Correctness of P3109 neighboring values #
The exact numerical ordering of non-NaN values is a consecutive integer interval. The upper and lower neighbor operations move by one in that interval, returning NaN precisely when the requested neighbor does not exist. Infinite endpoints obey the same order as finite values.
Index of the least numerical datum; unsigned formats begin at zero.
Instances For
Index of the greatest numerical datum, whether finite or infinite.
Instances For
Every executable code fits the declared descriptor width.
Numerical-order index of an executable value, used only after excluding NaN.
Instances For
The executable NaN predicate agrees with exact decoding.
A NaN left operand is unordered under the public strict comparison.
A NaN right operand is unordered under the public strict comparison.
Public strict comparison agrees with integer-index order, with NaN excluded explicitly.
Non-NaN executable values lie between the numerical index endpoints.
The public zero constructor has code zero.
The public NaN constructor has the descriptor's unique NaN code.
Below the greatest datum, the upper neighbor exists and advances the order index by one.
Above the least datum, the lower neighbor exists and retreats by one in numerical order.
The greatest numerical datum has no upper neighbor, in either finite or extended formats.
The least numerical datum has no lower neighbor, in either finite or extended formats.
Whenever a greater value exists, the upper neighbor is strictly greater than the input.
No value greater than the input is smaller than its upper neighbor.
Whenever a lesser value exists, the lower neighbor is strictly smaller than the input.
No value smaller than the input is greater than its lower neighbor.
The upper-neighbor result is NaN exactly when the numerical order has no greater datum.
The lower-neighbor result is NaN exactly when the numerical order has no lesser datum.