"M.-A. Lemburg" wrote: > >... > > from mx.Number import * > f = Float(3.141) > r1 = Rational(3.141) > r2 = Rational(2, 3) > i = Integer("1231231231231231231231231") Wouldn't you more often make a rational from a string instead of a float? The float loses precision and the rational loses performance so you've got the worst of both worlds. :) > * Please try out the rational type and see if it fits your > needs -- the results are sometimes surprising (due to the > IEEE representations of floats); I'm sure this proof of > concept will raise a few more questions regarding the > usefulness of switching to rationals for literals like > 1.123. This seems to come back to my point above. If you made the rational from strings instead of floats, the IEEE representation for floats would be irrelevant, wouldn't it? -- Take a recipe. Leave a recipe. Python Cookbook! http://www.ActiveState.com/pythoncookbook
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