Skip to main content
Install Relativities before running the synthetic examples. This page rounds values with round(x, places, mode). RSL keeps every value exact until a round changes it. So the premium rounds exactly where the filing says, and only there.

Round to cents or dollars

round takes three parts: the value, the number of decimal places, and the mode. The dwelling-fire rater from Write your first rater rounds each item charge to cents:
  • 2 rounds to cents, 0 to whole dollars, and -1 to tens of dollars.
  • The mode is required. Write the mode the filing states.
  • A value already on the target, such as 2.10 rounded to cents, stays the same in every mode.

Choose the mode

Save this rater as round-modes/rater.rsl. It rounds one amount to cents in four of the modes:
round-modes/rater.rsl
Each round cites the filed rounding rule, and each rounded value is a rating outcome. Rate 2.125, -2.125 and 2.121:
The modes differ on a half, such as 2.125, and on negative amounts.

Round the premium and cite the rule

Each returned premium needs an explicit rounding operation with a citation on the calculation that performs it. Use round(value, places, mode) and cite the filing’s rounding rule on that calculation. E-OUTCOME-ROUND identifies a missing premium-rounding operation or citation.

Apply a minimum premium

Wrap the rounded premium in max with the filed minimum. Save this rater as minimum/rater.rsl:
minimum/rater.rsl
Rate one payroll on each side of the minimum of 250:
A payroll of 100,000 rates 215, so the policy pays the minimum. A payroll of 150,000 rates 322.50, which rounds to 323.
  • A max or min of rounded values and constants counts as rounded, so this premium passes the outcome-rounding rule.
  • round(max(x, minimum_premium), 0, half_up) passes too. Write the order the filing states.
  • A max over an exact value, such as max(x, minimum_premium) alone, gets E-OUTCOME-ROUND.
  • min caps a premium at a filed maximum in the same way.

Round after each factor

Some filings multiply a chain of factors and round after each one. Save this rater as round-stepwise/rater.rsl:
round-stepwise/rater.rsl
The combined calculation writes a product with by, to fix the order, and round_each. The rater sorts the factors by order, multiplies them in turn, and rounds to 4 places after each step. Two factors of 1.00005 give 1.0002. One round at the end gives 1.0001:
explain lists each input, then each calculation in order, with its exact value.
  • by names a number or date input of each element.
  • Each order value appears once. The rater refuses a repeat with INPUT-KEY on a keyed by list, and with INPUT-UNIQUE on other lists.
  • round_each works with sum and product.
  • Exact numbers explains why values stay exact until a round.
  • Citations lists each value that needs a citation.