Positive directed rounding for arbitrary executable float formats #
The shift-based directed rounders used by Model are related to the independent Flocq-style
real semantics at the scaled-mantissa boundary, before subnormal and normal values are packed
into interchange fields.
roundAt fmt x mode is the real rounding of every IEEERoundingMode on the same grid, Flocq's
round with nearestEven, ceilRound, and floorRound for nearest-even and the two infinity
directions. Nearest-away rounding is Flocq's nearestChoice with the tie choice
nearestAwayChoice, and rounding away from zero is awayRound.
All definitions are uniform in FloatFormat.
Real rounding in every direction #
Nearest-away rounding rounds the scaled mantissa with ties away from zero.
Rounding toward zero truncates the scaled mantissa.
Rounding away from zero rounds the scaled mantissa away from zero.
Every rounding direction returns a value on the grid of fmt.
Every rounding direction fixes a value already on the grid of fmt.
On a nonnegative real a directed mode is upward rounding when it rounds positive results away from zero, and downward rounding otherwise. The two nearest modes are not directed.
Two reals with the same canonical exponent whose scaled mantissas have the same integer bracket and the same location in it round alike in every direction.
Executable scaled-mantissa rounding #
Floor a natural mantissa after expressing it at targetExponent.
Instances For
Ceil a natural mantissa after expressing it at targetExponent.
Instances For
Ceiling alignment preserves nonzeroness of a positive mantissa.
Floor alignment never exceeds ceiling alignment at the same exponent.
Ceiling alignment is at most one unit above floor alignment.
Downward shifting computes the integer floor of a scaled positive dyadic.
Upward shifting computes the integer ceiling of a scaled positive dyadic.
Floor alignment at any target exponent is a lower bound for the exact dyadic magnitude.
Ceiling alignment at any target exponent is an upper bound for the exact dyadic magnitude.