summaryrefslogtreecommitdiff
path: root/src/pkg/math/bits.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-11-09 21:23:52 -0800
committerRobert Griesemer <gri@golang.org>2009-11-09 21:23:52 -0800
commit120abb1469d005f13783b5c7d1bc9c77591cfa09 (patch)
treec515081857e0b9ad897c6d35b0be64fe4c346688 /src/pkg/math/bits.go
parenteaaa68b0ca76b27c2d8eb245d6d1a543fbde0e5b (diff)
downloadgo-120abb1469d005f13783b5c7d1bc9c77591cfa09.tar.gz
- replaced gofmt expression formatting algorithm with
rsc's algorithm - applied gofmt -w misc src - partial CL (last chunk) R=rsc, r http://go/go-review/1024041
Diffstat (limited to 'src/pkg/math/bits.go')
-rw-r--r--src/pkg/math/bits.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/pkg/math/bits.go b/src/pkg/math/bits.go
index b1bf2da46..5372c6806 100644
--- a/src/pkg/math/bits.go
+++ b/src/pkg/math/bits.go
@@ -9,7 +9,7 @@ const (
uvinf = 0x7FF0000000000000;
uvneginf = 0xFFF0000000000000;
mask = 0x7FF;
- shift = 64-11-1;
+ shift = 64 - 11 - 1;
bias = 1022;
)
@@ -51,9 +51,9 @@ func Frexp(f float64) (frac float64, exp int) {
return
}
x := Float64bits(f);
- exp = int((x>>shift)&mask)-bias;
- x &^= mask<<shift;
- x |= bias<<shift;
+ exp = int((x>>shift)&mask) - bias;
+ x &^= mask << shift;
+ x |= bias << shift;
frac = Float64frombits(x);
return;
}
@@ -62,7 +62,7 @@ func Frexp(f float64) (frac float64, exp int) {
// It returns frac × 2<sup>exp</sup>.
func Ldexp(frac float64, exp int) float64 {
x := Float64bits(frac);
- exp += int(x>>shift)&mask;
+ exp += int(x>>shift) & mask;
if exp <= 0 {
return 0 // underflow
}
@@ -72,8 +72,8 @@ func Ldexp(frac float64, exp int) float64 {
}
return Inf(1);
}
- x &^= mask<<shift;
- x |= uint64(exp)<<shift;
+ x &^= mask << shift;
+ x |= uint64(exp) << shift;
return Float64frombits(x);
}
@@ -97,6 +97,6 @@ func Modf(f float64) (int float64, frac float64) {
x &^= 1<<(64-11-e) - 1
}
int = Float64frombits(x);
- frac = f-int;
+ frac = f - int;
return;
}