From 04b08da9af0c450d645ab7389d1467308cfc2db8 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 4 Mar 2013 21:27:36 +0100 Subject: Imported Upstream version 1.1~hg20130304 --- src/pkg/math/all_test.go | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/pkg/math/all_test.go') diff --git a/src/pkg/math/all_test.go b/src/pkg/math/all_test.go index ed66a42fb..0d8b10f67 100644 --- a/src/pkg/math/all_test.go +++ b/src/pkg/math/all_test.go @@ -1128,11 +1128,11 @@ var vfgammaSC = []float64{ NaN(), } var gammaSC = []float64{ + NaN(), + NaN(), Inf(-1), Inf(1), Inf(1), - Inf(1), - Inf(1), NaN(), } @@ -1693,6 +1693,17 @@ func alike(a, b float64) bool { return false } +func TestNaN(t *testing.T) { + f64 := NaN() + if f64 == f64 { + t.Fatalf("NaN() returns %g, expected NaN", f64) + } + f32 := float32(f64) + if f32 == f32 { + t.Fatalf("float32(NaN()) is %g, expected NaN", f32) + } +} + func TestAcos(t *testing.T) { for i := 0; i < len(vf); i++ { a := vf[i] / 10 @@ -2270,6 +2281,13 @@ func TestLog2(t *testing.T) { t.Errorf("Log2(%g) = %g, want %g", vflogSC[i], f, logSC[i]) } } + for i := -1074; i <= 1023; i++ { + f := Ldexp(1, i) + l := Log2(f) + if l != float64(i) { + t.Errorf("Log2(2**%d) = %g, want %d", i, l, i) + } + } } func TestModf(t *testing.T) { -- cgit v1.2.3