This is the mail archive of the gcc@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]

Re: Draft "Unsafe fp optimizations" project description.


> with Text_IO; use Text_IO;
> procedure k is
>    a : float := -0.0;
>    b : float := +0.0;
> 
> begin
>    Put_Line (Float'Image (b - a));
>    Put_line (Float'Image (-b + a));

This should be

>    Put_line (Float'Image (-a + b));

if you want the expressions to be equivalent.

> end;
> 
> The output of this is
> 
>  0.00000E+00
> -0.00000E+00
> 
> This minus zero stuff is tricky!

I agree.


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