From: Arnaud Charlet Date: Fri, 30 Oct 2020 15:17:29 +0000 (-0400) Subject: [Ada] Error in Big_Real comparison X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9df8679166e3dde5bdc45b5ed3289ffcab1b20f1;p=gcc.git [Ada] Error in Big_Real comparison gcc/ada/ * libgnat/a-nbnbre.adb ("=", "<"): Fix. --- 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 ---------- -- "<=" --