4 ms·
Floating point error, present in every language that uses floats. This is in no way unique to JavaScript.
by fbonetti 10y ago
Floating point error, present in every language that uses floats. This is in no way unique to JavaScript.
- mrrobot2 10y agoTalk is cheap, give an example in code.
- insin 10y agoPython REPL: >>> 0.3 - 0.1 0.19999999999999998 Ruby REPL: 0.3 - 0.1 => 0.19999999999999998
- mrrobot2 10y agohttps://repl.it/Cbqb https://repl.it/Cbqb unless your Python compiler runs on some sort of JavaScript (-:
- mrrobot2 10y agoAnd while you're at it, do you know of any other language that does this? http://pasteboard.co/bbM0qneiQ.jpg http://pasteboard.co/bbM0qneiQ.jpg
- deleted 10y ago[deleted]
- skeeterbug 10y agoPython 2.7.12 (default, Jul 1 2016, 15:12:24) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 0.3 - 0.1 0.19999999999999998 Python 3.5.1 yields the same result
- Sacho 10y agoI don't use python, but print-like functions(or in this case, statements) usually format their output. https://repl.it/Cbqb/1 https://repl.it/Cbqb/1 From the documentation: > print evaluates each expression in turn and writes the resulting object to standard output (see below). If an object is not a string, it is first converted to a string using the rules for string conversions. I can't even find what the rules for string conversions are in the documentation :/ Oddly enough they're not described under https://docs.python.org/2/reference/expressions.html#string-conversions https://docs.python.org/2/reference/expressions.html#string-...