Commit 1ae2eed0 authored by Ian Lance Taylor's avatar Ian Lance Taylor

math: test for pos/neg zero return of Ceil/Floor/Trunc

Ceil and Trunc of -0.2 return -0, not +0, but we didn't test that.

Updates #23647

Change-Id: Idbd4699376abfb4ca93f16c73c114d610d86a9f2
Reviewed-on: https://go-review.googlesource.com/91335
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent aa311fec
......@@ -128,7 +128,7 @@ var cbrt = []float64{
var ceil = []float64{
5.0000000000000000e+00,
8.0000000000000000e+00,
0.0000000000000000e+00,
Copysign(0, -1),
-5.0000000000000000e+00,
1.0000000000000000e+01,
3.0000000000000000e+00,
......@@ -644,7 +644,7 @@ var tanh = []float64{
var trunc = []float64{
4.0000000000000000e+00,
7.0000000000000000e+00,
-0.0000000000000000e+00,
Copysign(0, -1),
-5.0000000000000000e+00,
9.0000000000000000e+00,
2.0000000000000000e+00,
......@@ -2158,7 +2158,7 @@ func TestCbrt(t *testing.T) {
func TestCeil(t *testing.T) {
for i := 0; i < len(vf); i++ {
if f := Ceil(vf[i]); ceil[i] != f {
if f := Ceil(vf[i]); !alike(ceil[i], f) {
t.Errorf("Ceil(%g) = %g, want %g", vf[i], f, ceil[i])
}
}
......@@ -2385,7 +2385,7 @@ func TestDim(t *testing.T) {
func TestFloor(t *testing.T) {
for i := 0; i < len(vf); i++ {
if f := Floor(vf[i]); floor[i] != f {
if f := Floor(vf[i]); !alike(floor[i], f) {
t.Errorf("Floor(%g) = %g, want %g", vf[i], f, floor[i])
}
}
......@@ -2916,7 +2916,7 @@ func TestTanh(t *testing.T) {
func TestTrunc(t *testing.T) {
for i := 0; i < len(vf); i++ {
if f := Trunc(vf[i]); trunc[i] != f {
if f := Trunc(vf[i]); !alike(trunc[i], f) {
t.Errorf("Trunc(%g) = %g, want %g", vf[i], f, trunc[i])
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment