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
However,
document.writeln(Math.floor(43.99999999999999));
produces 44.
The magic number of 9’s after the decimal point seems to be 15*.
Why is this?
Furthermore, Does the Math.floor function accept the number as a number object, or a number value?
The IEEE 754 double-precision binary floating-point format (which is what JavaScript uses for its Number type) gives you a precision of 15 – 17 significant decimal digits.
Source: http://en.wikipedia.org/wiki/Double-precision_floating-point_format#IEEE_754_double-precision_binary_floating-point_format:_binary64