Posted on 2013-06-26
I am pulling numbers from a mysql database of type decimal(15,2).
I am having a problem with doing simple subtraction with PHP and it relates to negative numbers.
Say I got two numbers -64.05 and -64.05 and these need to be subtracted. In math, it should read as -64.05 + 64.05 to make 0. But no matter how I script it, using abs(#) or converting the second number into a positive another way it comes out being equal to -1.8474111129763E-13
Or some other random string depending on the values.
It seems so basic, what am I missing?