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]
Other format: [Raw text]

Re: real.c implementation


> That seems like a complete waste of effort.  Why not do it 
> correctly, once, in the right place?

Well in Ada, you are required in any case to implement multiple precision
real arithmetic at compile time, since it is required that static expressions
of arbitrary precision must be evaluated exactly. Furthremore, the rules
for the exact evaluation of things like the 'Machine attribute are very
precise and "do it correctly" is quite Ada specific. Finally, under no
circumstances can you rely on the assembler to convert decimal float
values accurately, since miscelleaneous assemblers cannot be trusted
to do that right.

> I am surprised that the Mercury compiler does not take the same approach.

The reason for my surprise is that if the Mercury spec requires this to be
"done right", I would have thought that you would not simply trust the
backend of GCC to do things right (in our experience, at least in GCC 2,
it for sure does not do the "right thing" for denormals in all situations).

Of course I am all in favor of doing things as right as possible in GCC.
But it would not surprise me if different front ends had subtly different
requirements. For example, an interesting issue is whether unbiased rounding
is required for literals. In Ada 95, you are required to do biased rounding
(0.5 ULP always rounding up) for literals, but I can easily see some other
language requiring unbiased rounding, and indeed there is a discussion that
this requirement of Ada should be changed :-)


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