On 2021-11-20 03:25:53 +0000, Ben Bacarisse wrote:
> Chris Angelico <ros...@gmail.com> writes:
> 
> > It does mean exactly what it meant in grade school, just as 1/3 means
> > exactly what it meant in grade school. Now try to represent 1/3 on a
> > blackboard, as a decimal fraction. If that's impossible, does it mean
> > that 1/3 doesn't mean 1/3, or that 1/3 can't be represented?
> 
> As you know, it is possible, but let's say we outlaw any finite notation
> for repeated digits...  Why should I convert 1/3 to this particular
> apparently unsuitable representation?

Because you want to use tools which require that particular
representation? Like for example a pocket calculator?

> I will write 1/3 and manipulate that number using factional notation.

On paper, maybe. But if after a few more steps you have fractions like
37645 / 9537654, you might reconsider that choice.

In a program? Yes, there are cases where you really want to use
fractions. That's why fractions.Fraction exists in Python (and similar
datatypes in many other programming languages). But they have their
limits, too (no π or √2) and for most problems you don't need them. I
don't actually think I ever used fractions.Fraction in my 7 years of
Python programming. (I think I used Math::BigRat in Perl, but I've been
programming in Perl for a lot longer.)

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | h...@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment: signature.asc
Description: PGP signature

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to