βdocument.writeln(Math.floor(43.9));
produces 43 in the browser.
βdocument.writeln(Math.floor(43.9999));βββββββββββββββββββββββββββββββββββββββ
produces 43
βdocument.writeln(Math.floor(43.999999999999));βββββββββββββββββββββββββββββββββββββββ
again 43
but
document.writeln(Math.floor(43.99999999999999));
produces 44.
The magic number 9 after the decimal point seems to be equal to 15 *.
Why is this?
Also, does the Math.floor function accept a number as a numeric object or a numeric value?
javascript
darethas
source share