diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-01-17 12:40:45 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-01-17 12:40:45 +0100 |
commit | 3e45412327a2654a77944249962b3652e6142299 (patch) | |
tree | bc3bf69452afa055423cbe0c5cfa8ca357df6ccf /src/pkg/math/sqrt_port.go | |
parent | c533680039762cacbc37db8dc7eed074c3e497be (diff) | |
download | golang-upstream/2011.01.12.tar.gz |
Imported Upstream version 2011.01.12upstream/2011.01.12
Diffstat (limited to 'src/pkg/math/sqrt_port.go')
-rw-r--r-- | src/pkg/math/sqrt_port.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pkg/math/sqrt_port.go b/src/pkg/math/sqrt_port.go index 8d821b559..6f35a383d 100644 --- a/src/pkg/math/sqrt_port.go +++ b/src/pkg/math/sqrt_port.go @@ -113,7 +113,7 @@ func sqrtGo(x float64) float64 { } exp++ } - exp -= bias + 1 // unbias exponent + exp -= bias // unbias exponent ix &^= mask << shift ix |= 1 << shift if exp&1 == 1 { // odd exp, double x to make it even @@ -138,6 +138,6 @@ func sqrtGo(x float64) float64 { if ix != 0 { // remainder, result not exact q += q & 1 // round according to extra bit } - ix = q>>1 + uint64(exp+bias)<<shift // significand + biased exponent + ix = q>>1 + uint64(exp-1+bias)<<shift // significand + biased exponent return Float64frombits(ix) } |