1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

math: inf,nan,fmod for the JS backend (#11246)

This commit is contained in:
playX
2021-08-20 01:14:49 +03:00
committed by GitHub
parent 70a658a265
commit 1570e613b5
10 changed files with 812 additions and 34 deletions

View File

@ -15,17 +15,6 @@ const (
frac_mask = ((u64(1) << u64(shift)) - u64(1))
)
// inf returns positive infinity if sign >= 0, negative infinity if sign < 0.
pub fn inf(sign int) f64 {
v := if sign >= 0 { math.uvinf } else { math.uvneginf }
return f64_from_bits(v)
}
// nan returns an IEEE 754 ``not-a-number'' value.
pub fn nan() f64 {
return f64_from_bits(math.uvnan)
}
// is_nan reports whether f is an IEEE 754 ``not-a-number'' value.
pub fn is_nan(f f64) bool {
// IEEE 754 says that only NaNs satisfy f != f.