calc_exact
Perform exact arithmetic to prevent floating-point precision errors. Compute rational numbers, arbitrary-precision integers, bitwise operations, and math functions for assertions and comparisons.
Instructions
EXACT arithmetic: 0.1 + 0.2 == 0.3 is True here (False in plain Python).
Everything is an exact rational, integers are arbitrary precision. Supports
/ // % ** comparisons, bitwise ops (& | ^ << >> ~) on integers, and whitelisted math functions (sqrt, log, sin, ...) plus pi/e/tau. Use BEFORE asserting any computed number: thresholds, ratios, overflows, 'X is N% of Y'. Examples: '2**64 - 1', 'comb(52,5)', '0.1+0.2 == 0.3', '0xff & 0x0f'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expr | Yes |