3 ms·
well, yes - but the funny thing is that the example chosen to illustrate the convenience of a REPL is - errr - factually wrong a scientist knows that 0.1 + 0.2
by librasteve 1y ago
well, yes - but the funny thing is that the example chosen to illustrate the convenience of a REPL is - errr - factually wrong
a scientist knows that 0.1 + 0.2 is not greater than 0.3, only a computer geek would think that this is OK
- emil-lp 1y agoYou completely miss the point twice over. The REPL example intends to show what the program does, not whether or not something is intuitive for you. Second, using your same argumentation, >>> 010 + 006 == 14 True Is also wrong. It's based on a misunderstanding of what representations of numbers in programming languages are. In Python (and almost all other languages), 0.1 means the IEEE float closest to the decimal number 0.1, and arithmetic operations are performed according to the IEEE standard.
- librasteve 1y agoI am not “missing the point”, I am disagreeing with you. (Hopefully in an agreeable way) I am making the point that using a decimal literal (eg 0.1) representation for a IEEE double is a bad choice and that using it as a representation for a Rat (aka Fraction) is a better choice. I 100% accept your point that in Python 0.1+0.2>0.3 is true which is why I prefer Raku’s number system.