Re: IEEE 754 floating point standard
"Tim Roberts" <timr@probo.com> wrote in message
news:jj9p0315cklkt22d6jhqall8cpm2bmqu1q@4ax.com
"Carl Daniel [VC++ MVP]"
<cpdaniel_remove_this_and_nospam@mvps.org.nospam> wrote:
"John" <no@spam> wrote:
Hi, I was wondering a couple things:
1) Does VC6 comply with the IEEE 754 floating point standard?
No, I don't believe so. VC6 uses too much precision sometimes (in
order to improve performance).
I'm not sure I understand your response. It is the processor's
floating point unit that conforms to IEEE 754. VC6 can only choose
one of the three precisions the processor offers, and all three of
them are in the standard.
VC6 effectively chooses a mixed mode, where calculations are performed
in 80 bits for as long as possible (as long as values can be kept on FPU
stack) then truncated down to 64 bits when values are spilled into
memory. The result is different from both pure 80-bit mode and pure
64-bit mode (where all intermediate calculations are performed in 64
bit).
Unless a compiler is simulating floating point, like the old 386
compilers used to do, I don't see how the compiler could be
non-compliant when the FPU is.
VC6 is a case in point. An expression (x == x) is always true, even when
x is a NaN. The generated code calls FCOMP floating point instruction,
but then doesn't interpret the resulting flags correctly. So the FPU
gives all the necessary information, but surrounding compiler-generated
code is wrong.
For more details, see
http://groups.google.com/group/microsoft.public.vc.stl/browse_frm/thread/4d09011ef94acad1
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925