On Wed, 10 Jan 2001, Kirby Urner wrote:
Here's something from a math teacher who hangs out on math-teach (where I've been cross-posting a few of my "math through programming" essays).
He wonders if there's a way to get "long floats". I don't think there is, except maybe there's an add-on module I don't know about. Any clues?
According to the documentation at: http://python.org/doc/current/lib/module-mpz.html there should be a rational numbers module in one of the Demos directories (Demo/classes/Rat.py). Here's an interpreter session that plays a little bit with it. ###
from Rat import rat rat(5,3) Rat(5,3) str(rat(1,3)) '(1/3)' 1000-.0001 999.99990000000003 rat(1000) - rat(.0001) 999.99990000000003 # whoops! rat(1000) - rat(1, 1000) Rat(999999,1000) # ah, that's better. ###
Hope this helps!