Skip to main content

Module numeric

Module numeric 

Source
Expand description

Shared numeric helpers: percentage clamping, sum checks, thresholds.

Functions§

percentage_in_range
Whether pct is a valid percentage value: finite and in [0.0, 100.0].
sums_to
Whether the values yielded by values sum to target within ± tolerance (percentage points). Returns the computed sum alongside the verdict, since callers reporting a failure need it in their message. A non-finite sum (e.g. one input was NaN) is always false.