UNPKG

@technobuddha/library

Version:
28 lines (27 loc) 1.01 kB
/** * Options for the {@link ceil} function * @group Math * @category Operations */ export type CeilOptions = { /** A small value to subtract from the input before applying the ceiling, useful for floating-point tolerance. Defaults to 0. */ tolerance?: number; /** The number of decimal places to consider when applying the ceiling. Defaults to 0. */ precision?: number; }; /** * Returns the smallest integer greater than or equal to the given number, with optional tolerance and precision adjustments. * @param input - The number to apply the ceiling operation to. * @param options - Optional configuration object. * @returns The smallest integer greater than or equal to the adjusted input. * @example * ```typescript * ceil(2.3); // 3 * ceil(-2.3); // -2 * ceil(2.0001, { tolerance: 0.001 }); // 2 * ceil(2.345, { precision: 2 }); // 2.35 * ``` * @group Math * @category Operations */ export declare function ceil(input: number, { tolerance, precision }?: CeilOptions): number;