Ada: fix compile time evaluation of Long_Florst'Succ (0.0)
James A. Morrison
ja2morri@csclub.uwaterloo.ca
Sun Nov 21 20:59:00 GMT 2004
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;
>
> begin
> 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 ?
--
Thanks,
Jim
http://www.student.cs.uwaterloo.ca/~ja2morri/
http://phython.blogspot.com
http://open.nit.ca/wiki/?page=jim
More information about the Gcc-patches
mailing list