]> Cypherpunks repositories - gostls13.git/commitdiff
math: don't use integer division that truncates to zero
authorDan Kortschak <dan@kortschak.io>
Tue, 21 Dec 2021 11:19:50 +0000 (21:49 +1030)
committerIan Lance Taylor <iant@golang.org>
Sat, 5 Mar 2022 21:19:15 +0000 (21:19 +0000)
Change-Id: I7389da0c3a63fea3be5c820f2ce0d0168a95ab4c
Reviewed-on: https://go-review.googlesource.com/c/go/+/373377
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/math/all_test.go

index c11d823233148890fa729294a43ee93cc7131d9f..8d5e0ad4391c1e0e215315997aff1f0dfbb03cd6 100644 (file)
@@ -1631,8 +1631,8 @@ var vfpowSC = [][2]float64{
        {-1, Inf(-1)},
        {-1, Inf(1)},
        {-1, NaN()},
-       {-1 / 2, Inf(-1)},
-       {-1 / 2, Inf(1)},
+       {-0.5, Inf(-1)},
+       {-0.5, Inf(1)},
        {Copysign(0, -1), Inf(-1)},
        {Copysign(0, -1), -Pi},
        {Copysign(0, -1), -0.5},
@@ -1652,8 +1652,8 @@ var vfpowSC = [][2]float64{
        {0, Inf(1)},
        {0, NaN()},
 
-       {1 / 2, Inf(-1)},
-       {1 / 2, Inf(1)},
+       {0.5, Inf(-1)},
+       {0.5, Inf(1)},
        {1, Inf(-1)},
        {1, Inf(1)},
        {1, NaN()},
@@ -1681,8 +1681,8 @@ var vfpowSC = [][2]float64{
        {2, float64(1 << 32)},
        {2, -float64(1 << 32)},
        {-2, float64(1<<32 + 1)},
-       {1 / 2, float64(1 << 45)},
-       {1 / 2, -float64(1 << 45)},
+       {0.5, float64(1 << 45)},
+       {0.5, -float64(1 << 45)},
        {Nextafter(1, 2), float64(1 << 63)},
        {Nextafter(1, -2), float64(1 << 63)},
        {Nextafter(-1, 2), float64(1 << 63)},