[IronPython] Floating-point number don't compare correctly

hao.yu hao.yu at yeah.net
Sun Jun 10 04:25:35 CEST 2007


Test the following lines under IronPython 1.1:

import System

intVar = System.Int32.Parsse("400")
floatVar = System.Single.Parse("400")
doubleVar = System.Double.Parse("400")
intVar>500, floatVar>500, doubleVar>500

=> (False, True, False)


It seemed that float number type compare incorrectly with int numbers. If I change the expression to

floatVar>500.0

the result is False (as expected).

Why this behaviour?






More information about the Ironpython-users mailing list