Skip to content

@technobuddha > library > Math > Operations

Function: floor() ​

ts
function floor(input: number, options: FloorOptions): number;

Defined in: floor.ts:31

Returns the largest integer less than or equal to the given number, with optional tolerance and precision adjustments.

Parameters ​

ParameterTypeDescription
inputnumberThe number to floor.
optionsFloorOptionsOptional settings for the operation.

Returns ​

number

The floored number, adjusted for tolerance and precision.

Example ​

typescript
floor(2.7); // 2
floor(-2.7); // -3
floor(2.999, { tolerance: 0.001 }); // 2
floor(2.345, { precision: 2 }); // 2.34