rs6000: floating point cast oddities?
dewar@gnat.com
dewar@gnat.com
Mon Dec 17 18:44:00 GMT 2001
>>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.
More information about the Gcc
mailing list