Applying rounding strategies
9.99
will be priced at 7.4925
after a 25% coupon application. To bring
this price back to looking nice a rounding strategy can be applied to shift it to a nice number like 7.49
or 7.50
.
The rounding strategies Corrily supports are governed by a simple language which is best described through example.
Imagine you want to round up to .25
, .49
, .75
or .99
for prices between 0 and anything less than 100 and for
anything equal to 100 or more you want to round to the nearest multiple of 50. A rounding rule to define this would then
be:
0_<100:f25_f49_f75_f99_nearest|>=100_inf:multiple_50_up
|
each of which contains a range 0_<100
and >=100_inf
followed by
:
and a range body which can either be:
f25_f49_f75_f99
where f
denotes a float, i.e. the ability to round to say 4.59
)multiple_50
(the other important function is sigfig_<n_sigfigs>
which rounds to the nearest number of
significant figures._down
, _up
or _nearest
which defines whether numbers are rounded down, up or to the nearest number defined in the range body.