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.Overriding precision
You can override the number of decimal places per request:0 to 6 decimal places.
Rounding strategies
The engine supports multiple rounding strategies (configured per scheme in the DSL):| Strategy | Behavior | Example (2.545 to 2dp) |
|---|---|---|
HALF_UP | Round half away from zero | 2.55 |
HALF_EVEN | Round half to nearest even (banker’s rounding) | 2.54 |
FLOOR | Always round down | 2.54 |
CEILING | Always round up | 2.55 |
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: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: