penchY penchY - 7 months ago 14
PHP Question

How addition and subtraction of integers rates

Looking script for addition and subtraction of integers rates? help

example:
0.50 - 50% = 0.25
35.52 - 47% = ....

Answer

Parse your percentages to numerical values:

  0% = 0.0
 50% = 5.0
100% = 1.0
  x% = x/100.0

y +/- x% = y * (1.0 +/- x/100.0)