TorchLean API

FloatLib.Floats.Formats.DecimalInterchange.Algebraic.Special

Algebraic special values and preferred zero cohorts #

Reciprocal square root keeps the zero sign at its pole, including negative zero. Hypotenuse lets infinity dominate quiet NaNs but still signals any signaling NaN. Exact zeros use the preferred quantum clamped to the destination format.

theorem FloatLib.Floats.Formats.DecimalInterchange.sqrtMagnitude_zero (f : Format) (mode : RoundingMode) (preferred : ℤ) :
sqrtMagnitude f mode 0 preferred = { value := Datum.finite false 0 (max f.minQuantum (min preferred f.maxQuantum)) }
theorem FloatLib.Floats.Formats.DecimalInterchange.Arithmetic.rsqrt_zero (f : Format) (mode : RoundingMode) (s : Bool) (q : ℤ) :
rsqrt f mode (Datum.finite s 0 q) = { value := Datum.infinity s, status := { divideByZero := true } }

This is the IEEE signed-zero rule: reciprocal square root of -0 is -∞.

theorem FloatLib.Floats.Formats.DecimalInterchange.Arithmetic.hypot_zero (f : Format) (mode : RoundingMode) (sx sy : Bool) (qx qy : ℤ) :
hypot f mode (Datum.finite sx 0 qx) (Datum.finite sy 0 qy) = { value := Datum.finite false 0 (max f.minQuantum (min (min qx qy) f.maxQuantum)) }

Both zero signs disappear in a hypotenuse; the finer operand cohort is preferred.

theorem FloatLib.Floats.Formats.DecimalInterchange.Arithmetic.powInt_zero_neg (f : Format) (mode : RoundingMode) (s : Bool) (q n : ℤ) (hn : n < 0) :
powInt f mode (Datum.finite s 0 q) n = { value := Datum.infinity (powerSign s n), status := { divideByZero := true } }
theorem FloatLib.Floats.Formats.DecimalInterchange.Arithmetic.powInt_zero_pos (f : Format) (mode : RoundingMode) (s : Bool) (q n : ℤ) (hn : 0 < n) :
powInt f mode (Datum.finite s 0 q) n = { value := Datum.finite (powerSign s n) 0 (max f.minQuantum (min (q * n) f.maxQuantum)) }