Skip to main content
All monetary calculations use Decimal arithmetic (never floating-point) to ensure exact results.

Default behavior

Values are rounded using HALF_UP strategy to 2 decimal places by default. Each value is rounded once — at the end of its computation. Intermediate calculations carry full 28-digit precision to prevent rounding error accumulation.
Intermediate:  839.4400000000000000000000000000
Final:         839.44

Overriding precision

You can override the number of decimal places per request:
{
  "options": {
    "precision": 4
  }
}
Valid range: 0 to 6 decimal places.

Rounding strategies

The engine supports multiple rounding strategies (configured per scheme in the DSL):
StrategyBehaviorExample (2.545 to 2dp)
HALF_UPRound half away from zero2.55
HALF_EVENRound half to nearest even (banker’s rounding)2.54
FLOORAlways round down2.54
CEILINGAlways round up2.55
Most Latin American tax authorities expect HALF_UP, which is the default for all current schemes.

Why strings, not numbers

All monetary values in API responses are serialized as JSON strings:
{
  "net_salary": "20039.25",
  "total_deductions": "3960.75"
}
JSON numbers are IEEE 754 floats, which cannot represent all decimal values exactly. For example, 0.1 + 0.2 = 0.30000000000000004 in most languages. Returning strings ensures the exact computed value reaches your application without precision loss. Parse response values with your language’s decimal type:
from decimal import Decimal

net = Decimal(result["summary"]["net_salary"])  # Exact