[Insight-developers] VC++ Debug/Release float/double preci sion and Schrodinger's Cat.
Luis Ibanez
luis.ibanez@kitware.com
Mon, 15 Apr 2002 12:09:58 -0400
Jim,
Yeap, That's it.
Enabling "Floating-Point Consistency" in VC++
produce the right results for the example.
So... what do we do ?
Should we maybe add a VC++ option in CMake ?
something like:
VC++_USE_IEEE_FLOATING_POINT
The concern is that for this particular example
it was pretty obvious that something was going
wrong (just three lines of code !) but the same
can be happening right now on the internals of
a Registration method when computing derivatives,
or in the middle of a watershed segmentation or
in the fuzzy connectedness filter.
In those cases the complexity of the code involved
will make almost impossible to realize that improper
computations are being performed at the low level.
Just reading the code will not help at all.
Selecting this optimization option will sacrify
speed but anyways... running faster is useless
is the results are wrong :-/
BTW there are other optimization options that
may eventually be interesting to expose at CMake
level, for example:
- Favor small code
- Favor fast code
- Inline Function Expansion
It could probably be better to set this on the
Advanced level and preced this options (as VC++
does) with something like :
VC++_CUSTOMIZE_OPTIMIZATION
only when this option is "ON", CMake will present
the detailed optimization options.
Luis
=====================================================
Miller, James V (Research) wrote:
> Just looked up the compiler option. /Op ensures that all intermediate
> calculations are done according to IEEE standards. The downside is that
> it does this by reading and writing variables to memory instead of leaving
> them in a register. The result is that the code is bigger and slower.
> The /Za option (ANSI compatibility) turns on /Op by default.
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_.2f.op.asp
>
>
>