exactnumber
Version:
Arbitrary-precision decimals. Enables making math calculations with rational numbers, without precision loss.
15 lines (14 loc) • 1.11 kB
TypeScript
import type { ExactNumberType } from './types';
export declare function parseParameter(x: number | bigint | string | ExactNumberType): ExactNumberType;
type ExactNumberInterface = {
(x: number | bigint | string | ExactNumberType, y?: number | bigint | string | ExactNumberType): ExactNumberType;
min: (...params: (number | bigint | string | ExactNumberType)[]) => ExactNumberType;
max: (...params: (number | bigint | string | ExactNumberType)[]) => ExactNumberType;
fromBase: (num: string, radix: number) => ExactNumberType;
isExactNumber: (x: any) => boolean;
range: (start: number | bigint | string | ExactNumberType, end: number | bigint | string | ExactNumberType, increment?: number | bigint | string | ExactNumberType) => Generator<ExactNumberType, void, unknown>;
gcd: (a: number | bigint | string | ExactNumberType, b: number | bigint | string | ExactNumberType) => ExactNumberType;
lcm: (a: number | bigint | string | ExactNumberType, b: number | bigint | string | ExactNumberType) => ExactNumberType;
};
export declare const ExactNumber: ExactNumberInterface;
export {};