math: fix failing test on FreeBSD with gcc 12.2.0 (and -ffast-math) (#19278)

This commit is contained in:
Delyan Angelov 2023-09-06 07:30:46 +03:00 committed by GitHub
parent 639f128c1b
commit 3e93a13ed8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 68 additions and 21 deletions

View file

@ -29,6 +29,11 @@ pub fn nan() f64 {
// is_nan reports whether f is an IEEE 754 ``not-a-number'' value.
pub fn is_nan(f f64) bool {
$if fast_math {
if f64_bits(f) == math.uvnan {
return true
}
}
// IEEE 754 says that only NaNs satisfy f != f.
// To avoid the floating-point hardware, could use:
// x := f64_bits(f);