I am facing weird issue during rounding the value using javascript. Some of the value is not rounding in correct format.
var n =17.955 ;
var roundedPrice;
roundedPrice = Math.round(n*100)/100;
console.log(roundedPrice); // It returns 17.95 instead of 17.96
It is happening for some specific values like 16.955, 17.955, 18.955, 19.955
. Except these values like 1.955, 12.955, 20.955, 27.955 ...
This round function return correct values.
Edited : It is happening with 17.955 only. This returns correct result with 17.9555 ( 3 times 5).
Thanks in advance.