Elm Exactly

Figuredynamic-basis-conv

Figure 53, APPLY\APPLY on Conversions, in Section D.4.4 Conversions.

APPLY(toFloat,n) = {fl(n)}APPLY(Char.toCode,ch) = {code(ch)}APPLY(Char.fromCode,n) = {ch}if n is a Unicode scalar value  and code(ch)=n = {other(n)}otherwiseAPPLY(round,x) = {sat(⌊x+12⌋)}if x∈FltfinAPPLY(floor,x) = {sat(⌊x⌋)}if x∈FltfinAPPLY(ceiling,x) = {sat(⌈x⌉)}if x∈FltfinAPPLY(truncate,x) = {sat(trunc(x))}if x∈FltfinAPPLY(b,x) = {sat(x)}if x∈{+∞,−∞}APPLY(b,NaN) = {0} \begin{array}{rcll} \APPLY(\kw{toFloat},n) {\ }& = {\ }& \{\dbfl(n)\} {\quad}& \\[1ex] \APPLY(\kw{Char.toCode},\dbch) {\ }& = {\ }& \{\dbcode(\dbch)\} {\quad}& \\ \APPLY(\kw{Char.fromCode},n) {\ }& = {\ }& \{\dbch\} {\quad}& \text{if}\ n\ \text{is a Unicode scalar value}\\ {\ }& {\ }& {\quad}& \text{and}\ \dbcode(\dbch)=n\\ {\ }& = {\ }& \{\mathit{other}(n)\} {\quad}& \text{otherwise}\\[1ex] \APPLY(\kw{round},x) {\ }& = {\ }& \{\dbsat(\lfloor x+\tfrac{1}{2}\rfloor)\} {\quad}& \text{if}\ x\in\effFltFin\\ \APPLY(\kw{floor},x) {\ }& = {\ }& \{\dbsat(\lfloor x\rfloor)\} {\quad}& \text{if}\ x\in\effFltFin\\ \APPLY(\kw{ceiling},x) {\ }& = {\ }& \{\dbsat(\lceil x\rceil)\} {\quad}& \text{if}\ x\in\effFltFin\\ \APPLY(\kw{truncate},x) {\ }& = {\ }& \{\dbsat(\dbtrunc(x))\} {\quad}& \text{if}\ x\in\effFltFin\\[1ex] \APPLY(b,x) {\ }& = {\ }& \{\dbsat(x)\} {\quad}& \text{if}\ x\in\{+\infty,-\infty\}\\ \APPLY(b,\dbNaN) {\ }& = {\ }& \{0\} {\quad}& \end{array}
Figure 53: APPLY\APPLY on Conversions
Read it in its chapter·Permanent address: /standard/figures/dynamic-basis-conv

Referred to from

Tests (0)

No test of the suite checks this figure yet.

Discussions

Discuss this figure·Search the discussions on GitHub

Discussions are on GitHub; one about this figure has [fig:dynamic-basis-conv] 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.