Commit fb7178e7 authored by Caleb Spare's avatar Caleb Spare Committed by Minux Ma

runtime: copy sqrt normalization bugfix from math

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

Updates #13013

Change-Id: Id7d02e63d92806f06a4e064a91b2fb6574fe385f
Reviewed-on: https://go-review.googlesource.com/16291Reviewed-by: 's avatarMinux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 75a423a9
......@@ -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--
}
......
......@@ -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,
}
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