0

I just want for example multiply 7.50*1.19

Iam pretty sure it´s 8,925 but if i calculate it in my js i get 8.924999999999999 and i cannot get a correct rounding to finally get 8,93

parseFloat(tarif.field_grundpreis * 1.19)

Result = 8.924999999999999

While tarif.field_grundpreis is 7.50

It´s crazy, please help.

Schnitzer
  • 1
  • 1
  • This is how IEEE floating point numbers work. This is the same in any language that uses floating point arithmetic. – sbking Jul 20 '17 at 16:38
  • More specifically, [IEEE 754 double-precision binary floating-point format](https://en.wikipedia.org/wiki/Double-precision_floating-point_format) – Patrick Roberts Jul 20 '17 at 16:41
  • Thanks for your help. I solved it with big.js and now it works perfect. – Schnitzer Jul 20 '17 at 17:09

0 Answers0