Directed executable IEEE32 operations.
This file provides lower and upper rounding variants for arithmetic operations, forming the runtime side of the interval-enclosure story.
ceil(n / 2^shift) for naturals, implemented via shifts (used for directed rounding).
Instances For
Directed rounding down (toward -∞) for a positive dyadic mant * 2^exp.
Instances For
Directed rounding up (toward +∞) for a positive dyadic mant * 2^exp.
Instances For
Directed rounding down (toward -∞) of an exact dyadic to float32.
Instances For
Directed rounding up (toward +∞) of an exact dyadic to float32.
Instances For
addDown x y is a float32 lower bound for the exact real sum (when finite).
Instances For
addUp x y is a float32 upper bound for the exact real sum (when finite).
Instances For
subDown x y is a float32 lower bound for the exact real difference (when finite).
Instances For
subUp x y is a float32 upper bound for the exact real difference (when finite).
Instances For
mulDown x y is a float32 lower bound for the exact real product (when finite).
Instances For
mulUp x y is a float32 upper bound for the exact real product (when finite).
Instances For
Directed rounding for exact rationals (division-friendly) #
For divDown/divUp we need outward rounding of an exact rational num/den to the float32 grid.
Our dyadic-directed rounders (roundDyadicDown/roundDyadicUp) already have a clean soundness
proof,
so we reduce rational rounding to dyadic rounding by building a dyadic enclosure of num/den:
- lower dyadic:
⌊(num/den) * 2^K⌋ * 2^{-K}, - upper dyadic:
⌈(num/den) * 2^K⌉ * 2^{-K}.
We then apply roundDyadicDown/roundDyadicUp to these dyadics.
This is sound (it produces outward-rounded endpoints), but it is not necessarily optimally tight; a
larger ratApproxShift improves tightness at some computational cost.
Number of extra bits used when turning num/den into a dyadic enclosure.
Instances For
ceil(num/den) for naturals, totalized (returns 0 when den = 0).
Instances For
Lower dyadic mantissa for num/den at scale 2^ratApproxShift.
Instances For
Upper dyadic mantissa for num/den at scale 2^ratApproxShift.
Instances For
Directed rounding down (toward -∞) for a rational ±(num/den) with den > 0.
We do not attempt to be "correctly rounded" in the IEEE-754 sense; we only need a sound lower bound.
Instances For
Directed rounding up (toward +∞) for a rational ±(num/den) with den > 0.
Instances For
divDown x y is a float32 lower bound for the exact real quotient (when finite and y ≠ 0).
Instances For
divUp x y is a float32 upper bound for the exact real quotient (when finite and y ≠ 0).