Elm Exactly

Basis entryBasics.floor

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

Static basis

var or con ↦ (σ,is)round, floor ↦ (Float→Int,v)\begin{array}{|rcl|}\hline \var\ \text{or}\ \con {\ }& \mapsto {\ }& (\sigma, \is)\\\hline \href{/standard/basis/Basics/round}{\kw{round}},\ \href{/standard/basis/Basics/floor}{\kw{floor}} {\ }& \mapsto {\ }& (\tFloat \rightarrow \tInt, \isv)\\\hline\end{array}
Figure 38: Static VE\VE of ME0(Basics)\ME_0(\kw{Basics}): Constructors, Conversions, Comparison, Booleans and Integer Functions

Dynamic basis

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

Its APPLY

APPLY(floor,x) = {sat(⌊x⌋)}if x∈Fltfin\begin{array}{rcll} \APPLY(\kw{floor},x) {\ }& = {\ }& \{\dbsat(\lfloor x\rfloor)\} {\quad}& \text{if}\ x\in\effFltFin\end{array}
Figure 53: APPLY\APPLY on Conversions
Read it in its chapter·Permanent address: /standard/basis/Basics/floor

Tests (3)

  • elm-core / FloatFloorTest
    `floor` rounds a `Float` down towards negative infinity, for positive, whole and negative values.
  • elm-core / FloorToIntTest
    `floor` rounds a Float down to an Int: 2.7 gives 2 and -2.3 gives -3.
  • elm-core / StandardA44RoundNonFiniteTest
    `round`, `floor` and `ceiling` of NaN are `0`, and of an infinity an Int.

Discussions

Discuss this basis entry·Search the discussions on GitHub

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