floor
mathComputes number rounded down to precision.
Signature
floor(number: number, precision?: number): numberParameters
| Name | Type | Description |
|---|---|---|
number | number | The number to round down |
precision? | number | The precision to round down toDefault: 0 |
Returns
number - Returns the rounded down number
Examples
Round to integer
import { floor } from 'dashlite'
const result = floor(4.006)
console.log(result)Output:
4Round with precision
import { floor } from 'dashlite'
const result = floor(0.046, 2)
console.log(result)Output:
0.04Negative precision
import { floor } from 'dashlite'
const result = floor(4060, -2)
console.log(result)Output:
4000Available since version 1.0.0