decimal128
Version:
Partial implementation of IEEE 754 Decimal128 decimal floating-point numbers
27 lines (26 loc) • 909 B
text/typescript
import JSBI from "jsbi";
import { RoundingMode } from "./common.mjs";
export declare class Rational {
readonly numerator: JSBI;
readonly denominator: JSBI;
readonly isNegative: boolean;
constructor(p: JSBI, q: JSBI);
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;
}