UNPKG

@typester/big-rational

Version:

BigRational is a ~1kB arbitrary precision rational number library powered by the native BigInt type.

28 lines (26 loc) 836 B
declare class BigRational { #private; private constructor(); static from(numerator: bigint, denominator: bigint): BigRational; static fromString(string: string): BigRational; numerator(): bigint; denominator(): bigint; add(other: BigRational): BigRational; subtract(other: BigRational): BigRational; multiply(other: BigRational): BigRational; divide(other: BigRational): BigRational; compare(other: BigRational): number; power(n: bigint): BigRational; modulo(other: BigRational): BigRational; floor(): bigint; ceil(): bigint; truncate(): bigint; negate(): BigRational; inverse(): BigRational; abs(): BigRational; toNumberApproximate(): number; toFractionString(): string; toMixedString(): string; toString(): string; } export { BigRational };