NLA-lib Explorer

Catalog: scalar arithmetic

Library · Source module

Catalog: scalar arithmetic

The group NLAlib.Ops.ScalarOp of scalar operations and its functional and numerical contracts.

* Functional (NLAlib.Ops.IsScalar): every scalar operation is the function of a machine NLAlib.Ops.Machine K on words, on all operands (scalar operations may alias). * Mathematics (NLAlib.Ops.StdModel): the standard model of rounded arithmetic at the unit roundoff u, a property of the functions of the machine on decoded values. The unit roundoff is a parameter; nothing fixes one precision. The model is unconditional: it has no overflow or underflow; a finite-format model needs explicit range guards and an absolute allowance. * Mathematics (NLAlib.Ops.MixedModel): relative plus absolute rounding bounds on an explicit range, including underflow. Arithmetic outside the range remains specified by the machine, with no numerical accuracy promised there.

Division is specified only for a divisor that decodes to a nonzero number, and the square root only for a nonnegative argument: outside, the model says nothing of the result, so no theorem can be proved through a division by zero. Every literal is rounded (StdModel.lit), so zero is exact.

Witnesses: exact real arithmetic meets both for every u ≥ 0 (NLAlib.Ops.exists_isScalar), and so does the machine that inflates every result by the factor 1 + u (NLAlib.Ops.stdModel_infl), which is not exact and attains the bounds.

Main results

* NLAlib.Ops.exists_isScalar: the contracts of scalar arithmetic can be met. * NLAlib.Ops.MixedModel.abs_add_mul_sub_le: guarded multiply-add with absolute error. * NLAlib.Ops.StdModel.abs_add_mul_sub_le: two rounded operations.

Declarations