Rounding from a Certified Bracket #
The effective calculation layer identifies a unit interval [m, m + 1) and a location inside it.
This file turns that finite location data into the integer selected by directed or nearest rounding
and proves agreement with the rounded-real definitions. Every named rounding mode is covered:
floor, ceiling, truncation, rounding away from zero, and nearest rounding with any tie choice.
Nearest rounding with ties away from zero differs from every other nearest rounding only at an
exact midpoint, where it agrees with awayRound.
Source counterparts are in Flocq 4.2.2, src/Calc/Round.v: inbetween_int_NE for
nearest-even selection, truncate_correct for the canonical bracket after truncation, and
round_trunc_NE_correct for agreement with real-valued rounding.
Release source: https://flocq.gitlabpages.inria.fr/releases/flocq-4.2.2.tar.gz.
Canonical location obtained from the floor bracket of a real value.
Instances For
Every real value satisfies its canonical floor bracket.
Increment an integer when the supplied decision is true.
Instances For
A conditional increment always selects one of the two bracket endpoints.
Upward rounding increments exactly when the location is inexact.
Instances For
Tie decision used by nearest-even rounding: increment exactly when the lower integer is odd.
Instances For
Choice-based nearest rounding with the parity decision is FloatLib's nearest-even mode.
At a midpoint, nearest rounding with ties away from zero is rounding away from zero.
Conjugating nearest rounding by negation mirrors its tie choice.
Nearest rounding with ties away from zero commutes with negation.
A certified unit bracket determines the floor.
A certified unit bracket determines ceiling from exactness alone.
A certified unit bracket computes arbitrary-tie nearest rounding.
A certified unit bracket computes nearest-even rounding.
A certified unit bracket places its input in [m, m + 1).
A certified unit bracket computes toward-zero rounding: floor when the lower integer is nonnegative and ceiling when it is negative.
A certified unit bracket computes rounding away from zero: ceiling when the lower integer is nonnegative and floor when it is negative.
Mantissa truncation #
Instances For
Instances For
Real interval and location denoted by a truncation state.
Instances For
A positive value bracketed by a truncation state forces a nonnegative lower mantissa.
For a positive input and a bracket with sufficient precision, the lower mantissa's digit count
determines the canonical exponent. This is the representation-level counterpart of Flocq's
cexp_inbetween_float.
A bracket stored at the canonical exponent is a unit bracket for the scaled mantissa.
Discard shift low radix digits and transfer their information into the refined location.
Positive shifts are the intended use, and the correctness theorems assume 0 < shift.
Instances For
A positive shift produces a radix power strictly larger than one.
The truncated remainder is a valid cell index in the discarded radix block.
Mantissa reconstruction after one truncation step.
After a positive truncation step, the enlarged bracket still contains the input.
Number of low radix digits discarded to reach the exponent selected by fexp.
Instances For
Truncate only when the target exponent lies strictly above the stored exponent.
Instances For
Format-driven truncation preserves the bracketing relation for the input.
For a positive input with sufficient initial precision, truncation both preserves the bracket and selects the canonical format exponent.
Nearest-even result selected from a format-truncated bracket.
Instances For
Truncation never changes a zero mantissa into a nonzero one.
Rounded mantissa paired with the input's canonical exponent.
Instances For
A rounded scaled mantissa and the input's canonical exponent represent the rounded real value.
A scaled-mantissa bracket computes format-level downward rounding.
A scaled-mantissa bracket computes format-level upward rounding.
A scaled-mantissa bracket computes format-level nearest-even rounding.
A scaled-mantissa bracket computes format-level nearest rounding with any tie choice.
A scaled-mantissa bracket computes format-level rounding toward zero.
A scaled-mantissa bracket computes format-level rounding away from zero.
Nearest-even integer selected from the real input's floor bracket.
Instances For
Nearest-even format rounding agrees with selection from the scaled input's floor bracket.
Nearest-even selection after canonical truncation agrees with generic rounded-real semantics.
The input must be positive, and hexp requires sufficient precision in the initial bracket.
truncate_brackets alone does not establish the canonical-exponent condition.