3

Ok so, this is what I have

amount = parseFloat("0.07") * 100;

and this is what I get in return

7.000000000000001

Could anyone tell me why? It only happens with 0.07... Other numbers convert correctly, 0.01 or 0.06 for instance.

Jurijs Kastanovs
  • 685
  • 1
  • 15
  • 35
  • 1
    Please read http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html "What Every Computer Scientist Should Know About Floating-Point Arithmetic" – Patashu Apr 17 '13 at 11:37

0 Answers0