0

I have application that is adding a series of numbers. I expect the numbers to sum to equal 0, but when PHP processes the math, it comes out to -1.2789769243682E-13. I am curious why this is. When I perform the math manually it equals zero like expected.

<?php

$math = 138.57 + 138.57 + 138.57 + 138.57 + 138.57 + (-673.71) + (-19.14);
echo $math;
//-1.2789769243682E-13
Brady Charron
  • 13
  • 1
  • 4
  • https://stackoverflow.com/questions/59667791/positive-and-negative-floating-numbers-addition-php-returning-exponential-numbe – j08691 Apr 05 '22 at 19:41
  • @j08691 Thanks for the link. The issue was closed as a duplicate before I could follow up, but yes, the link you shared does answer my question (as does the duplicate question answer it was closed with. – Brady Charron Apr 07 '22 at 12:51

0 Answers0