From 2981fc7f1676ca79e487ba3c1df06e5e60723483 Mon Sep 17 00:00:00 2001 From: Dan Kortschak Date: Tue, 21 Dec 2021 21:49:50 +1030 Subject: [PATCH] math: don't use integer division that truncates to zero Change-Id: I7389da0c3a63fea3be5c820f2ce0d0168a95ab4c Reviewed-on: https://go-review.googlesource.com/c/go/+/373377 Trust: Emmanuel Odeke Run-TryBot: Emmanuel Odeke TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor --- src/math/all_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/math/all_test.go b/src/math/all_test.go index c11d823233..8d5e0ad439 100644 --- a/src/math/all_test.go +++ b/src/math/all_test.go @@ -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)}, -- 2.50.0