Elm Exactly

Basis entryBasics.sqrt

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

Static basis

var ↦ (σ,is)sqrt ↦ (Float→Float,v)\begin{array}{|rcl|}\hline \var {\ }& \mapsto {\ }& (\sigma, \is)\\\hline \href{/standard/basis/Basics/sqrt}{\kw{sqrt}} {\ }& \mapsto {\ }& (\tFloat \rightarrow \tFloat, \isv)\\\hline\end{array}
Figure 39: Static VE\VE of ME0(Basics)\ME_0(\kw{Basics}): Floating-point Functions and Function Helpers

Dynamic basis

var or con ↦ varitysqrt ↦ basic value1\begin{array}{|rclc|}\hline \var\ \text{or}\ \con {\ }& \mapsto {\ }& v {\qquad}& \arity\\\hline \href{/standard/basis/Basics/sqrt}{\kw{sqrt}} {\ }& \mapsto {\ }& \text{basic value} {\qquad}& 1\\\hline\end{array}
Figure 45: Dynamic VE\VE of ME0(Basics)\ME_0(\kw{Basics})

Its APPLY

APPLY(sqrt,x) = {NaN}if x is NaN, or x<0 = {x}if x∈{+0,−0,+∞} = {fl(x)}otherwise\begin{array}{rcll} \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}
Figure 50: APPLY\APPLY on Floats: Arithmetic
Read it in its chapter·Permanent address: /standard/basis/Basics/sqrt

Tests (1)

  • elm-core / FloatSqrtTest
    `sqrt` of 4.0, 9.0 and 0.0 is 2, 3 and 0.

Discussions

Discuss this basis entry·Search the discussions on GitHub

Discussions are on GitHub; one about this basis entry has [b:Basics.sqrt] 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.