UNPKG

2.06 kBTypeScriptView Raw
1declare module "bigfloat" {
2 /** Difference between closest possible IEEE 754 doubles between 1 and 2. */
3 export const dblEpsilon: number;
4 export class BigFloat {
5 /** Output EXACT value of an IEEE 754 double in base 2, 10 or 16.
6 * Exponent must be between -2 and 61, and last 3 bits of mantissa must be 0.
7 * Useful for debugging. */
8 static doubleToString(dbl: number, base?: number): string;
9 constructor(dbl?: number);
10 /** Set value from a floating point number (probably IEEE 754 double). */
11 setDouble(dbl: number): this;
12 /** Multiply by an integer and write output limbs to another list. */
13 private mulInt(factor, dstLimbList, srcPos, dstPos, overwriteMask);
14 private mulBig(multiplier);
15 /** Multiply and return product in a new BigFloat. */
16 mul(multiplier: number | BigFloat): BigFloat;
17 absDeltaFrom(other: BigFloat): number;
18 isZero(): boolean;
19 /** Return an arbitrary number with sign matching the result of this - other. */
20 deltaFrom(other: BigFloat): number;
21 private addBig(addend);
22 private subBig(subtrahend);
23 private addSub(addend, flip);
24 /** Add and return sum in a new BigFloat. */
25 add(addend: number | BigFloat): BigFloat;
26 /** Subtract and return difference in a new BigFloat. */
27 sub(subtrahend: number | BigFloat): BigFloat;
28 /** Divide by integer, replacing current value by quotient. Return integer remainder. */
29 private divInt(divisor);
30 private fractionToString(base, groupSize, digitList);
31 /** Convert to string in base 2, 10 or 16. */
32 toString(base?: number): string;
33 /** Remove leading and trailing insignificant zero digits. */
34 static trim(str: string): string;
35 private static padTbl;
36 isNegative: number;
37 fractionLen: number;
38 private static tempFloat;
39 /** List of digits in base 2^32, least significant first. */
40 private limbList;
41 }
42}