12
$\begingroup$

"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?

$\endgroup$
5
  • 5
    $\begingroup$ 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. $\endgroup$
    – Arno
    Commented Oct 9, 2018 at 13:30
  • $\begingroup$ Sure, I abstract my way out of that and just care about this NaN value for this reason. $\endgroup$
    – C.P.
    Commented Oct 9, 2018 at 13:31
  • 4
    $\begingroup$ $x/0 = \infty$ rather than NaN in floating point (for $x>0$, $-\infty$ for $x < 0$) $\endgroup$
    – J.J. Green
    Commented Oct 9, 2018 at 14:00
  • 3
    $\begingroup$ Also remember that NaN != NaN, which probably breaks all sorts of other axioms. $\endgroup$ Commented Oct 9, 2018 at 17:04
  • 1
    $\begingroup$ 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.) $\endgroup$ Commented Oct 9, 2018 at 18:51

1 Answer 1

12
$\begingroup$

The abstract picture here is that of adjoining an undefined or bottom element to a (partial) algebra. Doing this to a total algebra is boring, but it is a useful trick to turn partial algebras into total ones.

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.

$\endgroup$
1
  • $\begingroup$ Thanks, it was a bit expected. I am used to partial monoids and this kind of operations for them. $\endgroup$
    – C.P.
    Commented Oct 9, 2018 at 14:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .