Re:Ruby vs. Python comes down to the for loop (2021)
by xdennis on Monday April 22, 2024 @06:42AM
(#40113041)
But it's not. In second grade I was taught that 1/2 is 0 (with a remainder of 1). Fractions, real numbers, complex... are taught afterwards.
Re:Ruby vs. Python comes down to the for loop (2021)
by Hamuko on Monday April 22, 2024 @07:00AM
(#40113130)
I don't think the target audience of Python are second-graders, but rather people who have graduated elementary school and realise that 1/2 comes out to 0.5.
Re:Ruby vs. Python comes down to the for loop (2021)
by mgaunard on Monday April 22, 2024 @08:22AM
(#40113661)
That's silly, in math those two are just different notations for the same thing, and usually fractions are preferred.
Also anyone who's done any bit of programming should know that numbers as represented by a computer are discrete, while mathematics deal with symbolic relations which might require infinite amount of data to numerically represent.
Binary floating-point can't even represent 0.1.
It's not wrong that 0 is the behaviour of C/Ruby, it's just that 1/2=0.5 is the expected result of much of Python's target audience.