Skip to content

Commit

Permalink
cmd/compile/internal/gc: correctly use Float32 in mpgetfltN
Browse files Browse the repository at this point in the history
This resolves the compiler part of issue golang#10321.

Change-Id: I44b9909f992b37dd34b1c5292decd12de3d3a65e
Reviewed-on: https://go-review.googlesource.com/10355
Reviewed-by: Alan Donovan <[email protected]>
  • Loading branch information
griesemer committed May 22, 2015
1 parent 1c0498f commit bd7c1f1
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/cmd/compile/internal/gc/mparith3.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,8 @@ func mpgetfltN(a *Mpflt, prec int, bias int) float64 {
case 53:
x, _ = a.Val.Float64()
case 24:
// We should be using a.Val.Float32() here but that seems incorrect
// for certain denormal values (all.bash fails). The current code
// 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()
x32, _ := a.Val.Float32()
x = float64(x32)
default:
panic("unreachable")
}
Expand Down

0 comments on commit bd7c1f1

Please sign in to comment.