On 15-12-2009 22:46, Richard D. Moores wrote:
def float_to_exact_number_stored_in_computer(f):
"""
Given a float, return the exact number stored in computer.
See
http://docs.python.org/3.1/tutorial/floatingpoint.html#representation-error
"""
from decimal import Decimal
return Decimal.from_float(f)
I've just borrowed from the doc, but that name is too long, isn't it?
Please suggest something shorter but still meaningful.
Thanks,
Dick Moores
What's wrong with just using the Decimal.from_float function directly?
This wrapper doesn't really do anything, seems like having a separate
function would be unnecessary.
Hugo
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor