Reputation: 247
In an Angular app, I'm showing a value in "l/h" unit, but I do a conversion to store this value in "kg/s" in my database. For example, if the user enters 30 l/h, I store 30 / 0.9506 / 3600 = 0.008766393155200223
Then, when the user refreshes the page, the value displayed is not 30 but 29.999999999999993 (the result of 0.008766393155200223 * 0.9506 * 3600).
How could I avoid this conversion side-effect?
Upvotes: 0
Views: 736