Math errors in python
Chris S.
chrisks at NOSPAM.udel.edu
Sun Sep 19 04:52:13 EDT 2004
Richard Townsend wrote:
> On Sun, 19 Sep 2004 08:00:03 GMT, Chris S. wrote:
>
>
>>Sqrt is a fair criticism, but Pi equals 22/7, exactly the form this
>>arithmetic is meant for. Any decimal can be represented by a fraction,
>>yet not all fractions can be represented by decimals. My point is that
>>such simple accuracy should be supported out of the box.
>>
>
>
> Do you really think Pi equals 22/7 ?
Of course not. That's just a common approximation. Irrational numbers
are an obvious exception, but we shouldn't sacrifice the accuracy of
common decimal math just for their sake.
>
>>>>import math
>>>>print math.pi
>
> 3.14159265359
>
>>>>print 22.0/7.0
>
> 3.14285714286
>
> What do you get on your $20 calculator ?
The same thing actually.
More information about the Python-list
mailing list