This is the mail archive of the
mailing list for the GCC project.
Re: Ada: fix compile time evaluation of Long_Florst'Succ (0.0)
- From: ja2morri at csclub dot uwaterloo dot ca (James A. Morrison)
- To: Arnaud Charlet <charlet at ACT-Europe dot FR>
- Cc: gcc-patches at gcc dot gnu dot org, Geert Bosch <bosch at gnat dot com>
- Date: 21 Nov 2004 15:42:45 -0500
- Subject: Re: Ada: fix compile time evaluation of Long_Florst'Succ (0.0)
- References: <20041027095119.GC91230@province.act-europe.fr>
Arnaud Charlet <charlet@ACT-Europe.FR> writes:
> Tested on x86-linux
> This change fixes a bug in the compile-time evaluation of the
> Long_Float'Succ (0.0). Implementing Succ and Pred in terms of
> other standard attributes is preferable over using routines
> that try to do too much and whose specifications aren't as
> solid as those of the Ada attributes.
> Although the new implementation may be a bit slower (at
> compile time), this could easily be fixed by special casing
> various operations in urealp.adb. This small drawback is
> easily outweighed by the new approach taking 50 lines less
> code and producing correct answers on targets without
> gradual underflow.
> Test case:
> with Ada.Long_Float_Text_IO; use Ada.Long_Float_Text_IO;
> procedure T is
> X : Long_Float;
> X := Long_Float'Succ (0.0);
> Put (X);
> end T;
Is 4.94065645841247E-324 the expected answer? Is it good enough to have
any value between say 3.11111111e-324 and 6.999999999e-324 ?