mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-02 03:02:37 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user