Skip to content

Commit da3f40a

Browse files
committed
Create a test that shows broken comparison on float32
1 parent d7274c6 commit da3f40a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/FSharp.Core.UnitTests/FSharp.Core/PrimTypes.fs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,3 +816,16 @@ type RangeTests() =
816816
if System.UIntPtr.Size >= 8 then RangeTestsHelpers.unsigned (System.UIntPtr System.UInt64.MinValue) (System.UIntPtr System.UInt64.MaxValue)
817817

818818

819+
open NonStructuralComparison
820+
821+
822+
[<TestFixture>]
823+
type NonStructuralComparisonTests() =
824+
825+
[<Test>]
826+
member __.CompareFloat32() = // https://github.com/Microsoft/visualfsharp/pull/4493
827+
828+
let x = 32 |> float32
829+
let y = 32 |> float32
830+
let comparison = compare x y
831+
Assert.AreEqual(0, comparison)

0 commit comments

Comments
 (0)