Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bignumber.js

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bignumber.js - npm Package Compare versions

Comparing version 5.0.0 to 6.0.0

CHANGELOG.md

2871

bignumber.d.ts

@@ -1,1295 +0,1772 @@

// Type definitions for Bignumber.js
// Project: bignumber.js
// Definitions by: Felix Becker https://github.com/felixfbecker
// Type definitions for bignumber.js >=6.0.0
// Project: https://github.com/MikeMcl/bignumber.js
// Definitions by: Michael Mclaughlin <https://github.com/MikeMcl>
// Definitions: https://github.com/MikeMcl/bignumber.js
export interface Format {
/** the decimal separator */
decimalSeparator?: string;
/** the grouping separator of the integer part */
groupSeparator?: string;
/** the primary grouping size of the integer part */
groupSize?: number;
/** the secondary grouping size of the integer part */
secondaryGroupSize?: number;
/** the grouping separator of the fraction part */
fractionGroupSeparator?: string;
/** the grouping size of the fraction part */
fractionGroupSize?: number;
}
// Documentation: http://mikemcl.github.io/bignumber.js/
//
// Exports (available globally or when using import):
//
// class BigNumber (default export)
// type BigNumber.Constructor
// type BigNumber.Instance
// type BigNumber.ModuloMode
// type BigNumber.RoundingMOde
// type BigNumber.Value
// interface BigNumber.Config
// interface BigNumber.Format
//
// Example (alternative syntax commented-out):
//
// import {BigNumber} from "bignumber.js"
// //import BigNumber from "bignumber.js"
//
// let rm: BigNumber.RoundingMode = BigNumber.ROUND_UP;
// let f: BigNumber.Format = { decimalSeparator: ',' };
// let c: BigNumber.Config = { DECIMAL_PLACES: 4, ROUNDING_MODE: rm, FORMAT: f };
// BigNumber.config(c);
//
// let v: BigNumber.Value = '12345.6789';
// let b: BigNumber = new BigNumber(v);
// //let b: BigNumber.Instance = new BigNumber(v);
//
// The use of compiler option `--strictNullChecks` is recommended.
export interface Configuration {
/**
* integer, `0` to `1e+9` inclusive
*
* The maximum number of decimal places of the results of operations involving division, i.e. division, square root
* and base conversion operations, and power operations with negative exponents.
*
* ```ts
* BigNumber.config({ DECIMAL_PLACES: 5 })
* BigNumber.config(5) // equivalent
* ```
* @default 20
*/
DECIMAL_PLACES?: number;
type BigNumberConstructor = typeof BigNumber;
type BigNumberInstance = BigNumber;
type BigNumberModuloMode = BigNumberRoundingMode | 9;
type BigNumberRoundingMode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
type BigNumberValue = string | number | BigNumber;
/**
* The rounding mode used in the above operations and the default rounding mode of round, toExponential, toFixed,
* toFormat and toPrecision. The modes are available as enumerated properties of the BigNumber constructor.
* @default [[RoundingMode.ROUND_HALF_UP]]
*/
ROUNDING_MODE?: RoundingMode;
/**
* See `BigNumber.config` and `BigNumber.clone`.
*/
interface BigNumberConfig {
/**
* - `number`: integer, magnitude `0` to `1e+9` inclusive
* - `number[]`: [ integer `-1e+9` to `0` inclusive, integer `0` to `1e+9` inclusive ]
*
* The exponent value(s) at which `toString` returns exponential notation.
*
* If a single number is assigned, the value
* is the exponent magnitude.
*
* If an array of two numbers is assigned then the first number is the negative exponent
* value at and beneath which exponential notation is used, and the second number is the positive exponent value at
* and above which the same.
*
* For example, to emulate JavaScript numbers in terms of the exponent values at which
* they begin to use exponential notation, use [-7, 20].
*
* ```ts
* BigNumber.config({ EXPONENTIAL_AT: 2 })
* new BigNumber(12.3) // '12.3' e is only 1
* new BigNumber(123) // '1.23e+2'
* new BigNumber(0.123) // '0.123' e is only -1
* new BigNumber(0.0123) // '1.23e-2'
*
* BigNumber.config({ EXPONENTIAL_AT: [-7, 20] })
* new BigNumber(123456789) // '123456789' e is only 8
* new BigNumber(0.000000123) // '1.23e-7'
*
* // Almost never return exponential notation:
* BigNumber.config({ EXPONENTIAL_AT: 1e+9 })
*
* // Always return exponential notation:
* BigNumber.config({ EXPONENTIAL_AT: 0 })
* ```
* Regardless of the value of `EXPONENTIAL_AT`, the `toFixed` method will always return a value in normal notation
* and the `toExponential` method will always return a value in exponential form.
*
* Calling `toString` with a base argument, e.g. `toString(10)`, will also always return normal notation.
*
* @default `[-7, 20]`
*/
EXPONENTIAL_AT?: number | [number, number];
/**
* An integer, 0 to 1e+9. Default value: 20.
*
* The maximum number of decimal places of the result of operations involving division, i.e.
* division, square root and base conversion operations, and exponentiation when the exponent is
* negative.
*
* ```ts
* BigNumber.config({ DECIMAL_PLACES: 5 })
* BigNumber.set({ DECIMAL_PLACES: 5 })
* ```
*/
DECIMAL_PLACES?: number;
/**
* - number: integer, magnitude `1` to `1e+9` inclusive
* - number[]: [ integer `-1e+9` to `-1` inclusive, integer `1` to `1e+9` inclusive ]
*
* The exponent value(s) beyond which overflow to `Infinity` and underflow to zero occurs.
*
* If a single number is
* assigned, it is the maximum exponent magnitude: values wth a positive exponent of greater magnitude become
* Infinity and those with a negative exponent of greater magnitude become zero.
*
* If an array of two numbers is
* assigned then the first number is the negative exponent limit and the second number is the positive exponent
* limit.
*
* For example, to emulate JavaScript numbers in terms of the exponent values at which they become zero and
* Infinity, use [-324, 308].
*
* ```ts
* BigNumber.config({ RANGE: 500 })
* BigNumber.config().RANGE // [ -500, 500 ]
* new BigNumber('9.999e499') // '9.999e+499'
* new BigNumber('1e500') // 'Infinity'
* new BigNumber('1e-499') // '1e-499'
* new BigNumber('1e-500') // '0'
* BigNumber.config({ RANGE: [-3, 4] })
* new BigNumber(99999) // '99999' e is only 4
* new BigNumber(100000) // 'Infinity' e is 5
* new BigNumber(0.001) // '0.01' e is only -3
* new BigNumber(0.0001) // '0' e is -4
* ```
*
* The largest possible magnitude of a finite BigNumber is `9.999...e+1000000000`.
*
* The smallest possible magnitude of a non-zero BigNumber is `1e-1000000000`.
*
* @default `[-1e+9, 1e+9]`
*/
RANGE?: number | [number, number];
/**
* An integer, 0 to 8. Default value: `BigNumber.ROUND_HALF_UP` (4).
*
* The rounding mode used in operations that involve division (see `DECIMAL_PLACES`) and the
* default rounding mode of the `decimalPlaces`, `precision`, `toExponential`, `toFixed`,
* `toFormat` and `toPrecision` methods.
*
* The modes are available as enumerated properties of the BigNumber constructor.
*
* ```ts
* BigNumber.config({ ROUNDING_MODE: 0 })
* BigNumber.set({ ROUNDING_MODE: BigNumber.ROUND_UP })
* ```
*/
ROUNDING_MODE?: BigNumberRoundingMode;
/**
*
* The value that determines whether BigNumber Errors are thrown. If ERRORS is false, no errors will be thrown.
* `true`, `false`, `0` or `1`.
* ```ts
* BigNumber.config({ ERRORS: false })
* ```
*
* @default `true`
*/
ERRORS?: boolean | number;
/**
* An integer, 0 to 1e+9, or an array, [-1e+9 to 0, 0 to 1e+9].
* Default value: `[-7, 20]`.
*
* The exponent value(s) at which `toString` returns exponential notation.
*
* If a single number is assigned, the value is the exponent magnitude.
*
* If an array of two numbers is assigned then the first number is the negative exponent value at
* and beneath which exponential notation is used, and the second number is the positive exponent
* value at and above which exponential notation is used.
*
* For example, to emulate JavaScript numbers in terms of the exponent values at which they begin
* to use exponential notation, use `[-7, 20]`.
*
* ```ts
* BigNumber.config({ EXPONENTIAL_AT: 2 })
* new BigNumber(12.3) // '12.3' e is only 1
* new BigNumber(123) // '1.23e+2'
* new BigNumber(0.123) // '0.123' e is only -1
* new BigNumber(0.0123) // '1.23e-2'
*
* BigNumber.config({ EXPONENTIAL_AT: [-7, 20] })
* new BigNumber(123456789) // '123456789' e is only 8
* new BigNumber(0.000000123) // '1.23e-7'
*
* // Almost never return exponential notation:
* BigNumber.config({ EXPONENTIAL_AT: 1e+9 })
*
* // Always return exponential notation:
* BigNumber.config({ EXPONENTIAL_AT: 0 })
* ```
*
* Regardless of the value of `EXPONENTIAL_AT`, the `toFixed` method will always return a value in
* normal notation and the `toExponential` method will always return a value in exponential form.
* Calling `toString` with a base argument, e.g. `toString(10)`, will also always return normal
* notation.
*/
EXPONENTIAL_AT?: number|[number, number];
/**
* `true`, `false`, `0` or `1`.
*
* The value that determines whether cryptographically-secure pseudo-random number generation is used.
*
* If `CRYPTO` is set to `true` then the random method will generate random digits using `crypto.getRandomValues` in
* browsers that support it, or `crypto.randomBytes` if using a version of Node.js that supports it.
*
* If neither function is supported by the host environment then attempting to set `CRYPTO` to `true` will fail, and
* if [[Configuration.ERRORS]] is `true` an exception will be thrown.
*
* If `CRYPTO` is `false` then the source of randomness used will be `Math.random` (which is assumed to generate at
* least 30 bits of randomness).
*
* See [[BigNumber.random]].
*
* ```ts
* BigNumber.config({ CRYPTO: true })
* BigNumber.config().CRYPTO // true
* BigNumber.random() // 0.54340758610486147524
* ```
*
* @default `false`
*/
CRYPTO?: boolean | number;
/**
* An integer, magnitude 1 to 1e+9, or an array, [-1e+9 to -1, 1 to 1e+9].
* Default value: `[-1e+9, 1e+9]`.
*
* The exponent value(s) beyond which overflow to Infinity and underflow to zero occurs.
*
* If a single number is assigned, it is the maximum exponent magnitude: values wth a positive
* exponent of greater magnitude become Infinity and those with a negative exponent of greater
* magnitude become zero.
*
* If an array of two numbers is assigned then the first number is the negative exponent limit and
* the second number is the positive exponent limit.
*
* For example, to emulate JavaScript numbers in terms of the exponent values at which they
* become zero and Infinity, use [-324, 308].
*
* ```ts
* BigNumber.config({ RANGE: 500 })
* BigNumber.config().RANGE // [ -500, 500 ]
* new BigNumber('9.999e499') // '9.999e+499'
* new BigNumber('1e500') // 'Infinity'
* new BigNumber('1e-499') // '1e-499'
* new BigNumber('1e-500') // '0'
*
* BigNumber.config({ RANGE: [-3, 4] })
* new BigNumber(99999) // '99999' e is only 4
* new BigNumber(100000) // 'Infinity' e is 5
* new BigNumber(0.001) // '0.01' e is only -3
* new BigNumber(0.0001) // '0' e is -4
* ```
* The largest possible magnitude of a finite BigNumber is 9.999...e+1000000000.
* The smallest possible magnitude of a non-zero BigNumber is 1e-1000000000.
*/
RANGE?: number|[number, number];
/**
* The modulo mode used when calculating the modulus: `a mod n`.
*
* The quotient, `q = a / n`, is calculated according to
* the [[Configuration.ROUNDING_MODE]] that corresponds to the chosen MODULO_MODE.
*
* The remainder, r, is calculated as: `r = a - n * q`.
*
* The modes that are most commonly used for the modulus/remainder operation are shown in the following table.
* Although the other rounding modes can be used, they may not give useful results.
*
* Property | Value | Description
* -------------------|:-----:|---------------------------------------------------------------------------------------
* `ROUND_UP` | 0 | The remainder is positive if the dividend is negative, otherwise it is negative.
* `ROUND_DOWN` | 1 | The remainder has the same sign as the dividend. This uses 'truncating division' and matches the behaviour of JavaScript's remainder operator `%`.
* `ROUND_FLOOR` | 3 | The remainder has the same sign as the divisor.
* | | This matches Python's % operator.
* `ROUND_HALF_EVEN` | 6 | The IEEE 754 remainder function.
* `EUCLID` | 9 | The remainder is always positive. Euclidian division: `q = sign(n) * floor(a / abs(n))`
*
* The rounding/modulo modes are available as enumerated properties of the BigNumber constructor.
*
* See [[BigNumber.modulo]]
*
* ```ts
* BigNumber.config({ MODULO_MODE: BigNumber.EUCLID })
* BigNumber.config({ MODULO_MODE: 9 }) // equivalent
* ```
*
* @default [[RoundingMode.ROUND_DOWN]]
*/
MODULO_MODE?: RoundingMode;
/**
* A boolean: `true` or `false`. Default value: `false`.
*
* The value that determines whether cryptographically-secure pseudo-random number generation is
* used. If `CRYPTO` is set to true then the random method will generate random digits using
* `crypto.getRandomValues` in browsers that support it, or `crypto.randomBytes` if using a
* version of Node.js that supports it.
*
* If neither function is supported by the host environment then attempting to set `CRYPTO` to
* `true` will fail and an exception will be thrown.
*
* If `CRYPTO` is `false` then the source of randomness used will be `Math.random` (which is
* assumed to generate at least 30 bits of randomness).
*
* See `BigNumber.random`.
*
* ```ts
* BigNumber.config({ CRYPTO: true })
* BigNumber.config().CRYPTO // true
* BigNumber.random() // 0.54340758610486147524
* ```
*/
CRYPTO?: boolean;
/**
* integer, `0` to `1e+9` inclusive.
*
* The maximum number of significant digits of the result of the power operation (unless a modulus is specified).
*
* If set to 0, the number of signifcant digits will not be limited.
*
* See [[BigNumber.toPower]]
*
* ```ts
* BigNumber.config({ POW_PRECISION: 100 })
* ```
*
* @default 100
*/
POW_PRECISION?: number;
/**
* An integer, 0 to 9. Default value: `BigNumber.ROUND_DOWN` (1).
*
* The modulo mode used when calculating the modulus: `a mod n`.
* The quotient, `q = a / n`, is calculated according to the `ROUNDING_MODE` that corresponds to
* the chosen `MODULO_MODE`.
* The remainder, `r`, is calculated as: `r = a - n * q`.
*
* The modes that are most commonly used for the modulus/remainder operation are shown in the
* following table. Although the other rounding modes can be used, they may not give useful
* results.
*
* Property | Value | Description
* :------------------|:------|:------------------------------------------------------------------
* `ROUND_UP` | 0 | The remainder is positive if the dividend is negative.
* `ROUND_DOWN` | 1 | The remainder has the same sign as the dividend.
* | | Uses 'truncating division' and matches JavaScript's `%` operator .
* `ROUND_FLOOR` | 3 | The remainder has the same sign as the divisor.
* | | This matches Python's `%` operator.
* `ROUND_HALF_EVEN` | 6 | The IEEE 754 remainder function.
* `EUCLID` | 9 | The remainder is always positive.
* | | Euclidian division: `q = sign(n) * floor(a / abs(n))`
*
* The rounding/modulo modes are available as enumerated properties of the BigNumber constructor.
*
* See `modulo`.
*
* ```ts
* BigNumber.config({ MODULO_MODE: BigNumber.EUCLID })
* BigNumber.set({ MODULO_MODE: 9 }) // equivalent
* ```
*/
MODULO_MODE?: BigNumberModuloMode;
/**
* The FORMAT object configures the format of the string returned by the `toFormat` method. The example below shows
* the properties of the FORMAT object that are recognised, and their default values. Unlike the other configuration
* properties, the values of the properties of the FORMAT object will not be checked for validity. The existing
* FORMAT object will simply be replaced by the object that is passed in. Note that all the properties shown below
* do not have to be included.
*
* See `toFormat` for examples of usage.
*
* ```ts
* BigNumber.config({
* FORMAT: {
* // the decimal separator
* decimalSeparator: '.',
* // the grouping separator of the integer part
* groupSeparator: ',',
* // the primary grouping size of the integer part
* groupSize: 3,
* // the secondary grouping size of the integer part
* secondaryGroupSize: 0,
* // the grouping separator of the fraction part
* fractionGroupSeparator: ' ',
* // the grouping size of the fraction part
* fractionGroupSize: 0
* }
* });
* ```
*/
FORMAT?: Format;
/**
* An integer, 0 to 1e+9. Default value: 0.
*
* The maximum precision, i.e. number of significant digits, of the result of the power operation
* - unless a modulus is specified.
*
* If set to 0, the number of significant digits will not be limited.
*
* See `exponentiatedBy`.
*
* ```ts
* BigNumber.config({ POW_PRECISION: 100 })
* ```
*/
POW_PRECISION?: number;
/**
* An object including any number of the properties shown below.
*
* The object configures the format of the string returned by the `toFormat` method.
* The example below shows the properties of the object that are recognised, and
* their default values.
*
* Unlike the other configuration properties, the values of the properties of the `FORMAT` object
* will not be checked for validity - the existing object will simply be replaced by the object
* that is passed in.
*
* See `toFormat`.
*
* ```ts
* BigNumber.config({
* FORMAT: {
* // the decimal separator
* decimalSeparator: '.',
* // the grouping separator of the integer part
* groupSeparator: ',',
* // the primary grouping size of the integer part
* groupSize: 3,
* // the secondary grouping size of the integer part
* secondaryGroupSize: 0,
* // the grouping separator of the fraction part
* fractionGroupSeparator: ' ',
* // the grouping size of the fraction part
* fractionGroupSize: 0
* }
* })
* ```
*/
FORMAT?: BigNumberFormat;
/**
* A string representing the alphabet used for base conversion.
* Default value: `'0123456789abcdefghijklmnopqrstuvwxyz'`.
*
* The length of the alphabet corresponds to the maximum value of the base argument that can be
* passed to the BigNumber constructor or `toString`. There is no maximum length, but it must be
* at least 2 characters long, and it must not contain a repeated character, or `'.'` - the
* decimal separator for all values whatever their base.
*
* ```ts
* // duodecimal (base 12)
* BigNumber.config({ ALPHABET: '0123456789TE' })
* x = new BigNumber('T', 12)
* x.toString() // '10'
* x.toString(12) // 'T'
* ```
*/
ALPHABET?: string;
}
/**
* The library's enumerated rounding modes are stored as properties of the constructor.
* (They are not referenced internally by the library itself.)
* Rounding modes 0 to 6 (inclusive) are the same as those of Java's BigDecimal class.
* See `FORMAT` and `toFormat`.
*/
declare enum RoundingMode {
/** Rounds away from zero */
ROUND_UP = 0,
/** Rounds towards zero */
ROUND_DOWN = 1,
/** Rounds towards Infinity */
ROUND_CEIL = 2,
/** Rounds towards -Infinity */
ROUND_FLOOR = 3,
/**
* Rounds towards nearest neighbour. If equidistant, rounds away from zero
*/
ROUND_HALF_UP = 4,
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards zero
*/
ROUND_HALF_DOWN = 5,
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour
*/
ROUND_HALF_EVEN = 6,
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards `Infinity`
*/
ROUND_HALF_CEIL = 7,
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards `-Infinity`
*/
ROUND_HALF_FLOOR = 8,
/**
* The remainder is always positive. Euclidian division: `q = sign(n) * floor(a / abs(n))`
*/
EUCLID = 9
interface BigNumberFormat {
/**
* The decimal separator.
*/
decimalSeparator?: string;
/**
* The grouping separator of the integer part.
*/
groupSeparator?: string;
/**
* The primary grouping size of the integer part.
*/
groupSize?: number;
/**
* The secondary grouping size of the integer part.
*/
secondaryGroupSize?: number;
/**
* The grouping separator of the fraction part.
*/
fractionGroupSeparator?: string;
/**
* The grouping size of the fraction part.
*/
fractionGroupSize?: number;
}
export class BigNumber {
/** Rounds away from zero */
static ROUND_UP: RoundingMode;
export declare class BigNumber {
/** Rounds towards zero */
static ROUND_DOWN: RoundingMode;
/**
* Used internally by the `BigNumber.isBigNumber` method.
*/
private readonly _isBigNumber: true;
/** Rounds towards Infinity */
static ROUND_CEIL: RoundingMode;
/**
* The coefficient of the value of this BigNumber, an array of base 1e14 integer numbers.
*/
readonly c: number[];
/** Rounds towards -Infinity */
static ROUND_FLOOR: RoundingMode;
/**
* The exponent of the value of this BigNumber, an integer number, -1000000000 to 1000000000.
*/
readonly e: number;
/**
* Rounds towards nearest neighbour. If equidistant, rounds away from zero
*/
static ROUND_HALF_UP: RoundingMode;
/**
* The sign of the value of this BigNumber, -1 or 1.
*/
readonly s: number;
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards zero
*/
static ROUND_HALF_DOWN: RoundingMode;
/**
* Returns a new instance of BigNumber with value `n`.
*
* Legitimate values for `n` include ±0, ±`Infinity` and `NaN`.
*
* Values of type number with more than 15 significant digits are considered invalid as calling
* `toString` or `valueOf` on such numbers may not result in the intended value.
*
* ```ts
* console.log( 823456789123456.3 ); // 823456789123456.2
* ```
*
* There is no limit to the number of digits of a value of type string (other than that of
* JavaScript's maximum array size). Decimal string values may be in exponential, as well as
* normal (fixed-point) notation. Non-decimal values must be in normal notation.
*
* String values in hexadecimal literal form, e.g. '0xff', are valid, as are string values with
* the octal and binary prefixs '0o' and '0b'. String values in octal literal form without the
* prefix will be interpreted as decimals, e.g. '011' is interpreted as 11, not 9.
*
* Values in any base may have fraction digits.
*
* If a base is specified, `n` is rounded according to the current `DECIMAL_PLACES` and
* `ROUNDING_MODE` settings. If base is omitted, or is `null` or `undefined`, base 10 is assumed.
*
* Throws an invalid `value` or `base`.
*
* ```ts
* x = new BigNumber(9) // '9'
* y = new BigNumber(x) // '9'
*
* // 'new' is optional
* BigNumber(435.345) // '435.345'
*
* new BigNumber('5032485723458348569331745.33434346346912144534543')
* new BigNumber('4.321e+4') // '43210'
* new BigNumber('-735.0918e-430') // '-7.350918e-428'
* new BigNumber(Infinity) // 'Infinity'
* new BigNumber(NaN) // 'NaN'
* new BigNumber('.5') // '0.5'
* new BigNumber('+2') // '2'
* new BigNumber(-10110100.1, 2) // '-180.5'
* new BigNumber(-0b10110100.1) // '-180.5'
* new BigNumber('123412421.234324', 5) // '607236.557696'
* new BigNumber('ff.8', 16) // '255.5'
* new BigNumber('0xff.8') // '255.5'
*
* // The following throws 'Not a base 2 number'.
* new BigNumber(9, 2)
*
* // The following throws 'Number primitive has more than 15 significant digits'.
* new BigNumber(96517860459076817.4395)
*
* // The following throws 'Not a number'.
* new BigNumber('blurgh')
*
* // A value is only rounded by the constructor if a base is specified.
* BigNumber.config({ DECIMAL_PLACES: 5 })
* new BigNumber(1.23456789) // '1.23456789'
* new BigNumber(1.23456789, 10) // '1.23457'
* ```
*
* @param n A numeric value.
* @param base The base of n, integer, 2 to 36 (or `ALPHABET.length`, see `ALPHABET`).
*/
constructor(n: BigNumberValue, base?: number);
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour
*/
static ROUND_HALF_EVEN: RoundingMode;
/**
* Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of this
* BigNumber.
*
* The return value is always exact and unrounded.
*
* ```ts
* x = new BigNumber(-0.8)
* x.absoluteValue() // '0.8'
* ```
*/
absoluteValue(): BigNumber;
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards `Infinity`
*/
static ROUND_HALF_CEIL: RoundingMode;
/**
* Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of this
* BigNumber.
*
* The return value is always exact and unrounded.
*
* ```ts
* x = new BigNumber(-0.8)
* x.abs() // '0.8'
* ```
*/
abs(): BigNumber;
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards `-Infinity`
*/
static ROUND_HALF_FLOOR: RoundingMode;
/**
* Returns | |
* :-------:|:--------------------------------------------------------------|
* 1 | If the value of this BigNumber is greater than the value of `n`
* -1 | If the value of this BigNumber is less than the value of `n`
* 0 | If this BigNumber and `n` have the same value
* `null` | If the value of either this BigNumber or `n` is `NaN`
*
* ```ts
*
* x = new BigNumber(Infinity)
* y = new BigNumber(5)
* x.comparedTo(y) // 1
* x.comparedTo(x.minus(1)) // 0
* y.comparedTo(NaN) // null
* y.comparedTo('110', 2) // -1
* ```
* @param n A numeric value.
* @param [base] The base of n.
*/
comparedTo(n: BigNumberValue, base?: number): number;
/**
* The remainder is always positive. Euclidian division: `q = sign(n) * floor(a / abs(n))`
*/
static EUCLID: RoundingMode;
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode
* `roundingMode` to a maximum of `decimalPlaces` decimal places.
*
* If `decimalPlaces` is omitted, or is `null` or `undefined`, the return value is the number of
* decimal places of the value of this BigNumber, or `null` if the value of this BigNumber is
* ±`Infinity` or `NaN`.
*
* If `roundingMode` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used.
*
* Throws if `decimalPlaces` or `roundingMode` is invalid.
*
* ```ts
* x = new BigNumber(1234.56)
* x.decimalPlaces() // 2
* x.decimalPlaces(1) // '1234.6'
* x.decimalPlaces(2) // '1234.56'
* x.decimalPlaces(10) // '1234.56'
* x.decimalPlaces(0, 1) // '1234'
* x.decimalPlaces(0, 6) // '1235'
* x.decimalPlaces(1, 1) // '1234.5'
* x.decimalPlaces(1, BigNumber.ROUND_HALF_EVEN) // '1234.6'
* x // '1234.56'
* y = new BigNumber('9.9e-101')
* y.decimalPlaces() // 102
* ```
*
* @param [decimalPlaces] Decimal places, integer, 0 to 1e+9.
* @param [roundingMode] Rounding mode, integer, 0 to 8.
*/
decimalPlaces(decimalPlaces?: number, roundingMode?: BigNumberRoundingMode): BigNumber;
/**
* Returns a new independent BigNumber constructor with configuration as described by `obj` (see `config`), or with
* the default configuration if `obj` is `null` or `undefined`.
*
* ```ts
* BigNumber.config({ DECIMAL_PLACES: 5 })
* BN = BigNumber.another({ DECIMAL_PLACES: 9 })
*
* x = new BigNumber(1)
* y = new BN(1)
*
* x.div(3) // 0.33333
* y.div(3) // 0.333333333
*
* // BN = BigNumber.another({ DECIMAL_PLACES: 9 }) is equivalent to:
* BN = BigNumber.another()
* BN.config({ DECIMAL_PLACES: 9 })
* ```
*/
static another(config?: Configuration): typeof BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode
* `roundingMode` to a maximum of `decimalPlaces` decimal places.
*
* If `decimalPlaces` is omitted, or is `null` or `undefined`, the return value is the number of
* decimal places of the value of this BigNumber, or `null` if the value of this BigNumber is
* ±`Infinity` or `NaN`.
*
* If `roundingMode` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used.
*
* Throws if `decimalPlaces` or `roundingMode` is invalid.
*
* ```ts
* x = new BigNumber(1234.56)
* x.dp() // 2
* x.dp(1) // '1234.6'
* x.dp(2) // '1234.56'
* x.dp(10) // '1234.56'
* x.dp(0, 1) // '1234'
* x.dp(0, 6) // '1235'
* x.dp(1, 1) // '1234.5'
* x.dp(1, BigNumber.ROUND_HALF_EVEN) // '1234.6'
* x // '1234.56'
* y = new BigNumber('9.9e-101')
* y.dp() // 102
* ```
*
* @param [decimalPlaces] Decimal places, integer, 0 to 1e+9.
* @param [roundingMode] Rounding mode, integer, 0 to 8.
*/
dp(decimalPlaces?: number, roundingMode?: BigNumberRoundingMode): BigNumber;
/**
* Configures the 'global' settings for this particular BigNumber constructor. Returns an object with the above
* properties and their current values. If the value to be assigned to any of the above properties is `null` or
* `undefined` it is ignored. See Errors for the treatment of invalid values.
*/
static config(config?: Configuration): Configuration;
/**
* Returns a BigNumber whose value is the value of this BigNumber divided by `n`, rounded
* according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` settings.
*
* ```ts
* x = new BigNumber(355)
* y = new BigNumber(113)
* x.dividedBy(y) // '3.14159292035398230088'
* x.dividedBy(5) // '71'
* x.dividedBy(47, 16) // '5'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
dividedBy(n: BigNumberValue, base?: number): BigNumber;
/**
* Configures the 'global' settings for this particular BigNumber constructor. Returns an object with the above
* properties and their current values. If the value to be assigned to any of the above properties is `null` or
* `undefined` it is ignored. See Errors for the treatment of invalid values.
*/
static config(
decimalPlaces?: number,
roundingMode?: RoundingMode,
exponentialAt?: number | [number, number],
range?: number | [number, number],
errors?: boolean | number,
crypto?: boolean | number,
moduloMode?: RoundingMode,
powPrecision?: number,
format?: Format
): Configuration;
/**
* Returns a BigNumber whose value is the value of this BigNumber divided by `n`, rounded
* according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` settings.
*
* ```ts
* x = new BigNumber(355)
* y = new BigNumber(113)
* x.div(y) // '3.14159292035398230088'
* x.div(5) // '71'
* x.div(47, 16) // '5'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
div(n: BigNumberValue, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the maximum of `arg1`, `arg2`,... . The argument to this method can also be an
* array of values. The return value is always exact and unrounded.
*
* ```ts
* x = new BigNumber('3257869345.0378653')
* BigNumber.max(4e9, x, '123456789.9') // '4000000000'
*
* arr = [12, '13', new BigNumber(14)]
* BigNumber.max(arr) // '14'
* ```
*/
static max(...args: Array<number | string | BigNumber>): BigNumber;
static max(args: Array<number | string | BigNumber>): BigNumber;
/**
* Returns a BigNumber whose value is the integer part of dividing the value of this BigNumber by
* `n`.
*
* ```ts
* x = new BigNumber(5)
* y = new BigNumber(3)
* x.dividedToIntegerBy(y) // '1'
* x.dividedToIntegerBy(0.7) // '7'
* x.dividedToIntegerBy('0.f', 16) // '5'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
dividedToIntegerBy(n: BigNumberValue, base?: number): BigNumber;
/**
* See BigNumber for further parameter details. Returns a BigNumber whose value is the minimum of arg1, arg2,... .
* The argument to this method can also be an array of values. The return value is always exact and unrounded.
*
* ```ts
* x = new BigNumber('3257869345.0378653')
* BigNumber.min(4e9, x, '123456789.9') // '123456789.9'
*
* arr = [2, new BigNumber(-14), '-15.9999', -12]
* BigNumber.min(arr) // '-15.9999'
* ```
*/
static min(...args: Array<number | string | BigNumber>): BigNumber;
static min(args: Array<number | string | BigNumber>): BigNumber;
/**
* Returns a BigNumber whose value is the integer part of dividing the value of this BigNumber by
* `n`.
*
* ```ts
* x = new BigNumber(5)
* y = new BigNumber(3)
* x.idiv(y) // '1'
* x.idiv(0.7) // '7'
* x.idiv('0.f', 16) // '5'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
idiv(n: BigNumberValue, base?: number): BigNumber;
/**
* Returns a new BigNumber with a pseudo-random value equal to or greater than 0 and less than 1.
*
* The return value
* will have dp decimal places (or less if trailing zeros are produced). If dp is omitted then the number of decimal
* places will default to the current `DECIMAL_PLACES` setting.
*
* Depending on the value of this BigNumber constructor's
* `CRYPTO` setting and the support for the crypto object in the host environment, the random digits of the return
* value are generated by either `Math.random` (fastest), `crypto.getRandomValues` (Web Cryptography API in recent
* browsers) or `crypto.randomBytes` (Node.js).
*
* If `CRYPTO` is true, i.e. one of the crypto methods is to be used, the
* value of a returned BigNumber should be cryptographically-secure and statistically indistinguishable from a
* random value.
*
* ```ts
* BigNumber.config({ DECIMAL_PLACES: 10 })
* BigNumber.random() // '0.4117936847'
* BigNumber.random(20) // '0.78193327636914089009'
* ```
*
* @param dp integer, `0` to `1e+9` inclusive
*/
static random(dp?: number): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber exponentiated by `n`, i.e.
* raised to the power `n`, and optionally modulo a modulus `m`.
*
* If `n` is negative the result is rounded according to the current `DECIMAL_PLACES` and
* `ROUNDING_MODE` settings.
*
* As the number of digits of the result of the power operation can grow so large so quickly,
* e.g. 123.456**10000 has over 50000 digits, the number of significant digits calculated is
* limited to the value of the `POW_PRECISION` setting (unless a modulus `m` is specified).
*
* By default `POW_PRECISION` is set to 0. This means that an unlimited number of significant
* digits will be calculated, and that the method's performance will decrease dramatically for
* larger exponents.
*
* If `m` is specified and the value of `m`, `n` and this BigNumber are positive integers, then a
* fast modular exponentiation algorithm is used, otherwise if any of the values is not a positive
* integer the operation will simply be performed as `x.exponentiatedBy(n).modulo(m)` with a
* `POW_PRECISION` of 0.
*
* Throws if `n` is not a primitive number, or is not an integer, or is out of range.
*
* ```ts
* Math.pow(0.7, 2) // 0.48999999999999994
* x = new BigNumber(0.7)
* x.exponentiatedBy(2) // '0.49'
* BigNumber(3).exponentiatedBy(-2) // '0.11111111111111111111'
* ```
*
* @param n The exponent, an integer, -9007199254740991 to 9007199254740991.
* @param [m] The modulus, a positive integer.
*/
exponentiatedBy(n: number, m?: BigNumberValue): BigNumber;
/**
* Coefficient: Array of base `1e14` numbers or `null`
* @readonly
*/
c: number[];
/**
* Returns a BigNumber whose value is the value of this BigNumber exponentiated by `n`, i.e.
* raised to the power `n`, and optionally modulo a modulus `m`.
*
* If `n` is negative the result is rounded according to the current `DECIMAL_PLACES` and
* `ROUNDING_MODE` settings.
*
* As the number of digits of the result of the power operation can grow so large so quickly,
* e.g. 123.456**10000 has over 50000 digits, the number of significant digits calculated is
* limited to the value of the `POW_PRECISION` setting (unless a modulus `m` is specified).
*
* By default `POW_PRECISION` is set to 0. This means that an unlimited number of significant
* digits will be calculated, and that the method's performance will decrease dramatically for
* larger exponents.
*
* If `m` is specified and the value of `m`, `n` and this BigNumber are positive integers, then a
* fast modular exponentiation algorithm is used, otherwise if any of the values is not a positive
* integer the operation will simply be performed as `x.exponentiatedBy(n).modulo(m)` with a
* `POW_PRECISION` of 0.
*
* Throws if `n` is not a primitive number or an integer, or is out of range.
*
* ```ts
* Math.pow(0.7, 2) // 0.48999999999999994
* x = new BigNumber(0.7)
* x.pow(2) // '0.49'
* BigNumber(3).pow(-2) // '0.11111111111111111111'
* ```
*
* @param n The exponent, an integer, -9007199254740991 to 9007199254740991.
* @param [m] The modulus, a positive integer.
*/
pow(n: number, m?: BigNumberValue): BigNumber;
/**
* Exponent: Integer, `-1000000000` to `1000000000` inclusive or `null`
* @readonly
*/
e: number;
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded to an integer using
* rounding mode `rm`.
*
* If `rm` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used.
*
* Throws if `rm` is invalid.
*
* ```ts
* x = new BigNumber(123.456)
* x.integerValue() // '123'
* x.integerValue(BigNumber.ROUND_CEIL) // '124'
* y = new BigNumber(-12.7)
* y.integerValue() // '-13'
* x.integerValue(BigNumber.ROUND_DOWN) // '-12'
* ```
*
* @param {BigNumberRoundingMode} [rm] The roundng mode, an integer, 0 to 8.
*/
integerValue(rm?: BigNumberRoundingMode): BigNumber;
/**
* Sign: `-1`, `1` or `null`
* @readonly
*/
s: number;
/**
* Returns `true` if the value of this BigNumber is equal to the value of `n`, otherwise returns
* `false`.
*
* As with JavaScript, `NaN` does not equal `NaN`.
*
* ```ts
* 0 === 1e-324 // true
* x = new BigNumber(0)
* x.isEqualTo('1e-324') // false
* BigNumber(-0).isEqualTo(x) // true ( -0 === 0 )
* BigNumber(255).isEqualTo('ff', 16) // true
*
* y = new BigNumber(NaN)
* y.isEqualTo(NaN) // false
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
isEqualTo(n: BigNumberValue, base?: number): boolean;
/**
* Returns a new instance of a BigNumber object. If a base is specified, the value is rounded according to the
* current [[Configuration.DECIMAL_PLACES]] and [[Configuration.ROUNDING_MODE]] configuration. See Errors for the treatment of an invalid value or base.
*
* ```ts
* x = new BigNumber(9) // '9'
* y = new BigNumber(x) // '9'
*
* // 'new' is optional if ERRORS is false
* BigNumber(435.345) // '435.345'
*
* new BigNumber('5032485723458348569331745.33434346346912144534543')
* new BigNumber('4.321e+4') // '43210'
* new BigNumber('-735.0918e-430') // '-7.350918e-428'
* new BigNumber(Infinity) // 'Infinity'
* new BigNumber(NaN) // 'NaN'
* new BigNumber('.5') // '0.5'
* new BigNumber('+2') // '2'
* new BigNumber(-10110100.1, 2) // '-180.5'
* new BigNumber(-0b10110100.1) // '-180.5'
* new BigNumber('123412421.234324', 5) // '607236.557696'
* new BigNumber('ff.8', 16) // '255.5'
* new BigNumber('0xff.8') // '255.5'
* ```
*
* The following throws `not a base 2 number` if [[Configuration.ERRORS]] is true, otherwise it returns a BigNumber with value `NaN`.
*
* ```ts
* new BigNumber(9, 2)
* ```
*
* The following throws `number type has more than 15 significant digits` if [[Configuration.ERRORS]] is true, otherwise it returns a BigNumber with value `96517860459076820`.
*
* ```ts
* new BigNumber(96517860459076817.4395)
* ```
*
* The following throws `not a number` if [[Configuration.ERRORS]] is true, otherwise it returns a BigNumber with value `NaN`.
*
* ```ts
* new BigNumber('blurgh')
* ```
*
* A value is only rounded by the constructor if a base is specified.
*
* ```ts
* BigNumber.config({ DECIMAL_PLACES: 5 })
* new BigNumber(1.23456789) // '1.23456789'
* new BigNumber(1.23456789, 10) // '1.23457'
* ```
*
* @param value A numeric value.
*
* Legitimate values include `±0`, `±Infinity` and `NaN`.
*
* Values of type `number` with more than 15 significant digits are considered invalid (if [[Configuration.ERRORS]]
* is `true`) as calling `toString` or `valueOf` on such numbers may not result in the intended value.
*
* There is no limit to the number of digits of a value of type `string` (other than that of JavaScript's maximum
* array size).
*
* Decimal string values may be in exponential, as well as normal (fixed-point) notation. Non-decimal values must be
* in normal notation. String values in hexadecimal literal form, e.g. `'0xff'`, are valid, as are string values
* with the octal and binary prefixs `'0o'` and `'0b'`.
*
* String values in octal literal form without the prefix will be interpreted as decimals, e.g. `'011'` is
* interpreted as 11, not 9.
*
* Values in any base may have fraction digits.
*
* For bases from 10 to 36, lower and/or upper case letters can be used to represent values from 10 to 35.
*
* For bases above 36, a-z represents values from 10 to 35, A-Z from 36 to 61, and $ and _ represent 62 and 63
* respectively (this can be changed by editing the ALPHABET variable near the top of the source file).
*
* @param base integer, 2 to 64 inclusive
*
* The base of value. If base is omitted, or is `null` or `undefined`, base 10 is assumed.
*/
constructor(value: number | string | BigNumber, base?: number);
/**
* Returns `true` if the value of this BigNumber is equal to the value of `n`, otherwise returns
* `false`.
*
* As with JavaScript, `NaN` does not equal `NaN`.
*
* ```ts
* 0 === 1e-324 // true
* x = new BigNumber(0)
* x.eq('1e-324') // false
* BigNumber(-0).eq(x) // true ( -0 === 0 )
* BigNumber(255).eq('ff', 16) // true
*
* y = new BigNumber(NaN)
* y.eq(NaN) // false
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
eq(n: BigNumberValue, base?: number): boolean;
/**
* Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of this BigNumber. The
* return value is always exact and unrounded.
* ```ts
* x = new BigNumber(-0.8)
* y = x.absoluteValue() // '0.8'
* z = y.abs() // '0.8'
* ```
* @alias [[BigNumber.abs]]
*/
absoluteValue(): BigNumber;
/**
* Returns `true` if the value of this BigNumber is a finite number, otherwise returns `false`.
*
* The only possible non-finite values of a BigNumber are `NaN`, `Infinity` and `-Infinity`.
*
* ```ts
* x = new BigNumber(1)
* x.isFinite() // true
* y = new BigNumber(Infinity)
* y.isFinite() // false
* ```
*/
isFinite(): boolean;
/**
* See [[BigNumber.absoluteValue]]
*/
abs(): BigNumber;
/**
* Returns `true` if the value of this BigNumber is greater than the value of `n`, otherwise
* returns `false`.
*
* ```ts
* 0.1 > (0.3 - 0.2) // true
* x = new BigNumber(0.1)
* x.isGreaterThan(BigNumber(0.3).minus(0.2)) // false
* BigNumber(0).isGreaterThan(x) // false
* BigNumber(11, 3).isGreaterThan(11.1, 2) // true
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
isGreaterThan(n: BigNumberValue, base?: number): boolean;
/**
* See [[plus]]
*/
add(n: number | string | BigNumber, base?: number): BigNumber;
/**
* Returns `true` if the value of this BigNumber is greater than the value of `n`, otherwise
* returns `false`.
*
* ```ts
* 0.1 > (0.3 - 0 // true
* x = new BigNumber(0.1)
* x.gt(BigNumber(0.3).minus(0.2)) // false
* BigNumber(0).gt(x) // false
* BigNumber(11, 3).gt(11.1, 2) // true
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
gt(n: BigNumberValue, base?: number): boolean;
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded to a whole number in the direction of
* positive `Infinity`.
*
* ```ts
* x = new BigNumber(1.3)
* x.ceil() // '2'
* y = new BigNumber(-1.8)
* y.ceil() // '-1'
* ```
*/
ceil(): BigNumber;
/**
* Returns `true` if the value of this BigNumber is greater than or equal to the value of `n`,
* otherwise returns `false`.
*
* ```ts
* (0.3 - 0.2) >= 0.1 // false
* x = new BigNumber(0.3).minus(0.2)
* x.isGreaterThanOrEqualTo(0.1) // true
* BigNumber(1).isGreaterThanOrEqualTo(x) // true
* BigNumber(10, 18).isGreaterThanOrEqualTo('i', 36) // true
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
isGreaterThanOrEqualTo(n: BigNumberValue, base?: number): boolean;
/**
* Returns | |
* :-------:|---------------------------------------------------------------|
* 1 | If the value of this BigNumber is greater than the value of n
* -1 | If the value of this BigNumber is less than the value of n
* 0 | If this BigNumber and n have the same value
* null | If the value of either this BigNumber or n is NaN
*
* ```ts
* x = new BigNumber(Infinity)
* y = new BigNumber(5)
* x.comparedTo(y) // 1
* x.comparedTo(x.minus(1)) // 0
* y.cmp(NaN) // null
* y.cmp('110', 2) // -1
* ```
*
* @alias [[cmp]]
*/
comparedTo(n: number | string | BigNumber, base?: number): number;
/**
* Returns `true` if the value of this BigNumber is greater than or equal to the value of `n`,
* otherwise returns `false`.
*
* ```ts
* (0.3 - 0.2) >= 0.1 // false
* x = new BigNumber(0.3).minus(0.2)
* x.gte(0.1) // true
* BigNumber(1).gte(x) // true
* BigNumber(10, 18).gte('i', 36) // true
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
gte(n: BigNumberValue, base?: number): boolean;
/**
* See [[comparedTo]]
*/
cmp(n: number | string | BigNumber, base?: number): number;
/**
* Returns `true` if the value of this BigNumber is an integer, otherwise returns `false`.
*
* ```ts
* x = new BigNumber(1)
* x.isInteger() // true
* y = new BigNumber(123.456)
* y.isInteger() // false
* ```
*/
isInteger(): boolean;
/**
* Return the number of decimal places of the value of this BigNumber, or `null` if the value of this BigNumber is
* `±Infinity` or `NaN`.
*
* ```ts
* x = new BigNumber(123.45)
* x.decimalPlaces() // 2
* y = new BigNumber('9.9e-101')
* y.dp() // 102
* ```
*
* @alias [[dp]]
*/
decimalPlaces(): number;
/**
* Returns `true` if the value of this BigNumber is less than the value of `n`, otherwise returns
* `false`.
*
* ```ts
* (0.3 - 0.2) < 0.1 // true
* x = new BigNumber(0.3).minus(0.2)
* x.isLessThan(0.1) // false
* BigNumber(0).isLessThan(x) // true
* BigNumber(11.1, 2).isLessThan(11, 3) // true
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
isLessThan(n: BigNumberValue, base?: number): boolean;
/**
* See [[decimalPlaces]]
*/
dp(): number;
/**
* Returns `true` if the value of this BigNumber is less than the value of `n`, otherwise returns
* `false`.
*
* ```ts
* (0.3 - 0.2) < 0.1 // true
* x = new BigNumber(0.3).minus(0.2)
* x.lt(0.1) // false
* BigNumber(0).lt(x) // true
* BigNumber(11.1, 2).lt(11, 3) // true
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
lt(n: BigNumberValue, base?: number): boolean;
/**
* Returns a BigNumber whose value is the value of this BigNumber divided by n, rounded according to the current
* DECIMAL_PLACES and ROUNDING_MODE configuration.
*
* ```ts
* x = new BigNumber(355)
* y = new BigNumber(113)
* x.dividedBy(y) // '3.14159292035398230088'
* x.div(5) // '71'
* x.div(47, 16) // '5'
* ```
*
* @alias [[div]]
*/
dividedBy(n: number | string | BigNumber, base?: number): BigNumber;
/**
* Returns `true` if the value of this BigNumber is less than or equal to the value of `n`,
* otherwise returns `false`.
*
* ```ts
* 0.1 <= (0.3 - 0.2) // false
* x = new BigNumber(0.1)
* x.isLessThanOrEqualTo(BigNumber(0.3).minus(0.2)) // true
* BigNumber(-1).isLessThanOrEqualTo(x) // true
* BigNumber(10, 18).isLessThanOrEqualTo('i', 36) // true
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
isLessThanOrEqualTo(n: BigNumberValue, base?: number): boolean;
/**
* See [[dividedBy]]
*/
div(n: number | string | BigNumber, base?: number): BigNumber;
/**
* Returns `true` if the value of this BigNumber is less than or equal to the value of `n`,
* otherwise returns `false`.
*
* ```ts
* 0.1 <= (0.3 - 0.2) // false
* x = new BigNumber(0.1)
* x.lte(BigNumber(0.3).minus(0.2)) // true
* BigNumber(-1).lte(x) // true
* BigNumber(10, 18).lte('i', 36) // true
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
lte(n: BigNumberValue, base?: number): boolean;
/**
* Return a BigNumber whose value is the integer part of dividing the value of this BigNumber by n.
*
* ```ts
* x = new BigNumber(5)
* y = new BigNumber(3)
* x.dividedToIntegerBy(y) // '1'
* x.divToInt(0.7) // '7'
* x.divToInt('0.f', 16) // '5'
* ```
*
* @alias [[divToInt]]
*/
dividedToIntegerBy(n: number | string | BigNumber, base?: number): BigNumber;
/**
* Returns `true` if the value of this BigNumber is `NaN`, otherwise returns `false`.
*
* ```ts
* x = new BigNumber(NaN)
* x.isNaN() // true
* y = new BigNumber('Infinity')
* y.isNaN() // false
* ```
*/
isNaN(): boolean;
/**
* See [[dividedToIntegerBy]]
*/
divToInt(n: number | string | BigNumber, base?: number): BigNumber;
/**
* Returns `true` if the value of this BigNumber is negative, otherwise returns `false`.
*
* ```ts
* x = new BigNumber(-0)
* x.isNegative() // true
* y = new BigNumber(2)
* y.isNegative() // false
* ```
*/
isNegative(): boolean;
/**
* Returns true if the value of this BigNumber equals the value of `n`, otherwise returns `false`. As with JavaScript,
* `NaN` does not equal `NaN`.
*
* Note: This method uses the [[comparedTo]] internally.
*
* ```ts
* 0 === 1e-324 // true
* x = new BigNumber(0)
* x.equals('1e-324') // false
* BigNumber(-0).eq(x) // true ( -0 === 0 )
* BigNumber(255).eq('ff', 16) // true
*
* y = new BigNumber(NaN)
* y.equals(NaN) // false
* ```
*
* @alias [[eq]]
*/
equals(n: number | string | BigNumber, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is positive, otherwise returns `false`.
*
* ```ts
* x = new BigNumber(-0)
* x.isPositive() // false
* y = new BigNumber(2)
* y.isPositive() // true
* ```
*/
isPositive(): boolean;
/**
* See [[equals]]
*/
eq(n: number | string | BigNumber, base?: number): boolean;
/**
* Returns `true` if the value of this BigNumber is zero or minus zero, otherwise returns `false`.
*
* ```ts
* x = new BigNumber(-0)
* x.isZero() // true
* ```
*/
isZero(): boolean;
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded to a whole number in the direction of
* negative `Infinity`.
*
* ```ts
* x = new BigNumber(1.8)
* x.floor() // '1'
* y = new BigNumber(-1.3)
* y.floor() // '-2'
* ```
*/
floor(): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber minus `n`.
*
* The return value is always exact and unrounded.
*
* ```ts
* 0.3 - 0.1 // 0.19999999999999998
* x = new BigNumber(0.3)
* x.minus(0.1) // '0.2'
* x.minus(0.6, 20) // '0'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
minus(n: BigNumberValue, base?: number): BigNumber;
/**
* Returns `true` if the value of this BigNumber is greater than the value of `n`, otherwise returns `false`.
*
* Note: This method uses the comparedTo method internally.
*
* ```ts
* 0.1 > (0.3 - 0.2) // true
* x = new BigNumber(0.1)
* x.greaterThan(BigNumber(0.3).minus(0.2)) // false
* BigNumber(0).gt(x) // false
* BigNumber(11, 3).gt(11.1, 2) // true
* ```
*
* @alias [[gt]]
*/
greaterThan(n: number | string | BigNumber, base?: number): boolean;
/**
* Returns a BigNumber whose value is the value of this BigNumber modulo `n`, i.e. the integer
* remainder of dividing this BigNumber by `n`.
*
* The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE`
* setting of this BigNumber constructor. If it is 1 (default value), the result will have the
* same sign as this BigNumber, and it will match that of Javascript's `%` operator (within the
* limits of double precision) and BigDecimal's `remainder` method.
*
* The return value is always exact and unrounded.
*
* See `MODULO_MODE` for a description of the other modulo modes.
*
* ```ts
* 1 % 0.9 // 0.09999999999999998
* x = new BigNumber(1)
* x.modulo(0.9) // '0.1'
* y = new BigNumber(33)
* y.modulo('a', 33) // '3'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
modulo(n: BigNumberValue, base?: number): BigNumber;
/**
* See [[greaterThan]]
*/
gt(n: number | string | BigNumber, base?: number): boolean;
/**
* Returns a BigNumber whose value is the value of this BigNumber modulo `n`, i.e. the integer
* remainder of dividing this BigNumber by `n`.
*
* The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE`
* setting of this BigNumber constructor. If it is 1 (default value), the result will have the
* same sign as this BigNumber, and it will match that of Javascript's `%` operator (within the
* limits of double precision) and BigDecimal's `remainder` method.
*
* The return value is always exact and unrounded.
*
* See `MODULO_MODE` for a description of the other modulo modes.
*
* ```ts
* 1 % 0.9 // 0.09999999999999998
* x = new BigNumber(1)
* x.mod(0.9) // '0.1'
* y = new BigNumber(33)
* y.mod('a', 33) // '3'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
mod(n: BigNumberValue, base?: number): BigNumber;
/**
* Returns `true` if the value of this BigNumber is greater than or equal to the value of `n`, otherwise returns `false`.
*
* Note: This method uses the comparedTo method internally.
*
* @alias [[gte]]
*/
greaterThanOrEqualTo(n: number | string | BigNumber, base?: number): boolean;
/**
* Returns a BigNumber whose value is the value of this BigNumber multiplied by `n`.
*
* The return value is always exact and unrounded.
*
* ```ts
* 0.6 * 3 // 1.7999999999999998
* x = new BigNumber(0.6)
* y = x.multipliedBy(3) // '1.8'
* BigNumber('7e+500').multipliedBy(y) // '1.26e+501'
* x.multipliedBy('-a', 16) // '-6'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
multipliedBy(n: BigNumberValue, base?: number) : BigNumber;
/**
* See [[greaterThanOrEqualTo]]
*/
gte(n: number | string | BigNumber, base?: number): boolean;
/**
* Returns a BigNumber whose value is the value of this BigNumber multiplied by `n`.
*
* The return value is always exact and unrounded.
*
* ```ts
* 0.6 * 3 // 1.7999999999999998
* x = new BigNumber(0.6)
* y = x.times(3) // '1.8'
* BigNumber('7e+500').times(y) // '1.26e+501'
* x.times('-a', 16) // '-6'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
times(n: BigNumberValue, base?: number): BigNumber;
/**
* Returns true if the value of this BigNumber is a finite number, otherwise returns false. The only possible
* non-finite values of a BigNumber are `NaN`, `Infinity` and `-Infinity`.
*
* Note: The native method `isFinite()` can be used if `n <= Number.MAX_VALUE`.
*/
isFinite(): boolean;
/**
* Returns a BigNumber whose value is the value of this BigNumber negated, i.e. multiplied by -1.
*
* ```ts
* x = new BigNumber(1.8)
* x.negated() // '-1.8'
* y = new BigNumber(-1.3)
* y.negated() // '1.3'
* ```
*/
negated(): BigNumber;
/**
* Returns true if the value of this BigNumber is a whole number, otherwise returns false.
* @alias [[isInt]]
*/
isInteger(): boolean;
/**
* Returns a BigNumber whose value is the value of this BigNumber plus `n`.
*
* The return value is always exact and unrounded.
*
* ```ts
* 0.1 + 0.2 // 0.30000000000000004
* x = new BigNumber(0.1)
* y = x.plus(0.2) // '0.3'
* BigNumber(0.7).plus(x).plus(y) // '1'
* x.plus('0.1', 8) // '0.225'
* ```
*
* @param n A numeric value.
* @param [base] The base of n.
*/
plus(n: BigNumberValue, base?: number): BigNumber;
/**
* See [[isInteger]]
*/
isInt(): boolean;
/**
* Returns the number of significant digits of the value of this BigNumber, or `null` if the value
* of this BigNumber is ±`Infinity` or `NaN`.
*
* If `includeZeros` is true then any trailing zeros of the integer part of the value of this
* BigNumber are counted as significant digits, otherwise they are not.
*
* Throws if `includeZeros` is invalid.
*
* ```ts
* x = new BigNumber(9876.54321)
* x.precision() // 9
* y = new BigNumber(987000)
* y.precision(false) // 3
* y.precision(true) // 6
* ```
*
* @param [includeZeros] Whether to include integer trailing zeros in the significant digit count.
*/
precision(includeZeros?: boolean): number;
/**
* Returns `true` if the value of this BigNumber is `NaN`, otherwise returns `false`.
*
* Note: The native method isNaN() can also be used.
*/
isNaN(): boolean;
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded to a precision of
* `significantDigits` significant digits using rounding mode `roundingMode`.
*
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` will be used.
*
* Throws if `significantDigits` or `roundingMode` is invalid.
*
* ```ts
* x = new BigNumber(9876.54321)
* x.precision(6) // '9876.54'
* x.precision(6, BigNumber.ROUND_UP) // '9876.55'
* x.precision(2) // '9900'
* x.precision(2, 1) // '9800'
* x // '9876.54321'
* ```
*
* @param significantDigits Significant digits, integer, 1 to 1e+9.
* @param [roundingMode] Rounding mode, integer, 0 to 8.
*/
precision(significantDigits: number, roundingMode?: BigNumberRoundingMode): BigNumber;
/**
* Returns true if the value of this BigNumber is negative, otherwise returns false.
*
* Note: `n < 0` can be used if `n <= * -Number.MIN_VALUE`.
*
* @alias [[isNeg]]
*/
isNegative(): boolean;
/**
* Returns the number of significant digits of the value of this BigNumber,
* or `null` if the value of this BigNumber is ±`Infinity` or `NaN`.
*
* If `includeZeros` is true then any trailing zeros of the integer part of
* the value of this BigNumber are counted as significant digits, otherwise
* they are not.
*
* Throws if `includeZeros` is invalid.
*
* ```ts
* x = new BigNumber(9876.54321)
* x.sd() // 9
* y = new BigNumber(987000)
* y.sd(false) // 3
* y.sd(true) // 6
* ```
*
* @param [includeZeros] Whether to include integer trailing zeros in the significant digit count.
*/
sd(includeZeros?: boolean): number;
/**
* See [[isNegative]]
*/
isNeg(): boolean;
/*
* Returns a BigNumber whose value is the value of this BigNumber rounded to a precision of
* `significantDigits` significant digits using rounding mode `roundingMode`.
*
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` will be used.
*
* Throws if `significantDigits` or `roundingMode` is invalid.
*
* ```ts
* x = new BigNumber(9876.54321)
* x.sd(6) // '9876.54'
* x.sd(6, BigNumber.ROUND_UP) // '9876.55'
* x.sd(2) // '9900'
* x.sd(2, 1) // '9800'
* x // '9876.54321'
* ```
*
* @param significantDigits Significant digits, integer, 1 to 1e+9.
* @param [roundingMode] Rounding mode, integer, 0 to 8.
*/
sd(significantDigits: number, roundingMode?: BigNumberRoundingMode): BigNumber;
/**
* Returns true if the value of this BigNumber is zero or minus zero, otherwise returns false.
*
* Note: `n == 0` can be used if `n >= Number.MIN_VALUE`.
*/
isZero(): boolean;
/**
* Returns a BigNumber whose value is the value of this BigNumber shifted by `n` places.
*
* The shift is of the decimal point, i.e. of powers of ten, and is to the left if `n` is negative
* or to the right if `n` is positive.
*
* The return value is always exact and unrounded.
*
* Throws if `n` is invalid.
*
* ```ts
* x = new BigNumber(1.23)
* x.shiftedBy(3) // '1230'
* x.shiftedBy(-3) // '0.00123'
* ```
*
* @param n The shift value, integer, -9007199254740991 to 9007199254740991.
*/
shiftedBy(n: number): BigNumber;
/**
* Returns true if the value of this BigNumber is less than the value of n, otherwise returns false.
*
* Note: This method uses [[comparedTo]] internally.
*
* @alias [[lt]]
*/
lessThan(n: number | string | BigNumber, base?: number): boolean;
/**
* Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded
* according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` settings.
*
* The return value will be correctly rounded, i.e. rounded as if the result was first calculated
* to an infinite number of correct digits before rounding.
*
* ```ts
* x = new BigNumber(16)
* x.squareRoot() // '4'
* y = new BigNumber(3)
* y.squareRoot() // '1.73205080756887729353'
* ```
*/
squareRoot(): BigNumber;
/**
* See [[lessThan]]
*/
lt(n: number | string | BigNumber, base?: number): boolean;
/**
* Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded
* according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` settings.
*
* The return value will be correctly rounded, i.e. rounded as if the result was first calculated
* to an infinite number of correct digits before rounding.
*
* ```ts
* x = new BigNumber(16)
* x.sqrt() // '4'
* y = new BigNumber(3)
* y.sqrt() // '1.73205080756887729353'
* ```
*/
sqrt(): BigNumber;
/**
* Returns true if the value of this BigNumber is less than or equal the value of n, otherwise returns false.
*
* Note: This method uses [[comparedTo]] internally.
*/
lessThanOrEqualTo(n: number | string | BigNumber, base?: number): boolean;
/**
* Returns a string representing the value of this BigNumber in exponential notation rounded using
* rounding mode `roundingMode` to `decimalPlaces` decimal places, i.e with one digit before the
* decimal point and `decimalPlaces` digits after it.
*
* If the value of this BigNumber in exponential notation has fewer than `decimalPlaces` fraction
* digits, the return value will be appended with zeros accordingly.
*
* If `decimalPlaces` is omitted, or is `null` or `undefined`, the number of digits after the
* decimal point defaults to the minimum number of digits necessary to represent the value
* exactly.
*
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*
* Throws if `decimalPlaces` or `roundingMode` is invalid.
*
* ```ts
* x = 45.6
* y = new BigNumber(x)
* x.toExponential() // '4.56e+1'
* y.toExponential() // '4.56e+1'
* x.toExponential(0) // '5e+1'
* y.toExponential(0) // '5e+1'
* x.toExponential(1) // '4.6e+1'
* y.toExponential(1) // '4.6e+1'
* y.toExponential(1, 1) // '4.5e+1' (ROUND_DOWN)
* x.toExponential(3) // '4.560e+1'
* y.toExponential(3) // '4.560e+1'
* ```
*
* @param [decimalPlaces] Decimal places, integer, 0 to 1e+9.
* @param [roundingMode] Rounding mode, integer, 0 to 8.
*/
toExponential(decimalPlaces?: number, roundingMode?: BigNumberRoundingMode): string;
/**
* See [[lessThanOrEqualTo]]
*/
lte(n: number | string | BigNumber, base?: number): boolean;
/**
* Returns a string representing the value of this BigNumber in normal (fixed-point) notation
* rounded to `decimalPlaces` decimal places using rounding mode `roundingMode`.
*
* If the value of this BigNumber in normal notation has fewer than `decimalPlaces` fraction
* digits, the return value will be appended with zeros accordingly.
*
* Unlike `Number.prototype.toFixed`, which returns exponential notation if a number is greater or
* equal to 10**21, this method will always return normal notation.
*
* If `decimalPlaces` is omitted or is `null` or `undefined`, the return value will be unrounded
* and in normal notation. This is also unlike `Number.prototype.toFixed`, which returns the value
* to zero decimal places. It is useful when normal notation is required and the current
* `EXPONENTIAL_AT` setting causes `toString` to return exponential notation.
*
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*
* Throws if `decimalPlaces` or `roundingMode` is invalid.
*
* ```ts
* x = 3.456
* y = new BigNumber(x)
* x.toFixed() // '3'
* y.toFixed() // '3.456'
* y.toFixed(0) // '3'
* x.toFixed(2) // '3.46'
* y.toFixed(2) // '3.46'
* y.toFixed(2, 1) // '3.45' (ROUND_DOWN)
* x.toFixed(5) // '3.45600'
* y.toFixed(5) // '3.45600'
* ```
*
* @param [decimalPlaces] Decimal places, integer, 0 to 1e+9.
* @param [roundingMode] Rounding mode, integer, 0 to 8.
*/
toFixed(decimalPlaces?: number, roundingMode?: BigNumberRoundingMode): string;
/**
* Returns a BigNumber whose value is the value of this BigNumber minus `n`.
*
* The return value is always exact and unrounded.
*
* @alias [[sub]]
*/
minus(n: number | string | BigNumber, base?: number): BigNumber;
/**
* Returns a string representing the value of this BigNumber in normal (fixed-point) notation
* rounded to `decimalPlaces` decimal places using rounding mode `roundingMode`, and formatted
* according to the properties of the `FORMAT` object.
*
* The properties of the `FORMAT` object are shown in the examples below.
*
* If `decimalPlaces` is omitted or is `null` or `undefined`, then the return value is not
* rounded to a fixed number of decimal places.
*
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*
* Throws if `decimalPlaces` or `roundingMode` is invalid.
*
* ```ts
* format = {
* decimalSeparator: '.',
* groupSeparator: ',',
* groupSize: 3,
* secondaryGroupSize: 0,
* fractionGroupSeparator: ' ',
* fractionGroupSize: 0
* }
* BigNumber.config({ FORMAT: format })
*
* x = new BigNumber('123456789.123456789')
* x.toFormat() // '123,456,789.123456789'
* x.toFormat(1) // '123,456,789.1'
*
* format.groupSeparator = ' '
* format.fractionGroupSize = 5
* x.toFormat() // '123 456 789.12345 6789'
*
* BigNumber.config({
* FORMAT: {
* decimalSeparator: ',',
* groupSeparator: '.',
* groupSize: 3,
* secondaryGroupSize: 2
* }
* })
*
* x.toFormat(6) // '12.34.56.789,123'
* ```
*
* @param [decimalPlaces] Decimal places, integer, 0 to 1e+9.
* @param [roundingMode] Rounding mode, integer, 0 to 8.
*/
toFormat(decimalPlaces?: number, roundingMode?: BigNumberRoundingMode): string;
/**
* Returns a BigNumber whose value is the value of this BigNumber modulo n, i.e. the integer remainder of dividing
* this BigNumber by n.
*
* The value returned, and in particular its sign, is dependent on the value of the [[Configuration.MODULO_MODE]]
* setting of this BigNumber constructor. If it is `1` (default value), the result will have the same sign as this
* BigNumber, and it will match that of Javascript's `%` operator (within the limits of double precision) and
* BigDecimal's remainder method.
*
* The return value is always exact and unrounded.
*
* ```ts
* 1 % 0.9 // 0.09999999999999998
* x = new BigNumber(1)
* x.modulo(0.9) // '0.1'
* y = new BigNumber(33)
* y.mod('a', 33) // '3'
* ```
*
* @alias [[mod]]
*/
modulo(n: number | string | BigNumber, base?: number): BigNumber;
/**
* Returns a string array representing the value of this BigNumber as a simple fraction with an
* integer numerator and an integer denominator. The denominator will be a positive non-zero value
* less than or equal to `max_denominator`.
*
* If a maximum denominator, `max_denominator`, is not specified, or is `null` or `undefined`, the
* denominator will be the lowest value necessary to represent the number exactly.
*
* Throws if `max_denominator` is invalid.
*
* ```ts
* x = new BigNumber(1.75)
* x.toFraction() // '7, 4'
*
* pi = new BigNumber('3.14159265358')
* pi.toFraction() // '157079632679,50000000000'
* pi.toFraction(100000) // '312689, 99532'
* pi.toFraction(10000) // '355, 113'
* pi.toFraction(100) // '311, 99'
* pi.toFraction(10) // '22, 7'
* pi.toFraction(1) // '3, 1'
* ```
*
* @param [max_denominator] The maximum denominator, integer, >= 1 and < Infinity.
*/
toFraction(max_denominator?: BigNumberValue): BigNumber[];
/**
* See [[modulo]]
*/
mod(n: number | string | BigNumber, base?: number): BigNumber;
/**
* As `valueOf`.
*/
toJSON(): string;
/**
* See [[times]]
*/
mul(n: number | string | BigNumber, base?: number): BigNumber;
/**
* Returns the value of this BigNumber as a JavaScript primitive number.
*
* Using the unary plus operator gives the same result.
*
* ```ts
* x = new BigNumber(456.789)
* x.toNumber() // 456.789
* +x // 456.789
*
* y = new BigNumber('45987349857634085409857349856430985')
* y.toNumber() // 4.598734985763409e+34
*
* z = new BigNumber(-0)
* 1 / z.toNumber() // -Infinity
* 1 / +z // -Infinity
* ```
*/
toNumber(): number;
/**
* Returns a BigNumber whose value is the value of this BigNumber negated, i.e. multiplied by -1.
*
* ```ts
* x = new BigNumber(1.8)
* x.negated() // '-1.8'
* y = new BigNumber(-1.3)
* y.neg() // '1.3'
* ```
*
* @alias [[neg]]
*/
negated(): BigNumber;
/**
* Returns a string representing the value of this BigNumber rounded to `significantDigits`
* significant digits using rounding mode `roundingMode`.
*
* If `significantDigits` is less than the number of digits necessary to represent the integer
* part of the value in normal (fixed-point) notation, then exponential notation is used.
*
* If `significantDigits` is omitted, or is `null` or `undefined`, then the return value is the
* same as `n.toString()`.
*
* If `roundingMode` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*
* Throws if `significantDigits` or `roundingMode` is invalid.
*
* ```ts
* x = 45.6
* y = new BigNumber(x)
* x.toPrecision() // '45.6'
* y.toPrecision() // '45.6'
* x.toPrecision(1) // '5e+1'
* y.toPrecision(1) // '5e+1'
* y.toPrecision(2, 0) // '4.6e+1' (ROUND_UP)
* y.toPrecision(2, 1) // '4.5e+1' (ROUND_DOWN)
* x.toPrecision(5) // '45.600'
* y.toPrecision(5) // '45.600'
* ```
*
* @param [significantDigits] Significant digits, integer, 1 to 1e+9.
* @param [roundingMode] Rounding mode, integer 0 to 8.
*/
toPrecision(significantDigits?: number, roundingMode?: BigNumberRoundingMode): string;
/**
* See [[negated]]
*/
neg(): BigNumber;
/**
* Returns a string representing the value of this BigNumber in base `base`, or base 10 if `base`
* is omitted or is `null` or `undefined`.
*
* For bases above 10, and using the default base conversion alphabet (see `ALPHABET`), values
* from 10 to 35 are represented by a-z (the same as `Number.prototype.toString`).
*
* If a base is specified the value is rounded according to the current `DECIMAL_PLACES` and
* `ROUNDING_MODE` settings, otherwise it is not.
*
* If a base is not specified, and this BigNumber has a positive exponent that is equal to or
* greater than the positive component of the current `EXPONENTIAL_AT` setting, or a negative
* exponent equal to or less than the negative component of the setting, then exponential notation
* is returned.
*
* If `base` is `null` or `undefined` it is ignored.
*
* Throws if `base` is invalid.
*
* ```ts
* x = new BigNumber(750000)
* x.toString() // '750000'
* BigNumber.config({ EXPONENTIAL_AT: 5 })
* x.toString() // '7.5e+5'
*
* y = new BigNumber(362.875)
* y.toString(2) // '101101010.111'
* y.toString(9) // '442.77777777777777777778'
* y.toString(32) // 'ba.s'
*
* BigNumber.config({ DECIMAL_PLACES: 4 });
* z = new BigNumber('1.23456789')
* z.toString() // '1.23456789'
* z.toString(10) // '1.2346'
* ```
*
* @param [base] The base, integer, 2 to 36 (or `ALPHABET.length`, see `ALPHABET`).
*/
toString(base?: number): string;
/**
* Returns a BigNumber whose value is the value of this BigNumber plus `n`.
*
* The return value is always exact and unrounded.
*
* @alias [[add]]
*/
plus(n: number | string | BigNumber, base?: number): BigNumber;
/**
* As `toString`, but does not accept a base argument and includes the minus sign for negative
* zero.
*
* ``ts
* x = new BigNumber('-0')
* x.toString() // '0'
* x.valueOf() // '-0'
* y = new BigNumber('1.777e+457')
* y.valueOf() // '1.777e+457'
* ```
*/
valueOf(): string;
/**
* If z is true or 1 then any trailing zeros of the integer part of a number are counted as significant digits,
* otherwise they are not.
*
* @param z true, false, 0 or 1
* @alias [[sd]]
*/
precision(z?: boolean | number): number;
/**
* Returns a new independent BigNumber constructor with configuration as described by `object`, or
* with the default configuration if object is `null` or `undefined`.
*
* Throws if `object` is not an object.
*
* ```ts
* BigNumber.config({ DECIMAL_PLACES: 5 })
* BN = BigNumber.clone({ DECIMAL_PLACES: 9 })
*
* x = new BigNumber(1)
* y = new BN(1)
*
* x.div(3) // 0.33333
* y.div(3) // 0.333333333
*
* // BN = BigNumber.clone({ DECIMAL_PLACES: 9 }) is equivalent to:
* BN = BigNumber.clone()
* BN.config({ DECIMAL_PLACES: 9 })
* ```
*
* @param [object] The configuration object.
*/
static clone(object?: BigNumberConfig): BigNumberConstructor;
/**
* See [[precision]]
*/
sd(z?: boolean | number): number;
/**
* Configures the settings that apply to this BigNumber constructor.
*
* The configuration object, `object`, contains any number of the properties shown in the example
* below.
*
* Returns an object with the above properties and their current values.
*
* Throws if `object` is not an object, or if an invalid value is assigned to one or more of the
* properties.
*
* ```ts
* BigNumber.config({
* DECIMAL_PLACES: 40,
* ROUNDING_MODE: BigNumber.ROUND_HALF_CEIL,
* EXPONENTIAL_AT: [-10, 20],
* RANGE: [-500, 500],
* CRYPTO: true,
* MODULO_MODE: BigNumber.ROUND_FLOOR,
* POW_PRECISION: 80,
* FORMAT: {
* groupSize: 3,
* groupSeparator: ' ',
* decimalSeparator: ','
* },
* ALPHABET: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'
* });
*
* BigNumber.config().DECIMAL_PLACES // 40
* ```
*
* @param object The configuration object.
*/
static config(object: BigNumberConfig): BigNumberConfig;
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode rm to a maximum of dp
* decimal places.
*
* - if dp is omitted, or is null or undefined, the return value is n rounded to a whole number.
* - if rm is omitted, or is null or undefined, ROUNDING_MODE is used.
*
* ```ts
* x = 1234.56
* Math.round(x) // 1235
* y = new BigNumber(x)
* y.round() // '1235'
* y.round(1) // '1234.6'
* y.round(2) // '1234.56'
* y.round(10) // '1234.56'
* y.round(0, 1) // '1234'
* y.round(0, 6) // '1235'
* y.round(1, 1) // '1234.5'
* y.round(1, BigNumber.ROUND_HALF_EVEN) // '1234.6'
* y // '1234.56'
* ```
*
* @param dp integer, 0 to 1e+9 inclusive
* @param rm integer, 0 to 8 inclusive
*/
round(dp?: number, rm?: number): BigNumber;
/**
* Returns `true` if `value` is a BigNumber instance, otherwise returns `false`.
*
* ```ts
* x = 42
* y = new BigNumber(x)
*
* BigNumber.isBigNumber(x) // false
* y instanceof BigNumber // true
* BigNumber.isBigNumber(y) // true
*
* BN = BigNumber.clone();
* z = new BN(x)
* z instanceof BigNumber // false
* BigNumber.isBigNumber(z) // true
* ```
*
* @param value The value to test.
*/
static isBigNumber(value: any): boolean;
/**
* Returns a BigNumber whose value is the value of this BigNumber shifted n places.
*
* The shift is of the decimal point, i.e. of powers of ten, and is to the left if n is negative or to the right if
* n is positive. The return value is always exact and unrounded.
*
* @param n integer, -9007199254740991 to 9007199254740991 inclusive
*/
shift(n: number): BigNumber;
/**
*
* Returns a BigNumber whose value is the maximum of the arguments.
*
* Accepts either an argument list or an array of values.
*
* The return value is always exact and unrounded.
*
* ```ts
* x = new BigNumber('3257869345.0378653')
* BigNumber.maximum(4e9, x, '123456789.9') // '4000000000'
*
* arr = [12, '13', new BigNumber(14)]
* BigNumber.maximum(arr) // '14'
* ```
*
* @param n A numeric value.
*/
static maximum(...n: BigNumberValue[]): BigNumber;
/**
* Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded according to the
* current DECIMAL_PLACES and ROUNDING_MODE configuration.
*
* The return value will be correctly rounded, i.e. rounded
* as if the result was first calculated to an infinite number of correct digits before rounding.
*
* @alias [[sqrt]]
*/
squareRoot(): BigNumber;
/**
* Returns a BigNumber whose value is the maximum of the arguments.
*
* Accepts either an argument list or an array of values.
*
* The return value is always exact and unrounded.
*
* ```ts
* x = new BigNumber('3257869345.0378653')
* BigNumber.max(4e9, x, '123456789.9') // '4000000000'
*
* arr = [12, '13', new BigNumber(14)]
* BigNumber.max(arr) // '14'
* ```
*
* @param n A numeric value.
*/
static max(...n: BigNumberValue[]): BigNumber;
/**
* See [[squareRoot]]
*/
sqrt(): BigNumber;
/**
* Returns a BigNumber whose value is the minimum of the arguments.
*
* Accepts either an argument list or an array of values.
*
* The return value is always exact and unrounded.
*
* ```ts
* x = new BigNumber('3257869345.0378653')
* BigNumber.minimum(4e9, x, '123456789.9') // '123456789.9'
*
* arr = [2, new BigNumber(-14), '-15.9999', -12]
* BigNumber.minimum(arr) // '-15.9999'
* ```
*
* @param n A numeric value.
*/
static minimum(...n: BigNumberValue[]): BigNumber;
/**
* See [[minus]]
*/
sub(n: number | string | BigNumber, base?: number): BigNumber;
/**
* Returns a BigNumber whose value is the minimum of the arguments.
*
* Accepts either an argument list or an array of values.
*
* The return value is always exact and unrounded.
*
* ```ts
* x = new BigNumber('3257869345.0378653')
* BigNumber.min(4e9, x, '123456789.9') // '123456789.9'
*
* arr = [2, new BigNumber(-14), '-15.9999', -12]
* BigNumber.min(arr) // '-15.9999'
* ```
*
* @param n A numeric value.
*/
static min(...n: BigNumberValue[]): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber times n.
*
* The return value is always exact and unrounded.
*
* @alias [[mul]]
*/
times(n: number | string | BigNumber, base?: number): BigNumber;
/**
* Returns a new BigNumber with a pseudo-random value equal to or greater than 0 and less than 1.
*
* The return value will have `decimalPlaces` decimal places, or less if trailing zeros are
* produced. If `decimalPlaces` is omitted, the current `DECIMAL_PLACES` setting will be used.
*
* Depending on the value of this BigNumber constructor's `CRYPTO` setting and the support for the
* `crypto` object in the host environment, the random digits of the return value are generated by
* either `Math.random` (fastest), `crypto.getRandomValues` (Web Cryptography API in recent
* browsers) or `crypto.randomBytes` (Node.js).
*
* If `CRYPTO` is true, i.e. one of the `crypto` methods is to be used, the value of a returned
* BigNumber should be cryptographically secure and statistically indistinguishable from a random
* value.
*
* Throws if `decimalPlaces` is invalid.
*
* ```ts
* BigNumber.config({ DECIMAL_PLACES: 10 })
* BigNumber.random() // '0.4117936847'
* BigNumber.random(20) // '0.78193327636914089009'
* ```
*
* @param [decimalPlaces] Decimal places, integer, 0 to 1e+9.
*/
static random(decimalPlaces?: number): BigNumber;
/**
* Returns a BigNumber whose value is the value of this BigNumber rounded to sd significant digits using rounding mode rm.
*
* If sd is omitted or is null or undefined, the return value will not be rounded.
*
* If rm is omitted or is null or undefined, ROUNDING_MODE will be used.
*
* ```ts
* BigNumber.config({ precision: 5, rounding: 4 })
* x = new BigNumber(9876.54321)
*
* x.toDigits() // '9876.5'
* x.toDigits(6) // '9876.54'
* x.toDigits(6, BigNumber.ROUND_UP) // '9876.55'
* x.toDigits(2) // '9900'
* x.toDigits(2, 1) // '9800'
* x // '9876.54321'
* ```
*
* @param sd integer, 1 to 1e+9 inclusive
* @param rm integer, 0 to 8 inclusive
*/
toDigits(sd?: number, rm?: number): BigNumber;
/**
* Configures the settings that apply to this BigNumber constructor.
*
* The configuration object, `object`, contains any number of the properties shown in the example
* below.
*
* Returns an object with the above properties and their current values.
*
* Throws if `object` is not an object, or if an invalid value is assigned to one or more of the
* properties.
*
* ```ts
* BigNumber.set({
* DECIMAL_PLACES: 40,
* ROUNDING_MODE: BigNumber.ROUND_HALF_CEIL,
* EXPONENTIAL_AT: [-10, 20],
* RANGE: [-500, 500],
* CRYPTO: true,
* MODULO_MODE: BigNumber.ROUND_FLOOR,
* POW_PRECISION: 80,
* FORMAT: {
* groupSize: 3,
* groupSeparator: ' ',
* decimalSeparator: ','
* },
* ALPHABET: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'
* });
*
* BigNumber.set().DECIMAL_PLACES // 40
* ```
*
* @param object The configuration object.
*/
static set(object: BigNumberConfig): BigNumberConfig;
/**
* Returns a string representing the value of this BigNumber in exponential notation rounded using rounding mode rm
* to dp decimal places, i.e with one digit before the decimal point and dp digits after it.
*
* If the value of this BigNumber in exponential notation has fewer than dp fraction digits, the return value will
* be appended with zeros accordingly.
*
* If dp is omitted, or is null or undefined, the number of digits after the decimal point defaults to the minimum
* number of digits necessary to represent the value exactly.
*
* If rm is omitted or is null or undefined, ROUNDING_MODE is used.
*
* ```ts
* x = 45.6
* y = new BigNumber(x)
* x.toExponential() // '4.56e+1'
* y.toExponential() // '4.56e+1'
* x.toExponential(0) // '5e+1'
* y.toExponential(0) // '5e+1'
* x.toExponential(1) // '4.6e+1'
* y.toExponential(1) // '4.6e+1'
* y.toExponential(1, 1) // '4.5e+1' (ROUND_DOWN)
* x.toExponential(3) // '4.560e+1'
* y.toExponential(3) // '4.560e+1'
* ```
*
* @param dp integer, 0 to 1e+9 inclusive
* @param rm integer, 0 to 8 inclusive
*/
toExponential(dp?: number, rm?: number): string;
/**
* Helps ES6 import.
*/
private static readonly default?: BigNumberConstructor;
/**
* Returns a string representing the value of this BigNumber in normal (fixed-point) notation rounded to dp decimal
* places using rounding mode `rm`.
*
* If the value of this BigNumber in normal notation has fewer than `dp` fraction digits, the return value will be
* appended with zeros accordingly.
*
* Unlike `Number.prototype.toFixed`, which returns exponential notation if a number is greater or equal to 10<sup>21</sup>, this
* method will always return normal notation.
*
* If dp is omitted or is `null` or `undefined`, the return value will be unrounded and in normal notation. This is also
* unlike `Number.prototype.toFixed`, which returns the value to zero decimal places.
*
* It is useful when fixed-point notation is required and the current `EXPONENTIAL_AT` setting causes toString to
* return exponential notation.
*
* If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*
* ```ts
* x = 3.456
* y = new BigNumber(x)
* x.toFixed() // '3'
* y.toFixed() // '3.456'
* y.toFixed(0) // '3'
* x.toFixed(2) // '3.46'
* y.toFixed(2) // '3.46'
* y.toFixed(2, 1) // '3.45' (ROUND_DOWN)
* x.toFixed(5) // '3.45600'
* y.toFixed(5) // '3.45600'
* ```
*
* @param dp integer, 0 to 1e+9 inclusive
* @param rm integer, 0 to 8 inclusive
*/
toFixed(dp?: number, rm?: number): string;
/**
* Helps ES6 import.
*/
private static readonly BigNumber?: BigNumberConstructor;
/**
* Returns a string representing the value of this BigNumber in normal (fixed-point) notation rounded to dp decimal
* places using rounding mode `rm`, and formatted according to the properties of the FORMAT object.
*
* See the examples below for the properties of the `FORMAT` object, their types and their usage.
*
* If `dp` is omitted or is `null` or `undefined`, then the return value is not rounded to a fixed number of decimal
* places.
*
* If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*
* ```ts
* format = {
* decimalSeparator: '.',
* groupSeparator: ',',
* groupSize: 3,
* secondaryGroupSize: 0,
* fractionGroupSeparator: ' ',
* fractionGroupSize: 0
* }
* BigNumber.config({ FORMAT: format })
*
* x = new BigNumber('123456789.123456789')
* x.toFormat() // '123,456,789.123456789'
* x.toFormat(1) // '123,456,789.1'
*
* // If a reference to the object assigned to FORMAT has been retained,
* // the format properties can be changed directly
* format.groupSeparator = ' '
* format.fractionGroupSize = 5
* x.toFormat() // '123 456 789.12345 6789'
*
* BigNumber.config({
* FORMAT: {
* decimalSeparator = ',',
* groupSeparator = '.',
* groupSize = 3,
* secondaryGroupSize = 2
* }
* })
*
* x.toFormat(6) // '12.34.56.789,123'
* ```
*
* @param dp integer, 0 to 1e+9 inclusive
* @param rm integer, 0 to 8 inclusive
*/
toFormat(dp?: number, rm?: number): string;
/**
* Rounds away from zero.
*/
static readonly ROUND_UP: 0;
/**
* Returns a string array representing the value of this BigNumber as a simple fraction with an integer numerator
* and an integer denominator. The denominator will be a positive non-zero value less than or equal to max.
*
* If a maximum denominator, max, is not specified, or is null or undefined, the denominator will be the lowest
* value necessary to represent the number exactly.
*
* ```ts
* x = new BigNumber(1.75)
* x.toFraction() // '7, 4'
*
* pi = new BigNumber('3.14159265358')
* pi.toFraction() // '157079632679,50000000000'
* pi.toFraction(100000) // '312689, 99532'
* pi.toFraction(10000) // '355, 113'
* pi.toFraction(100) // '311, 99'
* pi.toFraction(10) // '22, 7'
* pi.toFraction(1) // '3, 1'
* ```
*
* @param max integer >= `1` and < `Infinity`
*/
toFraction(max?: number | string | BigNumber): [string, string];
/**
* Rounds towards zero.
*/
static readonly ROUND_DOWN: 1;
/**
* Same as [[valueOf]]
*
* ```ts
* x = new BigNumber('177.7e+457')
* y = new BigNumber(235.4325)
* z = new BigNumber('0.0098074')
*
* // Serialize an array of three BigNumbers
* str = JSON.stringify( [x, y, z] )
* // "["1.777e+459","235.4325","0.0098074"]"
*
* // Return an array of three BigNumbers
* JSON.parse(str, function (key, val) {
* return key === '' ? val : new BigNumber(val)
* })
* ```
*/
toJSON(): string;
/**
* Rounds towards Infinity.
*/
static readonly ROUND_CEIL: 2;
/**
* Returns the value of this BigNumber as a JavaScript number primitive.
*
* Type coercion with, for example, the unary plus operator will also work, except that a BigNumber with the value
* minus zero will be converted to positive zero.
*
* ```ts
* x = new BigNumber(456.789)
* x.toNumber() // 456.789
* +x // 456.789
*
* y = new BigNumber('45987349857634085409857349856430985')
* y.toNumber() // 4.598734985763409e+34
*
* z = new BigNumber(-0)
* 1 / +z // Infinity
* 1 / z.toNumber() // -Infinity
* ```
*/
toNumber(): number;
/**
* Rounds towards -Infinity.
*/
static readonly ROUND_FLOOR: 3;
/**
* Returns a BigNumber whose value is the value of this BigNumber raised to the power `n`, and optionally modulo `a`
* modulus `m`.
*
* If `n` is negative the result is rounded according to the current [[Configuration.DECIMAL_PLACES]] and
* [[Configuration.ROUNDING_MODE]] configuration.
*
* If `n` is not an integer or is out of range:
* - If `ERRORS` is `true` a BigNumber Error is thrown,
* - else if `n` is greater than `9007199254740991`, it is interpreted as `Infinity`;
* - else if n is less than `-9007199254740991`, it is interpreted as `-Infinity`;
* - else if `n` is otherwise a number, it is truncated to an integer;
* - else it is interpreted as `NaN`.
*
* As the number of digits of the result of the power operation can grow so large so quickly, e.g.
* 123.456<sup>10000</sup> has over 50000 digits, the number of significant digits calculated is limited to the
* value of the [[Configuration.POW_PRECISION]] setting (default value: `100`) unless a modulus `m` is specified.
*
* Set [[Configuration.POW_PRECISION]] to `0` for an unlimited number of significant digits to be calculated (this
* will cause the method to slow dramatically for larger exponents).
*
* Negative exponents will be calculated to the number of decimal places specified by
* [[Configuration.DECIMAL_PLACES]] (but not to more than [[Configuration.POW_PRECISION]] significant digits).
*
* If `m` is specified and the value of `m`, `n` and this BigNumber are positive integers, then a fast modular
* exponentiation algorithm is used, otherwise if any of the values is not a positive integer the operation will
* simply be performed as `x.toPower(n).modulo(m)` with a `POW_PRECISION` of `0`.
*
* ```ts
* Math.pow(0.7, 2) // 0.48999999999999994
* x = new BigNumber(0.7)
* x.toPower(2) // '0.49'
* BigNumber(3).pow(-2) // '0.11111111111111111111'
* ```
*
* @param n integer, -9007199254740991 to 9007199254740991 inclusive
* @alias [[pow]]
*/
toPower(n: number, m?: number | string | BigNumber): BigNumber;
/**
* Rounds towards nearest neighbour. If equidistant, rounds away from zero .
*/
static readonly ROUND_HALF_UP: 4;
/**
* See [[toPower]]
*/
pow(n: number, m?: number | string | BigNumber): BigNumber;
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards zero.
*/
static readonly ROUND_HALF_DOWN: 5;
/**
* Returns a string representing the value of this BigNumber rounded to `sd` significant digits using rounding mode
* rm.
*
* - If `sd` is less than the number of digits necessary to represent the integer part of the value in normal
* (fixed-point) notation, then exponential notation is used.
* - If `sd` is omitted, or is `null` or `undefined`, then the return value is the same as `n.toString()`.
* - If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
*
* ```ts
* x = 45.6
* y = new BigNumber(x)
* x.toPrecision() // '45.6'
* y.toPrecision() // '45.6'
* x.toPrecision(1) // '5e+1'
* y.toPrecision(1) // '5e+1'
* y.toPrecision(2, 0) // '4.6e+1' (ROUND_UP)
* y.toPrecision(2, 1) // '4.5e+1' (ROUND_DOWN)
* x.toPrecision(5) // '45.600'
* y.toPrecision(5) // '45.600'
* ```
*
* @param sd integer, 1 to 1e+9 inclusive
* @param rm integer, 0 to 8 inclusive
*/
toPrecision(sd?: number, rm?: number): string;
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour.
*/
static readonly ROUND_HALF_EVEN: 6;
/**
* Returns a string representing the value of this BigNumber in the specified base, or base 10 if base is omitted or
* is `null` or `undefined`.
*
* For bases above 10, values from 10 to 35 are represented by a-z (as with `Number.prototype.toString`), 36 to 61 by
* A-Z, and 62 and 63 by `$` and `_` respectively.
*
* If a base is specified the value is rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE`
* configuration.
*
* If a base is not specified, and this BigNumber has a positive exponent that is equal to or greater than the
* positive component of the current `EXPONENTIAL_AT` setting, or a negative exponent equal to or less than the
* negative component of the setting, then exponential notation is returned.
*
* If base is `null` or `undefined` it is ignored.
*
* ```ts
* x = new BigNumber(750000)
* x.toString() // '750000'
* BigNumber.config({ EXPONENTIAL_AT: 5 })
* x.toString() // '7.5e+5'
*
* y = new BigNumber(362.875)
* y.toString(2) // '101101010.111'
* y.toString(9) // '442.77777777777777777778'
* y.toString(32) // 'ba.s'
*
* BigNumber.config({ DECIMAL_PLACES: 4 });
* z = new BigNumber('1.23456789')
* z.toString() // '1.23456789'
* z.toString(10) // '1.2346'
* ```
*
* @param base integer, 2 to 64 inclusive
*/
toString(base?: number): string;
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards Infinity.
*/
static readonly ROUND_HALF_CEIL: 7;
/**
* Returns a BigNumber whose value is the value of this BigNumber truncated to a whole number.
*
* ```ts
* x = new BigNumber(123.456)
* x.truncated() // '123'
* y = new BigNumber(-12.3)
* y.trunc() // '-12'
* ```
*
* @alias [[trunc]]
*/
truncated(): BigNumber;
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards -Infinity.
*/
static readonly ROUND_HALF_FLOOR: 8;
/**
* See [[truncated]]
*/
trunc(): BigNumber;
/**
* See `MODULO_MODE`.
*/
static readonly EUCLID: 9;
}
/**
* As [[toString]], but does not accept a base argument and includes the minus sign for negative zero.`
*
* ```ts
* x = new BigNumber('-0')
* x.toString() // '0'
* x.valueOf() // '-0'
* y = new BigNumber('1.777e+457')
* y.valueOf() // '1.777e+457'
* ```
*/
valueOf(): string;
export default BigNumber;
export namespace BigNumber {
export type Config = BigNumberConfig;
export type Constructor = BigNumberConstructor;
export type Format = BigNumberFormat;
export type Instance = BigNumberInstance;
export type ModuloMode = BigNumberModuloMode;
export type RoundingMode = BigNumberRoundingMode;
export type Value = BigNumberValue;
}
export default BigNumber;
/**
* Browsers.
*/
declare global {
const BigNumber: BigNumberConstructor;
type BigNumber = BigNumberInstance;
namespace BigNumber {
type Config = BigNumberConfig;
type Constructor = BigNumberConstructor;
type Format = BigNumberFormat;
type Instance = BigNumberInstance;
type ModuloMode = BigNumberModuloMode;
type RoundingMode = BigNumberRoundingMode;
type Value = BigNumberValue;
}
}

@@ -1,3 +0,3 @@

/* bignumber.js v5.0.0 https://github.com/MikeMcl/bignumber.js/LICENCE */
!function(e){"use strict";function n(e){function a(e,n){var t,r,i,o,u,s,l=this;if(!(l instanceof a))return new a(e,n);if(null!=n&&V(n,2,64,C,"base")){if(n=0|n,s=e+"",10==n)return l=new a(e instanceof a?e:s),I(l,B+l.e+1,P);if((o="number"==typeof e)&&0*e!=0||!new RegExp("^-?"+(t="["+v.slice(0,n)+"]+")+"(?:\\."+t+")?$",37>n?"i":"").test(s))return U(l,s,o,n);o?(l.s=0>1/e?(s=s.slice(1),-1):1,z&&s.replace(/^0\.0*|\./,"").length>15&&x(C,w,e),o=!1):l.s=45===s.charCodeAt(0)?(s=s.slice(1),-1):1,s=A(s,10,n,l.s)}else{if(e instanceof a)return l.s=e.s,l.e=e.e,l.c=(e=e.c)?e.slice():e,void(C=0);if((o="number"==typeof e)&&0*e==0){if(l.s=0>1/e?(e=-e,-1):1,e===~~e){for(r=0,i=e;i>=10;i/=10,r++);return l.e=r,l.c=[e],void(C=0)}s=e+""}else{if(!h.test(s=e+""))return U(l,s,o);l.s=45===s.charCodeAt(0)?(s=s.slice(1),-1):1}}for((r=s.indexOf("."))>-1&&(s=s.replace(".","")),(i=s.search(/e/i))>0?(0>r&&(r=i),r+=+s.slice(i+1),s=s.substring(0,i)):0>r&&(r=s.length),i=0;48===s.charCodeAt(i);i++);for(u=s.length;48===s.charCodeAt(--u););if(s=s.slice(i,u+1))if(u=s.length,o&&z&&u>15&&(e>y||e!==p(e))&&x(C,w,l.s*e),r=r-i-1,r>G)l.c=l.e=null;else if($>r)l.c=[l.e=0];else{if(l.e=r,l.c=[],i=(r+1)%b,0>r&&(i+=b),u>i){for(i&&l.c.push(+s.slice(0,i)),u-=b;u>i;)l.c.push(+s.slice(i,i+=b));s=s.slice(i),i=b-s.length}else i-=u;for(;i--;s+="0");l.c.push(+s)}else l.c=[l.e=0];C=0}function A(e,n,t,i){var o,u,l,f,h,g,p,d=e.indexOf("."),m=B,w=P;for(37>t&&(e=e.toLowerCase()),d>=0&&(l=W,W=0,e=e.replace(".",""),p=new a(t),h=p.pow(e.length-d),W=l,p.c=s(c(r(h.c),h.e),10,n),p.e=p.c.length),g=s(e,t,n),u=l=g.length;0==g[--l];g.pop());if(!g[0])return"0";if(0>d?--u:(h.c=g,h.e=u,h.s=i,h=L(h,p,m,w,n),g=h.c,f=h.r,u=h.e),o=u+m+1,d=g[o],l=n/2,f=f||0>o||null!=g[o+1],f=4>w?(null!=d||f)&&(0==w||w==(h.s<0?3:2)):d>l||d==l&&(4==w||f||6==w&&1&g[o-1]||w==(h.s<0?8:7)),1>o||!g[0])e=f?c("1",-m):"0";else{if(g.length=o,f)for(--n;++g[--o]>n;)g[o]=0,o||(++u,g=[1].concat(g));for(l=g.length;!g[--l];);for(d=0,e="";l>=d;e+=v.charAt(g[d++]));e=c(e,u)}return e}function E(e,n,t,i){var o,u,s,f,h;if(t=null!=t&&V(t,0,8,i,m)?0|t:P,!e.c)return e.toString();if(o=e.c[0],s=e.e,null==n)h=r(e.c),h=19==i||24==i&&q>=s?l(h,s):c(h,s);else if(e=I(new a(e),n,t),u=e.e,h=r(e.c),f=h.length,19==i||24==i&&(u>=n||q>=u)){for(;n>f;h+="0",f++);h=l(h,u)}else if(n-=s,h=c(h,u),u+1>f){if(--n>0)for(h+=".";n--;h+="0");}else if(n+=u-f,n>0)for(u+1==f&&(h+=".");n--;h+="0");return e.s<0&&o?"-"+h:h}function D(e,n){var t,r,i=0;for(u(e[0])&&(e=e[0]),t=new a(e[0]);++i<e.length;){if(r=new a(e[i]),!r.s){t=r;break}n.call(t,r)&&(t=r)}return t}function F(e,n,t,r,i){return(n>e||e>t||e!=f(e))&&x(r,(i||"decimal places")+(n>e||e>t?" out of range":" not an integer"),e),!0}function _(e,n,t){for(var r=1,i=n.length;!n[--i];n.pop());for(i=n[0];i>=10;i/=10,r++);return(t=r+t*b-1)>G?e.c=e.e=null:$>t?e.c=[e.e=0]:(e.e=t,e.c=n),e}function x(e,n,t){var r=new Error(["new BigNumber","cmp","config","div","divToInt","eq","gt","gte","lt","lte","minus","mod","plus","precision","random","round","shift","times","toDigits","toExponential","toFixed","toFormat","toFraction","pow","toPrecision","toString","BigNumber"][e]+"() "+n+": "+t);throw r.name="BigNumber Error",C=0,r}function I(e,n,t,r){var i,o,u,s,l,c,f,a=e.c,h=O;if(a){e:{for(i=1,s=a[0];s>=10;s/=10,i++);if(o=n-i,0>o)o+=b,u=n,l=a[c=0],f=l/h[i-u-1]%10|0;else if(c=g((o+1)/b),c>=a.length){if(!r)break e;for(;a.length<=c;a.push(0));l=f=0,i=1,o%=b,u=o-b+1}else{for(l=s=a[c],i=1;s>=10;s/=10,i++);o%=b,u=o-b+i,f=0>u?0:l/h[i-u-1]%10|0}if(r=r||0>n||null!=a[c+1]||(0>u?l:l%h[i-u-1]),r=4>t?(f||r)&&(0==t||t==(e.s<0?3:2)):f>5||5==f&&(4==t||r||6==t&&(o>0?u>0?l/h[i-u]:0:a[c-1])%10&1||t==(e.s<0?8:7)),1>n||!a[0])return a.length=0,r?(n-=e.e+1,a[0]=h[(b-n%b)%b],e.e=-n||0):a[0]=e.e=0,e;if(0==o?(a.length=c,s=1,c--):(a.length=c+1,s=h[b-o],a[c]=u>0?p(l/h[i-u]%h[u])*s:0),r)for(;;){if(0==c){for(o=1,u=a[0];u>=10;u/=10,o++);for(u=a[0]+=s,s=1;u>=10;u/=10,s++);o!=s&&(e.e++,a[0]==N&&(a[0]=1));break}if(a[c]+=s,a[c]!=N)break;a[c--]=0,s=1}for(o=a.length;0===a[--o];a.pop());}e.e>G?e.c=e.e=null:e.e<$&&(e.c=[e.e=0])}return e}var L,U,C=0,M=a.prototype,T=new a(1),B=20,P=4,q=-7,k=21,$=-1e7,G=1e7,z=!0,V=F,j=!1,H=1,W=0,J={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0};return a.another=n,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.EUCLID=9,a.config=a.set=function(){var e,n,t=0,r={},i=arguments,s=i[0],l=s&&"object"==typeof s?function(){return s.hasOwnProperty(n)?null!=(e=s[n]):void 0}:function(){return i.length>t?null!=(e=i[t++]):void 0};return l(n="DECIMAL_PLACES")&&V(e,0,S,2,n)&&(B=0|e),r[n]=B,l(n="ROUNDING_MODE")&&V(e,0,8,2,n)&&(P=0|e),r[n]=P,l(n="EXPONENTIAL_AT")&&(u(e)?V(e[0],-S,0,2,n)&&V(e[1],0,S,2,n)&&(q=0|e[0],k=0|e[1]):V(e,-S,S,2,n)&&(q=-(k=0|(0>e?-e:e)))),r[n]=[q,k],l(n="RANGE")&&(u(e)?V(e[0],-S,-1,2,n)&&V(e[1],1,S,2,n)&&($=0|e[0],G=0|e[1]):V(e,-S,S,2,n)&&(0|e?$=-(G=0|(0>e?-e:e)):z&&x(2,n+" cannot be zero",e))),r[n]=[$,G],l(n="ERRORS")&&(e===!!e||1===e||0===e?(C=0,V=(z=!!e)?F:o):z&&x(2,n+d,e)),r[n]=z,l(n="CRYPTO")&&(e===!0||e===!1||1===e||0===e?e?(e="undefined"==typeof crypto,!e&&crypto&&(crypto.getRandomValues||crypto.randomBytes)?j=!0:z?x(2,"crypto unavailable",e?void 0:crypto):j=!1):j=!1:z&&x(2,n+d,e)),r[n]=j,l(n="MODULO_MODE")&&V(e,0,9,2,n)&&(H=0|e),r[n]=H,l(n="POW_PRECISION")&&V(e,0,S,2,n)&&(W=0|e),r[n]=W,l(n="FORMAT")&&("object"==typeof e?J=e:z&&x(2,n+" not an object",e)),r[n]=J,r},a.max=function(){return D(arguments,M.lt)},a.min=function(){return D(arguments,M.gt)},a.random=function(){var e=9007199254740992,n=Math.random()*e&2097151?function(){return p(Math.random()*e)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(e){var t,r,i,o,u,s=0,l=[],c=new a(T);if(e=null!=e&&V(e,0,S,14)?0|e:B,o=g(e/b),j)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));o>s;)u=131072*t[s]+(t[s+1]>>>11),u>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(l.push(u%1e14),s+=2);s=o/2}else if(crypto.randomBytes){for(t=crypto.randomBytes(o*=7);o>s;)u=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6],u>=9e15?crypto.randomBytes(7).copy(t,s):(l.push(u%1e14),s+=7);s=o/7}else j=!1,z&&x(14,"crypto unavailable",crypto);if(!j)for(;o>s;)u=n(),9e15>u&&(l[s++]=u%1e14);for(o=l[--s],e%=b,o&&e&&(u=O[b-e],l[s]=p(o/u)*u);0===l[s];l.pop(),s--);if(0>s)l=[i=0];else{for(i=-1;0===l[0];l.splice(0,1),i-=b);for(s=1,u=l[0];u>=10;u/=10,s++);b>s&&(i-=b-s)}return c.e=i,c.c=l,c}}(),L=function(){function e(e,n,t){var r,i,o,u,s=0,l=e.length,c=n%R,f=n/R|0;for(e=e.slice();l--;)o=e[l]%R,u=e[l]/R|0,r=f*o+u*c,i=c*o+r%R*R+s,s=(i/t|0)+(r/R|0)+f*u,e[l]=i%t;return s&&(e=[s].concat(e)),e}function n(e,n,t,r){var i,o;if(t!=r)o=t>r?1:-1;else for(i=o=0;t>i;i++)if(e[i]!=n[i]){o=e[i]>n[i]?1:-1;break}return o}function r(e,n,t,r){for(var i=0;t--;)e[t]-=i,i=e[t]<n[t]?1:0,e[t]=i*r+e[t]-n[t];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(i,o,u,s,l){var c,f,h,g,d,m,w,v,y,O,R,S,A,E,D,F,_,x=i.s==o.s?1:-1,L=i.c,U=o.c;if(!(L&&L[0]&&U&&U[0]))return new a(i.s&&o.s&&(L?!U||L[0]!=U[0]:U)?L&&0==L[0]||!U?0*x:x/0:NaN);for(v=new a(x),y=v.c=[],f=i.e-o.e,x=u+f+1,l||(l=N,f=t(i.e/b)-t(o.e/b),x=x/b|0),h=0;U[h]==(L[h]||0);h++);if(U[h]>(L[h]||0)&&f--,0>x)y.push(1),g=!0;else{for(E=L.length,F=U.length,h=0,x+=2,d=p(l/(U[0]+1)),d>1&&(U=e(U,d,l),L=e(L,d,l),F=U.length,E=L.length),A=F,O=L.slice(0,F),R=O.length;F>R;O[R++]=0);_=U.slice(),_=[0].concat(_),D=U[0],U[1]>=l/2&&D++;do{if(d=0,c=n(U,O,F,R),0>c){if(S=O[0],F!=R&&(S=S*l+(O[1]||0)),d=p(S/D),d>1)for(d>=l&&(d=l-1),m=e(U,d,l),w=m.length,R=O.length;1==n(m,O,w,R);)d--,r(m,w>F?_:U,w,l),w=m.length,c=1;else 0==d&&(c=d=1),m=U.slice(),w=m.length;if(R>w&&(m=[0].concat(m)),r(O,m,R,l),R=O.length,-1==c)for(;n(U,O,F,R)<1;)d++,r(O,R>F?_:U,R,l),R=O.length}else 0===c&&(d++,O=[0]);y[h++]=d,O[0]?O[R++]=L[A]||0:(O=[L[A]],R=1)}while((A++<E||null!=O[0])&&x--);g=null!=O[0],y[0]||y.splice(0,1)}if(l==N){for(h=1,x=y[0];x>=10;x/=10,h++);I(v,u+(v.e=h+f*b-1)+1,s,g)}else v.e=f,v.r=+g;return v}}(),U=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,n=/^([^.]+)\.$/,t=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(o,u,s,l){var c,f=s?u:u.replace(i,"");if(r.test(f))o.s=isNaN(f)?null:0>f?-1:1;else{if(!s&&(f=f.replace(e,function(e,n,t){return c="x"==(t=t.toLowerCase())?16:"b"==t?2:8,l&&l!=c?e:n}),l&&(c=l,f=f.replace(n,"$1").replace(t,"0.$1")),u!=f))return new a(f,c);z&&x(C,"not a"+(l?" base "+l:"")+" number",u),o.s=null}o.c=o.e=null,C=0}}(),M.absoluteValue=M.abs=function(){var e=new a(this);return e.s<0&&(e.s=1),e},M.ceil=function(){return I(new a(this),this.e+1,2)},M.comparedTo=M.cmp=function(e,n){return C=1,i(this,new a(e,n))},M.decimalPlaces=M.dp=function(){var e,n,r=this.c;if(!r)return null;if(e=((n=r.length-1)-t(this.e/b))*b,n=r[n])for(;n%10==0;n/=10,e--);return 0>e&&(e=0),e},M.dividedBy=M.div=function(e,n){return C=3,L(this,new a(e,n),B,P)},M.dividedToIntegerBy=M.divToInt=function(e,n){return C=4,L(this,new a(e,n),0,1)},M.equals=M.eq=function(e,n){return C=5,0===i(this,new a(e,n))},M.floor=function(){return I(new a(this),this.e+1,3)},M.greaterThan=M.gt=function(e,n){return C=6,i(this,new a(e,n))>0},M.greaterThanOrEqualTo=M.gte=function(e,n){return C=7,1===(n=i(this,new a(e,n)))||0===n},M.isFinite=function(){return!!this.c},M.isInteger=M.isInt=function(){return!!this.c&&t(this.e/b)>this.c.length-2},M.isNaN=function(){return!this.s},M.isNegative=M.isNeg=function(){return this.s<0},M.isZero=function(){return!!this.c&&0==this.c[0]},M.lessThan=M.lt=function(e,n){return C=8,i(this,new a(e,n))<0},M.lessThanOrEqualTo=M.lte=function(e,n){return C=9,-1===(n=i(this,new a(e,n)))||0===n},M.minus=M.sub=function(e,n){var r,i,o,u,s=this,l=s.s;if(C=10,e=new a(e,n),n=e.s,!l||!n)return new a(NaN);if(l!=n)return e.s=-n,s.plus(e);var c=s.e/b,f=e.e/b,h=s.c,g=e.c;if(!c||!f){if(!h||!g)return h?(e.s=-n,e):new a(g?s:NaN);if(!h[0]||!g[0])return g[0]?(e.s=-n,e):new a(h[0]?s:3==P?-0:0)}if(c=t(c),f=t(f),h=h.slice(),l=c-f){for((u=0>l)?(l=-l,o=h):(f=c,o=g),o.reverse(),n=l;n--;o.push(0));o.reverse()}else for(i=(u=(l=h.length)<(n=g.length))?l:n,l=n=0;i>n;n++)if(h[n]!=g[n]){u=h[n]<g[n];break}if(u&&(o=h,h=g,g=o,e.s=-e.s),n=(i=g.length)-(r=h.length),n>0)for(;n--;h[r++]=0);for(n=N-1;i>l;){if(h[--i]<g[i]){for(r=i;r&&!h[--r];h[r]=n);--h[r],h[i]+=N}h[i]-=g[i]}for(;0==h[0];h.splice(0,1),--f);return h[0]?_(e,h,f):(e.s=3==P?-1:1,e.c=[e.e=0],e)},M.modulo=M.mod=function(e,n){var t,r,i=this;return C=11,e=new a(e,n),!i.c||!e.s||e.c&&!e.c[0]?new a(NaN):!e.c||i.c&&!i.c[0]?new a(i):(9==H?(r=e.s,e.s=1,t=L(i,e,0,3),e.s=r,t.s*=r):t=L(i,e,0,H),i.minus(t.times(e)))},M.negated=M.neg=function(){var e=new a(this);return e.s=-e.s||null,e},M.plus=M.add=function(e,n){var r,i=this,o=i.s;if(C=12,e=new a(e,n),n=e.s,!o||!n)return new a(NaN);if(o!=n)return e.s=-n,i.minus(e);var u=i.e/b,s=e.e/b,l=i.c,c=e.c;if(!u||!s){if(!l||!c)return new a(o/0);if(!l[0]||!c[0])return c[0]?e:new a(l[0]?i:0*o)}if(u=t(u),s=t(s),l=l.slice(),o=u-s){for(o>0?(s=u,r=c):(o=-o,r=l),r.reverse();o--;r.push(0));r.reverse()}for(o=l.length,n=c.length,0>o-n&&(r=c,c=l,l=r,n=o),o=0;n;)o=(l[--n]=l[n]+c[n]+o)/N|0,l[n]=N===l[n]?0:l[n]%N;return o&&(l=[o].concat(l),++s),_(e,l,s)},M.precision=M.sd=function(e){var n,t,r=this,i=r.c;if(null!=e&&e!==!!e&&1!==e&&0!==e&&(z&&x(13,"argument"+d,e),e!=!!e&&(e=null)),!i)return null;if(t=i.length-1,n=t*b+1,t=i[t]){for(;t%10==0;t/=10,n--);for(t=i[0];t>=10;t/=10,n++);}return e&&r.e+1>n&&(n=r.e+1),n},M.round=function(e,n){var t=new a(this);return(null==e||V(e,0,S,15))&&I(t,~~e+this.e+1,null!=n&&V(n,0,8,15,m)?0|n:P),t},M.shift=function(e){var n=this;return V(e,-y,y,16,"argument")?n.times("1e"+f(e)):new a(n.c&&n.c[0]&&(-y>e||e>y)?n.s*(0>e?0:1/0):n)},M.squareRoot=M.sqrt=function(){var e,n,i,o,u,s=this,l=s.c,c=s.s,f=s.e,h=B+4,g=new a("0.5");if(1!==c||!l||!l[0])return new a(!c||0>c&&(!l||l[0])?NaN:l?s:1/0);if(c=Math.sqrt(+s),0==c||c==1/0?(n=r(l),(n.length+f)%2==0&&(n+="0"),c=Math.sqrt(n),f=t((f+1)/2)-(0>f||f%2),c==1/0?n="1e"+f:(n=c.toExponential(),n=n.slice(0,n.indexOf("e")+1)+f),i=new a(n)):i=new a(c+""),i.c[0])for(f=i.e,c=f+h,3>c&&(c=0);;)if(u=i,i=g.times(u.plus(L(s,u,h,1))),r(u.c).slice(0,c)===(n=r(i.c)).slice(0,c)){if(i.e<f&&--c,n=n.slice(c-3,c+1),"9999"!=n&&(o||"4999"!=n)){(!+n||!+n.slice(1)&&"5"==n.charAt(0))&&(I(i,i.e+B+2,1),e=!i.times(i).eq(s));break}if(!o&&(I(u,u.e+B+2,0),u.times(u).eq(s))){i=u;break}h+=4,c+=4,o=1}return I(i,i.e+B+1,P,e)},M.times=M.mul=function(e,n){var r,i,o,u,s,l,c,f,h,g,p,d,m,w,v,y=this,O=y.c,S=(C=17,e=new a(e,n)).c;if(!(O&&S&&O[0]&&S[0]))return!y.s||!e.s||O&&!O[0]&&!S||S&&!S[0]&&!O?e.c=e.e=e.s=null:(e.s*=y.s,O&&S?(e.c=[0],e.e=0):e.c=e.e=null),e;for(i=t(y.e/b)+t(e.e/b),e.s*=y.s,c=O.length,g=S.length,g>c&&(m=O,O=S,S=m,o=c,c=g,g=o),o=c+g,m=[];o--;m.push(0));for(w=N,v=R,o=g;--o>=0;){for(r=0,p=S[o]%v,d=S[o]/v|0,s=c,u=o+s;u>o;)f=O[--s]%v,h=O[s]/v|0,l=d*f+h*p,f=p*f+l%v*v+m[u]+r,r=(f/w|0)+(l/v|0)+d*h,m[u--]=f%w;m[u]=r}return r?++i:m.splice(0,1),_(e,m,i)},M.toDigits=function(e,n){var t=new a(this);return e=null!=e&&V(e,1,S,18,"precision")?0|e:null,n=null!=n&&V(n,0,8,18,m)?0|n:P,e?I(t,e,n):t},M.toExponential=function(e,n){return E(this,null!=e&&V(e,0,S,19)?~~e+1:null,n,19)},M.toFixed=function(e,n){return E(this,null!=e&&V(e,0,S,20)?~~e+this.e+1:null,n,20)},M.toFormat=function(e,n){var t=E(this,null!=e&&V(e,0,S,21)?~~e+this.e+1:null,n,21);if(this.c){var r,i=t.split("."),o=+J.groupSize,u=+J.secondaryGroupSize,s=J.groupSeparator,l=i[0],c=i[1],f=this.s<0,a=f?l.slice(1):l,h=a.length;if(u&&(r=o,o=u,u=r,h-=r),o>0&&h>0){for(r=h%o||o,l=a.substr(0,r);h>r;r+=o)l+=s+a.substr(r,o);u>0&&(l+=s+a.slice(r)),f&&(l="-"+l)}t=c?l+J.decimalSeparator+((u=+J.fractionGroupSize)?c.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+J.fractionGroupSeparator):c):l}return t},M.toFraction=function(e){var n,t,i,o,u,s,l,c,f,h=z,g=this,p=g.c,d=new a(T),m=t=new a(T),w=l=new a(T);if(null!=e&&(z=!1,s=new a(e),z=h,(!(h=s.isInt())||s.lt(T))&&(z&&x(22,"max denominator "+(h?"out of range":"not an integer"),e),e=!h&&s.c&&I(s,s.e+1,1).gte(T)?s:null)),!p)return g.toString();for(f=r(p),o=d.e=f.length-g.e-1,d.c[0]=O[(u=o%b)<0?b+u:u],e=!e||s.cmp(d)>0?o>0?d:m:s,u=G,G=1/0,s=new a(f),l.c[0]=0;c=L(s,d,0,1),i=t.plus(c.times(w)),1!=i.cmp(e);)t=w,w=i,m=l.plus(c.times(i=m)),l=i,d=s.minus(c.times(i=d)),s=i;return i=L(e.minus(t),w,0,1),l=l.plus(i.times(m)),t=t.plus(i.times(w)),l.s=m.s=g.s,o*=2,n=L(m,w,o,P).minus(g).abs().cmp(L(l,t,o,P).minus(g).abs())<1?[m.toString(),w.toString()]:[l.toString(),t.toString()],G=u,n},M.toNumber=function(){return+this},M.toPower=M.pow=function(e,n){var t,r,i,o=p(0>e?-e:+e),u=this;if(null!=n&&(C=23,n=new a(n)),!V(e,-y,y,23,"exponent")&&(!isFinite(e)||o>y&&(e/=0)||parseFloat(e)!=e&&!(e=NaN))||0==e)return t=Math.pow(+u,e),new a(n?t%n:t);for(n?e>1&&u.gt(T)&&u.isInt()&&n.gt(T)&&n.isInt()?u=u.mod(n):(i=n,n=null):W&&(t=g(W/b+2)),r=new a(T);;){if(o%2){if(r=r.times(u),!r.c)break;t?r.c.length>t&&(r.c.length=t):n&&(r=r.mod(n))}if(o=p(o/2),!o)break;u=u.times(u),t?u.c&&u.c.length>t&&(u.c.length=t):n&&(u=u.mod(n))}return n?r:(0>e&&(r=T.div(r)),i?r.mod(i):t?I(r,W,P):r)},M.toPrecision=function(e,n){return E(this,null!=e&&V(e,1,S,24,"precision")?0|e:null,n,24)},M.toString=function(e){var n,t=this,i=t.s,o=t.e;return null===o?i?(n="Infinity",0>i&&(n="-"+n)):n="NaN":(n=r(t.c),n=null!=e&&V(e,2,64,25,"base")?A(c(n,o),0|e,10,i):q>=o||o>=k?l(n,o):c(n,o),0>i&&t.c[0]&&(n="-"+n)),n},M.truncated=M.trunc=function(){return I(new a(this),this.e+1,1)},M.valueOf=M.toJSON=function(){var e,n=this,t=n.e;return null===t?n.toString():(e=r(n.c),e=q>=t||t>=k?l(e,t):c(e,t),n.s<0?"-"+e:e)},M.isBigNumber=!0,null!=e&&a.config(e),a}function t(e){var n=0|e;return e>0||e===n?n:n-1}function r(e){for(var n,t,r=1,i=e.length,o=e[0]+"";i>r;){for(n=e[r++]+"",t=b-n.length;t--;n="0"+n);o+=n}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function i(e,n){var t,r,i=e.c,o=n.c,u=e.s,s=n.s,l=e.e,c=n.e;if(!u||!s)return null;if(t=i&&!i[0],r=o&&!o[0],t||r)return t?r?0:-s:u;if(u!=s)return u;if(t=0>u,r=l==c,!i||!o)return r?0:!i^t?1:-1;if(!r)return l>c^t?1:-1;for(s=(l=i.length)<(c=o.length)?l:c,u=0;s>u;u++)if(i[u]!=o[u])return i[u]>o[u]^t?1:-1;return l==c?0:l>c^t?1:-1}function o(e,n,t){return(e=f(e))>=n&&t>=e}function u(e){return"[object Array]"==Object.prototype.toString.call(e)}function s(e,n,t){for(var r,i,o=[0],u=0,s=e.length;s>u;){for(i=o.length;i--;o[i]*=n);for(o[r=0]+=v.indexOf(e.charAt(u++));r<o.length;r++)o[r]>t-1&&(null==o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/t|0,o[r]%=t)}return o.reverse()}function l(e,n){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(0>n?"e":"e+")+n}function c(e,n){var t,r;if(0>n){for(r="0.";++n;r+="0");e=r+e}else if(t=e.length,++n>t){for(r="0",n-=t;--n;r+="0");e+=r}else t>n&&(e=e.slice(0,n)+"."+e.slice(n));return e}function f(e){return e=parseFloat(e),0>e?g(e):p(e)}var a,h=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,g=Math.ceil,p=Math.floor,d=" not a boolean or binary digit",m="rounding mode",w="number type has more than 15 significant digits",v="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",N=1e14,b=14,y=9007199254740991,O=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],R=1e7,S=1e9;a=n(),a["default"]=a.BigNumber=a,"function"==typeof define&&define.amd?define(function(){return a}):"undefined"!=typeof module&&module.exports?module.exports=a:(e||(e="undefined"!=typeof self?self:Function("return this")()),e.BigNumber=a)}(this);
/* bignumber.js v6.0.0 https://github.com/MikeMcl/bignumber.js/LICENCE */
!function(e){"use strict";function r(e){function c(e,r){var n,t,i,s,u,f,a,g=this;if(!(g instanceof c))return new c(e,r);if(null==r){if(e instanceof c)return g.s=e.s,g.e=e.e,void(g.c=(e=e.c)?e.slice():e);if(u="number"==typeof e,u&&0*e==0){if(g.s=0>1/e?(e=-e,-1):1,e===~~e){for(i=0,s=e;s>=10;s/=10,i++);return g.e=i,void(g.c=[e])}a=e+""}else{if(!l.test(a=e+""))return S(g,a,u);g.s=45==a.charCodeAt(0)?(a=a.slice(1),-1):1}}else{if(o(r,2,k.length,"Base"),a=e+"",10==r)return g=new c(e instanceof c?e:a),A(g,D+g.e+1,T);if(u="number"==typeof e){if(0*e!=0)return S(g,a,u,r);if(g.s=0>1/e?(a=a.slice(1),-1):1,a.replace(/^0\.0*|\./,"").length>15)throw Error(p+e);u=!1}else g.s=45===a.charCodeAt(0)?(a=a.slice(1),-1):1,r>10&&37>r&&(a=a.toLowerCase());for(n=k.slice(0,r),i=s=0,f=a.length;f>s;s++)if(n.indexOf(t=a.charAt(s))<0){if("."==t&&s>i){i=f;continue}return S(g,e+"",u,r)}a=P(a,r,10,g.s)}for((i=a.indexOf("."))>-1&&(a=a.replace(".","")),(s=a.search(/e/i))>0?(0>i&&(i=s),i+=+a.slice(s+1),a=a.substring(0,s)):0>i&&(i=a.length),s=0;48===a.charCodeAt(s);s++);for(f=a.length;48===a.charCodeAt(--f););if(a=a.slice(s,f+1)){if(f=a.length,u&&f>15&&(e>w||e!==h(e)))throw Error(p+g.s*e);if(i=i-s-1,i>C)g.c=g.e=null;else if(x>i)g.c=[g.e=0];else{if(g.e=i,g.c=[],s=(i+1)%m,0>i&&(s+=m),f>s){for(s&&g.c.push(+a.slice(0,s)),f-=m;f>s;)g.c.push(+a.slice(s,s+=m));a=a.slice(s),s=m-a.length}else s-=f;for(;s--;a+="0");g.c.push(+a)}}else g.c=[g.e=0]}function y(e,r,n,i){var s,l,a,h,g;if(null==n?n=T:o(n,0,8),!e.c)return e.toString();if(s=e.c[0],a=e.e,null==r)g=t(e.c),g=1==i||2==i&&I>=a?u(g,a):f(g,a,"0");else if(e=A(new c(e),r,n),l=e.e,g=t(e.c),h=g.length,1==i||2==i&&(l>=r||I>=l)){for(;r>h;g+="0",h++);g=u(g,l)}else if(r-=a,g=f(g,l,"0"),l+1>h){if(--r>0)for(g+=".";r--;g+="0");}else if(r+=l-h,r>0)for(l+1==h&&(g+=".");r--;g+="0");return e.s<0&&s?"-"+g:g}function b(e,r){var n,t,i=0;for(s(e[0])&&(e=e[0]),n=new c(e[0]);++i<e.length;){if(t=new c(e[i]),!t.s){n=t;break}r.call(n,t)&&(n=t)}return n}function E(e,r,n){for(var t=1,i=r.length;!r[--i];r.pop());for(i=r[0];i>=10;i/=10,t++);return(n=t+n*m-1)>C?e.c=e.e=null:x>n?e.c=[e.e=0]:(e.e=n,e.c=r),e}function A(e,r,n,t){var i,o,s,u,f,c,l,g=e.c,p=v;if(g){e:{for(i=1,u=g[0];u>=10;u/=10,i++);if(o=r-i,0>o)o+=m,s=r,f=g[c=0],l=f/p[i-s-1]%10|0;else if(c=a((o+1)/m),c>=g.length){if(!t)break e;for(;g.length<=c;g.push(0));f=l=0,i=1,o%=m,s=o-m+1}else{for(f=u=g[c],i=1;u>=10;u/=10,i++);o%=m,s=o-m+i,l=0>s?0:f/p[i-s-1]%10|0}if(t=t||0>r||null!=g[c+1]||(0>s?f:f%p[i-s-1]),t=4>n?(l||t)&&(0==n||n==(e.s<0?3:2)):l>5||5==l&&(4==n||t||6==n&&(o>0?s>0?f/p[i-s]:0:g[c-1])%10&1||n==(e.s<0?8:7)),1>r||!g[0])return g.length=0,t?(r-=e.e+1,g[0]=p[(m-r%m)%m],e.e=-r||0):g[0]=e.e=0,e;if(0==o?(g.length=c,u=1,c--):(g.length=c+1,u=p[m-o],g[c]=s>0?h(f/p[i-s]%p[s])*u:0),t)for(;;){if(0==c){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(e.e++,g[0]==d&&(g[0]=1));break}if(g[c]+=u,g[c]!=d)break;g[c--]=0,u=1}for(o=g.length;0===g[--o];g.pop());}e.e>C?e.c=e.e=null:e.e<x&&(e.c=[e.e=0])}return e}var R,P,S,_=c.prototype,L=new c(1),D=20,T=4,I=-7,B=21,x=-1e7,C=1e7,M=!1,U=1,F=0,G={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0},k="0123456789abcdefghijklmnopqrstuvwxyz";return c.clone=r,c.ROUND_UP=0,c.ROUND_DOWN=1,c.ROUND_CEIL=2,c.ROUND_FLOOR=3,c.ROUND_HALF_UP=4,c.ROUND_HALF_DOWN=5,c.ROUND_HALF_EVEN=6,c.ROUND_HALF_CEIL=7,c.ROUND_HALF_FLOOR=8,c.EUCLID=9,c.config=c.set=function(e){var r,n;if(null!=e){if("object"!=typeof e)throw Error(g+"Object expected: "+e);if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(n=e[r],o(n,0,O,r),D=n),e.hasOwnProperty(r="ROUNDING_MODE")&&(n=e[r],o(n,0,8,r),T=n),e.hasOwnProperty(r="EXPONENTIAL_AT")&&(n=e[r],s(n)?(o(n[0],-O,0,r),o(n[1],0,O,r),I=n[0],B=n[1]):(o(n,-O,O,r),I=-(B=0>n?-n:n))),e.hasOwnProperty(r="RANGE"))if(n=e[r],s(n))o(n[0],-O,-1,r),o(n[1],1,O,r),x=n[0],C=n[1];else{if(o(n,-O,O,r),!n)throw Error(g+r+" cannot be zero: "+n);x=-(C=0>n?-n:n)}if(e.hasOwnProperty(r="CRYPTO")){if(n=e[r],n!==!!n)throw Error(g+r+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw M=!n,Error(g+"crypto unavailable");M=n}else M=n}if(e.hasOwnProperty(r="MODULO_MODE")&&(n=e[r],o(n,0,9,r),U=n),e.hasOwnProperty(r="POW_PRECISION")&&(n=e[r],o(n,0,O,r),F=n),e.hasOwnProperty(r="FORMAT")){if(n=e[r],"object"!=typeof n)throw Error(g+r+" not an object: "+n);G=n}if(e.hasOwnProperty(r="ALPHABET")){if(n=e[r],"string"!=typeof n||/^.$|\.|(.).*\1/.test(n))throw Error(g+r+" invalid: "+n);k=n}}return{DECIMAL_PLACES:D,ROUNDING_MODE:T,EXPONENTIAL_AT:[I,B],RANGE:[x,C],CRYPTO:M,MODULO_MODE:U,POW_PRECISION:F,FORMAT:G,ALPHABET:k}},c.isBigNumber=function(e){return e instanceof c||e&&e._isBigNumber===!0||!1},c.maximum=c.max=function(){return b(arguments,_.lt)},c.minimum=c.min=function(){return b(arguments,_.gt)},c.random=function(){var e=9007199254740992,r=Math.random()*e&2097151?function(){return h(Math.random()*e)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(e){var n,t,i,s,u,f=0,l=[],p=new c(L);if(null==e?e=D:o(e,0,O),s=a(e/m),M)if(crypto.getRandomValues){for(n=crypto.getRandomValues(new Uint32Array(s*=2));s>f;)u=131072*n[f]+(n[f+1]>>>11),u>=9e15?(t=crypto.getRandomValues(new Uint32Array(2)),n[f]=t[0],n[f+1]=t[1]):(l.push(u%1e14),f+=2);f=s/2}else{if(!crypto.randomBytes)throw M=!1,Error(g+"crypto unavailable");for(n=crypto.randomBytes(s*=7);s>f;)u=281474976710656*(31&n[f])+1099511627776*n[f+1]+4294967296*n[f+2]+16777216*n[f+3]+(n[f+4]<<16)+(n[f+5]<<8)+n[f+6],u>=9e15?crypto.randomBytes(7).copy(n,f):(l.push(u%1e14),f+=7);f=s/7}if(!M)for(;s>f;)u=r(),9e15>u&&(l[f++]=u%1e14);for(s=l[--f],e%=m,s&&e&&(u=v[m-e],l[f]=h(s/u)*u);0===l[f];l.pop(),f--);if(0>f)l=[i=0];else{for(i=-1;0===l[0];l.splice(0,1),i-=m);for(f=1,u=l[0];u>=10;u/=10,f++);m>f&&(i-=m-f)}return p.e=i,p.c=l,p}}(),P=function(){function e(e,r,n,t){for(var i,o,s=[0],u=0,f=e.length;f>u;){for(o=s.length;o--;s[o]*=r);for(s[0]+=t.indexOf(e.charAt(u++)),i=0;i<s.length;i++)s[i]>n-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}var r="0123456789";return function(n,i,o,s,u){var l,a,h,g,p,d,m,w,v=n.indexOf("."),N=D,O=T;for(v>=0&&(g=F,F=0,n=n.replace(".",""),w=new c(i),d=w.pow(n.length-v),F=g,w.c=e(f(t(d.c),d.e,"0"),10,o,r),w.e=w.c.length),m=e(n,i,o,u?(l=k,r):(l=r,k)),h=g=m.length;0==m[--g];m.pop());if(!m[0])return l.charAt(0);if(0>v?--h:(d.c=m,d.e=h,d.s=s,d=R(d,w,N,O,o),m=d.c,p=d.r,h=d.e),a=h+N+1,v=m[a],g=o/2,p=p||0>a||null!=m[a+1],p=4>O?(null!=v||p)&&(0==O||O==(d.s<0?3:2)):v>g||v==g&&(4==O||p||6==O&&1&m[a-1]||O==(d.s<0?8:7)),1>a||!m[0])n=p?f(l.charAt(1),-N,l.charAt(0)):l.charAt(0);else{if(m.length=a,p)for(--o;++m[--a]>o;)m[a]=0,a||(++h,m=[1].concat(m));for(g=m.length;!m[--g];);for(v=0,n="";g>=v;n+=l.charAt(m[v++]));n=f(n,h,l.charAt(0))}return n}}(),R=function(){function e(e,r,n){var t,i,o,s,u=0,f=e.length,c=r%N,l=r/N|0;for(e=e.slice();f--;)o=e[f]%N,s=e[f]/N|0,t=l*o+s*c,i=c*o+t%N*N+u,u=(i/n|0)+(t/N|0)+l*s,e[f]=i%n;return u&&(e=[u].concat(e)),e}function r(e,r,n,t){var i,o;if(n!=t)o=n>t?1:-1;else for(i=o=0;n>i;i++)if(e[i]!=r[i]){o=e[i]>r[i]?1:-1;break}return o}function t(e,r,n,t){for(var i=0;n--;)e[n]-=i,i=e[n]<r[n]?1:0,e[n]=i*t+e[n]-r[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(i,o,s,u,f){var l,a,g,p,w,v,N,O,y,b,E,R,P,S,_,L,D,T=i.s==o.s?1:-1,I=i.c,B=o.c;if(!(I&&I[0]&&B&&B[0]))return new c(i.s&&o.s&&(I?!B||I[0]!=B[0]:B)?I&&0==I[0]||!B?0*T:T/0:NaN);for(O=new c(T),y=O.c=[],a=i.e-o.e,T=s+a+1,f||(f=d,a=n(i.e/m)-n(o.e/m),T=T/m|0),g=0;B[g]==(I[g]||0);g++);if(B[g]>(I[g]||0)&&a--,0>T)y.push(1),p=!0;else{for(S=I.length,L=B.length,g=0,T+=2,w=h(f/(B[0]+1)),w>1&&(B=e(B,w,f),I=e(I,w,f),L=B.length,S=I.length),P=L,b=I.slice(0,L),E=b.length;L>E;b[E++]=0);D=B.slice(),D=[0].concat(D),_=B[0],B[1]>=f/2&&_++;do{if(w=0,l=r(B,b,L,E),0>l){if(R=b[0],L!=E&&(R=R*f+(b[1]||0)),w=h(R/_),w>1)for(w>=f&&(w=f-1),v=e(B,w,f),N=v.length,E=b.length;1==r(v,b,N,E);)w--,t(v,N>L?D:B,N,f),N=v.length,l=1;else 0==w&&(l=w=1),v=B.slice(),N=v.length;if(E>N&&(v=[0].concat(v)),t(b,v,E,f),E=b.length,-1==l)for(;r(B,b,L,E)<1;)w++,t(b,E>L?D:B,E,f),E=b.length}else 0===l&&(w++,b=[0]);y[g++]=w,b[0]?b[E++]=I[P]||0:(b=[I[P]],E=1)}while((P++<S||null!=b[0])&&T--);p=null!=b[0],y[0]||y.splice(0,1)}if(f==d){for(g=1,T=y[0];T>=10;T/=10,g++);A(O,s+(O.e=g+a*m-1)+1,u,p)}else O.e=a,O.r=+p;return O}}(),S=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,r=/^([^.]+)\.$/,n=/^\.([^.]+)$/,t=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(o,s,u,f){var l,a=u?s:s.replace(i,"");if(!t.test(a)){if(!u&&(a=a.replace(e,function(e,r,n){return l="x"==(n=n.toLowerCase())?16:"b"==n?2:8,f&&f!=l?e:r}),f&&(l=f,a=a.replace(r,"$1").replace(n,"0.$1")),s!=a))return new c(a,l);throw Error(g+"Not a"+(f?" base "+f:"")+" number: "+s)}o.s=isNaN(a)?null:0>a?-1:1,o.c=o.e=null}}(),_.absoluteValue=_.abs=function(){var e=new c(this);return e.s<0&&(e.s=1),e},_.comparedTo=function(e,r){return i(this,new c(e,r))},_.decimalPlaces=_.dp=function(e,r){var t,i,s,u=this;if(null!=e)return o(e,0,O),null==r?r=T:o(r,0,8),A(new c(u),e+u.e+1,r);if(!(t=u.c))return null;if(i=((s=t.length-1)-n(this.e/m))*m,s=t[s])for(;s%10==0;s/=10,i--);return 0>i&&(i=0),i},_.dividedBy=_.div=function(e,r){return R(this,new c(e,r),D,T)},_.dividedToIntegerBy=_.idiv=function(e,r){return R(this,new c(e,r),0,1)},_.isEqualTo=_.eq=function(e,r){return 0===i(this,new c(e,r))},_.integerValue=function(e){var r=new c(this);return null==e?e=T:o(e,0,8),A(r,r.e+1,e)},_.isGreaterThan=_.gt=function(e,r){return i(this,new c(e,r))>0},_.isGreaterThanOrEqualTo=_.gte=function(e,r){return 1===(r=i(this,new c(e,r)))||0===r},_.isFinite=function(){return!!this.c},_.isInteger=function(){return!!this.c&&n(this.e/m)>this.c.length-2},_.isNaN=function(){return!this.s},_.isNegative=function(){return this.s<0},_.isPositive=function(){return this.s>0},_.isZero=function(){return!!this.c&&0==this.c[0]},_.isLessThan=_.lt=function(e,r){return i(this,new c(e,r))<0},_.isLessThanOrEqualTo=_.lte=function(e,r){return-1===(r=i(this,new c(e,r)))||0===r},_.minus=function(e,r){var t,i,o,s,u=this,f=u.s;if(e=new c(e,r),r=e.s,!f||!r)return new c(NaN);if(f!=r)return e.s=-r,u.plus(e);var l=u.e/m,a=e.e/m,h=u.c,g=e.c;if(!l||!a){if(!h||!g)return h?(e.s=-r,e):new c(g?u:NaN);if(!h[0]||!g[0])return g[0]?(e.s=-r,e):new c(h[0]?u:3==T?-0:0)}if(l=n(l),a=n(a),h=h.slice(),f=l-a){for((s=0>f)?(f=-f,o=h):(a=l,o=g),o.reverse(),r=f;r--;o.push(0));o.reverse()}else for(i=(s=(f=h.length)<(r=g.length))?f:r,f=r=0;i>r;r++)if(h[r]!=g[r]){s=h[r]<g[r];break}if(s&&(o=h,h=g,g=o,e.s=-e.s),r=(i=g.length)-(t=h.length),r>0)for(;r--;h[t++]=0);for(r=d-1;i>f;){if(h[--i]<g[i]){for(t=i;t&&!h[--t];h[t]=r);--h[t],h[i]+=d}h[i]-=g[i]}for(;0==h[0];h.splice(0,1),--a);return h[0]?E(e,h,a):(e.s=3==T?-1:1,e.c=[e.e=0],e)},_.modulo=_.mod=function(e,r){var n,t,i=this;return e=new c(e,r),!i.c||!e.s||e.c&&!e.c[0]?new c(NaN):!e.c||i.c&&!i.c[0]?new c(i):(9==U?(t=e.s,e.s=1,n=R(i,e,0,3),e.s=t,n.s*=t):n=R(i,e,0,U),i.minus(n.times(e)))},_.multipliedBy=_.times=function(e,r){var t,i,o,s,u,f,l,a,h,g,p,w,v,O,y,b=this,A=b.c,R=(e=new c(e,r)).c;if(!(A&&R&&A[0]&&R[0]))return!b.s||!e.s||A&&!A[0]&&!R||R&&!R[0]&&!A?e.c=e.e=e.s=null:(e.s*=b.s,A&&R?(e.c=[0],e.e=0):e.c=e.e=null),e;for(i=n(b.e/m)+n(e.e/m),e.s*=b.s,l=A.length,g=R.length,g>l&&(v=A,A=R,R=v,o=l,l=g,g=o),o=l+g,v=[];o--;v.push(0));for(O=d,y=N,o=g;--o>=0;){for(t=0,p=R[o]%y,w=R[o]/y|0,u=l,s=o+u;s>o;)a=A[--u]%y,h=A[u]/y|0,f=w*a+h*p,a=p*a+f%y*y+v[s]+t,t=(a/O|0)+(f/y|0)+w*h,v[s--]=a%O;v[s]=t}return t?++i:v.splice(0,1),E(e,v,i)},_.negated=function(){var e=new c(this);return e.s=-e.s||null,e},_.plus=function(e,r){var t,i=this,o=i.s;if(e=new c(e,r),r=e.s,!o||!r)return new c(NaN);if(o!=r)return e.s=-r,i.minus(e);var s=i.e/m,u=e.e/m,f=i.c,l=e.c;if(!s||!u){if(!f||!l)return new c(o/0);if(!f[0]||!l[0])return l[0]?e:new c(f[0]?i:0*o)}if(s=n(s),u=n(u),f=f.slice(),o=s-u){for(o>0?(u=s,t=l):(o=-o,t=f),t.reverse();o--;t.push(0));t.reverse()}for(o=f.length,r=l.length,0>o-r&&(t=l,l=f,f=t,r=o),o=0;r;)o=(f[--r]=f[r]+l[r]+o)/d|0,f[r]=d===f[r]?0:f[r]%d;return o&&(f=[o].concat(f),++u),E(e,f,u)},_.precision=_.sd=function(e,r){var n,t,i,s=this;if(null!=e&&e!==!!e)return o(e,1,O),null==r?r=T:o(r,0,8),A(new c(s),e,r);if(!(n=s.c))return null;if(i=n.length-1,t=i*m+1,i=n[i]){for(;i%10==0;i/=10,t--);for(i=n[0];i>=10;i/=10,t++);}return e&&s.e+1>t&&(t=s.e+1),t},_.shiftedBy=function(e){return o(e,-w,w),this.times("1e"+e)},_.squareRoot=_.sqrt=function(){var e,r,i,o,s,u=this,f=u.c,l=u.s,a=u.e,h=D+4,g=new c("0.5");if(1!==l||!f||!f[0])return new c(!l||0>l&&(!f||f[0])?NaN:f?u:1/0);if(l=Math.sqrt(+u),0==l||l==1/0?(r=t(f),(r.length+a)%2==0&&(r+="0"),l=Math.sqrt(r),a=n((a+1)/2)-(0>a||a%2),l==1/0?r="1e"+a:(r=l.toExponential(),r=r.slice(0,r.indexOf("e")+1)+a),i=new c(r)):i=new c(l+""),i.c[0])for(a=i.e,l=a+h,3>l&&(l=0);;)if(s=i,i=g.times(s.plus(R(u,s,h,1))),t(s.c).slice(0,l)===(r=t(i.c)).slice(0,l)){if(i.e<a&&--l,r=r.slice(l-3,l+1),"9999"!=r&&(o||"4999"!=r)){(!+r||!+r.slice(1)&&"5"==r.charAt(0))&&(A(i,i.e+D+2,1),e=!i.times(i).eq(u));break}if(!o&&(A(s,s.e+D+2,0),s.times(s).eq(u))){i=s;break}h+=4,l+=4,o=1}return A(i,i.e+D+1,T,e)},_.toExponential=function(e,r){return null!=e&&(o(e,0,O),e++),y(this,e,r,1)},_.toFixed=function(e,r){return null!=e&&(o(e,0,O),e=e+this.e+1),y(this,e,r)},_.toFormat=function(e,r){var n=this.toFixed(e,r);if(this.c){var t,i=n.split("."),o=+G.groupSize,s=+G.secondaryGroupSize,u=G.groupSeparator,f=i[0],c=i[1],l=this.s<0,a=l?f.slice(1):f,h=a.length;if(s&&(t=o,o=s,s=t,h-=t),o>0&&h>0){for(t=h%o||o,f=a.substr(0,t);h>t;t+=o)f+=u+a.substr(t,o);s>0&&(f+=u+a.slice(t)),l&&(f="-"+f)}n=c?f+G.decimalSeparator+((s=+G.fractionGroupSize)?c.replace(new RegExp("\\d{"+s+"}\\B","g"),"$&"+G.fractionGroupSeparator):c):f}return n},_.toFraction=function(e){var r,n,i,o,s,u,f,l,a,h,p,d,w=this,N=w.c;if(null!=e&&(l=new c(e),!l.isInteger()||l.lt(L)))throw Error(g+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+e);if(!N)return w.toString();for(n=new c(L),h=i=new c(L),o=a=new c(L),d=t(N),u=n.e=d.length-w.e-1,n.c[0]=v[(f=u%m)<0?m+f:f],e=!e||l.comparedTo(n)>0?u>0?n:h:l,f=C,C=1/0,l=new c(d),a.c[0]=0;p=R(l,n,0,1),s=i.plus(p.times(o)),1!=s.comparedTo(e);)i=o,o=s,h=a.plus(p.times(s=h)),a=s,n=l.minus(p.times(s=n)),l=s;return s=R(e.minus(i),o,0,1),a=a.plus(s.times(h)),i=i.plus(s.times(o)),a.s=h.s=w.s,u*=2,r=R(h,o,u,T).minus(w).abs().comparedTo(R(a,i,u,T).minus(w).abs())<1?[h.toString(),o.toString()]:[a.toString(),i.toString()],C=f,r},_.toNumber=function(){return+this},_.exponentiatedBy=_.pow=function(e,r){var n,t,i,s,u=this;for(o(e,-w,w),null!=r&&(r=new c(r)),r?e>1&&u.gt(L)&&u.isInteger()&&r.gt(L)&&r.isInteger()?u=u.mod(r):(s=r,r=null):F&&(t=a(F/m+2)),i=new c(L),n=h(0>e?-e:e);;){if(n%2){if(i=i.times(u),!i.c)break;t?i.c.length>t&&(i.c.length=t):r&&(i=i.mod(r))}if(n=h(n/2),!n)break;u=u.times(u),t?u.c&&u.c.length>t&&(u.c.length=t):r&&(u=u.mod(r))}return r?i:(0>e&&(i=L.div(i)),s?i.mod(s):t?A(i,F,T):i)},_.toPrecision=function(e,r){return null!=e&&o(e,1,O),y(this,e,r,2)},_.toString=function(e){var r,n=this,i=n.s,s=n.e;return null===s?i?(r="Infinity",0>i&&(r="-"+r)):r="NaN":(r=t(n.c),null==e?r=I>=s||s>=B?u(r,s):f(r,s,"0"):(o(e,2,k.length,"Base"),r=P(f(r,s,"0"),10,e,i,!0)),0>i&&n.c[0]&&(r="-"+r)),r},_.valueOf=_.toJSON=function(){var e,r=this,n=r.e;return null===n?r.toString():(e=t(r.c),e=I>=n||n>=B?u(e,n):f(e,n,"0"),r.s<0?"-"+e:e)},_._isBigNumber=!0,null!=e&&c.set(e),c}function n(e){var r=0|e;return e>0||e===r?r:r-1}function t(e){for(var r,n,t=1,i=e.length,o=e[0]+"";i>t;){for(r=e[t++]+"",n=m-r.length;n--;r="0"+r);o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function i(e,r){var n,t,i=e.c,o=r.c,s=e.s,u=r.s,f=e.e,c=r.e;if(!s||!u)return null;if(n=i&&!i[0],t=o&&!o[0],n||t)return n?t?0:-u:s;if(s!=u)return s;if(n=0>s,t=f==c,!i||!o)return t?0:!i^n?1:-1;if(!t)return f>c^n?1:-1;for(u=(f=i.length)<(c=o.length)?f:c,s=0;u>s;s++)if(i[s]!=o[s])return i[s]>o[s]^n?1:-1;return f==c?0:f>c^n?1:-1}function o(e,r,n,t){if(r>e||e>n||e!==(0>e?a(e):h(e)))throw Error(g+(t||"Argument")+("number"==typeof e?r>e||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+e)}function s(e){return"[object Array]"==Object.prototype.toString.call(e)}function u(e,r){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(0>r?"e":"e+")+r}function f(e,r,n){var t,i;if(0>r){for(i=n+".";++r;i+=n);e=i+e}else if(t=e.length,++r>t){for(i=n,r-=t;--r;i+=n);e+=i}else t>r&&(e=e.slice(0,r)+"."+e.slice(r));return e}var c,l=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,h=Math.floor,g="[BigNumber Error] ",p=g+"Number primitive has more than 15 significant digits: ",d=1e14,m=14,w=9007199254740991,v=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],N=1e7,O=1e9;c=r(),c["default"]=c.BigNumber=c,"function"==typeof define&&define.amd?define(function(){return c}):"undefined"!=typeof module&&module.exports?module.exports=c:(e||(e="undefined"!=typeof self?self:Function("return this")()),e.BigNumber=c)}(this);
//# sourceMappingURL=bignumber.js.map
{
"name": "bignumber.js",
"main": "bignumber.js",
"version": "5.0.0",
"version": "6.0.0",
"homepage": "https://github.com/MikeMcl/bignumber.js",

@@ -6,0 +6,0 @@ "authors": [

{
"name": "bignumber.js",
"description": "A library for arbitrary-precision decimal and non-decimal arithmetic",
"version": "5.0.0",
"version": "6.0.0",
"keywords": [

@@ -34,5 +34,5 @@ "arbitrary",

"scripts": {
"test": "node ./test/every-test.js",
"build": "uglifyjs bignumber.js --source-map bignumber.js.map -c -m -o bignumber.min.js --preamble \"/* bignumber.js v5.0.0 https://github.com/MikeMcl/bignumber.js/LICENCE */\""
"test": "node test/test",
"build": "uglifyjs bignumber.js --source-map bignumber.js.map -c -m -o bignumber.min.js --preamble \"/* bignumber.js v6.0.0 https://github.com/MikeMcl/bignumber.js/LICENCE */\""
}
}

@@ -34,18 +34,29 @@ ![bignumber.js](https://raw.githubusercontent.com/MikeMcl/bignumber.js/gh-pages/bignumberjs.png)

Browser:
```html
<script src='relative/path/to/bignumber.js'></script>
<script src='path/to/bignumber.js'></script>
```
For [Node.js](http://nodejs.org), the library is available from the [npm](https://npmjs.org/) registry
[Node.js](http://nodejs.org):
$ npm install bignumber.js
```bash
$ npm install --save bignumber.js
```
```javascript
```js
var BigNumber = require('bignumber.js');
```
To load with AMD loader libraries such as [requireJS](http://requirejs.org/):
ES6 module (*bignumber.mjs*):
```javascript
require(['path/to/bignumber'], function(BigNumber) {
```js
//import BigNumber from 'bignumber.js';
import {BigNumber} from 'bignumber.js';
```
AMD loader libraries such as [requireJS](http://requirejs.org/):
```js
require(['bignumber'], function(BigNumber) {
// Use BigNumber here in local scope. No global BigNumber.

@@ -68,8 +79,7 @@ });

z = new BigNumber(x)
x.equals(y) && y.equals(z) && x.equals(z) // true
x.isEqualTo(y) && y.isEqualTo(z) && x.isEqualTo(z) // true
```
and a base from 2 to 36 inclusive can be specified.
and a base from 2 to 64 inclusive can be specified.
```javascript

@@ -93,11 +103,11 @@ x = new BigNumber(1011, 2) // "11"

```javascript
x.dividedBy(y).plus(z).times(9).floor()
x.times('1.23456780123456789e+9').plus(9876.5432321).dividedBy('4444562598.111772').ceil()
x.dividedBy(y).plus(z).times(9)
x.times('1.23456780123456789e+9').plus(9876.5432321).dividedBy('4444562598.111772').integerValue()
```
Many method names have a shorter alias.
Some of the longer method names have a shorter alias.
```javascript
x.squareRoot().dividedBy(y).toPower(3).equals(x.sqrt().div(y).pow(3)) // true
x.cmp(y.mod(z).neg()) == 1 && x.comparedTo(y.modulo(z).negated()) == 1 // true
x.squareRoot().dividedBy(y).exponentiatedBy(3).isEqualTo( x.sqrt().div(y).pow(3) ) // true
x.modulo(y).multipliedBy(z).eq( x.mod(y).times(z) ) // true
```

@@ -137,8 +147,8 @@

y = new BigNumber(3);
z = x.div(y) // "0.6666666667"
z.sqrt() // "0.8164965809"
z.pow(-3) // "3.3749999995"
z.toString(2) // "0.1010101011"
z.times(z) // "0.44444444448888888889"
z.times(z).round(10) // "0.4444444445"
z = x.dividedBy(y) // "0.6666666667"
z.squareRoot() // "0.8164965809"
z.exponentiatedBy(-3) // "3.3749999995"
z.toString(2) // "0.1010101011"
z.multipliedBy(z) // "0.44444444448888888889"
z.multipliedBy(z).decimalPlaces(10) // "0.4444444445"
```

@@ -165,3 +175,2 @@

```javascript

@@ -174,5 +183,4 @@ x = new BigNumber(-123.456);

For advanced usage, multiple BigNumber constructors can be created, each with their own independent configuration which applies to all BigNumber's created from it.
Multiple BigNumber constructors can be created, each with their own independent configuration which applies to all BigNumber's created from it.
```javascript

@@ -183,3 +191,3 @@ // Set DECIMAL_PLACES for the original BigNumber constructor

// Create another BigNumber constructor, optionally passing in a configuration object
BN = BigNumber.another({ DECIMAL_PLACES: 5 })
BN = BigNumber.clone({ DECIMAL_PLACES: 5 })

@@ -197,5 +205,5 @@ x = new BigNumber(1)

The *test* directory contains the test scripts for each method.
The *test/modules* directory contains the test scripts for each method.
The tests can be run with Node or a browser. For Node use
The tests can be run with Node.js or a browser. For Node.js use

@@ -206,16 +214,10 @@ $ npm test

$ node test/every-test
$ node test/test
To test a single method, e.g.
To test a single method, use, for example
$ node test/toFraction
$ node test/methods/toFraction
For the browser, see *every-test.html* and *single-test.html* in the *test/browser* directory.
For the browser, open *test/test.html*.
*bignumber-vs-number.html* enables some of the methods of bignumber.js to be compared with those of JavaScript's number type.
## Versions
Version 1.x.x of this library is still supported on the 'original' branch. The advantages of later versions are that they are considerably faster for numbers with many digits and that there are some added methods (see Change Log below). The disadvantages are more lines of code and increased code complexity, and the loss of simplicity in no longer having the coefficient of a BigNumber stored in base 10.
## Performance

@@ -249,180 +251,4 @@

MIT.
The MIT Licence.
See [LICENCE](https://github.com/MikeMcl/bignumber.js/blob/master/LICENCE).
## Change Log
#### 5.0.0
* 27/11/2017
* #81 Don't throw on constructor call without `new`.
#### 4.1.0
* 26/09/2017
* Remove node 0.6 from *.travis.yml*.
* Add *bignumber.mjs*.
#### 4.0.4
* 03/09/2017
* Add missing aliases to *bignumber.d.ts*.
#### 4.0.3
* 30/08/2017
* Add types: *bignumber.d.ts*.
#### 4.0.2
* 03/05/2017
* #120 Workaround Safari/Webkit bug.
#### 4.0.1
* 05/04/2017
* #121 BigNumber.default to BigNumber['default'].
#### 4.0.0
* 09/01/2017
* Replace BigNumber.isBigNumber method with isBigNumber prototype property.
#### 3.1.2
* 08/01/2017
* Minor documentation edit.
#### 3.1.1
* 08/01/2017
* Uncomment `isBigNumber` tests.
* Ignore dot files.
#### 3.1.0
* 08/01/2017
* Add `isBigNumber` method.
#### 3.0.2
* 08/01/2017
* Bugfix: Possible incorrect value of `ERRORS` after a `BigNumber.another` call (due to `parseNumeric` declaration in outer scope).
#### 3.0.1
* 23/11/2016
* Apply fix for old ipads with `%` issue, see #57 and #102.
* Correct error message.
#### 3.0.0
* 09/11/2016
* Remove `require('crypto')` - leave it to the user.
* Add `BigNumber.set` as `BigNumber.config` alias.
* Default `POW_PRECISION` to `0`.
#### 2.4.0
* 14/07/2016
* #97 Add exports to support ES6 imports.
#### 2.3.0
* 07/03/2016
* #86 Add modulus parameter to `toPower`.
#### 2.2.0
* 03/03/2016
* #91 Permit larger JS integers.
#### 2.1.4
* 15/12/2015
* Correct UMD.
#### 2.1.3
* 13/12/2015
* Refactor re global object and crypto availability when bundling.
#### 2.1.2
* 10/12/2015
* Bugfix: `window.crypto` not assigned to `crypto`.
#### 2.1.1
* 09/12/2015
* Prevent code bundler from adding `crypto` shim.
#### 2.1.0
* 26/10/2015
* For `valueOf` and `toJSON`, include the minus sign with negative zero.
#### 2.0.8
* 2/10/2015
* Internal round function bugfix.
#### 2.0.6
* 31/03/2015
* Add bower.json. Tweak division after in-depth review.
#### 2.0.5
* 25/03/2015
* Amend README. Remove bitcoin address.
#### 2.0.4
* 25/03/2015
* Critical bugfix #58: division.
#### 2.0.3
* 18/02/2015
* Amend README. Add source map.
#### 2.0.2
* 18/02/2015
* Correct links.
#### 2.0.1
* 18/02/2015
* Add `max`, `min`, `precision`, `random`, `shift`, `toDigits` and `truncated` methods.
* Add the short-forms: `add`, `mul`, `sd`, `sub` and `trunc`.
* Add an `another` method to enable multiple independent constructors to be created.
* Add support for the base 2, 8 and 16 prefixes `0b`, `0o` and `0x`.
* Enable a rounding mode to be specified as a second parameter to `toExponential`, `toFixed`, `toFormat` and `toPrecision`.
* Add a `CRYPTO` configuration property so cryptographically-secure pseudo-random number generation can be specified.
* Add a `MODULO_MODE` configuration property to enable the rounding mode used by the `modulo` operation to be specified.
* Add a `POW_PRECISION` configuration property to enable the number of significant digits calculated by the power operation to be limited.
* Improve code quality.
* Improve documentation.
#### 2.0.0
* 29/12/2014
* Add `dividedToIntegerBy`, `isInteger` and `toFormat` methods.
* Remove the following short-forms: `isF`, `isZ`, `toE`, `toF`, `toFr`, `toN`, `toP`, `toS`.
* Store a BigNumber's coefficient in base 1e14, rather than base 10.
* Add fast path for integers to BigNumber constructor.
* Incorporate the library into the online documentation.
#### 1.5.0
* 13/11/2014
* Add `toJSON` and `decimalPlaces` methods.
#### 1.4.1
* 08/06/2014
* Amend README.
#### 1.4.0
* 08/05/2014
* Add `toNumber`.
#### 1.3.0
* 08/11/2013
* Ensure correct rounding of `sqrt` in all, rather than almost all, cases.
* Maximum radix to 64.
#### 1.2.1
* 17/10/2013
* Sign of zero when x < 0 and x + (-x) = 0.
#### 1.2.0
* 19/9/2013
* Throw Error objects for stack.
#### 1.1.1
* 22/8/2013
* Show original value in constructor error message.
#### 1.1.0
* 1/8/2013
* Allow numbers with trailing radix point.
#### 1.0.1
* Bugfix: error messages with incorrect method name
#### 1.0.0
* 8/11/2012
* Initial release

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc