Re: floating-point operations on modern hardware



kevinclancy_@xxxxxxxxxxx wrote:
I would like to know what algorithms modern computer hardware
(specifically the Pentium IV) uses to perform floating-point
arithmetic operations. Can anyone forward me to an official document
that contains this information? If not, could you give me a maximum
error bound for the basic operations? (+,-,*,/) I tried to find this
information in the IEEE 754, but the link to the IEEE 754 document on
IEEE's website is broken.

I have tried coding my own floating-point numbers using fixed-point
integers to represent the exponent and mantissa. I have tried to
implement the operations such that they return the closest
representable floating-point value to the ideal result. My solution is
very straightforward, but I'm not sure if it's the same algorithm that
my computer is using. The results of my operations tend to be slightly
different from the results computed in hardware. Could this be a
rounding error on my part? It would help a lot if I knew the
hardware's expected error from ideals.

Thanks in advance,
Kevin


The pentium 4 hardware has registers internally for floating point
calculations that have more precision that an IEEE754 double. This means
that if the optimizer kept your calculation in the registers between
intermediate steps then you might find that you have excess precision
with your pentium 4 relative to your own fixed point implementation. The
optimizer will do this to avoid a copy from the register to memory and
another back from the memory to the register.

If you are using a Gnu compiler, look at the "-float-store" option that
forces all intermediate steps of the calculations into memory. You
should then have fully IEEE754 conformant floating point math..

D.
.



Relevant Pages

  • Re: Print statement within If-Then block changes output!!!????
    ... Presuming that Colin's conclusion that this isn't the usual sort of out-of-bounds error causing that problem, and that it is in fact a compiler bug, I think I've got a fair guess which exactly compiler bug it is, because I've run into it in exactly this situation: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323. ... The short version is of the bug this: The Intel floating-point system has 80-bit floating-point registers, but has only 64-bit floating-point storage. ... Thus, there are cases where, if a value is stored in memory, its value will be slightly different than if its kept in a register. ...
    (comp.lang.fortran)
  • Re: floating-point operations on modern hardware
    ... (specifically the Pentium IV) ... arithmetic operations. ... I have tried coding my own floating-point numbers using fixed-point ... formal you should refer to the current international standard. ...
    (sci.math.num-analysis)
  • Re: Either 64bit mode or floating-point ?
    ... 64-Bit Media and x87 Floating-Point Instructions ... MMX registers. ...
    (comp.lang.asm.x86)
  • Re: Function ieee_value( r, IEEE_SIGNALING_NAN )
    ... Any compiler implementor worth his salt could make the ... to go through the floating-point registers. ... reference in the example should be a signaling NaN. ... It is easy to store a signaling NaN into a floating-point ...
    (comp.lang.fortran)
  • Re: Is there a Swap faster than using XOR!!!
    ... > websnarf@gmail.com (Paul Hsieh) writes: ... but C floating-point variables are not. ... storage which might be forced to go through memory -> but that memory ... implementing an incremental fibonacci inner loop using an add, a swap ...
    (comp.lang.c)