Skip to content

Commit 8ec718f

Browse files
committed
nan comparison fix with tests
1 parent a27507e commit 8ec718f

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/ProvidedTypes.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14003,12 +14003,12 @@ namespace ProviderImplementation.ProvidedTypes
1400314003
emitExpr ExpectedStackState.Value a2
1400414004
match t1 with
1400514005
| Bool | SByte | Char
14006-
| Double | Single
1400714006
| Int16 | Int32 | Int64 ->
1400814007
ilg.Emit(I_cgt)
1400914008
emitExpr ExpectedStackState.Value <@@ false @@>
1401014009
ilg.Emit(I_ceq)
1401114010
| Byte
14011+
| Double | Single
1401214012
| UInt16 | UInt32 | UInt64 ->
1401314013
ilg.Emit(I_cgt_un)
1401414014
emitExpr ExpectedStackState.Value <@@ false @@>
@@ -14029,12 +14029,12 @@ namespace ProviderImplementation.ProvidedTypes
1402914029
emitExpr ExpectedStackState.Value a2
1403014030
match t1 with
1403114031
| Bool | SByte | Char
14032-
| Double | Single
1403314032
| Int16 | Int32 | Int64 ->
1403414033
ilg.Emit(I_clt)
1403514034
emitExpr ExpectedStackState.Value <@@ false @@>
1403614035
ilg.Emit(I_ceq)
1403714036
| Byte
14037+
| Double | Single
1403814038
| UInt16 | UInt32 | UInt64 ->
1403914039
ilg.Emit(I_clt_un)
1404014040
emitExpr ExpectedStackState.Value <@@ false @@>

tests/GernatedOpTests.fs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,9 @@ let ``eq execute correctly``() =
560560
checkExpr <@ 1.0 = 1.0 @>
561561
checkExpr <@ 2.0 = 1.0 @>
562562
checkExpr <@ 1.0 = 2.0 @>
563+
checkExpr <@ 1.0 = nan @>
564+
checkExpr <@ nan = nan @>
565+
checkExpr <@ nan = 1.0 @>
563566
checkExpr <@ 1.f = 1.f @>
564567
checkExpr <@ 2.f = 1.f @>
565568
checkExpr <@ 1.f = 2.f @>
@@ -613,6 +616,9 @@ let ``lt execute correctly``() =
613616
checkExpr <@ 1.0 < 1.0 @>
614617
checkExpr <@ 2.0 < 1.0 @>
615618
checkExpr <@ 1.0 < 2.0 @>
619+
checkExpr <@ 1.0 < nan @>
620+
checkExpr <@ nan < nan @>
621+
checkExpr <@ nan < 1.0 @>
616622
checkExpr <@ 1.f < 1.f @>
617623
checkExpr <@ 2.f < 1.f @>
618624
checkExpr <@ 1.f < 2.f @>
@@ -666,6 +672,9 @@ let ``lte execute correctly``() =
666672
checkExpr <@ 1.0 <= 1.0 @>
667673
checkExpr <@ 2.0 <= 1.0 @>
668674
checkExpr <@ 1.0 <= 2.0 @>
675+
checkExpr <@ 1.0 <= nan @>
676+
checkExpr <@ nan <= nan @>
677+
checkExpr <@ nan <= 1.0 @>
669678
checkExpr <@ 1.f <= 1.f @>
670679
checkExpr <@ 2.f <= 1.f @>
671680
checkExpr <@ 1.f <= 2.f @>
@@ -718,6 +727,9 @@ let ``gt execute correctly``() =
718727
checkExpr <@ 1.0 > 1.0 @>
719728
checkExpr <@ 2.0 > 1.0 @>
720729
checkExpr <@ 1.0 > 2.0 @>
730+
checkExpr <@ 1.0 > nan @>
731+
checkExpr <@ nan > nan @>
732+
checkExpr <@ nan > 1.0 @>
721733
checkExpr <@ 1.f > 1.f @>
722734
checkExpr <@ 2.f > 1.f @>
723735
checkExpr <@ 1.f > 2.f @>
@@ -770,6 +782,9 @@ let ``gte execute correctly``() =
770782
checkExpr <@ 1.0 >= 1.0 @>
771783
checkExpr <@ 2.0 >= 1.0 @>
772784
checkExpr <@ 1.0 >= 2.0 @>
785+
checkExpr <@ 1.0 >= nan @>
786+
checkExpr <@ nan >= nan @>
787+
checkExpr <@ nan >= 1.0 @>
773788
checkExpr <@ 1.f >= 1.f @>
774789
checkExpr <@ 2.f >= 1.f @>
775790
checkExpr <@ 1.f >= 2.f @>

0 commit comments

Comments
 (0)