floating point - Why "decimal.Decimal('0') < 1.0" yields False in Python 2.6.5 -
in python 2.6.5 following expression yields false:
>>> import decimal >>> decimal.decimal('0') < 1.0 false
is there rationale explaining why comparison of decimal against float should behave this?
from documentation of decimal module:
changed in version 2.7: comparison between float instance x , decimal instance y returns result based on values of x , y. in earlier versions x < y returned same (arbitrary) result decimal instance x , float instance y.
so looks bug/missing feature , need upgrade.
Comments
Post a Comment