<div dir="ltr"><br><br>On Friday, March 7, 2014 12:11:21 AM UTC-6, Steven D'Aprano wrote:<div> </div><blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">For the first few releases of Decimal, it prohibited direct conversion
<br>of floats specifically to avoid that issue:
<br>
<br># Python 2.5
<br>py> decimal.Decimal(2.01)
<br>Traceback (most recent call last):
<br> File "<stdin>", line 1, in <module>
<br> File "/usr/local/lib/python2.5/<wbr>decimal.py", line 648, in __new__
<br> "First convert the float to a string")
<br>TypeError: Cannot convert float to Decimal. First convert the float to a string
<br>
<br>
<br>But that turned out to be more of a nuisance than what it was
<br>trying to protect from, so starting in Python 2.7 Decimal now
<br>supports direct and exact conversion from float.
</blockquote><div><span style="font-size: 13px;"><br></span></div><div><span style="font-size: 13px;">hey Steven, whoa...! that is useful, and very interesting news. That almost makes me want to cry.... </span></div><div><span style="font-size: 13px;">Wait a minute, I'm going to check it out, ... son of a gun, you're right. My Py2.6.1 does not</span></div><div><span style="font-size: 13px;">allow me to enter this sqrt( .789 ). What-da-ya-know........ Here is the output:</span></div><div><span style="font-size: 13px;"><br></span></div><div>>>> from pdeclib import *</div><div>>>> sqrt(.789)</div><div>Traceback (most recent call last):</div><div> File "<stdin>", line 1, in <module></div><div> File "pdeclib.py", line 243, in sqrt</div><div> sqr=Decimal(x).sqrt()</div><div> File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/decimal.py", line 652, in __new__</div><div> "First convert the float to a string")</div><div>TypeError: Cannot convert float to Decimal. First convert the float to a string</div><div>>>> </div><div><span style="font-size: 13px;"> </span></div><div>So, "ignorant boy" finds out that the community has come to court with unclean hands ! </div><div><br></div><div>Everyone (even the core devs) know that this little problem sucks, and they've tried to</div><div>fix it in different ways, and yet when I bring it up its like (hypocrisy) I'm the one with the</div><div>problem--- when in fact all along everyone knows that this little IED was going to go off and</div><div>make a mess. ~nice.</div><div><br></div><div><sigh> Steven, I honor you and thank you for being honest and coming clean on this. </div><div><br></div><div>Geeze... I'm going to bed.</div><div><br></div></div>