Elm Exactly

Basis entryBasics.mul

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

Static basis

op stands for ↦ OTSTAT(op)* mul ↦ (∀number. number→number→number,v)\begin{array}{|clcl|}\hline \opv {\ }& \text{stands for} {\ }& \mapsto {\ }& \OTstat(\opv)\\\hline \kw{*} {\ }& \href{/standard/basis/Basics/mul}{\kw{mul}} {\ }& \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*, /, //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(mul,m,n) = {norm(m⋅n)}\begin{array}{rcll} \APPLY(\kw{mul},m,n) {\ }& = {\ }& \{\norm(m\cdot n)\} {\quad}& \end{array}
Figure 49: APPLY\APPLY on Int Values
APPLY(mul,x,y) = {NaN}if x or y is NaN,  or one is a zero and one an infinity = {sgn(x)sgn(y)⋅∞}if x or y is an infinity = {sgn(x)sgn(y)⋅0}if x or y is a zero = {fl(x⋅y)}otherwise\begin{array}{rcll} \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}\end{array}
Figure 50: APPLY\APPLY on Floats: Arithmetic
Read it in its chapter·Permanent address: /standard/basis/Basics/mul

Tests (6)

  • elm / InfixPrecMulOverAddTest
    `*` (precedence 7) binds more tightly than `+` (precedence 6).
  • elm / InfixPrecPowOverMulTest
    `^` (precedence 8) binds more tightly than `*` (precedence 7).
  • elm-core / FloatMulTest
    Float multiplication gives the expected sign and value for positive, mixed-sign, two negative and zero operands.
  • elm-core / IntMulTest
    Checks integer multiplication `*` with positive, mixed-sign, two negative and zero operands.
  • elm-core / StandardA40IntOverflowTest
    Int `+`, `-` and `*` give an Int, never an infinity or NaN, however large the exact result.
  • elm-core / StandardA45IntNegativeZeroTest
    Int has one zero: no Int operation gives a negative zero.

Discussions

Discuss this basis entry·Search the discussions on GitHub

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