Figuredynamic-basis-float Figure 50 , A P P L Y \APPLY APPLY on Floats: Arithmetic, in Section D.4.2 Floating-Point Arithmetic .
A P P L Y ( negate , x ) = { N a N } if x is N a N = { ( − 1 ) ⋅ x } otherwise A P P L Y ( add , x , y ) = { N a N } if x or y is N a N , or { x , y } = { + ∞ , − ∞ } = { x } if x ∈ { + ∞ , − ∞ } = { y } if y ∈ { + ∞ , − ∞ } = { − 0 } if x and y are both − 0 = { f l ( x + y ) } otherwise A P P L Y ( sub , x , y ) = A P P L Y ( add , x , z ) where A P P L Y ( negate , y ) = { z } A P P L Y ( mul , x , y ) = { N a N } if x or y is N a N , or one is a zero and one an infinity = { s g n ( x ) s g n ( y ) ⋅ ∞ } if x or y is an infinity = { s g n ( x ) s g n ( y ) ⋅ 0 } if x or y is a zero = { f l ( x ⋅ y ) } otherwise A P P L Y ( fdiv , x , y ) = { N a N } if x or y is N a N , or both are zeros, or both infinities = { s g n ( x ) s g n ( y ) ⋅ ∞ } if x is an infinity, or y a zero = { s g n ( x ) s g n ( y ) ⋅ 0 } if x is a zero, or y an infinity = { f l ( x / y ) } otherwise A P P L Y ( sqrt , x ) = { N a N } if x is N a N , or x < 0 = { x } if x ∈ { + 0 , − 0 , + ∞ } = { f l ( x ) } otherwise
\begin{array}{rcll}
\APPLY(\kw{negate},x) {\ }& = {\ }& \{\dbNaN\} {\quad}& \text{if}\ x\ \text{is}\ \dbNaN\\
{\ }& = {\ }& \{(-1)\cdot x\} {\quad}& \text{otherwise}\\[1ex]
\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}\\[1ex]
\APPLY(\kw{sub},x,y) {\ }& = {\ }& \APPLY(\kw{add},x,z) {\quad}& \text{where}\ \APPLY(\kw{negate},y)=\{z\}\\[1ex]
\APPLY(\kw{mul},x,y) {\ }& = {\ }& \{\dbNaN\} {\quad}& \text{if}\ x\ \text{or}\ y\ \text{is}\ \dbNaN,\\
{\ }& {\ }& {\quad}& \text{or one is a zero and one an infinity}\\
{\ }& = {\ }& \{\dbsgn(x)\dbsgn(y)\cdot\infty\} {\quad}& \text{if}\ x\ \text{or}\ y\ \text{is an infinity}\\
{\ }& = {\ }& \{\dbsgn(x)\dbsgn(y)\cdot 0\} {\quad}& \text{if}\ x\ \text{or}\ y\ \text{is a zero}\\
{\ }& = {\ }& \{\dbfl(x\cdot y)\} {\quad}& \text{otherwise}\\[1ex]
\APPLY(\kw{fdiv},x,y) {\ }& = {\ }& \{\dbNaN\} {\quad}& \text{if}\ x\ \text{or}\ y\ \text{is}\ \dbNaN,\\
{\ }& {\ }& {\quad}& \text{or both are zeros, or both infinities}\\
{\ }& = {\ }& \{\dbsgn(x)\dbsgn(y)\cdot\infty\} {\quad}& \text{if}\ x\ \text{is an infinity,}\ \text{or}\ y\ \text{a zero}\\
{\ }& = {\ }& \{\dbsgn(x)\dbsgn(y)\cdot 0\} {\quad}& \text{if}\ x\ \text{is a zero,}\ \text{or}\ y\ \text{an infinity}\\
{\ }& = {\ }& \{\dbfl(x/y)\} {\quad}& \text{otherwise}\\[1ex]
\APPLY(\kw{sqrt},x) {\ }& = {\ }& \{\dbNaN\} {\quad}& \text{if}\ x\ \text{is}\ \dbNaN,\ \text{or}\ x<0\\
{\ }& = {\ }& \{x\} {\quad}& \text{if}\ x\in\{+0,-0,+\infty\}\\
{\ }& = {\ }& \{\dbfl(\sqrt{x})\} {\quad}& \text{otherwise}
\end{array}
APPLY ( negate , x ) APPLY ( add , x , y ) APPLY ( sub , x , y ) APPLY ( mul , x , y ) APPLY ( fdiv , x , y ) APPLY ( sqrt , x ) = = = = = = = = = = = = = = = = = = = { NaN } {( − 1 ) ⋅ x } { NaN } { x } { y } { − 0 } { fl ( x + y )} APPLY ( add , x , z ) { NaN } { sgn ( x ) sgn ( y ) ⋅ ∞ } { sgn ( x ) sgn ( y ) ⋅ 0 } { fl ( x ⋅ y )} { NaN } { sgn ( x ) sgn ( y ) ⋅ ∞ } { sgn ( x ) sgn ( y ) ⋅ 0 } { fl ( x / y )} { NaN } { x } { fl ( x )} if x is NaN otherwise if x or y is NaN , or { x , y } = { + ∞ , − ∞ } if x ∈ { + ∞ , − ∞ } if y ∈ { + ∞ , − ∞ } if x and y are both − 0 otherwise where APPLY ( negate , y ) = { z } if x or y is NaN , or one is a zero and one an infinity if x or y is an infinity if x or y is a zero otherwise if x or y is NaN , or both are zeros, or both infinities if x is an infinity, or y a zero if x is a zero, or y an infinity otherwise if x is NaN , or x < 0 if x ∈ { + 0 , − 0 , + ∞ } otherwise A P P L Y ( isNaN , x ) = { True } if x is N a N = { False } otherwise A P P L Y ( isInfinite , x ) = { True } if x ∈ { + ∞ , − ∞ } = { False } otherwise
\begin{array}{rcll}
\APPLY(\kw{isNaN},x) {\ }& = {\ }& \{\kw{True}\} {\quad}& \text{if}\ x\ \text{is}\ \dbNaN\\
{\ }& = {\ }& \{\kw{False}\} {\quad}& \text{otherwise}\\[1ex]
\APPLY(\kw{isInfinite},x) {\ }& = {\ }& \{\kw{True}\} {\quad}& \text{if}\ x\in\{+\infty,-\infty\}\\
{\ }& = {\ }& \{\kw{False}\} {\quad}& \text{otherwise}
\end{array}
APPLY ( isNaN , x ) APPLY ( isInfinite , x ) = = = = { True } { False } { True } { False } if x is NaN otherwise if x ∈ { + ∞ , − ∞ } otherwise Figure 50 : A P P L Y \APPLY APPLY on Floats: Arithmetic