I have multiple calculations which have troubles because of floating math problem in js. I'm trying to fix it by multiplying all parts of equation by 1000 and then dividing the result by 1000.
var a = 16924.83,
b = 16835.61;
var c = a-b; //outputs 89.22000000000116
var d = (1000*a-1000*b)/1000; //outputs 89.22 and seems to be working correct
Is it ok to do correction of floating math problem this way?
I did read Is floating point math broken?