1
0
mirror of https://github.com/golang/go synced 2024-11-18 09:34:53 -07:00

runtime: copy sqrt normalization bugfix from math

This copies the change from CL 16158 (applied as
22d4c8bf13).

Updates #13013

Change-Id: Id7d02e63d92806f06a4e064a91b2fb6574fe385f
Reviewed-on: https://go-review.googlesource.com/16291
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Caleb Spare 2015-10-23 14:49:56 -07:00 committed by Minux Ma
parent 75a423a983
commit fb7178e7cc
2 changed files with 3 additions and 1 deletions

View File

@ -117,7 +117,7 @@ func sqrt(ix uint64) uint64 {
// normalize x
exp := int((ix >> float64Shift) & float64Mask)
if exp == 0 { // subnormal x
for ix&1<<float64Shift == 0 {
for ix&(1<<float64Shift) == 0 {
ix <<= 1
exp--
}

View File

@ -74,6 +74,7 @@ var vfsqrtSC = []float64{
0,
math.Inf(1),
math.NaN(),
math.Float64frombits(2),
}
var sqrtSC = []float64{
math.NaN(),
@ -82,4 +83,5 @@ var sqrtSC = []float64{
0,
math.Inf(1),
math.NaN(),
3.1434555694052576e-162,
}