UNPKG

@lvlte/ulp

Version:

Compute the unit in last place of a given IEEE-754 64-bit number

22 lines (21 loc) 725 B
/** * The smallest positive normal number representable by IEEE-754 float64. */ export declare const FLOAT64_MIN: number; /** * Return the unit in the last place or unit of least precision (ulp) of x, that * is, the distance between two consecutive representable floating-point numbers * at x. * * @param x The input number (default: 1) * @returns The ulp of x, or `NaN` if `x` is not a finite number. */ export declare function eps(x?: number): number; /** * Exponent of a normalized floating-point number x. * * @param x The input number * @returns The largest integer `y` such that `2^y ≤ |x|`, or `NaN` if x is not * a finite number / if x is ±0. */ export declare function exponent(x: number): number;