This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: rs6000: floating point cast oddities?
- From: dewar at gnat dot com
- To: rth at redhat dot com, torvalds at transmeta dot com
- Cc: dalej at apple dot com, gcc at gcc dot gnu dot org
- Date: Mon, 17 Dec 2001 21:42:20 -0500 (EST)
- Subject: Re: rs6000: floating point cast oddities?
>>Who's the IEEE expert?
The IEEE report itself has nothing to say about how C maps to IEEE
operations, it is a hardware/software standard that dictates that a
certain set of operations should be available (all these operatoins are
a
available or easily implemented on the 8087, though it is true that the
extra stores to check magnitude if this is required are annoying. Note
that you can set the precision you want on the chip, so it is not
necessary to do store/load sequences. You just need a store to verify
the range (if you work in trapping mode, as is perfectly reasonable,
you can get the trap on the store -- if you wanted to work a bit
harder, the trap routine could go back and install an infinity result,
but that would be quite a lot of work).
Linus said
<<it does _not_ follow that you can do
float + float + float = (float) ((double) float + (double) float + (doub
le) float)
because doing two operations in double and then rounding only once is
different from doing them in float and rounding in between.
>>
I must be confused, I thought that the C standard
specified that all intermediate calculations were done in doulbe precision,
is this a misunderstanding?
There is also a section in the latest C standard on mapping to IEEE, and
that is actually what should be consulted here, rather than the IEEE standard itself.