| ||||||||||||||||||
Percentages
A value followed by a '%' sign is simply divided by 100,
except when the most recent pending operation is '+' or '-',
in which case the number is divided by 100, the result is added to or
subtracted from 1, and the pending operation is changed to '*'.
This has the effect of adding a percentage to the preceding value as calculated
so far (or subtracting it).
Examples:
50% => 0.5
120 * 5% => 6 and 120 / 5% => 2400
120 + 5% => 126 and 120 - 5% => 114
20 + (30 + 40 + 5%) => 93.5
20 + (30 + 40)% => 34
20 + 30% + 40% is the same as (20 + 30%) + 40% => 36.4
Caution:
Adding 17.5% VAT to an item costing 100 pence: 100+17.5% gives the expected result of 117.5, but attempting to reverse the process by doing 117.5-17.5% will give the result 96.9375. The recommended method of deducting VAT at 17.5% is to multiply the value by 40/47. Doing this, 117.5*40/47 gives the expected result of 100.
