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


> a.  Java has somewhat strict requirements for decimal-float conversion, and
> b.  We need gcc to do The Right Thing.
> 
> Neither of these can reasonably be disputed.

Well if you define "The Right Thing" to be what Java needs, fine, but then
this would be wrong for Ada, since Ada requires that float literals be
rounded away from infinity (0.5 always rounds up).

I don't know if any other languages are clearly defined. 

What about the handling of denormals?

Also note that this means that the Java requirements are different from
those of IEEE if you are stating them correctly, since IEEE specifically
does NOT require last bit accuracy for decimal conversions. To be exactly
last bit accurate throughout the range for decimal conversions is tricky,
it requires arbitrary precision arithmetic, far beyond anything that is
in the back end of GCC today.

(at least that's my best understanding from the algorithms available
a few years ago, perhaps there are new discoveries I am unaware of).

Also, the issue of what should be done on non-IEEE machines is not clear.
For example, on the Alpha, you probably do not want to generate denormal
literals by default.

I often find that in the Java world, people think that muttering the magic
incantation "IEEE 754" answers all questions. It does not, as the original
designers of Java (who created a language not practical to implement on the
x86) learned :-)


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