My Python & co. stuff

float > Decimal

Posted on: October 25, 2009

Another Python gotcha?

>>> a
12.878
>>> b
Decimal('15.0')
>>> a > b
True
>>> type(a)
<type 'float'>
>>> type(b)
<class 'decimal.Decimal'>
>>> 1.0 > Decimal('1.0')
True
>>> 0.0 > Decimal('0.0')
True
>>> 1.0 > Decimal('1.0') True >>> 0.0 > Decimal('0.0') True
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: