<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
On 15-12-2009 22:46, Richard D. Moores wrote:
<blockquote
cite="mid:d71c7ed60912151346t10a7e6c4sbd2b3add16270875@mail.gmail.com"
type="cite"><span style="font-family: courier new,monospace;">def
float_to_exact_number_stored_in_computer(f):</span><br
style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> """</span><br
style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> Given a float,
return the exact number stored in computer</span>.<br
style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> See <a
moz-do-not-send="true"
href="http://docs.python.org/3.1/tutorial/floatingpoint.html#representation-error">http://docs.python.org/3.1/tutorial/floatingpoint.html#representation-error</a></span><br
style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> """</span><br
style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> from decimal
import Decimal</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> return
Decimal.from_float(f)<br>
<br>
I've just borrowed from the doc, but that name is too long, isn't it?
Please suggest something shorter but still meaningful. <br>
<br>
Thanks,<br>
<br>
Dick Moores</span><br>
</blockquote>
<br>
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.<br>
<br>
Hugo<br>
</body>
</html>