0

I've came across this issue and really can't figure out what i'm doing wrong.

So I use math.round to get 2 floating point of a variable. Later on i need to multiply this value *100. But somehow I receive an invalid number.

(Math.round(8.80*100)/100)*100  
880.0000000000001

I've tested it on w3schools try editor. Why is this happening?

Ceatry
  • 89
  • 2
  • 7
  • `Math.round(8.80*100/100*100)` Everything should be with method's parenthesis. – zer00ne Jun 24 '22 at 12:57
  • 1
    There nothing wrong with `Math.round()` 8.8 * 100 will give you 880.0000000000001 Have a look here to see [How to deal with floating point number precision in JavaScript](https://stackoverflow.com/questions/1458633/how-to-deal-with-floating-point-number-precision-in-javascript) – Cedric Cholley Jun 24 '22 at 13:01

0 Answers0