diff options
Diffstat (limited to 'src/pkg/math')
-rw-r--r-- | src/pkg/math/all_test.go | 8 | ||||
-rw-r--r-- | src/pkg/math/bits.go | 4 | ||||
-rw-r--r-- | src/pkg/math/floor.go | 4 | ||||
-rw-r--r-- | src/pkg/math/sin.go | 4 | ||||
-rw-r--r-- | src/pkg/math/unsafe.go | 16 |
5 files changed, 9 insertions, 27 deletions
diff --git a/src/pkg/math/all_test.go b/src/pkg/math/all_test.go index 066f89da8..06c5be200 100644 --- a/src/pkg/math/all_test.go +++ b/src/pkg/math/all_test.go @@ -168,12 +168,8 @@ func tolerance(a, b, e float64) bool { } return d < e; } -func close(a, b float64) bool { - return tolerance(a, b, 1e-14); -} -func veryclose(a, b float64) bool { - return tolerance(a, b, 4e-16); -} +func close(a, b float64) bool { return tolerance(a, b, 1e-14) } +func veryclose(a, b float64) bool { return tolerance(a, b, 4e-16) } func TestAsin(t *testing.T) { for i := 0; i < len(vf); i++ { diff --git a/src/pkg/math/bits.go b/src/pkg/math/bits.go index 100d00623..3084ed508 100644 --- a/src/pkg/math/bits.go +++ b/src/pkg/math/bits.go @@ -25,9 +25,7 @@ func Inf(sign int) float64 { } // NaN returns an IEEE 754 ``not-a-number'' value. -func NaN() float64 { - return Float64frombits(uvnan); -} +func NaN() float64 { return Float64frombits(uvnan) } // IsNaN returns whether f is an IEEE 754 ``not-a-number'' value. func IsNaN(f float64) (is bool) { diff --git a/src/pkg/math/floor.go b/src/pkg/math/floor.go index 7f2c9111d..cb3110fb2 100644 --- a/src/pkg/math/floor.go +++ b/src/pkg/math/floor.go @@ -19,6 +19,4 @@ func Floor(x float64) float64 { } // Ceil returns the least integer value greater than or equal to x. -func Ceil(x float64) float64 { - return -Floor(-x); -} +func Ceil(x float64) float64 { return -Floor(-x) } diff --git a/src/pkg/math/sin.go b/src/pkg/math/sin.go index 973aef554..740d6778b 100644 --- a/src/pkg/math/sin.go +++ b/src/pkg/math/sin.go @@ -58,6 +58,4 @@ func Cos(x float64) float64 { } // Sin returns the sine of x. -func Sin(x float64) float64 { - return sinus(x, 0); -} +func Sin(x float64) float64 { return sinus(x, 0) } diff --git a/src/pkg/math/unsafe.go b/src/pkg/math/unsafe.go index 187dcc225..182b2e13b 100644 --- a/src/pkg/math/unsafe.go +++ b/src/pkg/math/unsafe.go @@ -7,23 +7,15 @@ package math import "unsafe" // Float32bits returns the IEEE 754 binary representation of f. -func Float32bits(f float32) uint32 { - return *(*uint32)(unsafe.Pointer(&f)); -} +func Float32bits(f float32) uint32 { return *(*uint32)(unsafe.Pointer(&f)) } // Float32frombits returns the floating point number corresponding // to the IEEE 754 binary representation b. -func Float32frombits(b uint32) float32 { - return *(*float32)(unsafe.Pointer(&b)); -} +func Float32frombits(b uint32) float32 { return *(*float32)(unsafe.Pointer(&b)) } // Float64bits returns the IEEE 754 binary representation of f. -func Float64bits(f float64) uint64 { - return *(*uint64)(unsafe.Pointer(&f)); -} +func Float64bits(f float64) uint64 { return *(*uint64)(unsafe.Pointer(&f)) } // Float64frombits returns the floating point number corresponding // the IEEE 754 binary representation b. -func Float64frombits(b uint64) float64 { - return *(*float64)(unsafe.Pointer(&b)); -} +func Float64frombits(b uint64) float64 { return *(*float64)(unsafe.Pointer(&b)) } |