Policy that clamps the value to [0, ā).]
Declared in <mp-units/overflow_policies.h>
struct clamp_non_negative;
Saturates negative values to zero. Use when small negative values can arise from floating-point rounding in a naturally non-negative domain (e.g., a computed energy that rounds to ā1eā15 J should be treated as 0 J rather than signalling an error).
| Name | Description |
|---|---|
operator() | Clamps v to zero if it is negative. |
| Name | Description |
|---|---|
min | Lower domain bound: zero in any unit. See check_non_negative::min for rationale. |