ceil

math

Computes number rounded up to precision.

Signature

ceil(number: number, precision?: number): number

Parameters

NameTypeDescription
numbernumberThe number to round up
precision?numberThe precision to round up toDefault: 0

Returns

number - Returns the rounded up number

Examples

Round to integer

import { ceil } from 'dashlite'

const result = ceil(4.006)
console.log(result)

Output:

5

Round with precision

import { ceil } from 'dashlite'

const result = ceil(6.004, 2)
console.log(result)

Output:

6.01

Negative precision

import { ceil } from 'dashlite'

const result = ceil(6040, -2)
console.log(result)

Output:

6100

Available since version 1.0.0