Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Though a fully conforming implementation is free to create its own floating point system, there are two is a systems which garner garners overwhelming popularity and another very popular in legacy systems. The firstmost popular implementation, used by the default options of Microsoft Visual Studio and GCC on Intel architectures, is IEEE 754. The second is the system used natively by derivative architectures of IBM System/360, , generally considered legacy, system is commonly known as the "IBM floating point representation," or "IBM/370." Each of these systems have differing precisions and ranges of representable values. Thus, they do not represent all of the same values, are not binary compatible, and have differing associated error rates.

...

Wiki Markup
The reason for this behavior is that Linux uses the internal extended precision mode of the x87 floating point unit (FPU) on IA-32 machines for increased accuracy during computation.  When the result is stored into memory by the assignment to {{c}}, the FPU automatically rounds the result to fit into a {{double}}.  Later, when the value is read back from memory and compared to the internal representation (which has extended precision), the comparison fails, producing an unexpected result.  Windows does not use the extended precision mode, so all computation is done with double precision and there are no differences in precision between values stored in memory and those internal to the FPU.  On Linux, compiling with the {{-O}} optimization flag eliminates the unnecessary store into memory, so all computation happens within the FPU with extended precision \[[Gough 2005|AA. C References#Gough 2005]\].

...