Re: vc8 floating point failure

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




Phil Frisbie, Jr. wrote:
wade@xxxxxxxxxx wrote:

Compiling http://www.netlib.org/paranoia/paranoia.c with /fp:precise
/O2, /Ot and it shows failures and defects on my machine (P4, 3.4 Ghz).
It isn't at all obvious why that should be. With /fp:strict, or with
optimization turned off, it says the math is fine.

Does anyone know what optimization is causing the problem (and is the
problem consistent with MS's description of :precise)?

Did you read the documentation on /fp:precise?

My interpretation is that /fp:precise leaves intermediate results in extended
x86 precision and only rounds to a 32 bit float or 64 bit double for an
assignment, cast, or when passing to a function.

agreed.

But /fp:strict rounds to float/double precision after EACH calculation, which
slows down x86 code.

I don't think so.

From
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/floapoint.asp:

fp:strict rounding semantics:
"Explicit rounding at assignments, typecasts, and function calls
Intermediate expressions will be evaluated at register precision.
Same as fp:precise."

AFAICT, compared to precise, fp:strict:
- disables contractions (should not matter here)
- will not reorder evaluations (should not matter here, for paranoia,
fp:precise should only reorder when its assumptions are correct, and
the reorder will not change the result).
- allows access to the FPU environment, but paranoia does not make that
access.
- Checks for exceptions earlier, but no paranoia result is dependent on
when an exception occurs.

My simplistic view is that fp:strict is the thing to use when you are
playing with the fp environment, and when you want floating point
exceptions (signalling overflow, divide by zero, etc) to be reported
promptly. paranoia doesn't play with the fp environment, and it
doesn't enable exception semantics.

.



Relevant Pages

  • Re: Exceptions in C/C++
    ... a normal software engineering environment, ... No one gives a flying firkin about your exceptions and your bounds- ... For enhancement, read misfeature leading to bloat and pointless ... Please let's argument within the technical context ...
    (comp.lang.c)
  • Issues with ISE Eiffel 5.7 build 58953 (GPL Edition)
    ... the environment suffered from internal errors ... Eiffel is all about writing bug-free software while the programming ... Following is the set of recorded exceptions. ...
    (comp.lang.eiffel)
  • Re: What shell do people use?
    ... Bonus if it's extra uncomfortable. ... | I disagree. ... With a few exceptions, root's environment should be as ...
    (comp.unix.bsd.freebsd.misc)
  • Re: C++ in the kernel
    ... be better suited to the embedded environment. ... when abused (uncaught exceptions are evil, ... language and can be used to good effect. ... Could that be done with cfront? ...
    (freebsd-arch)