Amounts and rounding
Input
An amount field (money) or number field (number, percentage) accepts a JSON number or a string. A string may
follow the French notation as well as the English one: decimal comma or decimal point, spaces between the thousands
(« 27 500,50 », « 27500.50 »). A percentage is entered in points: 1.5 for 1.5%. The bounds of a field (minimum,
maximum of the schema served by GET /v1/calculators/{slug}/schema) apply to the value read, whatever its notation.
For an amount, prefer the string: a JSON number is a float for most languages, while a decimal string reaches the engine without loss.
Output
Every output of result is a decimal STRING, with a decimal point and no thousands separator. Amounts are computed in
exact decimal arithmetic, never in floating point. An output with no value for the given input is the empty string.
Rounding is not uniform: each calculation follows the rule of its text. Taxable income and income tax are whole euros, a social security contribution is computed to the cent. The two examples below are run by the engine:
Response: status 200, excerpt of result (irFinal, revenuFiscalReference).
{
"result": {
"irFinal": "1564",
"revenuFiscalReference": "27000"
}
}
Response: status 200, excerpt of result (salaireNet, totalSalarial, totalPatronal, coutTotalEmployeur).
{
"result": {
"salaireNet": "2374.79",
"totalSalarial": "625.21",
"totalPatronal": "991.08",
"coutTotalEmployeur": "3991.08"
}
}
The first one is an income tax calculation: irFinal is the income tax, revenuFiscalReference the reference
taxable income (revenu fiscal de référence).
The second one is a payslip for a non-managerial employee (non-cadre): salaireNet is the net salary,
totalSalarial and totalPatronal the employee and employer social security contributions, coutTotalEmployeur
the total employer cost.
The steps of the trace give the formula applied to each amount and their citations (see The trace).
Display
To display an amount in English, format the string with an English locale (for example en-GB: decimal point, comma
between the thousands, € sign before the amount, « €1,234.56 »), in decimal arithmetic: do not convert it to a float to
format it. The French site uses the fr-FR locale (decimal comma, space between the thousands, € sign after the amount).