Skip to main content
An RSL rater calculates the way an actuary does on paper. 0.1 is exactly one tenth, and 1.1 + 2.2 is exactly 3.3. A value changes only at a round that the rater writes.

Why exact numbers matter

A rating manual prints its rates and factors as decimals. Most programs store numbers in binary, which holds most decimals only approximately. Over a long chain of factors, those small errors can move a premium by a cent. The result can also depend on the order of the steps. RSL keeps each value exact through the declared operations. The same implementation and inputs produce the same result across machines. Calculation order still matters where rounding intervenes. Validate the declared order and rounding rules against the filing and independent examples.

Inputs arrive exactly

The rater reads each number in a request from its text, so 1000.005 stays 1000.005. It then checks the number against its declared precision, and refuses a number off that precision. Save the following synthetic rater as exact/rater.rsl to run the examples:
exact/rater.rsl
Its annual_premium input has a precision of 0.01. Rate three requests:
  • Send numbers as numbers. A number inside a string is a type error.
  • A Python float travels as its shortest decimal text, so 1000.005 arrives as 1000.005.
  • A Decimal keeps its own digits. An exponent such as 1e3 names an exact value.
  • The rater uses each input as sent. Round an input before you send it.

Division keeps the exact value

1000 / 12 is exactly 250/3. The monthly calculation keeps that value, and installment rounds it to cents:
explain gives a value with a short decimal form as a Decimal, and any other value, such as 250/3, as a Fraction. A premium always rounds, so it always comes back as a Decimal.

A precision on a calculation is a promise

A calculation typed with a precision, such as Money in whole cents, promises values on that precision. The check proves the promise, and the rater rounds only where a round says so. E-COMPUTED-RANGE shows the message for a broken promise, and its fix.