This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Ada: fix compile time evaluation of Long_Florst'Succ (0.0)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]