summaryrefslogtreecommitdiff
path: root/src/pkg/math/frexp.go
diff options
context:
space:
mode:
authorEoghan Sherry <ejsherry@gmail.com>2010-12-15 13:20:52 -0500
committerEoghan Sherry <ejsherry@gmail.com>2010-12-15 13:20:52 -0500
commitda50596fd84dda255cc9a486921d5c94fa947393 (patch)
treec4fe3cd38b4a90e0e0af072fc084a16606633978 /src/pkg/math/frexp.go
parent48778d08a220c2a93a81ca7e527650d899dab105 (diff)
downloadgo-da50596fd84dda255cc9a486921d5c94fa947393.tar.gz
math: change float64 bias constant from 1022 to 1023
This makes some subtle code easier to understand. R=rsc CC=golang-dev http://codereview.appspot.com/3444043 Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/pkg/math/frexp.go')
-rw-r--r--src/pkg/math/frexp.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pkg/math/frexp.go b/src/pkg/math/frexp.go
index b63b508e6..203219c0d 100644
--- a/src/pkg/math/frexp.go
+++ b/src/pkg/math/frexp.go
@@ -19,9 +19,9 @@ func Frexp(f float64) (frac float64, exp int) {
return f, 0
}
x := Float64bits(f)
- exp = int((x>>shift)&mask) - bias
+ exp = int((x>>shift)&mask) - bias + 1
x &^= mask << shift
- x |= bias << shift
+ x |= (-1 + bias) << shift
frac = Float64frombits(x)
return
}