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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -