@tempots/std

floorTo() function

Rounds a number down to the specified number of decimals.

Signature:

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

Parameters

Parameter

Type

Description

v

number

The number to round down.

decimals

number

The number of decimals to round down to.

Returns: number

The rounded down number.

Example

floorTo(1.234, 2) // returns 1.23
floorTo(1.234, 1) // returns 1.2
floorTo(1.234, 0) // returns 1