osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Old Man Yells At Cloud


On Tue, 19 Sep 2017 01:56:29 +0000, Stefan Ram wrote:

> Steve D'Aprano <steve+python at pearwood.info> writes:

>>It is true that binary floats have some unexpected properties. They
>>aren't the real numbers that we learn in maths. But most people who
>>have been to school have years of experience with calculators training
>>them to expect computer calculations are sometimes "off". They do a
>>sum and get 2.999999999 instead of 3, or perhaps 3.000000001, and
>>that's just the way calculators work.

>   It is possible that many calculators use base 10 and therefore such
>   surprises might be less common than in the world of programming
>   languages.

How relevant is the "people use calculators to do arithmetic" argument
today?  Okay, so I'm old and cynical, but I know [young] people who
don't (can't?) calculate a gratuity without an app or a web page.

FWIW, I would prefer that 1/10 be a rational because rationals are exact
when the operands are.  Rounding could easily fall under "In the face of
ambiguity, refuse to guess."  Yes, every once in a while, I get a result
with lots of digits, but that's usually while I'm developing an
algorithm, and then I can decide whether or not and when to coerce the
result to floating point.

Dan