Browse Source

Fix NaN checks in core:math.classify

Currently the classify procedures checks for NaNs using the check `x != x`, which is always false for NaNs and therefore that case is never entered. Using `!(x == x)` will work on the other hand.
vassvik 5 years ago
parent
commit
2d97e1dee3
1 changed files with 2 additions and 2 deletions
  1. 2 2
      core/math/math.odin

+ 2 - 2
core/math/math.odin

@@ -469,7 +469,7 @@ classify_f32 :: proc(x: f32) -> Float_Class {
 			return .Neg_Inf;
 		}
 		return .Inf;
-	case x != x:
+	case !(x == x):
 		return .NaN;
 	}
 
@@ -493,7 +493,7 @@ classify_f64 :: proc(x: f64) -> Float_Class {
 			return .Neg_Inf;
 		}
 		return .Inf;
-	case x != x:
+	case !(x == x):
 		return .NaN;
 	}
 	u := transmute(u64)x;