On 10/29/10 3:08 PM, Ed Leafe wrote:
> On Oct 29, 2010, at 5:52 PM, Ed Leafe wrote:
>
>>> Try typing 4.50 and tabbing off the spinner. Until I changed the floats to
>>> decimals,
>>> it would revert back to the oldval.
>>
>> OK, I hadn't tried that. Yes, it reverts if you type the value
>> directly. Any clue as to why? Is it the imprecision of floats?
>
> Actually, I dug a little deeper, and it's due to the inability to
> compare Decimal and float values in versions of Python earlier than 2.7. In
> 2.6 and earlier, you get the following:
>
> d = decimal.Decimal("999.0")
> f = 4.50
> print f> d
> => True
Wow, I'd known because of raised exceptions about Decimal's refusal to convert
directly from float, but I had no idea that it would compare incorrectly.
Paul
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[email protected]