@tempots/std

ceilTo() function

Rounds a number up to the specified number of decimals.

Signature:

ceilTo: (v: number, decimals: number) => number

Parameters

Parameter

Type

Description

v

number

The number to round up.

decimals

number

The number of decimals to round up to.

Returns: number

The rounded up number.

Example

ceilTo(1.234, 2) // returns 1.24
ceilTo(1.234, 1) // returns 1.3
ceilTo(1.234, 0) // returns 2