3

Closed

sys.float_info field values are inconsistent with those of CPython

description

In IronPython 2.6.1 (running in Silverlight on OS X 10.6), I'm seeing the following values for sys.float_info.min and sys.float_info.epsilon:
 
>>> sys.float_info.epsilon
4.9406564584124654e-324
>>> sys.float_info.min
-1.7976931348623157e+308
 
In CPython (any version >= 2.6), the relevant values are:
 
>>> sys.float_info.epsilon
2.2204460492503131e-16
>>> sys.float_info.min
2.2250738585072014e-308
 
The CPython documentation describes epsilon as the difference between 1.0 and the next largest double (i.e., it's C's DBL_EPSILON). I guess that this bug occurs because IronPython is using .NET's Double.Epsilon here, which is something entirely different. And similarly, C's DBL_MIN (which is what sys.float_info.min is based on) has a very different definition to Double.MinValue.
 
The other sys.float_info values correspond between the two versions, as far as I can tell.
Closed Dec 6 at 9:16 PM by jdhardy

comments