penchY - 5 months ago 6x

PHP Question

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)
```

Source (Stackoverflow)

Comments