Skip to main content
Install Relativities and download the synthetic examples before running this page. 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:
The sample download includes this rater in relativities-examples/rsl/exact:
  • Send numbers as JSON numbers. A number inside a string is a type error.
  • An exponent such as 1e3 is fine, because it 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, and the calculation keeps that value until a round:
A value with a short decimal form comes back as a JSON number. Any other value, such as 250/3, comes back as {"$rational": "p/q"}. 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. What rslc checks and guarantees shows the message for a broken promise.