decimal128
Version:
Partial implementation of IEEE 754 Decimal128 decimal floating-point numbers
26 lines (25 loc) • 892 B
text/typescript
import { RoundingMode } from "./common.mjs";
export declare class Rational {
readonly numerator: bigint;
readonly denominator: bigint;
readonly isNegative: boolean;
constructor(p: bigint, q: bigint);
toString(): string;
static fromString(s: string): Rational;
scale10(n: number): Rational;
negate(): Rational;
private static _add;
private static _subtract;
private static _multiply;
static add(...theArgs: Rational[]): Rational;
static subtract(x: Rational, ...theArgs: Rational[]): Rational;
static multiply(...theArgs: Rational[]): Rational;
toFixed(n: number): string;
private static roundHalfEven;
private static roundHalfExpand;
private static roundCeil;
private static roundFloor;
round(numFractionalDigits: number, mode: RoundingMode): Rational;
cmp(x: Rational): -1 | 0 | 1;
isZero(): boolean;
}