A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2004-March/043838.html below:

[Python-Dev] Expert floats

[Python-Dev] Expert floatsAndrew Koenig ark-mlist at att.net
Wed Mar 31 15:59:12 EST 2004
>>> import Decimal 
>>> d1 = Decimal.Decimal('1E50') 
>>> d2 = Decimal.Decimal('1E-50') 
>>> d1 + d2 
Decimal( (0, (1, 0, 0, 0, 0, 0, 0, 0, 0), 42L) ) 
>>> d1 + d2 == d1 
True 
>>> Decimal.getcontext().prec = 1000 
>>> d1 + d2 == d1 
False 
>>> d1 + d2 
Decimal( (0, (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1), -50L) )


Very nice!


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4