diff options
author | Robert Griesemer <gri@golang.org> | 2009-11-05 09:08:08 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2009-11-05 09:08:08 -0800 |
commit | 2f2d648553be9b2c3eae750e584f9a720e5b3f96 (patch) | |
tree | 6fce46a30b75ed69305bb8c0b887ca8e536693a9 /src/pkg/math | |
parent | 195b492f66b6372fc3964f191a664d1fccf55098 (diff) | |
download | golang-2f2d648553be9b2c3eae750e584f9a720e5b3f96.tar.gz |
gofmt-ify math, expvar, exp/spacewar
R=rsc
http://go/go-review/1018061
Diffstat (limited to 'src/pkg/math')
-rw-r--r-- | src/pkg/math/all_test.go | 4 | ||||
-rw-r--r-- | src/pkg/math/bits.go | 21 | ||||
-rw-r--r-- | src/pkg/math/unsafe.go | 1 |
3 files changed, 12 insertions, 14 deletions
diff --git a/src/pkg/math/all_test.go b/src/pkg/math/all_test.go index 9d899d1ce..066f89da8 100644 --- a/src/pkg/math/all_test.go +++ b/src/pkg/math/all_test.go @@ -5,8 +5,8 @@ package math_test import ( - . "math"; - "testing"; + . "math"; + "testing"; ) var vf = []float64{ diff --git a/src/pkg/math/bits.go b/src/pkg/math/bits.go index 00071aa0a..100d00623 100644 --- a/src/pkg/math/bits.go +++ b/src/pkg/math/bits.go @@ -5,12 +5,12 @@ package math const ( - uvnan = 0x7FF0000000000001; - uvinf = 0x7FF0000000000000; - uvneginf = 0xFFF0000000000000; - mask = 0x7FF; - shift = 64 - 11 - 1; - bias = 1022; + uvnan = 0x7FF0000000000001; + uvinf = 0x7FF0000000000000; + uvneginf = 0xFFF0000000000000; + mask = 0x7FF; + shift = 64-11-1; + bias = 1022; ) // Inf returns positive infinity if sign >= 0, negative infinity if sign < 0. @@ -32,7 +32,7 @@ func NaN() float64 { // IsNaN returns whether f is an IEEE 754 ``not-a-number'' value. func IsNaN(f float64) (is bool) { x := Float64bits(f); - return uint32(x>>shift) & mask == mask && x != uvinf && x != uvneginf; + return uint32(x>>shift)&mask == mask && x != uvinf && x != uvneginf; } // IsInf returns whether f is an infinity, according to sign. @@ -53,7 +53,7 @@ func Frexp(f float64) (frac float64, exp int) { return; } x := Float64bits(f); - exp = int((x>>shift)&mask) - bias; + exp = int((x>>shift)&mask)-bias; x &^= mask<<shift; x |= bias<<shift; frac = Float64frombits(x); @@ -64,7 +64,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 } @@ -99,7 +99,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; } - diff --git a/src/pkg/math/unsafe.go b/src/pkg/math/unsafe.go index cfc64634e..187dcc225 100644 --- a/src/pkg/math/unsafe.go +++ b/src/pkg/math/unsafe.go @@ -27,4 +27,3 @@ func Float64bits(f float64) uint64 { func Float64frombits(b uint64) float64 { return *(*float64)(unsafe.Pointer(&b)); } - |