# Terminology: algebraic structure for "floating point" arithmetic

"floating point arithmetic" is a terminology that refer to the arithmetic perform over (finite) representation of real number. See the wikipedia article for more details.

In the formal specification of floating point arithmetic (that should be used by all the major programming languages), it is specified that a "Not A number" (NaN) value should be a number.

If we abstract the fact that floating point arithmetic care only of finitely many values and abstract a bit, we get a sort of arithmetic arithmetic over $$\mathbb{R}\cup\{\textrm{NaN}\}$$ with $$\textrm{NaN}$$ being a zero for any arithmetic operation. Formally, for all $$x$$,
$$x\times \textrm{NaN} = x + \textrm{NaN} = \frac{x}{0} = \frac{0}{0}= \cdots =\textrm{NaN}$$

Is there any algebraic structures $$(E,+,\times)$$ having axioms allowing this or is it just to arbitrary to have been introduced even in weird part of algebra?

• Just to point out: Floating point arithmetic is rather horrible from an algebraic perspective. It does not even have associativity of addition, not to speak of any other nice properties.
– Arno
Oct 9 '18 at 13:30
• Sure, I abstract my way out of that and just care about this NaN value for this reason.
– C.P.
Oct 9 '18 at 13:31
• $x/0 = \infty$ rather than NaN in floating point (for $x>0$, $-\infty$ for $x < 0$) Oct 9 '18 at 14:00
• Also remember that NaN != NaN, which probably breaks all sorts of other axioms. Oct 9 '18 at 17:04
• You will find an introductory discussion about the operations on floating point numbers in the relevant chapter of “the Art of Computer Programming” (Knuth). As @arno pointed out, from an algebraic perspective, it is a rather horrible world. Besides the actual operations, the interesting structure to study is the representation error of the number and the statistical properties of this. (For instance, given the distribution of inputs for a program or formula it could be tractable to compute the distribution of the error in the output.) Oct 9 '18 at 18:51

One just picks an element $$\bot$$ not in the carrier set, and extends the operations as follows: Any operation applied to a tuple outside its original domain yields $$\bot$$, including any tuple containing a $$\bot$$ somewhere.
The structure you are describing is then just the $$1$$-point totalirization of the partial algebra $$(\mathbb{R},+,\times,/)$$. The algebras arising in such a manner will hardly ever have very familiar properties. In particular, I don't think people name them directly, and would rather speak about the underlying partial algebras.