Commit bd7c1f1f authored by Robert Griesemer's avatar Robert Griesemer

cmd/compile/internal/gc: correctly use Float32 in mpgetfltN

This resolves the compiler part of issue #10321.

Change-Id: I44b9909f992b37dd34b1c5292decd12de3d3a65e
Reviewed-on: https://go-review.googlesource.com/10355Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
parent 1c0498fc
...@@ -111,15 +111,8 @@ func mpgetfltN(a *Mpflt, prec int, bias int) float64 { ...@@ -111,15 +111,8 @@ func mpgetfltN(a *Mpflt, prec int, bias int) float64 {
case 53: case 53:
x, _ = a.Val.Float64() x, _ = a.Val.Float64()
case 24: case 24:
// We should be using a.Val.Float32() here but that seems incorrect x32, _ := a.Val.Float32()
// for certain denormal values (all.bash fails). The current code x = float64(x32)
// appears to work for all existing test cases, though there ought
// to be issues with denormal numbers that are incorrectly rounded.
// TODO(gri) replace with a.Val.Float32() once correctly working
// See also: https://github.com/golang/go/issues/10321
var t Mpflt
t.Val.SetPrec(24).Set(&a.Val)
x, _ = t.Val.Float64()
default: default:
panic("unreachable") panic("unreachable")
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment