Re: TAxis bug

Fred Gray (fgray@alecto.physics.uiuc.edu)
Thu, 9 Apr 1998 23:22:44 -0500 (CDT)


> I have investigated your problem on all Unix platforms and NT.
> NT is effectively given the "wrong" result. All Unix platforms are OK.
> The problem on NT is simply a rounding error problem. It is not a bug.
> May be there is an option (Valery please could you check) to optimize
> floating point rounding with VC++.

There is a Visual C++ runtime library function called _controlfp() which sets
the IEEE floating-point status word. The syntax is _controlfp(value, mask);
the mask indicates which bits of the status word you want to change. There
are lots of constants defined for various parts of this word. In order to set
round-to-nearest mode, the syntax would be:

_controlfp(_RC_NEAR, _MCW_RC);

The other rounding mode choices are _RC_CHOP, _RC_UP, and _RC_DOWN.

-------------------------------------------------------------------------------
-- Fred Gray Graduate Student --
-- fgray@physics.uiuc.edu Department of Physics --
-- University of Illinois at Urbana-Champaign --
-------------------------------------------------------------------------------