double rounding in x86
Michael Meissner
uunet!cygnus.com!meissner
Wed Aug 30 14:09:18 PDT 1995
| Besides its role in creating compiler nondeterminism in gcc-x86 (which
| can be fixed by the gcc team without *any* inconvenience or unpleasant
| surprises to the users), the use of long double under gcc has the
| further drawback that the implied precision is less predictable than
| that of either double or float. Whereas float and double always mean
| 32 and 64 bits respectively, long double means 80 bits on an x86 but
| only 64 bits on a Sun, Alpha (!), etc. where gcc treats long double as
| synonymous with double.
Speaking as a member of the GCC team, I believe your statement about
it being possible to fix GCC with *any* inconvenience or unpleasant
surprises to the users to be wrong. I can't see any real way of
fixing the various problems without making the code slower. In
particular, one of the problems is GCC spilling registers from the FPU
stack to memory and losing precision. It is certainly doable to store
and restore the numbers in 80 bit format when spilling registers,
which at least would prevent much of the nondeterminism. The problem
is that the extended store/load instructions take more cycles.
Another way is to set the machine PSW to evaluate everything in
double. This takes cycles also, and there is the chance that if you
leave the bit in 64-bit mode, it will break the OS libraries,
particularly printf and friends.
| Furthermore there is no point consulting people about changes intended
| to ameliorate gcc's execrably poor handling of extended precision until
| the gcc team shows signs of interest in working on extended precision
| problems. But I can't say I blame them for their lack of interest,
| they may justifiably perceive 80-bit precision as somewhere between a
| crock and a cruel hoax perpetrated on the scientific computing
| community.
GCC is free software. If it is important to you, and we're not doing
it, roll up your sleeves, and help us improve the software. I'm not
trying to be flip or insulting, but most things in GCC were done
because it was important to somebody.
--
Michael Meissner, Cygnus Support (East Coast)
Suite 105, 48 Grove Street, Somerville, MA 02144, USA
meissneracygnus.com, 617-629-3016 (office), 617-629-3010 (fax)
More information about the Numeric-interest
mailing list