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.
This commit is contained in:
vassvik
2019-12-12 19:12:12 +01:00
committed by GitHub
parent be2dfd42fd
commit 2d97e1dee3

View File

@@ -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;