Elm Exactly

Basis entryBasics.add

A value of Basics. Its type is in Section C.3 Basics.

Static basis

op stands for ↦ OTSTAT(op)+, - add, sub ↦ (∀number. number→number→number,v)\begin{array}{|clcl|}\hline \opv {\ }& \text{stands for} {\ }& \mapsto {\ }& \OTstat(\opv)\\\hline \kw{+},\ \kw{-} {\ }& \href{/standard/basis/Basics/add}{\kw{add}},\ \href{/standard/basis/Basics/sub}{\kw{sub}} {\ }& \mapsto {\ }& (\forall\mv{number}.\,\mv{number} \rightarrow \mv{number} \rightarrow \mv{number}, \isv)\\\hline\end{array}
Figure 40: The Static Operator Table, OTSTAT\OTstat

Dynamic basis

opstands for ↦ OTDYN(op)arity+, -add, sub ↦ basic value2\begin{array}{|clclc|}\hline \opv {\quad}& \text{stands for} {\ }& \mapsto {\ }& \OTdyn(\opv) {\qquad}& \arity\\\hline \kw{+},\ \kw{-} {\quad}& \href{/standard/basis/Basics/add}{\kw{add}},\ \href{/standard/basis/Basics/sub}{\kw{sub}} {\ }& \mapsto {\ }& \text{basic value} {\qquad}& 2\\\hline\end{array}
Figure 46: The Dynamic Operator Table, OTDYN\OTdyn

Its APPLY

APPLY(add,m,n) = {norm(m+n)}\begin{array}{rcll} \APPLY(\kw{add},m,n) {\ }& = {\ }& \{\norm(m+n)\} {\quad}& \end{array}
Figure 49: APPLY\APPLY on Int Values
APPLY(add,x,y) = {NaN}if x or y is NaN,  or {x,y}={+∞,−∞} = {x}if x∈{+∞,−∞} = {y}if y∈{+∞,−∞} = {−0}if x and y are both −0 = {fl(x+y)}otherwise\begin{array}{rcll} \APPLY(\kw{add},x,y) {\ }& = {\ }& \{\dbNaN\} {\quad}& \text{if}\ x\ \text{or}\ y\ \text{is}\ \dbNaN,\\ {\ }& {\ }& {\quad}& \text{or}\ \{x,y\}=\{+\infty,-\infty\}\\ {\ }& = {\ }& \{x\} {\quad}& \text{if}\ x\in\{+\infty,-\infty\}\\ {\ }& = {\ }& \{y\} {\quad}& \text{if}\ y\in\{+\infty,-\infty\}\\ {\ }& = {\ }& \{-0\} {\quad}& \text{if}\ x\ \text{and}\ y\ \text{are both}\ -0\\ {\ }& = {\ }& \{\dbfl(x+y)\} {\quad}& \text{otherwise}\end{array}
Figure 50: APPLY\APPLY on Floats: Arithmetic
Read it in its chapter·Permanent address: /standard/basis/Basics/add

Tests (6)

Discussions

Discuss this basis entry·Search the discussions on GitHub

Discussions are on GitHub; one about this basis entry has [b:Basics.add] in its title.

A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.