A floating-point machine that rounds every result to a binary format
Library · Source module
A floating-point machine that rounds every result to a binary format
NLAlib.binaryFloatMachine fmt r is a NLAlib.FloatMachine on stored reals whose arithmetic rounds its exact result to the grid of the binary format fmt with gradual underflow (NLAlib.Computation.binaryFloatRound, nearest selector r): conversion, addition, subtraction, multiplication and division, the normal sampler, and the two black boxes, which are correctly rounded (they compute the exact product, or an exact QR factorization, and round each entry, real and imaginary parts separately). Zero, one, negation, comparison and the floor conversion are exact, and the uniform sampler rounds s\mathbf{v} and then clamps it to [-s, s]. Stored values are arbitrary reals, so exact negation of an off-grid input and the clamp at an off-grid scale return values off the grid: in binary128 (p = 113), the scale s = 1 - 2^{-115} and every seed \mathbf{v} \le 1 with s\mathbf{v} \ge 1 - 2^{-114} give \mathrm{unif}(s, \mathbf{v}) = s. Results are on the grid when the inputs and the scale are. Overflow is not modelled: the quantizer rounds a value above the largest finite number to the p-bit grid at an exponent the format does not have, so a rounded result is a number of the format only when it is at most the largest finite number in magnitude. The contract's error bounds for the scalar operations, the matrix product, the QR factorization and the normal sampler apply only up to that range. Its exactness clauses, the uniform sampler's support and error bounds (at every scale s \ge 0) and the exact Hermitian symmetry of a product with its conjugate transpose have no range guard, and the machine meets them at every scale. It satisfies the contract NLAlib.FloatMachine.IsAccurate with u = 2^{-p}, floor \tau = 2^{e_{\min} + p - 1}, range the largest finite number, \mu_{\mathrm{MM}}(d) = \mu_{\mathrm{QR}}(d) = 2d and c_{\mathrm{N}} = \sqrt2; with an odd selector the rounded product of a matrix with its conjugate transpose is exactly Hermitian. Unlike NLAlib.exists_floatMachine_isAccurate_binaryFloatRound, whose black boxes are exact, every rounded operation and black box of this machine returns a value of the rounding, and its samplers have countable ranges and measurable fibres, the hypotheses under which the sampling analysis of NLAlib.eigh applies.
Main definitions
* NLAlib.binaryFloatMachine: the machine.
Main results
* NLAlib.isAccurate_binaryFloatMachine: the contract. * NLAlib.countable_range_binaryFloatRound, NLAlib.measurable_binaryFloatRound. * NLAlib.measurable_intLog_abs, NLAlib.specNorm_sub_map_le: shared with the grid machine (NLAlib/Matrix/Computation/GridMachine.lean). * NLAlib.countable_range_unif_binaryFloatMachine, NLAlib.measurableSet_preimage_unif_binaryFloatMachine, NLAlib.countable_range_normal_binaryFloatMachine, NLAlib.measurableSet_preimage_normal_binaryFloatMachine: the samplers.
Declarations
- NLAlib.binaryFloatMachine
- NLAlib.countable_range_binaryFloatRound
- NLAlib.countable_range_normal_binaryFloatMachine
- NLAlib.countable_range_unif_binaryFloatMachine
- NLAlib.isAccurate_binaryFloatMachine
- NLAlib.measurableSet_preimage_normal_binaryFloatMachine
- NLAlib.measurableSet_preimage_unif_binaryFloatMachine
- NLAlib.measurable_binaryFloatRound
- NLAlib.measurable_intLog_abs
- NLAlib.specNorm_sub_map_le