-1

Sometimes simple algebra can result in floating accuracy errors. in this case, I encountered 12 * 1.6 which resulted in 19.20000000003

Is there a way to catch this issue or prevent it from happening? Accuracy is highly important so simply rounding or truncation would not be enough.

DIGI Byte
  • 4,225
  • 1
  • 12
  • 20

1 Answers1

-1

No. Its the nature of floating point arithmetic. You only have so much accuaracy. https://en.wikipedia.org/wiki/Floating-point_arithmetic

GoldenretriverYT
  • 3,043
  • 1
  • 9
  • 22