problem with the 'math' module in 2.5?

Gary Herron gherron at islandtraining.com
Sun Oct 15 02:05:11 EDT 2006


Ben Finney wrote:
> "Chris" <chrispatton at gmail.com> writes:
>
>   
>> Oh, ok that explains it. Is that why my 16-bit calculator gives me
>> 0?
>>     
>
> Your calculator is probably doing rounding without you asking for it.
>   
Yes. Almost all calculators have 1 or 2 guard digits. These are extra
digits beyond what is shown on the display. All calculations are done at
that higher precision and the result are rounded to the precision of the
display for the user's benefit.

This satisfies users who know nothing about the numerical imprecision of
finite digit arithmetic. Python makes the opposite assumption that we
are are adults here and can handle the full knowledge, slight
imprecision and all.

Dr. Gary Herron

> Python refuses to guess what you want, and gives you the information
> available.
>
>   




More information about the Python-list mailing list