Chris Angelico <ros...@gmail.com> writes: > On Tue, May 24, 2016 at 2:51 AM, Ben Bacarisse <ben.use...@bsb.me.uk> wrote: >> Chris Angelico <ros...@gmail.com> writes: >> >>> On Tue, May 24, 2016 at 12:29 AM, Ben Bacarisse <ben.use...@bsb.me.uk> >>> wrote: >>>> Right, but this is to miss the point. Let's say that 4000 years have >>>> defined 1/3 to be one third, but Python 3 (as do many programming >>>> languages) defines 1/3 to be something very very very very close to one >>>> third, and *that* idea is very very very very new! >>> >>> Have you ever written one third as 0.33333333 ? >> >> Not that I recall, but, obviously, I can't be sure. I can't even tell >> without counting how many 3s there are there. Why do you ask? >> >>> Because that's also >>> something very very close to one third. >> >> Yes it is, but I don't get what point you are making. > > You asserted that representing one third as something almost, but not > exactly, one third was a new idea.
Ah, I didn't mean to assert that at all. I meant to say that the new thing is that the approximation is tucked away in a representation largely hidden from the person doing the arithmetic. Its floats in programming languages that are new, not approximations. > It is not. Ever since ancient > times, approximations have been used. Python is no different from > anything else; the only reason it _looks_ different is that it's an > approximation in binary, converted to decimal for display. It's often hard for people to see that actual value[1] in a program, but not when they do arithmetic by hand. This is what confused me about your question. Were I to approximate 1/3 with 0.333 (on paper) there should be no surprises down the line. I know that 3 times it won't be 1, but 0.999. Confusion creeps in when the approximation is not explicit in the eye of the beginner. Obviously, to you and me, 1/3 is clearly an approximation in Python -- we know that / explicitly makes floats -- but not everyone knows the full consequences of that right away. I doubt anyone, beginner or not, would be surprised that 0.33333333 is not actually one third (though they *might* be surprised if it's not 33333333/100000000). [1] Not being a Python expert I don't know how you show that actual value of a float. What is the Pythonic way to do that? -- Ben. -- https://mail.python.org/mailman/listinfo/python-list