From 9df8679166e3dde5bdc45b5ed3289ffcab1b20f1 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 30 Oct 2020 11:17:29 -0400 Subject: [PATCH] [Ada] Error in Big_Real comparison gcc/ada/ * libgnat/a-nbnbre.adb ("=", "<"): Fix. --- gcc/ada/libgnat/a-nbnbre.adb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/ada/libgnat/a-nbnbre.adb b/gcc/ada/libgnat/a-nbnbre.adb index ff5b4488381..e5d810e4db5 100644 --- a/gcc/ada/libgnat/a-nbnbre.adb +++ b/gcc/ada/libgnat/a-nbnbre.adb @@ -29,8 +29,6 @@ -- -- ------------------------------------------------------------------------------ --- This is the default version of this package, based on Big_Integers only. - with Ada.Strings.Text_Output.Utils; with System.Img_Real; use System.Img_Real; @@ -85,14 +83,16 @@ package body Ada.Numerics.Big_Numbers.Big_Reals is --------- function "=" (L, R : Valid_Big_Real) return Boolean is - (abs L.Num = abs R.Num and then L.Den = R.Den); + (L.Num = R.Num and then L.Den = R.Den); --------- -- "<" -- --------- function "<" (L, R : Valid_Big_Real) return Boolean is - (abs L.Num * R.Den < abs R.Num * L.Den); + (L.Num * R.Den < R.Num * L.Den); + -- The denominator is guaranteed to be positive since Normalized is + -- always called when constructing a Valid_Big_Real ---------- -- "<=" -- -- 2.30.2