Why is JavaScript's toPrecision
method sometimes rounding up and sometimes down?
For example:
console.log("1.05.toPrecision(2) = " + (1.05).toPrecision(2)); // returns "1.1"
console.log("1.005.toPrecision(3) = " + (1.005).toPrecision(3)); // returns "1.00", shouldn't it be "1.01"?
Note: I noticed this behavior on all browsers except of IE (tested on IE 11).