From a60f7228380989d04000bda7e519edc2ab901784 Mon Sep 17 00:00:00 2001 From: Mauri de Souza Meneguzzo Date: Sat, 22 Jul 2023 20:50:41 -0300 Subject: [PATCH] math/big: handle additional edge cases for Rat New special cases have been added to the Rat testcases. Updated the function quotToFloat32/64 to check for zero as well when determining if the value is infinite. This change ensures that the exact flag is correctly set for these edge cases, preventing test failures. Thanks Johan Jansons (@jupj) for the proposed fix on the ticket description. Fixes: #56164 --- src/math/big/rat.go | 4 ++-- src/math/big/ratconv_test.go | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/math/big/rat.go b/src/math/big/rat.go index 700a643265..75a3e39b8c 100644 --- a/src/math/big/rat.go +++ b/src/math/big/rat.go @@ -162,7 +162,7 @@ func quotToFloat32(a, b nat) (f float32, exact bool) { mantissa >>= 1 // discard rounding bit. Mantissa now scaled by 1<>= 1 // discard rounding bit. Mantissa now scaled by 1<