@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
| Parameter | Type | Description |
|---|---|---|
input | number | The number to floor. |
options | FloorOptions | Optional 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