Numeric compatibility C reference

See Shared value conversion and numeric policy for finite-value versus NaN checks and narrowing preconditions. These macros do not evaluate arguments exactly once.

ROUND(x)

Round halfway away from zero, then narrow to int.

Require a finite value whose adjusted magnitude fits int. This macro can evaluate its argument repeatedly and does not clamp or reject overflow.

FMOD(x, y)

Compute a legacy remainder using an int-truncated quotient.

Require a nonzero divisor and a finite quotient representable as int. This is not a range-safe replacement for the C fmod function. Arguments may be evaluated repeatedly; do not supply expressions with side effects.

DEFINED(x)

Test for a value other than NaN; infinity still counts as defined.

UNDEFINED(x)

Test for NaN, independently of whether other nonfinite values exist.