import { FixedX18Error } from './errors'; export type FractionTuple = [numerator: T, denominator: T]; export { FixedX18Error }; export declare class FixedX18 { readonly value: bigint; static RAW_ONE: bigint; static ONE: FixedX18; static NEG_ONE: FixedX18; static ZERO: FixedX18; static DECIMALS: number; constructor(value: bigint); get decimals(): number; static fromRawValue(this: void, rawValue: bigint): FixedX18; static fromBigIntString(this: void, rawString: string): FixedX18; /** * @deprecated use {@link FixedX18.fromInteger} instead. */ static fromBigint(this: void, value: bigint): FixedX18; static fromInteger(this: void, value: bigint): FixedX18; static fromString(this: void, value: string): FixedX18; private static readonly NUMBER_FORMATTER_OPTIONS; private static readonly NUMBER_FORMATTER; static fromNumber(this: void, value: number): FixedX18; static isFixedX18(value: unknown): value is FixedX18; get sign(): number; get bigintSign(): bigint; get fixedX18Sign(): FixedX18; neg(): FixedX18; add(other: FixedX18): FixedX18; sub(other: FixedX18): FixedX18; mulDown(other: FixedX18): FixedX18; mulUp(other: FixedX18): FixedX18; mulBigInt(other: bigint): FixedX18; static mulDown(a: FixedX18, b: FixedX18): FixedX18; static mulDown(a: bigint, b: FixedX18): bigint; static mulDown(a: FixedX18, b: bigint): bigint; static mulUp(a: FixedX18, b: FixedX18): FixedX18; static mulUp(a: bigint, b: FixedX18): bigint; static mulUp(a: FixedX18, b: bigint): bigint; divDown(other: FixedX18): FixedX18; divUp(other: FixedX18): FixedX18; divDownBigInt(other: bigint): FixedX18; static divDown(this: void, a: bigint, b: bigint): FixedX18; /** * @remarks * This one return bigint, as when we do calculation, we first shift a by * 18 decimals places. So that shifted places and the decimal places of b * will cancel out, lefting us with 0 decimal places. */ static divDown(this: void, a: bigint, b: FixedX18): bigint; inv(): FixedX18; static divUp(this: void, a: bigint, b: bigint): FixedX18; /** * @remarks * This one return bigint, as when we do calculation, we first shift a by * 18 decimals places. So that shifted places and the decimal places of b * will cancel out, lefting us with 0 decimal places. */ static divUp(this: void, a: bigint, b: FixedX18): bigint; mulFraction(other: FractionTuple): FixedX18; static mulFraction(a: bigint, b: FractionTuple): bigint; mulFractionUp(other: FractionTuple): FixedX18; static mulFractionUp(a: bigint, b: FractionTuple): bigint; abs(): FixedX18; min(other: FixedX18): FixedX18; max(other: FixedX18): FixedX18; subMax0(other: FixedX18): FixedX18; mulSqrt(other: FixedX18): FixedX18; sqrt(): FixedX18; isApproxEqualsTo(other: FixedX18, eps: FixedX18): boolean; static areApproxiatelyEquals(a: T, b: T, eps: FixedX18): boolean; isGreaterApproxEqualsTo(other: FixedX18, eps: FixedX18): boolean; isSmallerApproxEqualsTo(other: FixedX18, eps: FixedX18): boolean; static isAGreaterApproxB(a: T, b: T, eps: FixedX18): boolean; static isASmallerApproxB(a: T, b: T, eps: FixedX18): boolean; gt(other: FixedX18): boolean; gte(other: FixedX18): boolean; lt(other: FixedX18): boolean; lte(other: FixedX18): boolean; exactEq(other: FixedX18): boolean; isNegative(): boolean; isPositive(): boolean; is0(): boolean; ln(): FixedX18; exp(): FixedX18; pow(num: FixedX18): FixedX18; floor(): bigint; ceil(): bigint; /** * @example * FixedX18.fromString("123.456").round() should equivalent to "123" * FixedX18.fromString("123.456").round(1) should equivalent to "120" * FixedX18.fromString("123.456").round(-2) should equivalent to "123.46" * FixedX18.fromString("-123.456").round(-1) should equivalent to "-123.5" */ round(precision?: number): FixedX18; toString(): string; toNumber(): number; }