Arith ceilFloorRound
Aus ExpeccoWiki
Inhaltsverzeichnis |
Schema
Schema for Ceiling, Floor and Round
Ceiling
Generates the smallest integral value which is greater than a given number (i.e. the next integer above).
Floor
Generates the largest integral value which is smaller than a given number (i.e. the previous integer below).
Round
Generates the nearest integral value for a given number.
RoundTo
Generates the nearest multiple of another number for a given number (i.e. rounds its value towards some delta number).
Examples
Sample results of ceiling, floor and rounded are:
| input | ceiling | floor | rounded |
|---|---|---|---|
| 1 | 1 | 1 | 1 |
| 1.2 | 2 | 1 | 1 |
| 1.5 | 2 | 1 | 2 |
| 1.6 | 2 | 1 | 2 |
| 2 | 2 | 2 | 2 |
RoundTo takes two input values:
| input | 1 | 0.1 | 0.01 | 0.2 | 0.5 | 10 |
|---|---|---|---|---|---|---|
| 1 | 1 | 1 | 1 | 1 | 1 | 0 |
| 1.2345 | 1 | 1.2 | 1.23 | 1.2 | 1 | 0 |
| 1.2456 | 1 | 1.2 | 1.25 | 1.2 | 1 | 0 |
| 1.2567 | 1 | 1.3 | 1.26 | 1.2 | 1 | 0 |
| 1.512 | 1 | 1.5 | 1.51 | 1.6 | 1.5 | 0 |
| 4.9 | 5 | 4.9 | 4.9 | 5 | 5 | 0 |
| 5.1 | 5 | 5.1 | 5.1 | 5 | 5 | 10 |
Revisions
Round and RoundTo have been added with 1.7.1.
The other blocks have been in the Standard Library since 1.6.
Back to Standard Library.
Previous: Arith [ Signum ]
Next: Arith [ E ]
