This commit is contained in:
Mauri de Souza Meneguzzo 2025-06-20 15:37:19 -04:00 committed by GitHub
commit b70b4ccaae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -162,7 +162,7 @@ func quotToFloat32(stk *stack, a, b nat) (f float32, exact bool) {
mantissa >>= 1 // discard rounding bit. Mantissa now scaled by 1<<Msize1.
f = float32(math.Ldexp(float64(mantissa), exp-Msize1))
if math.IsInf(float64(f), 0) {
if math.IsInf(float64(f), 0) || f == 0 {
exact = false
}
return
@ -260,7 +260,7 @@ func quotToFloat64(stk *stack, a, b nat) (f float64, exact bool) {
mantissa >>= 1 // discard rounding bit. Mantissa now scaled by 1<<Msize1.
f = math.Ldexp(float64(mantissa), exp-Msize1)
if math.IsInf(f, 0) {
if math.IsInf(f, 0) || f == 0 {
exact = false
}
return

View File

@ -466,6 +466,11 @@ var float64inputs = []string{
"-1152921504606846977", // -(1<<60 + 1)
"1/3",
"170141183460469231731687303715884105728p-48317",
"0000000000000000000000000000031768211457p-9818716",
"00000000000000000000000000000000000000000000000000000000001662320182p-801401",
"818p-8818873",
}
// isFinite reports whether f represents a finite rational value.