Elm Exactly

Basis entryBasics.fdiv

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

Static basis

op stands for ↦ OTSTAT(op)/ fdiv ↦ (Float→Float→Float,v)\begin{array}{|clcl|}\hline \opv {\ }& \text{stands for} {\ }& \mapsto {\ }& \OTstat(\opv)\\\hline \kw{/} {\ }& \href{/standard/basis/Basics/fdiv}{\kw{fdiv}} {\ }& \mapsto {\ }& (\tFloat \rightarrow \tFloat \rightarrow \tFloat, \isv)\\\hline\end{array}
Figure 40: The Static Operator Table, OTSTAT\OTstat

Dynamic basis

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

Its APPLY

APPLY(fdiv,x,y) = {NaN}if x or y is NaN,  or both are zeros, or both infinities = {sgn(x)sgn(y)⋅∞}if x is an infinity, or y a zero = {sgn(x)sgn(y)⋅0}if x is a zero, or y an infinity = {fl(x/y)}otherwise\begin{array}{rcll} \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}\end{array}
Figure 50: APPLY\APPLY on Floats: Arithmetic
Read it in its chapter·Permanent address: /standard/basis/Basics/fdiv

Tests (4)

  • elm / InfixAssocLeftArithTest
    `-`, `/` and `//` associate to the left.
  • elm-core / BasicsIsNaNTest
    `isNaN` is true for `0 / 0` and false for 42.0, and `isInfinite` is true for `1 / 0` and false for 42.0.
  • elm-core / FloatDivTest
    `/` on `Float` values for each combination of signs of the dividend and divisor.
  • elm-core / FloatNegativeZeroTest
    Negative zero (`-0.0`) equals 0.0, and dividing 1.0 by it gives -Infinity while dividing by 0.0 gives Infinity.

Discussions

Discuss this basis entry·Search the discussions on GitHub

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