Skip to content

Commit 4bd266e

Browse files
committed
Fix conversion test cases
1 parent 8e32e71 commit 4bd266e

File tree

1 file changed

+6
-6
lines changed
  • src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Numerics

1 file changed

+6
-6
lines changed

src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Numerics/BFloat16Tests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ public static IEnumerable<object[]> ExplicitConversion_ToSingle_TestData()
146146
(UInt16BitsToBFloat16(0b1_01111111_0000000), -1f), // -1
147147
(BFloat16.MaxValue, BitConverter.UInt32BitsToSingle(0x7F7F0000)), // 3.3895314E+38
148148
(BFloat16.MinValue, BitConverter.UInt32BitsToSingle(0xFF7F0000)), // -3.3895314E+38
149-
(UInt16BitsToBFloat16(0b0_01111011_1001100), 0.099609375f), // 0.1ish
150-
(UInt16BitsToBFloat16(0b1_01111011_1001100), -0.099609375f), // -0.1ish
149+
(UInt16BitsToBFloat16(0b0_01111011_1001101), 0.10009765625f), // 0.1ish
150+
(UInt16BitsToBFloat16(0b1_01111011_1001101), -0.10009765625f), // -0.1ish
151151
(UInt16BitsToBFloat16(0b0_10000100_0101000), 42f), // 42
152152
(UInt16BitsToBFloat16(0b1_10000100_0101000), -42f), // -42
153153
// (BFloat16.PositiveInfinity, float.PositiveInfinity), // PosInfinity
@@ -173,7 +173,7 @@ public static IEnumerable<object[]> ExplicitConversion_ToSingle_TestData()
173173
(UInt16BitsToBFloat16(0b0_00000000_0111111), BitConverter.UInt32BitsToSingle(0x003F0000)), // just below middle subnormal
174174
(UInt16BitsToBFloat16(0b0_00000000_0000001), BitConverter.UInt32BitsToSingle(0x00010000)), // smallest subnormal
175175
(UInt16BitsToBFloat16(0b1_00000000_0000001), BitConverter.UInt32BitsToSingle(0x80010000)), // highest negative subnormal
176-
(UInt16BitsToBFloat16(0b1_00000000_0111111), BitConverter.UInt32BitsToSingle(0x803F8000)), // just above negative middle subnormal
176+
(UInt16BitsToBFloat16(0b1_00000000_0111111), BitConverter.UInt32BitsToSingle(0x803F0000)), // just above negative middle subnormal
177177
(UInt16BitsToBFloat16(0b1_00000000_1000000), BitConverter.UInt32BitsToSingle(0x80400000)), // negative middle subnormal
178178
(UInt16BitsToBFloat16(0b1_00000000_1111111), BitConverter.UInt32BitsToSingle(0x807F0000)), // lowest negative subnormal
179179
(UInt16BitsToBFloat16(0b1_00000001_0000000), BitConverter.UInt32BitsToSingle(0x80800000)) // highest negative normal
@@ -216,16 +216,16 @@ public static IEnumerable<object[]> ExplicitConversion_FromSingle_TestData()
216216
(-0f, UInt16BitsToBFloat16(0b1_00000000_0000000)), // -0
217217
(42f, UInt16BitsToBFloat16(0b0_10000100_0101000)), // 42
218218
(-42f, UInt16BitsToBFloat16(0b1_10000100_0101000)), // -42
219-
(0.1f, UInt16BitsToBFloat16(0b0_01111011_1001100)), // 0.0999755859375
220-
(-0.1f, UInt16BitsToBFloat16(0b1_01111011_1001100)), // -0.0999755859375
219+
(0.1f, UInt16BitsToBFloat16(0b0_01111011_1001101)), // 0.10009765625
220+
(-0.1f, UInt16BitsToBFloat16(0b1_01111011_1001101)), // -0.10009765625
221221
(1.5f, UInt16BitsToBFloat16(0b0_01111111_1000000)), // 1.5
222222
(-1.5f, UInt16BitsToBFloat16(0b1_01111111_1000000)), // -1.5
223223
(1.5078125f, UInt16BitsToBFloat16(0b0_01111111_1000001)), // 1.5078125
224224
(-1.5078125f, UInt16BitsToBFloat16(0b1_01111111_1000001)), // -1.5078125
225225
(BitConverter.UInt32BitsToSingle(0x00800000), UInt16BitsToBFloat16(0b0_00000001_0000000)), // smallest normal
226226
(BitConverter.UInt32BitsToSingle(0x007F0000), UInt16BitsToBFloat16(0b0_00000000_1111111)), // largest subnormal
227227
(BitConverter.UInt32BitsToSingle(0x00400000), UInt16BitsToBFloat16(0b0_00000000_1000000)), // middle subnormal
228-
(BitConverter.UInt32BitsToSingle(0x003F8000), UInt16BitsToBFloat16(0b0_00000000_0111111)), // just below middle subnormal
228+
(BitConverter.UInt32BitsToSingle(0x003F0000), UInt16BitsToBFloat16(0b0_00000000_0111111)), // just below middle subnormal
229229
(BitConverter.UInt32BitsToSingle(0x00010000), UInt16BitsToBFloat16(0b0_00000000_0000001)), // smallest subnormal
230230
(BitConverter.UInt32BitsToSingle(0x80010000), UInt16BitsToBFloat16(0b1_00000000_0000001)), // highest negative subnormal
231231
(BitConverter.UInt32BitsToSingle(0x803F0000), UInt16BitsToBFloat16(0b1_00000000_0111111)), // just above negative middle subnormal

0 commit comments

Comments
 (0)