diff -pruN 1.3.0+dfsg-1/bignumber.d.ts 8.0.2+ds-1/bignumber.d.ts
--- 1.3.0+dfsg-1/bignumber.d.ts	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/bignumber.d.ts	2019-01-13 22:17:07.000000000 +0000
@@ -0,0 +1,1848 @@
+// Type definitions for bignumber.js >=8.0.0
+// Project: https://github.com/MikeMcl/bignumber.js
+// Definitions by: Michael Mclaughlin <https://github.com/MikeMcl>
+// Definitions: https://github.com/MikeMcl/bignumber.js
+
+// Documentation: http://mikemcl.github.io/bignumber.js/
+//
+// Exports:
+//
+//   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 default BigNumber;
+
+export namespace BigNumber {
+
+  /**
+   * See `BigNumber.config` and `BigNumber.clone`.
+   */
+  export interface Config {
+
+    /**
+     * 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;
+
+    /**
+     * 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?: BigNumber.RoundingMode;
+
+    /**
+     * 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];
+
+    /**
+     * 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];
+
+    /**
+     * 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
+     * // Node.js
+     * global.crypto = require('crypto')
+     *
+     * BigNumber.config({ CRYPTO: true })
+     * BigNumber.config().CRYPTO       // true
+     * BigNumber.random()              // 0.54340758610486147524
+     * ```
+     */
+    CRYPTO?: boolean;
+
+    /**
+     * An integer, 0, 1, 3, 6 or 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?: BigNumber.ModuloMode;
+
+    /**
+     * 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: {
+     *     // string to prepend
+     *     prefix: '',
+     *     // 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,
+     *     // string to append
+     *     suffix: ''
+     *   }
+     * })
+     * ```
+     */
+    FORMAT?: BigNumber.Format;
+
+    /**
+     * The alphabet used for base conversion. The length of the alphabet corresponds to the maximum
+     * value of the base argument that can be passed to the BigNumber constructor or `toString`.
+     *  
+     * Default value: `'0123456789abcdefghijklmnopqrstuvwxyz'`.
+     *
+     * There is no maximum length for the alphabet, but it must be at least 2 characters long,
+     * and it must not contain whitespace or a repeated character, or the sign indicators '+' and
+     * '-', or the decimal separator '.'. 
+     *
+     * ```ts
+     * // duodecimal (base 12)
+     * BigNumber.config({ ALPHABET: '0123456789TE' })
+     * x = new BigNumber('T', 12)
+     * x.toString()                // '10'
+     * x.toString(12)              // 'T'
+     * ```
+     */
+    ALPHABET?: string;
+  }
+
+  export type Constructor = typeof BigNumber;
+
+  /**
+   * See `FORMAT` and `toFormat`.
+   */
+  export interface Format {
+
+    /**
+     * The string to prepend.
+     */
+    prefix?: string;
+
+    /**
+     * 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;
+
+    /**
+     * The string to append.
+     */
+    suffix?: string;
+  }
+
+  export type Instance = BigNumber;
+  export type ModuloMode = 0 | 1 | 3 | 6 | 9;
+  export type RoundingMode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
+  export type Value = string | number | BigNumber;
+}
+
+export declare class BigNumber {
+
+  /**
+   * Used internally by the `BigNumber.isBigNumber` method.
+   */
+  private readonly _isBigNumber: true;
+
+  /**
+   * The coefficient of the value of this BigNumber, an array of base 1e14 integer numbers.
+   */
+  readonly c: number[];
+
+  /**
+   * The exponent of the value of this BigNumber, an integer number, -1000000000 to 1000000000.
+   */
+  readonly e: number;
+
+  /**
+   * The sign of the value of this BigNumber, -1 or 1.
+   */
+  readonly s: number;
+
+  /**
+   * Returns a new instance of a BigNumber object with value `n`, where `n` is a numeric value in
+   * the specified `base`, or base 10 if `base` is omitted or is `null` or `undefined`.
+   *
+   * ```ts
+   * x = new BigNumber(123.4567)              // '123.4567'
+   * // 'new' is optional
+   * y = BigNumber(x)                         // '123.4567'
+   * ```
+   *
+   * If `n` is a base 10 value it can be in normal (fixed-point) or exponential notation.
+   * Values in other bases must be in normal notation. Values in any base can have fraction digits,
+   * i.e. digits after the decimal point.
+   *
+   * ```ts
+   * new BigNumber(43210)                     // '43210'
+   * new BigNumber('4.321e+4')                // '43210'
+   * new BigNumber('-735.0918e-430')          // '-7.350918e-428'
+   * new BigNumber('123412421.234324', 5)     // '607236.557696'
+   * ```
+   *
+   * Signed `0`, signed `Infinity` and `NaN` are supported.
+   *
+   * ```ts
+   * new BigNumber('-Infinity')               // '-Infinity'
+   * new BigNumber(NaN)                       // 'NaN'
+   * new BigNumber(-0)                        // '0'
+   * new BigNumber('.5')                      // '0.5'
+   * new BigNumber('+2')                      // '2'
+   * ```
+   *
+   * 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.
+   *
+   * ```ts
+   * new BigNumber(-10110100.1, 2)            // '-180.5'
+   * new BigNumber('-0b10110100.1')           // '-180.5'
+   * new BigNumber('ff.8', 16)                // '255.5'
+   * new BigNumber('0xff.8')                  // '255.5'
+   * ```
+   *
+   * If a base is specified, `n` is rounded according to the current `DECIMAL_PLACES` and
+   * `ROUNDING_MODE` settings. This includes base 10, so don't include a `base` parameter for decimal
+   * values unless this behaviour is desired.
+   *
+   * ```ts
+   * BigNumber.config({ DECIMAL_PLACES: 5 })
+   * new BigNumber(1.23456789)                // '1.23456789'
+   * new BigNumber(1.23456789, 10)            // '1.23457'
+   * ```
+   *
+   * An error is thrown if `base` is invalid.
+   *
+   * There is no limit to the number of digits of a value of type string (other than that of
+   * JavaScript's maximum array size). See `RANGE` to set the maximum and minimum possible exponent
+   * value of a BigNumber.
+   *
+   * ```ts
+   * new BigNumber('5032485723458348569331745.33434346346912144534543')
+   * new BigNumber('4.321e10000000')
+   * ```
+   *
+   * BigNumber `NaN` is returned if `n` is invalid (unless `BigNumber.DEBUG` is `true`, see below).
+   *
+   * ```ts
+   * new BigNumber('.1*')                    // 'NaN'
+   * new BigNumber('blurgh')                 // 'NaN'
+   * new BigNumber(9, 2)                     // 'NaN'
+   * ```
+   *
+   * To aid in debugging, if `BigNumber.DEBUG` is `true` then an error will be thrown on an
+   * invalid `n`. An error will also be thrown if `n` is of type number with more than 15
+   * significant digits, as calling `toString` or `valueOf` on these numbers may not result in the
+   * intended value.
+   *
+   * ```ts
+   * console.log(823456789123456.3)          //  823456789123456.2
+   * new BigNumber(823456789123456.3)        // '823456789123456.2'
+   * BigNumber.DEBUG = true
+   * // 'Error: Number has more than 15 significant digits'
+   * new BigNumber(823456789123456.3)
+   * // 'Error: Not a base 2 number'
+   * new BigNumber(9, 2)
+   * ```
+   *
+   * @param n A numeric value.
+   * @param base The base of `n`, integer, 2 to 36 (or `ALPHABET.length`, see `ALPHABET`).
+   */
+  constructor(n: BigNumber.Value, base?: number);
+
+  /**
+   * 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;
+
+  /**
+   * 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;
+
+  /**
+   *  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: BigNumber.Value, base?: number): number;
+
+  /**
+   * 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(): number;
+  decimalPlaces(decimalPlaces: number, roundingMode?: BigNumber.RoundingMode): 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(): number;
+  dp(decimalPlaces: number, roundingMode?: BigNumber.RoundingMode): BigNumber;
+
+  /**
+   * 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: BigNumber.Value, base?: number): BigNumber;
+
+  /**
+   * 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: BigNumber.Value, base?: number): 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: BigNumber.Value, base?: number): 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: BigNumber.Value, base?: 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 integers and `n` is
+   * positive, then a fast modular exponentiation algorithm is used, otherwise the operation will
+   * be performed as `x.exponentiatedBy(n).modulo(m)` with a `POW_PRECISION` of 0.
+   *
+   * Throws if `n` is not an integer.
+   *
+   * ```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.
+   * @param [m] The modulus.
+   */
+  exponentiatedBy(n: BigNumber.Value, m?: BigNumber.Value): BigNumber;
+  exponentiatedBy(n: number, m?: BigNumber.Value): 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 integers and `n` is
+   * positive, then a fast modular exponentiation algorithm is used, otherwise the operation will
+   * be performed as `x.pow(n).modulo(m)` with a `POW_PRECISION` of 0.
+   *
+   * Throws if `n` is not an integer.
+   *
+   * ```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.
+   * @param [m] The modulus.
+   */
+  pow(n: BigNumber.Value, m?: BigNumber.Value): BigNumber;
+  pow(n: number, m?: BigNumber.Value): BigNumber;
+
+  /**
+   * 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 {BigNumber.RoundingMode} [rm] The roundng mode, an integer, 0 to 8.
+   */
+  integerValue(rm?: BigNumber.RoundingMode): BigNumber;
+
+  /**
+   * 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: BigNumber.Value, base?: number): boolean;
+
+  /**
+   * 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: BigNumber.Value, base?: number): boolean;
+
+  /**
+   * 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;
+
+  /**
+   * 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: BigNumber.Value, base?: number): boolean;
+
+  /**
+   * 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: BigNumber.Value, base?: number): boolean;
+
+  /**
+   * 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: BigNumber.Value, base?: number): boolean;
+
+  /**
+   * 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: BigNumber.Value, base?: number): boolean;
+
+  /**
+   * 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;
+
+  /**
+   * 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: BigNumber.Value, base?: number): boolean;
+
+  /**
+   * 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: BigNumber.Value, base?: number): boolean;
+
+  /**
+   * 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: BigNumber.Value, base?: number): boolean;
+
+  /**
+   * 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: BigNumber.Value, base?: number): boolean;
+
+  /**
+   * 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;
+
+  /**
+   * 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 is positive, otherwise returns `false`.
+   *
+   * ```ts
+   * x = new BigNumber(-0)
+   * x.isPositive()                  // false
+   * y = new BigNumber(2)
+   * y.isPositive()                  // true
+   * ```
+   */
+  isPositive(): 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 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: BigNumber.Value, base?: number): BigNumber;
+
+  /**
+   * 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: BigNumber.Value, base?: number): BigNumber;
+
+  /**
+   * 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: BigNumber.Value, base?: number): BigNumber;
+
+  /**
+   * 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: BigNumber.Value, base?: number) : BigNumber;
+
+  /**
+   * 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: BigNumber.Value, base?: number): BigNumber;
+
+  /**
+   * 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 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: BigNumber.Value, base?: number): BigNumber;
+
+  /**
+   * 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 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?: BigNumber.RoundingMode): BigNumber;
+
+  /**
+   * 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;
+
+  /*
+   * 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?: BigNumber.RoundingMode): BigNumber;
+
+  /**
+   * 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 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;
+
+  /**
+   * 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 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?: BigNumber.RoundingMode): string;
+  toExponential(): string;
+
+  /**
+   * 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?: BigNumber.RoundingMode): string;
+  toFixed(): string;
+
+  /**
+   * 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` or `FORMAT` object.
+   *
+   * The formatting object may contain some or all of the properties 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.
+   *
+   * If `format` is omitted or is `null` or `undefined`, `FORMAT` is used.
+   *
+   * Throws if `decimalPlaces`, `roundingMode`, or `format` is invalid.
+   *
+   * ```ts
+   * fmt = {
+   *   decimalSeparator: '.',
+   *   groupSeparator: ',',
+   *   groupSize: 3,
+   *   secondaryGroupSize: 0,
+   *   fractionGroupSeparator: ' ',
+   *   fractionGroupSize: 0
+   * }
+   *
+   * x = new BigNumber('123456789.123456789')
+   *
+   * // Set the global formatting options
+   * BigNumber.config({ FORMAT: fmt })
+   *
+   * x.toFormat()                              // '123,456,789.123456789'
+   * x.toFormat(3)                             // '123,456,789.123'
+   *
+   * // If a reference to the object assigned to FORMAT has been retained,
+   * // the format properties can be changed directly
+   * fmt.groupSeparator = ' '
+   * fmt.fractionGroupSize = 5
+   * x.toFormat()                              // '123 456 789.12345 6789'
+   *
+   * // Alternatively, pass the formatting options as an argument
+   * fmt = {
+   *   decimalSeparator: ',',
+   *   groupSeparator: '.',
+   *   groupSize: 3,
+   *   secondaryGroupSize: 2
+   * }
+   *
+   * x.toFormat()                              // '123 456 789.12345 6789'
+   * x.toFormat(fmt)                           // '12.34.56.789,123456789'
+   * x.toFormat(2, fmt)                        // '12.34.56.789,12'
+   * x.toFormat(3, BigNumber.ROUND_UP, fmt)    // '12.34.56.789,124'
+   * ```
+   *
+   * @param [decimalPlaces] Decimal places, integer, 0 to 1e+9.
+   * @param [roundingMode] Rounding mode, integer, 0 to 8.
+   * @param [format] Formatting options object. See `BigNumber.Format`.
+   */
+  toFormat(decimalPlaces: number, roundingMode: BigNumber.RoundingMode, format?: BigNumber.Format): string;
+  toFormat(decimalPlaces: number, roundingMode?: BigNumber.RoundingMode): string;
+  toFormat(decimalPlaces?: number): string;
+  toFormat(decimalPlaces: number, format: BigNumber.Format): string;
+  toFormat(format: BigNumber.Format): string;
+
+  /**
+   * Returns an array of two BigNumbers 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 > 0, or Infinity.
+   */
+  toFraction(max_denominator?: BigNumber.Value): [BigNumber, BigNumber];
+
+  /**
+   * As `valueOf`.
+   */
+  toJSON(): string;
+
+  /**
+   * 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 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?: BigNumber.RoundingMode): string;
+  toPrecision(): string;
+
+  /**
+   * 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;
+
+  /**
+   * 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;
+
+  /**
+   * 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?: BigNumber.Config): BigNumber.Constructor;
+
+  /**
+   * 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: BigNumber.Config): BigNumber.Config;
+
+  /**
+   * 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): value is BigNumber;
+
+  /**
+   * Returns a BigNumber whose value is the maximum of the arguments.
+   *
+   * 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.apply(null, arr)            // '14'
+   * ```
+   *
+   * @param n A numeric value.
+   */
+  static maximum(...n: BigNumber.Value[]): BigNumber;
+
+  /**
+   * Returns a BigNumber whose value is the maximum of the arguments.
+   *
+   * 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.apply(null, arr)            // '14'
+   * ```
+   *
+   * @param n A numeric value.
+   */
+  static max(...n: BigNumber.Value[]): BigNumber;
+
+  /**
+   * Returns a BigNumber whose value is the minimum of the arguments.
+   *
+   * 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.apply(null, arr)                // '-15.9999'
+   * ```
+   *
+   * @param n A numeric value.
+   */
+  static minimum(...n: BigNumber.Value[]): BigNumber;
+
+  /**
+   * Returns a BigNumber whose value is the minimum of the arguments.
+   *
+   * 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.apply(null, arr)                   // '-15.9999'
+   * ```
+   *
+   * @param n A numeric value.
+   */
+  static min(...n: BigNumber.Value[]): 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).
+   *
+   * To be able to set `CRYPTO` to true when using Node.js, the `crypto` object must be available
+   * globally:
+   *
+   * ```ts
+   * global.crypto = require('crypto')
+   * ```
+   *
+   * 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 sum of the arguments.
+   *
+   * The return value is always exact and unrounded.
+   *
+   * ```ts
+   * x = new BigNumber('3257869345.0378653')
+   * BigNumber.sum(4e9, x, '123456789.9')      // '7381326134.9378653'
+   *
+   * arr = [2, new BigNumber(14), '15.9999', 12]
+   * BigNumber.sum.apply(null, arr)            // '43.9999'
+   * ```
+   *
+   * @param n A numeric value.
+   */
+  static sum(...n: BigNumber.Value[]): 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: BigNumber.Config): BigNumber.Config;
+
+  /**
+   * Helps ES6 import.
+   */
+  private static readonly default?: BigNumber.Constructor;
+
+  /**
+   * Helps ES6 import.
+   */
+  private static readonly BigNumber?: BigNumber.Constructor;
+
+  /**
+   * Rounds away from zero.
+   */
+  static readonly ROUND_UP: 0;
+
+  /**
+   * Rounds towards zero.
+   */
+  static readonly ROUND_DOWN: 1;
+
+  /**
+   * Rounds towards Infinity.
+   */
+  static readonly ROUND_CEIL: 2;
+
+  /**
+   * Rounds towards -Infinity.
+   */
+  static readonly ROUND_FLOOR: 3;
+
+  /**
+   * Rounds towards nearest neighbour. If equidistant, rounds away from zero .
+   */
+  static readonly ROUND_HALF_UP: 4;
+
+  /**
+   * Rounds towards nearest neighbour. If equidistant, rounds towards zero.
+   */
+  static readonly ROUND_HALF_DOWN: 5;
+
+  /**
+   * Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour.
+   */
+  static readonly ROUND_HALF_EVEN: 6;
+
+  /**
+   * Rounds towards nearest neighbour. If equidistant, rounds towards Infinity.
+   */
+  static readonly ROUND_HALF_CEIL: 7;
+
+  /**
+   * Rounds towards nearest neighbour. If equidistant, rounds towards -Infinity.
+   */
+  static readonly ROUND_HALF_FLOOR: 8;
+
+  /**
+   * See `MODULO_MODE`.
+   */
+  static readonly EUCLID: 9;
+
+  /**
+   * To aid in debugging, if a `BigNumber.DEBUG` property is `true` then an error will be thrown
+   * on an invalid `BigNumber.Value`.
+   *
+   * ```ts
+   * // No error, and BigNumber NaN is returned.
+   * new BigNumber('blurgh')    // 'NaN'
+   * new BigNumber(9, 2)        // 'NaN'
+   * BigNumber.DEBUG = true
+   * new BigNumber('blurgh')    // '[BigNumber Error] Not a number'
+   * new BigNumber(9, 2)        // '[BigNumber Error] Not a base 2 number'
+   * ```
+   *
+   * An error will also be thrown if a `BigNumber.Value` is of type number with more than 15
+   * significant digits, as calling `toString` or `valueOf` on such numbers may not result
+   * in the intended value.
+   *
+   * ```ts
+   * console.log(823456789123456.3)       //  823456789123456.2
+   * // No error, and the returned BigNumber does not have the same value as the number literal.
+   * new BigNumber(823456789123456.3)     // '823456789123456.2'
+   * BigNumber.DEBUG = true
+   * new BigNumber(823456789123456.3)
+   * // '[BigNumber Error] Number primitive has more than 15 significant digits'
+   * ```
+   *
+   */
+  static DEBUG?: boolean;
+}
diff -pruN 1.3.0+dfsg-1/bignumber.js 8.0.2+ds-1/bignumber.js
--- 1.3.0+dfsg-1/bignumber.js	2013-11-08 16:56:48.000000000 +0000
+++ 8.0.2+ds-1/bignumber.js	2019-01-13 22:17:07.000000000 +0000
@@ -1,816 +1,1529 @@
-/* bignumber.js v1.3.0 https://github.com/MikeMcl/bignumber.js/LICENCE */
-;(function ( global ) {
-    'use strict';
+;(function (globalObject) {
+  'use strict';
 
-    /*
-      bignumber.js v1.3.0
-      A JavaScript library for arbitrary-precision arithmetic.
-      https://github.com/MikeMcl/bignumber.js
-      Copyright (c) 2012 Michael Mclaughlin <M8ch88l@gmail.com>
-      MIT Expat Licence
-    */
-
-    /*********************************** DEFAULTS ************************************/
-
-    /*
-     * The default values below must be integers within the stated ranges (inclusive).
-     * Most of these values can be changed during run-time using BigNumber.config().
-     */
-
-    /*
-     * The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP,
-     * MAX_EXP, and the argument to toFixed, toPrecision and toExponential, beyond
-     * which an exception is thrown (if ERRORS is true).
-     */
-    var MAX = 1E9,                                   // 0 to 1e+9
-
-        // Limit of magnitude of exponent argument to toPower.
-        MAX_POWER = 1E6,                             // 1 to 1e+6
-
-        // The maximum number of decimal places for operations involving division.
-        DECIMAL_PLACES = 20,                         // 0 to MAX
-
-        /*
-         * The rounding mode used when rounding to the above decimal places, and when
-         * using toFixed, toPrecision and toExponential, and round (default value).
-         * UP         0 Away from zero.
-         * DOWN       1 Towards zero.
-         * CEIL       2 Towards +Infinity.
-         * FLOOR      3 Towards -Infinity.
-         * HALF_UP    4 Towards nearest neighbour. If equidistant, up.
-         * HALF_DOWN  5 Towards nearest neighbour. If equidistant, down.
-         * HALF_EVEN  6 Towards nearest neighbour. If equidistant, towards even neighbour.
-         * HALF_CEIL  7 Towards nearest neighbour. If equidistant, towards +Infinity.
-         * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
-         */
-        ROUNDING_MODE = 4,                           // 0 to 8
-
-        // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]
-
-        // The exponent value at and beneath which toString returns exponential notation.
-        // Number type: -7
-        TO_EXP_NEG = -7,                             // 0 to -MAX
-
-        // The exponent value at and above which toString returns exponential notation.
-        // Number type: 21
-        TO_EXP_POS = 21,                             // 0 to MAX
-
-        // RANGE : [MIN_EXP, MAX_EXP]
-
-        // The minimum exponent value, beneath which underflow to zero occurs.
-        // Number type: -324  (5e-324)
-        MIN_EXP = -MAX,                              // -1 to -MAX
+/*
+ *      bignumber.js v8.0.2
+ *      A JavaScript library for arbitrary-precision arithmetic.
+ *      https://github.com/MikeMcl/bignumber.js
+ *      Copyright (c) 2019 Michael Mclaughlin <M8ch88l@gmail.com>
+ *      MIT Licensed.
+ *
+ *      BigNumber.prototype methods     |  BigNumber methods
+ *                                      |
+ *      absoluteValue            abs    |  clone
+ *      comparedTo                      |  config               set
+ *      decimalPlaces            dp     |      DECIMAL_PLACES
+ *      dividedBy                div    |      ROUNDING_MODE
+ *      dividedToIntegerBy       idiv   |      EXPONENTIAL_AT
+ *      exponentiatedBy          pow    |      RANGE
+ *      integerValue                    |      CRYPTO
+ *      isEqualTo                eq     |      MODULO_MODE
+ *      isFinite                        |      POW_PRECISION
+ *      isGreaterThan            gt     |      FORMAT
+ *      isGreaterThanOrEqualTo   gte    |      ALPHABET
+ *      isInteger                       |  isBigNumber
+ *      isLessThan               lt     |  maximum              max
+ *      isLessThanOrEqualTo      lte    |  minimum              min
+ *      isNaN                           |  random
+ *      isNegative                      |  sum
+ *      isPositive                      |
+ *      isZero                          |
+ *      minus                           |
+ *      modulo                   mod    |
+ *      multipliedBy             times  |
+ *      negated                         |
+ *      plus                            |
+ *      precision                sd     |
+ *      shiftedBy                       |
+ *      squareRoot               sqrt   |
+ *      toExponential                   |
+ *      toFixed                         |
+ *      toFormat                        |
+ *      toFraction                      |
+ *      toJSON                          |
+ *      toNumber                        |
+ *      toPrecision                     |
+ *      toString                        |
+ *      valueOf                         |
+ *
+ */
+
+
+  var BigNumber,
+    isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,
+
+    mathceil = Math.ceil,
+    mathfloor = Math.floor,
+
+    bignumberError = '[BigNumber Error] ',
+    tooManyDigits = bignumberError + 'Number primitive has more than 15 significant digits: ',
+
+    BASE = 1e14,
+    LOG_BASE = 14,
+    MAX_SAFE_INTEGER = 0x1fffffffffffff,         // 2^53 - 1
+    // MAX_INT32 = 0x7fffffff,                   // 2^31 - 1
+    POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13],
+    SQRT_BASE = 1e7,
+
+    // EDITABLE
+    // The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and
+    // the arguments to toExponential, toFixed, toFormat, and toPrecision.
+    MAX = 1E9;                                   // 0 to MAX_INT32
+
+
+  /*
+   * Create and return a BigNumber constructor.
+   */
+  function clone(configObject) {
+    var div, convertBase, parseNumeric,
+      P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },
+      ONE = new BigNumber(1),
+
+
+      //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------
+
+
+      // The default values below must be integers within the inclusive ranges stated.
+      // The values can also be changed at run-time using BigNumber.set.
+
+      // The maximum number of decimal places for operations involving division.
+      DECIMAL_PLACES = 20,                     // 0 to MAX
+
+      // The rounding mode used when rounding to the above decimal places, and when using
+      // toExponential, toFixed, toFormat and toPrecision, and round (default value).
+      // UP         0 Away from zero.
+      // DOWN       1 Towards zero.
+      // CEIL       2 Towards +Infinity.
+      // FLOOR      3 Towards -Infinity.
+      // HALF_UP    4 Towards nearest neighbour. If equidistant, up.
+      // HALF_DOWN  5 Towards nearest neighbour. If equidistant, down.
+      // HALF_EVEN  6 Towards nearest neighbour. If equidistant, towards even neighbour.
+      // HALF_CEIL  7 Towards nearest neighbour. If equidistant, towards +Infinity.
+      // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
+      ROUNDING_MODE = 4,                       // 0 to 8
+
+      // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]
+
+      // The exponent value at and beneath which toString returns exponential notation.
+      // Number type: -7
+      TO_EXP_NEG = -7,                         // 0 to -MAX
+
+      // The exponent value at and above which toString returns exponential notation.
+      // Number type: 21
+      TO_EXP_POS = 21,                         // 0 to MAX
+
+      // RANGE : [MIN_EXP, MAX_EXP]
+
+      // The minimum exponent value, beneath which underflow to zero occurs.
+      // Number type: -324  (5e-324)
+      MIN_EXP = -1e7,                          // -1 to -MAX
+
+      // The maximum exponent value, above which overflow to Infinity occurs.
+      // Number type:  308  (1.7976931348623157e+308)
+      // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.
+      MAX_EXP = 1e7,                           // 1 to MAX
+
+      // Whether to use cryptographically-secure random number generation, if available.
+      CRYPTO = false,                          // true or false
+
+      // The modulo mode used when calculating the modulus: a mod n.
+      // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
+      // The remainder (r) is calculated as: r = a - n * q.
+      //
+      // UP        0 The remainder is positive if the dividend is negative, else is negative.
+      // DOWN      1 The remainder has the same sign as the dividend.
+      //             This modulo mode is commonly known as 'truncated division' and is
+      //             equivalent to (a % n) in JavaScript.
+      // FLOOR     3 The remainder has the same sign as the divisor (Python %).
+      // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.
+      // EUCLID    9 Euclidian division. q = sign(n) * floor(a / abs(n)).
+      //             The remainder is always positive.
+      //
+      // The truncated division, floored division, Euclidian division and IEEE 754 remainder
+      // modes are commonly used for the modulus operation.
+      // Although the other rounding modes can also be used, they may not give useful results.
+      MODULO_MODE = 1,                         // 0 to 9
+
+      // The maximum number of significant digits of the result of the exponentiatedBy operation.
+      // If POW_PRECISION is 0, there will be unlimited significant digits.
+      POW_PRECISION = 0,                    // 0 to MAX
+
+      // The format specification used by the BigNumber.prototype.toFormat method.
+      FORMAT = {
+        prefix: '',
+        groupSize: 3,
+        secondaryGroupSize: 0,
+        groupSeparator: ',',
+        decimalSeparator: '.',
+        fractionGroupSize: 0,
+        fractionGroupSeparator: '\xA0',      // non-breaking space
+        suffix: ''
+      },
+
+      // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',
+      // '-', '.', whitespace, or repeated character.
+      // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'
+      ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';
 
-        // The maximum exponent value, above which overflow to Infinity occurs.
-        // Number type:  308  (1.7976931348623157e+308)
-        MAX_EXP = MAX,                               // 1 to MAX
 
-        // Whether BigNumber Errors are ever thrown.
-        // CHANGE parseInt to parseFloat if changing ERRORS to false.
-        ERRORS = true,                               // true or false
-        parse = parseInt,                            // parseInt or parseFloat
-
-    /***********************************************************************************/
-
-        P = BigNumber.prototype,
-        DIGITS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_',
-        outOfRange,
-        id = 0,
-        isValid = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
-        trim = String.prototype.trim || function () {return this.replace(/^\s+|\s+$/g, '')},
-        ONE = BigNumber(1);
+    //------------------------------------------------------------------------------------------
 
 
     // CONSTRUCTOR
 
 
     /*
-     * The exported function.
+     * The BigNumber constructor and exported function.
      * Create and return a new instance of a BigNumber object.
      *
      * n {number|string|BigNumber} A numeric value.
-     * [b] {number} The base of n. Integer, 2 to 64 inclusive.
+     * [b] {number} The base of n. Integer, 2 to ALPHABET.length inclusive.
      */
-    function BigNumber( n, b ) {
-        var e, i, isNum, digits, valid, orig,
-            x = this;
-
-        // Enable constructor usage without new.
-        if ( !(x instanceof BigNumber) ) {
-            return new BigNumber( n, b )
-        }
+    function BigNumber(n, b) {
+      var alphabet, c, caseChanged, e, i, isNum, len, str,
+        x = this;
+
+      // Enable constructor usage without new.
+      if (!(x instanceof BigNumber)) {
+
+        // Don't throw on constructor call without new (#81).
+        // '[BigNumber Error] Constructor call without new: {n}'
+        //throw Error(bignumberError + ' Constructor call without new: ' + n);
+        return new BigNumber(n, b);
+      }
 
-        // Duplicate.
-        if ( n instanceof BigNumber ) {
-            id = 0;
+      if (b == null) {
 
-            // e is undefined.
-            if ( b !== e ) {
-                n += ''
-            } else {
-                x['s'] = n['s'];
-                x['e'] = n['e'];
-                x['c'] = ( n = n['c'] ) ? n.slice() : n;
-                return
-            }
+        // Duplicate.
+        if (n instanceof BigNumber) {
+          x.s = n.s;
+          x.e = n.e;
+          x.c = (n = n.c) ? n.slice() : n;
+          return;
         }
 
-        // If number, check if minus zero.
-        if ( typeof n != 'string' ) {
-            n = ( isNum = typeof n == 'number' ||
-                Object.prototype.toString.call(n) == '[object Number]' ) &&
-                    n === 0 && 1 / n < 0 ? '-0' : n + ''
-        }
+        isNum = typeof n == 'number';
 
-        orig = n;
+        if (isNum && n * 0 == 0) {
 
-        if ( b === e && isValid.test(n) ) {
+          // Use `1 / n` to handle minus zero also.
+          x.s = 1 / n < 0 ? (n = -n, -1) : 1;
 
-            // Determine sign.
-            x['s'] = n.charAt(0) == '-' ? ( n = n.slice(1), -1 ) : 1
+          // Faster path for integers.
+          if (n === ~~n) {
+            for (e = 0, i = n; i >= 10; i /= 10, e++);
+            x.e = e;
+            x.c = [n];
+            return;
+          }
 
-        // Either n is not a valid BigNumber or a base has been specified.
+          str = String(n);
         } else {
+          str = String(n);
+          if (!isNumeric.test(str)) return parseNumeric(x, str, isNum);
+          x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;
+        }
 
-            // Enable exponential notation to be used with base 10 argument.
-            // Ensure return value is rounded to DECIMAL_PLACES as with other bases.
-            if ( b == 10 ) {
+        // Decimal point?
+        if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
 
-                return setMode( n, DECIMAL_PLACES, ROUNDING_MODE )
-            }
+        // Exponential form?
+        if ((i = str.search(/e/i)) > 0) {
 
-            n = trim.call(n).replace( /^\+(?!-)/, '' );
+          // Determine exponent.
+          if (e < 0) e = i;
+          e += +str.slice(i + 1);
+          str = str.substring(0, i);
+        } else if (e < 0) {
 
-            x['s'] = n.charAt(0) == '-' ? ( n = n.replace( /^-(?!-)/, '' ), -1 ) : 1;
+          // Integer.
+          e = str.length;
+        }
 
-            if ( b != null ) {
+      } else {
 
-                if ( ( b == (b | 0) || !ERRORS ) &&
-                  !( outOfRange = !( b >= 2 && b < 65 ) ) ) {
+        // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'
+        intCheck(b, 2, ALPHABET.length, 'Base');
+        str = String(n);
 
-                    digits = '[' + DIGITS.slice( 0, b = b | 0 ) + ']+';
+        // Allow exponential notation to be used with base 10 argument, while
+        // also rounding to DECIMAL_PLACES as with other bases.
+        if (b == 10) {
+          x = new BigNumber(n instanceof BigNumber ? n : str);
+          return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);
+        }
 
-                    // Before non-decimal number validity test and base conversion
-                    // remove the `.` from e.g. '1.', and replace e.g. '.1' with '0.1'.
-                    n = n.replace( /\.$/, '' ).replace( /^\./, '0.' );
+        isNum = typeof n == 'number';
 
-                    // Any number in exponential form will fail due to the e+/-.
-                    if ( valid = new RegExp(
-                      '^' + digits + '(?:\\.' + digits + ')?$', b < 37 ? 'i' : '' ).test(n) ) {
+        if (isNum) {
 
-                        if ( isNum ) {
+          // Avoid potential interpretation of Infinity and NaN as base 44+ values.
+          if (n * 0 != 0) return parseNumeric(x, str, isNum, b);
 
-                            if ( n.replace( /^0\.0*|\./, '' ).length > 15 ) {
+          x.s = 1 / n < 0 ? (str = str.slice(1), -1) : 1;
 
-                                // 'new BigNumber() number type has more than 15 significant digits: {n}'
-                                ifExceptionsThrow( orig, 0 )
-                            }
+          // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'
+          if (BigNumber.DEBUG && str.replace(/^0\.0*|\./, '').length > 15) {
+            throw Error
+             (tooManyDigits + n);
+          }
 
-                            // Prevent later check for length on converted number.
-                            isNum = !isNum
-                        }
-                        n = convert( n, 10, b, x['s'] )
+          // Prevent later check for length on converted number.
+          isNum = false;
+        } else {
+          x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
+        }
 
-                    } else if ( n != 'Infinity' && n != 'NaN' ) {
+        alphabet = ALPHABET.slice(0, b);
+        e = i = 0;
 
-                        // 'new BigNumber() not a base {b} number: {n}'
-                        ifExceptionsThrow( orig, 1, b );
-                        n = 'NaN'
-                    }
-                } else {
+        // Check that str is a valid base b number.
+        // Don't use RegExp so alphabet can contain special characters.
+        for (len = str.length; i < len; i++) {
+          if (alphabet.indexOf(c = str.charAt(i)) < 0) {
+            if (c == '.') {
 
-                    // 'new BigNumber() base not an integer: {b}'
-                    // 'new BigNumber() base out of range: {b}'
-                    ifExceptionsThrow( b, 2 );
+              // If '.' is not the first character and it has not be found before.
+              if (i > e) {
+                e = len;
+                continue;
+              }
+            } else if (!caseChanged) {
 
-                    // Ignore base.
-                    valid = isValid.test(n)
-                }
-            } else {
-                valid = isValid.test(n)
+              // Allow e.g. hexadecimal 'FF' as well as 'ff'.
+              if (str == str.toUpperCase() && (str = str.toLowerCase()) ||
+                  str == str.toLowerCase() && (str = str.toUpperCase())) {
+                caseChanged = true;
+                i = -1;
+                e = 0;
+                continue;
+              }
             }
 
-            if ( !valid ) {
-
-                // Infinity/NaN
-                x['c'] = x['e'] = null;
-
-                // NaN
-                if ( n != 'Infinity' ) {
-
-                    // No exception on NaN.
-                    if ( n != 'NaN' ) {
-
-                        // 'new BigNumber() not a number: {n}'
-                        ifExceptionsThrow( orig, 3 )
-                    }
-                    x['s'] = null
-                }
-                id = 0;
-
-                return
-            }
+            return parseNumeric(x, String(n), isNum, b);
+          }
         }
 
+        str = convertBase(str, b, 10, x.s);
+
         // Decimal point?
-        if ( ( e = n.indexOf('.') ) > -1 ) {
-            n = n.replace( '.', '' )
-        }
+        if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
+        else e = str.length;
+      }
 
-        // Exponential form?
-        if ( ( i = n.search( /e/i ) ) > 0 ) {
+      // Determine leading zeros.
+      for (i = 0; str.charCodeAt(i) === 48; i++);
 
-            // Determine exponent.
-            if ( e < 0 ) {
-                e = i
-            }
-            e += +n.slice( i + 1 );
-            n = n.substring( 0, i )
+      // Determine trailing zeros.
+      for (len = str.length; str.charCodeAt(--len) === 48;);
 
-        } else if ( e < 0 ) {
+      str = str.slice(i, ++len);
 
-            // Integer.
-            e = n.length
-        }
+      if (str) {
+        len -= i;
 
-        // Determine leading zeros.
-        for ( i = 0; n.charAt(i) == '0'; i++ ) {
+        // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'
+        if (isNum && BigNumber.DEBUG &&
+          len > 15 && (n > MAX_SAFE_INTEGER || n !== mathfloor(n))) {
+            throw Error
+             (tooManyDigits + (x.s * n));
         }
 
-        b = n.length;
+        e = e - i - 1;
 
-        // Disallow numbers with over 15 significant digits if number type.
-        if ( isNum && b > 15 && n.slice(i).length > 15 ) {
+         // Overflow?
+        if (e > MAX_EXP) {
 
-            // 'new BigNumber() number type has more than 15 significant digits: {n}'
-            ifExceptionsThrow( orig, 0 )
-        }
-        id = 0;
+          // Infinity.
+          x.c = x.e = null;
+
+        // Underflow?
+        } else if (e < MIN_EXP) {
 
-        // Overflow?
-        if ( ( e -= i + 1 ) > MAX_EXP ) {
+          // Zero.
+          x.c = [x.e = 0];
+        } else {
+          x.e = e;
+          x.c = [];
 
-            // Infinity.
-            x['c'] = x['e'] = null
+          // Transform base
 
-        // Zero or underflow?
-        } else if ( i == b || e < MIN_EXP ) {
+          // e is the base 10 exponent.
+          // i is where to slice str to get the first element of the coefficient array.
+          i = (e + 1) % LOG_BASE;
+          if (e < 0) i += LOG_BASE;
 
-            // Zero.
-            x['c'] = [ x['e'] = 0 ]
-        } else {
+          if (i < len) {
+            if (i) x.c.push(+str.slice(0, i));
 
-            // Determine trailing zeros.
-            for ( ; n.charAt(--b) == '0'; ) {
+            for (len -= LOG_BASE; i < len;) {
+              x.c.push(+str.slice(i, i += LOG_BASE));
             }
 
-            x['e'] = e;
-            x['c'] = [];
+            str = str.slice(i);
+            i = LOG_BASE - str.length;
+          } else {
+            i -= len;
+          }
 
-            // Convert string to array of digits (without leading and trailing zeros).
-            for ( e = 0; i <= b; x['c'][e++] = +n.charAt(i++) ) {
-            }
+          for (; i--; str += '0');
+          x.c.push(+str);
         }
+      } else {
+
+        // Zero.
+        x.c = [x.e = 0];
+      }
     }
 
 
-    // CONSTRUCTOR PROPERTIES/METHODS
+    // CONSTRUCTOR PROPERTIES
 
 
-    BigNumber['ROUND_UP'] = 0;
-    BigNumber['ROUND_DOWN'] = 1;
-    BigNumber['ROUND_CEIL'] = 2;
-    BigNumber['ROUND_FLOOR'] = 3;
-    BigNumber['ROUND_HALF_UP'] = 4;
-    BigNumber['ROUND_HALF_DOWN'] = 5;
-    BigNumber['ROUND_HALF_EVEN'] = 6;
-    BigNumber['ROUND_HALF_CEIL'] = 7;
-    BigNumber['ROUND_HALF_FLOOR'] = 8;
+    BigNumber.clone = clone;
+
+    BigNumber.ROUND_UP = 0;
+    BigNumber.ROUND_DOWN = 1;
+    BigNumber.ROUND_CEIL = 2;
+    BigNumber.ROUND_FLOOR = 3;
+    BigNumber.ROUND_HALF_UP = 4;
+    BigNumber.ROUND_HALF_DOWN = 5;
+    BigNumber.ROUND_HALF_EVEN = 6;
+    BigNumber.ROUND_HALF_CEIL = 7;
+    BigNumber.ROUND_HALF_FLOOR = 8;
+    BigNumber.EUCLID = 9;
 
 
     /*
      * Configure infrequently-changing library-wide settings.
      *
-     * Accept an object or an argument list, with one or many of the following
-     * properties or parameters respectively:
-     * [ DECIMAL_PLACES [, ROUNDING_MODE [, EXPONENTIAL_AT [, RANGE [, ERRORS ]]]]]
+     * Accept an object with the following optional properties (if the value of a property is
+     * a number, it must be an integer within the inclusive range stated):
+     *
+     *   DECIMAL_PLACES   {number}           0 to MAX
+     *   ROUNDING_MODE    {number}           0 to 8
+     *   EXPONENTIAL_AT   {number|number[]}  -MAX to MAX  or  [-MAX to 0, 0 to MAX]
+     *   RANGE            {number|number[]}  -MAX to MAX (not zero)  or  [-MAX to -1, 1 to MAX]
+     *   CRYPTO           {boolean}          true or false
+     *   MODULO_MODE      {number}           0 to 9
+     *   POW_PRECISION       {number}           0 to MAX
+     *   ALPHABET         {string}           A string of two or more unique characters which does
+     *                                       not contain '.'.
+     *   FORMAT           {object}           An object with some of the following properties:
+     *     prefix                 {string}
+     *     groupSize              {number}
+     *     secondaryGroupSize     {number}
+     *     groupSeparator         {string}
+     *     decimalSeparator       {string}
+     *     fractionGroupSize      {number}
+     *     fractionGroupSeparator {string}
+     *     suffix                 {string}
+     *
+     * (The values assigned to the above FORMAT object properties are not checked for validity.)
      *
      * E.g.
-     * BigNumber.config(20, 4) is equivalent to
      * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })
-     * Ignore properties/parameters set to null or undefined.
+     *
+     * Ignore properties/parameters set to null or undefined, except for ALPHABET.
      *
      * Return an object with the properties current values.
      */
-    BigNumber['config'] = function () {
-        var v, p,
-            i = 0,
-            r = {},
-            a = arguments,
-            o = a[0],
-            c = 'config',
-            inRange = function ( n, lo, hi ) {
-              return !( ( outOfRange = n < lo || n > hi ) ||
-                parse(n) != n && n !== 0 )
-            },
-            has = o && typeof o == 'object'
-              ? function () {if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null}
-              : function () {if ( a.length > i ) return ( v = a[i++] ) != null};
+    BigNumber.config = BigNumber.set = function (obj) {
+      var p, v;
 
-        // [DECIMAL_PLACES] {number} Integer, 0 to MAX inclusive.
-        if ( has( p = 'DECIMAL_PLACES' ) ) {
+      if (obj != null) {
 
-            if ( inRange( v, 0, MAX ) ) {
-                DECIMAL_PLACES = v | 0
-            } else {
+        if (typeof obj == 'object') {
 
-                // 'config() DECIMAL_PLACES not an integer: {v}'
-                // 'config() DECIMAL_PLACES out of range: {v}'
-                ifExceptionsThrow( v, p, c )
+          // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.
+          // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'
+          if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {
+            v = obj[p];
+            intCheck(v, 0, MAX, p);
+            DECIMAL_PLACES = v;
+          }
+
+          // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.
+          // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'
+          if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {
+            v = obj[p];
+            intCheck(v, 0, 8, p);
+            ROUNDING_MODE = v;
+          }
+
+          // EXPONENTIAL_AT {number|number[]}
+          // Integer, -MAX to MAX inclusive or
+          // [integer -MAX to 0 inclusive, 0 to MAX inclusive].
+          // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'
+          if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {
+            v = obj[p];
+            if (v && v.pop) {
+              intCheck(v[0], -MAX, 0, p);
+              intCheck(v[1], 0, MAX, p);
+              TO_EXP_NEG = v[0];
+              TO_EXP_POS = v[1];
+            } else {
+              intCheck(v, -MAX, MAX, p);
+              TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);
             }
-        }
-        r[p] = DECIMAL_PLACES;
+          }
 
-        // [ROUNDING_MODE] {number} Integer, 0 to 8 inclusive.
-        if ( has( p = 'ROUNDING_MODE' ) ) {
-
-            if ( inRange( v, 0, 8 ) ) {
-                ROUNDING_MODE = v | 0
+          // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or
+          // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].
+          // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'
+          if (obj.hasOwnProperty(p = 'RANGE')) {
+            v = obj[p];
+            if (v && v.pop) {
+              intCheck(v[0], -MAX, -1, p);
+              intCheck(v[1], 1, MAX, p);
+              MIN_EXP = v[0];
+              MAX_EXP = v[1];
             } else {
-
-                // 'config() ROUNDING_MODE not an integer: {v}'
-                // 'config() ROUNDING_MODE out of range: {v}'
-                ifExceptionsThrow( v, p, c )
+              intCheck(v, -MAX, MAX, p);
+              if (v) {
+                MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);
+              } else {
+                throw Error
+                 (bignumberError + p + ' cannot be zero: ' + v);
+              }
+            }
+          }
+
+          // CRYPTO {boolean} true or false.
+          // '[BigNumber Error] CRYPTO not true or false: {v}'
+          // '[BigNumber Error] crypto unavailable'
+          if (obj.hasOwnProperty(p = 'CRYPTO')) {
+            v = obj[p];
+            if (v === !!v) {
+              if (v) {
+                if (typeof crypto != 'undefined' && crypto &&
+                 (crypto.getRandomValues || crypto.randomBytes)) {
+                  CRYPTO = v;
+                } else {
+                  CRYPTO = !v;
+                  throw Error
+                   (bignumberError + 'crypto unavailable');
+                }
+              } else {
+                CRYPTO = v;
+              }
+            } else {
+              throw Error
+               (bignumberError + p + ' not true or false: ' + v);
             }
-        }
-        r[p] = ROUNDING_MODE;
+          }
 
-        /*
-         * [EXPONENTIAL_AT] {number|number[]} Integer, -MAX to MAX inclusive or
-         * [ integer -MAX to 0 inclusive, 0 to MAX inclusive ].
-         */
-        if ( has( p = 'EXPONENTIAL_AT' ) ) {
-
-            if ( inRange( v, -MAX, MAX ) ) {
-                TO_EXP_NEG = -( TO_EXP_POS = ~~( v < 0 ? -v : +v ) )
-            } else if ( !outOfRange && v && inRange( v[0], -MAX, 0 ) &&
-              inRange( v[1], 0, MAX ) ) {
-                TO_EXP_NEG = ~~v[0], TO_EXP_POS = ~~v[1]
+          // MODULO_MODE {number} Integer, 0 to 9 inclusive.
+          // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'
+          if (obj.hasOwnProperty(p = 'MODULO_MODE')) {
+            v = obj[p];
+            intCheck(v, 0, 9, p);
+            MODULO_MODE = v;
+          }
+
+          // POW_PRECISION {number} Integer, 0 to MAX inclusive.
+          // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'
+          if (obj.hasOwnProperty(p = 'POW_PRECISION')) {
+            v = obj[p];
+            intCheck(v, 0, MAX, p);
+            POW_PRECISION = v;
+          }
+
+          // FORMAT {object}
+          // '[BigNumber Error] FORMAT not an object: {v}'
+          if (obj.hasOwnProperty(p = 'FORMAT')) {
+            v = obj[p];
+            if (typeof v == 'object') FORMAT = v;
+            else throw Error
+             (bignumberError + p + ' not an object: ' + v);
+          }
+
+          // ALPHABET {string}
+          // '[BigNumber Error] ALPHABET invalid: {v}'
+          if (obj.hasOwnProperty(p = 'ALPHABET')) {
+            v = obj[p];
+
+            // Disallow if only one character,
+            // or if it contains '+', '-', '.', whitespace, or a repeated character.
+            if (typeof v == 'string' && !/^.$|[+-.\s]|(.).*\1/.test(v)) {
+              ALPHABET = v;
             } else {
-
-                // 'config() EXPONENTIAL_AT not an integer or not [integer, integer]: {v}'
-                // 'config() EXPONENTIAL_AT out of range or not [negative, positive: {v}'
-                ifExceptionsThrow( v, p, c, 1 )
+              throw Error
+               (bignumberError + p + ' invalid: ' + v);
             }
-        }
-        r[p] = [ TO_EXP_NEG, TO_EXP_POS ];
+          }
 
-        /*
-         * [RANGE][ {number|number[]} Non-zero integer, -MAX to MAX inclusive or
-         * [ integer -MAX to -1 inclusive, integer 1 to MAX inclusive ].
-         */
-        if ( has( p = 'RANGE' ) ) {
-
-            if ( inRange( v, -MAX, MAX ) && ~~v ) {
-                MIN_EXP = -( MAX_EXP = ~~( v < 0 ? -v : +v ) )
-            } else if ( !outOfRange && v && inRange( v[0], -MAX, -1 ) &&
-              inRange( v[1], 1, MAX ) ) {
-                MIN_EXP = ~~v[0], MAX_EXP = ~~v[1]
-            } else {
+        } else {
 
-                // 'config() RANGE not a non-zero integer or not [integer, integer]: {v}'
-                // 'config() RANGE out of range or not [negative, positive: {v}'
-                ifExceptionsThrow( v, p, c, 1, 1 )
-            }
+          // '[BigNumber Error] Object expected: {v}'
+          throw Error
+           (bignumberError + 'Object expected: ' + obj);
         }
-        r[p] = [ MIN_EXP, MAX_EXP ];
+      }
 
-        // [ERRORS] {boolean|number} true, false, 1 or 0.
-        if ( has( p = 'ERRORS' ) ) {
+      return {
+        DECIMAL_PLACES: DECIMAL_PLACES,
+        ROUNDING_MODE: ROUNDING_MODE,
+        EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],
+        RANGE: [MIN_EXP, MAX_EXP],
+        CRYPTO: CRYPTO,
+        MODULO_MODE: MODULO_MODE,
+        POW_PRECISION: POW_PRECISION,
+        FORMAT: FORMAT,
+        ALPHABET: ALPHABET
+      };
+    };
 
-            if ( v === !!v || v === 1 || v === 0 ) {
-                parse = ( outOfRange = id = 0, ERRORS = !!v )
-                  ? parseInt
-                  : parseFloat
-            } else {
 
-                // 'config() ERRORS not a boolean or binary digit: {v}'
-                ifExceptionsThrow( v, p, c, 0, 0, 1 )
-            }
-        }
-        r[p] = ERRORS;
+    /*
+     * Return true if v is a BigNumber instance, otherwise return false.
+     *
+     * v {any}
+     */
+    BigNumber.isBigNumber = function (v) {
+      return v instanceof BigNumber || v && v._isBigNumber === true || false;
+    };
+
 
-        return r
+    /*
+     * Return a new BigNumber whose value is the maximum of the arguments.
+     *
+     * arguments {number|string|BigNumber}
+     */
+    BigNumber.maximum = BigNumber.max = function () {
+      return maxOrMin(arguments, P.lt);
     };
 
 
-    // PRIVATE FUNCTIONS
+    /*
+     * Return a new BigNumber whose value is the minimum of the arguments.
+     *
+     * arguments {number|string|BigNumber}
+     */
+    BigNumber.minimum = BigNumber.min = function () {
+      return maxOrMin(arguments, P.gt);
+    };
+
+
+    /*
+     * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,
+     * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing
+     * zeros are produced).
+     *
+     * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.
+     *
+     * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'
+     * '[BigNumber Error] crypto unavailable'
+     */
+    BigNumber.random = (function () {
+      var pow2_53 = 0x20000000000000;
 
+      // Return a 53 bit integer n, where 0 <= n < 9007199254740992.
+      // Check if Math.random() produces more than 32 bits of randomness.
+      // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.
+      // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.
+      var random53bitInt = (Math.random() * pow2_53) & 0x1fffff
+       ? function () { return mathfloor(Math.random() * pow2_53); }
+       : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +
+         (Math.random() * 0x800000 | 0); };
+
+      return function (dp) {
+        var a, b, e, k, v,
+          i = 0,
+          c = [],
+          rand = new BigNumber(ONE);
+
+        if (dp == null) dp = DECIMAL_PLACES;
+        else intCheck(dp, 0, MAX);
+
+        k = mathceil(dp / LOG_BASE);
+
+        if (CRYPTO) {
+
+          // Browsers supporting crypto.getRandomValues.
+          if (crypto.getRandomValues) {
+
+            a = crypto.getRandomValues(new Uint32Array(k *= 2));
+
+            for (; i < k;) {
+
+              // 53 bits:
+              // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)
+              // 11111 11111111 11111111 11111111 11100000 00000000 00000000
+              // ((Math.pow(2, 32) - 1) >>> 11).toString(2)
+              //                                     11111 11111111 11111111
+              // 0x20000 is 2^21.
+              v = a[i] * 0x20000 + (a[i + 1] >>> 11);
+
+              // Rejection sampling:
+              // 0 <= v < 9007199254740992
+              // Probability that v >= 9e15, is
+              // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251
+              if (v >= 9e15) {
+                b = crypto.getRandomValues(new Uint32Array(2));
+                a[i] = b[0];
+                a[i + 1] = b[1];
+              } else {
+
+                // 0 <= v <= 8999999999999999
+                // 0 <= (v % 1e14) <= 99999999999999
+                c.push(v % 1e14);
+                i += 2;
+              }
+            }
+            i = k / 2;
+
+          // Node.js supporting crypto.randomBytes.
+          } else if (crypto.randomBytes) {
+
+            // buffer
+            a = crypto.randomBytes(k *= 7);
+
+            for (; i < k;) {
+
+              // 0x1000000000000 is 2^48, 0x10000000000 is 2^40
+              // 0x100000000 is 2^32, 0x1000000 is 2^24
+              // 11111 11111111 11111111 11111111 11111111 11111111 11111111
+              // 0 <= v < 9007199254740992
+              v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +
+                 (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +
+                 (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];
+
+              if (v >= 9e15) {
+                crypto.randomBytes(7).copy(a, i);
+              } else {
+
+                // 0 <= (v % 1e14) <= 99999999999999
+                c.push(v % 1e14);
+                i += 7;
+              }
+            }
+            i = k / 7;
+          } else {
+            CRYPTO = false;
+            throw Error
+             (bignumberError + 'crypto unavailable');
+          }
+        }
+
+        // Use Math.random.
+        if (!CRYPTO) {
+
+          for (; i < k;) {
+            v = random53bitInt();
+            if (v < 9e15) c[i++] = v % 1e14;
+          }
+        }
+
+        k = c[--i];
+        dp %= LOG_BASE;
+
+        // Convert trailing digits to zeros according to dp.
+        if (k && dp) {
+          v = POWS_TEN[LOG_BASE - dp];
+          c[i] = mathfloor(k / v) * v;
+        }
+
+        // Remove trailing elements which are zero.
+        for (; c[i] === 0; c.pop(), i--);
+
+        // Zero?
+        if (i < 0) {
+          c = [e = 0];
+        } else {
 
-    // Assemble error messages. Throw BigNumber Errors.
-    function ifExceptionsThrow( arg, i, j, isArray, isRange, isErrors) {
+          // Remove leading elements which are zero and adjust exponent accordingly.
+          for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);
 
-        if ( ERRORS ) {
-            var error,
-                method = ['new BigNumber', 'cmp', 'div', 'eq', 'gt', 'gte', 'lt',
-                     'lte', 'minus', 'mod', 'plus', 'times', 'toFr'
-                    ][ id ? id < 0 ? -id : id : 1 / id < 0 ? 1 : 0 ] + '()',
-                message = outOfRange ? ' out of range' : ' not a' +
-                  ( isRange ? ' non-zero' : 'n' ) + ' integer';
-
-            message = ( [
-                method + ' number type has more than 15 significant digits',
-                method + ' not a base ' + j + ' number',
-                method + ' base' + message,
-                method + ' not a number' ][i] ||
-                  j + '() ' + i + ( isErrors
-                    ? ' not a boolean or binary digit'
-                    : message + ( isArray
-                      ? ' or not [' + ( outOfRange
-                        ? ' negative, positive'
-                        : ' integer, integer' ) + ' ]'
-                      : '' ) ) ) + ': ' + arg;
-
-            outOfRange = id = 0;
-            error = new Error(message);
-            error['name'] = 'BigNumber Error';
+          // Count the digits of the first element of c to determine leading zeros, and...
+          for (i = 1, v = c[0]; v >= 10; v /= 10, i++);
 
-            throw error
+          // adjust the exponent accordingly.
+          if (i < LOG_BASE) e -= LOG_BASE - i;
         }
-    }
+
+        rand.e = e;
+        rand.c = c;
+        return rand;
+      };
+    })();
 
 
     /*
-     * Convert a numeric string of baseIn to a numeric string of baseOut.
+     * Return a BigNumber whose value is the sum of the arguments.
+     *
+     * arguments {number|string|BigNumber}
      */
-    function convert( nStr, baseOut, baseIn, sign ) {
-        var e, dvs, dvd, nArr, fracArr, fracBN;
+    BigNumber.sum = function () {
+      var i = 1,
+        args = arguments,
+        sum = new BigNumber(args[0]);
+      for (; i < args.length;) sum = sum.plus(args[i++]);
+      return sum;
+    };
 
-        // Convert string of base bIn to an array of numbers of baseOut.
-        // Eg. strToArr('255', 10) where baseOut is 16, returns [15, 15].
-        // Eg. strToArr('ff', 16)  where baseOut is 10, returns [2, 5, 5].
-        function strToArr( str, bIn ) {
-            var j,
-                i = 0,
-                strL = str.length,
-                arrL,
-                arr = [0];
 
-            for ( bIn = bIn || baseIn; i < strL; i++ ) {
+    // PRIVATE FUNCTIONS
 
-                for ( arrL = arr.length, j = 0; j < arrL; arr[j] *= bIn, j++ ) {
-                }
 
-                for ( arr[0] += DIGITS.indexOf( str.charAt(i) ), j = 0;
-                      j < arr.length;
-                      j++ ) {
-
-                    if ( arr[j] > baseOut - 1 ) {
-
-                        if ( arr[j + 1] == null ) {
-                            arr[j + 1] = 0
-                        }
-                        arr[j + 1] += arr[j] / baseOut ^ 0;
-                        arr[j] %= baseOut
-                    }
-                }
-            }
+    // Called by BigNumber and BigNumber.prototype.toString.
+    convertBase = (function () {
+      var decimal = '0123456789';
+
+      /*
+       * Convert string of baseIn to an array of numbers of baseOut.
+       * Eg. toBaseOut('255', 10, 16) returns [15, 15].
+       * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].
+       */
+      function toBaseOut(str, baseIn, baseOut, alphabet) {
+        var j,
+          arr = [0],
+          arrL,
+          i = 0,
+          len = str.length;
+
+        for (; i < len;) {
+          for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);
+
+          arr[0] += alphabet.indexOf(str.charAt(i++));
+
+          for (j = 0; j < arr.length; j++) {
+
+            if (arr[j] > baseOut - 1) {
+              if (arr[j + 1] == null) arr[j + 1] = 0;
+              arr[j + 1] += arr[j] / baseOut | 0;
+              arr[j] %= baseOut;
+            }
+          }
+        }
+
+        return arr.reverse();
+      }
+
+      // Convert a numeric string of baseIn to a numeric string of baseOut.
+      // If the caller is toString, we are converting from base 10 to baseOut.
+      // If the caller is BigNumber, we are converting from baseIn to base 10.
+      return function (str, baseIn, baseOut, sign, callerIsToString) {
+        var alphabet, d, e, k, r, x, xc, y,
+          i = str.indexOf('.'),
+          dp = DECIMAL_PLACES,
+          rm = ROUNDING_MODE;
+
+        // Non-integer.
+        if (i >= 0) {
+          k = POW_PRECISION;
+
+          // Unlimited precision.
+          POW_PRECISION = 0;
+          str = str.replace('.', '');
+          y = new BigNumber(baseIn);
+          x = y.pow(str.length - i);
+          POW_PRECISION = k;
+
+          // Convert str as if an integer, then restore the fraction part by dividing the
+          // result by its base raised to a power.
+
+          y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),
+           10, baseOut, decimal);
+          y.e = y.c.length;
+        }
+
+        // Convert the number as integer.
+
+        xc = toBaseOut(str, baseIn, baseOut, callerIsToString
+         ? (alphabet = ALPHABET, decimal)
+         : (alphabet = decimal, ALPHABET));
+
+        // xc now represents str as an integer and converted to baseOut. e is the exponent.
+        e = k = xc.length;
+
+        // Remove trailing zeros.
+        for (; xc[--k] == 0; xc.pop());
+
+        // Zero?
+        if (!xc[0]) return alphabet.charAt(0);
 
-            return arr.reverse()
+        // Does str represent an integer? If so, no need for the division.
+        if (i < 0) {
+          --e;
+        } else {
+          x.c = xc;
+          x.e = e;
+
+          // The sign is needed for correct rounding.
+          x.s = sign;
+          x = div(x, y, dp, rm, baseOut);
+          xc = x.c;
+          r = x.r;
+          e = x.e;
         }
 
-        // Convert array to string.
-        // E.g. arrToStr( [9, 10, 11] ) becomes '9ab' (in bases above 11).
-        function arrToStr( arr ) {
-            var i = 0,
-                arrL = arr.length,
-                str = '';
+        // xc now represents str converted to baseOut.
+
+        // THe index of the rounding digit.
+        d = e + dp + 1;
+
+        // The rounding digit: the digit to the right of the digit that may be rounded up.
+        i = xc[d];
+
+        // Look at the rounding digits and mode to determine whether to round up.
+
+        k = baseOut / 2;
+        r = r || d < 0 || xc[d + 1] != null;
+
+        r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))
+              : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||
+               rm == (x.s < 0 ? 8 : 7));
+
+        // If the index of the rounding digit is not greater than zero, or xc represents
+        // zero, then the result of the base conversion is zero or, if rounding up, a value
+        // such as 0.00001.
+        if (d < 1 || !xc[0]) {
 
-            for ( ; i < arrL; str += DIGITS.charAt( arr[i++] ) ) {
+          // 1^-dp or 0
+          str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
+        } else {
+
+          // Truncate xc to the required number of decimal places.
+          xc.length = d;
+
+          // Round up?
+          if (r) {
+
+            // Rounding up may mean the previous digit has to be rounded up and so on.
+            for (--baseOut; ++xc[--d] > baseOut;) {
+              xc[d] = 0;
+
+              if (!d) {
+                ++e;
+                xc = [1].concat(xc);
+              }
             }
+          }
+
+          // Determine trailing zeros.
+          for (k = xc.length; !xc[--k];);
 
-            return str
+          // E.g. [4, 11, 15] becomes 4bf.
+          for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));
+
+          // Add leading zeros, decimal point and trailing zeros as required.
+          str = toFixedPoint(str, e, alphabet.charAt(0));
         }
 
-        if ( baseIn < 37 ) {
-            nStr = nStr.toLowerCase()
+        // The caller will add the sign.
+        return str;
+      };
+    })();
+
+
+    // Perform division in the specified base. Called by div and convertBase.
+    div = (function () {
+
+      // Assume non-zero x and k.
+      function multiply(x, k, base) {
+        var m, temp, xlo, xhi,
+          carry = 0,
+          i = x.length,
+          klo = k % SQRT_BASE,
+          khi = k / SQRT_BASE | 0;
+
+        for (x = x.slice(); i--;) {
+          xlo = x[i] % SQRT_BASE;
+          xhi = x[i] / SQRT_BASE | 0;
+          m = khi * xlo + xhi * klo;
+          temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;
+          carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;
+          x[i] = temp % base;
         }
 
-        /*
-         * If non-integer convert integer part and fraction part separately.
-         * Convert the fraction part as if it is an integer than use division to
-         * reduce it down again to a value less than one.
-         */
-        if ( ( e = nStr.indexOf( '.' ) ) > -1 ) {
+        if (carry) x = [carry].concat(x);
+
+        return x;
+      }
 
-            /*
-             * Calculate the power to which to raise the base to get the number
-             * to divide the fraction part by after it has been converted as an
-             * integer to the required base.
-             */
-            e = nStr.length - e - 1;
+      function compare(a, b, aL, bL) {
+        var i, cmp;
 
-            // Use toFixed to avoid possible exponential notation.
-            dvs = strToArr( new BigNumber(baseIn)['pow'](e)['toF'](), 10 );
+        if (aL != bL) {
+          cmp = aL > bL ? 1 : -1;
+        } else {
 
-            nArr = nStr.split('.');
+          for (i = cmp = 0; i < aL; i++) {
 
-            // Convert the base of the fraction part (as integer).
-            dvd = strToArr( nArr[1] );
+            if (a[i] != b[i]) {
+              cmp = a[i] > b[i] ? 1 : -1;
+              break;
+            }
+          }
+        }
 
-            // Convert the base of the integer part.
-            nArr = strToArr( nArr[0] );
+        return cmp;
+      }
 
-            // Result will be a BigNumber with a value less than 1.
-            fracBN = divide( dvd, dvs, dvd.length - dvs.length, sign, baseOut,
-              // Is least significant digit of integer part an odd number?
-              nArr[nArr.length - 1] & 1 );
+      function subtract(a, b, aL, base) {
+        var i = 0;
 
-            fracArr = fracBN['c'];
+        // Subtract b from a.
+        for (; aL--;) {
+          a[aL] -= i;
+          i = a[aL] < b[aL] ? 1 : 0;
+          a[aL] = i * base + a[aL] - b[aL];
+        }
 
-            // e can be <= 0  ( if e == 0, fracArr is [0] or [1] ).
-            if ( e = fracBN['e'] ) {
+        // Remove leading zeros.
+        for (; !a[0] && a.length > 1; a.splice(0, 1));
+      }
 
-                // Append zeros according to the exponent of the result.
-                for ( ; ++e; fracArr.unshift(0) ) {
-                }
+      // x: dividend, y: divisor.
+      return function (x, y, dp, rm, base) {
+        var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,
+          yL, yz,
+          s = x.s == y.s ? 1 : -1,
+          xc = x.c,
+          yc = y.c;
 
-                // Append the fraction part to the converted integer part.
-                nStr = arrToStr(nArr) + '.' + arrToStr(fracArr)
+        // Either NaN, Infinity or 0?
+        if (!xc || !xc[0] || !yc || !yc[0]) {
 
-            // fracArr is [1].
-            // Fraction digits rounded up, so increment last digit of integer part.
-            } else if ( fracArr[0] ) {
-
-                if ( nArr[ e = nArr.length - 1 ] < baseOut - 1 ) {
-                    ++nArr[e];
-                    nStr = arrToStr(nArr)
-                } else {
-                    nStr = new BigNumber( arrToStr(nArr),
-                      baseOut )['plus'](ONE)['toS'](baseOut)
-                }
+          return new BigNumber(
 
-            // fracArr is [0]. No fraction digits.
-            } else {
-                nStr = arrToStr(nArr)
-            }
-        } else {
+           // Return NaN if either NaN, or both Infinity or 0.
+           !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :
 
-            // Simple integer. Convert base.
-            nStr = arrToStr( strToArr(nStr) )
+            // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
+            xc && xc[0] == 0 || !yc ? s * 0 : s / 0
+         );
         }
 
-        return nStr
-    }
+        q = new BigNumber(s);
+        qc = q.c = [];
+        e = x.e - y.e;
+        s = dp + e + 1;
+
+        if (!base) {
+          base = BASE;
+          e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);
+          s = s / LOG_BASE | 0;
+        }
 
+        // Result exponent may be one less then the current value of e.
+        // The coefficients of the BigNumbers from convertBase may have trailing zeros.
+        for (i = 0; yc[i] == (xc[i] || 0); i++);
 
-    // Perform division in the specified base. Called by div and convert.
-    function divide( dvd, dvs, exp, s, base, isOdd ) {
-        var dvsL, dvsT, next, cmp, remI,
-            dvsZ = dvs.slice(),
-            dvdI = dvsL = dvs.length,
-            dvdL = dvd.length,
-            rem = dvd.slice( 0, dvsL ),
-            remL = rem.length,
-            quo = new BigNumber(ONE),
-            qc = quo['c'] = [],
-            qi = 0,
-            dig = DECIMAL_PLACES + ( quo['e'] = exp ) + 1;
-
-        quo['s'] = s;
-        s = dig < 0 ? 0 : dig;
-
-        // Add zeros to make remainder as long as divisor.
-        for ( ; remL++ < dvsL; rem.push(0) ) {
-        }
-
-        // Create version of divisor with leading zero.
-        dvsZ.unshift(0);
-
-        do {
-
-            // 'next' is how many times the divisor goes into the current remainder.
-            for ( next = 0; next < base; next++ ) {
-
-                // Compare divisor and remainder.
-                if ( dvsL != ( remL = rem.length ) ) {
-                    cmp = dvsL > remL ? 1 : -1
-                } else {
-                    for ( remI = -1, cmp = 0; ++remI < dvsL; ) {
+        if (yc[i] > (xc[i] || 0)) e--;
 
-                        if ( dvs[remI] != rem[remI] ) {
-                            cmp = dvs[remI] > rem[remI] ? 1 : -1;
-                            break
-                        }
-                    }
+        if (s < 0) {
+          qc.push(1);
+          more = true;
+        } else {
+          xL = xc.length;
+          yL = yc.length;
+          i = 0;
+          s += 2;
+
+          // Normalise xc and yc so highest order digit of yc is >= base / 2.
+
+          n = mathfloor(base / (yc[0] + 1));
+
+          // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.
+          // if (n > 1 || n++ == 1 && yc[0] < base / 2) {
+          if (n > 1) {
+            yc = multiply(yc, n, base);
+            xc = multiply(xc, n, base);
+            yL = yc.length;
+            xL = xc.length;
+          }
+
+          xi = yL;
+          rem = xc.slice(0, yL);
+          remL = rem.length;
+
+          // Add zeros to make remainder as long as divisor.
+          for (; remL < yL; rem[remL++] = 0);
+          yz = yc.slice();
+          yz = [0].concat(yz);
+          yc0 = yc[0];
+          if (yc[1] >= base / 2) yc0++;
+          // Not necessary, but to prevent trial digit n > base, when using base 3.
+          // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;
+
+          do {
+            n = 0;
+
+            // Compare divisor and remainder.
+            cmp = compare(yc, rem, yL, remL);
+
+            // If divisor < remainder.
+            if (cmp < 0) {
+
+              // Calculate trial digit, n.
+
+              rem0 = rem[0];
+              if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
+
+              // n is how many times the divisor goes into the current remainder.
+              n = mathfloor(rem0 / yc0);
+
+              //  Algorithm:
+              //  product = divisor multiplied by trial digit (n).
+              //  Compare product and remainder.
+              //  If product is greater than remainder:
+              //    Subtract divisor from product, decrement trial digit.
+              //  Subtract product from remainder.
+              //  If product was less than remainder at the last compare:
+              //    Compare new remainder and divisor.
+              //    If remainder is greater than divisor:
+              //      Subtract divisor from remainder, increment trial digit.
+
+              if (n > 1) {
+
+                // n may be > base only when base is 3.
+                if (n >= base) n = base - 1;
+
+                // product = divisor * trial digit.
+                prod = multiply(yc, n, base);
+                prodL = prod.length;
+                remL = rem.length;
+
+                // Compare product and remainder.
+                // If product > remainder then trial digit n too high.
+                // n is 1 too high about 5% of the time, and is not known to have
+                // ever been more than 1 too high.
+                while (compare(prod, rem, prodL, remL) == 1) {
+                  n--;
+
+                  // Subtract divisor from product.
+                  subtract(prod, yL < prodL ? yz : yc, prodL, base);
+                  prodL = prod.length;
+                  cmp = 1;
                 }
+              } else {
 
-                // Subtract divisor from remainder (if divisor < remainder).
-                if ( cmp < 0 ) {
+                // n is 0 or 1, cmp is -1.
+                // If n is 0, there is no need to compare yc and rem again below,
+                // so change cmp to 1 to avoid it.
+                // If n is 1, leave cmp as -1, so yc and rem are compared again.
+                if (n == 0) {
 
-                    // Remainder cannot be more than one digit longer than divisor.
-                    // Equalise lengths using divisor with extra leading zero?
-                    for ( dvsT = remL == dvsL ? dvs : dvsZ; remL; ) {
-
-                        if ( rem[--remL] < dvsT[remL] ) {
-
-                            for ( remI = remL;
-                              remI && !rem[--remI];
-                                rem[remI] = base - 1 ) {
-                            }
-                            --rem[remI];
-                            rem[remL] += base
-                        }
-                        rem[remL] -= dvsT[remL]
-                    }
-                    for ( ; !rem[0]; rem.shift() ) {
-                    }
-                } else {
-                    break
+                  // divisor < remainder, so n must be at least 1.
+                  cmp = n = 1;
                 }
-            }
-
-            // Add the 'next' digit to the result array.
-            qc[qi++] = cmp ? next : ++next;
 
-            // Update the remainder.
-            rem[0] && cmp
-              ? ( rem[remL] = dvd[dvdI] || 0 )
-              : ( rem = [ dvd[dvdI] ] )
+                // product = divisor
+                prod = yc.slice();
+                prodL = prod.length;
+              }
+
+              if (prodL < remL) prod = [0].concat(prod);
+
+              // Subtract product from remainder.
+              subtract(rem, prod, remL, base);
+              remL = rem.length;
+
+               // If product was < remainder.
+              if (cmp == -1) {
+
+                // Compare divisor and new remainder.
+                // If divisor < new remainder, subtract divisor from remainder.
+                // Trial digit n too low.
+                // n is 1 too low about 5% of the time, and very rarely 2 too low.
+                while (compare(yc, rem, yL, remL) < 1) {
+                  n++;
+
+                  // Subtract divisor from remainder.
+                  subtract(rem, yL < remL ? yz : yc, remL, base);
+                  remL = rem.length;
+                }
+              }
+            } else if (cmp === 0) {
+              n++;
+              rem = [0];
+            } // else cmp === 1 and n will be 0
 
-        } while ( ( dvdI++ < dvdL || rem[0] != null ) && s-- );
+            // Add the next digit, n, to the result array.
+            qc[i++] = n;
 
-        // Leading zero? Do not remove if result is simply zero (qi == 1).
-        if ( !qc[0] && qi != 1 ) {
+            // Update the remainder.
+            if (rem[0]) {
+              rem[remL++] = xc[xi] || 0;
+            } else {
+              rem = [xc[xi]];
+              remL = 1;
+            }
+          } while ((xi++ < xL || rem[0] != null) && s--);
 
-            // There can't be more than one zero.
-            --quo['e'];
-            qc.shift()
-        }
+          more = rem[0] != null;
 
-        // Round?
-        if ( qi > dig ) {
-            rnd( quo, DECIMAL_PLACES, base, isOdd, rem[0] != null )
+          // Leading zero?
+          if (!qc[0]) qc.splice(0, 1);
         }
 
-        // Overflow?
-        if ( quo['e'] > MAX_EXP ) {
+        if (base == BASE) {
 
-            // Infinity.
-            quo['c'] = quo['e'] = null
+          // To calculate q.e, first get the number of digits of qc[0].
+          for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);
 
-        // Underflow?
-        } else if ( quo['e'] < MIN_EXP ) {
+          round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);
 
-            // Zero.
-            quo['c'] = [quo['e'] = 0]
+        // Caller is convertBase.
+        } else {
+          q.e = e;
+          q.r = +more;
         }
 
-        return quo
-    }
+        return q;
+      };
+    })();
 
 
     /*
-     * Return a string representing the value of BigNumber n in normal or
-     * exponential notation rounded to the specified decimal places or
-     * significant digits.
-     * Called by toString, toExponential (exp 1), toFixed, and toPrecision (exp 2).
-     * d is the index (with the value in normal notation) of the digit that may be
-     * rounded up.
+     * Return a string representing the value of BigNumber n in fixed-point or exponential
+     * notation rounded to the specified decimal places or significant digits.
+     *
+     * n: a BigNumber.
+     * i: the index of the last digit required (i.e. the digit that may be rounded up).
+     * rm: the rounding mode.
+     * id: 1 (toExponential) or 2 (toPrecision).
      */
-    function format( n, d, exp ) {
+    function format(n, i, rm, id) {
+      var c0, e, ne, len, str;
 
-        // Initially, i is the number of decimal places required.
-        var i = d - (n = new BigNumber(n))['e'],
-            c = n['c'];
+      if (rm == null) rm = ROUNDING_MODE;
+      else intCheck(rm, 0, 8);
 
-        // +-Infinity or NaN?
-        if ( !c ) {
-            return n['toS']()
-        }
+      if (!n.c) return n.toString();
 
-        // Round?
-        if ( c.length > ++d ) {
-            rnd( n, i, 10 )
-        }
+      c0 = n.c[0];
+      ne = n.e;
+
+      if (i == null) {
+        str = coeffToString(n.c);
+        str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS)
+         ? toExponential(str, ne)
+         : toFixedPoint(str, ne, '0');
+      } else {
+        n = round(new BigNumber(n), i, rm);
+
+        // n.e may have changed if the value was rounded up.
+        e = n.e;
+
+        str = coeffToString(n.c);
+        len = str.length;
 
-        // Recalculate d if toFixed as n['e'] may have changed if value rounded up.
-        i = c[0] == 0 ? i + 1 : exp ? d : n['e'] + i + 1;
+        // toPrecision returns exponential notation if the number of significant digits
+        // specified is less than the number of digits necessary to represent the integer
+        // part of the value in fixed-point notation.
 
-        // Append zeros?
-        for ( ; c.length < i; c.push(0) ) {
+        // Exponential notation.
+        if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {
+
+          // Append zeros?
+          for (; len < i; str += '0', len++);
+          str = toExponential(str, e);
+
+        // Fixed-point notation.
+        } else {
+          i -= ne;
+          str = toFixedPoint(str, e, '0');
+
+          // Append zeros?
+          if (e + 1 > len) {
+            if (--i > 0) for (str += '.'; i--; str += '0');
+          } else {
+            i += e - len;
+            if (i > 0) {
+              if (e + 1 == len) str += '.';
+              for (; i--; str += '0');
+            }
+          }
         }
-        i = n['e'];
+      }
+
+      return n.s < 0 && c0 ? '-' + str : str;
+    }
 
-        /*
-         * toPrecision returns exponential notation if the number of significant
-         * digits specified is less than the number of digits necessary to
-         * represent the integer part of the value in normal notation.
-         */
-        return exp == 1 || exp == 2 && ( --d < i || i <= TO_EXP_NEG )
 
-          // Exponential notation.
-          ? ( n['s'] < 0 && c[0] ? '-' : '' ) + ( c.length > 1
-            ? ( c.splice( 1, 0, '.' ), c.join('') )
-            : c[0] ) + ( i < 0 ? 'e' : 'e+' ) + i
+    // Handle BigNumber.max and BigNumber.min.
+    function maxOrMin(args, method) {
+      var n,
+        i = 1,
+        m = new BigNumber(args[0]);
+
+      for (; i < args.length; i++) {
+        n = new BigNumber(args[i]);
+
+        // If any number is NaN, return NaN.
+        if (!n.s) {
+          m = n;
+          break;
+        } else if (method.call(m, n)) {
+          m = n;
+        }
+      }
 
-          // Normal notation.
-          : n['toS']()
+      return m;
     }
 
 
-    // Round if necessary.
-    // Called by divide, format, setMode and sqrt.
-    function rnd( x, dp, base, isOdd, r ) {
-        var xc = x['c'],
-            isNeg = x['s'] < 0,
-            half = base / 2,
-            i = x['e'] + dp + 1,
-
-            // 'next' is the digit after the digit that may be rounded up.
-            next = xc[i],
-
-            /*
-             * 'more' is whether there are digits after 'next'.
-             * E.g.
-             * 0.005 (e = -3) to be rounded to 0 decimal places (dp = 0) gives i = -2
-             * The 'next' digit is zero, and there ARE 'more' digits after it.
-             * 0.5 (e = -1) dp = 0 gives i = 0
-             * The 'next' digit is 5 and there are no 'more' digits after it.
-             */
-            more = r || i < 0 || xc[i + 1] != null;
-
-        r = ROUNDING_MODE < 4
-          ? ( next != null || more ) &&
-            ( ROUNDING_MODE == 0 ||
-               ROUNDING_MODE == 2 && !isNeg ||
-                 ROUNDING_MODE == 3 && isNeg )
-          : next > half || next == half &&
-            ( ROUNDING_MODE == 4 || more ||
-
-              /*
-               * isOdd is used in base conversion and refers to the least significant
-               * digit of the integer part of the value to be converted. The fraction
-               * part is rounded by this method separately from the integer part.
-               */
-              ROUNDING_MODE == 6 && ( xc[i - 1] & 1 || !dp && isOdd ) ||
-                ROUNDING_MODE == 7 && !isNeg ||
-                  ROUNDING_MODE == 8 && isNeg );
+    /*
+     * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.
+     * Called by minus, plus and times.
+     */
+    function normalise(n, c, e) {
+      var i = 1,
+        j = c.length;
 
-        if ( i < 1 || !xc[0] ) {
-            xc.length = 0;
-            xc.push(0);
+       // Remove trailing zeros.
+      for (; !c[--j]; c.pop());
+
+      // Calculate the base 10 exponent. First get the number of digits of c[0].
+      for (j = c[0]; j >= 10; j /= 10, i++);
 
-            if ( r ) {
+      // Overflow?
+      if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {
 
-                // 1, 0.1, 0.01, 0.001, 0.0001 etc.
-                xc[0] = 1;
-                x['e'] = -dp
+        // Infinity.
+        n.c = n.e = null;
+
+      // Underflow?
+      } else if (e < MIN_EXP) {
+
+        // Zero.
+        n.c = [n.e = 0];
+      } else {
+        n.e = e;
+        n.c = c;
+      }
+
+      return n;
+    }
+
+
+    // Handle values that fail the validity test in BigNumber.
+    parseNumeric = (function () {
+      var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i,
+        dotAfter = /^([^.]+)\.$/,
+        dotBefore = /^\.([^.]+)$/,
+        isInfinityOrNaN = /^-?(Infinity|NaN)$/,
+        whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
+
+      return function (x, str, isNum, b) {
+        var base,
+          s = isNum ? str : str.replace(whitespaceOrPlus, '');
+
+        // No exception on ±Infinity or NaN.
+        if (isInfinityOrNaN.test(s)) {
+          x.s = isNaN(s) ? null : s < 0 ? -1 : 1;
+          x.c = x.e = null;
+        } else {
+          if (!isNum) {
+
+            // basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i
+            s = s.replace(basePrefix, function (m, p1, p2) {
+              base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;
+              return !b || b == base ? p1 : m;
+            });
+
+            if (b) {
+              base = b;
+
+              // E.g. '1.' to '1', '.1' to '0.1'
+              s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');
+            }
+
+            if (str != s) return new BigNumber(s, base);
+          }
+
+          // '[BigNumber Error] Not a number: {n}'
+          // '[BigNumber Error] Not a base {b} number: {n}'
+          if (BigNumber.DEBUG) {
+            throw Error
+              (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);
+          }
+
+          // NaN
+          x.c = x.e = x.s = null;
+        }
+      }
+    })();
+
+
+    /*
+     * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.
+     * If r is truthy, it is known that there are more digits after the rounding digit.
+     */
+    function round(x, sd, rm, r) {
+      var d, i, j, k, n, ni, rd,
+        xc = x.c,
+        pows10 = POWS_TEN;
+
+      // if x is not Infinity or NaN...
+      if (xc) {
+
+        // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.
+        // n is a base 1e14 number, the value of the element of array x.c containing rd.
+        // ni is the index of n within x.c.
+        // d is the number of digits of n.
+        // i is the index of rd within n including leading zeros.
+        // j is the actual index of rd within n (if < 0, rd is a leading zero).
+        out: {
+
+          // Get the number of digits of the first element of xc.
+          for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);
+          i = sd - d;
+
+          // If the rounding digit is in the first element of xc...
+          if (i < 0) {
+            i += LOG_BASE;
+            j = sd;
+            n = xc[ni = 0];
+
+            // Get the rounding digit at index j of n.
+            rd = n / pows10[d - j - 1] % 10 | 0;
+          } else {
+            ni = mathceil((i + 1) / LOG_BASE);
+
+            if (ni >= xc.length) {
+
+              if (r) {
+
+                // Needed by sqrt.
+                for (; xc.length <= ni; xc.push(0));
+                n = rd = 0;
+                d = 1;
+                i %= LOG_BASE;
+                j = i - LOG_BASE + 1;
+              } else {
+                break out;
+              }
             } else {
+              n = k = xc[ni];
+
+              // Get the number of digits of n.
+              for (d = 1; k >= 10; k /= 10, d++);
+
+              // Get the index of rd within n.
+              i %= LOG_BASE;
+
+              // Get the index of rd within n, adjusted for leading zeros.
+              // The number of leading zeros of n is given by LOG_BASE - d.
+              j = i - LOG_BASE + d;
 
-                // Zero.
-                x['e'] = 0
+              // Get the rounding digit at index j of n.
+              rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;
             }
+          }
 
-            return x
-        }
+          r = r || sd < 0 ||
 
-        // Remove any digits after the required decimal places.
-        xc.length = i--;
+          // Are there any non-zero digits after the rounding digit?
+          // The expression  n % pows10[d - j - 1]  returns all digits of n to the right
+          // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
+           xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);
 
-        // Round up?
-        if ( r ) {
+          r = rm < 4
+           ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))
+           : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&
 
-            // Rounding up may mean the previous digit has to be rounded up and so on.
-            for ( --base; ++xc[i] > base; ) {
-                xc[i] = 0;
+            // Check whether the digit to the left of the rounding digit is odd.
+            ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||
+             rm == (x.s < 0 ? 8 : 7));
+
+          if (sd < 1 || !xc[0]) {
+            xc.length = 0;
+
+            if (r) {
+
+              // Convert sd to decimal places.
+              sd -= x.e + 1;
+
+              // 1, 0.1, 0.01, 0.001, 0.0001 etc.
+              xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];
+              x.e = -sd || 0;
+            } else {
 
-                if ( !i-- ) {
-                    ++x['e'];
-                    xc.unshift(1)
+              // Zero.
+              xc[0] = x.e = 0;
+            }
+
+            return x;
+          }
+
+          // Remove excess digits.
+          if (i == 0) {
+            xc.length = ni;
+            k = 1;
+            ni--;
+          } else {
+            xc.length = ni + 1;
+            k = pows10[LOG_BASE - i];
+
+            // E.g. 56700 becomes 56000 if 7 is the rounding digit.
+            // j > 0 means i > number of leading zeros of n.
+            xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;
+          }
+
+          // Round up?
+          if (r) {
+
+            for (; ;) {
+
+              // If the digit to be rounded up is in the first element of xc...
+              if (ni == 0) {
+
+                // i will be the length of xc[0] before k is added.
+                for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);
+                j = xc[0] += k;
+                for (k = 1; j >= 10; j /= 10, k++);
+
+                // if i != k the length has increased.
+                if (i != k) {
+                  x.e++;
+                  if (xc[0] == BASE) xc[0] = 1;
                 }
+
+                break;
+              } else {
+                xc[ni] += k;
+                if (xc[ni] != BASE) break;
+                xc[ni--] = 0;
+                k = 1;
+              }
             }
+          }
+
+          // Remove trailing zeros.
+          for (i = xc.length; xc[--i] === 0; xc.pop());
         }
 
-        // Remove trailing zeros.
-        for ( i = xc.length; !xc[--i]; xc.pop() ) {
+        // Overflow? Infinity.
+        if (x.e > MAX_EXP) {
+          x.c = x.e = null;
+
+        // Underflow? Zero.
+        } else if (x.e < MIN_EXP) {
+          x.c = [x.e = 0];
         }
+      }
 
-        return x
+      return x;
     }
 
 
-    // Round after setting the appropriate rounding mode.
-    // Handles ceil, floor and round.
-    function setMode( x, dp, rm ) {
-        var r = ROUNDING_MODE;
-
-        ROUNDING_MODE = rm;
-        x = new BigNumber(x);
-        x['c'] && rnd( x, dp, 10 );
-        ROUNDING_MODE = r;
+    function valueOf(n) {
+      var str,
+        e = n.e;
+
+      if (e === null) return n.toString();
 
-        return x
+      str = coeffToString(n.c);
+
+      str = e <= TO_EXP_NEG || e >= TO_EXP_POS
+        ? toExponential(str, e)
+        : toFixedPoint(str, e, '0');
+
+      return n.s < 0 ? '-' + str : str;
     }
 
 
@@ -820,81 +1533,58 @@
     /*
      * Return a new BigNumber whose value is the absolute value of this BigNumber.
      */
-    P['abs'] = P['absoluteValue'] = function () {
-        var x = new BigNumber(this);
-
-        if ( x['s'] < 0 ) {
-            x['s'] = 1
-        }
-
-        return x
+    P.absoluteValue = P.abs = function () {
+      var x = new BigNumber(this);
+      if (x.s < 0) x.s = 1;
+      return x;
     };
 
 
     /*
-     * Return a new BigNumber whose value is the value of this BigNumber
-     * rounded to a whole number in the direction of Infinity.
+     * Return
+     *   1 if the value of this BigNumber is greater than the value of BigNumber(y, b),
+     *   -1 if the value of this BigNumber is less than the value of BigNumber(y, b),
+     *   0 if they have the same value,
+     *   or null if the value of either is NaN.
      */
-    P['ceil'] = function () {
-        return setMode( this, 0, 2 )
+    P.comparedTo = function (y, b) {
+      return compare(this, new BigNumber(y, b));
     };
 
 
     /*
-     * Return
-     * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),
-     * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),
-     * 0 if they have the same value,
-     * or null if the value of either is NaN.
-     */
-    P['comparedTo'] = P['cmp'] = function ( y, b ) {
-        var a,
-            x = this,
-            xc = x['c'],
-            yc = ( id = -id, y = new BigNumber( y, b ) )['c'],
-            i = x['s'],
-            j = y['s'],
-            k = x['e'],
-            l = y['e'];
-
-        // Either NaN?
-        if ( !i || !j ) {
-            return null
-        }
-
-        a = xc && !xc[0], b = yc && !yc[0];
-
-        // Either zero?
-        if ( a || b ) {
-            return a ? b ? 0 : -j : i
-        }
+     * If dp is undefined or null or true or false, return the number of decimal places of the
+     * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.
+     *
+     * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this
+     * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or
+     * ROUNDING_MODE if rm is omitted.
+     *
+     * [dp] {number} Decimal places: integer, 0 to MAX inclusive.
+     * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+     *
+     * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'
+     */
+    P.decimalPlaces = P.dp = function (dp, rm) {
+      var c, n, v,
+        x = this;
 
-        // Signs differ?
-        if ( i != j ) {
-            return i
-        }
+      if (dp != null) {
+        intCheck(dp, 0, MAX);
+        if (rm == null) rm = ROUNDING_MODE;
+        else intCheck(rm, 0, 8);
 
-        // Either Infinity?
-        if ( a = i < 0, b = k == l, !xc || !yc ) {
-            return b ? 0 : !xc ^ a ? 1 : -1
-        }
+        return round(new BigNumber(x), dp + x.e + 1, rm);
+      }
 
-        // Compare exponents.
-        if ( !b ) {
-            return k > l ^ a ? 1 : -1
-        }
+      if (!(c = x.c)) return null;
+      n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;
 
-        // Compare digit by digit.
-        for ( i = -1,
-              j = ( k = xc.length ) < ( l = yc.length ) ? k : l;
-              ++i < j; ) {
+      // Subtract the number of trailing zeros of the last number.
+      if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);
+      if (n < 0) n = 0;
 
-            if ( xc[i] != yc[i] ) {
-                return xc[i] > yc[i] ^ a ? 1 : -1
-            }
-        }
-        // Compare lengths.
-        return k == l ? 0 : k > l ^ a ? 1 : -1
+      return n;
     };
 
 
@@ -915,136 +1605,265 @@
      *  I / N = N
      *  I / I = N
      *
-     * Return a new BigNumber whose value is the value of this BigNumber
-     * divided by the value of BigNumber(y, b), rounded according to
-     * DECIMAL_PLACES and ROUNDING_MODE.
+     * Return a new BigNumber whose value is the value of this BigNumber divided by the value of
+     * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.
+     */
+    P.dividedBy = P.div = function (y, b) {
+      return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);
+    };
+
+
+    /*
+     * Return a new BigNumber whose value is the integer part of dividing the value of this
+     * BigNumber by the value of BigNumber(y, b).
      */
-    P['dividedBy'] = P['div'] = function ( y, b ) {
-        var xc = this['c'],
-            xe = this['e'],
-            xs = this['s'],
-            yc = ( id = 2, y = new BigNumber( y, b ) )['c'],
-            ye = y['e'],
-            ys = y['s'],
-            s = xs == ys ? 1 : -1;
+    P.dividedToIntegerBy = P.idiv = function (y, b) {
+      return div(this, new BigNumber(y, b), 0, 1);
+    };
+
+
+    /*
+     * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.
+     *
+     * If m is present, return the result modulo m.
+     * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.
+     * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.
+     *
+     * The modular power operation works efficiently when x, n, and m are integers, otherwise it
+     * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.
+     *
+     * n {number|string|BigNumber} The exponent. An integer.
+     * [m] {number|string|BigNumber} The modulus.
+     *
+     * '[BigNumber Error] Exponent not an integer: {n}'
+     */
+    P.exponentiatedBy = P.pow = function (n, m) {
+      var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y,
+        x = this;
+
+      n = new BigNumber(n);
+
+      // Allow NaN and ±Infinity, but not other non-integers.
+      if (n.c && !n.isInteger()) {
+        throw Error
+          (bignumberError + 'Exponent not an integer: ' + valueOf(n));
+      }
+
+      if (m != null) m = new BigNumber(m);
+
+      // Exponent of MAX_SAFE_INTEGER is 15.
+      nIsBig = n.e > 14;
+
+      // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.
+      if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {
+
+        // The sign of the result of pow when x is negative depends on the evenness of n.
+        // If +n overflows to ±Infinity, the evenness of n would be not be known.
+        y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n)));
+        return m ? y.mod(m) : y;
+      }
+
+      nIsNeg = n.s < 0;
+
+      if (m) {
+
+        // x % m returns NaN if abs(m) is zero, or m is NaN.
+        if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);
+
+        isModExp = !nIsNeg && x.isInteger() && m.isInteger();
 
-        // Either NaN/Infinity/0?
-        return !xe && ( !xc || !xc[0] ) || !ye && ( !yc || !yc[0] )
+        if (isModExp) x = x.mod(m);
 
-          // Either NaN?
-          ? new BigNumber( !xs || !ys ||
+      // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.
+      // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.
+      } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0
+        // [1, 240000000]
+        ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7
+        // [80000000000000]  [99999750000000]
+        : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {
 
-            // Both 0 or both Infinity?
-            ( xc ? yc && xc[0] == yc[0] : !yc )
+        // If x is negative and n is odd, k = -0, else k = 0.
+        k = x.s < 0 && isOdd(n) ? -0 : 0;
 
-              // Return NaN.
-              ? NaN
+        // If x >= 1, k = ±Infinity.
+        if (x.e > -1) k = 1 / k;
 
-              // x is 0 or y is Infinity?
-              : xc && xc[0] == 0 || !yc
+        // If n is negative return ±0, else return ±Infinity.
+        return new BigNumber(nIsNeg ? 1 / k : k);
 
-                // Return +-0.
-                ? s * 0
+      } else if (POW_PRECISION) {
 
-                // y is 0. Return +-Infinity.
-                : s / 0 )
+        // Truncating each coefficient array to a length of k after each multiplication
+        // equates to truncating significant digits to POW_PRECISION + [28, 41],
+        // i.e. there will be a minimum of 28 guard digits retained.
+        k = mathceil(POW_PRECISION / LOG_BASE + 2);
+      }
 
-          : divide( xc, yc, xe - ye, s, 10 )
+      if (nIsBig) {
+        half = new BigNumber(0.5);
+        if (nIsNeg) n.s = 1;
+        nIsOdd = isOdd(n);
+      } else {
+        i = Math.abs(+valueOf(n));
+        nIsOdd = i % 2;
+      }
+
+      y = new BigNumber(ONE);
+
+      // Performs 54 loop iterations for n of 9007199254740991.
+      for (; ;) {
+
+        if (nIsOdd) {
+          y = y.times(x);
+          if (!y.c) break;
+
+          if (k) {
+            if (y.c.length > k) y.c.length = k;
+          } else if (isModExp) {
+            y = y.mod(m);    //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));
+          }
+        }
+
+        if (i) {
+          i = mathfloor(i / 2);
+          if (i === 0) break;
+          nIsOdd = i % 2;
+        } else {
+          n = n.times(half);
+          round(n, n.e + 1, 1);
+
+          if (n.e > 14) {
+            nIsOdd = isOdd(n);
+          } else {
+            i = +valueOf(n);
+            if (i === 0) break;
+            nIsOdd = i % 2;
+          }
+        }
+
+        x = x.times(x);
+
+        if (k) {
+          if (x.c && x.c.length > k) x.c.length = k;
+        } else if (isModExp) {
+          x = x.mod(m);    //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));
+        }
+      }
+
+      if (isModExp) return y;
+      if (nIsNeg) y = ONE.div(y);
+
+      return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;
     };
 
 
     /*
-     * Return true if the value of this BigNumber is equal to the value of
-     * BigNumber(n, b), otherwise returns false.
+     * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer
+     * using rounding mode rm, or ROUNDING_MODE if rm is omitted.
+     *
+     * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+     *
+     * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'
      */
-    P['equals'] = P['eq'] = function ( n, b ) {
-        id = 3;
-        return this['cmp']( n, b ) === 0
+    P.integerValue = function (rm) {
+      var n = new BigNumber(this);
+      if (rm == null) rm = ROUNDING_MODE;
+      else intCheck(rm, 0, 8);
+      return round(n, n.e + 1, rm);
     };
 
 
     /*
-     * Return a new BigNumber whose value is the value of this BigNumber
-     * rounded to a whole number in the direction of -Infinity.
+     * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),
+     * otherwise return false.
      */
-    P['floor'] = function () {
-        return setMode( this, 0, 3 )
+    P.isEqualTo = P.eq = function (y, b) {
+      return compare(this, new BigNumber(y, b)) === 0;
     };
 
 
     /*
-     * Return true if the value of this BigNumber is greater than the value of
-     * BigNumber(n, b), otherwise returns false.
+     * Return true if the value of this BigNumber is a finite number, otherwise return false.
      */
-    P['greaterThan'] = P['gt'] = function ( n, b ) {
-        id = 4;
-        return this['cmp']( n, b ) > 0
+    P.isFinite = function () {
+      return !!this.c;
     };
 
 
     /*
-     * Return true if the value of this BigNumber is greater than or equal to
-     * the value of BigNumber(n, b), otherwise returns false.
+     * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),
+     * otherwise return false.
      */
-    P['greaterThanOrEqualTo'] = P['gte'] = function ( n, b ) {
-        id = 5;
-        return ( b = this['cmp']( n, b ) ) == 1 || b === 0
+    P.isGreaterThan = P.gt = function (y, b) {
+      return compare(this, new BigNumber(y, b)) > 0;
     };
 
 
     /*
-     * Return true if the value of this BigNumber is a finite number, otherwise
-     * returns false.
+     * Return true if the value of this BigNumber is greater than or equal to the value of
+     * BigNumber(y, b), otherwise return false.
      */
-    P['isFinite'] = P['isF'] = function () {
-        return !!this['c']
+    P.isGreaterThanOrEqualTo = P.gte = function (y, b) {
+      return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;
+
+    };
+
+
+    /*
+     * Return true if the value of this BigNumber is an integer, otherwise return false.
+     */
+    P.isInteger = function () {
+      return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;
     };
 
 
     /*
-     * Return true if the value of this BigNumber is NaN, otherwise returns
-     * false.
+     * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),
+     * otherwise return false.
      */
-    P['isNaN'] = function () {
-        return !this['s']
+    P.isLessThan = P.lt = function (y, b) {
+      return compare(this, new BigNumber(y, b)) < 0;
     };
 
 
     /*
-     * Return true if the value of this BigNumber is negative, otherwise
-     * returns false.
+     * Return true if the value of this BigNumber is less than or equal to the value of
+     * BigNumber(y, b), otherwise return false.
      */
-    P['isNegative'] = P['isNeg'] = function () {
-        return this['s'] < 0
+    P.isLessThanOrEqualTo = P.lte = function (y, b) {
+      return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;
     };
 
 
     /*
-     * Return true if the value of this BigNumber is 0 or -0, otherwise returns
-     * false.
+     * Return true if the value of this BigNumber is NaN, otherwise return false.
      */
-    P['isZero'] = P['isZ'] = function () {
-        return !!this['c'] && this['c'][0] == 0
+    P.isNaN = function () {
+      return !this.s;
     };
 
 
     /*
-     * Return true if the value of this BigNumber is less than the value of
-     * BigNumber(n, b), otherwise returns false.
+     * Return true if the value of this BigNumber is negative, otherwise return false.
      */
-    P['lessThan'] = P['lt'] = function ( n, b ) {
-        id = 6;
-        return this['cmp']( n, b ) < 0
+    P.isNegative = function () {
+      return this.s < 0;
     };
 
 
     /*
-     * Return true if the value of this BigNumber is less than or equal to the
-     * value of BigNumber(n, b), otherwise returns false.
+     * Return true if the value of this BigNumber is positive, otherwise return false.
      */
-    P['lessThanOrEqualTo'] = P['lte'] = function ( n, b ) {
-        id = 7;
-        return ( b = this['cmp']( n, b ) ) == -1 || b === 0
+    P.isPositive = function () {
+      return this.s > 0;
+    };
+
+
+    /*
+     * Return true if the value of this BigNumber is 0 or -0, otherwise return false.
+     */
+    P.isZero = function () {
+      return !!this.c && this.c[0] == 0;
     };
 
 
@@ -1065,188 +1884,279 @@
      *  I - N = N
      *  I - I = N
      *
-     * Return a new BigNumber whose value is the value of this BigNumber minus
-     * the value of BigNumber(y, b).
+     * Return a new BigNumber whose value is the value of this BigNumber minus the value of
+     * BigNumber(y, b).
      */
-    P['minus'] = function ( y, b ) {
-        var d, i, j, xLTy,
-            x = this,
-            a = x['s'];
-
-        b = ( id = 8, y = new BigNumber( y, b ) )['s'];
-
-        // Either NaN?
-        if ( !a || !b ) {
-            return new BigNumber(NaN)
-        }
-
-        // Signs differ?
-        if ( a != b ) {
-            return y['s'] = -b, x['plus'](y)
-        }
+    P.minus = function (y, b) {
+      var i, j, t, xLTy,
+        x = this,
+        a = x.s;
+
+      y = new BigNumber(y, b);
+      b = y.s;
+
+      // Either NaN?
+      if (!a || !b) return new BigNumber(NaN);
+
+      // Signs differ?
+      if (a != b) {
+        y.s = -b;
+        return x.plus(y);
+      }
+
+      var xe = x.e / LOG_BASE,
+        ye = y.e / LOG_BASE,
+        xc = x.c,
+        yc = y.c;
 
-        var xc = x['c'],
-            xe = x['e'],
-            yc = y['c'],
-            ye = y['e'];
+      if (!xe || !ye) {
 
-        if ( !xe || !ye ) {
+        // Either Infinity?
+        if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);
 
-            // Either Infinity?
-            if ( !xc || !yc ) {
-                return xc ? ( y['s'] = -b, y ) : new BigNumber( yc ? x : NaN )
-            }
+        // Either zero?
+        if (!xc[0] || !yc[0]) {
 
-            // Either zero?
-            if ( !xc[0] || !yc[0] ) {
+          // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.
+          return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :
 
-                // y is non-zero?
-                return yc[0]
-                  ? ( y['s'] = -b, y )
-
-                  // x is non-zero?
-                  : new BigNumber( xc[0]
-                    ? x
-
-                    // Both are zero.
-                    // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
-                    : ROUNDING_MODE == 3 ? -0 : 0 )
-            }
+           // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
+           ROUNDING_MODE == 3 ? -0 : 0);
         }
+      }
 
-        // Determine which is the bigger number.
-        // Prepend zeros to equalise exponents.
-        if ( xc = xc.slice(), a = xe - ye ) {
-            d = ( xLTy = a < 0 ) ? ( a = -a, xc ) : ( ye = xe, yc );
+      xe = bitFloor(xe);
+      ye = bitFloor(ye);
+      xc = xc.slice();
 
-            for ( d.reverse(), b = a; b--; d.push(0) ) {
-            }
-            d.reverse()
-        } else {
+      // Determine which is the bigger number.
+      if (a = xe - ye) {
 
-            // Exponents equal. Check digit by digit.
-            j = ( ( xLTy = xc.length < yc.length ) ? xc : yc ).length;
+        if (xLTy = a < 0) {
+          a = -a;
+          t = xc;
+        } else {
+          ye = xe;
+          t = yc;
+        }
 
-            for ( a = b = 0; b < j; b++ ) {
+        t.reverse();
 
-                if ( xc[b] != yc[b] ) {
-                    xLTy = xc[b] < yc[b];
-                    break
-                }
-            }
-        }
+        // Prepend zeros to equalise exponents.
+        for (b = a; b--; t.push(0));
+        t.reverse();
+      } else {
 
-        // x < y? Point xc to the array of the bigger number.
-        if ( xLTy ) {
-            d = xc, xc = yc, yc = d;
-            y['s'] = -y['s']
-        }
+        // Exponents equal. Check digit by digit.
+        j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;
 
-        /*
-         * Append zeros to xc if shorter. No need to add zeros to yc if shorter
-         * as subtraction only needs to start at yc.length.
-         */
-        if ( ( b = -( ( j = xc.length ) - yc.length ) ) > 0 ) {
+        for (a = b = 0; b < j; b++) {
 
-            for ( ; b--; xc[j++] = 0 ) {
-            }
+          if (xc[b] != yc[b]) {
+            xLTy = xc[b] < yc[b];
+            break;
+          }
         }
+      }
 
-        // Subtract yc from xc.
-        for ( b = yc.length; b > a; ){
+      // x < y? Point xc to the array of the bigger number.
+      if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;
 
-            if ( xc[--b] < yc[b] ) {
+      b = (j = yc.length) - (i = xc.length);
 
-                for ( i = b; i && !xc[--i]; xc[i] = 9 ) {
-                }
-                --xc[i];
-                xc[b] += 10
-            }
-            xc[b] -= yc[b]
-        }
+      // Append zeros to xc if shorter.
+      // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.
+      if (b > 0) for (; b--; xc[i++] = 0);
+      b = BASE - 1;
 
-        // Remove trailing zeros.
-        for ( ; xc[--j] == 0; xc.pop() ) {
-        }
+      // Subtract yc from xc.
+      for (; j > a;) {
 
-        // Remove leading zeros and adjust exponent accordingly.
-        for ( ; xc[0] == 0; xc.shift(), --ye ) {
+        if (xc[--j] < yc[j]) {
+          for (i = j; i && !xc[--i]; xc[i] = b);
+          --xc[i];
+          xc[j] += BASE;
         }
 
-        /*
-         * No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity
-         * when neither x or y are Infinity.
-         */
+        xc[j] -= yc[j];
+      }
 
-        // Underflow?
-        if ( ye < MIN_EXP || !xc[0] ) {
+      // Remove leading zeros and adjust exponent accordingly.
+      for (; xc[0] == 0; xc.splice(0, 1), --ye);
 
-            /*
-             * Following IEEE 754 (2008) 6.3,
-             * n - n = +0  but  n - n = -0 when rounding towards -Infinity.
-             */
-            if ( !xc[0] ) {
-                y['s'] = ROUNDING_MODE == 3 ? -1 : 1
-            }
+      // Zero?
+      if (!xc[0]) {
 
-            // Result is zero.
-            xc = [ye = 0]
-        }
+        // Following IEEE 754 (2008) 6.3,
+        // n - n = +0  but  n - n = -0  when rounding towards -Infinity.
+        y.s = ROUNDING_MODE == 3 ? -1 : 1;
+        y.c = [y.e = 0];
+        return y;
+      }
 
-        return y['c'] = xc, y['e'] = ye, y
+      // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity
+      // for finite x and y.
+      return normalise(y, xc, ye);
     };
 
 
     /*
      *   n % 0 =  N
      *   n % N =  N
+     *   n % I =  n
      *   0 % n =  0
      *  -0 % n = -0
      *   0 % 0 =  N
      *   0 % N =  N
+     *   0 % I =  0
      *   N % n =  N
      *   N % 0 =  N
      *   N % N =  N
+     *   N % I =  N
+     *   I % n =  N
+     *   I % 0 =  N
+     *   I % N =  N
+     *   I % I =  N
+     *
+     * Return a new BigNumber whose value is the value of this BigNumber modulo the value of
+     * BigNumber(y, b). The result depends on the value of MODULO_MODE.
+     */
+    P.modulo = P.mod = function (y, b) {
+      var q, s,
+        x = this;
+
+      y = new BigNumber(y, b);
+
+      // Return NaN if x is Infinity or NaN, or y is NaN or zero.
+      if (!x.c || !y.s || y.c && !y.c[0]) {
+        return new BigNumber(NaN);
+
+      // Return x if y is Infinity or x is zero.
+      } else if (!y.c || x.c && !x.c[0]) {
+        return new BigNumber(x);
+      }
+
+      if (MODULO_MODE == 9) {
+
+        // Euclidian division: q = sign(y) * floor(x / abs(y))
+        // r = x - qy    where  0 <= r < abs(y)
+        s = y.s;
+        y.s = 1;
+        q = div(x, y, 0, 3);
+        y.s = s;
+        q.s *= s;
+      } else {
+        q = div(x, y, 0, MODULO_MODE);
+      }
+
+      y = x.minus(q.times(y));
+
+      // To match JavaScript %, ensure sign of zero is sign of dividend.
+      if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;
+
+      return y;
+    };
+
+
+    /*
+     *  n * 0 = 0
+     *  n * N = N
+     *  n * I = I
+     *  0 * n = 0
+     *  0 * 0 = 0
+     *  0 * N = N
+     *  0 * I = N
+     *  N * n = N
+     *  N * 0 = N
+     *  N * N = N
+     *  N * I = N
+     *  I * n = I
+     *  I * 0 = N
+     *  I * N = N
+     *  I * I = I
      *
-     * Return a new BigNumber whose value is the value of this BigNumber modulo
-     * the value of BigNumber(y, b).
+     * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value
+     * of BigNumber(y, b).
      */
-    P['modulo'] = P['mod'] = function ( y, b ) {
-        var x = this,
-            xc = x['c'],
-            yc = ( id = 9, y = new BigNumber( y, b ) )['c'],
-            i = x['s'],
-            j = y['s'];
+    P.multipliedBy = P.times = function (y, b) {
+      var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,
+        base, sqrtBase,
+        x = this,
+        xc = x.c,
+        yc = (y = new BigNumber(y, b)).c;
+
+      // Either NaN, ±Infinity or ±0?
+      if (!xc || !yc || !xc[0] || !yc[0]) {
+
+        // Return NaN if either is NaN, or one is 0 and the other is Infinity.
+        if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {
+          y.c = y.e = y.s = null;
+        } else {
+          y.s *= x.s;
 
-        // Is x or y NaN, or y zero?
-        b = !i || !j || yc && !yc[0];
+          // Return ±Infinity if either is ±Infinity.
+          if (!xc || !yc) {
+            y.c = y.e = null;
 
-        if ( b || xc && !xc[0] ) {
-            return new BigNumber( b ? NaN : x )
+          // Return ±0 if either is ±0.
+          } else {
+            y.c = [0];
+            y.e = 0;
+          }
         }
 
-        x['s'] = y['s'] = 1;
-        b = y['cmp'](x) == 1;
-        x['s'] = i, y['s'] = j;
+        return y;
+      }
+
+      e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);
+      y.s *= x.s;
+      xcL = xc.length;
+      ycL = yc.length;
+
+      // Ensure xc points to longer array and xcL to its length.
+      if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;
 
-        return b
-          ? new BigNumber(x)
-          : ( i = DECIMAL_PLACES, j = ROUNDING_MODE,
-            DECIMAL_PLACES = 0, ROUNDING_MODE = 1,
-              x = x['div'](y),
-                DECIMAL_PLACES = i, ROUNDING_MODE = j,
-                  this['minus']( x['times'](y) ) )
+      // Initialise the result array with zeros.
+      for (i = xcL + ycL, zc = []; i--; zc.push(0));
+
+      base = BASE;
+      sqrtBase = SQRT_BASE;
+
+      for (i = ycL; --i >= 0;) {
+        c = 0;
+        ylo = yc[i] % sqrtBase;
+        yhi = yc[i] / sqrtBase | 0;
+
+        for (k = xcL, j = i + k; j > i;) {
+          xlo = xc[--k] % sqrtBase;
+          xhi = xc[k] / sqrtBase | 0;
+          m = yhi * xlo + xhi * ylo;
+          xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;
+          c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;
+          zc[j--] = xlo % base;
+        }
+
+        zc[j] = c;
+      }
+
+      if (c) {
+        ++e;
+      } else {
+        zc.splice(0, 1);
+      }
+
+      return normalise(y, zc, e);
     };
 
 
     /*
-     * Return a new BigNumber whose value is the value of this BigNumber
-     * negated, i.e. multiplied by -1.
+     * Return a new BigNumber whose value is the value of this BigNumber negated,
+     * i.e. multiplied by -1.
      */
-    P['negated'] = P['neg'] = function () {
-        var x = new BigNumber(this);
-
-        return x['s'] = -x['s'] || null, x
+    P.negated = function () {
+      var x = new BigNumber(this);
+      x.s = -x.s || null;
+      return x;
     };
 
 
@@ -1267,738 +2177,684 @@
      *  I + N = N
      *  I + I = I
      *
-     * Return a new BigNumber whose value is the value of this BigNumber plus
-     * the value of BigNumber(y, b).
+     * Return a new BigNumber whose value is the value of this BigNumber plus the value of
+     * BigNumber(y, b).
      */
-    P['plus'] = function ( y, b ) {
-        var d,
-            x = this,
-            a = x['s'];
-
-        b = ( id = 10, y = new BigNumber( y, b ) )['s'];
-
-        // Either NaN?
-        if ( !a || !b ) {
-            return new BigNumber(NaN)
-        }
+    P.plus = function (y, b) {
+      var t,
+        x = this,
+        a = x.s;
+
+      y = new BigNumber(y, b);
+      b = y.s;
+
+      // Either NaN?
+      if (!a || !b) return new BigNumber(NaN);
+
+      // Signs differ?
+       if (a != b) {
+        y.s = -b;
+        return x.minus(y);
+      }
+
+      var xe = x.e / LOG_BASE,
+        ye = y.e / LOG_BASE,
+        xc = x.c,
+        yc = y.c;
 
-        // Signs differ?
-        if ( a != b ) {
-            return y['s'] = -b, x['minus'](y)
-        }
-
-        var xe = x['e'],
-            xc = x['c'],
-            ye = y['e'],
-            yc = y['c'];
-
-        if ( !xe || !ye ) {
-
-            // Either Infinity?
-            if ( !xc || !yc ) {
-
-                // Return +-Infinity.
-                return new BigNumber( a / 0 )
-            }
-
-            // Either zero?
-            if ( !xc[0] || !yc[0] ) {
-
-                // y is non-zero?
-                return yc[0]
-                  ? y
-
-                  // x is non-zero?
-                  : new BigNumber( xc[0]
-                    ? x
+      if (!xe || !ye) {
 
-                    // Both are zero. Return zero.
-                    : a * 0 )
-            }
-        }
-
-        // Prepend zeros to equalise exponents.
-        // Note: Faster to use reverse then do unshifts.
-        if ( xc = xc.slice(), a = xe - ye ) {
-            d = a > 0 ? ( ye = xe, yc ) : ( a = -a, xc );
+        // Return ±Infinity if either ±Infinity.
+        if (!xc || !yc) return new BigNumber(a / 0);
 
-            for ( d.reverse(); a--; d.push(0) ) {
-            }
-            d.reverse()
-        }
-
-        // Point xc to the longer array.
-        if ( xc.length - yc.length < 0 ) {
-            d = yc, yc = xc, xc = d
-        }
-
-        /*
-         * Only start adding at yc.length - 1 as the
-         * further digits of xc can be left as they are.
-         */
-        for ( a = yc.length, b = 0; a;
-             b = ( xc[--a] = xc[a] + yc[a] + b ) / 10 ^ 0, xc[a] %= 10 ) {
+        // Either zero?
+        // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.
+        if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);
+      }
+
+      xe = bitFloor(xe);
+      ye = bitFloor(ye);
+      xc = xc.slice();
+
+      // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.
+      if (a = xe - ye) {
+        if (a > 0) {
+          ye = xe;
+          t = yc;
+        } else {
+          a = -a;
+          t = xc;
         }
 
-        // No need to check for zero, as +x + +y != 0 && -x + -y != 0
+        t.reverse();
+        for (; a--; t.push(0));
+        t.reverse();
+      }
 
-        if ( b ) {
-            xc.unshift(b);
+      a = xc.length;
+      b = yc.length;
 
-            // Overflow? (MAX_EXP + 1 possible)
-            if ( ++ye > MAX_EXP ) {
+      // Point xc to the longer array, and b to the shorter length.
+      if (a - b < 0) t = yc, yc = xc, xc = t, b = a;
 
-                // Infinity.
-                xc = ye = null
-            }
-        }
+      // Only start adding at yc.length - 1 as the further digits of xc can be ignored.
+      for (a = 0; b;) {
+        a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;
+        xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;
+      }
 
-         // Remove trailing zeros.
-        for ( a = xc.length; xc[--a] == 0; xc.pop() ) {
-        }
+      if (a) {
+        xc = [a].concat(xc);
+        ++ye;
+      }
 
-        return y['c'] = xc, y['e'] = ye, y
+      // No need to check for zero, as +x + +y != 0 && -x + -y != 0
+      // ye = MAX_EXP + 1 possible
+      return normalise(y, xc, ye);
     };
 
 
     /*
-     * Return a BigNumber whose value is the value of this BigNumber raised to
-     * the power e. If e is negative round according to DECIMAL_PLACES and
-     * ROUNDING_MODE.
+     * If sd is undefined or null or true or false, return the number of significant digits of
+     * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.
+     * If sd is true include integer-part trailing zeros in the count.
+     *
+     * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this
+     * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or
+     * ROUNDING_MODE if rm is omitted.
+     *
+     * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.
+     *                     boolean: whether to count integer-part trailing zeros: true or false.
+     * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
      *
-     * e {number} Integer, -MAX_POWER to MAX_POWER inclusive.
+     * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'
      */
-    P['toPower'] = P['pow'] = function ( e ) {
+    P.precision = P.sd = function (sd, rm) {
+      var c, n, v,
+        x = this;
 
-        // e to integer, avoiding NaN or Infinity becoming 0.
-        var i = e * 0 == 0 ? e | 0 : e,
-            x = new BigNumber(this),
-            y = new BigNumber(ONE);
+      if (sd != null && sd !== !!sd) {
+        intCheck(sd, 1, MAX);
+        if (rm == null) rm = ROUNDING_MODE;
+        else intCheck(rm, 0, 8);
 
-        // Use Math.pow?
-        // Pass +-Infinity for out of range exponents.
-        if ( ( ( ( outOfRange = e < -MAX_POWER || e > MAX_POWER ) &&
-          (i = e * 1 / 0) ) ||
+        return round(new BigNumber(x), sd, rm);
+      }
 
-             /*
-              * Any exponent that fails the parse becomes NaN.
-              *
-              * Include 'e !== 0' because on Opera -0 == parseFloat(-0) is false,
-              * despite -0 === parseFloat(-0) && -0 == parseFloat('-0') is true.
-              */
-             parse(e) != e && e !== 0 && !(i = NaN) ) &&
+      if (!(c = x.c)) return null;
+      v = c.length - 1;
+      n = v * LOG_BASE + 1;
 
-              // 'pow() exponent not an integer: {e}'
-              // 'pow() exponent out of range: {e}'
-              !ifExceptionsThrow( e, 'exponent', 'pow' ) ||
+      if (v = c[v]) {
 
-                // Pass zero to Math.pow, as any value to the power zero is 1.
-                !i ) {
+        // Subtract the number of trailing zeros of the last element.
+        for (; v % 10 == 0; v /= 10, n--);
 
-            // i is +-Infinity, NaN or 0.
-            return new BigNumber( Math.pow( x['toS'](), i ) )
-        }
-
-        for ( i = i < 0 ? -i : i; ; ) {
+        // Add the number of digits of the first element.
+        for (v = c[0]; v >= 10; v /= 10, n++);
+      }
 
-            if ( i & 1 ) {
-                y = y['times'](x)
-            }
-            i >>= 1;
+      if (sd && x.e + 1 > n) n = x.e + 1;
 
-            if ( !i ) {
-                break
-            }
-            x = x['times'](x)
-        }
-
-        return e < 0 ? ONE['div'](y) : y
+      return n;
     };
 
 
     /*
-     * Return a new BigNumber whose value is the value of this BigNumber
-     * rounded to a maximum of dp decimal places using rounding mode rm, or to
-     * 0 and ROUNDING_MODE respectively if omitted.
+     * Return a new BigNumber whose value is the value of this BigNumber shifted by k places
+     * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.
+     *
+     * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.
      *
-     * [dp] {number} Integer, 0 to MAX inclusive.
-     * [rm] {number} Integer, 0 to 8 inclusive.
+     * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'
      */
-    P['round'] = function ( dp, rm ) {
-
-        dp = dp == null || ( ( ( outOfRange = dp < 0 || dp > MAX ) ||
-          parse(dp) != dp ) &&
-
-            // 'round() decimal places out of range: {dp}'
-            // 'round() decimal places not an integer: {dp}'
-            !ifExceptionsThrow( dp, 'decimal places', 'round' ) )
-              ? 0
-              : dp | 0;
-
-        rm = rm == null || ( ( ( outOfRange = rm < 0 || rm > 8 ) ||
-
-          // Include '&& rm !== 0' because with Opera -0 == parseFloat(-0) is false.
-          parse(rm) != rm && rm !== 0 ) &&
-
-            // 'round() mode not an integer: {rm}'
-            // 'round() mode out of range: {rm}'
-            !ifExceptionsThrow( rm, 'mode', 'round' ) )
-              ? ROUNDING_MODE
-              : rm | 0;
-
-        return setMode( this, dp, rm )
+    P.shiftedBy = function (k) {
+      intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
+      return this.times('1e' + k);
     };
 
 
     /*
      *  sqrt(-n) =  N
-     *  sqrt( N) =  N
+     *  sqrt(N) =  N
      *  sqrt(-I) =  N
-     *  sqrt( I) =  I
-     *  sqrt( 0) =  0
+     *  sqrt(I) =  I
+     *  sqrt(0) =  0
      *  sqrt(-0) = -0
      *
-     * Return a new BigNumber whose value is the square root of the value of
-     * this BigNumber, rounded according to DECIMAL_PLACES and ROUNDING_MODE.
+     * Return a new BigNumber whose value is the square root of the value of this BigNumber,
+     * rounded according to DECIMAL_PLACES and ROUNDING_MODE.
      */
-    P['squareRoot'] = P['sqrt'] = function () {
-        var i, n, r, re, t,
-            x = this,
-            c = x['c'],
-            s = x['s'],
-            e = x['e'],
-            dp = DECIMAL_PLACES,
-            rm = ROUNDING_MODE,
-            half = new BigNumber('0.5');
-
-        // Negative/NaN/Infinity/zero?
-        if ( s !== 1 || !c || !c[0] ) {
-
-            return new BigNumber( !s || s < 0 && ( !c || c[0] )
-              ? NaN
-              : c ? x : 1 / 0 )
-        }
-
-        // Initial estimate.
-        s = Math.sqrt( x['toS']() );
-        ROUNDING_MODE = 1;
-
-        /*
-          Math.sqrt underflow/overflow?
-          Pass x to Math.sqrt as integer, then adjust the exponent of the result.
-         */
-        if ( s == 0 || s == 1 / 0 ) {
-            n = c.join('');
-
-            if ( !( n.length + e & 1 ) ) {
-                n += '0'
-            }
-            r = new BigNumber( Math.sqrt(n) + '' );
+    P.squareRoot = P.sqrt = function () {
+      var m, n, r, rep, t,
+        x = this,
+        c = x.c,
+        s = x.s,
+        e = x.e,
+        dp = DECIMAL_PLACES + 4,
+        half = new BigNumber('0.5');
+
+      // Negative/NaN/Infinity/zero?
+      if (s !== 1 || !c || !c[0]) {
+        return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);
+      }
+
+      // Initial estimate.
+      s = Math.sqrt(+valueOf(x));
+
+      // Math.sqrt underflow/overflow?
+      // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
+      if (s == 0 || s == 1 / 0) {
+        n = coeffToString(c);
+        if ((n.length + e) % 2 == 0) n += '0';
+        s = Math.sqrt(+n);
+        e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);
 
-            // r may still not be finite.
-            if ( !r['c'] ) {
-                r['c'] = [1]
-            }
-            r['e'] = ( ( ( e + 1 ) / 2 ) | 0 ) - ( e < 0 || e & 1 )
+        if (s == 1 / 0) {
+          n = '1e' + e;
         } else {
-            r = new BigNumber( n = s.toString() )
+          n = s.toExponential();
+          n = n.slice(0, n.indexOf('e') + 1) + e;
         }
-        re = r['e'];
-        s = re + ( DECIMAL_PLACES += 4 );
 
-        if ( s < 3 ) {
-            s = 0
-        }
-        e = s;
+        r = new BigNumber(n);
+      } else {
+        r = new BigNumber(s + '');
+      }
+
+      // Check for zero.
+      // r could be zero if MIN_EXP is changed after the this value was created.
+      // This would cause a division by zero (x/t) and hence Infinity below, which would cause
+      // coeffToString to throw.
+      if (r.c[0]) {
+        e = r.e;
+        s = e + dp;
+        if (s < 3) s = 0;
 
         // Newton-Raphson iteration.
-        for ( ; ; ) {
-            t = r;
-            r = half['times']( t['plus']( x['div'](t) ) );
-
-            if ( t['c'].slice( 0, s ).join('') === r['c'].slice( 0, s ).join('') ) {
-                c = r['c'];
-
-                /*
-                  The exponent of r may here be one less than the final result
-                  exponent (re), e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust
-                  s so the rounding digits are indexed correctly.
-                 */
-                s = s - ( n && r['e'] < re );
-
-                /*
-                  The 4th rounding digit may be in error by -1 so if the 4 rounding
-                  digits are 9999 or 4999 (i.e. approaching a rounding boundary)
-                  continue the iteration.
-                 */
-                if ( c[s] == 9 && c[s - 1] == 9 && c[s - 2] == 9 &&
-                        ( c[s - 3] == 9 || n && c[s - 3] == 4 ) ) {
-
-                    /*
-                      If 9999 on first run through, check to see if rounding up
-                      gives the exact result as the nines may infinitely repeat.
-                     */
-                    if ( n && c[s - 3] == 9 ) {
-                        t = r['round']( dp, 0 );
-
-                        if ( t['times'](t)['eq'](x) ) {
-                            ROUNDING_MODE = rm;
-                            DECIMAL_PLACES = dp;
-
-                            return t
-                        }
-                    }
-                    DECIMAL_PLACES += 4;
-                    s += 4;
-                    n = ''
-                } else {
+        for (; ;) {
+          t = r;
+          r = half.times(t.plus(div(x, t, dp, 1)));
+
+          if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {
+
+            // The exponent of r may here be one less than the final result exponent,
+            // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits
+            // are indexed correctly.
+            if (r.e < e) --s;
+            n = n.slice(s - 3, s + 1);
+
+            // The 4th rounding digit may be in error by -1 so if the 4 rounding digits
+            // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the
+            // iteration.
+            if (n == '9999' || !rep && n == '4999') {
+
+              // On the first iteration only, check to see if rounding up gives the
+              // exact result as the nines may infinitely repeat.
+              if (!rep) {
+                round(t, t.e + DECIMAL_PLACES + 2, 0);
+
+                if (t.times(t).eq(x)) {
+                  r = t;
+                  break;
+                }
+              }
 
-                    /*
-                      If the rounding digits are null, 0000 or 5000, check for an
-                      exact result. If not, then there are further digits so
-                      increment the 1st rounding digit to ensure correct rounding.
-                     */
-                    if ( !c[e] && !c[e - 1] && !c[e - 2] &&
-                            ( !c[e - 3] || c[e - 3] == 5 ) ) {
-
-                        // Truncate to the first rounding digit.
-                        if ( c.length > e - 2 ) {
-                            c.length = e - 2
-                        }
-
-                        if ( !r['times'](r)['eq'](x) ) {
-
-                            while ( c.length < e - 3 ) {
-                                c.push(0)
-                            }
-                            c[e - 3]++
-                        }
-                    }
-                    ROUNDING_MODE = rm;
-                    rnd( r, DECIMAL_PLACES = dp, 10 );
+              dp += 4;
+              s += 4;
+              rep = 1;
+            } else {
 
-                    return r
-                }
+              // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact
+              // result. If not, then there are further digits and m will be truthy.
+              if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
+
+                // Truncate to the first rounding digit.
+                round(r, r.e + DECIMAL_PLACES + 2, 1);
+                m = !r.times(r).eq(x);
+              }
+
+              break;
             }
+          }
         }
+      }
+
+      return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);
     };
 
 
     /*
-     *  n * 0 = 0
-     *  n * N = N
-     *  n * I = I
-     *  0 * n = 0
-     *  0 * 0 = 0
-     *  0 * N = N
-     *  0 * I = N
-     *  N * n = N
-     *  N * 0 = N
-     *  N * N = N
-     *  N * I = N
-     *  I * n = I
-     *  I * 0 = N
-     *  I * N = N
-     *  I * I = I
+     * Return a string representing the value of this BigNumber in exponential notation and
+     * rounded using ROUNDING_MODE to dp fixed decimal places.
+     *
+     * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.
+     * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
      *
-     * Return a new BigNumber whose value is the value of this BigNumber times
-     * the value of BigNumber(y, b).
+     * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'
      */
-    P['times'] = function ( y, b ) {
-        var c,
-            x = this,
-            xc = x['c'],
-            yc = ( id = 11, y = new BigNumber( y, b ) )['c'],
-            i = x['e'],
-            j = y['e'],
-            a = x['s'];
-
-        y['s'] = a == ( b = y['s'] ) ? 1 : -1;
-
-        // Either NaN/Infinity/0?
-        if ( !i && ( !xc || !xc[0] ) || !j && ( !yc || !yc[0] ) ) {
-
-            // Either NaN?
-            return new BigNumber( !a || !b ||
-
-              // x is 0 and y is Infinity  or  y is 0 and x is Infinity?
-              xc && !xc[0] && !yc || yc && !yc[0] && !xc
+    P.toExponential = function (dp, rm) {
+      if (dp != null) {
+        intCheck(dp, 0, MAX);
+        dp++;
+      }
+      return format(this, dp, rm, 1);
+    };
 
-                // Return NaN.
-                ? NaN
 
-                // Either Infinity?
-                : !xc || !yc
+    /*
+     * Return a string representing the value of this BigNumber in fixed-point notation rounding
+     * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.
+     *
+     * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',
+     * but e.g. (-0.00001).toFixed(0) is '-0'.
+     *
+     * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.
+     * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+     *
+     * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'
+     */
+    P.toFixed = function (dp, rm) {
+      if (dp != null) {
+        intCheck(dp, 0, MAX);
+        dp = dp + this.e + 1;
+      }
+      return format(this, dp, rm);
+    };
 
-                  // Return +-Infinity.
-                  ? y['s'] / 0
 
-                  // x or y is 0. Return +-0.
-                  : y['s'] * 0 )
-        }
-        y['e'] = i + j;
-
-        if ( ( a = xc.length ) < ( b = yc.length ) ) {
-            c = xc, xc = yc, yc = c, j = a, a = b, b = j
+    /*
+     * Return a string representing the value of this BigNumber in fixed-point notation rounded
+     * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties
+     * of the format or FORMAT object (see BigNumber.set).
+     *
+     * The formatting object may contain some or all of the properties shown below.
+     *
+     * FORMAT = {
+     *   prefix: '',
+     *   groupSize: 3,
+     *   secondaryGroupSize: 0,
+     *   groupSeparator: ',',
+     *   decimalSeparator: '.',
+     *   fractionGroupSize: 0,
+     *   fractionGroupSeparator: '\xA0',      // non-breaking space
+     *   suffix: ''
+     * };
+     *
+     * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.
+     * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+     * [format] {object} Formatting options. See FORMAT pbject above.
+     *
+     * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'
+     * '[BigNumber Error] Argument not an object: {format}'
+     */
+    P.toFormat = function (dp, rm, format) {
+      var str,
+        x = this;
+
+      if (format == null) {
+        if (dp != null && rm && typeof rm == 'object') {
+          format = rm;
+          rm = null;
+        } else if (dp && typeof dp == 'object') {
+          format = dp;
+          dp = rm = null;
+        } else {
+          format = FORMAT;
         }
+      } else if (typeof format != 'object') {
+        throw Error
+          (bignumberError + 'Argument not an object: ' + format);
+      }
+
+      str = x.toFixed(dp, rm);
+
+      if (x.c) {
+        var i,
+          arr = str.split('.'),
+          g1 = +format.groupSize,
+          g2 = +format.secondaryGroupSize,
+          groupSeparator = format.groupSeparator || '',
+          intPart = arr[0],
+          fractionPart = arr[1],
+          isNeg = x.s < 0,
+          intDigits = isNeg ? intPart.slice(1) : intPart,
+          len = intDigits.length;
+
+        if (g2) i = g1, g1 = g2, g2 = i, len -= i;
+
+        if (g1 > 0 && len > 0) {
+          i = len % g1 || g1;
+          intPart = intDigits.substr(0, i);
+          for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);
+          if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);
+          if (isNeg) intPart = '-' + intPart;
+        }
+
+        str = fractionPart
+         ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize)
+          ? fractionPart.replace(new RegExp('\\d{' + g2 + '}\\B', 'g'),
+           '$&' + (format.fractionGroupSeparator || ''))
+          : fractionPart)
+         : intPart;
+      }
+
+      return (format.prefix || '') + str + (format.suffix || '');
+    };
 
-        for ( j = a + b, c = []; j--; c.push(0) ) {
-        }
 
-        // Multiply!
-        for ( i = b - 1; i > -1; i-- ) {
+    /*
+     * Return an array of two BigNumbers 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 the specified
+     * maximum denominator. If a maximum denominator is not specified, the denominator will be
+     * the lowest value necessary to represent the number exactly.
+     *
+     * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.
+     *
+     * '[BigNumber Error] Argument {not an integer|out of range} : {md}'
+     */
+    P.toFraction = function (md) {
+      var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s,
+        x = this,
+        xc = x.c;
 
-            for ( b = 0, j = a + i;
-                  j > i;
-                  b = c[j] + yc[i] * xc[j - i - 1] + b,
-                  c[j--] = b % 10 | 0,
-                  b = b / 10 | 0 ) {
-            }
+      if (md != null) {
+        n = new BigNumber(md);
 
-            if ( b ) {
-                c[j] = ( c[j] + b ) % 10
-            }
+        // Throw if md is less than one or is not an integer, unless it is Infinity.
+        if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {
+          throw Error
+            (bignumberError + 'Argument ' +
+              (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));
         }
+      }
 
-        b && ++y['e'];
+      if (!xc) return new BigNumber(x);
 
-        // Remove any leading zero.
-        !c[0] && c.shift();
+      d = new BigNumber(ONE);
+      n1 = d0 = new BigNumber(ONE);
+      d1 = n0 = new BigNumber(ONE);
+      s = coeffToString(xc);
 
-        // Remove trailing zeros.
-        for ( j = c.length; !c[--j]; c.pop() ) {
-        }
+      // Determine initial denominator.
+      // d is a power of 10 and the minimum max denominator that specifies the value exactly.
+      e = d.e = s.length - x.e - 1;
+      d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];
+      md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;
 
-        // No zero check needed as only x * 0 == 0 etc.
+      exp = MAX_EXP;
+      MAX_EXP = 1 / 0;
+      n = new BigNumber(s);
 
-        // Overflow?
-        y['c'] = y['e'] > MAX_EXP
+      // n0 = d1 = 0
+      n0.c[0] = 0;
 
-          // Infinity.
-          ? ( y['e'] = null )
+      for (; ;)  {
+        q = div(n, d, 0, 1);
+        d2 = d0.plus(q.times(d1));
+        if (d2.comparedTo(md) == 1) break;
+        d0 = d1;
+        d1 = d2;
+        n1 = n0.plus(q.times(d2 = n1));
+        n0 = d2;
+        d = n.minus(q.times(d2 = d));
+        n = d2;
+      }
 
-          // Underflow?
-          : y['e'] < MIN_EXP
+      d2 = div(md.minus(d0), d1, 0, 1);
+      n0 = n0.plus(d2.times(n1));
+      d0 = d0.plus(d2.times(d1));
+      n0.s = n1.s = x.s;
+      e = e * 2;
 
-            // Zero.
-            ? [ y['e'] = 0 ]
+      // Determine which fraction is closer to x, n0/d0 or n1/d1
+      r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(
+          div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];
 
-            // Neither.
-            : c;
+      MAX_EXP = exp;
 
-        return y
+      return r;
     };
 
 
     /*
-     * Return a string representing the value of this BigNumber in exponential
-     * notation to dp fixed decimal places and rounded using ROUNDING_MODE if
-     * necessary.
-     *
-     * [dp] {number} Integer, 0 to MAX inclusive.
+     * Return the value of this BigNumber converted to a number primitive.
      */
-    P['toExponential'] = P['toE'] = function ( dp ) {
-
-        return format( this,
-          ( dp == null || ( ( outOfRange = dp < 0 || dp > MAX ) ||
-
-            /*
-             * Include '&& dp !== 0' because with Opera -0 == parseFloat(-0) is
-             * false, despite -0 == parseFloat('-0') && 0 == -0 being true.
-             */
-            parse(dp) != dp && dp !== 0 ) &&
-
-              // 'toE() decimal places not an integer: {dp}'
-              // 'toE() decimal places out of range: {dp}'
-              !ifExceptionsThrow( dp, 'decimal places', 'toE' ) ) && this['c']
-                ? this['c'].length - 1
-                : dp | 0, 1 )
+    P.toNumber = function () {
+      return +valueOf(this);
     };
 
 
     /*
-     * Return a string representing the value of this BigNumber in normal
-     * notation to dp fixed decimal places and rounded using ROUNDING_MODE if
-     * necessary.
+     * Return a string representing the value of this BigNumber rounded to sd significant digits
+     * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits
+     * necessary to represent the integer part of the value in fixed-point notation, then use
+     * exponential notation.
      *
-     * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',
-     * but e.g. (-0.00001).toFixed(0) is '-0'.
+     * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.
+     * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
      *
-     * [dp] {number} Integer, 0 to MAX inclusive.
+     * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'
      */
-    P['toFixed'] = P['toF'] = function ( dp ) {
-        var n, str, d,
-            x = this;
+    P.toPrecision = function (sd, rm) {
+      if (sd != null) intCheck(sd, 1, MAX);
+      return format(this, sd, rm, 2);
+    };
 
-        if ( !( dp == null || ( ( outOfRange = dp < 0 || dp > MAX ) ||
-            parse(dp) != dp && dp !== 0 ) &&
 
-            // 'toF() decimal places not an integer: {dp}'
-            // 'toF() decimal places out of range: {dp}'
-            !ifExceptionsThrow( dp, 'decimal places', 'toF' ) ) ) {
-              d = x['e'] + ( dp | 0 )
+    /*
+     * Return a string representing the value of this BigNumber in base b, or base 10 if b is
+     * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and
+     * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent
+     * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than
+     * TO_EXP_NEG, return exponential notation.
+     *
+     * [b] {number} Integer, 2 to ALPHABET.length inclusive.
+     *
+     * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'
+     */
+    P.toString = function (b) {
+      var str,
+        n = this,
+        s = n.s,
+        e = n.e;
+
+      // Infinity or NaN?
+      if (e === null) {
+        if (s) {
+          str = 'Infinity';
+          if (s < 0) str = '-' + str;
+        } else {
+          str = 'NaN';
         }
-
-        n = TO_EXP_NEG, dp = TO_EXP_POS;
-        TO_EXP_NEG = -( TO_EXP_POS = 1 / 0 );
-
-        // Note: str is initially undefined.
-        if ( d == str ) {
-            str = x['toS']()
+      } else {
+        if (b == null) {
+          str = e <= TO_EXP_NEG || e >= TO_EXP_POS
+           ? toExponential(coeffToString(n.c), e)
+           : toFixedPoint(coeffToString(n.c), e, '0');
+        } else if (b === 10) {
+          n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);
+          str = toFixedPoint(coeffToString(n.c), n.e, '0');
         } else {
-            str = format( x, d );
-
-            // (-0).toFixed() is '0', but (-0.1).toFixed() is '-0'.
-            // (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
-            if ( x['s'] < 0 && x['c'] ) {
-
-                // As e.g. -0 toFixed(3), will wrongly be returned as -0.000 from toString.
-                if ( !x['c'][0] ) {
-                    str = str.replace(/^-/, '')
-
-                // As e.g. -0.5 if rounded to -0 will cause toString to omit the minus sign.
-                } else if ( str.indexOf('-') < 0 ) {
-                    str = '-' + str
-                }
-            }
+          intCheck(b, 2, ALPHABET.length, 'Base');
+          str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);
         }
-        TO_EXP_NEG = n, TO_EXP_POS = dp;
 
-        return str
+        if (s < 0 && n.c[0]) str = '-' + str;
+      }
+
+      return str;
     };
 
 
     /*
-     * Return 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
-     * the specified maximum denominator. If a maximum denominator is not
-     * specified, the denominator will be the lowest value necessary to
-     * represent the number exactly.
-     *
-     * [maxD] {number|string|BigNumber} Integer >= 1 and < Infinity.
+     * Return as toString, but do not accept a base argument, and include the minus sign for
+     * negative zero.
      */
-    P['toFraction'] = P['toFr'] = function ( maxD ) {
-        var q, frac, n0, d0, d2, n, e,
-            n1 = d0 = new BigNumber(ONE),
-            d1 = n0 = new BigNumber('0'),
-            x = this,
-            xc = x['c'],
-            exp = MAX_EXP,
-            dp = DECIMAL_PLACES,
-            rm = ROUNDING_MODE,
-            d = new BigNumber(ONE);
-
-        // NaN, Infinity.
-        if ( !xc ) {
-            return x['toS']()
-        }
-
-        e = d['e'] = xc.length - x['e'] - 1;
-
-        // If max denominator is undefined or null...
-        if ( maxD == null ||
+    P.valueOf = P.toJSON = function () {
+      return valueOf(this);
+    };
 
-             // or NaN...
-             ( !( id = 12, n = new BigNumber(maxD) )['s'] ||
 
-               // or less than 1, or Infinity...
-               ( outOfRange = n['cmp'](n1) < 0 || !n['c'] ) ||
+    P._isBigNumber = true;
 
-                 // or not an integer...
-                 ( ERRORS && n['e'] < n['c'].length - 1 ) ) &&
+    if (typeof Symbol == 'function' && typeof Symbol.iterator == 'symbol') {
+      P[Symbol.toStringTag] = 'BigNumber';
+      // Node.js v10.12.0+
+      P[Symbol.for('nodejs.util.inspect.custom')] = P.valueOf;
+    }
 
-                   // 'toFr() max denominator not an integer: {maxD}'
-                   // 'toFr() max denominator out of range: {maxD}'
-                   !ifExceptionsThrow( maxD, 'max denominator', 'toFr' ) ||
+    if (configObject != null) BigNumber.set(configObject);
 
-                     // or greater than the maxD needed to specify the value exactly...
-                     ( maxD = n )['cmp'](d) > 0 ) {
+    return BigNumber;
+  }
 
-            // d is e.g. 10, 100, 1000, 10000... , n1 is 1.
-            maxD = e > 0 ? d : n1
-        }
 
-        MAX_EXP = 1 / 0;
-        n = new BigNumber( xc.join('') );
+  // PRIVATE HELPER FUNCTIONS
 
-        for ( DECIMAL_PLACES = 0, ROUNDING_MODE = 1; ; )  {
-            q = n['div'](d);
-            d2 = d0['plus']( q['times'](d1) );
 
-            if ( d2['cmp'](maxD) == 1 ) {
-                break
-            }
+  function bitFloor(n) {
+    var i = n | 0;
+    return n > 0 || n === i ? i : i - 1;
+  }
 
-            d0 = d1, d1 = d2;
 
-            n1 = n0['plus']( q['times']( d2 = n1 ) );
-            n0 = d2;
+  // Return a coefficient array as a string of base 10 digits.
+  function coeffToString(a) {
+    var s, z,
+      i = 1,
+      j = a.length,
+      r = a[0] + '';
 
-            d = n['minus']( q['times']( d2 = d ) );
-            n = d2
-        }
+    for (; i < j;) {
+      s = a[i++] + '';
+      z = LOG_BASE - s.length;
+      for (; z--; s = '0' + s);
+      r += s;
+    }
 
-        d2 = maxD['minus'](d0)['div'](d1);
-        n0 = n0['plus']( d2['times'](n1) );
-        d0 = d0['plus']( d2['times'](d1) );
+    // Determine trailing zeros.
+    for (j = r.length; r.charCodeAt(--j) === 48;);
 
-        n0['s'] = n1['s'] = x['s'];
+    return r.slice(0, j + 1 || 1);
+  }
 
-        DECIMAL_PLACES = e * 2;
-        ROUNDING_MODE = rm;
 
-        // Determine which fraction is closer to x, n0 / d0 or n1 / d1?
-        frac = n1['div'](d1)['minus'](x)['abs']()['cmp'](
-          n0['div'](d0)['minus'](x)['abs']() ) < 1
-          ? [ n1['toS'](), d1['toS']() ]
-          : [ n0['toS'](), d0['toS']() ];
+  // Compare the value of BigNumbers x and y.
+  function compare(x, y) {
+    var a, b,
+      xc = x.c,
+      yc = y.c,
+      i = x.s,
+      j = y.s,
+      k = x.e,
+      l = y.e;
 
-        return MAX_EXP = exp, DECIMAL_PLACES = dp, frac
-    };
+    // Either NaN?
+    if (!i || !j) return null;
 
+    a = xc && !xc[0];
+    b = yc && !yc[0];
 
-    /*
-     * Return a string representing the value of this BigNumber to sd significant
-     * digits and rounded using ROUNDING_MODE if necessary.
-     * If sd is less than the number of digits necessary to represent the integer
-     * part of the value in normal notation, then use exponential notation.
-     *
-     * sd {number} Integer, 1 to MAX inclusive.
-     */
-    P['toPrecision'] = P['toP'] = function ( sd ) {
+    // Either zero?
+    if (a || b) return a ? b ? 0 : -j : i;
 
-        /*
-         * ERRORS true: Throw if sd not undefined, null or an integer in range.
-         * ERRORS false: Ignore sd if not a number or not in range.
-         * Truncate non-integers.
-         */
-        return sd == null || ( ( ( outOfRange = sd < 1 || sd > MAX ) ||
-          parse(sd) != sd ) &&
+    // Signs differ?
+    if (i != j) return i;
 
-            // 'toP() precision not an integer: {sd}'
-            // 'toP() precision out of range: {sd}'
-            !ifExceptionsThrow( sd, 'precision', 'toP' ) )
-              ? this['toS']()
-              : format( this, --sd | 0, 2 )
-    };
+    a = i < 0;
+    b = k == l;
 
+    // Either Infinity?
+    if (!xc || !yc) return b ? 0 : !xc ^ a ? 1 : -1;
 
-    /*
-     * Return a string representing the value of this BigNumber in base b, or
-     * base 10 if b is omitted. If a base is specified, including base 10,
-     * round according to DECIMAL_PLACES and ROUNDING_MODE.
-     * If a base is not specified, and this BigNumber has a positive exponent
-     * that is equal to or greater than TO_EXP_POS, or a negative exponent equal
-     * to or less than TO_EXP_NEG, return exponential notation.
-     *
-     * [b] {number} Integer, 2 to 64 inclusive.
-     */
-    P['toString'] = P['toS'] = function ( b ) {
-        var u, str, strL,
-            x = this,
-            xe = x['e'];
+    // Compare exponents.
+    if (!b) return k > l ^ a ? 1 : -1;
 
-        // Infinity or NaN?
-        if ( xe === null ) {
-            str = x['s'] ? 'Infinity' : 'NaN'
+    j = (k = xc.length) < (l = yc.length) ? k : l;
 
-        // Exponential format?
-        } else if ( b === u && ( xe <= TO_EXP_NEG || xe >= TO_EXP_POS ) ) {
-            return format( x, x['c'].length - 1, 1 )
-        } else {
-            str = x['c'].join('');
+    // Compare digit by digit.
+    for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1;
 
-            // Negative exponent?
-            if ( xe < 0 ) {
+    // Compare lengths.
+    return k == l ? 0 : k > l ^ a ? 1 : -1;
+  }
 
-                // Prepend zeros.
-                for ( ; ++xe; str = '0' + str ) {
-                }
-                str = '0.' + str
 
-            // Positive exponent?
-            } else if ( strL = str.length, xe > 0 ) {
-
-                if ( ++xe > strL ) {
+  /*
+   * Check that n is a primitive number, an integer, and in range, otherwise throw.
+   */
+  function intCheck(n, min, max, name) {
+    if (n < min || n > max || n !== (n < 0 ? mathceil(n) : mathfloor(n))) {
+      throw Error
+       (bignumberError + (name || 'Argument') + (typeof n == 'number'
+         ? n < min || n > max ? ' out of range: ' : ' not an integer: '
+         : ' not a primitive number: ') + String(n));
+    }
+  }
 
-                    // Append zeros.
-                    for ( xe -= strL; xe-- ; str += '0' ) {
-                    }
-                } else if ( xe < strL ) {
-                    str = str.slice( 0, xe ) + '.' + str.slice(xe)
-                }
 
-            // Exponent zero.
-            } else {
-                if ( u = str.charAt(0), strL > 1 ) {
-                    str = u + '.' + str.slice(1)
+  // Assumes finite n.
+  function isOdd(n) {
+    var k = n.c.length - 1;
+    return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0;
+  }
 
-                // Avoid '-0'
-                } else if ( u == '0' ) {
-                    return u
-                }
-            }
 
-            if ( b != null ) {
+  function toExponential(str, e) {
+    return (str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str) +
+     (e < 0 ? 'e' : 'e+') + e;
+  }
 
-                if ( !( outOfRange = !( b >= 2 && b < 65 ) ) &&
-                  ( b == (b | 0) || !ERRORS ) ) {
-                    str = convert( str, b | 0, 10, x['s'] );
-
-                    // Avoid '-0'
-                    if ( str == '0' ) {
-                        return str
-                    }
-                } else {
 
-                    // 'toS() base not an integer: {b}'
-                    // 'toS() base out of range: {b}'
-                    ifExceptionsThrow( b, 'base', 'toS' )
-                }
-            }
+  function toFixedPoint(str, e, z) {
+    var len, zs;
 
-        }
+    // Negative exponent?
+    if (e < 0) {
 
-        return x['s'] < 0 ? '-' + str : str
-    };
+      // Prepend zeros.
+      for (zs = z + '.'; ++e; zs += z);
+      str = zs + str;
 
+    // Positive exponent
+    } else {
+      len = str.length;
 
-    /*
-     * Return as toString, but do not accept a base argument.
-     */
-    P['valueOf'] = function () {
-        return this['toS']()
-    };
+      // Append zeros.
+      if (++e > len) {
+        for (zs = z, e -= len; --e; zs += z);
+        str += zs;
+      } else if (e < len) {
+        str = str.slice(0, e) + '.' + str.slice(e);
+      }
+    }
 
+    return str;
+  }
 
-    // Add aliases for BigDecimal methods.
-    //P['add'] = P['plus'];
-    //P['subtract'] = P['minus'];
-    //P['multiply'] = P['times'];
-    //P['divide'] = P['div'];
-    //P['remainder'] = P['mod'];
-    //P['compareTo'] = P['cmp'];
-    //P['negate'] = P['neg'];
 
+  // EXPORT
 
-    // EXPORT
 
+  BigNumber = clone();
+  BigNumber['default'] = BigNumber.BigNumber = BigNumber;
 
-    // Node and other CommonJS-like environments that support module.exports.
-    if ( typeof module !== 'undefined' && module.exports ) {
-        module.exports = BigNumber
+  // AMD.
+  if (typeof define == 'function' && define.amd) {
+    define(function () { return BigNumber; });
 
-    //AMD.
-    } else if ( typeof define == 'function' && define.amd ) {
-        define( function () {
-            return BigNumber
-        })
+  // Node.js and other environments that support module.exports.
+  } else if (typeof module != 'undefined' && module.exports) {
+    module.exports = BigNumber;
 
-    //Browser.
-    } else {
-        global['BigNumber'] = BigNumber
+  // Browser.
+  } else {
+    if (!globalObject) {
+      globalObject = typeof self != 'undefined' && self ? self : window;
     }
 
-})( this );
-
+    globalObject.BigNumber = BigNumber;
+  }
+})(this);
diff -pruN 1.3.0+dfsg-1/bignumber.mjs 8.0.2+ds-1/bignumber.mjs
--- 1.3.0+dfsg-1/bignumber.mjs	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/bignumber.mjs	2019-01-13 22:17:07.000000000 +0000
@@ -0,0 +1,2832 @@
+/*
+ *      bignumber.js v8.0.2
+ *      A JavaScript library for arbitrary-precision arithmetic.
+ *      https://github.com/MikeMcl/bignumber.js
+ *      Copyright (c) 2019 Michael Mclaughlin <M8ch88l@gmail.com>
+ *      MIT Licensed.
+ *
+ *      BigNumber.prototype methods     |  BigNumber methods
+ *                                      |
+ *      absoluteValue            abs    |  clone
+ *      comparedTo                      |  config               set
+ *      decimalPlaces            dp     |      DECIMAL_PLACES
+ *      dividedBy                div    |      ROUNDING_MODE
+ *      dividedToIntegerBy       idiv   |      EXPONENTIAL_AT
+ *      exponentiatedBy          pow    |      RANGE
+ *      integerValue                    |      CRYPTO
+ *      isEqualTo                eq     |      MODULO_MODE
+ *      isFinite                        |      POW_PRECISION
+ *      isGreaterThan            gt     |      FORMAT
+ *      isGreaterThanOrEqualTo   gte    |      ALPHABET
+ *      isInteger                       |  isBigNumber
+ *      isLessThan               lt     |  maximum              max
+ *      isLessThanOrEqualTo      lte    |  minimum              min
+ *      isNaN                           |  random
+ *      isNegative                      |  sum
+ *      isPositive                      |
+ *      isZero                          |
+ *      minus                           |
+ *      modulo                   mod    |
+ *      multipliedBy             times  |
+ *      negated                         |
+ *      plus                            |
+ *      precision                sd     |
+ *      shiftedBy                       |
+ *      squareRoot               sqrt   |
+ *      toExponential                   |
+ *      toFixed                         |
+ *      toFormat                        |
+ *      toFraction                      |
+ *      toJSON                          |
+ *      toNumber                        |
+ *      toPrecision                     |
+ *      toString                        |
+ *      valueOf                         |
+ *
+ */
+
+
+var isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,
+
+  mathceil = Math.ceil,
+  mathfloor = Math.floor,
+
+  bignumberError = '[BigNumber Error] ',
+  tooManyDigits = bignumberError + 'Number primitive has more than 15 significant digits: ',
+
+  BASE = 1e14,
+  LOG_BASE = 14,
+  MAX_SAFE_INTEGER = 0x1fffffffffffff,         // 2^53 - 1
+  // MAX_INT32 = 0x7fffffff,                   // 2^31 - 1
+  POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13],
+  SQRT_BASE = 1e7,
+
+  // EDITABLE
+  // The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and
+  // the arguments to toExponential, toFixed, toFormat, and toPrecision.
+  MAX = 1E9;                                   // 0 to MAX_INT32
+
+
+/*
+ * Create and return a BigNumber constructor.
+ */
+function clone(configObject) {
+  var div, convertBase, parseNumeric,
+    P = BigNumber.prototype = { constructor: BigNumber, toString: null, valueOf: null },
+    ONE = new BigNumber(1),
+
+
+    //----------------------------- EDITABLE CONFIG DEFAULTS -------------------------------
+
+
+    // The default values below must be integers within the inclusive ranges stated.
+    // The values can also be changed at run-time using BigNumber.set.
+
+    // The maximum number of decimal places for operations involving division.
+    DECIMAL_PLACES = 20,                     // 0 to MAX
+
+    // The rounding mode used when rounding to the above decimal places, and when using
+    // toExponential, toFixed, toFormat and toPrecision, and round (default value).
+    // UP         0 Away from zero.
+    // DOWN       1 Towards zero.
+    // CEIL       2 Towards +Infinity.
+    // FLOOR      3 Towards -Infinity.
+    // HALF_UP    4 Towards nearest neighbour. If equidistant, up.
+    // HALF_DOWN  5 Towards nearest neighbour. If equidistant, down.
+    // HALF_EVEN  6 Towards nearest neighbour. If equidistant, towards even neighbour.
+    // HALF_CEIL  7 Towards nearest neighbour. If equidistant, towards +Infinity.
+    // HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
+    ROUNDING_MODE = 4,                       // 0 to 8
+
+    // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]
+
+    // The exponent value at and beneath which toString returns exponential notation.
+    // Number type: -7
+    TO_EXP_NEG = -7,                         // 0 to -MAX
+
+    // The exponent value at and above which toString returns exponential notation.
+    // Number type: 21
+    TO_EXP_POS = 21,                         // 0 to MAX
+
+    // RANGE : [MIN_EXP, MAX_EXP]
+
+    // The minimum exponent value, beneath which underflow to zero occurs.
+    // Number type: -324  (5e-324)
+    MIN_EXP = -1e7,                          // -1 to -MAX
+
+    // The maximum exponent value, above which overflow to Infinity occurs.
+    // Number type:  308  (1.7976931348623157e+308)
+    // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.
+    MAX_EXP = 1e7,                           // 1 to MAX
+
+    // Whether to use cryptographically-secure random number generation, if available.
+    CRYPTO = false,                          // true or false
+
+    // The modulo mode used when calculating the modulus: a mod n.
+    // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
+    // The remainder (r) is calculated as: r = a - n * q.
+    //
+    // UP        0 The remainder is positive if the dividend is negative, else is negative.
+    // DOWN      1 The remainder has the same sign as the dividend.
+    //             This modulo mode is commonly known as 'truncated division' and is
+    //             equivalent to (a % n) in JavaScript.
+    // FLOOR     3 The remainder has the same sign as the divisor (Python %).
+    // HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.
+    // EUCLID    9 Euclidian division. q = sign(n) * floor(a / abs(n)).
+    //             The remainder is always positive.
+    //
+    // The truncated division, floored division, Euclidian division and IEEE 754 remainder
+    // modes are commonly used for the modulus operation.
+    // Although the other rounding modes can also be used, they may not give useful results.
+    MODULO_MODE = 1,                         // 0 to 9
+
+    // The maximum number of significant digits of the result of the exponentiatedBy operation.
+    // If POW_PRECISION is 0, there will be unlimited significant digits.
+    POW_PRECISION = 0,                    // 0 to MAX
+
+    // The format specification used by the BigNumber.prototype.toFormat method.
+    FORMAT = {
+      prefix: '',
+      groupSize: 3,
+      secondaryGroupSize: 0,
+      groupSeparator: ',',
+      decimalSeparator: '.',
+      fractionGroupSize: 0,
+      fractionGroupSeparator: '\xA0',      // non-breaking space
+      suffix: ''
+    },
+
+    // The alphabet used for base conversion. It must be at least 2 characters long, with no '+',
+    // '-', '.', whitespace, or repeated character.
+    // '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'
+    ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';
+
+
+  //------------------------------------------------------------------------------------------
+
+
+  // CONSTRUCTOR
+
+
+  /*
+   * The BigNumber constructor and exported function.
+   * Create and return a new instance of a BigNumber object.
+   *
+   * n {number|string|BigNumber} A numeric value.
+   * [b] {number} The base of n. Integer, 2 to ALPHABET.length inclusive.
+   */
+  function BigNumber(n, b) {
+    var alphabet, c, caseChanged, e, i, isNum, len, str,
+      x = this;
+
+    // Enable constructor usage without new.
+    if (!(x instanceof BigNumber)) {
+
+      // Don't throw on constructor call without new (#81).
+      // '[BigNumber Error] Constructor call without new: {n}'
+      //throw Error(bignumberError + ' Constructor call without new: ' + n);
+      return new BigNumber(n, b);
+    }
+
+    if (b == null) {
+
+      // Duplicate.
+      if (n instanceof BigNumber) {
+        x.s = n.s;
+        x.e = n.e;
+        x.c = (n = n.c) ? n.slice() : n;
+        return;
+      }
+
+      isNum = typeof n == 'number';
+
+      if (isNum && n * 0 == 0) {
+
+        // Use `1 / n` to handle minus zero also.
+        x.s = 1 / n < 0 ? (n = -n, -1) : 1;
+
+        // Faster path for integers.
+        if (n === ~~n) {
+          for (e = 0, i = n; i >= 10; i /= 10, e++);
+          x.e = e;
+          x.c = [n];
+          return;
+        }
+
+        str = String(n);
+      } else {
+        str = String(n);
+        if (!isNumeric.test(str)) return parseNumeric(x, str, isNum);
+        x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;
+      }
+
+      // Decimal point?
+        if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
+
+        // Exponential form?
+        if ((i = str.search(/e/i)) > 0) {
+
+          // Determine exponent.
+          if (e < 0) e = i;
+          e += +str.slice(i + 1);
+          str = str.substring(0, i);
+        } else if (e < 0) {
+
+          // Integer.
+          e = str.length;
+        }
+
+    } else {
+
+      // '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'
+      intCheck(b, 2, ALPHABET.length, 'Base');
+      str = String(n);
+
+      // Allow exponential notation to be used with base 10 argument, while
+      // also rounding to DECIMAL_PLACES as with other bases.
+      if (b == 10) {
+        x = new BigNumber(n instanceof BigNumber ? n : str);
+        return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);
+      }
+
+      isNum = typeof n == 'number';
+
+      if (isNum) {
+
+        // Avoid potential interpretation of Infinity and NaN as base 44+ values.
+        if (n * 0 != 0) return parseNumeric(x, str, isNum, b);
+
+        x.s = 1 / n < 0 ? (str = str.slice(1), -1) : 1;
+
+        // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'
+        if (BigNumber.DEBUG && str.replace(/^0\.0*|\./, '').length > 15) {
+          throw Error
+           (tooManyDigits + n);
+        }
+
+        // Prevent later check for length on converted number.
+        isNum = false;
+      } else {
+        x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
+      }
+
+      alphabet = ALPHABET.slice(0, b);
+      e = i = 0;
+
+      // Check that str is a valid base b number.
+      // Don't use RegExp so alphabet can contain special characters.
+      for (len = str.length; i < len; i++) {
+        if (alphabet.indexOf(c = str.charAt(i)) < 0) {
+          if (c == '.') {
+
+            // If '.' is not the first character and it has not be found before.
+            if (i > e) {
+              e = len;
+              continue;
+            }
+          } else if (!caseChanged) {
+
+            // Allow e.g. hexadecimal 'FF' as well as 'ff'.
+            if (str == str.toUpperCase() && (str = str.toLowerCase()) ||
+                str == str.toLowerCase() && (str = str.toUpperCase())) {
+              caseChanged = true;
+              i = -1;
+              e = 0;
+              continue;
+            }
+          }
+
+          return parseNumeric(x, String(n), isNum, b);
+        }
+      }
+
+      str = convertBase(str, b, 10, x.s);
+
+      // Decimal point?
+      if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
+      else e = str.length;
+    }
+
+    // Determine leading zeros.
+    for (i = 0; str.charCodeAt(i) === 48; i++);
+
+    // Determine trailing zeros.
+    for (len = str.length; str.charCodeAt(--len) === 48;);
+
+    str = str.slice(i, ++len);
+
+    if (str) {
+      len -= i;
+
+      // '[BigNumber Error] Number primitive has more than 15 significant digits: {n}'
+      if (isNum && BigNumber.DEBUG &&
+        len > 15 && (n > MAX_SAFE_INTEGER || n !== mathfloor(n))) {
+          throw Error
+           (tooManyDigits + (x.s * n));
+      }
+
+      e = e - i - 1;
+
+       // Overflow?
+      if (e > MAX_EXP) {
+
+        // Infinity.
+        x.c = x.e = null;
+
+      // Underflow?
+      } else if (e < MIN_EXP) {
+
+        // Zero.
+        x.c = [x.e = 0];
+      } else {
+        x.e = e;
+        x.c = [];
+
+        // Transform base
+
+        // e is the base 10 exponent.
+        // i is where to slice str to get the first element of the coefficient array.
+        i = (e + 1) % LOG_BASE;
+        if (e < 0) i += LOG_BASE;
+
+        if (i < len) {
+          if (i) x.c.push(+str.slice(0, i));
+
+          for (len -= LOG_BASE; i < len;) {
+            x.c.push(+str.slice(i, i += LOG_BASE));
+          }
+
+          str = str.slice(i);
+          i = LOG_BASE - str.length;
+        } else {
+          i -= len;
+        }
+
+        for (; i--; str += '0');
+        x.c.push(+str);
+      }
+    } else {
+
+      // Zero.
+      x.c = [x.e = 0];
+    }
+  }
+
+
+  // CONSTRUCTOR PROPERTIES
+
+
+  BigNumber.clone = clone;
+
+  BigNumber.ROUND_UP = 0;
+  BigNumber.ROUND_DOWN = 1;
+  BigNumber.ROUND_CEIL = 2;
+  BigNumber.ROUND_FLOOR = 3;
+  BigNumber.ROUND_HALF_UP = 4;
+  BigNumber.ROUND_HALF_DOWN = 5;
+  BigNumber.ROUND_HALF_EVEN = 6;
+  BigNumber.ROUND_HALF_CEIL = 7;
+  BigNumber.ROUND_HALF_FLOOR = 8;
+  BigNumber.EUCLID = 9;
+
+
+  /*
+   * Configure infrequently-changing library-wide settings.
+   *
+   * Accept an object with the following optional properties (if the value of a property is
+   * a number, it must be an integer within the inclusive range stated):
+   *
+   *   DECIMAL_PLACES   {number}           0 to MAX
+   *   ROUNDING_MODE    {number}           0 to 8
+   *   EXPONENTIAL_AT   {number|number[]}  -MAX to MAX  or  [-MAX to 0, 0 to MAX]
+   *   RANGE            {number|number[]}  -MAX to MAX (not zero)  or  [-MAX to -1, 1 to MAX]
+   *   CRYPTO           {boolean}          true or false
+   *   MODULO_MODE      {number}           0 to 9
+   *   POW_PRECISION       {number}           0 to MAX
+   *   ALPHABET         {string}           A string of two or more unique characters which does
+   *                                     not contain '.'.
+   *   FORMAT           {object}           An object with some of the following properties:
+   *     prefix                 {string}
+   *     groupSize              {number}
+   *     secondaryGroupSize     {number}
+   *     groupSeparator         {string}
+   *     decimalSeparator       {string}
+   *     fractionGroupSize      {number}
+   *     fractionGroupSeparator {string}
+   *     suffix                 {string}
+   *
+   * (The values assigned to the above FORMAT object properties are not checked for validity.)
+   *
+   * E.g.
+   * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })
+   *
+   * Ignore properties/parameters set to null or undefined, except for ALPHABET.
+   *
+   * Return an object with the properties current values.
+   */
+  BigNumber.config = BigNumber.set = function (obj) {
+    var p, v;
+
+    if (obj != null) {
+
+      if (typeof obj == 'object') {
+
+        // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.
+        // '[BigNumber Error] DECIMAL_PLACES {not a primitive number|not an integer|out of range}: {v}'
+        if (obj.hasOwnProperty(p = 'DECIMAL_PLACES')) {
+          v = obj[p];
+          intCheck(v, 0, MAX, p);
+          DECIMAL_PLACES = v;
+        }
+
+        // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.
+        // '[BigNumber Error] ROUNDING_MODE {not a primitive number|not an integer|out of range}: {v}'
+        if (obj.hasOwnProperty(p = 'ROUNDING_MODE')) {
+          v = obj[p];
+          intCheck(v, 0, 8, p);
+          ROUNDING_MODE = v;
+        }
+
+        // EXPONENTIAL_AT {number|number[]}
+        // Integer, -MAX to MAX inclusive or
+        // [integer -MAX to 0 inclusive, 0 to MAX inclusive].
+        // '[BigNumber Error] EXPONENTIAL_AT {not a primitive number|not an integer|out of range}: {v}'
+        if (obj.hasOwnProperty(p = 'EXPONENTIAL_AT')) {
+          v = obj[p];
+          if (v && v.pop) {
+            intCheck(v[0], -MAX, 0, p);
+            intCheck(v[1], 0, MAX, p);
+            TO_EXP_NEG = v[0];
+            TO_EXP_POS = v[1];
+          } else {
+            intCheck(v, -MAX, MAX, p);
+            TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);
+          }
+        }
+
+        // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or
+        // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].
+        // '[BigNumber Error] RANGE {not a primitive number|not an integer|out of range|cannot be zero}: {v}'
+        if (obj.hasOwnProperty(p = 'RANGE')) {
+          v = obj[p];
+          if (v && v.pop) {
+            intCheck(v[0], -MAX, -1, p);
+            intCheck(v[1], 1, MAX, p);
+            MIN_EXP = v[0];
+            MAX_EXP = v[1];
+          } else {
+            intCheck(v, -MAX, MAX, p);
+            if (v) {
+              MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);
+            } else {
+              throw Error
+               (bignumberError + p + ' cannot be zero: ' + v);
+            }
+          }
+        }
+
+        // CRYPTO {boolean} true or false.
+        // '[BigNumber Error] CRYPTO not true or false: {v}'
+        // '[BigNumber Error] crypto unavailable'
+        if (obj.hasOwnProperty(p = 'CRYPTO')) {
+          v = obj[p];
+          if (v === !!v) {
+            if (v) {
+              if (typeof crypto != 'undefined' && crypto &&
+               (crypto.getRandomValues || crypto.randomBytes)) {
+                CRYPTO = v;
+              } else {
+                CRYPTO = !v;
+                throw Error
+                 (bignumberError + 'crypto unavailable');
+              }
+            } else {
+              CRYPTO = v;
+            }
+          } else {
+            throw Error
+             (bignumberError + p + ' not true or false: ' + v);
+          }
+        }
+
+        // MODULO_MODE {number} Integer, 0 to 9 inclusive.
+        // '[BigNumber Error] MODULO_MODE {not a primitive number|not an integer|out of range}: {v}'
+        if (obj.hasOwnProperty(p = 'MODULO_MODE')) {
+          v = obj[p];
+          intCheck(v, 0, 9, p);
+          MODULO_MODE = v;
+        }
+
+        // POW_PRECISION {number} Integer, 0 to MAX inclusive.
+        // '[BigNumber Error] POW_PRECISION {not a primitive number|not an integer|out of range}: {v}'
+        if (obj.hasOwnProperty(p = 'POW_PRECISION')) {
+          v = obj[p];
+          intCheck(v, 0, MAX, p);
+          POW_PRECISION = v;
+        }
+
+        // FORMAT {object}
+        // '[BigNumber Error] FORMAT not an object: {v}'
+        if (obj.hasOwnProperty(p = 'FORMAT')) {
+          v = obj[p];
+          if (typeof v == 'object') FORMAT = v;
+          else throw Error
+           (bignumberError + p + ' not an object: ' + v);
+        }
+
+        // ALPHABET {string}
+        // '[BigNumber Error] ALPHABET invalid: {v}'
+        if (obj.hasOwnProperty(p = 'ALPHABET')) {
+          v = obj[p];
+
+          // Disallow if only one character,
+          // or if it contains '+', '-', '.', whitespace, or a repeated character.
+          if (typeof v == 'string' && !/^.$|[+-.\s]|(.).*\1/.test(v)) {
+            ALPHABET = v;
+          } else {
+            throw Error
+             (bignumberError + p + ' invalid: ' + v);
+          }
+        }
+
+      } else {
+
+        // '[BigNumber Error] Object expected: {v}'
+        throw Error
+         (bignumberError + 'Object expected: ' + obj);
+      }
+    }
+
+    return {
+      DECIMAL_PLACES: DECIMAL_PLACES,
+      ROUNDING_MODE: ROUNDING_MODE,
+      EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],
+      RANGE: [MIN_EXP, MAX_EXP],
+      CRYPTO: CRYPTO,
+      MODULO_MODE: MODULO_MODE,
+      POW_PRECISION: POW_PRECISION,
+      FORMAT: FORMAT,
+      ALPHABET: ALPHABET
+    };
+  };
+
+
+  /*
+   * Return true if v is a BigNumber instance, otherwise return false.
+   *
+   * v {any}
+   */
+  BigNumber.isBigNumber = function (v) {
+    return Object.prototype.toString.call(v) == '[object BigNumber]';
+  };
+
+
+  /*
+   * Return a new BigNumber whose value is the maximum of the arguments.
+   *
+   * arguments {number|string|BigNumber}
+   */
+  BigNumber.maximum = BigNumber.max = function () {
+    return maxOrMin(arguments, P.lt);
+  };
+
+
+  /*
+   * Return a new BigNumber whose value is the minimum of the arguments.
+   *
+   * arguments {number|string|BigNumber}
+   */
+  BigNumber.minimum = BigNumber.min = function () {
+    return maxOrMin(arguments, P.gt);
+  };
+
+
+  /*
+   * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,
+   * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing
+   * zeros are produced).
+   *
+   * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.
+   *
+   * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp}'
+   * '[BigNumber Error] crypto unavailable'
+   */
+  BigNumber.random = (function () {
+    var pow2_53 = 0x20000000000000;
+
+    // Return a 53 bit integer n, where 0 <= n < 9007199254740992.
+    // Check if Math.random() produces more than 32 bits of randomness.
+    // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.
+    // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.
+    var random53bitInt = (Math.random() * pow2_53) & 0x1fffff
+     ? function () { return mathfloor(Math.random() * pow2_53); }
+     : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +
+       (Math.random() * 0x800000 | 0); };
+
+    return function (dp) {
+      var a, b, e, k, v,
+        i = 0,
+        c = [],
+        rand = new BigNumber(ONE);
+
+      if (dp == null) dp = DECIMAL_PLACES;
+      else intCheck(dp, 0, MAX);
+
+      k = mathceil(dp / LOG_BASE);
+
+      if (CRYPTO) {
+
+        // Browsers supporting crypto.getRandomValues.
+        if (crypto.getRandomValues) {
+
+          a = crypto.getRandomValues(new Uint32Array(k *= 2));
+
+          for (; i < k;) {
+
+            // 53 bits:
+            // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)
+            // 11111 11111111 11111111 11111111 11100000 00000000 00000000
+            // ((Math.pow(2, 32) - 1) >>> 11).toString(2)
+            //                                     11111 11111111 11111111
+            // 0x20000 is 2^21.
+            v = a[i] * 0x20000 + (a[i + 1] >>> 11);
+
+            // Rejection sampling:
+            // 0 <= v < 9007199254740992
+            // Probability that v >= 9e15, is
+            // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251
+            if (v >= 9e15) {
+              b = crypto.getRandomValues(new Uint32Array(2));
+              a[i] = b[0];
+              a[i + 1] = b[1];
+            } else {
+
+              // 0 <= v <= 8999999999999999
+              // 0 <= (v % 1e14) <= 99999999999999
+              c.push(v % 1e14);
+              i += 2;
+            }
+          }
+          i = k / 2;
+
+        // Node.js supporting crypto.randomBytes.
+        } else if (crypto.randomBytes) {
+
+          // buffer
+          a = crypto.randomBytes(k *= 7);
+
+          for (; i < k;) {
+
+            // 0x1000000000000 is 2^48, 0x10000000000 is 2^40
+            // 0x100000000 is 2^32, 0x1000000 is 2^24
+            // 11111 11111111 11111111 11111111 11111111 11111111 11111111
+            // 0 <= v < 9007199254740992
+            v = ((a[i] & 31) * 0x1000000000000) + (a[i + 1] * 0x10000000000) +
+               (a[i + 2] * 0x100000000) + (a[i + 3] * 0x1000000) +
+               (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];
+
+            if (v >= 9e15) {
+              crypto.randomBytes(7).copy(a, i);
+            } else {
+
+              // 0 <= (v % 1e14) <= 99999999999999
+              c.push(v % 1e14);
+              i += 7;
+            }
+          }
+          i = k / 7;
+        } else {
+          CRYPTO = false;
+          throw Error
+           (bignumberError + 'crypto unavailable');
+        }
+      }
+
+      // Use Math.random.
+      if (!CRYPTO) {
+
+        for (; i < k;) {
+          v = random53bitInt();
+          if (v < 9e15) c[i++] = v % 1e14;
+        }
+      }
+
+      k = c[--i];
+      dp %= LOG_BASE;
+
+      // Convert trailing digits to zeros according to dp.
+      if (k && dp) {
+        v = POWS_TEN[LOG_BASE - dp];
+        c[i] = mathfloor(k / v) * v;
+      }
+
+      // Remove trailing elements which are zero.
+      for (; c[i] === 0; c.pop(), i--);
+
+      // Zero?
+      if (i < 0) {
+        c = [e = 0];
+      } else {
+
+        // Remove leading elements which are zero and adjust exponent accordingly.
+        for (e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);
+
+        // Count the digits of the first element of c to determine leading zeros, and...
+        for (i = 1, v = c[0]; v >= 10; v /= 10, i++);
+
+        // adjust the exponent accordingly.
+        if (i < LOG_BASE) e -= LOG_BASE - i;
+      }
+
+      rand.e = e;
+      rand.c = c;
+      return rand;
+    };
+  })();
+
+
+   /*
+   * Return a BigNumber whose value is the sum of the arguments.
+   *
+   * arguments {number|string|BigNumber}
+   */
+  BigNumber.sum = function () {
+    var i = 1,
+      args = arguments,
+      sum = new BigNumber(args[0]);
+    for (; i < args.length;) sum = sum.plus(args[i++]);
+    return sum;
+  };
+
+
+  // PRIVATE FUNCTIONS
+
+
+  // Called by BigNumber and BigNumber.prototype.toString.
+  convertBase = (function () {
+    var decimal = '0123456789';
+
+    /*
+     * Convert string of baseIn to an array of numbers of baseOut.
+     * Eg. toBaseOut('255', 10, 16) returns [15, 15].
+     * Eg. toBaseOut('ff', 16, 10) returns [2, 5, 5].
+     */
+    function toBaseOut(str, baseIn, baseOut, alphabet) {
+      var j,
+        arr = [0],
+        arrL,
+        i = 0,
+        len = str.length;
+
+      for (; i < len;) {
+        for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);
+
+        arr[0] += alphabet.indexOf(str.charAt(i++));
+
+        for (j = 0; j < arr.length; j++) {
+
+          if (arr[j] > baseOut - 1) {
+            if (arr[j + 1] == null) arr[j + 1] = 0;
+            arr[j + 1] += arr[j] / baseOut | 0;
+            arr[j] %= baseOut;
+          }
+        }
+      }
+
+      return arr.reverse();
+    }
+
+    // Convert a numeric string of baseIn to a numeric string of baseOut.
+    // If the caller is toString, we are converting from base 10 to baseOut.
+    // If the caller is BigNumber, we are converting from baseIn to base 10.
+    return function (str, baseIn, baseOut, sign, callerIsToString) {
+      var alphabet, d, e, k, r, x, xc, y,
+        i = str.indexOf('.'),
+        dp = DECIMAL_PLACES,
+        rm = ROUNDING_MODE;
+
+      // Non-integer.
+      if (i >= 0) {
+        k = POW_PRECISION;
+
+        // Unlimited precision.
+        POW_PRECISION = 0;
+        str = str.replace('.', '');
+        y = new BigNumber(baseIn);
+        x = y.pow(str.length - i);
+        POW_PRECISION = k;
+
+        // Convert str as if an integer, then restore the fraction part by dividing the
+        // result by its base raised to a power.
+
+        y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e, '0'),
+         10, baseOut, decimal);
+        y.e = y.c.length;
+      }
+
+      // Convert the number as integer.
+
+      xc = toBaseOut(str, baseIn, baseOut, callerIsToString
+       ? (alphabet = ALPHABET, decimal)
+       : (alphabet = decimal, ALPHABET));
+
+      // xc now represents str as an integer and converted to baseOut. e is the exponent.
+      e = k = xc.length;
+
+      // Remove trailing zeros.
+      for (; xc[--k] == 0; xc.pop());
+
+      // Zero?
+      if (!xc[0]) return alphabet.charAt(0);
+
+      // Does str represent an integer? If so, no need for the division.
+      if (i < 0) {
+        --e;
+      } else {
+        x.c = xc;
+        x.e = e;
+
+        // The sign is needed for correct rounding.
+        x.s = sign;
+        x = div(x, y, dp, rm, baseOut);
+        xc = x.c;
+        r = x.r;
+        e = x.e;
+      }
+
+      // xc now represents str converted to baseOut.
+
+      // THe index of the rounding digit.
+      d = e + dp + 1;
+
+      // The rounding digit: the digit to the right of the digit that may be rounded up.
+      i = xc[d];
+
+      // Look at the rounding digits and mode to determine whether to round up.
+
+      k = baseOut / 2;
+      r = r || d < 0 || xc[d + 1] != null;
+
+      r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))
+            : i > k || i == k &&(rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||
+             rm == (x.s < 0 ? 8 : 7));
+
+      // If the index of the rounding digit is not greater than zero, or xc represents
+      // zero, then the result of the base conversion is zero or, if rounding up, a value
+      // such as 0.00001.
+      if (d < 1 || !xc[0]) {
+
+        // 1^-dp or 0
+        str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
+      } else {
+
+        // Truncate xc to the required number of decimal places.
+        xc.length = d;
+
+        // Round up?
+        if (r) {
+
+          // Rounding up may mean the previous digit has to be rounded up and so on.
+          for (--baseOut; ++xc[--d] > baseOut;) {
+            xc[d] = 0;
+
+            if (!d) {
+              ++e;
+              xc = [1].concat(xc);
+            }
+          }
+        }
+
+        // Determine trailing zeros.
+        for (k = xc.length; !xc[--k];);
+
+        // E.g. [4, 11, 15] becomes 4bf.
+        for (i = 0, str = ''; i <= k; str += alphabet.charAt(xc[i++]));
+
+        // Add leading zeros, decimal point and trailing zeros as required.
+        str = toFixedPoint(str, e, alphabet.charAt(0));
+      }
+
+      // The caller will add the sign.
+      return str;
+    };
+  })();
+
+
+  // Perform division in the specified base. Called by div and convertBase.
+  div = (function () {
+
+    // Assume non-zero x and k.
+    function multiply(x, k, base) {
+      var m, temp, xlo, xhi,
+        carry = 0,
+        i = x.length,
+        klo = k % SQRT_BASE,
+        khi = k / SQRT_BASE | 0;
+
+      for (x = x.slice(); i--;) {
+        xlo = x[i] % SQRT_BASE;
+        xhi = x[i] / SQRT_BASE | 0;
+        m = khi * xlo + xhi * klo;
+        temp = klo * xlo + ((m % SQRT_BASE) * SQRT_BASE) + carry;
+        carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;
+        x[i] = temp % base;
+      }
+
+      if (carry) x = [carry].concat(x);
+
+      return x;
+    }
+
+    function compare(a, b, aL, bL) {
+      var i, cmp;
+
+      if (aL != bL) {
+        cmp = aL > bL ? 1 : -1;
+      } else {
+
+        for (i = cmp = 0; i < aL; i++) {
+
+          if (a[i] != b[i]) {
+            cmp = a[i] > b[i] ? 1 : -1;
+            break;
+          }
+        }
+      }
+
+      return cmp;
+    }
+
+    function subtract(a, b, aL, base) {
+      var i = 0;
+
+      // Subtract b from a.
+      for (; aL--;) {
+        a[aL] -= i;
+        i = a[aL] < b[aL] ? 1 : 0;
+        a[aL] = i * base + a[aL] - b[aL];
+      }
+
+      // Remove leading zeros.
+      for (; !a[0] && a.length > 1; a.splice(0, 1));
+    }
+
+    // x: dividend, y: divisor.
+    return function (x, y, dp, rm, base) {
+      var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,
+        yL, yz,
+        s = x.s == y.s ? 1 : -1,
+        xc = x.c,
+        yc = y.c;
+
+      // Either NaN, Infinity or 0?
+      if (!xc || !xc[0] || !yc || !yc[0]) {
+
+        return new BigNumber(
+
+         // Return NaN if either NaN, or both Infinity or 0.
+         !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN :
+
+          // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
+          xc && xc[0] == 0 || !yc ? s * 0 : s / 0
+       );
+      }
+
+      q = new BigNumber(s);
+      qc = q.c = [];
+      e = x.e - y.e;
+      s = dp + e + 1;
+
+      if (!base) {
+        base = BASE;
+        e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);
+        s = s / LOG_BASE | 0;
+      }
+
+      // Result exponent may be one less then the current value of e.
+      // The coefficients of the BigNumbers from convertBase may have trailing zeros.
+      for (i = 0; yc[i] == (xc[i] || 0); i++);
+
+      if (yc[i] > (xc[i] || 0)) e--;
+
+      if (s < 0) {
+        qc.push(1);
+        more = true;
+      } else {
+        xL = xc.length;
+        yL = yc.length;
+        i = 0;
+        s += 2;
+
+        // Normalise xc and yc so highest order digit of yc is >= base / 2.
+
+        n = mathfloor(base / (yc[0] + 1));
+
+        // Not necessary, but to handle odd bases where yc[0] == (base / 2) - 1.
+        // if (n > 1 || n++ == 1 && yc[0] < base / 2) {
+        if (n > 1) {
+          yc = multiply(yc, n, base);
+          xc = multiply(xc, n, base);
+          yL = yc.length;
+          xL = xc.length;
+        }
+
+        xi = yL;
+        rem = xc.slice(0, yL);
+        remL = rem.length;
+
+        // Add zeros to make remainder as long as divisor.
+        for (; remL < yL; rem[remL++] = 0);
+        yz = yc.slice();
+        yz = [0].concat(yz);
+        yc0 = yc[0];
+        if (yc[1] >= base / 2) yc0++;
+        // Not necessary, but to prevent trial digit n > base, when using base 3.
+        // else if (base == 3 && yc0 == 1) yc0 = 1 + 1e-15;
+
+        do {
+          n = 0;
+
+          // Compare divisor and remainder.
+          cmp = compare(yc, rem, yL, remL);
+
+          // If divisor < remainder.
+          if (cmp < 0) {
+
+            // Calculate trial digit, n.
+
+            rem0 = rem[0];
+            if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
+
+            // n is how many times the divisor goes into the current remainder.
+            n = mathfloor(rem0 / yc0);
+
+            //  Algorithm:
+            //  product = divisor multiplied by trial digit (n).
+            //  Compare product and remainder.
+            //  If product is greater than remainder:
+            //    Subtract divisor from product, decrement trial digit.
+            //  Subtract product from remainder.
+            //  If product was less than remainder at the last compare:
+            //    Compare new remainder and divisor.
+            //    If remainder is greater than divisor:
+            //      Subtract divisor from remainder, increment trial digit.
+
+            if (n > 1) {
+
+              // n may be > base only when base is 3.
+              if (n >= base) n = base - 1;
+
+              // product = divisor * trial digit.
+              prod = multiply(yc, n, base);
+              prodL = prod.length;
+              remL = rem.length;
+
+              // Compare product and remainder.
+              // If product > remainder then trial digit n too high.
+              // n is 1 too high about 5% of the time, and is not known to have
+              // ever been more than 1 too high.
+              while (compare(prod, rem, prodL, remL) == 1) {
+                n--;
+
+                // Subtract divisor from product.
+                subtract(prod, yL < prodL ? yz : yc, prodL, base);
+                prodL = prod.length;
+                cmp = 1;
+              }
+            } else {
+
+              // n is 0 or 1, cmp is -1.
+              // If n is 0, there is no need to compare yc and rem again below,
+              // so change cmp to 1 to avoid it.
+              // If n is 1, leave cmp as -1, so yc and rem are compared again.
+              if (n == 0) {
+
+                // divisor < remainder, so n must be at least 1.
+                cmp = n = 1;
+              }
+
+              // product = divisor
+              prod = yc.slice();
+              prodL = prod.length;
+            }
+
+            if (prodL < remL) prod = [0].concat(prod);
+
+            // Subtract product from remainder.
+            subtract(rem, prod, remL, base);
+            remL = rem.length;
+
+             // If product was < remainder.
+            if (cmp == -1) {
+
+              // Compare divisor and new remainder.
+              // If divisor < new remainder, subtract divisor from remainder.
+              // Trial digit n too low.
+              // n is 1 too low about 5% of the time, and very rarely 2 too low.
+              while (compare(yc, rem, yL, remL) < 1) {
+                n++;
+
+                // Subtract divisor from remainder.
+                subtract(rem, yL < remL ? yz : yc, remL, base);
+                remL = rem.length;
+              }
+            }
+          } else if (cmp === 0) {
+            n++;
+            rem = [0];
+          } // else cmp === 1 and n will be 0
+
+          // Add the next digit, n, to the result array.
+          qc[i++] = n;
+
+          // Update the remainder.
+          if (rem[0]) {
+            rem[remL++] = xc[xi] || 0;
+          } else {
+            rem = [xc[xi]];
+            remL = 1;
+          }
+        } while ((xi++ < xL || rem[0] != null) && s--);
+
+        more = rem[0] != null;
+
+        // Leading zero?
+        if (!qc[0]) qc.splice(0, 1);
+      }
+
+      if (base == BASE) {
+
+        // To calculate q.e, first get the number of digits of qc[0].
+        for (i = 1, s = qc[0]; s >= 10; s /= 10, i++);
+
+        round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);
+
+      // Caller is convertBase.
+      } else {
+        q.e = e;
+        q.r = +more;
+      }
+
+      return q;
+    };
+  })();
+
+
+  /*
+   * Return a string representing the value of BigNumber n in fixed-point or exponential
+   * notation rounded to the specified decimal places or significant digits.
+   *
+   * n: a BigNumber.
+   * i: the index of the last digit required (i.e. the digit that may be rounded up).
+   * rm: the rounding mode.
+   * id: 1 (toExponential) or 2 (toPrecision).
+   */
+  function format(n, i, rm, id) {
+    var c0, e, ne, len, str;
+
+    if (rm == null) rm = ROUNDING_MODE;
+    else intCheck(rm, 0, 8);
+
+    if (!n.c) return n.toString();
+
+    c0 = n.c[0];
+    ne = n.e;
+
+    if (i == null) {
+      str = coeffToString(n.c);
+      str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS)
+       ? toExponential(str, ne)
+       : toFixedPoint(str, ne, '0');
+    } else {
+      n = round(new BigNumber(n), i, rm);
+
+      // n.e may have changed if the value was rounded up.
+      e = n.e;
+
+      str = coeffToString(n.c);
+      len = str.length;
+
+      // toPrecision returns exponential notation if the number of significant digits
+      // specified is less than the number of digits necessary to represent the integer
+      // part of the value in fixed-point notation.
+
+      // Exponential notation.
+      if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {
+
+        // Append zeros?
+        for (; len < i; str += '0', len++);
+        str = toExponential(str, e);
+
+      // Fixed-point notation.
+      } else {
+        i -= ne;
+        str = toFixedPoint(str, e, '0');
+
+        // Append zeros?
+        if (e + 1 > len) {
+          if (--i > 0) for (str += '.'; i--; str += '0');
+        } else {
+          i += e - len;
+          if (i > 0) {
+            if (e + 1 == len) str += '.';
+            for (; i--; str += '0');
+          }
+        }
+      }
+    }
+
+    return n.s < 0 && c0 ? '-' + str : str;
+  }
+
+
+  // Handle BigNumber.max and BigNumber.min.
+  function maxOrMin(args, method) {
+    var n,
+      i = 1,
+      m = new BigNumber(args[0]);
+
+    for (; i < args.length; i++) {
+      n = new BigNumber(args[i]);
+
+      // If any number is NaN, return NaN.
+      if (!n.s) {
+        m = n;
+        break;
+      } else if (method.call(m, n)) {
+        m = n;
+      }
+    }
+
+    return m;
+  }
+
+
+  /*
+   * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.
+   * Called by minus, plus and times.
+   */
+  function normalise(n, c, e) {
+    var i = 1,
+      j = c.length;
+
+     // Remove trailing zeros.
+    for (; !c[--j]; c.pop());
+
+    // Calculate the base 10 exponent. First get the number of digits of c[0].
+    for (j = c[0]; j >= 10; j /= 10, i++);
+
+    // Overflow?
+    if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {
+
+      // Infinity.
+      n.c = n.e = null;
+
+    // Underflow?
+    } else if (e < MIN_EXP) {
+
+      // Zero.
+      n.c = [n.e = 0];
+    } else {
+      n.e = e;
+      n.c = c;
+    }
+
+    return n;
+  }
+
+
+  // Handle values that fail the validity test in BigNumber.
+  parseNumeric = (function () {
+    var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i,
+      dotAfter = /^([^.]+)\.$/,
+      dotBefore = /^\.([^.]+)$/,
+      isInfinityOrNaN = /^-?(Infinity|NaN)$/,
+      whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
+
+    return function (x, str, isNum, b) {
+      var base,
+        s = isNum ? str : str.replace(whitespaceOrPlus, '');
+
+      // No exception on ±Infinity or NaN.
+      if (isInfinityOrNaN.test(s)) {
+        x.s = isNaN(s) ? null : s < 0 ? -1 : 1;
+        x.c = x.e = null;
+      } else {
+        if (!isNum) {
+
+          // basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i
+          s = s.replace(basePrefix, function (m, p1, p2) {
+            base = (p2 = p2.toLowerCase()) == 'x' ? 16 : p2 == 'b' ? 2 : 8;
+            return !b || b == base ? p1 : m;
+          });
+
+          if (b) {
+            base = b;
+
+            // E.g. '1.' to '1', '.1' to '0.1'
+            s = s.replace(dotAfter, '$1').replace(dotBefore, '0.$1');
+          }
+
+          if (str != s) return new BigNumber(s, base);
+        }
+
+        // '[BigNumber Error] Not a number: {n}'
+        // '[BigNumber Error] Not a base {b} number: {n}'
+        if (BigNumber.DEBUG) {
+          throw Error
+            (bignumberError + 'Not a' + (b ? ' base ' + b : '') + ' number: ' + str);
+        }
+
+        // NaN
+        x.c = x.e = x.s = null;
+      }
+    }
+  })();
+
+
+  /*
+   * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.
+   * If r is truthy, it is known that there are more digits after the rounding digit.
+   */
+  function round(x, sd, rm, r) {
+    var d, i, j, k, n, ni, rd,
+      xc = x.c,
+      pows10 = POWS_TEN;
+
+    // if x is not Infinity or NaN...
+    if (xc) {
+
+      // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.
+      // n is a base 1e14 number, the value of the element of array x.c containing rd.
+      // ni is the index of n within x.c.
+      // d is the number of digits of n.
+      // i is the index of rd within n including leading zeros.
+      // j is the actual index of rd within n (if < 0, rd is a leading zero).
+      out: {
+
+        // Get the number of digits of the first element of xc.
+        for (d = 1, k = xc[0]; k >= 10; k /= 10, d++);
+        i = sd - d;
+
+        // If the rounding digit is in the first element of xc...
+        if (i < 0) {
+          i += LOG_BASE;
+          j = sd;
+          n = xc[ni = 0];
+
+          // Get the rounding digit at index j of n.
+          rd = n / pows10[d - j - 1] % 10 | 0;
+        } else {
+          ni = mathceil((i + 1) / LOG_BASE);
+
+          if (ni >= xc.length) {
+
+            if (r) {
+
+              // Needed by sqrt.
+              for (; xc.length <= ni; xc.push(0));
+              n = rd = 0;
+              d = 1;
+              i %= LOG_BASE;
+              j = i - LOG_BASE + 1;
+            } else {
+              break out;
+            }
+          } else {
+            n = k = xc[ni];
+
+            // Get the number of digits of n.
+            for (d = 1; k >= 10; k /= 10, d++);
+
+            // Get the index of rd within n.
+            i %= LOG_BASE;
+
+            // Get the index of rd within n, adjusted for leading zeros.
+            // The number of leading zeros of n is given by LOG_BASE - d.
+            j = i - LOG_BASE + d;
+
+            // Get the rounding digit at index j of n.
+            rd = j < 0 ? 0 : n / pows10[d - j - 1] % 10 | 0;
+          }
+        }
+
+        r = r || sd < 0 ||
+
+        // Are there any non-zero digits after the rounding digit?
+        // The expression  n % pows10[d - j - 1]  returns all digits of n to the right
+        // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
+         xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);
+
+        r = rm < 4
+         ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))
+         : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 &&
+
+          // Check whether the digit to the left of the rounding digit is odd.
+          ((i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10) & 1 ||
+           rm == (x.s < 0 ? 8 : 7));
+
+        if (sd < 1 || !xc[0]) {
+          xc.length = 0;
+
+          if (r) {
+
+            // Convert sd to decimal places.
+            sd -= x.e + 1;
+
+            // 1, 0.1, 0.01, 0.001, 0.0001 etc.
+            xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];
+            x.e = -sd || 0;
+          } else {
+
+            // Zero.
+            xc[0] = x.e = 0;
+          }
+
+          return x;
+        }
+
+        // Remove excess digits.
+        if (i == 0) {
+          xc.length = ni;
+          k = 1;
+          ni--;
+        } else {
+          xc.length = ni + 1;
+          k = pows10[LOG_BASE - i];
+
+          // E.g. 56700 becomes 56000 if 7 is the rounding digit.
+          // j > 0 means i > number of leading zeros of n.
+          xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;
+        }
+
+        // Round up?
+        if (r) {
+
+          for (; ;) {
+
+            // If the digit to be rounded up is in the first element of xc...
+            if (ni == 0) {
+
+              // i will be the length of xc[0] before k is added.
+              for (i = 1, j = xc[0]; j >= 10; j /= 10, i++);
+              j = xc[0] += k;
+              for (k = 1; j >= 10; j /= 10, k++);
+
+              // if i != k the length has increased.
+              if (i != k) {
+                x.e++;
+                if (xc[0] == BASE) xc[0] = 1;
+              }
+
+              break;
+            } else {
+              xc[ni] += k;
+              if (xc[ni] != BASE) break;
+              xc[ni--] = 0;
+              k = 1;
+            }
+          }
+        }
+
+        // Remove trailing zeros.
+        for (i = xc.length; xc[--i] === 0; xc.pop());
+      }
+
+      // Overflow? Infinity.
+      if (x.e > MAX_EXP) {
+        x.c = x.e = null;
+
+      // Underflow? Zero.
+      } else if (x.e < MIN_EXP) {
+        x.c = [x.e = 0];
+      }
+    }
+
+    return x;
+  }
+
+
+  function valueOf(n) {
+    var str,
+      e = n.e;
+
+    if (e === null) return n.toString();
+
+    str = coeffToString(n.c);
+
+    str = e <= TO_EXP_NEG || e >= TO_EXP_POS
+      ? toExponential(str, e)
+      : toFixedPoint(str, e, '0');
+
+    return n.s < 0 ? '-' + str : str;
+  }
+
+
+  // PROTOTYPE/INSTANCE METHODS
+
+
+  /*
+   * Return a new BigNumber whose value is the absolute value of this BigNumber.
+   */
+  P.absoluteValue = P.abs = function () {
+    var x = new BigNumber(this);
+    if (x.s < 0) x.s = 1;
+    return x;
+  };
+
+
+  /*
+   * Return
+   *   1 if the value of this BigNumber is greater than the value of BigNumber(y, b),
+   *   -1 if the value of this BigNumber is less than the value of BigNumber(y, b),
+   *   0 if they have the same value,
+   *   or null if the value of either is NaN.
+   */
+  P.comparedTo = function (y, b) {
+    return compare(this, new BigNumber(y, b));
+  };
+
+
+  /*
+   * If dp is undefined or null or true or false, return the number of decimal places of the
+   * value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.
+   *
+   * Otherwise, if dp is a number, return a new BigNumber whose value is the value of this
+   * BigNumber rounded to a maximum of dp decimal places using rounding mode rm, or
+   * ROUNDING_MODE if rm is omitted.
+   *
+   * [dp] {number} Decimal places: integer, 0 to MAX inclusive.
+   * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+   *
+   * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'
+   */
+  P.decimalPlaces = P.dp = function (dp, rm) {
+    var c, n, v,
+      x = this;
+
+    if (dp != null) {
+      intCheck(dp, 0, MAX);
+      if (rm == null) rm = ROUNDING_MODE;
+      else intCheck(rm, 0, 8);
+
+      return round(new BigNumber(x), dp + x.e + 1, rm);
+    }
+
+    if (!(c = x.c)) return null;
+    n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;
+
+    // Subtract the number of trailing zeros of the last number.
+    if (v = c[v]) for (; v % 10 == 0; v /= 10, n--);
+    if (n < 0) n = 0;
+
+    return n;
+  };
+
+
+  /*
+   *  n / 0 = I
+   *  n / N = N
+   *  n / I = 0
+   *  0 / n = 0
+   *  0 / 0 = N
+   *  0 / N = N
+   *  0 / I = 0
+   *  N / n = N
+   *  N / 0 = N
+   *  N / N = N
+   *  N / I = N
+   *  I / n = I
+   *  I / 0 = I
+   *  I / N = N
+   *  I / I = N
+   *
+   * Return a new BigNumber whose value is the value of this BigNumber divided by the value of
+   * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.
+   */
+  P.dividedBy = P.div = function (y, b) {
+    return div(this, new BigNumber(y, b), DECIMAL_PLACES, ROUNDING_MODE);
+  };
+
+
+  /*
+   * Return a new BigNumber whose value is the integer part of dividing the value of this
+   * BigNumber by the value of BigNumber(y, b).
+   */
+  P.dividedToIntegerBy = P.idiv = function (y, b) {
+    return div(this, new BigNumber(y, b), 0, 1);
+  };
+
+
+  /*
+   * Return a BigNumber whose value is the value of this BigNumber exponentiated by n.
+   *
+   * If m is present, return the result modulo m.
+   * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.
+   * If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using ROUNDING_MODE.
+   *
+   * The modular power operation works efficiently when x, n, and m are integers, otherwise it
+   * is equivalent to calculating x.exponentiatedBy(n).modulo(m) with a POW_PRECISION of 0.
+   *
+   * n {number|string|BigNumber} The exponent. An integer.
+   * [m] {number|string|BigNumber} The modulus.
+   *
+   * '[BigNumber Error] Exponent not an integer: {n}'
+   */
+  P.exponentiatedBy = P.pow = function (n, m) {
+    var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y,
+      x = this;
+
+    n = new BigNumber(n);
+
+    // Allow NaN and ±Infinity, but not other non-integers.
+    if (n.c && !n.isInteger()) {
+      throw Error
+        (bignumberError + 'Exponent not an integer: ' + valueOf(n));
+    }
+
+    if (m != null) m = new BigNumber(m);
+
+    // Exponent of MAX_SAFE_INTEGER is 15.
+    nIsBig = n.e > 14;
+
+    // If x is NaN, ±Infinity, ±0 or ±1, or n is ±Infinity, NaN or ±0.
+    if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {
+
+      // The sign of the result of pow when x is negative depends on the evenness of n.
+      // If +n overflows to ±Infinity, the evenness of n would be not be known.
+      y = new BigNumber(Math.pow(+valueOf(x), nIsBig ? 2 - isOdd(n) : +valueOf(n)));
+      return m ? y.mod(m) : y;
+    }
+
+    nIsNeg = n.s < 0;
+
+    if (m) {
+
+      // x % m returns NaN if abs(m) is zero, or m is NaN.
+      if (m.c ? !m.c[0] : !m.s) return new BigNumber(NaN);
+
+      isModExp = !nIsNeg && x.isInteger() && m.isInteger();
+
+      if (isModExp) x = x.mod(m);
+
+    // Overflow to ±Infinity: >=2**1e10 or >=1.0000024**1e15.
+    // Underflow to ±0: <=0.79**1e10 or <=0.9999975**1e15.
+    } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0
+      // [1, 240000000]
+      ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7
+      // [80000000000000]  [99999750000000]
+      : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {
+
+      // If x is negative and n is odd, k = -0, else k = 0.
+      k = x.s < 0 && isOdd(n) ? -0 : 0;
+
+      // If x >= 1, k = ±Infinity.
+      if (x.e > -1) k = 1 / k;
+
+      // If n is negative return ±0, else return ±Infinity.
+      return new BigNumber(nIsNeg ? 1 / k : k);
+
+    } else if (POW_PRECISION) {
+
+      // Truncating each coefficient array to a length of k after each multiplication
+      // equates to truncating significant digits to POW_PRECISION + [28, 41],
+      // i.e. there will be a minimum of 28 guard digits retained.
+      k = mathceil(POW_PRECISION / LOG_BASE + 2);
+    }
+
+    if (nIsBig) {
+      half = new BigNumber(0.5);
+      if (nIsNeg) n.s = 1;
+      nIsOdd = isOdd(n);
+    } else {
+      i = Math.abs(+valueOf(n));
+      nIsOdd = i % 2;
+    }
+
+    y = new BigNumber(ONE);
+
+    // Performs 54 loop iterations for n of 9007199254740991.
+    for (; ;) {
+
+      if (nIsOdd) {
+        y = y.times(x);
+        if (!y.c) break;
+
+        if (k) {
+          if (y.c.length > k) y.c.length = k;
+        } else if (isModExp) {
+          y = y.mod(m);    //y = y.minus(div(y, m, 0, MODULO_MODE).times(m));
+        }
+      }
+
+      if (i) {
+        i = mathfloor(i / 2);
+        if (i === 0) break;
+        nIsOdd = i % 2;
+      } else {
+        n = n.times(half);
+        round(n, n.e + 1, 1);
+
+        if (n.e > 14) {
+          nIsOdd = isOdd(n);
+        } else {
+          i = +valueOf(n);
+          if (i === 0) break;
+          nIsOdd = i % 2;
+        }
+      }
+
+      x = x.times(x);
+
+      if (k) {
+        if (x.c && x.c.length > k) x.c.length = k;
+      } else if (isModExp) {
+        x = x.mod(m);    //x = x.minus(div(x, m, 0, MODULO_MODE).times(m));
+      }
+    }
+
+    if (isModExp) return y;
+    if (nIsNeg) y = ONE.div(y);
+
+    return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;
+  };
+
+
+  /*
+   * Return a new BigNumber whose value is the value of this BigNumber rounded to an integer
+   * using rounding mode rm, or ROUNDING_MODE if rm is omitted.
+   *
+   * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+   *
+   * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {rm}'
+   */
+  P.integerValue = function (rm) {
+    var n = new BigNumber(this);
+    if (rm == null) rm = ROUNDING_MODE;
+    else intCheck(rm, 0, 8);
+    return round(n, n.e + 1, rm);
+  };
+
+
+  /*
+   * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),
+   * otherwise return false.
+   */
+  P.isEqualTo = P.eq = function (y, b) {
+    return compare(this, new BigNumber(y, b)) === 0;
+  };
+
+
+  /*
+   * Return true if the value of this BigNumber is a finite number, otherwise return false.
+   */
+  P.isFinite = function () {
+    return !!this.c;
+  };
+
+
+  /*
+   * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),
+   * otherwise return false.
+   */
+  P.isGreaterThan = P.gt = function (y, b) {
+    return compare(this, new BigNumber(y, b)) > 0;
+  };
+
+
+  /*
+   * Return true if the value of this BigNumber is greater than or equal to the value of
+   * BigNumber(y, b), otherwise return false.
+   */
+  P.isGreaterThanOrEqualTo = P.gte = function (y, b) {
+    return (b = compare(this, new BigNumber(y, b))) === 1 || b === 0;
+
+  };
+
+
+  /*
+   * Return true if the value of this BigNumber is an integer, otherwise return false.
+   */
+  P.isInteger = function () {
+    return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;
+  };
+
+
+  /*
+   * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),
+   * otherwise return false.
+   */
+  P.isLessThan = P.lt = function (y, b) {
+    return compare(this, new BigNumber(y, b)) < 0;
+  };
+
+
+  /*
+   * Return true if the value of this BigNumber is less than or equal to the value of
+   * BigNumber(y, b), otherwise return false.
+   */
+  P.isLessThanOrEqualTo = P.lte = function (y, b) {
+    return (b = compare(this, new BigNumber(y, b))) === -1 || b === 0;
+  };
+
+
+  /*
+   * Return true if the value of this BigNumber is NaN, otherwise return false.
+   */
+  P.isNaN = function () {
+    return !this.s;
+  };
+
+
+  /*
+   * Return true if the value of this BigNumber is negative, otherwise return false.
+   */
+  P.isNegative = function () {
+    return this.s < 0;
+  };
+
+
+  /*
+   * Return true if the value of this BigNumber is positive, otherwise return false.
+   */
+  P.isPositive = function () {
+    return this.s > 0;
+  };
+
+
+  /*
+   * Return true if the value of this BigNumber is 0 or -0, otherwise return false.
+   */
+  P.isZero = function () {
+    return !!this.c && this.c[0] == 0;
+  };
+
+
+  /*
+   *  n - 0 = n
+   *  n - N = N
+   *  n - I = -I
+   *  0 - n = -n
+   *  0 - 0 = 0
+   *  0 - N = N
+   *  0 - I = -I
+   *  N - n = N
+   *  N - 0 = N
+   *  N - N = N
+   *  N - I = N
+   *  I - n = I
+   *  I - 0 = I
+   *  I - N = N
+   *  I - I = N
+   *
+   * Return a new BigNumber whose value is the value of this BigNumber minus the value of
+   * BigNumber(y, b).
+   */
+  P.minus = function (y, b) {
+    var i, j, t, xLTy,
+      x = this,
+      a = x.s;
+
+    y = new BigNumber(y, b);
+    b = y.s;
+
+    // Either NaN?
+    if (!a || !b) return new BigNumber(NaN);
+
+    // Signs differ?
+    if (a != b) {
+      y.s = -b;
+      return x.plus(y);
+    }
+
+    var xe = x.e / LOG_BASE,
+      ye = y.e / LOG_BASE,
+      xc = x.c,
+      yc = y.c;
+
+    if (!xe || !ye) {
+
+      // Either Infinity?
+      if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber(yc ? x : NaN);
+
+      // Either zero?
+      if (!xc[0] || !yc[0]) {
+
+        // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.
+        return yc[0] ? (y.s = -b, y) : new BigNumber(xc[0] ? x :
+
+         // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
+         ROUNDING_MODE == 3 ? -0 : 0);
+      }
+    }
+
+    xe = bitFloor(xe);
+    ye = bitFloor(ye);
+    xc = xc.slice();
+
+    // Determine which is the bigger number.
+    if (a = xe - ye) {
+
+      if (xLTy = a < 0) {
+        a = -a;
+        t = xc;
+      } else {
+        ye = xe;
+        t = yc;
+      }
+
+      t.reverse();
+
+      // Prepend zeros to equalise exponents.
+      for (b = a; b--; t.push(0));
+      t.reverse();
+    } else {
+
+      // Exponents equal. Check digit by digit.
+      j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;
+
+      for (a = b = 0; b < j; b++) {
+
+        if (xc[b] != yc[b]) {
+          xLTy = xc[b] < yc[b];
+          break;
+        }
+      }
+    }
+
+    // x < y? Point xc to the array of the bigger number.
+    if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;
+
+    b = (j = yc.length) - (i = xc.length);
+
+    // Append zeros to xc if shorter.
+    // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.
+    if (b > 0) for (; b--; xc[i++] = 0);
+    b = BASE - 1;
+
+    // Subtract yc from xc.
+    for (; j > a;) {
+
+      if (xc[--j] < yc[j]) {
+        for (i = j; i && !xc[--i]; xc[i] = b);
+        --xc[i];
+        xc[j] += BASE;
+      }
+
+      xc[j] -= yc[j];
+    }
+
+    // Remove leading zeros and adjust exponent accordingly.
+    for (; xc[0] == 0; xc.splice(0, 1), --ye);
+
+    // Zero?
+    if (!xc[0]) {
+
+      // Following IEEE 754 (2008) 6.3,
+      // n - n = +0  but  n - n = -0  when rounding towards -Infinity.
+      y.s = ROUNDING_MODE == 3 ? -1 : 1;
+      y.c = [y.e = 0];
+      return y;
+    }
+
+    // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity
+    // for finite x and y.
+    return normalise(y, xc, ye);
+  };
+
+
+  /*
+   *   n % 0 =  N
+   *   n % N =  N
+   *   n % I =  n
+   *   0 % n =  0
+   *  -0 % n = -0
+   *   0 % 0 =  N
+   *   0 % N =  N
+   *   0 % I =  0
+   *   N % n =  N
+   *   N % 0 =  N
+   *   N % N =  N
+   *   N % I =  N
+   *   I % n =  N
+   *   I % 0 =  N
+   *   I % N =  N
+   *   I % I =  N
+   *
+   * Return a new BigNumber whose value is the value of this BigNumber modulo the value of
+   * BigNumber(y, b). The result depends on the value of MODULO_MODE.
+   */
+  P.modulo = P.mod = function (y, b) {
+    var q, s,
+      x = this;
+
+    y = new BigNumber(y, b);
+
+    // Return NaN if x is Infinity or NaN, or y is NaN or zero.
+    if (!x.c || !y.s || y.c && !y.c[0]) {
+      return new BigNumber(NaN);
+
+    // Return x if y is Infinity or x is zero.
+    } else if (!y.c || x.c && !x.c[0]) {
+      return new BigNumber(x);
+    }
+
+    if (MODULO_MODE == 9) {
+
+      // Euclidian division: q = sign(y) * floor(x / abs(y))
+      // r = x - qy    where  0 <= r < abs(y)
+      s = y.s;
+      y.s = 1;
+      q = div(x, y, 0, 3);
+      y.s = s;
+      q.s *= s;
+    } else {
+      q = div(x, y, 0, MODULO_MODE);
+    }
+
+    y = x.minus(q.times(y));
+
+    // To match JavaScript %, ensure sign of zero is sign of dividend.
+    if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;
+
+    return y;
+  };
+
+
+  /*
+   *  n * 0 = 0
+   *  n * N = N
+   *  n * I = I
+   *  0 * n = 0
+   *  0 * 0 = 0
+   *  0 * N = N
+   *  0 * I = N
+   *  N * n = N
+   *  N * 0 = N
+   *  N * N = N
+   *  N * I = N
+   *  I * n = I
+   *  I * 0 = N
+   *  I * N = N
+   *  I * I = I
+   *
+   * Return a new BigNumber whose value is the value of this BigNumber multiplied by the value
+   * of BigNumber(y, b).
+   */
+  P.multipliedBy = P.times = function (y, b) {
+    var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,
+      base, sqrtBase,
+      x = this,
+      xc = x.c,
+      yc = (y = new BigNumber(y, b)).c;
+
+    // Either NaN, ±Infinity or ±0?
+    if (!xc || !yc || !xc[0] || !yc[0]) {
+
+      // Return NaN if either is NaN, or one is 0 and the other is Infinity.
+      if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {
+        y.c = y.e = y.s = null;
+      } else {
+        y.s *= x.s;
+
+        // Return ±Infinity if either is ±Infinity.
+        if (!xc || !yc) {
+          y.c = y.e = null;
+
+        // Return ±0 if either is ±0.
+        } else {
+          y.c = [0];
+          y.e = 0;
+        }
+      }
+
+      return y;
+    }
+
+    e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);
+    y.s *= x.s;
+    xcL = xc.length;
+    ycL = yc.length;
+
+    // Ensure xc points to longer array and xcL to its length.
+    if (xcL < ycL) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;
+
+    // Initialise the result array with zeros.
+    for (i = xcL + ycL, zc = []; i--; zc.push(0));
+
+    base = BASE;
+    sqrtBase = SQRT_BASE;
+
+    for (i = ycL; --i >= 0;) {
+      c = 0;
+      ylo = yc[i] % sqrtBase;
+      yhi = yc[i] / sqrtBase | 0;
+
+      for (k = xcL, j = i + k; j > i;) {
+        xlo = xc[--k] % sqrtBase;
+        xhi = xc[k] / sqrtBase | 0;
+        m = yhi * xlo + xhi * ylo;
+        xlo = ylo * xlo + ((m % sqrtBase) * sqrtBase) + zc[j] + c;
+        c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;
+        zc[j--] = xlo % base;
+      }
+
+      zc[j] = c;
+    }
+
+    if (c) {
+      ++e;
+    } else {
+      zc.splice(0, 1);
+    }
+
+    return normalise(y, zc, e);
+  };
+
+
+  /*
+   * Return a new BigNumber whose value is the value of this BigNumber negated,
+   * i.e. multiplied by -1.
+   */
+  P.negated = function () {
+    var x = new BigNumber(this);
+    x.s = -x.s || null;
+    return x;
+  };
+
+
+  /*
+   *  n + 0 = n
+   *  n + N = N
+   *  n + I = I
+   *  0 + n = n
+   *  0 + 0 = 0
+   *  0 + N = N
+   *  0 + I = I
+   *  N + n = N
+   *  N + 0 = N
+   *  N + N = N
+   *  N + I = N
+   *  I + n = I
+   *  I + 0 = I
+   *  I + N = N
+   *  I + I = I
+   *
+   * Return a new BigNumber whose value is the value of this BigNumber plus the value of
+   * BigNumber(y, b).
+   */
+  P.plus = function (y, b) {
+    var t,
+      x = this,
+      a = x.s;
+
+    y = new BigNumber(y, b);
+    b = y.s;
+
+    // Either NaN?
+    if (!a || !b) return new BigNumber(NaN);
+
+    // Signs differ?
+     if (a != b) {
+      y.s = -b;
+      return x.minus(y);
+    }
+
+    var xe = x.e / LOG_BASE,
+      ye = y.e / LOG_BASE,
+      xc = x.c,
+      yc = y.c;
+
+    if (!xe || !ye) {
+
+      // Return ±Infinity if either ±Infinity.
+      if (!xc || !yc) return new BigNumber(a / 0);
+
+      // Either zero?
+      // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.
+      if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber(xc[0] ? x : a * 0);
+    }
+
+    xe = bitFloor(xe);
+    ye = bitFloor(ye);
+    xc = xc.slice();
+
+    // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.
+    if (a = xe - ye) {
+      if (a > 0) {
+        ye = xe;
+        t = yc;
+      } else {
+        a = -a;
+        t = xc;
+      }
+
+      t.reverse();
+      for (; a--; t.push(0));
+      t.reverse();
+    }
+
+    a = xc.length;
+    b = yc.length;
+
+    // Point xc to the longer array, and b to the shorter length.
+    if (a - b < 0) t = yc, yc = xc, xc = t, b = a;
+
+    // Only start adding at yc.length - 1 as the further digits of xc can be ignored.
+    for (a = 0; b;) {
+      a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;
+      xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;
+    }
+
+    if (a) {
+      xc = [a].concat(xc);
+      ++ye;
+    }
+
+    // No need to check for zero, as +x + +y != 0 && -x + -y != 0
+    // ye = MAX_EXP + 1 possible
+    return normalise(y, xc, ye);
+  };
+
+
+  /*
+   * If sd is undefined or null or true or false, return the number of significant digits of
+   * the value of this BigNumber, or null if the value of this BigNumber is ±Infinity or NaN.
+   * If sd is true include integer-part trailing zeros in the count.
+   *
+   * Otherwise, if sd is a number, return a new BigNumber whose value is the value of this
+   * BigNumber rounded to a maximum of sd significant digits using rounding mode rm, or
+   * ROUNDING_MODE if rm is omitted.
+   *
+   * sd {number|boolean} number: significant digits: integer, 1 to MAX inclusive.
+   *                     boolean: whether to count integer-part trailing zeros: true or false.
+   * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+   *
+   * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'
+   */
+  P.precision = P.sd = function (sd, rm) {
+    var c, n, v,
+      x = this;
+
+    if (sd != null && sd !== !!sd) {
+      intCheck(sd, 1, MAX);
+      if (rm == null) rm = ROUNDING_MODE;
+      else intCheck(rm, 0, 8);
+
+      return round(new BigNumber(x), sd, rm);
+    }
+
+    if (!(c = x.c)) return null;
+    v = c.length - 1;
+    n = v * LOG_BASE + 1;
+
+    if (v = c[v]) {
+
+      // Subtract the number of trailing zeros of the last element.
+      for (; v % 10 == 0; v /= 10, n--);
+
+      // Add the number of digits of the first element.
+      for (v = c[0]; v >= 10; v /= 10, n++);
+    }
+
+    if (sd && x.e + 1 > n) n = x.e + 1;
+
+    return n;
+  };
+
+
+  /*
+   * Return a new BigNumber whose value is the value of this BigNumber shifted by k places
+   * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.
+   *
+   * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.
+   *
+   * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {k}'
+   */
+  P.shiftedBy = function (k) {
+    intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
+    return this.times('1e' + k);
+  };
+
+
+  /*
+   *  sqrt(-n) =  N
+   *  sqrt(N) =  N
+   *  sqrt(-I) =  N
+   *  sqrt(I) =  I
+   *  sqrt(0) =  0
+   *  sqrt(-0) = -0
+   *
+   * Return a new BigNumber whose value is the square root of the value of this BigNumber,
+   * rounded according to DECIMAL_PLACES and ROUNDING_MODE.
+   */
+  P.squareRoot = P.sqrt = function () {
+    var m, n, r, rep, t,
+      x = this,
+      c = x.c,
+      s = x.s,
+      e = x.e,
+      dp = DECIMAL_PLACES + 4,
+      half = new BigNumber('0.5');
+
+    // Negative/NaN/Infinity/zero?
+    if (s !== 1 || !c || !c[0]) {
+      return new BigNumber(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);
+    }
+
+    // Initial estimate.
+    s = Math.sqrt(+valueOf(x));
+
+    // Math.sqrt underflow/overflow?
+    // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
+    if (s == 0 || s == 1 / 0) {
+      n = coeffToString(c);
+      if ((n.length + e) % 2 == 0) n += '0';
+      s = Math.sqrt(+n);
+      e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);
+
+      if (s == 1 / 0) {
+        n = '1e' + e;
+      } else {
+        n = s.toExponential();
+        n = n.slice(0, n.indexOf('e') + 1) + e;
+      }
+
+      r = new BigNumber(n);
+    } else {
+      r = new BigNumber(s + '');
+    }
+
+    // Check for zero.
+    // r could be zero if MIN_EXP is changed after the this value was created.
+    // This would cause a division by zero (x/t) and hence Infinity below, which would cause
+    // coeffToString to throw.
+    if (r.c[0]) {
+      e = r.e;
+      s = e + dp;
+      if (s < 3) s = 0;
+
+      // Newton-Raphson iteration.
+      for (; ;) {
+        t = r;
+        r = half.times(t.plus(div(x, t, dp, 1)));
+
+        if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {
+
+          // The exponent of r may here be one less than the final result exponent,
+          // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits
+          // are indexed correctly.
+          if (r.e < e) --s;
+          n = n.slice(s - 3, s + 1);
+
+          // The 4th rounding digit may be in error by -1 so if the 4 rounding digits
+          // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the
+          // iteration.
+          if (n == '9999' || !rep && n == '4999') {
+
+            // On the first iteration only, check to see if rounding up gives the
+            // exact result as the nines may infinitely repeat.
+            if (!rep) {
+              round(t, t.e + DECIMAL_PLACES + 2, 0);
+
+              if (t.times(t).eq(x)) {
+                r = t;
+                break;
+              }
+            }
+
+            dp += 4;
+            s += 4;
+            rep = 1;
+          } else {
+
+            // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact
+            // result. If not, then there are further digits and m will be truthy.
+            if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
+
+              // Truncate to the first rounding digit.
+              round(r, r.e + DECIMAL_PLACES + 2, 1);
+              m = !r.times(r).eq(x);
+            }
+
+            break;
+          }
+        }
+      }
+    }
+
+    return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);
+  };
+
+
+  /*
+   * Return a string representing the value of this BigNumber in exponential notation and
+   * rounded using ROUNDING_MODE to dp fixed decimal places.
+   *
+   * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.
+   * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+   *
+   * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'
+   */
+  P.toExponential = function (dp, rm) {
+    if (dp != null) {
+      intCheck(dp, 0, MAX);
+      dp++;
+    }
+    return format(this, dp, rm, 1);
+  };
+
+
+  /*
+   * Return a string representing the value of this BigNumber in fixed-point notation rounding
+   * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.
+   *
+   * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',
+   * but e.g. (-0.00001).toFixed(0) is '-0'.
+   *
+   * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.
+   * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+   *
+   * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'
+   */
+  P.toFixed = function (dp, rm) {
+    if (dp != null) {
+      intCheck(dp, 0, MAX);
+      dp = dp + this.e + 1;
+    }
+    return format(this, dp, rm);
+  };
+
+
+  /*
+   * Return a string representing the value of this BigNumber in fixed-point notation rounded
+   * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties
+   * of the format or FORMAT object (see BigNumber.set).
+   *
+   * The formatting object may contain some or all of the properties shown below.
+   *
+   * FORMAT = {
+   *   prefix: '',
+   *   groupSize: 3,
+   *   secondaryGroupSize: 0,
+   *   groupSeparator: ',',
+   *   decimalSeparator: '.',
+   *   fractionGroupSize: 0,
+   *   fractionGroupSeparator: '\xA0',      // non-breaking space
+   *   suffix: ''
+   * };
+   *
+   * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.
+   * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+   * [format] {object} Formatting options. See FORMAT pbject above.
+   *
+   * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {dp|rm}'
+   * '[BigNumber Error] Argument not an object: {format}'
+   */
+  P.toFormat = function (dp, rm, format) {
+    var str,
+      x = this;
+
+    if (format == null) {
+      if (dp != null && rm && typeof rm == 'object') {
+        format = rm;
+        rm = null;
+      } else if (dp && typeof dp == 'object') {
+        format = dp;
+        dp = rm = null;
+      } else {
+        format = FORMAT;
+      }
+    } else if (typeof format != 'object') {
+      throw Error
+        (bignumberError + 'Argument not an object: ' + format);
+    }
+
+    str = x.toFixed(dp, rm);
+
+    if (x.c) {
+      var i,
+        arr = str.split('.'),
+        g1 = +format.groupSize,
+        g2 = +format.secondaryGroupSize,
+        groupSeparator = format.groupSeparator || '',
+        intPart = arr[0],
+        fractionPart = arr[1],
+        isNeg = x.s < 0,
+        intDigits = isNeg ? intPart.slice(1) : intPart,
+        len = intDigits.length;
+
+      if (g2) i = g1, g1 = g2, g2 = i, len -= i;
+
+      if (g1 > 0 && len > 0) {
+        i = len % g1 || g1;
+        intPart = intDigits.substr(0, i);
+        for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);
+        if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);
+        if (isNeg) intPart = '-' + intPart;
+      }
+
+      str = fractionPart
+       ? intPart + (format.decimalSeparator || '') + ((g2 = +format.fractionGroupSize)
+        ? fractionPart.replace(new RegExp('\\d{' + g2 + '}\\B', 'g'),
+         '$&' + (format.fractionGroupSeparator || ''))
+        : fractionPart)
+       : intPart;
+    }
+
+    return (format.prefix || '') + str + (format.suffix || '');
+  };
+
+
+  /*
+   * Return an array of two BigNumbers 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 the specified
+   * maximum denominator. If a maximum denominator is not specified, the denominator will be
+   * the lowest value necessary to represent the number exactly.
+   *
+   * [md] {number|string|BigNumber} Integer >= 1, or Infinity. The maximum denominator.
+   *
+   * '[BigNumber Error] Argument {not an integer|out of range} : {md}'
+   */
+  P.toFraction = function (md) {
+    var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s,
+      x = this,
+      xc = x.c;
+
+    if (md != null) {
+      n = new BigNumber(md);
+
+      // Throw if md is less than one or is not an integer, unless it is Infinity.
+      if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {
+        throw Error
+          (bignumberError + 'Argument ' +
+            (n.isInteger() ? 'out of range: ' : 'not an integer: ') + valueOf(n));
+      }
+    }
+
+    if (!xc) return new BigNumber(x);
+
+    d = new BigNumber(ONE);
+    n1 = d0 = new BigNumber(ONE);
+    d1 = n0 = new BigNumber(ONE);
+    s = coeffToString(xc);
+
+    // Determine initial denominator.
+    // d is a power of 10 and the minimum max denominator that specifies the value exactly.
+    e = d.e = s.length - x.e - 1;
+    d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];
+    md = !md || n.comparedTo(d) > 0 ? (e > 0 ? d : n1) : n;
+
+    exp = MAX_EXP;
+    MAX_EXP = 1 / 0;
+    n = new BigNumber(s);
+
+    // n0 = d1 = 0
+    n0.c[0] = 0;
+
+    for (; ;)  {
+      q = div(n, d, 0, 1);
+      d2 = d0.plus(q.times(d1));
+      if (d2.comparedTo(md) == 1) break;
+      d0 = d1;
+      d1 = d2;
+      n1 = n0.plus(q.times(d2 = n1));
+      n0 = d2;
+      d = n.minus(q.times(d2 = d));
+      n = d2;
+    }
+
+    d2 = div(md.minus(d0), d1, 0, 1);
+    n0 = n0.plus(d2.times(n1));
+    d0 = d0.plus(d2.times(d1));
+    n0.s = n1.s = x.s;
+    e = e * 2;
+
+    // Determine which fraction is closer to x, n0/d0 or n1/d1
+    r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(
+        div(n0, d0, e, ROUNDING_MODE).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];
+
+    MAX_EXP = exp;
+
+    return r;
+  };
+
+
+  /*
+   * Return the value of this BigNumber converted to a number primitive.
+   */
+  P.toNumber = function () {
+    return +valueOf(this);
+  };
+
+
+  /*
+   * Return a string representing the value of this BigNumber rounded to sd significant digits
+   * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits
+   * necessary to represent the integer part of the value in fixed-point notation, then use
+   * exponential notation.
+   *
+   * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.
+   * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
+   *
+   * '[BigNumber Error] Argument {not a primitive number|not an integer|out of range}: {sd|rm}'
+   */
+  P.toPrecision = function (sd, rm) {
+    if (sd != null) intCheck(sd, 1, MAX);
+    return format(this, sd, rm, 2);
+  };
+
+
+  /*
+   * Return a string representing the value of this BigNumber in base b, or base 10 if b is
+   * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and
+   * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent
+   * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than
+   * TO_EXP_NEG, return exponential notation.
+   *
+   * [b] {number} Integer, 2 to ALPHABET.length inclusive.
+   *
+   * '[BigNumber Error] Base {not a primitive number|not an integer|out of range}: {b}'
+   */
+  P.toString = function (b) {
+    var str,
+      n = this,
+      s = n.s,
+      e = n.e;
+
+    // Infinity or NaN?
+    if (e === null) {
+      if (s) {
+        str = 'Infinity';
+        if (s < 0) str = '-' + str;
+      } else {
+        str = 'NaN';
+      }
+    } else {
+      if (b == null) {
+        str = e <= TO_EXP_NEG || e >= TO_EXP_POS
+         ? toExponential(coeffToString(n.c), e)
+         : toFixedPoint(coeffToString(n.c), e, '0');
+      } else if (b === 10) {
+        n = round(new BigNumber(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);
+        str = toFixedPoint(coeffToString(n.c), n.e, '0');
+      } else {
+        intCheck(b, 2, ALPHABET.length, 'Base');
+        str = convertBase(toFixedPoint(coeffToString(n.c), e, '0'), 10, b, s, true);
+      }
+
+      if (s < 0 && n.c[0]) str = '-' + str;
+    }
+
+    return str;
+  };
+
+
+  /*
+   * Return as toString, but do not accept a base argument, and include the minus sign for
+   * negative zero.
+   */
+  P.valueOf = P.toJSON = P[Symbol.for('nodejs.util.inspect.custom')] = function () {
+    return valueOf(this);
+  };
+
+  P[Symbol.toStringTag] = 'BigNumber';
+
+  if (configObject != null) BigNumber.set(configObject);
+
+  return BigNumber;
+}
+
+
+// PRIVATE HELPER FUNCTIONS
+
+
+function bitFloor(n) {
+  var i = n | 0;
+  return n > 0 || n === i ? i : i - 1;
+}
+
+
+// Return a coefficient array as a string of base 10 digits.
+function coeffToString(a) {
+  var s, z,
+    i = 1,
+    j = a.length,
+    r = a[0] + '';
+
+  for (; i < j;) {
+    s = a[i++] + '';
+    z = LOG_BASE - s.length;
+    for (; z--; s = '0' + s);
+    r += s;
+  }
+
+  // Determine trailing zeros.
+  for (j = r.length; r.charCodeAt(--j) === 48;);
+
+  return r.slice(0, j + 1 || 1);
+}
+
+
+// Compare the value of BigNumbers x and y.
+function compare(x, y) {
+  var a, b,
+    xc = x.c,
+    yc = y.c,
+    i = x.s,
+    j = y.s,
+    k = x.e,
+    l = y.e;
+
+  // Either NaN?
+  if (!i || !j) return null;
+
+  a = xc && !xc[0];
+  b = yc && !yc[0];
+
+  // Either zero?
+  if (a || b) return a ? b ? 0 : -j : i;
+
+  // Signs differ?
+  if (i != j) return i;
+
+  a = i < 0;
+  b = k == l;
+
+  // Either Infinity?
+  if (!xc || !yc) return b ? 0 : !xc ^ a ? 1 : -1;
+
+  // Compare exponents.
+  if (!b) return k > l ^ a ? 1 : -1;
+
+  j = (k = xc.length) < (l = yc.length) ? k : l;
+
+  // Compare digit by digit.
+  for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1;
+
+  // Compare lengths.
+  return k == l ? 0 : k > l ^ a ? 1 : -1;
+}
+
+
+/*
+ * Check that n is a primitive number, an integer, and in range, otherwise throw.
+ */
+function intCheck(n, min, max, name) {
+  if (n < min || n > max || n !== (n < 0 ? mathceil(n) : mathfloor(n))) {
+    throw Error
+     (bignumberError + (name || 'Argument') + (typeof n == 'number'
+       ? n < min || n > max ? ' out of range: ' : ' not an integer: '
+       : ' not a primitive number: ') + String(n));
+  }
+}
+
+
+// Assumes finite n.
+function isOdd(n) {
+  var k = n.c.length - 1;
+  return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0;
+}
+
+
+function toExponential(str, e) {
+  return (str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str) +
+   (e < 0 ? 'e' : 'e+') + e;
+}
+
+
+function toFixedPoint(str, e, z) {
+  var len, zs;
+
+  // Negative exponent?
+  if (e < 0) {
+
+    // Prepend zeros.
+    for (zs = z + '.'; ++e; zs += z);
+    str = zs + str;
+
+  // Positive exponent
+  } else {
+    len = str.length;
+
+    // Append zeros.
+    if (++e > len) {
+      for (zs = z, e -= len; --e; zs += z);
+      str += zs;
+    } else if (e < len) {
+      str = str.slice(0, e) + '.' + str.slice(e);
+    }
+  }
+
+  return str;
+}
+
+
+// EXPORT
+
+
+export var BigNumber = clone();
+
+export default BigNumber;
diff -pruN 1.3.0+dfsg-1/CHANGELOG.md 8.0.2+ds-1/CHANGELOG.md
--- 1.3.0+dfsg-1/CHANGELOG.md	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/CHANGELOG.md	2019-01-13 22:17:07.000000000 +0000
@@ -0,0 +1,252 @@
+#### 8.0.2
+* 13/01/2019
+* #209 `toPrecision` without argument should follow `toString`.
+* Improve *Use* section of *README*.
+* Optimise `toString(10)`.
+* Add verson number to API doc.
+
+#### 8.0.1
+* 01/11/2018
+* Rest parameter must be array type in *bignumber.d.ts*.
+
+#### 8.0.1
+* 01/11/2018
+* Rest parameter must be array type in *bignumber.d.ts*.
+
+#### 8.0.0
+* 01/11/2018
+* [NEW FEATURE] Add `BigNumber.sum` method.
+* [NEW FEATURE]`toFormat`: add `prefix` and `suffix` options.
+* [NEW FEATURE] #178 Pass custom formatting to `toFormat`.
+* [BREAKING CHANGE] #184 `toFraction`: return array of BigNumbers not strings.
+* [NEW FEATURE] #185 Enable overwrite of `valueOf` to prevent accidental addition to string.
+* #183 Add Node.js `crypto` requirement to documentation.
+* [BREAKING CHANGE] #198 Disallow signs and whitespace in custom alphabet.
+* [NEW FEATURE] #188 Implement `util.inspect.custom` for Node.js REPL.
+* #170 Make `isBigNumber` a type guard in *bignumber.d.ts*.
+* [BREAKING CHANGE] `BigNumber.min` and `BigNumber.max`: don't accept an array.
+* Update *.travis.yml*.
+* Remove *bower.json*.
+
+#### 7.2.1
+* 24/05/2018
+* Add `browser` field to *package.json*.
+
+#### 7.2.0
+* 22/05/2018
+* #166 Correct *.mjs* file. Remove extension from `main` field in *package.json*.
+
+#### 7.1.0
+* 18/05/2018
+* Add `module` field to *package.json* for *bignumber.mjs*.
+
+#### 7.0.2
+* 17/05/2018
+* #165 Bugfix: upper-case letters for bases 11-36 in a custom alphabet.
+* Add note to *README* regarding creating BigNumbers from Number values.
+
+#### 7.0.1
+* 26/04/2018
+* #158 Fix global object variable name typo.
+
+#### 7.0.0
+* 26/04/2018
+* #143 Remove global BigNumber from typings.
+* #144 Enable compatibility with `Object.freeze(Object.prototype)`.
+* #148 #123 #11 Only throw on a number primitive with more than 15 significant digits if `BigNumber.DEBUG` is `true`.
+* Only throw on an invalid BigNumber value if `BigNumber.DEBUG` is `true`. Return BigNumber `NaN` instead.
+* #154 `exponentiatedBy`: allow BigNumber exponent.
+* #156 Prevent Content Security Policy *unsafe-eval* issue.
+* `toFraction`: allow `Infinity` maximum denominator.
+* Comment-out some excess tests to reduce test time.
+* Amend indentation and other spacing.
+
+#### 6.0.0
+* 26/01/2018
+* #137 Implement `APLHABET` configuration option.
+* Remove `ERRORS` configuration option.
+* Remove `toDigits` method; extend `precision` method accordingly.
+* Remove s`round` method; extend `decimalPlaces` method accordingly.
+* Remove methods: `ceil`, `floor`, and `truncated`.
+* Remove method aliases: `add`, `cmp`, `isInt`, `isNeg`, `trunc`, `mul`, `neg` and `sub`.
+* Rename methods: `shift` to `shiftedBy`, `another` to `clone`, `toPower` to `exponentiatedBy`, and `equals` to `isEqualTo`.
+* Rename methods: add `is` prefix to `greaterThan`, `greaterThanOrEqualTo`, `lessThan` and `lessThanOrEqualTo`.
+* Add methods: `multipliedBy`, `isBigNumber`, `isPositive`, `integerValue`, `maximum` and `minimum`.
+* Refactor test suite.
+* Add *CHANGELOG.md*.
+* Rewrite *bignumber.d.ts*.
+* Redo API image.
+
+#### 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`, `shiftedBy`, `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
diff -pruN 1.3.0+dfsg-1/debian/changelog 8.0.2+ds-1/debian/changelog
--- 1.3.0+dfsg-1/debian/changelog	2014-03-15 00:36:22.000000000 +0000
+++ 8.0.2+ds-1/debian/changelog	2019-02-12 06:10:01.000000000 +0000
@@ -1,3 +1,25 @@
+bignumber.js (8.0.2+ds-1) unstable; urgency=medium
+
+  [ Mike Gabriel ]
+  * debian/control: Remove myself from Uploaders: field.
+
+  [ Xavier Guimard ]
+  * Bump debhelper compatibility level to 11
+  * Declare compliance with policy 4.3.0
+  * Change section to javascript
+  * Change priority to optional
+  * Update copyrights
+  * Update VCS fields to salsa
+  * Add upstream/metadata
+  * Set myself as uploader (Closes: #921362)
+  * Clean install
+  * Hide false positive lintian errors
+  * Enable tests based on pkg-js-tools
+  * Exclude minified files from import
+  * New upstream version 8.0.2+ds (Closes: #862918)
+
+ -- Xavier Guimard <yadd@debian.org>  Tue, 12 Feb 2019 07:10:01 +0100
+
 bignumber.js (1.3.0+dfsg-1) unstable; urgency=low
 
   * New upstream release.
diff -pruN 1.3.0+dfsg-1/debian/clean 8.0.2+ds-1/debian/clean
--- 1.3.0+dfsg-1/debian/clean	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/debian/clean	2019-02-12 05:50:27.000000000 +0000
@@ -0,0 +1 @@
+bignumber.min.js*
diff -pruN 1.3.0+dfsg-1/debian/compat 8.0.2+ds-1/debian/compat
--- 1.3.0+dfsg-1/debian/compat	2013-09-01 20:38:32.000000000 +0000
+++ 8.0.2+ds-1/debian/compat	2019-02-12 05:15:23.000000000 +0000
@@ -1 +1 @@
-8
+11
diff -pruN 1.3.0+dfsg-1/debian/control 8.0.2+ds-1/debian/control
--- 1.3.0+dfsg-1/debian/control	2014-03-15 00:32:28.000000000 +0000
+++ 8.0.2+ds-1/debian/control	2019-02-12 05:34:20.000000000 +0000
@@ -1,23 +1,21 @@
 Source: bignumber.js
-Section: web
-Priority: extra
 Maintainer: Debian Javascript Maintainers <pkg-javascript-devel@lists.alioth.debian.org>
-Uploaders:
- Mike Gabriel <sunweaver@debian.org>,
-Build-Depends:
- debhelper (>= 8.0.0),
- dh-buildinfo,
- uglifyjs,
-Standards-Version: 3.9.5
+Uploaders: Xavier Guimard <yadd@debian.org>
+Section: javascript
+Testsuite: autopkgtest-pkg-nodejs
+Priority: optional
+Build-Depends: debhelper (>= 11~),
+               pkg-js-tools,
+               uglifyjs
+Standards-Version: 4.3.0
+Vcs-Browser: https://salsa.debian.org/js-team/bignumber.js
+Vcs-Git: https://salsa.debian.org/js-team/bignumber.js.git
 Homepage: https://github.com/MikeMcl/bignumber.js/
-Vcs-Git: git://anonscm.debian.org/collab-maint/bignumber.js.git
-Vcs-Browser: http://anonscm.debian.org/gitiweb/?p=collab-maint/bignumber.js.git
 
 Package: node-bignumber
 Architecture: all
-Depends:
- ${misc:Depends},
- nodejs (>= 0.6.19~dfsg1-3~),
+Depends: ${misc:Depends},
+         nodejs
 Description: Arbitrary-precision decimal and non-decimal arithmetic for Node.js
  Features:
  .
@@ -43,8 +41,7 @@ Description: Arbitrary-precision decimal
 
 Package: libjs-bignumber
 Architecture: all
-Depends:
- ${misc:Depends},
+Depends: ${misc:Depends}
 Description: Arbitrary-precision decimal and non-decimal arithmetic (client)
  Features:
  .
diff -pruN 1.3.0+dfsg-1/debian/copyright 8.0.2+ds-1/debian/copyright
--- 1.3.0+dfsg-1/debian/copyright	2013-09-01 20:38:32.000000000 +0000
+++ 8.0.2+ds-1/debian/copyright	2019-02-12 06:01:18.000000000 +0000
@@ -1,47 +1,48 @@
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 Upstream-Name: bignumber.js
 Upstream-Contact: Michael Mclaughlin <M8ch88l@gmail.com>
 Source: https://github.com/MikeMcl/bignumber.js
+Files-Excluded: bignumber.min.js
+ bignumber.min.js.map
 
 Files: *
-Copyright:
- 2012, Michael Mclaughlin <M8ch88l@gmail.com>
+Copyright: 2019, Michael Mclaughlin <M8ch88l@gmail.com>
 License: Expat
 
-Files:
- test/toPrecision.js
- test/abs.js
- test/pow.js
- test/ceil.js
- test/floor.js
- test/round.js
-Copyright:
- 2008, 2010, 2011, The V8 Project Authors (http://code.google.com/p/v8)
-License: BSD-3-clause
+Files: perf/lib/bigdecimal_GWT/*
+Copyright: 2008, 2010, 2011, The V8 Project Authors <https://v8.dev/>
+License: Apache-2.0
+
+Files: perf/lib/bigdecimal_ICU4J/*
+Copyright: 2012, Daniel Trebbien and other contributors
+License: Expat
+Comment: Portions Copyright (c) 2003 STZ-IDA and PTV AG, Karlsruhe, Germany
+ Portions Copyright (c) 1995-2001 International Business Machines Corporation
+ and others
+ .
+ Except as contained in this notice, the name of a copyright holder
+ shall not be used in advertising or otherwise to promote the sale, use or
+ other dealings in this Software without prior written authorization of the
+ copyright holder.
 
 Files: debian/*
-Copyright:
- 2013, Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+Copyright: 2013, Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+ 2019, Xavier Guimard <yadd@debian.org>
 License: Expat or BSD-3-clause
 
-License: Expat
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
+License: Apache-2.0
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+     https://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS"BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
  .
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- .
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
+ On Debian systems, the complete text of the Apache License,
+ Version 2.0 can be found in '/usr/share/common-licenses/Apache-2.0'.
 
 License: BSD-3-clause
  Redistribution and use in source and binary forms, with or without
@@ -69,3 +70,22 @@ License: BSD-3-clause
  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+License: Expat
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
diff -pruN 1.3.0+dfsg-1/debian/node-bignumber.install 8.0.2+ds-1/debian/node-bignumber.install
--- 1.3.0+dfsg-1/debian/node-bignumber.install	2013-09-01 20:38:32.000000000 +0000
+++ 8.0.2+ds-1/debian/node-bignumber.install	2019-02-12 05:30:45.000000000 +0000
@@ -1 +1,2 @@
-bignumber.js usr/lib/nodejs/
+bignumber.js usr/lib/nodejs/bignumber.js/
+package.json usr/lib/nodejs/bignumber.js/
diff -pruN 1.3.0+dfsg-1/debian/rules 8.0.2+ds-1/debian/rules
--- 1.3.0+dfsg-1/debian/rules	2013-09-02 13:14:11.000000000 +0000
+++ 8.0.2+ds-1/debian/rules	2019-02-12 06:09:40.000000000 +0000
@@ -5,7 +5,7 @@
 #export DH_VERBOSE=1
 
 %:
-	dh $@
+	dh $@ --with nodejs
 
 override_dh_auto_build:
 	uglifyjs bignumber.js > bignumber.min.js
@@ -16,37 +16,3 @@ override_dh_installdocs:
 	rm -f debian/node-bignumber/usr/share/doc/node-bignumber/perf/lib/bigdecimal_GWT/LICENCE*
 	rm -f debian/node-bignumber/usr/share/doc/node-bignumber/perf/lib/bigdecimal_ICU4J/LICENCE*
 	rm -f debian/node-bignumber/usr/share/doc/node-bignumber/test/v8-LICENCE*
-
-override_dh_auto_clean:
-	rm -f bignumber.min.js
-	dh_auto_clean
-
-PKD   = $(abspath $(dir $(MAKEFILE_LIST)))
-PKG   = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source))
-UVER  = $(shell dpkg-parsechangelog -l$(PKD)/changelog | perl -ne 'print $$1 if m{^Version:\s+(?:\d+:)?(\d.*)(?:\-\d+.*)};')
-DTYPE = +dfsg
-VER  ?= $(subst $(DTYPE),,$(UVER))
-
-## http://wiki.debian.org/onlyjob/get-orig-source
-.PHONY: get-orig-source
-get-orig-source: $(PKG)_$(VER)$(DTYPE).orig.tar.gz $(info I: $(PKG)_$(VER)$(DTYPE))
-	@
-
-$(PKG)_$(VER)$(DTYPE).orig.tar.gz:
-	@echo "# Downloading..."
-	uscan --noconf --verbose --rename --destdir=$(CURDIR) --check-dirname-level=0 --force-download --download-version $(VER) $(PKD)
-	$(if $(wildcard $(PKG)-$(VER)),$(error $(PKG)-$(VER) exist, aborting..))
-	@echo "# Extracting..."
-	mkdir $(PKG)-$(VER) \
-	    && tar -xf $(PKG)_$(VER).orig.tar.* --directory $(PKG)-$(VER) --strip-components 1 \
-	    || $(RM) -r $(PKG)-$(VER)
-	@echo "# Cleaning-up..."
-	cd $(PKG)-$(VER) \
-	    && $(RM) -r -v \
-	        perf/ \
-	        bignumber.min.js
-	$(RM) -v $(PKG)_$(VER).orig.tar.*
-	@echo "# Packing..."
-	find -L "$(PKG)-$(VER)" -xdev -type f -print | sort \
-	    | tar -caf "../$(PKG)_$(VER)$(DTYPE).orig.tar.gz" -T- --owner=root --group=root --mode=a+rX \
-	    && $(RM) -r "$(PKG)-$(VER)"
diff -pruN 1.3.0+dfsg-1/debian/source/lintian-overrides 8.0.2+ds-1/debian/source/lintian-overrides
--- 1.3.0+dfsg-1/debian/source/lintian-overrides	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/debian/source/lintian-overrides	2019-02-12 05:54:47.000000000 +0000
@@ -0,0 +1,9 @@
+# False positive: data
+insane-line-length-in-source-file test/methods/BigNumber.js line length is 779 characters (>512)
+source-contains-prebuilt-javascript-object test/methods/BigNumber.js line length is 775 characters (>512)
+source-is-missing test/methods/BigNumber.js line length is 775 characters (>512)
+insane-line-length-in-source-file test/methods/squareRoot.js line length is 597 characters (>512)
+source-contains-prebuilt-javascript-object perf/lib/bigdecimal_GWT/bigdecimal.js line length is 502 characters (>256)
+source-is-missing perf/lib/bigdecimal_GWT/bigdecimal.js line length is 502 characters (>256)
+insane-line-length-in-source-file perf/lib/bigdecimal_ICU4J/BigDecimal-all-last.js line length is 598 characters (>512)
+source-contains-prebuilt-javascript-object perf/lib/bigdecimal_ICU4J/BigDecimal-all-last.min.js
diff -pruN 1.3.0+dfsg-1/debian/tests/pkg-js/test 8.0.2+ds-1/debian/tests/pkg-js/test
--- 1.3.0+dfsg-1/debian/tests/pkg-js/test	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/debian/tests/pkg-js/test	2019-02-12 05:52:34.000000000 +0000
@@ -0,0 +1 @@
+node test/test.js
diff -pruN 1.3.0+dfsg-1/debian/upstream/metadata 8.0.2+ds-1/debian/upstream/metadata
--- 1.3.0+dfsg-1/debian/upstream/metadata	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/debian/upstream/metadata	2019-02-12 05:24:43.000000000 +0000
@@ -0,0 +1,7 @@
+---
+Archive: GitHub
+Bug-Database: https://github.com/MikeMcl/bignumber.js/issues
+Contact: https://github.com/MikeMcl/bignumber.js/issues
+Name: bignumber.js
+Repository: https://github.com/MikeMcl/bignumber.js.git
+Repository-Browse: https://github.com/MikeMcl/bignumber.js
diff -pruN 1.3.0+dfsg-1/debian/watch 8.0.2+ds-1/debian/watch
--- 1.3.0+dfsg-1/debian/watch	2013-09-01 20:54:38.000000000 +0000
+++ 8.0.2+ds-1/debian/watch	2019-02-12 05:48:15.000000000 +0000
@@ -1,4 +1,6 @@
-version=3
-opts=dversionmangle=s/\+dfsg//,filenamemangle=s/.*\/v?([\d\.-]+)\.tar\.gz/bignumber.js-$1.tar.gz/ \
-https://github.com/MikeMcl/bignumber.js/tags .*/archive/v?([\d\.]+).tar.gz
+version=4
+opts=dversionmangle=auto,\
+filenamemangle=s/.*\/v?([\d\.-]+)\.tar\.gz/bignumber.js-$1.tar.gz/,\
+repack,repacksuffix=+ds \
+ https://github.com/MikeMcl/bignumber.js/tags .*/archive/v?([\d\.]+).tar.gz
 
diff -pruN 1.3.0+dfsg-1/doc/API.html 8.0.2+ds-1/doc/API.html
--- 1.3.0+dfsg-1/doc/API.html	2013-11-08 16:56:48.000000000 +0000
+++ 8.0.2+ds-1/doc/API.html	2019-01-13 22:17:07.000000000 +0000
@@ -1,64 +1,66 @@
 <!DOCTYPE HTML>
 <html>
 <head>
-  <meta charset="utf-8">
-  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
-  <meta name="Author" content="M Mclaughlin">
-  <title>bignumber.js API</title>
-  <style>
-html{font-family:sans-serif;font-size:100%}
-body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;
-  line-height:1.65em;background:#fefff5;color:#000;min-height:100%;margin:0}
-.nav{background:#fff;position:fixed;top:0;bottom:0;left:0;width:180px;
-  overflow-y:auto;padding:15px 0 30px 20px}
+<meta charset="utf-8">
+<meta http-equiv="X-UA-Compatible" content="IE=edge">
+<meta name="Author" content="M Mclaughlin">
+<title>bignumber.js API</title>
+<style>
+html{font-size:100%}
+body{background:#fff;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;
+  line-height:1.65em;min-height:100%;margin:0}
+body,i{color:#000}
+.nav{background:#fff;position:fixed;top:0;bottom:0;left:0;width:200px;overflow-y:auto;
+  padding:15px 0 30px 15px}
 div.container{width:600px;margin:50px 0 50px 240px}
 p{margin:0 0 1em;width:600px}
 pre,ul{margin:1em 0}
 h1,h2,h3,h4,h5{margin:0;padding:1.5em 0 0}
 h1,h2{padding:.75em 0}
-h1{font-size:2.5em;color:#fa6900}
-h2{font-size:2.25em;color:#fa6900}
-h3{font-size:1.75em;color:#69d2e7}
-h4{font-size:1.75em;color:#fa6900;padding-bottom:.75em}
-h5{font-size:1.2em;padding-bottom:.3em}
-h6{font-size:1.1em;margin:0;padding:0.5em 0}
-dd dt{font-size:1.2em}
-dt{padding-top:.5em}
+h1{font:400 3em Verdana,sans-serif;color:#000;margin-bottom:1em}
+h2{font-size:2.25em;color:#ff2a00}
+h3{font-size:1.75em;color:#4dc71f}
+h4{font-size:1.75em;color:#ff2a00;padding-bottom:.75em}
+h5{font-size:1.2em;margin-bottom:.4em}
+h6{font-size:1.1em;margin-bottom:0.8em;padding:0.5em 0}
 dd{padding-top:.35em}
+dt{padding-top:.5em}
 b{font-weight:700}
-a,a:visited{color:#444;text-decoration:none}
-a:active,a:hover{outline:0;color:#000}
-.nav a:hover{text-decoration:underline}
-.nav a,.nav b,.nav a:visited{display:block;color:#fa6900;font-weight:700;
-  margin-top:15px}
-.nav b{color:#69d2e7;margin-top:20px;cursor:default;width:auto}
+dt b{font-size:1.3em}
+a,a:visited{color:#ff2a00;text-decoration:none}
+a:active,a:hover{outline:0;text-decoration:underline}
+.nav a,.nav b,.nav a:visited{display:block;color:#ff2a00;font-weight:700; margin-top:15px}
+.nav b{color:#4dc71f;margin-top:20px;cursor:default;width:auto}
 ul{list-style-type:none;padding:0 0 0 20px}
 .nav ul{line-height:14px;padding-left:0;margin:5px 0 0}
-.nav ul a,.nav ul a:visited{display:inline;color:#000;font-family:Verdana,
-  Geneva,sans-serif;font-size:11px;font-weight:400;margin:0}
+.nav ul a,.nav ul a:visited,span{display:inline;color:#000;font-family:Verdana,Geneva,sans-serif;
+  font-size:11px;font-weight:400;margin:0}
 .inset,ul.inset{margin-left:20px}
-code.inset{font-size:.9em}
-.nav li{cursor:pointer;width:auto;margin:0 0 3px}
-span.alias{font-style:italic;margin-left:20px}
-table{border-collapse:collapse;border-spacing:0;border:2px solid #a7dbd8;
-  margin:1.75em 0;padding:0}
+.inset{font-size:.9em}
+.nav li{width:auto;margin:0 0 3px}
+.alias{font-style:italic;margin-left:20px}
+table{border-collapse:collapse;border-spacing:0;border:2px solid #a7dbd8;margin:1.75em 0;padding:0}
 td,th{text-align:left;margin:0;padding:2px 5px;border:1px dotted #a7dbd8}
-th{border-top:2px solid #a7dbd8;border-bottom:2px solid #a7dbd8;color:#f38630}
-pre{background:#fff;white-space:pre-wrap;word-wrap:break-word;
-  border-left:5px solid #a7dbd8;padding:1px 0 1px 15px;margin:1.2em 0}
-code,pre{font-family:Monaco,Consolas,"Lucida Console",monospace;
-  font-weight:400}
+th{border-top:2px solid #a7dbd8;border-bottom:2px solid #a7dbd8;color:#ff2a00}
+code,pre{font-family:Consolas, monaco, monospace;font-weight:400}
+pre{background:#f5f5f5;white-space:pre-wrap;word-wrap:break-word;border-left:5px solid #abef98;
+  padding:1px 0 1px 15px;margin:1.2em 0}
+code,.nav-title{color:#ff2a00}
 .end{margin-bottom:25px}
-.nav-title{color:#fa6900}
 .centre{text-align:center}
 .error-table{font-size:13px;width:100%}
-  </style>
+#faq{margin:3em 0 0}
+li span{float:right;margin-right:10px;color:#c0c0c0}
+#js{font:inherit;color:#4dc71f}
+</style>
 </head>
 <body>
 
   <div class="nav">
 
-    <a class='nav-title' href="#">bignumber.js</a>
+    <b>v9.0.0</b>
+	
+	<a class='nav-title' href="#">API</a>
 
     <b> CONSTRUCTOR </b>
     <ul>
@@ -67,16 +69,26 @@ code,pre{font-family:Monaco,Consolas,"Lu
 
     <a href="#methods">Methods</a>
     <ul>
-      <li><a href="#config">config</a></li>
+      <li><a href="#clone">clone</a></li>
+      <li><a href="#config" >config</a><span>set</span></li>
       <li>
         <ul class="inset">
           <li><a href="#decimal-places">DECIMAL_PLACES</a></li>
           <li><a href="#rounding-mode" >ROUNDING_MODE</a></li>
           <li><a href="#exponential-at">EXPONENTIAL_AT</a></li>
           <li><a href="#range"         >RANGE</a></li>
-          <li><a href="#errors"        >ERRORS</a></li>
+          <li><a href="#crypto"        >CRYPTO</a></li>
+          <li><a href="#modulo-mode"   >MODULO_MODE</a></li>
+          <li><a href="#pow-precision" >POW_PRECISION</a></li>
+          <li><a href="#format"        >FORMAT</a></li>
+          <li><a href="#alphabet"      >ALPHABET</a></li>
         </ul>
       </li>
+      <li><a href="#isBigNumber">isBigNumber</a></li>
+      <li><a href="#max"        >maximum</a><span>max</span></li>
+      <li><a href="#min"        >minimum</a><span>min</span></li>
+      <li><a href="#random"     >random</a></li>
+      <li><a href="#sum"        >sum</a></li>
     </ul>
 
     <a href="#constructor-properties">Properties</a>
@@ -96,590 +108,1025 @@ code,pre{font-family:Monaco,Consolas,"Lu
 
     <a href="#prototype-methods">Methods</a>
     <ul>
-      <li><a href="#abs"    >absoluteValue</a></li>
-      <li><a href="#ceil"   >ceil</a></li>
-      <li><a href="#floor"  >floor</a></li>
-      <li><a href="#neg"    >negated</a></li>
-      <li><a href="#sqrt"   >squareRoot</a></li>
-      <li><a href="#isF"    >isFinite</a></li>
-      <li><a href="#isNaN"  >isNaN</a></li>
-      <li><a href="#isNeg"  >isNegative</a></li>
-      <li><a href="#isZ"    >isZero</a></li>
-      <li><a href="#cmp"    >comparedTo</a></li>
-      <li><a href="#div"    >dividedBy</a></li>
-      <li><a href="#minus"  >minus</a></li>
-      <li><a href="#mod"    >modulo</a></li>
-      <li><a href="#plus"   >plus</a></li>
-      <li><a href="#times"  >times</a></li>
-      <li><a href="#pow"    >toPower</a></li>
-      <li><a href="#eq"     >equals</a></li>
-      <li><a href="#gt"     >greaterThan</a></li>
-      <li><a href="#gte"    >greaterThanOrEqualTo</a></li>
-      <li><a href="#lt"     >lessThan</a></li>
-      <li><a href="#lte"    >lessThanOrEqualTo</a></li>
-      <li><a href="#toE"    >toExponential</a></li>
-      <li><a href="#toF"    >toFixed</a></li>
-      <li><a href="#toP"    >toPrecision</a></li>
-      <li><a href="#toS"    >toString</a></li>
-      <li><a href="#valueOf">valueOf</a></li>
-      <li><a href="#toFr"   >toFraction</a></li>
-      <li><a href="#round"  >round</a></li>
+      <li><a href="#abs"    >absoluteValue         </a><span>abs</span>  </li>
+      <li><a href="#cmp"    >comparedTo            </a>                  </li>
+      <li><a href="#dp"     >decimalPlaces         </a><span>dp</span>   </li>
+      <li><a href="#div"    >dividedBy             </a><span>div</span>  </li>
+      <li><a href="#divInt" >dividedToIntegerBy    </a><span>idiv</span> </li>
+      <li><a href="#pow"    >exponentiatedBy       </a><span>pow</span>  </li>
+      <li><a href="#int"    >integerValue          </a>                  </li>
+      <li><a href="#eq"     >isEqualTo             </a><span>eq</span>   </li>
+      <li><a href="#isF"    >isFinite              </a>                  </li>
+      <li><a href="#gt"     >isGreaterThan         </a><span>gt</span>   </li>
+      <li><a href="#gte"    >isGreaterThanOrEqualTo</a><span>gte</span>  </li>
+      <li><a href="#isInt"  >isInteger             </a>                  </li>
+      <li><a href="#lt"     >isLessThan            </a><span>lt</span>   </li>
+      <li><a href="#lte"    >isLessThanOrEqualTo   </a><span>lte</span>  </li>
+      <li><a href="#isNaN"  >isNaN                 </a>                  </li>
+      <li><a href="#isNeg"  >isNegative            </a>                  </li>
+      <li><a href="#isPos"  >isPositive            </a>                  </li>
+      <li><a href="#isZ"    >isZero                </a>                  </li>
+      <li><a href="#minus"  >minus                 </a>                  </li>
+      <li><a href="#mod"    >modulo                </a><span>mod</span>  </li>
+      <li><a href="#times"  >multipliedBy          </a><span>times</span></li>
+      <li><a href="#neg"    >negated               </a>                  </li>
+      <li><a href="#plus"   >plus                  </a>                  </li>
+      <li><a href="#sd"     >precision             </a><span>sd</span>   </li>
+      <li><a href="#shift"  >shiftedBy             </a>                  </li>
+      <li><a href="#sqrt"   >squareRoot            </a><span>sqrt</span> </li>
+      <li><a href="#toE"    >toExponential         </a>                  </li>
+      <li><a href="#toFix"  >toFixed               </a>                  </li>
+      <li><a href="#toFor"  >toFormat              </a>                  </li>
+      <li><a href="#toFr"   >toFraction            </a>                  </li>
+      <li><a href="#toJSON" >toJSON                </a>                  </li>
+      <li><a href="#toN"    >toNumber              </a>                  </li>
+      <li><a href="#toP"    >toPrecision           </a>                  </li>
+      <li><a href="#toS"    >toString              </a>                  </li>
+      <li><a href="#valueOf">valueOf               </a>                  </li>
     </ul>
 
     <a href="#instance-properties">Properties</a>
     <ul>
-      <li><a href="#coefficient">c : coefficient</a></li>
-      <li><a href="#exponent"   >e : exponent</a></li>
-      <li><a href="#sign"       >s : sign</a></li>
+      <li><a href="#coefficient">c: coefficient</a></li>
+      <li><a href="#exponent"   >e: exponent</a></li>
+      <li><a href="#sign"       >s: sign</a></li>
     </ul>
 
     <a href="#zero-nan-infinity">Zero, NaN &amp; Infinity</a>
-
     <a href="#Errors">Errors</a>
-
+    <a href="#type-coercion">Type coercion</a>
     <a class='end' href="#faq">FAQ</a>
 
   </div>
 
   <div class="container">
 
-    <h1>bignumber.js</h1>
+    <h1>bignumber<span id='js'>.js</span></h1>
 
     <p>A JavaScript library for arbitrary-precision arithmetic.</p>
-
-    <p>
-      <a href="https://github.com/MikeMcl/bignumber.js">Hosted on GitHub</a>.
-    </p>
-
+    <p><a href="https://github.com/MikeMcl/bignumber.js">Hosted on GitHub</a>. </p>
 
     <h2>API</h2>
 
     <p>
-      In all examples below, <code>var</code> and semicolons are not shown, and
-      if a commented-out value is in quotes it means <code>toString</code> has
-      been called on the preceding expression.
+      See the <a href='https://github.com/MikeMcl/bignumber.js'>README</a> on GitHub for a
+      quick-start introduction.
+    </p>
+    <p>
+      In all examples below, <code>var</code> and semicolons are not shown, and if a commented-out
+      value is in quotes it means <code>toString</code> has been called on the preceding expression.
     </p>
-
 
 
     <h3>CONSTRUCTOR</h3>
 
+
     <h5 id="bignumber">
-      BigNumber<code class='inset'>BigNumber(value [, base]) &rArr;
-      <i>BigNumber</i>
-      </code>
+      BigNumber<code class='inset'>BigNumber(n [, base]) <i>&rArr; BigNumber</i></code>
     </h5>
-    <dl>
-      <dt><code>value</code></dt>
-      <dd>
-        <i>number|string|BigNumber</i> : See <a href='#range'>RANGE</a> for
-        range.
-      </dd>
-      <dd>
-        A numeric value.
-      </dd>
-      <dd>
-        Legitimate values include <code>&plusmn;0</code>,
-        <code>&plusmn;Infinity</code> and <code>NaN</code>.
-      </dd>
-      <dd>
-        Values of type <em>number</em> with more than 15 significant digits are
-        considered invalid as calling <code>toString</code> or
-        <code>valueOf</code> on such numbers may not result in the intended
-        value.
-      </dd>
-      <dd>
-        There is no limit to the number of digits of a value of type
-        <em>string</em> (other than that of JavaScript's maximum array size).
-      </dd>
-      <dd>
-        Decimal string values may be in exponential, as well as normal
-        (non-exponential) notation. Non-decimal values must be in normal
-        notation.
-      </dd>
-      <dd>
-        String values in hexadecimal literal form, e.g. <code>'0xff'</code>, are
-        invalid, and string values in octal literal form will be interpreted as
-        decimals, e.g. <code>'011'</code> is interpreted as 11, not 9.
-      </dd>
-      <dd>Values in any base may have fraction digits.</dd>
-      <dd>
-        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, <code>a-z</code>
-        represents values from 10 to 35, <code>A-Z</code> from 36 to 61, and
-        <code>$</code> and <code>_</code> represent 62 and 63 respectively <i>
-        (this can be changed by ediiting the DIGITS variable near the top of the 
-        source file).</i>
-      </dd>
-    </dl>
-    <dl>
-      <dt><code>base</code></dt>
-      <dd>
-        <i>number</i> : integer, <code>2</code> to <code>64</code> inclusive
-      </dd>
-      <dd>The base of <code>value</code>.</dd>
-      <dd>If <code>base</code> is omitted, or is <code>null</code> or undefined,
-      base 10 is assumed.</dd>
-    </dl>
-    <p>Returns a new instance of a BigNumber object.</p>
     <p>
-      If a base is specified, the value is rounded according to
-      the current <a href='#decimal-places'><code>DECIMAL_PLACES</code></a> and
-      <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> settings.
-      Usefully, this means the decimal places of a decimal value
-      passed to the constructor can be limited by explicitly specifying base 10.
+      <code>n</code>: <i>number|string|BigNumber</i><br />
+      <code>base</code>: <i>number</i>: integer, <code>2</code> to <code>36</code> inclusive. (See
+      <a href='#alphabet'><code>ALPHABET</code></a> to extend this range).
     </p>
     <p>
-      See <a href='#Errors'>Errors</a> for the treatment of an invalid
-      <code>value</code> or <code>base</code>.
+      Returns a new instance of a BigNumber object with value <code>n</code>, where <code>n</code>
+      is a numeric value in the specified <code>base</code>, or base <code>10</code> if
+      <code>base</code> is omitted or is <code>null</code> or <code>undefined</code>.
     </p>
     <pre>
-x = new BigNumber(9)                       // '9'
-y = new BigNumber(x)                       // '9'
-BigNumber(435.345)                         // 'new' is optional
-new BigNumber('5032485723458348569331745.33434346346912144534543')
+x = new BigNumber(123.4567)                // '123.4567'
+// 'new' is optional
+y = BigNumber(x)                           // '123.4567'</pre>
+    <p>
+      If <code>n</code> is a base <code>10</code> value it can be in normal (fixed-point) or
+      exponential notation. Values in other bases must be in normal notation. Values in any base can
+      have fraction digits, i.e. digits after the decimal point.
+    </p>
+    <pre>
+new BigNumber(43210)                       // '43210'
 new BigNumber('4.321e+4')                  // '43210'
 new BigNumber('-735.0918e-430')            // '-7.350918e-428'
-new BigNumber(Infinity)                    // 'Infinity'
+new BigNumber('123412421.234324', 5)       // '607236.557696'</pre>
+    <p>
+      Signed <code>0</code>, signed <code>Infinity</code> and <code>NaN</code> are supported.
+    </p>
+    <pre>
+new BigNumber('-Infinity')                 // '-Infinity'
 new BigNumber(NaN)                         // 'NaN'
+new BigNumber(-0)                          // '0'
 new BigNumber('.5')                        // '0.5'
-new BigNumber('+2')                        // '2'
+new BigNumber('+2')                        // '2'</pre>
+    <p>
+      String values in hexadecimal literal form, e.g. <code>'0xff'</code>, are valid, as are
+      string values with the octal and binary prefixs <code>'0o'</code> and <code>'0b'</code>.
+      String values in octal literal form without the prefix will be interpreted as
+      decimals, e.g. <code>'011'</code> is interpreted as 11, not 9.
+    </p>
+    <pre>
 new BigNumber(-10110100.1, 2)              // '-180.5'
-new BigNumber('123412421.234324', 5)       // '607236.557696'
+new BigNumber('-0b10110100.1')             // '-180.5'
 new BigNumber('ff.8', 16)                  // '255.5'
+new BigNumber('0xff.8')                    // '255.5'</pre>
+    <p>
+      If a base is specified, <code>n</code> is rounded according to the current
+      <a href='#decimal-places'><code>DECIMAL_PLACES</code></a> and
+      <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> settings. <em>This includes base
+      <code>10</code> so don't include a <code>base</code> parameter for decimal values unless
+      this behaviour is wanted.</em>
+    </p>
+    <pre>BigNumber.config({ DECIMAL_PLACES: 5 })
+new BigNumber(1.23456789)                  // '1.23456789'
+new BigNumber(1.23456789, 10)              // '1.23457'</pre>
+    <p>An error is thrown if <code>base</code> is invalid. See <a href='#Errors'>Errors</a>.</p>
+    <p>
+      There is no limit to the number of digits of a value of type <em>string</em> (other than
+      that of JavaScript's maximum array size). See <a href='#range'><code>RANGE</code></a> to set
+      the maximum and minimum possible exponent value of a BigNumber.
+    </p>
+    <pre>
+new BigNumber('5032485723458348569331745.33434346346912144534543')
+new BigNumber('4.321e10000000')</pre>
+    <p>BigNumber <code>NaN</code> is returned if <code>n</code> is invalid
+    (unless <code>BigNumber.DEBUG</code> is <code>true</code>, see below).</p>
+    <pre>
+new BigNumber('.1*')                       // 'NaN'
+new BigNumber('blurgh')                    // 'NaN'
+new BigNumber(9, 2)                        // 'NaN'</pre>
+    <p>
+      To aid in debugging, if <code>BigNumber.DEBUG</code> is <code>true</code> then an error will
+      be thrown on an invalid <code>n</code>. An error will also be thrown if <code>n</code> is of
+      type <em>number</em> with more than <code>15</code> significant digits, as calling
+      <code><a href='#toS'>toString</a></code> or <code><a href='#valueOf'>valueOf</a></code> on
+      these numbers may not result in the intended value.
+    </p>
+      <pre>
+console.log(823456789123456.3)            //  823456789123456.2
+new BigNumber(823456789123456.3)          // '823456789123456.2'
+BigNumber.DEBUG = true
+// '[BigNumber Error] Number primitive has more than 15 significant digits'
+new BigNumber(823456789123456.3)
+// '[BigNumber Error] Not a base 2 number'
+new BigNumber(9, 2)</pre>
 
-new BigNumber(9, 2)
-// Throws 'not a base 2 number' if ERRORS is true, otherwise 'NaN'
 
-new BigNumber(96517860459076817.4395)
-// Throws 'number type has more than 15 significant digits'
-// if ERRORS is true, otherwise '96517860459076820'
 
-new BigNumber('blurgh')
-// Throws 'not a number' if ERRORS is true, otherwise 'NaN'
 
-BigNumber.config({DECIMAL_PLACES : 5})
-new BigNumber(1.23456789)                  // '1.23456789'
-new BigNumber(1.23456789, 10)              // '1.23457'</pre>
+    <h4 id="methods">Methods</h4>
+     <p>The static methods of a BigNumber constructor.</p>
 
 
-    <h4 id="methods">Methods</h4>
+
+
+    <h5 id="clone">clone
+      <code class='inset'>.clone([object]) <i>&rArr; BigNumber constructor</i></code>
+    </h5>
+    <p><code>object</code>: <i>object</i></p>
     <p>
-      The <code>BigNumber</code> constructor has one added method,
-      <code>config</code>, which configures the library-wide settings for
-      arithmetic, formatting and errors.
+      Returns a new independent BigNumber constructor with configuration as described by
+      <code>object</code> (see <a href='#config'><code>config</code></a>), or with the default
+      configuration if <code>object</code> is <code>null</code> or <code>undefined</code>.
     </p>
+    <p>
+      Throws if <code>object</code> is not an object. See <a href='#Errors'>Errors</a>.
+    </p>
+    <pre>BigNumber.config({ DECIMAL_PLACES: 5 })
+BN = BigNumber.clone({ DECIMAL_PLACES: 9 })
 
-    <h5 id="config">
-      config<code class='inset'>config([settings]) &rArr; <i>object</i></code>
-    </h5>
-    <i>
-      Note: the settings can also be supplied as an argument list,
-      see below.
-    </i>
-    <dl>
-      <dt><code>settings</code></dt>
-      <dd><i>object</i></dd>
+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 })</pre>
+
+
+
+    <h5 id="config">config<code class='inset'>set([object]) <i>&rArr; object</i></code></h5>
+    <p>
+      <code>object</code>: <i>object</i>: an object that contains some or all of the following
+      properties.
+    </p>
+    <p>Configures the settings for this particular BigNumber constructor.</p>
 
+    <dl class='inset'>
+      <dt id="decimal-places"><code><b>DECIMAL_PLACES</b></code></dt>
+      <dd>
+        <i>number</i>: integer, <code>0</code> to <code>1e+9</code> inclusive<br />
+        Default value: <code>20</code>
+      </dd>
       <dd>
-        An object that contains some or all of the following properties:
-        <dl>
+        The <u>maximum</u> 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.<br />
+      </dd>
+      <dd>
+      <pre>BigNumber.config({ DECIMAL_PLACES: 5 })
+BigNumber.set({ DECIMAL_PLACES: 5 })    // equivalent</pre>
+      </dd>
 
 
 
-          <dt id="decimal-places"><code><b>DECIMAL_PLACES</b></code></dt>
-          <dd>
-            <i>number</i> : integer, <code>0</code> to <code>1e+9</code>
-            inclusive<br />
-            Default value: <code>20</code>
-          </dd>
-          <dd>
-            The <u>maximum</u> number of decimal places of the results of
-            division, square root and base conversion operations, and power
-            operations with negative exponents.<br />
-            I.e. aside from the base conversion which may be involved with any
-            method that accepts a base argument, the value is only relevant to
-            the <code>dividedBy</code>, <code>squareRoot</code> and
-            <code>toPower</code> methods.
-          </dd>
-          <dd>
-            <pre>BigNumber.config({ DECIMAL_PLACES : 5 })
-BigNumber.config(5)    // equivalent</pre>
-          </dd>
-
-
-
-          <dt id="rounding-mode"><code><b>ROUNDING_MODE</b></code></dt>
-          <dd>
-            <i>number</i> : integer, <code>0</code> to <code>8</code>
-            inclusive<br />
-            Default value: <code>4</code>
-            <a href="#h-up">(<code>ROUND_HALF_UP</code>)</a>
-          </dd>
-          <dd>
-            The rounding mode used in the above operations and by
-            <a href='#round'><code>round</code></a>,
-            <a href='#toE'><code>toExponential</code></a>,
-            <a href='#toF'><code>toFixed</code></a> and
-            <a href='#toP'><code>toPrecision</code></a>.
-          </dd>
-          <dd>
-             The modes are available as enumerated properties of the BigNumber
-             constructor.
-          </dd>
-           <dd>
-            <pre>BigNumber.config({ ROUNDING_MODE : 0 })
-BigNumber.config(null, BigNumber.ROUND_UP)    // equivalent</pre>
-          </dd>
-
-
-
-          <dt id="exponential-at"><code><b>EXPONENTIAL_AT</b></code></dt>
-          <dd>
-            <i>number</i> : integer, magnitude <code>0</code> to
-            <code>1e+9</code> inclusive, or<br />
-            <i>number</i>[] : [ integer -1e+9 to 0 inclusive, integer 0 to 1e+9
-            inclusive ]<br />
-            Default value: <code>[-7, 20]</code>
-          </dd>
-          <dd>
-            The exponent value(s) at which <code>toString</code> returns
-            exponential notation.
-          </dd>
-          <dd>
-            If a single number is assigned, the value is the exponent magnitude.
-            <br />
-            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.
-          </dd>
-          <dd>
-            For example, to emulate JavaScript numbers in terms of the exponent
-            values at which they begin to use exponential notation, use
-            <code>[-7, 20]</code>.
-          </dd>
-          <dd>
-            <pre>BigNumber.config({ EXPONENTIAL_AT : 2 })
+      <dt id="rounding-mode"><code><b>ROUNDING_MODE</b></code></dt>
+      <dd>
+        <i>number</i>: integer, <code>0</code> to <code>8</code> inclusive<br />
+        Default value: <code>4</code> <a href="#round-half-up">(<code>ROUND_HALF_UP</code>)</a>
+      </dd>
+      <dd>
+        The rounding mode used in the above operations and the default rounding mode of
+        <a href='#dp'><code>decimalPlaces</code></a>,
+        <a href='#sd'><code>precision</code></a>,
+        <a href='#toE'><code>toExponential</code></a>,
+        <a href='#toFix'><code>toFixed</code></a>,
+        <a href='#toFor'><code>toFormat</code></a> and
+        <a href='#toP'><code>toPrecision</code></a>.
+      </dd>
+      <dd>The modes are available as enumerated properties of the BigNumber constructor.</dd>
+       <dd>
+      <pre>BigNumber.config({ ROUNDING_MODE: 0 })
+BigNumber.set({ ROUNDING_MODE: BigNumber.ROUND_UP })    // equivalent</pre>
+        </dd>
+
+
+
+      <dt id="exponential-at"><code><b>EXPONENTIAL_AT</b></code></dt>
+      <dd>
+        <i>number</i>: integer, magnitude <code>0</code> to <code>1e+9</code> inclusive, or
+        <br />
+        <i>number</i>[]: [ integer <code>-1e+9</code> to <code>0</code> inclusive, integer
+        <code>0</code> to <code>1e+9</code> inclusive ]<br />
+        Default value: <code>[-7, 20]</code>
+      </dd>
+      <dd>
+        The exponent value(s) at which <code>toString</code> returns exponential notation.
+      </dd>
+      <dd>
+        If a single number is assigned, the value is the exponent magnitude.<br />
+        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.
+      </dd>
+      <dd>
+        For example, to emulate JavaScript numbers in terms of the exponent values at which they
+        begin to use exponential notation, use <code>[-7, 20]</code>.
+      </dd>
+      <dd>
+      <pre>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] })
+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 })
+BigNumber.config({ EXPONENTIAL_AT: 1e+9 })
 
 // Always return exponential notation:
-BigNumber.config({ EXPONENTIAL_AT : 0 })</pre>
-          </dd>
-          <dd>
-            Regardless of the value of <code>EXPONENTIAL_AT</code>, the
-            <code>toFixed</code> method will always return a value in
-            normal notation and the <code>toExponential</code> method will
-            always return a value in exponential form.
-          </dd>
-          <dd>
-            Calling <code>toString</code> with a base argument, e.g.
-            <code>toString(10)</code>, will also always return normal notation.
-          </dd>
+BigNumber.config({ EXPONENTIAL_AT: 0 })</pre>
+      </dd>
+      <dd>
+        Regardless of the value of <code>EXPONENTIAL_AT</code>, the <code>toFixed</code> method
+        will always return a value in normal notation and the <code>toExponential</code> method
+        will always return a value in exponential form.
+      </dd>
+      <dd>
+        Calling <code>toString</code> with a base argument, e.g. <code>toString(10)</code>, will
+        also always return normal notation.
+      </dd>
 
 
 
-          <dt id="range"><code><b>RANGE</b></code></dt>
-          <dd>
-            <i>number</i> : integer, magnitude <code>1</code> to
-            <code>1e+9</code> inclusive, or<br />
-            <i>number</i>[] : [ integer -1e+9 to -1 inclusive, integer 1 to 1e+9
-            inclusive ]<br />
-            Default value: <code>[-1e+9, 1e+9]</code>
-          </dd>
-          <dd>
-            The exponent value(s) beyond which overflow to Infinity and
-            underflow to zero occurs.
-          </dd>
-          <dd>
-            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.
-          <dd>
-            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.
-          </dd>
-          <dd>
-            For example, to emulate JavaScript numbers in terms of the exponent
-            values at which they become zero and Infinity, use
-            <code>[-324, 308]</code>.
-          </dd>
-          <dd>
-            <pre>BigNumber.config({ RANGE : 500 })
+      <dt id="range"><code><b>RANGE</b></code></dt>
+      <dd>
+        <i>number</i>: integer, magnitude <code>1</code> to <code>1e+9</code> inclusive, or
+        <br />
+        <i>number</i>[]: [ integer <code>-1e+9</code> to <code>-1</code> inclusive, integer
+        <code>1</code> to <code>1e+9</code> inclusive ]<br />
+        Default value: <code>[-1e+9, 1e+9]</code>
+      </dd>
+      <dd>
+        The exponent value(s) beyond which overflow to <code>Infinity</code> and underflow to
+        zero occurs.
+      </dd>
+      <dd>
+        If a single number is assigned, it is the maximum exponent magnitude: values wth a
+        positive exponent of greater magnitude become <code>Infinity</code> and those with a
+        negative exponent of greater magnitude become zero.
+      <dd>
+        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.
+      </dd>
+      <dd>
+        For example, to emulate JavaScript numbers in terms of the exponent values at which they
+        become zero and <code>Infinity</code>, use <code>[-324, 308]</code>.
+      </dd>
+      <dd>
+      <pre>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] })
+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</pre>
-          </dd>
-          <dd>
-            The largest possible magnitude of a finite BigNumber is<br />
-            9.999...e+1000000000<br />
-            The smallest possible magnitude of a non-zero BigNumber is<br />
-            1e-1000000000
-          </dd>
+      </dd>
+      <dd>
+        The largest possible magnitude of a finite BigNumber is
+        <code>9.999...e+1000000000</code>.<br />
+        The smallest possible magnitude of a non-zero BigNumber is <code>1e-1000000000</code>.
+      </dd>
 
 
 
-          <dt id="errors"><code><b>ERRORS</b></code></dt>
-          <dd>
-            <i>boolean/number</i> : <code>true, false, 1 or 0</code><br />
-            Default value: <code>true</code>
-          </dd>
-          <dd>
-            The value that determines whether BigNumber Errors are thrown.<br />
-            If <code>ERRORS</code> is false, this library will not throw errors.
-          </dd>
-          <dd>
-            See <a href='#Errors'>Errors</a>.
-          </dd>
-           <dd>
-            <pre>BigNumber.config({ ERRORS : false })</pre>
-          </dd>
-        </dl>
+      <dt id="crypto"><code><b>CRYPTO</b></code></dt>
+      <dd>
+        <i>boolean</i>: <code>true</code> or <code>false</code>.<br />
+        Default value: <code>false</code>
+      </dd>
+      <dd>
+        The value that determines whether cryptographically-secure pseudo-random number
+        generation is used.
+      </dd>
+      <dd>
+        If <code>CRYPTO</code> is set to <code>true</code> then the
+        <a href='#random'><code>random</code></a> method will generate random digits using
+        <code>crypto.getRandomValues</code> in browsers that support it, or
+        <code>crypto.randomBytes</code> if using Node.js.
+      </dd>
+      <dd>
+        If neither function is supported by the host environment then attempting to set
+        <code>CRYPTO</code> to <code>true</code> will fail and an exception will be thrown.
       </dd>
+      <dd>
+        If <code>CRYPTO</code> is <code>false</code> then the source of randomness used will be
+        <code>Math.random</code> (which is assumed to generate at least <code>30</code> bits of
+        randomness).
+      </dd>
+      <dd>See <a href='#random'><code>random</code></a>.</dd>
+      <dd>
+      <pre>
+// Node.js
+global.crypto = require('crypto')
+
+BigNumber.config({ CRYPTO: true })
+BigNumber.config().CRYPTO       // true
+BigNumber.random()              // 0.54340758610486147524</pre>
+      </dd>
+
+
+
+      <dt id="modulo-mode"><code><b>MODULO_MODE</b></code></dt>
+      <dd>
+        <i>number</i>: integer, <code>0</code> to <code>9</code> inclusive<br />
+        Default value: <code>1</code> (<a href="#round-down"><code>ROUND_DOWN</code></a>)
+      </dd>
+      <dd>The modulo mode used when calculating the modulus: <code>a mod n</code>.</dd>
+      <dd>
+        The quotient, <code>q = a / n</code>, is calculated according to the
+        <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> that corresponds to the chosen
+        <code>MODULO_MODE</code>.
+      </dd>
+      <dd>The remainder, <code>r</code>, is calculated as: <code>r = a - n * q</code>.</dd>
+      <dd>
+        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.
+      </dd>
+      <dd>
+        <table>
+          <tr><th>Property</th><th>Value</th><th>Description</th></tr>
+          <tr>
+            <td><b>ROUND_UP</b></td><td class='centre'>0</td>
+            <td>
+              The remainder is positive if the dividend is negative, otherwise it is negative.
+            </td>
+          </tr>
+          <tr>
+            <td><b>ROUND_DOWN</b></td><td class='centre'>1</td>
+            <td>
+              The remainder has the same sign as the dividend.<br />
+              This uses 'truncating division' and matches the behaviour of JavaScript's
+              remainder operator <code>%</code>.
+            </td>
+          </tr>
+          <tr>
+            <td><b>ROUND_FLOOR</b></td><td class='centre'>3</td>
+            <td>
+              The remainder has the same sign as the divisor.<br />
+              This matches Python's <code>%</code> operator.
+            </td>
+          </tr>
+          <tr>
+            <td><b>ROUND_HALF_EVEN</b></td><td class='centre'>6</td>
+            <td>The <i>IEEE 754</i> remainder function.</td>
+          </tr>
+           <tr>
+             <td><b>EUCLID</b></td><td class='centre'>9</td>
+             <td>
+               The remainder is always positive. Euclidian division: <br />
+               <code>q = sign(n) * floor(a / abs(n))</code>
+             </td>
+           </tr>
+        </table>
+      </dd>
+      <dd>
+        The rounding/modulo modes are available as enumerated properties of the BigNumber
+        constructor.
+      </dd>
+      <dd>See <a href='#mod'><code>modulo</code></a>.</dd>
+      <dd>
+        <pre>BigNumber.config({ MODULO_MODE: BigNumber.EUCLID })
+BigNumber.config({ MODULO_MODE: 9 })          // equivalent</pre>
+      </dd>
+
+
+
+      <dt id="pow-precision"><code><b>POW_PRECISION</b></code></dt>
+      <dd>
+        <i>number</i>: integer, <code>0</code> to <code>1e+9</code> inclusive.<br />
+        Default value: <code>0</code>
+      </dd>
+      <dd>
+        The <i>maximum</i> precision, i.e. number of significant digits, of the result of the power
+        operation (unless a modulus is specified).
+      </dd>
+      <dd>If set to <code>0</code>, the number of significant digits will not be limited.</dd>
+      <dd>See <a href='#pow'><code>exponentiatedBy</code></a>.</dd>
+      <dd><pre>BigNumber.config({ POW_PRECISION: 100 })</pre></dd>
+
+
+
+      <dt id="format"><code><b>FORMAT</b></code></dt>
+      <dd><i>object</i></dd>
+      <dd>
+        The <code>FORMAT</code> object configures the format of the string returned by the
+        <a href='#toFor'><code>toFormat</code></a> method.
+      </dd>
+      <dd>
+        The example below shows the properties of the <code>FORMAT</code> object that are
+        recognised, and their default values.
+      </dd>
+      <dd>
+         Unlike the other configuration properties, the values of the properties of the
+         <code>FORMAT</code> object will not be checked for validity. The existing
+         <code>FORMAT</code> object will simply be replaced by the object that is passed in.
+         The object can include any number of the properties shown below.
+      </dd>
+      <dd>See <a href='#toFor'><code>toFormat</code></a> for examples of usage.</dd>
+      <dd>
+      <pre>
+BigNumber.config({
+  FORMAT: {
+    // string to prepend
+    prefix: '',
+    // decimal separator
+    decimalSeparator: '.',
+    // grouping separator of the integer part
+    groupSeparator: ',',
+    // primary grouping size of the integer part
+    groupSize: 3,
+    // secondary grouping size of the integer part
+    secondaryGroupSize: 0,
+    // grouping separator of the fraction part
+    fractionGroupSeparator: ' ',
+    // grouping size of the fraction part
+    fractionGroupSize: 0,
+    // string to append
+    suffix: ''
+  }
+});</pre>
+      </dd>
+
+
+
+      <dt id="alphabet"><code><b>ALPHABET</b></code></dt>
+      <dd>
+        <i>string</i><br />
+        Default value: <code>'0123456789abcdefghijklmnopqrstuvwxyz'</code>
+      </dd>
+      <dd>
+        The alphabet used for base conversion. The length of the alphabet corresponds to the
+        maximum value of the base argument that can be passed to the
+        <a href='#bignumber'><code>BigNumber</code></a> constructor or
+        <a href='#toS'><code>toString</code></a>.
+      </dd>
+      <dd>
+        There is no maximum length for the alphabet, but it must be at least 2 characters long, and
+        it must not contain whitespace or a repeated character, or the sign indicators
+        <code>'+'</code> and <code>'-'</code>, or the decimal separator <code>'.'</code>.
+      </dd>
+      <dd>
+        <pre>// duodecimal (base 12)
+BigNumber.config({ ALPHABET: '0123456789TE' })
+x = new BigNumber('T', 12)
+x.toString()                // '10'
+x.toString(12)              // 'T'</pre>
+      </dd>
+
+
+
     </dl>
+    <br /><br />
+    <p>Returns an object with the above properties and their current values.</p>
     <p>
-      <br />Returns an object with the above properties and their current
-      values.
-    </p>
-    <p>
-      If the value to be assigned to any of the above properties is
-      <code>null</code> or undefined it is ignored. See
-      <a href='#Errors'>Errors</a> for the treatment of invalid values.
+      Throws if <code>object</code> is not an object, or if an invalid value is assigned to
+      one or more of the above properties. See <a href='#Errors'>Errors</a>.
     </p>
     <pre>
 BigNumber.config({
-    DECIMAL_PLACES : 40,
-    ROUNDING_MODE : BigNumber.ROUND_HALF_CEIL,
-    EXPONENTIAL_AT : [-10, 20],
-    RANGE : [-500, 500],
-    ERRORS : true
+  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$_'
 });
 
-// Alternatively but equivalently:
-BigNumber.config( 40, 7, [-10, 20], 500, 1 )
-
 obj = BigNumber.config();
-obj.ERRORS       // true
-obj.RANGE        // [-500, 500]</pre>
+obj.DECIMAL_PLACES        // 40
+obj.RANGE                 // [-500, 500]</pre>
+
+
+
+    <h5 id="isBigNumber">
+      isBigNumber<code class='inset'>.isBigNumber(value) <i>&rArr; boolean</i></code>
+    </h5>
+    <p><code>value</code>: <i>any</i><br /></p>
+    <p>
+      Returns <code>true</code> if <code>value</code> is a BigNumber instance, otherwise returns
+      <code>false</code>.
+    </p>
+      <pre>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</pre>
+
+
+
+    <h5 id="max">maximum<code class='inset'>.max(n...) <i>&rArr; BigNumber</i></code></h5>
+    <p>
+      <code>n</code>: <i>number|string|BigNumber</i><br />
+      <i>See <code><a href="#bignumber">BigNumber</a></code> for further parameter details.</i>
+    </p>
+    <p>
+      Returns a BigNumber whose value is the maximum of the arguments.
+    </p>
+    <p>The return value is always exact and unrounded.</p>
+    <pre>x = new BigNumber('3257869345.0378653')
+BigNumber.maximum(4e9, x, '123456789.9')      // '4000000000'
+
+arr = [12, '13', new BigNumber(14)]
+BigNumber.max.apply(null, arr)                // '14'</pre>
+
+
+
+    <h5 id="min">minimum<code class='inset'>.min(n...) <i>&rArr; BigNumber</i></code></h5>
+    <p>
+      <code>n</code>: <i>number|string|BigNumber</i><br />
+      <i>See <code><a href="#bignumber">BigNumber</a></code> for further parameter details.</i>
+    </p>
+    <p>
+      Returns a BigNumber whose value is the minimum of the arguments.
+    </p>
+    <p>The return value is always exact and unrounded.</p>
+    <pre>x = new BigNumber('3257869345.0378653')
+BigNumber.minimum(4e9, x, '123456789.9')      // '123456789.9'
+
+arr = [2, new BigNumber(-14), '-15.9999', -12]
+BigNumber.min.apply(null, arr)                // '-15.9999'</pre>
+
+
+
+    <h5 id="random">
+      random<code class='inset'>.random([dp]) <i>&rArr; BigNumber</i></code>
+    </h5>
+    <p><code>dp</code>: <i>number</i>: integer, <code>0</code> to <code>1e+9</code> inclusive</p>
+    <p>
+      Returns a new BigNumber with a pseudo-random value equal to or greater than <code>0</code> and
+      less than <code>1</code>.
+    </p>
+    <p>
+      The return value will have <code>dp</code> decimal places (or less if trailing zeros are
+      produced).<br />
+      If <code>dp</code> is omitted then the number of decimal places will default to the current
+      <a href='#decimal-places'><code>DECIMAL_PLACES</code></a> setting.
+    </p>
+    <p>
+      Depending on the value of this BigNumber constructor's
+      <a href='#crypto'><code>CRYPTO</code></a> setting and the support for the
+      <code>crypto</code> object in the host environment, the random digits of the return value are
+      generated by either <code>Math.random</code> (fastest), <code>crypto.getRandomValues</code>
+      (Web Cryptography API in recent browsers) or <code>crypto.randomBytes</code> (Node.js).
+    </p>
+    <p>
+      To be able to set <a href='#crypto'><code>CRYPTO</code></a> to <code>true</code> when using
+      Node.js, the <code>crypto</code> object must be available globally:
+    </p>
+    <pre>global.crypto = require('crypto')</pre>
+    <p>
+      If <a href='#crypto'><code>CRYPTO</code></a> is <code>true</code>, i.e. one of the
+      <code>crypto</code> methods is to be used, the value of a returned BigNumber should be
+      cryptographically-secure and statistically indistinguishable from a random value.
+    </p>
+    <p>
+      Throws if <code>dp</code> is invalid. See <a href='#Errors'>Errors</a>.
+    </p>
+    <pre>BigNumber.config({ DECIMAL_PLACES: 10 })
+BigNumber.random()              // '0.4117936847'
+BigNumber.random(20)            // '0.78193327636914089009'</pre>
+
+
+
+    <h5 id="sum">sum<code class='inset'>.sum(n...) <i>&rArr; BigNumber</i></code></h5>
+    <p>
+      <code>n</code>: <i>number|string|BigNumber</i><br />
+      <i>See <code><a href="#bignumber">BigNumber</a></code> for further parameter details.</i>
+    </p>
+    <p>Returns a BigNumber whose value is the sum of the arguments.</p>
+    <p>The return value is always exact and unrounded.</p>
+    <pre>x = new BigNumber('3257869345.0378653')
+BigNumber.sum(4e9, x, '123456789.9')      // '7381326134.9378653'
+
+arr = [2, new BigNumber(14), '15.9999', 12]
+BigNumber.sum.apply(null, arr)            // '43.9999'</pre>
 
 
 
     <h4 id="constructor-properties">Properties</h4>
     <p>
-      The library's enumerated rounding modes are stored as properties of the
-      constructor.<br />
-      They are not referenced internally by the library itself.
+      The library's enumerated rounding modes are stored as properties of the constructor.<br />
+      (They are not referenced internally by the library itself.)
     </p>
     <p>
-      Rounding modes 0 to 6 (inclusive) are the same as those of Java's
+      Rounding modes <code>0</code> to <code>6</code> (inclusive) are the same as those of Java's
       BigDecimal class.
     </p>
     <table>
       <tr>
-      	<th>Property</th>
-      	<th>Value</th>
-      	<th>Description</th>
+        <th>Property</th>
+        <th>Value</th>
+        <th>Description</th>
       </tr>
       <tr>
-      	<td id="round-up"><b>ROUND_UP</b></td>
-      	<td class='centre'>0</td>
-      	<td>Rounds away from zero</td>
+        <td id="round-up"><b>ROUND_UP</b></td>
+        <td class='centre'>0</td>
+        <td>Rounds away from zero</td>
       </tr>
       <tr>
-      	<td id="round-down"><b>ROUND_DOWN</b></td>
-      	<td class='centre'>1</td>
-      	<td>Rounds towards zero</td>
+        <td id="round-down"><b>ROUND_DOWN</b></td>
+        <td class='centre'>1</td>
+        <td>Rounds towards zero</td>
       </tr>
       <tr>
-      	<td id="round-ceil"><b>ROUND_CEIL</b></td>
-      	<td class='centre'>2</td>
-      	<td>Rounds towards Infinity</td>
+        <td id="round-ceil"><b>ROUND_CEIL</b></td>
+        <td class='centre'>2</td>
+        <td>Rounds towards <code>Infinity</code></td>
       </tr>
       <tr>
-      	<td id="round-floor"><b>ROUND_FLOOR</b></td>
-      	<td class='centre'>3</td>
-      	<td>Rounds towards -Infinity</td>
+        <td id="round-floor"><b>ROUND_FLOOR</b></td>
+        <td class='centre'>3</td>
+        <td>Rounds towards <code>-Infinity</code></td>
       </tr>
       <tr>
-      	<td id="round-half-up"><b>ROUND_HALF_UP</b></td>
-      	<td class='centre'>4</td>
-      	<td>
+        <td id="round-half-up"><b>ROUND_HALF_UP</b></td>
+        <td class='centre'>4</td>
+        <td>
           Rounds towards nearest neighbour.<br />
           If equidistant, rounds away from zero
         </td>
       </tr>
       <tr>
-      	<td id="round-half-down"><b>ROUND_HALF_DOWN</b></td>
-      	<td class='centre'>5</td>
-      	<td>
+        <td id="round-half-down"><b>ROUND_HALF_DOWN</b></td>
+        <td class='centre'>5</td>
+        <td>
           Rounds towards nearest neighbour.<br />
           If equidistant, rounds towards zero
         </td>
       </tr>
       <tr>
-      	<td id="round-half-even"><b>ROUND_HALF_EVEN</b></td>
-      	<td class='centre'>6</td>
-      	<td>
+        <td id="round-half-even"><b>ROUND_HALF_EVEN</b></td>
+        <td class='centre'>6</td>
+        <td>
           Rounds towards nearest neighbour.<br />
           If equidistant, rounds towards even neighbour
         </td>
       </tr>
       <tr>
-      	<td id="round-half-ceil"><b>ROUND_HALF_CEIL</b></td>
-      	<td class='centre'>7</td>
-      	<td>
+        <td id="round-half-ceil"><b>ROUND_HALF_CEIL</b></td>
+        <td class='centre'>7</td>
+        <td>
           Rounds towards nearest neighbour.<br />
-          If equidistant, rounds towards Infinity
+          If equidistant, rounds towards <code>Infinity</code>
         </td>
       </tr>
       <tr>
-      	<td id="round-half-floor"><b>ROUND_HALF_FLOOR</b></td>
-      	<td class='centre'>8</td>
-      	<td>
+        <td id="round-half-floor"><b>ROUND_HALF_FLOOR</b></td>
+        <td class='centre'>8</td>
+        <td>
           Rounds towards nearest neighbour.<br />
-          If equidistant, rounds towards -Infinity
+          If equidistant, rounds towards <code>-Infinity</code>
         </td>
       </tr>
     </table>
     <pre>
-BigNumber.config({ ROUNDING_MODE : BigNumber.ROUND_CEIL })
-BigNumber.config({ ROUNDING_MODE : 2 })     // equivalent</pre>
+BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_CEIL })
+BigNumber.config({ ROUNDING_MODE: 2 })     // equivalent</pre>
 
 
     <h3>INSTANCE</h3>
 
     <h4 id="prototype-methods">Methods</h4>
+    <p>The methods inherited by a BigNumber instance from its constructor's prototype object.</p>
+    <p>A BigNumber is immutable in the sense that it is not changed by its methods. </p>
     <p>
-      The methods inherited by a BigNumber instance from its constructor's
-      prototype object.
-    </p>
-    <p>
-      A BigNumber is immutable in the sense that it is not changed by its
-      methods.
-    </p>
-    <p>
-      The treatment of &plusmn;<code>0</code>, &plusmn;<code>Infinity</code> and
-      <code>NaN</code> is consistent with how JavaScript treats these values.
+      The treatment of &plusmn;<code>0</code>, &plusmn;<code>Infinity</code> and <code>NaN</code> is
+      consistent with how JavaScript treats these values.
     </p>
+    <p>Many method names have a shorter alias.</p>
+
+
+
+    <h5 id="abs">absoluteValue<code class='inset'>.abs() <i>&rArr; BigNumber</i></code></h5>
     <p>
-      Method names over 5 letters in length have a shorter alias (except
-      <code>valueOf</code>).<br />
-      Internally, the library always uses the shorter method names.
+      Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of
+      this BigNumber.
     </p>
+    <p>The return value is always exact and unrounded.</p>
+    <pre>
+x = new BigNumber(-0.8)
+y = x.absoluteValue()           // '0.8'
+z = y.abs()                     // '0.8'</pre>
 
 
 
-    <h5 id="abs">
-      absoluteValue<code class='inset'>.abs() &rArr; <i>BigNumber</i></code>
+    <h5 id="cmp">
+      comparedTo<code class='inset'>.comparedTo(n [, base]) <i>&rArr; number</i></code>
     </h5>
     <p>
-      Returns a BigNumber whose value is the absolute value, i.e. the magnitude,
-      of this BigNumber.
+      <code>n</code>: <i>number|string|BigNumber</i><br />
+      <code>base</code>: <i>number</i><br />
+      <i>See <a href="#bignumber">BigNumber</a> for further parameter details.</i>
     </p>
+    <table>
+      <tr><th>Returns</th><th>&nbsp;</th></tr>
+      <tr>
+        <td class='centre'><code>1</code></td>
+        <td>If the value of this BigNumber is greater than the value of <code>n</code></td>
+      </tr>
+      <tr>
+        <td class='centre'><code>-1</code></td>
+        <td>If the value of this BigNumber is less than the value of <code>n</code></td>
+      </tr>
+      <tr>
+        <td class='centre'><code>0</code></td>
+        <td>If this BigNumber and <code>n</code> have the same value</td>
+      </tr>
+       <tr>
+        <td class='centre'><code>null</code></td>
+        <td>If the value of either this BigNumber or <code>n</code> is <code>NaN</code></td>
+      </tr>
+    </table>
     <pre>
-x = new BigNumber(-0.8)
-y = x.absoluteValue()         // '0.8'
-z = y.abs()                   // '0.8'</pre>
+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</pre>
 
 
 
-    <h5 id="ceil">
-      ceil<code class='inset'>.ceil() &rArr; <i>BigNumber</i></code>
+    <h5 id="dp">
+      decimalPlaces<code class='inset'>.dp([dp [, rm]]) <i>&rArr; BigNumber|number</i></code>
     </h5>
     <p>
-      Returns a BigNumber whose value is the value of this BigNumber rounded to
-      a whole number in the direction of Infinity.
+      <code>dp</code>: <i>number</i>: integer, <code>0</code> to <code>1e+9</code> inclusive<br />
+      <code>rm</code>: <i>number</i>: integer, <code>0</code> to <code>8</code> inclusive
+    </p>
+    <p>
+      If <code>dp</code> is a number, returns a BigNumber whose value is the value of this BigNumber
+      rounded by rounding mode <code>rm</code> to a maximum of <code>dp</code> decimal places.
+    </p>
+    <p>
+      If <code>dp</code> is omitted, or is <code>null</code> or <code>undefined</code>, the return
+      value is the number of decimal places of the value of this BigNumber, or <code>null</code> if
+      the value of this BigNumber is &plusmn;<code>Infinity</code> or <code>NaN</code>.
+    </p>
+    <p>
+      If <code>rm</code> is omitted, or is <code>null</code> or <code>undefined</code>,
+      <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> is used.
+    </p>
+    <p>
+      Throws if <code>dp</code> or <code>rm</code> is invalid. See <a href='#Errors'>Errors</a>.
     </p>
     <pre>
-x = new BigNumber(1.3)
-x.ceil()                      // '2'
-y = new BigNumber(-1.8)
-y.ceil()                      // '-1'</pre>
+x = new BigNumber(1234.56)
+x.decimalPlaces(1)                     // '1234.6'
+x.dp()                                 // 2
+x.decimalPlaces(2)                     // '1234.56'
+x.dp(10)                               // '1234.56'
+x.decimalPlaces(0, 1)                  // '1234'
+x.dp(0, 6)                             // '1235'
+x.decimalPlaces(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</pre>
 
 
 
-    <h5 id="floor">
-      floor<code class='inset'>.floor() &rArr;
-      <i>BigNumber</i></code>
+    <h5 id="div">dividedBy<code class='inset'>.div(n [, base]) <i>&rArr; BigNumber</i></code>
     </h5>
     <p>
-      Returns a BigNumber whose value is the value of this BigNumber rounded to
-      a whole number in the direction of -Infinity.
+      <code>n</code>: <i>number|string|BigNumber</i><br />
+      <code>base</code>: <i>number</i><br />
+      <i>See <a href="#bignumber">BigNumber</a> for further parameter details.</i>
+    </p>
+    <p>
+      Returns a BigNumber whose value is the value of this BigNumber divided by
+      <code>n</code>, rounded according to the current
+      <a href='#decimal-places'><code>DECIMAL_PLACES</code></a> and
+      <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> settings.
     </p>
     <pre>
-x = new BigNumber(1.8)
-x.floor()                     // '1'
-y = new BigNumber(-1.3)
-y.floor()                     // '-2'</pre>
+x = new BigNumber(355)
+y = new BigNumber(113)
+x.dividedBy(y)                  // '3.14159292035398230088'
+x.div(5)                        // '71'
+x.div(47, 16)                   // '5'</pre>
 
 
 
-    <h5 id="neg">
-      negated<code class='inset'>.neg() &rArr; <i>BigNumber</i></code>
+    <h5 id="divInt">
+      dividedToIntegerBy<code class='inset'>.idiv(n [, base]) &rArr;
+      <i>BigNumber</i></code>
     </h5>
     <p>
-      Returns a BigNumber whose value is the value of this BigNumber negated,
-      i.e. multiplied by -1.
+      <code>n</code>: <i>number|string|BigNumber</i><br />
+      <code>base</code>: <i>number</i><br />
+      <i>See <a href="#bignumber">BigNumber</a> for further parameter details.</i>
+    </p>
+    <p>
+      Returns a BigNumber whose value is the integer part of dividing the value of this BigNumber by
+      <code>n</code>.
     </p>
     <pre>
-x = new BigNumber(1.8)
-x.negated()                   // '-1.8'
-y = new BigNumber(-1.3)
-y.neg()                       // '1.3'</pre>
+x = new BigNumber(5)
+y = new BigNumber(3)
+x.dividedToIntegerBy(y)         // '1'
+x.idiv(0.7)                     // '7'
+x.idiv('0.f', 16)               // '5'</pre>
 
 
 
-    <h5 id="sqrt">
-      squareRoot<code class='inset'>.sqrt() &rArr; <i>BigNumber</i></code>
+    <h5 id="pow">
+      exponentiatedBy<code class='inset'>.pow(n [, m]) <i>&rArr; BigNumber</i></code>
     </h5>
     <p>
-      Returns a BigNumber whose value is the square root of this BigNumber,
-      correctly rounded according to the current
+      <code>n</code>: <i>number|string|BigNumber</i>: integer<br />
+      <code>m</code>: <i>number|string|BigNumber</i>
+    </p>
+    <p>
+      Returns a BigNumber whose value is the value of this BigNumber exponentiated by
+      <code>n</code>, i.e. raised to the power <code>n</code>, and optionally modulo a modulus
+      <code>m</code>.
+    </p>
+    <p>
+      Throws if <code>n</code> is not an integer. See <a href='#Errors'>Errors</a>.
+    </p>
+    <p>
+      If <code>n</code> is negative the result is rounded according to the current
       <a href='#decimal-places'><code>DECIMAL_PLACES</code></a> and
       <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> settings.
     </p>
+    <p>
+      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 <code>50000</code> digits, the number of significant
+      digits calculated is limited to the value of the
+      <a href='#pow-precision'><code>POW_PRECISION</code></a> setting (unless a modulus
+      <code>m</code> is specified).
+    </p>
+    <p>
+      By default <a href='#pow-precision'><code>POW_PRECISION</code></a> is set to <code>0</code>.
+      This means that an unlimited number of significant digits will be calculated, and that the
+      method's performance will decrease dramatically for larger exponents.
+    </p>
+    <p>
+      If <code>m</code> is specified and the value of <code>m</code>, <code>n</code> and this
+      BigNumber are integers, and <code>n</code> is positive, then a fast modular exponentiation
+      algorithm is used, otherwise the operation will be performed as
+      <code>x.exponentiatedBy(n).modulo(m)</code> with a
+      <a href='#pow-precision'><code>POW_PRECISION</code></a> of <code>0</code>.
+    </p>
     <pre>
-x = new BigNumber(16)
-x.squareRoot()                // '4'
-y = new BigNumber(3)
-y.sqrt()                      // '1.73205080756887729353'</pre>
+Math.pow(0.7, 2)                // 0.48999999999999994
+x = new BigNumber(0.7)
+x.exponentiatedBy(2)            // '0.49'
+BigNumber(3).pow(-2)            // '0.11111111111111111111'</pre>
 
 
 
-    <h5 id="isF">
-      isFinite<code class='inset'>.isF() &rArr; <i>boolean</i></code>
+    <h5 id="int">
+      integerValue<code class='inset'>.integerValue([rm]) <i>&rArr; BigNumber</i></code>
     </h5>
     <p>
-      Returns <code>true</code> if the value of this BigNumber is a finite
-      number, otherwise returns <code>false</code>.<br />
-      The only possible non-finite values of a BigNumber are NaN, Infinity and
-      -Infinity.
+      <code>rm</code>: <i>number</i>: integer, <code>0</code> to <code>8</code> inclusive
+    </p>
+   <p>
+      Returns a BigNumber whose value is the value of this BigNumber rounded to an integer using
+      rounding mode <code>rm</code>.
+    </p>
+    <p>
+      If <code>rm</code> is omitted, or is <code>null</code> or <code>undefined</code>,
+      <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> is used.
+    </p>
+    <p>
+      Throws if <code>rm</code> is invalid. See <a href='#Errors'>Errors</a>.
+    </p>
+    <pre>
+x = new BigNumber(123.456)
+x.integerValue()                        // '123'
+x.integerValue(BigNumber.ROUND_CEIL)    // '124'
+y = new BigNumber(-12.7)
+y.integerValue()                        // '-13'
+y.integerValue(BigNumber.ROUND_DOWN)    // '-12'</pre>
+    <p>
+      The following is an example of how to add a prototype method that emulates JavaScript's
+      <code>Math.round</code> function. <code>Math.ceil</code>, <code>Math.floor</code> and
+      <code>Math.trunc</code> can be emulated in the same way with
+      <code>BigNumber.ROUND_CEIL</code>, <code>BigNumber.ROUND_FLOOR</code> and
+      <code> BigNumber.ROUND_DOWN</code> respectively.
+    </p>
+    <pre>
+BigNumber.prototype.round = function (n) {
+  return n.integerValue(BigNumber.ROUND_HALF_CEIL);
+};
+x.round()                               // '123'</pre>
+
+
+
+    <h5 id="eq">isEqualTo<code class='inset'>.eq(n [, base]) <i>&rArr; boolean</i></code></h5>
+    <p>
+      <code>n</code>: <i>number|string|BigNumber</i><br />
+      <code>base</code>: <i>number</i><br />
+      <i>See <a href="#bignumber">BigNumber</a> for further parameter details.</i>
+    </p>
+    <p>
+      Returns <code>true</code> if the value of this BigNumber is equal to the value of
+      <code>n</code>, otherwise returns <code>false</code>.<br />
+      As with JavaScript, <code>NaN</code> does not equal <code>NaN</code>.
+    </p>
+    <p>Note: This method uses the <a href='#cmp'><code>comparedTo</code></a> method internally.</p>
+    <pre>
+0 === 1e-324                    // true
+x = new BigNumber(0)
+x.isEqualTo('1e-324')           // false
+BigNumber(-0).eq(x)             // true  ( -0 === 0 )
+BigNumber(255).eq('ff', 16)     // true
+
+y = new BigNumber(NaN)
+y.isEqualTo(NaN)                // false</pre>
+
+
+
+    <h5 id="isF">isFinite<code class='inset'>.isFinite() <i>&rArr; boolean</i></code></h5>
+    <p>
+      Returns <code>true</code> if the value of this BigNumber is a finite number, otherwise
+      returns <code>false</code>.
+    </p>
+    <p>
+      The only possible non-finite values of a BigNumber are <code>NaN</code>, <code>Infinity</code>
+      and <code>-Infinity</code>.
     </p>
     <pre>
 x = new BigNumber(1)
-x.isFinite()                  // true
+x.isFinite()                    // true
 y = new BigNumber(Infinity)
-y.isF()                       // false</pre>
+y.isFinite()                    // false</pre>
     <p>
       Note: The native method <code>isFinite()</code> can be used if
       <code>n &lt;= Number.MAX_VALUE</code>.
@@ -687,535 +1134,630 @@ y.isF()                       // false</
 
 
 
-    <h5 id="isNaN">
-      isNaN<code class='inset'>.isNaN() &rArr; <i>boolean</i></code>
-    </h5>
+    <h5 id="gt">isGreaterThan<code class='inset'>.gt(n [, base]) <i>&rArr; boolean</i></code></h5>
     <p>
-      Returns <code>true</code> if the value of this BigNumber is NaN, otherwise
-      returns <code>false</code>.<br />
+      <code>n</code>: <i>number|string|BigNumber</i><br />
+      <code>base</code>: <i>number</i><br />
+      <i>See <a href="#bignumber">BigNumber</a> for further parameter details.</i>
     </p>
-    <pre>
-x = new BigNumber(NaN)
-x.isNaN()                     // true
-y = new BigNumber('Infinity')
-y.isNaN()                     // false</pre>
     <p>
-      Note: The native method <code>isNaN()</code> can also be used.
+      Returns <code>true</code> if the value of this BigNumber is greater than the value of
+      <code>n</code>, otherwise returns <code>false</code>.
     </p>
+    <p>Note: This method uses the <a href='#cmp'><code>comparedTo</code></a> method internally.</p>
+    <pre>
+0.1 &gt; (0.3 - 0.2)                             // true
+x = new BigNumber(0.1)
+x.isGreaterThan(BigNumber(0.3).minus(0.2))    // false
+BigNumber(0).gt(x)                            // false
+BigNumber(11, 3).gt(11.1, 2)                  // true</pre>
 
 
 
-    <h5 id="isNeg">
-      isNegative<code class='inset'>.isNeg() &rArr; <i>boolean</i></code>
+    <h5 id="gte">
+      isGreaterThanOrEqualTo<code class='inset'>.gte(n [, base]) <i>&rArr; boolean</i></code>
     </h5>
     <p>
-      Returns <code>true</code> if the value of this BigNumber is negative,
-      otherwise returns <code>false</code>.<br />
+      <code>n</code>: <i>number|string|BigNumber</i><br />
+      <code>base</code>: <i>number</i><br />
+      <i>See <a href="#bignumber">BigNumber</a> for further parameter details.</i>
     </p>
-    <pre>
-x = new BigNumber(-0)
-x.isNegative()                // true
-y = new BigNumber(2)
-y.isNeg                       // false</pre>
     <p>
-      Note: <code>n &lt; 0</code> can be used if
-      <code>n &lt;= -Number.MIN_VALUE</code>.
+      Returns <code>true</code> if the value of this BigNumber is greater than or equal to the value
+      of <code>n</code>, otherwise returns <code>false</code>.
     </p>
+    <p>Note: This method uses the <a href='#cmp'><code>comparedTo</code></a> method internally.</p>
+    <pre>
+(0.3 - 0.2) &gt;= 0.1                     // false
+x = new BigNumber(0.3).minus(0.2)
+x.isGreaterThanOrEqualTo(0.1)          // true
+BigNumber(1).gte(x)                    // true
+BigNumber(10, 18).gte('i', 36)         // true</pre>
 
 
 
-    <h5 id="isZ">
-      isZero<code class='inset'>.isZ() &rArr; <i>boolean</i></code>
-    </h5>
+    <h5 id="isInt">isInteger<code class='inset'>.isInteger() <i>&rArr; boolean</i></code></h5>
     <p>
-      Returns <code>true</code> if the value of this BigNumber is zero or minus
-      zero, otherwise returns <code>false</code>.<br />
+      Returns <code>true</code> if the value of this BigNumber is an integer, otherwise returns
+      <code>false</code>.
     </p>
     <pre>
-x = new BigNumber(-0)
-x.isZero() && x.isNeg()        // true
-y = new BigNumber(Infinity)
-y.isZ()                        // false</pre>
+x = new BigNumber(1)
+x.isInteger()                   // true
+y = new BigNumber(123.456)
+y.isInteger()                   // false</pre>
+
+
+
+    <h5 id="lt">isLessThan<code class='inset'>.lt(n [, base]) <i>&rArr; boolean</i></code></h5>
     <p>
-      Note: <code>n == 0</code> can be used if
-      <code>n &gt;= Number.MIN_VALUE</code>.
+      <code>n</code>: <i>number|string|BigNumber</i><br />
+      <code>base</code>: <i>number</i><br />
+      <i>See <a href="#bignumber">BigNumber</a> for further parameter details.</i>
     </p>
+    <p>
+      Returns <code>true</code> if the value of this BigNumber is less than the value of
+      <code>n</code>, otherwise returns <code>false</code>.
+    </p>
+     <p>Note: This method uses the <a href='#cmp'><code>comparedTo</code></a> method internally.</p>
+    <pre>
+(0.3 - 0.2) &lt; 0.1                       // true
+x = new BigNumber(0.3).minus(0.2)
+x.isLessThan(0.1)                       // false
+BigNumber(0).lt(x)                      // true
+BigNumber(11.1, 2).lt(11, 3)            // true</pre>
 
 
 
-    <h5 id="cmp">
-      comparedTo<code class='inset'>.cmp(n [, base]) &rArr; <i>number</i></code>
+    <h5 id="lte">
+      isLessThanOrEqualTo<code class='inset'>.lte(n [, base]) <i>&rArr; boolean</i></code>
     </h5>
     <p>
-      <code>n</code> : <i>number|string|BigNumber</i><br />
-      <code>base</code> : <i>number</i><br />
-      <i>
-        See <a href="#bignumber">constructor</a> for further parameter details.
-      </i>
+      <code>n</code>: <i>number|string|BigNumber</i><br />
+      <code>base</code>: <i>number</i><br />
+      <i>See <a href="#bignumber">BigNumber</a> for further parameter details.</i>
+    </p>
+    <p>
+      Returns <code>true</code> if the value of this BigNumber is less than or equal to the value of
+      <code>n</code>, otherwise returns <code>false</code>.
+    </p>
+    <p>Note: This method uses the <a href='#cmp'><code>comparedTo</code></a> method internally.</p>
+    <pre>
+0.1 &lt;= (0.3 - 0.2)                                // false
+x = new BigNumber(0.1)
+x.isLessThanOrEqualTo(BigNumber(0.3).minus(0.2))  // true
+BigNumber(-1).lte(x)                              // true
+BigNumber(10, 18).lte('i', 36)                    // true</pre>
+
+
+
+    <h5 id="isNaN">isNaN<code class='inset'>.isNaN() <i>&rArr; boolean</i></code></h5>
+    <p>
+      Returns <code>true</code> if the value of this BigNumber is <code>NaN</code>, otherwise
+      returns <code>false</code>.
+    </p>
+    <pre>
+x = new BigNumber(NaN)
+x.isNaN()                       // true
+y = new BigNumber('Infinity')
+y.isNaN()                       // false</pre>
+    <p>Note: The native method <code>isNaN()</code> can also be used.</p>
+
+
+
+    <h5 id="isNeg">isNegative<code class='inset'>.isNegative() <i>&rArr; boolean</i></code></h5>
+    <p>
+      Returns <code>true</code> if the sign of this BigNumber is negative, otherwise returns
+      <code>false</code>.
     </p>
-    <table>
-      <tr>
-      	<th>Returns</th>
-      	<th colspan=2>&nbsp;</th>
-      </tr>
-      <tr>
-      	<td class='centre'>1</td>
-      	<td>
-          If the value of this BigNumber is greater than the value of <code>n</code>
-        </td>
-      </tr>
-      <tr>
-      	<td class='centre'>-1</td>
-      	<td>
-          If the value of this BigNumber is less than the value of <code>n</code>
-        </td>
-      </tr>
-      <tr>
-      	<td class='centre'>0</td>
-      	<td>If this BigNumber and <code>n</code> have the same value</td>
-      </tr>
-       <tr>
-      	<td class='centre'>null</td>
-      	<td>
-          if the value of either this BigNumber or <code>n</code> is
-          <code>NaN</code>
-        </td>
-      </tr>
-    </table>
     <pre>
-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</pre>
+x = new BigNumber(-0)
+x.isNegative()                  // true
+y = new BigNumber(2)
+y.isNegative()                  // false</pre>
+    <p>Note: <code>n &lt; 0</code> can be used if <code>n &lt;= -Number.MIN_VALUE</code>.</p>
 
 
 
-    <h5 id="div">
-      dividedBy<code class='inset'>.div(n [, base]) &rArr;
-      <i>BigNumber</i></code>
-    </h5>
+    <h5 id="isPos">isPositive<code class='inset'>.isPositive() <i>&rArr; boolean</i></code></h5>
     <p>
-      <code>n</code> : <i>number|string|BigNumber</i><br />
-      <code>base</code> : <i>number</i><br />
-      <i>See <a href="#bignumber">constructor</a> for further parameter details.
-      </i>
+      Returns <code>true</code> if the sign of this BigNumber is positive, otherwise returns
+      <code>false</code>.
     </p>
+    <pre>
+x = new BigNumber(-0)
+x.isPositive()                  // false
+y = new BigNumber(2)
+y.isPositive()                  // true</pre>
+
+
+
+    <h5 id="isZ">isZero<code class='inset'>.isZero() <i>&rArr; boolean</i></code></h5>
     <p>
-      Returns a BigNumber whose value is the value of this BigNumber divided by
-      <code>n</code>, rounded according to the current
-      <a href='#decimal-places'><code>DECIMAL_PLACES</code></a> and
-      <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> settings.
+      Returns <code>true</code> if the value of this BigNumber is zero or minus zero, otherwise
+      returns <code>false</code>.
     </p>
     <pre>
-x = new BigNumber(355)
-y = new BigNumber(113)
-x.dividedBy(y)             // '3.14159292035398230088'
-x.div(5)                   // '71'
-x.div(47, 16)              // '5'</pre>
+x = new BigNumber(-0)
+x.isZero() && x.isneg()         // true
+y = new BigNumber(Infinity)
+y.isZero()                      // false</pre>
+    <p>Note: <code>n == 0</code> can be used if <code>n &gt;= Number.MIN_VALUE</code>.</p>
 
 
 
     <h5 id="minus">
-      minus<code class='inset'>.minus(n [, base]) &rArr; <i>BigNumber</i></code>
+      minus<code class='inset'>.minus(n [, base]) <i>&rArr; BigNumber</i></code>
     </h5>
     <p>
-      <code>n</code> : <i>number|string|BigNumber</i><br />
-      <code>base</code> : <i>number</i><br />
-      <i>See <a href="#bignumber">constructor</a> for further parameter details.
-      </i>
-    </p>
-    <p>
-      Returns a BigNumber whose value is the value of this BigNumber minus
-      <code>n</code>.
+      <code>n</code>: <i>number|string|BigNumber</i><br />
+      <code>base</code>: <i>number</i><br />
+      <i>See <a href="#bignumber">BigNumber</a> for further parameter details.</i>
     </p>
+    <p>Returns a BigNumber whose value is the value of this BigNumber minus <code>n</code>.</p>
+    <p>The return value is always exact and unrounded.</p>
     <pre>
-0.3 - 0.1                  // 0.19999999999999998
+0.3 - 0.1                       // 0.19999999999999998
 x = new BigNumber(0.3)
-x.minus(0.1)               // '0.2'
-x.minus(0.6, 20)           // '0'</pre>
+x.minus(0.1)                    // '0.2'
+x.minus(0.6, 20)                // '0'</pre>
 
 
 
-    <h5 id="mod">
-      modulo<code class='inset'>.mod(n [, base]) &rArr; <i>BigNumber</i></code>
-    </h5>
+    <h5 id="mod">modulo<code class='inset'>.mod(n [, base]) <i>&rArr; BigNumber</i></code></h5>
     <p>
-      <code>n</code> : <i>number|string|BigNumber</i><br />
-      <code>base</code> : <i>number</i><br />
-      <i>See <a href="#bignumber">constructor</a> for further parameter details.
-      </i>
+      <code>n</code>: <i>number|string|BigNumber</i><br />
+      <code>base</code>: <i>number</i><br />
+      <i>See <a href="#bignumber">BigNumber</a> for further parameter details.</i>
     </p>
     <p>
-      Returns a BigNumber whose value is the value of this BigNumber modulo
-      <code>n</code>, i.e. the integer remainder of dividing this BigNumber by
-      <code>n</code>.
+      Returns a BigNumber whose value is the value of this BigNumber modulo <code>n</code>, i.e.
+      the integer remainder of dividing this BigNumber by <code>n</code>.
+    </p>
+    <p>
+      The value returned, and in particular its sign, is dependent on the value of the
+      <a href='#modulo-mode'><code>MODULO_MODE</code></a> setting of this BigNumber constructor.
+      If it is <code>1</code> (default value), the result will have the same sign as this BigNumber,
+      and it will match that of Javascript's <code>%</code> operator (within the limits of double
+      precision) and BigDecimal's <code>remainder</code> method.
     </p>
+    <p>The return value is always exact and unrounded.</p>
     <p>
-      The result will have the same sign as this BigNumber, and it will match
-      that of JavaScript's % operator (within the limits of its precision) and
-      BigDecimal's remainder method.
+      See <a href='#modulo-mode'><code>MODULO_MODE</code></a> for a description of the other
+      modulo modes.
     </p>
     <pre>
-1 % 0.9                    // 0.09999999999999998
+1 % 0.9                         // 0.09999999999999998
 x = new BigNumber(1)
-x.modulo(0.9)              // '0.1'
+x.modulo(0.9)                   // '0.1'
 y = new BigNumber(33)
-y.mod('a', 33)             // '3'</pre>
+y.mod('a', 33)                  // '3'</pre>
 
 
 
-    <h5 id="plus">
-      plus<code class='inset'>.plus(n [, base]) &rArr; <i>BigNumber</i></code>
+    <h5 id="times">
+      multipliedBy<code class='inset'>.times(n [, base]) <i>&rArr; BigNumber</i></code>
     </h5>
     <p>
-      <code>n</code> : <i>number|string|BigNumber</i><br />
-      <code>base</code> : <i>number</i><br />
-      <i>See <a href="#bignumber">constructor</a> for further parameter details.
-      </i>
+      <code>n</code>: <i>number|string|BigNumber</i><br />
+      <code>base</code>: <i>number</i><br />
+      <i>See <a href="#bignumber">BigNumber</a> for further parameter details.</i>
     </p>
     <p>
-      Returns a BigNumber whose value is the value of this BigNumber plus
-      <code>n</code>.
+      Returns a BigNumber whose value is the value of this BigNumber multiplied by <code>n</code>.
     </p>
+    <p>The return value is always exact and unrounded.</p>
     <pre>
-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'</pre>
+0.6 * 3                         // 1.7999999999999998
+x = new BigNumber(0.6)
+y = x.multipliedBy(3)           // '1.8'
+BigNumber('7e+500').times(y)    // '1.26e+501'
+x.multipliedBy('-a', 16)        // '-6'</pre>
 
 
 
-    <h5 id="times">
-      times<code class='inset'>.times(n [, base]) &rArr; <i>BigNumber</i></code>
-    </h5>
+    <h5 id="neg">negated<code class='inset'>.negated() <i>&rArr; BigNumber</i></code></h5>
     <p>
-      <code>n</code> : <i>number|string|BigNumber</i><br />
-      <code>base</code> : <i>number</i><br />
-      <i>See <a href="#bignumber">constructor</a> for further parameter details.
-      </i>
+      Returns a BigNumber whose value is the value of this BigNumber negated, i.e. multiplied by
+      <code>-1</code>.
     </p>
+    <pre>
+x = new BigNumber(1.8)
+x.negated()                     // '-1.8'
+y = new BigNumber(-1.3)
+y.negated()                     // '1.3'</pre>
+
+
+
+    <h5 id="plus">plus<code class='inset'>.plus(n [, base]) <i>&rArr; BigNumber</i></code></h5>
     <p>
-      Returns a BigNumber whose value is the value of this BigNumber times
-      <code>n</code>.
+      <code>n</code>: <i>number|string|BigNumber</i><br />
+      <code>base</code>: <i>number</i><br />
+      <i>See <a href="#bignumber">BigNumber</a> for further parameter details.</i>
     </p>
+    <p>Returns a BigNumber whose value is the value of this BigNumber plus <code>n</code>.</p>
+    <p>The return value is always exact and unrounded.</p>
     <pre>
-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'</pre>
+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'</pre>
 
 
 
-    <h5 id="pow">
-      toPower<code class='inset'>.pow(exp) &rArr; <i>BigNumber</i></code>
+    <h5 id="sd">
+      precision<code class='inset'>.sd([d [, rm]]) <i>&rArr; BigNumber|number</i></code>
     </h5>
     <p>
-      <code>exp</code> : <i>number</i> : integer, -1e+6 to 1e+6 inclusive
+      <code>d</code>: <i>number|boolean</i>: integer, <code>1</code> to <code>1e+9</code>
+      inclusive, or <code>true</code> or <code>false</code><br />
+      <code>rm</code>: <i>number</i>: integer, <code>0</code> to <code>8</code> inclusive.
     </p>
     <p>
-      Returns a BigNumber whose value is the value of this BigNumber raised to
-      the power <code>exp</code>.
+      If <code>d</code> is a number, returns a BigNumber whose value is the value of this BigNumber
+      rounded to a precision of <code>d</code> significant digits using rounding mode
+      <code>rm</code>.
     </p>
     <p>
-      If <code>exp</code> is negative the result is rounded according to the
-      current <a href='#decimal-places'><code>DECIMAL_PLACES</code></a> and
-      <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> settings.
+      If <code>d</code> is omitted or is <code>null</code> or <code>undefined</code>, the return
+      value is the number of significant digits of the value of this BigNumber, or <code>null</code>
+      if the value of this BigNumber is &plusmn;<code>Infinity</code> or <code>NaN</code>.</p>
     </p>
     <p>
-      If <code>exp</code> is not an integer or is out of range:
+      If <code>d</code> is <code>true</code> then any trailing zeros of the integer
+      part of a number are counted as significant digits, otherwise they are not.
     </p>
-    <p class='inset'>
-      If <code>ERRORS</code> is <code>true</code> a BigNumber
-      Error is thrown,<br />
-      else if <code>exp</code> is greater than 1e+6, it is interpreted as
-      <code>Infinity</code>;<br />
-      else if <code>exp</code> is less than -1e+6, it is interpreted as
-      <code>-Infinity</code>;<br />
-      else if <code>exp</code> is otherwise a number, it is truncated to an
-      integer;<br />
-      else it is interpreted as <code>NaN</code>.
+    <p>
+      If <code>rm</code> is omitted or is <code>null</code> or <code>undefined</code>,
+      <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> will be used.
     </p>
     <p>
-      Note: High value exponents may cause this method to be slow to return.
+      Throws if <code>d</code> or <code>rm</code> is invalid. See <a href='#Errors'>Errors</a>.
     </p>
     <pre>
-Math.pow(0.7, 2)             // 0.48999999999999994
-x = new BigNumber(0.7)
-x.toPower(2)                 // '0.49'
-BigNumber(3).pow(-2)         // '0.11111111111111111111'
+x = new BigNumber(9876.54321)
+x.precision(6)                         // '9876.54'
+x.sd()                                 // 9
+x.precision(6, BigNumber.ROUND_UP)     // '9876.55'
+x.sd(2)                                // '9900'
+x.precision(2, 1)                      // '9800'
+x                                      // '9876.54321'
+y = new BigNumber(987000)
+y.precision()                          // 3
+y.sd(true)                             // 6</pre>
 
-new BigNumber(123.456).toPower(1000).toString().length     // 5099
-new BigNumber(2).pow(1e+6)   // Time taken (Node.js): 9 minutes 34 secs.</pre>
 
 
-
-    <h5 id="eq">
-      equals<code class='inset'>.eq(n [, base]) &rArr; <i>boolean</i></code>
-    </h5>
+<h5 id="shift">shiftedBy<code class='inset'>.shiftedBy(n) <i>&rArr; BigNumber</i></code></h5>
+    <p>
+      <code>n</code>: <i>number</i>: integer,
+      <code>-9007199254740991</code> to <code>9007199254740991</code> inclusive
+    </p>
     <p>
-      <code>n</code> : <i>number|string|BigNumber</i><br />
-      <code>base</code> : <i>number</i><br />
-      <i>See <a href="#bignumber">constructor</a> for further parameter details.
-      </i>
+      Returns a BigNumber whose value is the value of this BigNumber shifted by <code>n</code>
+      places.
+    <p>
+      The shift is of the decimal point, i.e. of powers of ten, and is to the left if <code>n</code>
+      is negative or to the right if <code>n</code> is positive.
     </p>
+    <p>The return value is always exact and unrounded.</p>
     <p>
-      Returns <code>true</code> if the value of this BigNumber equals the value
-      of <code>n</code>, otherwise returns <code>false</code>.<br />
-      As with JavaScript, NaN does not equal NaN.
-      <br />Note : This method uses the <code>comparedTo</code> method
-      internally.
+      Throws if <code>n</code> is invalid. See <a href='#Errors'>Errors</a>.
     </p>
     <pre>
-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</pre>
+x = new BigNumber(1.23)
+x.shiftedBy(3)                      // '1230'
+x.shiftedBy(-3)                     // '0.00123'</pre>
 
 
 
-    <h5 id="gt">
-      greaterThan<code class='inset'>.gt(n [, base]) &rArr;
-      <i>boolean</i></code>
-    </h5>
+    <h5 id="sqrt">squareRoot<code class='inset'>.sqrt() <i>&rArr; BigNumber</i></code></h5>
     <p>
-      <code>n</code> : <i>number|string|BigNumber</i><br />
-      <code>base</code> : <i>number</i><br />
-      <i>See <a href="#bignumber">constructor</a> for further parameter details.
-      </i>
+      Returns a BigNumber whose value is the square root of the value of this BigNumber,
+      rounded according to the current
+      <a href='#decimal-places'><code>DECIMAL_PLACES</code></a> and
+      <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> settings.
     </p>
     <p>
-      Returns <code>true</code> if the value of this BigNumber is greater than
-      the value of <code>n</code>, otherwise returns <code>false</code>.<br />
-      Note : This method uses the <code>comparedTo</code> method internally.
+      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.
     </p>
     <pre>
-0.1 &gt; (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</pre>
+x = new BigNumber(16)
+x.squareRoot()                  // '4'
+y = new BigNumber(3)
+y.sqrt()                        // '1.73205080756887729353'</pre>
 
 
 
-    <h5 id="gte">
-      greaterThanOrEqualTo<code class='inset'>.gte(n [, base]) &rArr;
-      <i>boolean</i></code>
+    <h5 id="toE">
+      toExponential<code class='inset'>.toExponential([dp [, rm]]) <i>&rArr; string</i></code>
     </h5>
     <p>
-      <code>n</code> : <i>number|string|BigNumber</i><br />
-      <code>base</code> : <i>number</i><br />
-      <i>See <a href="#bignumber">constructor</a> for further parameter details.
-      </i>
+      <code>dp</code>: <i>number</i>: integer, <code>0</code> to <code>1e+9</code> inclusive<br />
+      <code>rm</code>: <i>number</i>: integer, <code>0</code> to <code>8</code> inclusive
     </p>
     <p>
-      Returns <code>true</code> if the value of this BigNumber is greater than
-      or equal to the value of <code>n</code>, otherwise returns
-      <code>false</code>.<br />
-      Note : This method uses the <code>comparedTo</code> method internally.
+      Returns a string representing the value of this BigNumber in exponential notation rounded
+      using rounding mode <code>rm</code> to <code>dp</code> decimal places, i.e with one digit
+      before the decimal point and <code>dp</code> digits after it.
     </p>
-    <pre>
-(0.3 - 0.2) &gt;= 0.1                   // false
-x = new BigNumber(0.3).minus(0.2)
-x.greaterThanOrEqualTo(0.1)          // true
-BigNumber(1).gte(x)                  // true
-BigNumber(10, 18).gte('i', 36)       // true</pre>
-
-
-
-    <h5 id="lt">
-      lessThan<code class='inset'>.lt(n [, base]) &rArr; <i>boolean</i></code>
-     </h5>
     <p>
-      <code>n</code> : <i>number|string|BigNumber</i><br />
-      <code>base</code> : <i>number</i><br />
-      <i>See <a href="#bignumber">constructor</a> for further parameter details.
-      </i>
+      If the value of this BigNumber in exponential notation has fewer than <code>dp</code> fraction
+      digits, the return value will be appended with zeros accordingly.
     </p>
     <p>
-      Returns <code>true</code> if the value of this BigNumber is less than the
-      value of <code>n</code>, otherwise returns <code>false</code>.<br />
-      Note : This method uses the <code>comparedTo</code> method internally.
+      If <code>dp</code> is omitted, or is <code>null</code> or <code>undefined</code>, the number
+      of digits after the decimal point defaults to the minimum number of digits necessary to
+      represent the value exactly.<br />
+      If <code>rm</code> is omitted or is <code>null</code> or <code>undefined</code>,
+      <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> is used.
     </p>
-    <pre>
-(0.3 - 0.2) &lt; 0.1                    // true
-x = new BigNumber(0.3).minus(0.2)
-x.lessThan(0.1)                      // false
-BigNumber(0).lt(x)                   // true
-BigNumber(11.1, 2).lt(11, 3)         // true</pre>
+    <p>
+      Throws if <code>dp</code> or <code>rm</code> is invalid. See <a href='#Errors'>Errors</a>.
+    </p>
+     <pre>
+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'</pre>
 
 
 
-    <h5 id="lte">
-      lessThanOrEqualTo<code class='inset'>.lte(n [, base]) &rArr;
-      <i>boolean</i></code>
+    <h5 id="toFix">
+      toFixed<code class='inset'>.toFixed([dp [, rm]]) <i>&rArr; string</i></code>
     </h5>
     <p>
-      <code>n</code> : <i>number|string|BigNumber</i><br />
-      <code>base</code> : <i>number</i><br />
-      <i>See <a href="#bignumber">constructor</a> for further parameter details.
-      </i>
+      <code>dp</code>: <i>number</i>: integer, <code>0</code> to <code>1e+9</code> inclusive<br />
+      <code>rm</code>: <i>number</i>: integer, <code>0</code> to <code>8</code> inclusive
     </p>
     <p>
-      Returns <code>true</code> if the value of this BigNumber is less than or
-      equal to the value of <code>n</code>, otherwise returns
-      <code>false</code>.<br />
-      Note : This method uses the <code>comparedTo</code> method internally.
+      Returns a string representing the value of this BigNumber in normal (fixed-point) notation
+      rounded to <code>dp</code> decimal places using rounding mode <code>rm</code>.
+    </p>
+    <p>
+      If the value of this BigNumber in normal notation has fewer than <code>dp</code> fraction
+      digits, the return value will be appended with zeros accordingly.
+    </p>
+   <p>
+      Unlike <code>Number.prototype.toFixed</code>, which returns exponential notation if a number
+      is greater or equal to <code>10<sup>21</sup></code>, this method will always return normal
+      notation.
+    </p>
+    <p>
+      If <code>dp</code> is omitted or is <code>null</code> or <code>undefined</code>, the return
+      value will be unrounded and in normal notation. This is also unlike
+      <code>Number.prototype.toFixed</code>, which returns the value to zero decimal places.<br />
+      It is useful when fixed-point notation is required and the current
+      <a href="#exponential-at"><code>EXPONENTIAL_AT</code></a> setting causes
+      <code><a href='#toS'>toString</a></code> to return exponential notation.<br />
+      If <code>rm</code> is omitted or is <code>null</code> or <code>undefined</code>,
+      <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> is used.
+    </p>
+    <p>
+      Throws if <code>dp</code> or <code>rm</code> is invalid. See <a href='#Errors'>Errors</a>.
     </p>
     <pre>
-0.1 &lt;= (0.3 - 0.2)                                // false
-x = new BigNumber(0.1)
-x.lessThanOrEqualTo(BigNumber(0.3).minus(0.2))    // true
-BigNumber(-1).lte(x)                              // true
-BigNumber(10, 18).lte('i', 36)                    // true</pre>
+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'</pre>
 
 
 
-    <h5 id="toE">
-      toExponential<code class='inset'>.toE([decimal_places]) &rArr;
-      <i>string</i></code>
+    <h5 id="toFor">
+      toFormat<code class='inset'>.toFormat([dp [, rm[, format]]]) <i>&rArr; string</i></code>
     </h5>
     <p>
-      <code>decimal_places</code> : <i>number</i> : integer, 0 to 1e+9 inclusive
+      <code>dp</code>: <i>number</i>: integer, <code>0</code> to <code>1e+9</code> inclusive<br />
+      <code>rm</code>: <i>number</i>: integer, <code>0</code> to <code>8</code> inclusive<br />
+      <code>format</code>: <i>object</i>: see <a href='#format'><code>FORMAT</code></a>
     </p>
     <p>
-      Returns a string representing the value of this BigNumber in exponential
-      notation to the specified decimal places, i.e with one digit before the
-      decimal point and <code>decimal_places</code> digits after it. If rounding
-      is necessary, the current
-      <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> is used.
+      <p>
+      Returns a string representing the value of this BigNumber in normal (fixed-point) notation
+      rounded to <code>dp</code> decimal places using rounding mode <code>rm</code>, and formatted
+      according to the properties of the <code>format</code> object.
     </p>
     <p>
-      If the value of this BigNumber in exponential notation has fewer fraction
-      digits then is specified by <code>decimal_places</code>, the return value
-      will be appended with zeros accordingly.
+      See <a href='#format'><code>FORMAT</code></a> and the examples below for the properties of the
+      <code>format</code> object, their types, and their usage. A formatting object may contain
+      some or all of the recognised properties.
     </p>
     <p>
-      If <code>decimal_places</code> is omitted, or is <code>null</code> or
-      undefined, the number of digits after the decimal point defaults to the
-      minimum number of digits necessary to represent the value exactly.
+      If <code>dp</code> is omitted or is <code>null</code> or <code>undefined</code>, then the
+      return value is not rounded to a fixed number of decimal places.<br />
+      If <code>rm</code> is omitted or is <code>null</code> or <code>undefined</code>,
+      <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> is used.<br />
+      If <code>format</code> is omitted or is <code>null</code> or <code>undefined</code>, the
+      <a href='#format'><code>FORMAT</code></a> object is used.
     </p>
     <p>
-      See <a href='#Errors'>Errors</a> for the treatment of other
-      non-integer or out of range <code>decimal_places</code> values.
+      Throws if <code>dp</code>, <code>rm</code> or <code>format</code> is invalid. See
+      <a href='#Errors'>Errors</a>.
     </p>
     <pre>
-x = 45.6
-y = new BigNumber(x)
-x.toExponential()         // '4.56e+1'
-y.toExponential()         // '4.56e+1'
-x.toExponential(0)        // '5e+1'
-y.toE(0)                  // '5e+1'
-x.toExponential(1)        // '4.6e+1'
-y.toE(1)                  // '4.6e+1'
-x.toExponential(3)        // '4.560e+1'
-y.toE(3)                  // '4.560e+1'</pre>
+fmt = {
+  prefix = '',
+  decimalSeparator: '.',
+  groupSeparator: ',',
+  groupSize: 3,
+  secondaryGroupSize: 0,
+  fractionGroupSeparator: ' ',
+  fractionGroupSize: 0,
+  suffix = ''
+}
+
+x = new BigNumber('123456789.123456789')
+
+// Set the global formatting options
+BigNumber.config({ FORMAT: fmt })
+
+x.toFormat()                              // '123,456,789.123456789'
+x.toFormat(3)                             // '123,456,789.123'
 
+// If a reference to the object assigned to FORMAT has been retained,
+// the format properties can be changed directly
+fmt.groupSeparator = ' '
+fmt.fractionGroupSize = 5
+x.toFormat()                              // '123 456 789.12345 6789'
 
+// Alternatively, pass the formatting options as an argument
+fmt = {
+  prefix: '=> ',
+  decimalSeparator: ',',
+  groupSeparator: '.',
+  groupSize: 3,
+  secondaryGroupSize: 2
+}
 
-    <h5 id="toF">
-      toFixed<code class='inset'>.toF([decimal_places]) &rArr;
-      <i>string</i></code>
+x.toFormat()                              // '123 456 789.12345 6789'
+x.toFormat(fmt)                           // '=> 12.34.56.789,123456789'
+x.toFormat(2, fmt)                        // '=> 12.34.56.789,12'
+x.toFormat(3, BigNumber.ROUND_UP, fmt)    // '=> 12.34.56.789,124'</pre>
+
+
+
+    <h5 id="toFr">
+      toFraction<code class='inset'>.toFraction([maximum_denominator])
+      <i>&rArr; [BigNumber, BigNumber]</i></code>
     </h5>
     <p>
-      <code>decimal_places</code> : <i>number</i> : integer, 0 to 1e+9 inclusive
+      <code>maximum_denominator</code>:
+      <i>number|string|BigNumber</i>: integer &gt;= <code>1</code> and &lt;=
+      <code>Infinity</code>
     </p>
     <p>
-      Returns a string representing the value of this BigNumber in normal
-      notation to the specified fixed number of decimal places, i.e. with
-      <code>decimal_places</code> digits after the decimal point. If rounding is
-      necessary, the current
-      <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> setting is used.
+      Returns an array of two BigNumbers 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 <code>maximum_denominator</code>.
     </p>
     <p>
-      If the value of this BigNumber in normal notation has fewer fraction
-      digits then is specified by <code>decimal_places</code>, the return value
-      will be appended with zeros accordingly.
+      If a <code>maximum_denominator</code> is not specified, or is <code>null</code> or
+      <code>undefined</code>, the denominator will be the lowest value necessary to represent the
+      number exactly.
     </p>
     <p>
-      Unlike <code>Number.prototype.toFixed</code>, which returns
-      exponential notation if a number is greater or equal to 10<sup>21</sup>,
-      this method will always return normal notation.
-    </p>
-    <p>
-      If <code>decimal_places</code> is omitted, or is <code>null</code> or
-      undefined, then the return value is the same as <code>n.toString()</code>.
-      This is  also unlike <code>Number.prototype.toFixed</code>, which returns
-      the value to zero decimal places.
+      Throws if <code>maximum_denominator</code> is invalid. See <a href='#Errors'>Errors</a>.
     </p>
+    <pre>
+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'</pre>
+
+
+
+    <h5 id="toJSON">toJSON<code class='inset'>.toJSON() <i>&rArr; string</i></code></h5>
+    <p>As <a href='#valueOf'><code>valueOf</code></a>.</p>
+    <pre>
+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)
+})</pre>
+
+
+
+    <h5 id="toN">toNumber<code class='inset'>.toNumber() <i>&rArr; number</i></code></h5>
+    <p>Returns the value of this BigNumber as a JavaScript number primitive.</p>
     <p>
-      See <a href='#Errors'>Errors</a> for the treatment of other
-      non-integer or out of range <code>decimal_places</code> values.
+      This method is identical to using type coercion with the unary plus operator.
     </p>
     <pre>
-x = 45.6
-y = new BigNumber(x)
-x.toFixed()              // '46'
-y.toFixed()              // '45.6'
-y.toF(0)                 // '46'
-x.toFixed(3)             // '45.600'
-y.toF(3)                 // '45.600'</pre>
+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</pre>
 
 
 
     <h5 id="toP">
-      toPrecision<code class='inset'>.toP([significant_figures]) &rArr;
-      <i>string</i></code>
+      toPrecision<code class='inset'>.toPrecision([sd [, rm]]) <i>&rArr; string</i></code>
     </h5>
     <p>
-      <code>significant_figures</code> : <i>number</i> : integer, 1 to 1e+9
-      inclusive
+      <code>sd</code>: <i>number</i>: integer, <code>1</code> to <code>1e+9</code> inclusive<br />
+      <code>rm</code>: <i>number</i>: integer, <code>0</code> to <code>8</code> inclusive
     </p>
     <p>
-      Returns a string representing the value of this BigNumber to the
-      specified number of significant digits. If rounding is necessary, the
-      current <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> setting is
-      used.
+      Returns a string representing the value of this BigNumber rounded to <code>sd</code>
+      significant digits using rounding mode <code>rm</code>.
     </p>
     <p>
-      If <code>significant_figures</code> is less than the number of digits
-      necessary to represent the integer part of the value in normal notation,
-      then exponential notation is used.
+      If <code>sd</code> 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.
     </p>
     <p>
-      If <code>significant_figures</code> is omitted, or is <code>null</code> or
-      undefined, then the return value is the same as <code>n.toString()</code>.
+      If <code>sd</code> is omitted, or is <code>null</code> or <code>undefined</code>, then the
+      return value is the same as <code>n.toString()</code>.<br />
+      If <code>rm</code> is omitted or is <code>null</code> or <code>undefined</code>,
+      <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> is used.
     </p>
     <p>
-      See <a href='#Errors'>Errors</a> for the treatment of other
-      non-integer or out of range <code>significant_figures</code> values.
+      Throws if <code>sd</code> or <code>rm</code> is invalid. See <a href='#Errors'>Errors</a>.
     </p>
-    <pre>
+     <pre>
 x = 45.6
 y = new BigNumber(x)
-x.toPrecision()           // '45.6'
-y.toPrecision()           // '45.6'
-x.toPrecision(1)          // '5e+1'
-y.toP(1)                  // '5e+1'
-x.toPrecision(5)          // '45.600'
-y.toP(5)                  // '45.600'</pre>
+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'</pre>
 
 
 
-    <h5 id="toS">
-      toString<code class='inset'>.toS([base]) &rArr; <i>string</i></code>
-    </h5>
+    <h5 id="toS">toString<code class='inset'>.toString([base]) <i>&rArr; string</i></code></h5>
+    <p>
+      <code>base</code>: <i>number</i>: integer, <code>2</code> to <code>ALPHABET.length</code>
+      inclusive (see <a href='#alphabet'><code>ALPHABET</code></a>).
+    </p>
     <p>
-      <code>base</code> : <i>number</i> : integer, 2 to 64 inclusive
+      Returns a string representing the value of this BigNumber in the specified base, or base
+      <code>10</code> if <code>base</code> is omitted or is <code>null</code> or
+      <code>undefined</code>.
     </p>
     <p>
-      Returns a string representing the value of this BigNumber in the specified
-      base, or base 10 if <code>base</code> is omitted. For bases above 10,
-      values from 10 to 35 are represented by <code>a-z</code> (as with
-      <code>Number.toString</code>), 36 to 61 by <code>A-Z</code>, and 62 and 63
-      by <code>$</code> and <code>_</code> respectively.
+      For bases above <code>10</code>, and using the default base conversion alphabet
+      (see <a href='#alphabet'><code>ALPHABET</code></a>), values from <code>10</code> to
+      <code>35</code> are represented by <code>a-z</code>
+      (as with <code>Number.prototype.toString</code>).
     </p>
     <p>
       If a base is specified the value is rounded according to the current
@@ -1229,16 +1771,14 @@ y.toP(5)                  // '45.600'</p
       or a negative exponent equal to or less than the negative component of the
       setting, then exponential notation is returned.
     </p>
+    <p>If <code>base</code> is <code>null</code> or <code>undefined</code> it is ignored.</p>
     <p>
-      If <code>base</code> is <code>null</code> or undefined it is ignored.
-      <br />
-      See <a href='#Errors'>Errors</a> for the treatment of other non-integer or
-      out of range <code>base</code> values.
+      Throws if <code>base</code> is invalid. See <a href='#Errors'>Errors</a>.
     </p>
     <pre>
 x = new BigNumber(750000)
 x.toString()                    // '750000'
-BigNumber.config({ EXPONENTIAL_AT : 5 })
+BigNumber.config({ EXPONENTIAL_AT: 5 })
 x.toString()                    // '7.5e+5'
 
 y = new BigNumber(362.875)
@@ -1246,150 +1786,69 @@ y.toString(2)                   // '1011
 y.toString(9)                   // '442.77777777777777777778'
 y.toString(32)                  // 'ba.s'
 
-BigNumber.config({ DECIMAL_PLACES : 4 });
+BigNumber.config({ DECIMAL_PLACES: 4 });
 z = new BigNumber('1.23456789')
 z.toString()                    // '1.23456789'
 z.toString(10)                  // '1.2346'</pre>
 
 
 
-    <h5 id="valueOf">
-      valueOf<code class='inset'>.valueOf() &rArr; <i>string</i></code>
-    </h5>
-    <p>
-      As <code>toString</code>, but does not accept a base argument.
-    </p>
-    <pre>
-x = new BigNumber('1.777e+457')
-x.valueOf()                      // '1.777e+457'</pre>
-
-
-
-    <h5 id="toFr">
-      toFraction<code class='inset'>.toFr([max_denominator]) &rArr;
-      <i>[string, string]</i></code>
-    </h5>
-    <p>
-      <code>max_denominator</code> : <i>number|string|BigNumber</i> :
-      integer &gt;= 1 and &lt; Infinity
-    </p>
-    <p>
-      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
-      <code>max_denominator</code>.
-    </p>
-    <p>
-      If a maximum denominator is not specified, or is <code>null</code> or
-      undefined, the denominator will be the lowest value necessary to represent
-      the number exactly.
-    </p>
-    <p>
-      See <a href='#Errors'>Errors</a> for the treatment of other non-integer or
-      out of range <code>max_denominator</code> values.
-    </p>
-    <pre>
-x = new BigNumber(1.75)
-x.toFraction()            // '7, 4'
-
-pi = new BigNumber('3.14159265358')
-pi.toFr()                 // '157079632679,50000000000'
-pi.toFr(100000)           // '312689, 99532'
-pi.toFr(10000)            // '355, 113'
-pi.toFr(100)              // '311, 99'
-pi.toFr(10)               // '22, 7'
-pi.toFr(1)                // '3, 1'</pre>
-
-
-
-    <h5 id="round">
-      round<code class='inset'>.round([decimal_places [, rounding_mode]])
-      &rArr; <i>BigNumber</i></code>
-    </h5>
-    <p>
-      <code>decimal_places</code> : <i>number</i> : integer, 0 to 1e+9 inclusive
-      <br />
-      <code>rounding_mode</code> : <i>number</i> : integer, 0 to 8 inclusive
-    </p>
-    <p>
-      Returns a BigNumber whose value is the value of this BigNumber rounded by
-      the specified <code>rounding_mode</code> to a maximum of
-      <code>decimal_places</code> digits after the decimal point.
-    </p>
-    <p>
-      if <code>decimal_places</code> is omitted, or is <code>null</code> or
-      undefined, the return value is <code>n</code> rounded to a whole number.
-    </p>
-    <p>
-      if <code>rounding_mode</code> is omitted, or is <code>null</code> or
-      undefined, the current
-      <a href='#rounding-mode'><code>ROUNDING_MODE</code></a> setting is used.
-    </p>
+    <h5 id="valueOf">valueOf<code class='inset'>.valueOf() <i>&rArr; string</i></code></h5>
     <p>
-      See <a href='#Errors'>Errors</a> for the treatment of other
-      non-integer or out of range <code>decimal_places</code> or
-      <code>rounding_mode</code> values.
+      As <a href='#toS'><code>toString</code></a>, but does not accept a base argument and includes
+      the minus sign for negative zero.
     </p>
     <pre>
-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'</pre>
+x = new BigNumber('-0')
+x.toString()                    // '0'
+x.valueOf()                     // '-0'
+y = new BigNumber('1.777e+457')
+y.valueOf()                     // '1.777e+457'</pre>
 
 
 
     <h4 id="instance-properties">Properties</h4>
-    <p>
-      A BigNumber is an object with three properties:
-    </p>
+    <p>The properties of a BigNumber instance:</p>
     <table>
       <tr>
-      	<th>Property</th>
-      	<th>Description</th>
-      	<th>Type</th>
-      	<th>Value</th>
+        <th>Property</th>
+        <th>Description</th>
+        <th>Type</th>
+        <th>Value</th>
       </tr>
       <tr>
-      	<td class='centre' id='coefficient'><b>c</b></td>
-      	<td>coefficient<sup>*</sup></td>
-      	<td><i>number</i><code>[]</code></td>
-      	<td> Array of single digits</td>
+        <td class='centre' id='coefficient'><b>c</b></td>
+        <td>coefficient<sup>*</sup></td>
+        <td><i>number</i><code>[]</code></td>
+        <td> Array of base <code>1e14</code> numbers</td>
       </tr>
       <tr>
-      	<td class='centre' id='exponent'><b>e</b></td>
-      	<td>exponent</td>
-      	<td><i>number</i></td>
-      	<td>Integer, -1e+9 to 1e+9 inclusive</td>
+        <td class='centre' id='exponent'><b>e</b></td>
+        <td>exponent</td>
+        <td><i>number</i></td>
+        <td>Integer, <code>-1000000000</code> to <code>1000000000</code> inclusive</td>
       </tr>
       <tr>
-      	<td class='centre' id='sign'><b>s</b></td>
-      	<td>sign</td>
-      	<td><i>number</i></td>
-      	<td>-1 or 1</td>
+        <td class='centre' id='sign'><b>s</b></td>
+        <td>sign</td>
+        <td><i>number</i></td>
+        <td><code>-1</code> or <code>1</code></td>
       </tr>
     </table>
     <p><sup>*</sup>significand</p>
     <p>
-      The value of any of the three properties may also be <code>null</code>.
+      The value of any of the <code>c</code>, <code>e</code> and <code>s</code> properties may also
+      be <code>null</code>.
     </p>
     <p>
-      The value of a BigNumber is stored in a normalised decimal floating point
-      format which corresponds to the value's <code>toExponential</code> form,
-      with the decimal point to be positioned after the most significant
-      (left-most) digit of the coefficient.
+      The above properties are best considered to be read-only. In early versions of this library it
+      was okay to change the exponent of a BigNumber by writing to its exponent property directly,
+      but this is no longer reliable as the value of the first element of the coefficient array is
+      now dependent on the exponent.
     </p>
     <p>
-      Note that, as with JavaScript numbers, the original exponent and
-      fractional trailing zeros are not preserved.
+      Note that, as with JavaScript numbers, the original exponent and fractional trailing zeros are
+      not necessarily preserved.
     </p>
     <pre>x = new BigNumber(0.123)              // '0.123'
 x.toExponential()                     // '1.23e-1'
@@ -1406,264 +1865,281 @@ z.e                                   //
 z.s                                   // -1</pre>
 
 
-    <p>
-      A BigNumber is mutable in the sense that the value of its properties can
-      be changed.<br />
-      For example, to rapidly shift a value by a power of 10:
-    </p>
-    <pre>
-x = new BigNumber('1234.000')      // '1234'
-x.toExponential()                  // '1.234e+3'
-x.c                                // '1,2,3,4'
-x.e                                // 3
-
-x.e = -5
-x                                  // '0.00001234'</pre>
-    <p>
-      If changing the coefficient array directly, which is not recommended, be
-      careful to avoid leading or trailing zeros (unless zero itself is being
-      represented).
-    </p>
-
-
 
     <h4 id="zero-nan-infinity">Zero, NaN and Infinity</h4>
     <p>
-      The table below shows how &plusmn;0, NaN and &plusmn;Infinity are stored.
+      The table below shows how &plusmn;<code>0</code>, <code>NaN</code> and
+      &plusmn;<code>Infinity</code> are stored.
     </p>
     <table>
       <tr>
-      	<th> </th>
-      	<th class='centre'>c</th>
-      	<th class='centre'>e</th>
-      	<th class='centre'>s</th>
+        <th> </th>
+        <th class='centre'>c</th>
+        <th class='centre'>e</th>
+        <th class='centre'>s</th>
       </tr>
       <tr>
-      	<td>&plusmn;0</td>
-      	<td><code>[0]</code></td>
-      	<td><code>0</code></td>
-      	<td><code>&plusmn;1</code></td>
+        <td>&plusmn;0</td>
+        <td><code>[0]</code></td>
+        <td><code>0</code></td>
+        <td><code>&plusmn;1</code></td>
       </tr>
       <tr>
-      	<td>NaN</td>
-      	<td><code>null</code></td>
-      	<td><code>null</code></td>
-      	<td><code>null</code></td>
+        <td>NaN</td>
+        <td><code>null</code></td>
+        <td><code>null</code></td>
+        <td><code>null</code></td>
       </tr>
       <tr>
-      	<td>&plusmn;Infinity</td>
-      	<td><code>null</code></td>
-      	<td><code>null</code></td>
-      	<td><code>&plusmn;1</code></td>
+        <td>&plusmn;Infinity</td>
+        <td><code>null</code></td>
+        <td><code>null</code></td>
+        <td><code>&plusmn;1</code></td>
       </tr>
     </table>
     <pre>
-x = new Number(-0)      // 0
-1 / x == -Infinity     // true
+x = new Number(-0)              // 0
+1 / x == -Infinity              // true
 
-y = new BigNumber(-0)   // '0'
-y.c                     // '0' ( [0].toString() )
-y.e                     // 0
-y.s                     // -1</pre>
+y = new BigNumber(-0)           // '0'
+y.c                             // '0' ( [0].toString() )
+y.e                             // 0
+y.s                             // -1</pre>
 
 
 
     <h4 id='Errors'>Errors</h4>
+    <p>The table below shows the errors that are thrown.</p>
     <p>
-      The errors that are thrown are generic <code>Error</code> objects with
-      <code>name</code> <i>BigNumber Error</i>. The table below shows the errors
-      that may be thrown if <code>ERRORS</code> is <code>true</code>, and the
-      action taken if <code>ERRORS</code> is <code>false</code>.
+      The errors are generic <code>Error</code> objects whose message begins
+      <code>'[BigNumber Error]'</code>.
     </p>
     <table class='error-table'>
       <tr>
-      	<th>Method(s)</th>
-      	<th>ERRORS : true<br />Throw BigNumber Error</th>
-      	<th>ERRORS : false<br />Action on invalid argument</th>
+        <th>Method</th>
+        <th>Throws</th>
       </tr>
       <tr>
-      	<td rowspan=5><code>
-        BigNumber<br />
-        comparedTo<br />
-        dividedBy<br />
-        equals<br />
-        greaterThan<br />
-        greaterThanOrEqualTo<br />
-        lessThan<br />
-        lessThanOrEqualTo<br />
-        minus<br />
-        mod<br />
-        plus<br />
-        times</code></td>
-      	<td>number type has more than<br />15 significant digits</td>
-      	<td>Accept.</td>
+        <td rowspan=6>
+          <code>BigNumber</code><br />
+          <code>comparedTo</code><br />
+          <code>dividedBy</code><br />
+          <code>dividedToIntegerBy</code><br />
+          <code>isEqualTo</code><br />
+          <code>isGreaterThan</code><br />
+          <code>isGreaterThanOrEqualTo</code><br />
+          <code>isLessThan</code><br />
+          <code>isLessThanOrEqualTo</code><br />
+          <code>minus</code><br />
+          <code>modulo</code><br />
+          <code>plus</code><br />
+          <code>multipliedBy</code>
+        </td>
+        <td>Base not a primitive number</td>
       </tr>
       <tr>
-      	<td>not a base... number</td>
-      	<td>Substitute <code>NaN</code>.</td>
+        <td>Base not an integer</td>
       </tr>
       <tr>
-      	<td>base not an integer</td>
-      	<td>Truncate to integer.<br />Ignore if not a number.</td>
+        <td>Base out of range</td>
+      </tr>
+       <tr>
+        <td>Number primitive has more than 15 significant digits<sup>*</sup></td>
       </tr>
       <tr>
-      	<td>base out of range</td>
-      	<td>Ignore.</td>
+        <td>Not a base... number<sup>*</sup></td>
       </tr>
       <tr>
-      	<td>not a number<sup>*</sup></td>
-      	<td>Substitute <code>NaN</code>.</td>
+        <td>Not a number<sup>*</sup></td>
       </tr>
       <tr>
-      	<td rowspan=9><code>config</code></td>
-      	<td><code>DECIMAL_PLACES</code> not an integer</td>
-      	<td>Truncate to integer.<br />Ignore if not a number.</td>
+        <td><code>clone</code></td>
+        <td>Object expected</td>
       </tr>
       <tr>
-      	<td><code>DECIMAL_PLACES</code> out of range</td>
-      	<td>Ignore.</td>
+        <td rowspan=24><code>config</code></td>
+        <td>Object expected</td>
       </tr>
       <tr>
-      	<td><code>ROUNDING_MODE</code> not an integer</td>
-      	<td>Truncate to integer.<br />Ignore if not a number.</td>
+        <td><code>DECIMAL_PLACES</code> not a primitive number</td>
       </tr>
       <tr>
-      	<td><code>ROUNDING_MODE</code> out of range</td>
-      	<td>Ignore.</td>
+        <td><code>DECIMAL_PLACES</code> not an integer</td>
       </tr>
       <tr>
-      	<td>
-          <code>EXPONENTIAL_AT</code> not an integer<br />
-          or not [integer, integer]
-        </td>
-      	<td>Truncate to integer(s).<br />Ignore if not number(s).</td>
+        <td><code>DECIMAL_PLACES</code> out of range</td>
       </tr>
       <tr>
-      	<td>
-          <code>EXPONENTIAL_AT</code> out of range<br />
-          or not [negative, positive]
-        </td>
-      	<td>Ignore.</td>
+        <td><code>ROUNDING_MODE</code> not a primitive number</td>
       </tr>
       <tr>
-      	<td>
-          <code>RANGE</code> not a non-zero integer<br />
-          or not [integer, integer]
-        </td>
-      	<td> Truncate to integer(s).<br />Ignore if zero or not number(s).</td>
+        <td><code>ROUNDING_MODE</code> not an integer</td>
       </tr>
-       <tr>
-      	<td>
-          <code>RANGE</code> out of range<br />
-          or not [negative, positive]
-        </td>
-      	<td>Ignore.</td>
+      <tr>
+        <td><code>ROUNDING_MODE</code> out of range</td>
       </tr>
       <tr>
-      	<td>
-          <code>ERRORS</code> not a boolean<br />
-          or binary digit
-        </td>
-      	<td>Ignore.</td>
+        <td><code>EXPONENTIAL_AT</code> not a primitive number</td>
       </tr>
       <tr>
-      	<td rowspan=2><code>toPower</code></td>
-      	<td>exponent not an integer</td>
-      	<td>Truncate to integer.<br />Substitute <code>NaN</code> if not a number.</td>
+        <td><code>EXPONENTIAL_AT</code> not an integer</td>
       </tr>
-       <tr>
-      	<td>exponent out of range</td>
-      	<td>Substitute <code>&plusmn;Infinity</code>.
-        </td>
+      <tr>
+        <td><code>EXPONENTIAL_AT</code> out of range</td>
+      </tr>
+      <tr>
+        <td><code>RANGE</code> not a primitive number</td>
+      </tr>
+      <tr>
+        <td><code>RANGE</code> not an integer</td>
+      </tr>
+      <tr>
+        <td><code>RANGE</code> cannot be zero</td>
+      </tr>
+      <tr>
+        <td><code>RANGE</code> cannot be zero</td>
+      </tr>
+      <tr>
+        <td><code>CRYPTO</code> not true or false</td>
+      </tr>
+      <tr>
+        <td><code>crypto</code> unavailable</td>
+      </tr>
+      <tr>
+        <td><code>MODULO_MODE</code> not a primitive number</td>
+      </tr>
+      <tr>
+        <td><code>MODULO_MODE</code> not an integer</td>
+      </tr>
+      <tr>
+        <td><code>MODULO_MODE</code> out of range</td>
+      </tr>
+      <tr>
+        <td><code>POW_PRECISION</code> not a primitive number</td>
+      </tr>
+      <tr>
+        <td><code>POW_PRECISION</code> not an integer</td>
+      </tr>
+      <tr>
+        <td><code>POW_PRECISION</code> out of range</td>
+      </tr>
+      <tr>
+        <td><code>FORMAT</code> not an object</td>
       </tr>
       <tr>
-      	<td rowspan=4><code>round</code></td>
-      	<td>decimal places not an integer</td>
-      	<td>Truncate to integer.<br />Ignore if not a number.</td>
+        <td><code>ALPHABET</code> invalid</td>
       </tr>
       <tr>
-      	<td>decimal places out of range</td>
-      	<td>Ignore.</td>
+        <td rowspan=3>
+          <code>decimalPlaces</code><br />
+          <code>precision</code><br />
+          <code>random</code><br />
+          <code>shiftedBy</code><br />
+          <code>toExponential</code><br />
+          <code>toFixed</code><br />
+          <code>toFormat</code><br />
+          <code>toPrecision</code>
+        </td>
+        <td>Argument not a primitive number</td>
       </tr>
       <tr>
-      	<td>mode not an integer</td>
-      	<td>Truncate to integer.<br />Ignore if not a number.</td>
+        <td>Argument not an integer</td>
       </tr>
       <tr>
-      	<td>mode out of range</td>
-      	<td>Ignore.</td>
+        <td>Argument out of range</td>
       </tr>
       <tr>
-      	<td rowspan=2><code>toExponential</code></td>
-      	<td>decimal places not an integer</td>
-      	<td>Truncate to integer.<br />Ignore if not a number.</td>
+        <td>
+          <code>decimalPlaces</code><br />
+          <code>precision</code>
+        </td>
+        <td>Argument not true or false</td>
       </tr>
       <tr>
-      	<td>decimal places out of range</td>
-      	<td>Ignore.</td>
+        <td><code>exponentiatedBy</code></td>
+        <td>Argument not an integer</td>
       </tr>
       <tr>
-      	<td rowspan=2><code>toFixed</code></td>
-      	<td>decimal places not an integer</td>
-      	<td>Truncate to integer.<br />Ignore if not a number.</td>
+        <td>
+          <code>minimum</code><br />
+          <code>maximum</code>
+        </td>
+        <td>Not a number<sup>*</sup></td>
       </tr>
       <tr>
-      	<td>decimal places out of range</td>
-      	<td>Ignore.</td>
+        <td>
+          <code>random</code>
+        </td>
+        <td>crypto unavailable</td>
       </tr>
       <tr>
-      	<td rowspan=2><code>toFraction</code></td>
-      	<td>max denominator not an integer</td>
-      	<td>Truncate to integer.<br />Ignore if not a number.</td>
+        <td>
+          <code>toFormat</code>
+        </td>
+        <td>Argument not an object</td>
       </tr>
       <tr>
-      	<td>max denominator out of range</td>
-      	<td>Ignore.</td>
+        <td rowspan=2><code>toFraction</code></td>
+        <td>Argument not an integer</td>
       </tr>
       <tr>
-      	<td rowspan=2><code>toPrecision</code></td>
-      	<td>precision not an integer</td>
-      	<td>Truncate to integer.<br />Ignore if not a number.</td>
+        <td>Argument out of range</td>
       </tr>
       <tr>
-      	<td>precision out of range</td>
-      	<td>Ignore.</td>
+        <td rowspan=3><code>toString</code></td>
+        <td>Base not a primitive number</td>
       </tr>
       <tr>
-      	<td rowspan=2><code>toString</code></td>
-      	<td>base not an integer</td>
-      	<td>Truncate to integer.<br />Ignore if not a number.</td>
+        <td>Base not an integer</td>
       </tr>
       <tr>
-      	<td>base out of range</td>
-      	<td>Ignore.</td>
+        <td>Base out of range</td>
       </tr>
     </table>
-    <p>
-      <sup>*</sup>No error is thrown if the value is <code>NaN</code> or 'NaN'
-    </p>
-    <p>
-      The message of a <i>BigNumber Error</i> will also contain the name of the
-      method from which the error originated.
-    </p>
-    <p>
-      To determine if an exception is a <i>BigNumber Error</i>:
-    </p>
+    <p><sup>*</sup>Only thrown if <code>BigNumber.DEBUG</code> is <code>true</code>.</p>
+    <p>To determine if an exception is a BigNumber Error:</p>
     <pre>
 try {
     // ...
 } catch (e) {
-    if ( e instanceof Error && e.name == 'BigNumber Error' ) {
+    if (e instanceof Error && e.message.indexOf('[BigNumber Error]') === 0) {
         // ...
     }
 }</pre>
 
+
+
+    <h4 id="type-coercion">Type coercion</h4>
+    <p>
+      To prevent the accidental use of a BigNumber in primitive number operations, or the
+      accidental addition of a BigNumber to a string, the <code>valueOf</code> method can be safely
+      overwritten as shown below.
+    </p>
+    <p>
+      The <a href='#valueOf'><code>valueOf</code></a> method is the same as the
+      <a href='#toJSON'><code>toJSON</code></a> method, and both are the same as the
+      <a href='#toS'><code>toString</code></a> method except they do not take a <code>base</code>
+      argument and they include the minus sign for negative zero.
+    </p>
+    <pre>
+BigNumber.prototype.valueOf = function () {
+  throw Error('valueOf called!')
+}
+
+x = new BigNumber(1)
+x / 2                    // '[BigNumber Error] valueOf called!'
+x + 'abc'                // '[BigNumber Error] valueOf called!'
+</pre>
+
+
+
     <h4 id='faq'>FAQ</h4>
+
     <h6>Why are trailing fractional zeros removed from BigNumbers?</h6>
     <p>
-      Many arbitrary-precision libraries retain trailing fractional zeros as
-      they can indicate the precision of a value. This can be useful but the
-      results of arithmetic operations can be misleading.
+      Some arbitrary-precision libraries retain trailing fractional zeros as they can indicate the
+      precision of a value. This can be useful but the results of arithmetic operations can be
+      misleading.
     </p>
     <pre>
 x = new BigDecimal("1.0")
@@ -1678,32 +2154,33 @@ z = x.multiply(y)                 // 4.1
       within a certain range.
     </p>
     <p>
-      In the first example, <code>x</code> has a value of 1.0. The trailing zero
-      shows the precision of the value, implying that it is in the range 0.95 to
-      1.05. Similarly, the precision indicated by the trailing zeros of
-      <code>y</code> indicates that the value is in the range 1.09995 to
-      1.10005. If we add the two lowest values in the ranges we get 0.95 +
-      1.09995 = 2.04995 and if we add the two highest values we get 1.05 +
-      1.10005 = 2.15005, so the range of the result of the addition implied by
-      the precision of its operands is 2.04995 to 2.15005. The result given by
-      BigDecimal of 2.1000 however, indicates that the value is in the range
-      2.09995 to 2.10005 and therefore the precision implied by its trailing
-      zeros is misleading.
-    </p>
-    <p>
-      In the second example, the true range is 4.122744 to 4.157256 yet the
-      BigDecimal answer of 4.1400000 indicates a range of 4.13999995 to
-      4.14000005. Again, the precision implied by the trailing zeros is
+      In the first example, <code>x</code> has a value of <code>1.0</code>. The trailing zero shows
+      the precision of the value, implying that it is in the range <code>0.95</code> to
+      <code>1.05</code>. Similarly, the precision indicated by the trailing zeros of <code>y</code>
+      indicates that the value is in the range <code>1.09995</code> to <code>1.10005</code>.
+    </p>
+    <p>
+      If we  add the two lowest values in the ranges we have, <code>0.95 + 1.09995 = 2.04995</code>,
+      and if we add the two highest values we have, <code>1.05 + 1.10005 = 2.15005</code>, so the
+      range of the result of the addition implied by the precision of its operands is
+      <code>2.04995</code> to <code>2.15005</code>.
+    </p>
+    <p>
+      The result given by BigDecimal of <code>2.1000</code> however, indicates that the value is in
+      the range <code>2.09995</code> to <code>2.10005</code> and therefore the precision implied by
+      its trailing zeros may be misleading.
+    </p>
+    <p>
+      In the second example, the true range is <code>4.122744</code> to <code>4.157256</code> yet
+      the BigDecimal answer of <code>4.1400000</code> indicates a range of <code>4.13999995</code>
+      to  <code>4.14000005</code>. Again, the precision implied by the trailing zeros may be
       misleading.
     </p>
     <p>
-      This library, like binary floating point and most calculators, does not
-      retain trailing fractional zeros. Instead, the <code>toExponential</code>,
-      <code>toFixed</code> and <code>toPrecision</code> methods enable trailing
-      zeros to be added if and when required.
+      This library, like binary floating point and most calculators, does not retain trailing
+      fractional zeros. Instead, the <code>toExponential</code>, <code>toFixed</code> and
+      <code>toPrecision</code> methods enable trailing zeros to be added if and when required.<br />
     </p>
-    <br />
-
   </div>
 
 </body>
diff -pruN 1.3.0+dfsg-1/LICENCE 8.0.2+ds-1/LICENCE
--- 1.3.0+dfsg-1/LICENCE	2013-11-08 16:56:48.000000000 +0000
+++ 8.0.2+ds-1/LICENCE	2019-01-13 22:17:07.000000000 +0000
@@ -1,6 +1,6 @@
-The MIT Expat Licence.
+The MIT Licence.
 
-Copyright (c) 2012 Michael Mclaughlin
+Copyright (c) 2019 Michael Mclaughlin
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
diff -pruN 1.3.0+dfsg-1/.npmignore 8.0.2+ds-1/.npmignore
--- 1.3.0+dfsg-1/.npmignore	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/.npmignore	2019-01-13 22:17:07.000000000 +0000
@@ -0,0 +1,6 @@
+test
+perf
+coverage
+.*
+
+
diff -pruN 1.3.0+dfsg-1/package.json 8.0.2+ds-1/package.json
--- 1.3.0+dfsg-1/package.json	2013-11-08 16:56:48.000000000 +0000
+++ 8.0.2+ds-1/package.json	2019-01-13 22:17:07.000000000 +0000
@@ -1,7 +1,7 @@
 {
   "name": "bignumber.js",
   "description": "A library for arbitrary-precision decimal and non-decimal arithmetic",
-  "version": "1.3.0",
+  "version": "8.0.2",
   "keywords": [
     "arbitrary",
     "precision",
@@ -16,11 +16,14 @@
     "bigint",
     "bignum"
   ],
-  "repository" : {
+  "repository": {
     "type": "git",
     "url": "https://github.com/MikeMcl/bignumber.js.git"
   },
   "main": "bignumber",
+  "module": "bignumber.mjs",
+  "browser": "bignumber.js",
+  "types": "bignumber.d.ts",
   "author": {
     "name": "Michael Mclaughlin",
     "email": "M8ch88l@gmail.com"
@@ -30,7 +33,8 @@
   },
   "license": "MIT",
   "scripts": {
-    "test": "node ./test/every-test.js",
-    "build": "uglifyjs -o ./bignumber.min.js ./bignumber.js"
-  }
-}
\ No newline at end of file
+    "test": "node test/test",
+    "build": "uglifyjs bignumber.js --source-map -c -m -o bignumber.min.js"
+  },
+  "dependencies": {}
+}
diff -pruN 1.3.0+dfsg-1/perf/bignumber-vs-bigdecimal.html 8.0.2+ds-1/perf/bignumber-vs-bigdecimal.html
--- 1.3.0+dfsg-1/perf/bignumber-vs-bigdecimal.html	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/perf/bignumber-vs-bigdecimal.html	2019-01-13 22:17:07.000000000 +0000
@@ -0,0 +1,691 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <meta charset='utf-8' />
+  <meta name="Author" content="M Mclaughlin">
+  <title>Testing BigNumber</title>
+  <style>
+    body {margin: 0; padding: 0; font-family: Calibri, Arial, Sans-Serif;}
+    div {margin: 1em 0;}
+    h1, #counter {text-align: center; background-color: rgb(225, 225, 225);
+        margin-top: 1em; padding: 0.2em; font-size: 1.2em;}
+    a {color:  rgb(0, 153, 255); margin: 0 0.6em;}
+    .links {position: fixed; bottom: 1em; right: 2em; font-size: 0.8em;}
+    .form, #time {width: 36em; margin: 0 auto;}
+    .form {text-align: left; margin-top: 1.4em;}
+    .random input {margin-left: 1em;}
+    .small {font-size: 0.9em;}
+    .methods {margin: 1em auto; width: 28em;}
+    .iterations input, .left {margin-left: 1.6em;}
+    .info span {margin-left: 1.6em; font-size: 0.9em;}
+    .info {margin-top: 1.6em;}
+    .random input, .iterations input {margin-right: 0.3em;}
+    .random label, .iterations label, .bigd label {font-size: 0.9em;
+        margin-left: 0.1em;}
+    .methods label {width: 5em; margin-left: 0.2em; display: inline-block;}
+    .methods label.right {width: 2em;}
+    .red {color: red; font-size: 1.1em; font-weight: bold;}
+    button {width: 10em; height: 2em;}
+    #dp, #r, #digits, #reps {margin-left: 0.8em;}
+    #bigint {font-style: italic; display: none;}
+    #gwt, #icu4j, #bd, #bigint {margin-left: 1.5em;}
+    #division {display: none;}
+    #counter {font-size: 2em; background-color: rgb(235, 235, 235);}
+    #time {text-align: center;}
+    #results {margin: 0 1.4em;}
+  </style>
+  <script src='../bignumber.js'></script>
+  <script src='./lib/bigdecimal_GWT/bigdecimal.js'></script>
+</head>
+<body>
+  <h1>Testing BigNumber against BigDecimal</h1>
+
+  <div class='form'>
+
+    <div class='methods'>
+      <input type='radio' id=0 name=1/><label for=0>plus</label>
+      <input type='radio' id=3 name=1/><label for=3>dividedBy</label>
+      <input type='radio' id=6 name=1/><label for=6 class='right'>absoluteValue</label>
+      <br>
+      <input type='radio' id=1 name=1/><label for=1>minus</label>
+      <input type='radio' id=4 name=1/><label for=4>modulo</label>
+      <input type='radio' id=7 name=1/><label for=7 class='right'>negated</label>
+      <br>
+      <input type='radio' id=2 name=1/><label for=2>multipliedBy</label>
+      <input type='radio' id=5 name=1/><label for=5>comparedTo</label>
+      <input type='radio' id=8 name=1/><label for=8 class='right'>exponentiatedBy</label>
+    </div>
+
+    <div class='bigd'>
+      <span>BigDecimal:</span>
+      <input type='radio' name=2 id='gwt' /><label for='gwt'>GWT</label>
+      <input type='radio' name=2 id='icu4j' /><label for='icu4j'>ICU4J</label>
+      <span id='bigint'>BigInteger</span>
+      <span id='bd'>add</span>
+    </div>
+
+    <div class='random'>
+      Random number digits:<input type='text' id='digits' size=12 />
+      <input type='radio' name=3 id='fix' /><label for='fix'>Fixed</label>
+      <input type='radio' name=3 id='max' /><label for='max'>Max</label>
+      <input type='checkbox' id='int' /><label for='int'>Integers only</label>
+    </div>
+
+    <div id='division'>
+      <span>Decimal places:<input type='text' id='dp' size=9 /></span>
+      <span class='left'>Rounding:<select id='r'>
+          <option>UP</option>
+          <option>DOWN</option>
+          <option>CEIL</option>
+          <option>FLOOR</option>
+          <option>HALF_UP</option>
+          <option>HALF_DOWN</option>
+          <option>HALF_EVEN</option>
+        </select></span>
+    </div>
+
+    <div class='iterations'>
+      Iterations:<input type='text' id='reps' size=11 />
+      <input type='checkbox' id='show'/><label for='show'>Show all (no timing)</label>
+    </div>
+
+    <div class='info'>
+      <button id='start'>Start</button>
+      <span>Click a method to stop</span>
+      <span>Press space bar to pause/unpause</span>
+    </div>
+
+  </div>
+
+  <div id='counter'>0</div>
+  <div id='time'></div>
+  <div id='results'></div>
+
+  <div class='links'>
+    <a href='https://github.com/MikeMcl/bignumber.js' target='_blank'>BigNumber</a>
+    <a href='https://github.com/iriscouch/bigdecimal.js' target='_blank'>GWT</a>
+    <a href='https://github.com/dtrebbien/BigDecimal.js/tree/' target='_blank'>ICU4J</a>
+  </div>
+
+  <script>
+
+var i, completedReps, targetReps, cycleReps, cycleTime, prevCycleReps, cycleLimit,
+    maxDigits, isFixed, isIntOnly, decimalPlaces, rounding, calcTimeout,
+    counterTimeout, script, isGWT, BigDecimal_GWT, BigDecimal_ICU4J,
+    bdM, bdTotal, bnM, bnTotal,
+    bdMs = ['add', 'subtract', 'multiply', 'divide', 'remainder', 'compareTo',
+        'abs', 'negate', 'pow'],
+    bnMs = ['plus', 'minus', 'multipliedBy', 'dividedBy', 'modulo', 'comparedTo', 'absoluteValue',
+        'negated', 'exponentiatedBy'],
+    lastRounding = 4,
+    pause = false,
+    up = true,
+    timingVisible = false,
+    showAll = false,
+
+    // Edit defaults here
+
+    DEFAULT_REPS = 10000,
+    DEFAULT_DIGITS = 20,
+    DEFAULT_DECIMAL_PLACES = 20,
+    DEFAULT_ROUNDING = 4,
+    MAX_POWER = 20,
+    CHANCE_NEGATIVE = 0.5,   // 0 (never) to 1 (always)
+    CHANCE_INTEGER = 0.2,    // 0 (never) to 1 (always)
+    MAX_RANDOM_EXPONENT = 100,
+    SPACE_BAR = 32,
+    ICU4J_URL = './lib/bigdecimal_ICU4J/BigDecimal-all-last.js',
+
+    //
+
+    $ = function (id) {return document.getElementById(id)},
+    $INPUTS = document.getElementsByTagName('input'),
+    $BD = $('bd'),
+    $BIGINT = $('bigint'),
+    $DIGITS = $('digits'),
+    $GWT = $('gwt'),
+    $ICU4J = $('icu4j'),
+    $FIX = $('fix'),
+    $MAX = $('max'),
+    $INT = $('int'),
+    $DIV = $('division'),
+    $DP = $('dp'),
+    $R = $('r'),
+    $REPS = $('reps'),
+    $SHOW = $('show'),
+    $START = $('start'),
+    $COUNTER = $('counter'),
+    $TIME = $('time'),
+    $RESULTS = $('results'),
+
+    // Get random number in normal notation.
+    getRandom = function () {
+        var z,
+            i = 0,
+            // n is the number of digits - 1
+            n = isFixed ? maxDigits - 1 : Math.random() * (maxDigits || 1) | 0,
+            r = ( Math.random() * 10 | 0 ) + '';
+
+        if (n) {
+            if (r == '0')
+                r = isIntOnly ? ( ( Math.random() * 9 | 0 ) + 1 ) + '' : (z = r + '.');
+
+            for ( ; i++ < n; r += Math.random() * 10 | 0 ){}
+
+            if (!z && !isIntOnly && Math.random() > CHANCE_INTEGER) {
+                r = r.slice( 0, i = (Math.random() * n | 0) + 1 ) +
+                    '.' + r.slice(i);
+            }
+        }
+
+        // Avoid division by zero error with division and modulo
+        if ((bdM == 'divide' || bdM == 'remainder') && parseFloat(r) === 0)
+            r = ( ( Math.random() * 9 | 0 ) + 1 ) + '';
+
+        return Math.random() > CHANCE_NEGATIVE ? r : '-' + r;
+    },
+
+    // Get random number in exponential notation (if isIntOnly is false).
+    // GWT BigDecimal BigInteger does not accept exponential notation.
+    //getRandom = function () {
+    //    var i = 0,
+    //        // n is the number of significant digits - 1
+    //        n = isFixed ? maxDigits - 1 : Math.random() * (maxDigits || 1) | 0,
+    //        r = ( ( Math.random() * 9 | 0 ) + 1 ) + '';
+    //
+    //    for (; i++ < n; r += Math.random() * 10 | 0 ){}
+    //
+    //    if ( !isIntOnly ) {
+    //
+    //        // Add exponent.
+    //        r += 'e' + ( Math.random() > 0.5 ? '+' : '-' ) +
+    //          ( Math.random() * MAX_RANDOM_EXPONENT | 0 );
+    //    }
+    //
+    //    return Math.random() > CHANCE_NEGATIVE ? r : '-' + r
+    //},
+
+    showTimings = function () {
+        var i, bdS, bnS,
+            sp = '',
+            r = bnTotal < bdTotal
+              ? (bnTotal ? bdTotal / bnTotal : bdTotal)
+              : (bdTotal ? bnTotal / bdTotal : bnTotal);
+
+        bdS = 'BigDecimal: ' + (bdTotal || '<1');
+        bnS = 'BigNumber: ' + (bnTotal || '<1');
+
+        for ( i = bdS.length - bnS.length; i-- > 0; sp += '&nbsp;'){}
+        bnS = 'BigNumber: ' + sp + (bnTotal || '<1');
+
+        $TIME.innerHTML =
+            'No mismatches<div>' + bdS + ' ms<br>' + bnS + ' ms</div>' +
+                ((r = parseFloat(r.toFixed(1))) > 1
+                    ? 'Big' + (bnTotal < bdTotal ? 'Number' : 'Decimal')
+                        + ' was ' + r + ' times faster'
+                    : 'Times approximately equal');
+    },
+
+    clear = function () {
+        clearTimeout(calcTimeout);
+        clearTimeout(counterTimeout);
+
+        $COUNTER.style.textDecoration = 'none';
+        $COUNTER.innerHTML = '0';
+        $TIME.innerHTML = $RESULTS.innerHTML = '';
+        $START.innerHTML = 'Start';
+    },
+
+    begin = function () {
+        var i;
+        clear();
+
+        targetReps = +$REPS.value;
+        if (!(targetReps > 0)) return;
+
+        $START.innerHTML = 'Restart';
+
+        i = +$DIGITS.value;
+        $DIGITS.value = maxDigits = i && isFinite(i) ? i : DEFAULT_DIGITS;
+
+        for (i = 0; i < 9; i++) {
+            if ($INPUTS[i].checked) {
+                bnM = bnMs[$INPUTS[i].id];
+                bdM = bdMs[$INPUTS[i].id];
+                break;
+            }
+        }
+
+        if (bdM == 'divide') {
+            i = +$DP.value;
+            $DP.value = decimalPlaces = isFinite(i) ? i : DEFAULT_DECIMAL_PLACES;
+            rounding = +$R.selectedIndex;
+            BigNumber.config({ DECIMAL_PLACES: decimalPlaces, ROUNDING_MODE: rounding });
+        }
+
+        isFixed = $FIX.checked;
+        isIntOnly = $INT.checked;
+        showAll = $SHOW.checked;
+
+        BigDecimal = (isGWT = $GWT.checked)
+            ? (isIntOnly ? BigInteger : BigDecimal_GWT)
+            : BigDecimal_ICU4J;
+
+        prevCycleReps = cycleLimit = completedReps = bdTotal = bnTotal = 0;
+        pause = false;
+
+        cycleReps = showAll ? 1 : 0.5;
+        cycleTime = +new Date();
+
+        setTimeout(updateCounter, 0);
+    },
+
+    updateCounter = function () {
+
+        if (pause) {
+            if (!timingVisible && !showAll) {
+                showTimings();
+                timingVisible = true;
+            }
+            counterTimeout = setTimeout(updateCounter, 50);
+            return;
+        }
+
+        $COUNTER.innerHTML = completedReps;
+
+        if (completedReps < targetReps) {
+            if (timingVisible) {
+                $TIME.innerHTML = '';
+                timingVisible = false;
+            }
+
+            if (!showAll) {
+
+                // Adjust cycleReps so counter is updated every second-ish
+                if (prevCycleReps != cycleReps) {
+
+                    // cycleReps too low
+                    if (+new Date() - cycleTime < 1e3) {
+                        prevCycleReps = cycleReps;
+
+                        if (cycleLimit) {
+                            cycleReps += ((cycleLimit - cycleReps) / 2);
+                        } else {
+                            cycleReps *= 2;
+                        }
+
+                    // cycleReps too high
+                    } else {
+                        cycleLimit = cycleReps;
+                        cycleReps -= ((cycleReps - prevCycleReps) / 2);
+                    }
+
+                    cycleReps = Math.floor(cycleReps) || 1;
+                    cycleTime = +new Date();
+                }
+
+                if (completedReps + cycleReps > targetReps) {
+                    cycleReps = targetReps - completedReps;
+                }
+            }
+
+            completedReps += cycleReps;
+            calcTimeout = setTimeout(calc, 0);
+
+        // Finished - show timings summary
+        } else {
+            $START.innerHTML = 'Start';
+            $COUNTER.style.textDecoration = 'underline';
+            if (!showAll) {
+                showTimings();
+            }
+        }
+    },
+
+    calc = function () {
+
+        var start, bdT, bnT, bdR, bnR,
+            xs = [cycleReps],
+            ys = [cycleReps],
+            bdRs = [cycleReps],
+            bnRs = [cycleReps];
+
+
+        // Generate random operands
+
+        for (i = 0; i < cycleReps; i++) {
+            xs[i] = getRandom();
+        }
+
+        if (bdM == 'pow') {
+            for (i = 0; i < cycleReps; i++) {
+                ys[i] = Math.floor(Math.random() * (MAX_POWER + 1)) + '';
+            }
+
+        // No second operand needed for abs and negate
+        } else if (bdM != 'abs' && bdM != 'negate') {
+            for (i = 0; i < cycleReps; i++) {
+                ys[i] = getRandom();
+            }
+        }
+
+
+        //********************************************************************//
+        //************************** START TIMING ****************************//
+        //********************************************************************//
+
+
+        // BigDecimal
+
+        if (bdM == 'divide') {
+
+            start = +new Date();
+            for (i = 0; i < cycleReps; i++) {
+                bdRs[i] = new BigDecimal(xs[i])[bdM](new BigDecimal(ys[i]),
+                    decimalPlaces, rounding);
+            }
+            bdT = +new Date() - start;
+
+        // GWT pow argument must be of type number. ICU4J pow argument must be of type BigDecimal
+        } else if (bdM == 'pow' && isGWT) {
+
+            start = +new Date();
+            for (i = 0; i < cycleReps; i++) {
+                bdRs[i] = new BigDecimal(xs[i])[bdM](+ys[i]);
+            }
+            bdT = +new Date() - start;
+
+        } else if (bdM == 'abs' || bdM == 'negate') {
+
+            start = +new Date();
+            for (i = 0; i < cycleReps; i++) {
+                bdRs[i] = new BigDecimal(xs[i])[bdM]();
+            }
+            bdT = +new Date() - start;
+
+        } else {
+
+            start = +new Date();
+            for (i = 0; i < cycleReps; i++) {
+                bdRs[i] = new BigDecimal(xs[i])[bdM](new BigDecimal(ys[i]));
+            }
+            bdT = +new Date() - start;
+
+        }
+
+
+        // BigNumber
+
+        if (bdM == 'pow') {
+
+            start = +new Date();
+            for (i = 0; i < cycleReps; i++) {
+                bnRs[i] = new BigNumber(xs[i])[bnM](+ys[i]);
+            }
+            bnT = +new Date() - start;
+
+        } else if (bdM == 'abs' || bdM == 'negate') {
+
+            start = +new Date();
+            for (i = 0; i < cycleReps; i++) {
+                bnRs[i] = new BigNumber(xs[i])[bnM]();
+            }
+            bnT = +new Date() - start;
+
+        } else {
+
+            start = +new Date();
+            for (i = 0; i < cycleReps; i++) {
+                bnRs[i] = new BigNumber(xs[i])[bnM](new BigNumber(ys[i]));
+            }
+            bnT = +new Date() - start;
+
+        }
+
+
+        //********************************************************************//
+        //**************************** END TIMING ****************************//
+        //********************************************************************//
+
+
+        // Check for mismatches
+
+        for (i = 0; i < cycleReps; i++) {
+            bnR = bnRs[i].toString();
+
+            // Remove any trailing zeros from BigDecimal result
+            if (isGWT) {
+                bdR = bdM == 'compareTo' || isIntOnly
+                    ? bdRs[i].toString()
+                    : bdRs[i].stripTrailingZeros().toPlainString();
+            } else {
+
+                // No toPlainString() or stripTrailingZeros() in ICU4J
+                bdR = bdRs[i].toString();
+
+                if (bdR.indexOf('.') != -1) {
+                    bdR = bdR.replace(/\.?0+$/, '');
+                }
+            }
+
+            if (bdR !== bnR) {
+
+                $RESULTS.innerHTML =
+                    '<span class="red">Breaking on first mismatch:</span>' +
+                    '<br><br>' +xs[i] + '<br>' + bnM + '<br>' + ys[i] +
+                    '<br><br>BigDecimal<br>' + bdR + '<br>' + bnR + '<br>BigNumber';
+
+                if (bdM == 'divide') {
+                    $RESULTS.innerHTML += '<br><br>Decimal places: ' +
+                        decimalPlaces + '<br>Rounding mode: ' + rounding;
+                }
+                return;
+            } else if (showAll) {
+                $RESULTS.innerHTML = xs[i] + '<br>' + bnM + '<br>' + ys[i] +
+                '<br><br>BigDecimal<br>' + bdR + '<br>' + bnR + '<br>BigNumber';
+            }
+        }
+
+        bdTotal += bdT;
+        bnTotal += bnT;
+
+        updateCounter();
+    };
+
+
+// Event handlers
+
+document.onkeyup = function (evt) {
+    evt = evt || window.event;
+    if ((evt.keyCode || evt.which) == SPACE_BAR) {
+        up = true;
+    }
+};
+document.onkeydown = function (evt) {
+    evt = evt || window.event;
+    if (up && (evt.keyCode || evt.which) == SPACE_BAR) {
+        pause = !pause;
+        up = false;
+    }
+};
+
+// BigNumber methods' radio buttons' event handlers
+for (i = 0; i < 9; i++) {
+    $INPUTS[i].checked = false;
+    $INPUTS[i].disabled = false;
+    $INPUTS[i].onclick = function () {
+        clear();
+        lastRounding = $R.options.selectedIndex;
+        $DIV.style.display = 'none';
+        bnM = bnMs[this.id];
+        $BD.innerHTML = bdM = bdMs[this.id];
+    };
+}
+$INPUTS[1].onclick = function () {
+    clear();
+    $R.options.selectedIndex = lastRounding;
+    $DIV.style.display = 'block';
+    bnM = bnMs[this.id];
+    $BD.innerHTML = bdM = bdMs[this.id];
+};
+
+// Show/hide BigInteger and disable/un-disable division accordingly as BigInteger
+// throws an exception if division gives "no exact representable decimal result"
+$INT.onclick = function () {
+    if (this.checked && $GWT.checked) {
+        if ($INPUTS[1].checked) {
+            $INPUTS[1].checked = false;
+            $INPUTS[0].checked = true;
+            $BD.innerHTML = bdMs[$INPUTS[0].id];
+            $DIV.style.display = 'none';
+        }
+        $INPUTS[1].disabled = true;
+        $BIGINT.style.display = 'inline';
+    } else {
+        $INPUTS[1].disabled = false;
+        $BIGINT.style.display = 'none';
+    }
+};
+$ICU4J.onclick = function () {
+    $INPUTS[1].disabled = false;
+    $BIGINT.style.display = 'none';
+};
+$GWT.onclick = function () {
+    if ($INT.checked) {
+        if ($INPUTS[1].checked) {
+            $INPUTS[1].checked = false;
+            $INPUTS[0].checked = true;
+            $BD.innerHTML = bdMs[$INPUTS[0].id];
+            $DIV.style.display = 'none';
+        }
+        $INPUTS[1].disabled = true;
+        $BIGINT.style.display = 'inline';
+    }
+};
+
+BigNumber.config({
+    DECIMAL_PLACES : 20,
+    ROUNDING_MODE : 4,
+    EXPONENTIAL_AT: 1E9,
+    RANGE: 1E9,
+    MODULO_MODE: 1,
+    POW_PRECISION: 10000
+});
+
+// Set defaults
+$MAX.checked = $INPUTS[0].checked = $GWT.checked = true;
+$SHOW.checked = $INT.checked = false;
+$REPS.value = DEFAULT_REPS;
+$DIGITS.value = DEFAULT_DIGITS;
+$DP.value = DEFAULT_DECIMAL_PLACES;
+$R.option = DEFAULT_ROUNDING;
+
+BigDecimal_GWT = BigDecimal;
+BigDecimal = undefined;
+
+// Load ICU4J BigDecimal
+script = document.createElement("script");
+script.src = ICU4J_URL;
+script.onload = script.onreadystatechange = function () {
+    if (!script.readyState || /loaded|complete/.test(script.readyState)) {
+        script = null;
+        BigDecimal_ICU4J = BigDecimal;
+        $START.onmousedown = begin;
+    }
+};
+document.getElementsByTagName("head")[0].appendChild(script);
+
+
+
+/*
+
+NOTES:
+
+
+ICU4J
+=====
+IBM java package: com.ibm.icu.math
+pow's argument must be a BigDecimal.
+Among other differences, doesn't have .toPlainString() or .stripTrailingZeros().
+Exports BigDecimal only.
+Much faster than gwt on Firefox, on Chrome it varies with the method.
+
+
+GWT
+===
+Java standard class library: java.math.BigDecimal
+
+Exports:
+  RoundingMode
+  MathContext
+  BigDecimal
+  BigInteger
+
+BigDecimal properties:
+  ROUND_CEILING
+  ROUND_DOWN
+  ROUND_FLOOR
+  ROUND_HALF_DOWN
+  ROUND_HALF_EVEN
+  ROUND_HALF_UP
+  ROUND_UNNECESSARY
+  ROUND_UP
+  __init__
+  valueOf
+  log
+  logObj
+  ONE
+  TEN
+  ZERO
+
+BigDecimal instance properties/methods:
+( for (var i in new BigDecimal('1').__gwt_instance.__gwtex_wrap) {...} )
+
+  byteValueExact
+  compareTo
+  doubleValue
+  equals
+  floatValue
+  hashCode
+  intValue
+  intValueExact
+  max
+  min
+  movePointLeft
+  movePointRight
+  precision
+  round
+  scale
+  scaleByPowerOfTen
+  shortValueExact
+  signum
+  stripTrailingZeros
+  toBigInteger
+  toBigIntegerExact
+  toEngineeringString
+  toPlainString
+  toString
+  ulp
+  unscaledValue
+  longValue
+  longValueExact
+  abs
+  add
+  divide
+  divideToIntegralValue
+  multiply
+  negate
+  plus
+  pow
+  remainder
+  setScale
+  subtract
+  divideAndRemainder
+
+*/
+
+  </script>
+</body>
+</html>
+
+
diff -pruN 1.3.0+dfsg-1/perf/bigtime.js 8.0.2+ds-1/perf/bigtime.js
--- 1.3.0+dfsg-1/perf/bigtime.js	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/perf/bigtime.js	2019-01-13 22:17:07.000000000 +0000
@@ -0,0 +1,342 @@
+
+var arg, i, j, max, method, methodIndex, decimalPlaces, rounding, reps, start,
+     timesEqual, xs, ys, prevRss, prevHeapUsed, prevHeapTotal, showMemory,
+    bdM, bdT, bdR, bdRs,
+    bnM, bnT, bnR, bnRs,
+    args = process.argv.splice(2),
+    BigDecimal = require('./lib/bigdecimal_GWT/bigdecimal').BigDecimal,
+    BigNumber = require('../bignumber'),
+    bdMs = ['add', 'subtract', 'multiply', 'divide', 'remainder',
+            'compareTo', 'pow', 'negate', 'abs'],
+    bnMs1 = ['plus', 'minus', 'multipliedBy', 'dividedBy', 'modulo',
+             'comparedTo', 'exponentiatedBy', 'negated', 'absoluteValue'],
+    bnMs2 = ['', '', '', 'div', 'mod', '', '', '', ''],
+    Ms = [bdMs, bnMs1, bnMs2],
+    allMs = [].concat.apply([], Ms),
+    bdTotal = 0,
+    bnTotal = 0,
+    BD = {},
+    BN = {},
+
+    ALWAYS_SHOW_MEMORY = false,
+    DEFAULT_MAX_DIGITS = 20,
+    DEFAULT_POW_MAX_DIGITS = 20,
+    DEFAULT_REPS = 1e4,
+    DEFAULT_POW_REPS = 1e2,
+    DEFAULT_PLACES = 20,
+    MAX_POWER = 50,
+    MAX_RANDOM_EXPONENT = 100,
+
+    getRandom = function (maxDigits) {
+        var i = 0, z,
+            // number of digits - 1
+            n = Math.random() * ( maxDigits || 1 ) | 0,
+            r = ( Math.random() * 10 | 0 ) + '';
+
+        if ( n ) {
+            if ( z = r === '0' ) {
+                r += '.';
+            }
+
+            for ( ; i++ < n; r += Math.random() * 10 | 0 ){}
+
+            // 20% chance of integer
+            if ( !z && Math.random() > 0.2 )
+                r = r.slice( 0, i = ( Math.random() * n | 0 ) + 1 ) + '.' + r.slice(i);
+        }
+
+        // Avoid 'division by zero' error with division and modulo.
+        if ((bdM == 'divide' || bdM == 'remainder') && parseFloat(r) === 0)
+            r = ( ( Math.random() * 9 | 0 ) + 1 ) + '';
+
+        // 50% chance of negative
+        return Math.random() > 0.5 ? r : '-' + r;
+    },
+
+    // Returns exponential notation.
+    //getRandom = function (maxDigits) {
+    //    var i = 0,
+    //        // n is the number of significant digits - 1
+    //        n = Math.random() * (maxDigits || 1) | 0,
+    //        r = ( ( Math.random() * 9 | 0 ) + 1 ) + ( n ? '.' : '' );
+    //
+    //    for (; i++ < n; r += Math.random() * 10 | 0 ){}
+    //
+    //    // Add exponent.
+    //    r += 'e' + ( Math.random() > 0.5 ? '+' : '-' ) +
+    //               ( Math.random() * MAX_RANDOM_EXPONENT | 0 );
+    //
+    //    // 50% chance of being negative.
+    //    return Math.random() > 0.5 ? r : '-' + r
+    //},
+
+    getFastest = function (bn, bd) {
+        var r;
+        if (Math.abs(bn - bd) > 2) {
+            r = 'Big' + ((bn < bd)
+                ? 'Number was ' + (bn ? parseFloat((bd / bn).toFixed(1)) : bd)
+                : 'Decimal was ' + (bd ? parseFloat((bn / bd).toFixed(1)) : bn)) +
+                    ' times faster';
+        } else {
+            timesEqual = 1;
+            r = 'Times approximately equal';
+        }
+        return r;
+    },
+
+    getMemory = function (obj) {
+        if (showMemory) {
+            var mem = process.memoryUsage(),
+                rss = mem.rss,
+                heapUsed = mem.heapUsed,
+                heapTotal = mem.heapTotal;
+
+            if (obj) {
+                obj.rss += (rss - prevRss);
+                obj.hU += (heapUsed - prevHeapUsed);
+                obj.hT += (heapTotal - prevHeapTotal);
+            }
+            prevRss = rss;
+            prevHeapUsed = heapUsed;
+            prevHeapTotal = heapTotal;
+        }
+    },
+
+    getMemoryTotals = function (obj) {
+        function toKB(m) {return parseFloat((m / 1024).toFixed(1))}
+        return '\trss: ' + toKB(obj.rss) +
+               '\thU: ' + toKB(obj.hU) +
+               '\thT: ' + toKB(obj.hT);
+    };
+
+
+if (arg = args[0], typeof arg != 'undefined' && !isFinite(arg) &&
+    allMs.indexOf(arg) == -1 && !/^-*m$/i.test(arg)) {
+    console.log(
+        '\n node bigtime [METHOD] [METHOD CALLS [MAX DIGITS [DECIMAL PLACES]]]\n' +
+            '\n METHOD: The method to be timed and compared with the' +
+            '\n \t corresponding method from BigDecimal or BigNumber\n' +
+            '\n   BigDecimal: add subtract multiply divide remainder' +
+            ' compareTo pow\n\t\tnegate abs\n\n   BigNumber: plus minus multipliedBy' +
+            ' dividedBy modulo comparedTo exponentiatedBy\n\t\tnegated absoluteValue' +
+            ' (div mod pow)' +
+            '\n\n METHOD CALLS: The number of method calls to be timed' +
+            '\n\n MAX DIGITS: The maximum number of digits of the random ' +
+            '\n\t\tnumbers used in the method calls\n\n ' +
+            'DECIMAL PLACES: The number of decimal places used in division' +
+            '\n\t\t(The rounding mode is randomly chosen)' +
+            '\n\n Default values: METHOD: randomly chosen' +
+            '\n\t\t METHOD CALLS: ' + DEFAULT_REPS +
+            '  (pow: ' + DEFAULT_POW_REPS + ')' +
+            '\n\t\t MAX DIGITS: ' + DEFAULT_MAX_DIGITS +
+            '  (pow: ' + DEFAULT_POW_MAX_DIGITS + ')' +
+            '\n\t\t DECIMAL PLACES: ' + DEFAULT_PLACES + '\n' +
+            '\n E.g.   node bigtime\n\tnode bigtime minus\n\tnode bigtime add 100000' +
+            '\n\tnode bigtime times 20000 100\n\tnode bigtime div 100000 50 20' +
+            '\n\tnode bigtime 9000\n\tnode bigtime 1000000 20\n' +
+            '\n To show memory usage, include an argument m or -m' +
+            '\n E.g.   node bigtime m add');
+} else {
+
+    BigNumber.config({
+        EXPONENTIAL_AT: 1E9,
+        RANGE: 1E9,
+        ERRORS: false,
+        MODULO_MODE: 1,
+        POW_PRECISION: 10000
+    });
+
+    Number.prototype.toPlainString = Number.prototype.toString;
+
+    for (i = 0; i < args.length; i++) {
+        arg = args[i];
+        if (isFinite(arg)) {
+            arg = Math.abs(parseInt(arg));
+            if (reps == null)
+                reps = arg <= 1e10 ? arg : 0;
+            else if (max == null)
+                max = arg <= 1e6 ? arg : 0;
+            else if (decimalPlaces == null)
+                decimalPlaces = arg <= 1e6 ? arg : DEFAULT_PLACES;
+        } else if (/^-*m$/i.test(arg))
+            showMemory = true;
+        else if (method == null)
+            method = arg;
+    }
+
+    for (i = 0;
+         i < Ms.length && (methodIndex = Ms[i].indexOf(method)) == -1;
+         i++) {}
+
+    bnM = methodIndex == -1
+        ? bnMs1[methodIndex = Math.floor(Math.random() * bdMs.length)]
+        : (Ms[i][0] == 'add' ? bnMs1 : Ms[i])[methodIndex];
+
+    bdM = bdMs[methodIndex];
+
+    if (!reps)
+        reps = bdM == 'pow' ? DEFAULT_POW_REPS : DEFAULT_REPS;
+    if (!max)
+        max = bdM == 'pow' ? DEFAULT_POW_MAX_DIGITS : DEFAULT_MAX_DIGITS;
+    if (decimalPlaces == null)
+        decimalPlaces = DEFAULT_PLACES;
+
+    xs = [reps], ys = [reps], bdRs = [reps], bnRs = [reps];
+    BD.rss = BD.hU = BD.hT = BN.rss = BN.hU = BN.hT = 0;
+    showMemory = showMemory || ALWAYS_SHOW_MEMORY;
+
+    console.log('\n BigNumber %s vs BigDecimal %s\n' +
+        '\n Method calls: %d\n\n Random operands: %d', bnM, bdM, reps,
+        bdM == 'abs' || bdM == 'negate' || bdM == 'abs' ? reps : reps * 2);
+
+    console.log(' Max. digits of operands: %d', max);
+
+    if (bdM == 'divide') {
+        rounding = Math.floor(Math.random() * 7);
+        console.log('\n Decimal places: %d\n Rounding mode: %d', decimalPlaces, rounding);
+        BigNumber.config({ DECIMAL_PLACES: decimalPlaces, ROUNDING_MODE: rounding });
+    }
+
+    process.stdout.write('\n Testing started');
+
+    outer:
+    for (; reps > 0; reps -= 1e4) {
+
+        j = Math.min(reps, 1e4);
+
+
+        // GENERATE RANDOM OPERANDS
+
+        for (i = 0; i < j; i++) {
+            xs[i] = getRandom(max);
+        }
+
+        if (bdM == 'pow') {
+            for (i = 0; i < j; i++) {
+                ys[i] = Math.floor(Math.random() * (MAX_POWER + 1));
+            }
+        } else if (bdM != 'abs' && bdM != 'negate') {
+            for (i = 0; i < j; i++) {
+                ys[i] = getRandom(max);
+            }
+        }
+
+        getMemory();
+
+
+        // BigDecimal
+
+        if (bdM == 'divide') {
+
+            start = +new Date();
+            for (i = 0; i < j; i++) {
+                bdRs[i] = new BigDecimal(xs[i])[bdM](new BigDecimal(ys[i]),
+                    decimalPlaces, rounding);
+            }
+            bdT = +new Date() - start;
+
+        } else if (bdM == 'pow') {
+
+            start = +new Date();
+            for (i = 0; i < j; i++) {
+                bdRs[i] = new BigDecimal(xs[i])[bdM](ys[i]);
+            }
+            bdT = +new Date() - start;
+
+        } else if (bdM == 'abs' || bdM == 'negate') {
+
+            start = +new Date();
+            for (i = 0; i < j; i++) {
+                bdRs[i] = new BigDecimal(xs[i])[bdM]();
+            }
+            bdT = +new Date() - start;
+
+        } else {
+
+            start = +new Date();
+            for (i = 0; i < j; i++) {
+                bdRs[i] = new BigDecimal(xs[i])[bdM](new BigDecimal(ys[i]));
+            }
+            bdT = +new Date() - start;
+
+        }
+
+        getMemory(BD);
+
+
+        // BigNumber
+
+        if (bdM == 'pow') {
+
+            start = +new Date();
+            for (i = 0; i < j; i++) {
+                bnRs[i] = new BigNumber(xs[i])[bnM](ys[i]);
+            }
+            bnT = +new Date() - start;
+
+        } else if (bdM == 'abs' || bdM == 'negate') {
+
+            start = +new Date();
+            for (i = 0; i < j; i++) {
+                bnRs[i] = new BigNumber(xs[i])[bnM]();
+            }
+            bnT = +new Date() - start;
+
+        } else {
+
+            start = +new Date();
+            for (i = 0; i < j; i++) {
+                bnRs[i] = new BigNumber(xs[i])[bnM](new BigNumber(ys[i]));
+            }
+            bnT = +new Date() - start;
+
+        }
+
+        getMemory(BN);
+
+
+        // CHECK FOR MISMATCHES
+
+        for (i = 0; i < j; i++) {
+            bnR = bnRs[i].toString();
+            bdR = bdRs[i].toPlainString();
+
+            // Strip any trailing zeros from non-integer BigDecimals
+            if (bdR.indexOf('.') != -1) {
+                bdR = bdR.replace(/\.?0+$/, '');
+            }
+
+            if (bdR !== bnR) {
+                console.log('\n breaking on first mismatch (result number %d):' +
+                '\n\n BigDecimal: %s\n BigNumber:  %s', i, bdR, bnR);
+                console.log('\n x: %s\n y: %s', xs[i], ys[i]);
+
+                if (bdM == 'divide')
+                    console.log('\n dp: %d\n r: %d',decimalPlaces, rounding);
+                break outer;
+            }
+        }
+
+        bdTotal += bdT;
+        bnTotal += bnT;
+
+        process.stdout.write(' .');
+    }
+
+
+    // TIMINGS SUMMARY
+
+
+    if (i == j) {
+        console.log(' done\n\n No mismatches.');
+        if (showMemory) {
+            console.log('\n Change in memory usage (KB):' +
+                        '\n\tBigDecimal' + getMemoryTotals(BD) +
+                        '\n\tBigNumber ' + getMemoryTotals(BN));
+        }
+        console.log('\n Time taken:' +
+            '\n\tBigDecimal  ' + (bdTotal || '<1') + ' ms' +
+            '\n\tBigNumber   ' + (bnTotal || '<1') + ' ms\n\n ' +
+            getFastest(bnTotal, bdTotal) + '\n');
+    }
+}
\ No newline at end of file
diff -pruN 1.3.0+dfsg-1/perf/bigtime-OOM.js 8.0.2+ds-1/perf/bigtime-OOM.js
--- 1.3.0+dfsg-1/perf/bigtime-OOM.js	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/perf/bigtime-OOM.js	2019-01-13 22:17:07.000000000 +0000
@@ -0,0 +1,372 @@
+
+var arg, i, max, method, methodIndex, decimalPlaces,
+    reps, rounding, start, timesEqual, Xs, Ys,
+    bdM, bdMT, bdOT, bdRs, bdXs, bdYs,
+    bnM, bnMT, bnOT, bnRs, bnXs, bnYs,
+    memoryUsage, showMemory, bnR, bdR,
+    prevRss, prevHeapUsed, prevHeapTotal,
+    args = process.argv.splice(2),
+    BigDecimal = require('./lib/bigdecimal_GWT/bigdecimal').BigDecimal,
+    BigNumber = require('../bignumber'),
+    bdMs = ['add', 'subtract', 'multiply', 'divide', 'remainder', 'compareTo', 'pow'],
+    bnMs1 = ['plus', 'minus', 'multipliedBy', 'dividedBy', 'modulo', 'comparedTo', 'exponentiatedBy'],
+    bnMs2 = ['', '', '', 'div', 'mod', '', ''],
+    Ms = [bdMs, bnMs1, bnMs2],
+    allMs = [].concat.apply([], Ms),
+    expTotal = 0,
+    total = 0,
+
+    ALWAYS_SHOW_MEMORY = false,
+    DEFAULT_MAX_DIGITS = 20,
+    DEFAULT_POW_MAX_DIGITS = 20,
+    DEFAULT_REPS = 1e4,
+    DEFAULT_POW_REPS = 1e2,
+    DEFAULT_PLACES = 20,
+    MAX_POWER = 50,
+
+    getRandom = function (maxDigits) {
+        var i = 0, z,
+            // number of digits - 1
+            n = Math.random() * ( maxDigits || 1 ) | 0,
+            r = ( Math.random() * 10 | 0 ) + '';
+
+        if ( n ) {
+            if ( z = r === '0' ) {
+                r += '.';
+            }
+
+            for ( ; i++ < n; r += Math.random() * 10 | 0 ){}
+
+            // 20% chance of integer
+            if ( !z && Math.random() > 0.2 )
+                r = r.slice( 0, i = ( Math.random() * n | 0 ) + 1 ) + '.' + r.slice(i);
+        }
+
+        // Avoid 'division by zero' error with division and modulo.
+        if ((bdM == 'divide' || bdM == 'remainder') && parseFloat(r) === 0)
+            r = ( ( Math.random() * 9 | 0 ) + 1 ) + '';
+
+        total += n + 1;
+
+        // 50% chance of negative
+        return Math.random() > 0.5 ? r : '-' + r;
+    },
+
+    pad = function (str) {
+        str += '... ';
+        while (str.length < 26) str += ' ';
+        return str;
+    },
+
+    getFastest = function (bn, bd) {
+        var r;
+        if (Math.abs(bn - bd) > 2) {
+            r = 'Big' + ((bn < bd)
+            ? 'Number ' + (bn ? parseFloat((bd / bn).toFixed(1)) : bd)
+            : 'Decimal ' + (bd ? parseFloat((bn / bd).toFixed(1)) : bn)) +
+                ' times faster';
+        } else {
+            timesEqual = 1;
+            r = 'Times approximately equal';
+        }
+        return r;
+    },
+
+    showMemoryChange = function () {
+        if (showMemory) {
+            memoryUsage = process.memoryUsage();
+
+            var rss = memoryUsage.rss,
+                heapUsed = memoryUsage.heapUsed,
+                heapTotal = memoryUsage.heapTotal;
+
+            console.log(' Change in memory usage: ' +
+                ' rss: ' +  toKB(rss - prevRss) +
+                ', hU: ' + toKB(heapUsed - prevHeapUsed) +
+                ', hT: ' + toKB(heapTotal - prevHeapTotal));
+            prevRss = rss; prevHeapUsed = heapUsed; prevHeapTotal = heapTotal;
+        }
+    },
+
+    toKB = function (m) {
+        return parseFloat((m / 1024).toFixed(1)) + ' KB';
+    };
+
+
+// PARSE COMMAND LINE AND SHOW HELP
+
+if (arg = args[0], typeof arg != 'undefined' && !isFinite(arg) &&
+    allMs.indexOf(arg) == -1 && !/^-*m$/i.test(arg)) {
+    console.log(
+    '\n node bigtime-OOM [METHOD] [METHOD CALLS [MAX DIGITS [DECIMAL PLACES]]]\n' +
+    '\n METHOD: The method to be timed and compared with the automatically' +
+    '\n         chosen corresponding method from BigDecimal or BigNumber\n' +
+    '\n BigDecimal: add  subtract multiply divide remainder compareTo pow' +
+    '\n BigNumber:  plus minus multipliedBy dividedBy modulo comparedTo exponentiatedBy' +
+    '\n             (div mod pow)' +
+    '\n\n METHOD CALLS: The number of method calls to be timed' +
+    '\n\n MAX DIGITS: The maximum number of digits of the random ' +
+    '\n             numbers used in the method calls' +
+    '\n\n DECIMAL PLACES: The number of decimal places used in division' +
+    '\n                 (The rounding mode is randomly chosen)' +
+    '\n\n Default values: METHOD: randomly chosen' +
+    '\n                 METHOD CALLS: ' + DEFAULT_REPS +
+    '  (pow: ' + DEFAULT_POW_REPS + ')' +
+    '\n                 MAX DIGITS: ' + DEFAULT_MAX_DIGITS +
+    '  (pow: ' + DEFAULT_POW_MAX_DIGITS + ')' +
+    '\n                 DECIMAL PLACES: ' + DEFAULT_PLACES + '\n' +
+    '\n E.g.s node bigtime-OOM\n       node bigtime-OOM minus' +
+    '\n       node bigtime-OOM add 100000' +
+    '\n       node bigtime-OOM multipliedBy 20000 100' +
+    '\n       node bigtime-OOM dividedBy 100000 50 20' +
+    '\n       node bigtime-OOM 9000' +
+    '\n       node bigtime-OOM 1000000 20\n' +
+    '\n To show memory usage include an argument m or -m' +
+    '\n E.g.  node bigtime-OOM m add');
+} else {
+     BigNumber.config({
+        EXPONENTIAL_AT: 1E9,
+        RANGE: 1E9,
+        ERRORS: false,
+        MODULO_MODE: 1,
+        POW_PRECISION: 10000
+    });
+
+    Number.prototype.toPlainString = Number.prototype.toString;
+
+    for (i = 0; i < args.length; i++) {
+        arg = args[i];
+
+        if (isFinite(arg)) {
+            arg = Math.abs(parseInt(arg));
+            if (reps == null) {
+                reps = arg <= 1e10 ? arg : 0;
+            } else if (max == null) {
+                max = arg <= 1e6 ? arg : 0;
+            } else if (decimalPlaces == null) {
+                decimalPlaces = arg <= 1e6 ? arg : DEFAULT_PLACES;
+            }
+        } else if (/^-*m$/i.test(arg)) {
+            showMemory = true;
+        } else if (method == null) {
+            method = arg;
+        }
+    }
+
+    for (i = 0;
+         i < Ms.length && (methodIndex = Ms[i].indexOf(method)) == -1;
+         i++) {}
+
+    bnM = methodIndex == -1
+        ? bnMs1[methodIndex = Math.floor(Math.random() * bdMs.length)]
+        : (Ms[i][0] == 'add' ? bnMs1 : Ms[i])[methodIndex];
+
+    bdM = bdMs[methodIndex];
+
+    if (!reps)
+        reps = bdM == 'pow' ? DEFAULT_POW_REPS : DEFAULT_REPS;
+    if (!max)
+        max = bdM == 'pow' ? DEFAULT_POW_MAX_DIGITS : DEFAULT_MAX_DIGITS;
+    if (decimalPlaces == null)
+        decimalPlaces = DEFAULT_PLACES;
+
+    Xs = [reps], Ys = [reps];
+    bdXs = [reps], bdYs = [reps], bdRs = [reps];
+    bnXs = [reps], bnYs = [reps], bnRs = [reps];
+    showMemory = showMemory || ALWAYS_SHOW_MEMORY;
+
+    console.log('\n BigNumber %s vs BigDecimal %s', bnM, bdM);
+    console.log('\n Method calls: %d', reps);
+
+    if (bdM == 'divide') {
+        rounding = Math.floor(Math.random() * 7);
+        console.log('\n Decimal places: %d\n Rounding mode: %d', decimalPlaces, rounding);
+        BigNumber.config({ DECIMAL_PLACES: decimalPlaces, ROUNDING_MODE: rounding });
+    }
+
+    if (showMemory) {
+        memoryUsage = process.memoryUsage();
+        console.log(' Memory usage:            rss: ' +
+            toKB(prevRss = memoryUsage.rss) + ', hU: ' +
+            toKB(prevHeapUsed = memoryUsage.heapUsed) + ', hT: ' +
+            toKB(prevHeapTotal = memoryUsage.heapTotal));
+    }
+
+
+    // Create random numbers
+
+    // pow: BigDecimal requires JS Number type for exponent argument
+    if (bdM == 'pow') {
+
+        process.stdout.write('\n Creating ' + reps +
+            ' random numbers (max. digits: ' + max + ')... ');
+
+        for (i = 0; i < reps; i++) {
+            Xs[i] = getRandom(max);
+        }
+        console.log('done\n Average number of digits: %d',
+            ((total / reps) | 0));
+
+        process.stdout.write(' Creating ' + reps +
+            ' random integer exponents (max. value: ' + MAX_POWER + ')... ');
+
+        for (i = 0; i < reps; i++) {
+            bdYs[i] = bnYs[i] = Math.floor(Math.random() * (MAX_POWER + 1));
+            expTotal += bdYs[i];
+        }
+        console.log('done\n Average value: %d', ((expTotal / reps) | 0));
+
+        showMemoryChange();
+
+
+        // pow: time creation of BigDecimals
+
+        process.stdout.write('\n Creating BigDecimals...  ');
+
+        start = +new Date();
+            for (i = 0; i < reps; i++) {
+                bdXs[i] = new BigDecimal(Xs[i]);
+            }
+        bdOT = +new Date() - start;
+
+        console.log('done. Time taken: %s ms', bdOT || '<1');
+
+        showMemoryChange();
+
+
+        // pow: time creation of BigNumbers
+
+        process.stdout.write(' Creating BigNumbers...   ');
+
+        start = +new Date();
+            for (i = 0; i < reps; i++) {
+                bnXs[i] = new BigNumber(Xs[i]);
+            }
+        bnOT = +new Date() - start;
+
+        console.log('done. Time taken: %s ms', bnOT || '<1');
+
+
+    } else {
+
+        process.stdout.write('\n Creating ' + (reps * 2) +
+            ' random numbers (max. digits: ' + max + ')... ');
+
+
+        for (i = 0; i < reps; i++) {
+            Xs[i] = getRandom(max);
+            Ys[i] = getRandom(max);
+        }
+        console.log('done\n Average number of digits: %d',
+            ( total / (reps * 2) ) | 0);
+
+        showMemoryChange();
+
+
+        // Time creation of BigDecimals
+
+        process.stdout.write('\n Creating BigDecimals...  ');
+
+        start = +new Date();
+            for (i = 0; i < reps; i++) {
+                bdXs[i] = new BigDecimal(Xs[i]);
+                bdYs[i] = new BigDecimal(Ys[i]);
+            }
+        bdOT = +new Date() - start;
+
+        console.log('done. Time taken: %s ms', bdOT || '<1');
+
+        showMemoryChange();
+
+
+        // Time creation of BigNumbers
+
+        process.stdout.write(' Creating BigNumbers...   ');
+
+        start = +new Date();
+            for (i = 0; i < reps; i++) {
+                bnXs[i] = new BigNumber(Xs[i]);
+                bnYs[i] = new BigNumber(Ys[i]);
+            }
+        bnOT = +new Date() - start;
+
+        console.log('done. Time taken: %s ms', bnOT || '<1');
+    }
+
+    showMemoryChange();
+
+    console.log('\n Object creation: %s\n', getFastest(bnOT, bdOT));
+
+
+    // Time BigDecimal method calls
+
+    process.stdout.write(pad(' BigDecimal ' + bdM));
+
+    if (bdM == 'divide') {
+        start = +new Date();
+            while (i--) bdRs[i] = bdXs[i][bdM](bdYs[i], decimalPlaces, rounding);
+        bdMT = +new Date() - start;
+    } else {
+        start = +new Date();
+            while (i--) bdRs[i] = bdXs[i][bdM](bdYs[i]);
+        bdMT = +new Date() - start;
+    }
+
+    console.log('done. Time taken: %s ms', bdMT || '<1');
+
+
+    // Time BigNumber method calls
+
+    i = reps;
+    process.stdout.write(pad(' BigNumber  ' + bnM));
+
+    start = +new Date();
+        while (i--) bnRs[i] = bnXs[i][bnM](bnYs[i]);
+    bnMT = +new Date() - start;
+
+    console.log('done. Time taken: %s ms', bnMT || '<1');
+
+
+    // Timings summary
+
+    console.log('\n Method calls:    %s', getFastest(bnMT, bdMT));
+
+    if (!timesEqual) {
+        console.log('\n Overall:         ' +
+            getFastest((bnOT || 1) + (bnMT || 1), (bdOT || 1) + (bdMT || 1)));
+    }
+
+
+
+    // Check for mismatches
+
+    process.stdout.write('\n Checking for mismatches... ');
+
+    for (i = 0; i < reps; i++) {
+
+        bnR = bnRs[i].toString();
+        bdR = bdRs[i].toPlainString();
+
+        // Strip any trailing zeros from non-integer BigDecimals
+        if (bdR.indexOf('.') != -1) {
+            bdR = bdR.replace(/\.?0+$/, '');
+        }
+
+        if (bdR !== bnR) {
+            console.log('breaking on first mismatch (result number %d):' +
+                '\n\n BigDecimal: %s\n BigNumber:  %s', i, bdR, bnR);
+            console.log('\n x: %s\n y: %s', Xs[i], Ys[i]);
+
+            if (bdM == 'divide') {
+                console.log('\n dp: %d\n r: %d',decimalPlaces, rounding);
+            }
+            break;
+        }
+    }
+    if (i == reps) {
+        console.log('done. None found.\n');
+    }
+}
+
+
+
diff -pruN 1.3.0+dfsg-1/perf/lib/bigdecimal_GWT/bigdecimal.js 8.0.2+ds-1/perf/lib/bigdecimal_GWT/bigdecimal.js
--- 1.3.0+dfsg-1/perf/lib/bigdecimal_GWT/bigdecimal.js	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/perf/lib/bigdecimal_GWT/bigdecimal.js	2019-01-13 22:17:07.000000000 +0000
@@ -0,0 +1,592 @@
+
+(function(exports) {
+
+if(typeof document === 'undefined')
+  var document = {};
+
+if(typeof window === 'undefined')
+  var window = {};
+if(!window.document)
+  window.document = document;
+
+if(typeof navigator === 'undefined')
+  var navigator = {};
+if(!navigator.userAgent)
+  navigator.userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22';
+
+function gwtapp() {};
+
+(function(){var $gwt_version = "2.4.0";var $wnd = window;var $doc = $wnd.document;var $moduleName, $moduleBase;var $strongName = '4533928AF3A2228268FD8F10BB191446';var $stats = $wnd.__gwtStatsEvent ? function(a) {return $wnd.__gwtStatsEvent(a);} : null;var $sessionId = $wnd.__gwtStatsSessionId ? $wnd.__gwtStatsSessionId : null;$stats && $stats({moduleName:'gwtapp',sessionId:$sessionId,subSystem:'startup',evtGroup:'moduleStartup',millis:(new Date()).getTime(),type:'moduleEvalStart'});function H(){}
+function P(){}
+function O(){}
+function N(){}
+function M(){}
+function rr(){}
+function gb(){}
+function ub(){}
+function pb(){}
+function Fb(){}
+function Ab(){}
+function Lb(){}
+function Tb(){}
+function Kb(){}
+function Zb(){}
+function _b(){}
+function fc(){}
+function ic(){}
+function hc(){}
+function Se(){}
+function Re(){}
+function Ze(){}
+function Ye(){}
+function Xe(){}
+function Ah(){}
+function Hh(){}
+function Gh(){}
+function Ej(){}
+function Mj(){}
+function Uj(){}
+function _j(){}
+function gk(){}
+function mk(){}
+function pk(){}
+function wk(){}
+function vk(){}
+function Dk(){}
+function Ik(){}
+function Qk(){}
+function Uk(){}
+function il(){}
+function ol(){}
+function rl(){}
+function Tl(){}
+function Xl(){}
+function km(){}
+function om(){}
+function Nn(){}
+function Np(){}
+function ep(){}
+function dp(){}
+function yp(){}
+function yo(){}
+function Zo(){}
+function xp(){}
+function Hp(){}
+function Mp(){}
+function Xp(){}
+function bq(){}
+function jq(){}
+function qq(){}
+function Dq(){}
+function Hq(){}
+function Nq(){}
+function Qq(){}
+function Zq(){}
+function Yq(){}
+function Yj(){Wj()}
+function Ij(){Gj()}
+function Eh(){Ch()}
+function Ek(){Cb()}
+function qk(){Cb()}
+function Rk(){Cb()}
+function Vk(){Cb()}
+function jl(){Cb()}
+function Oq(){Cb()}
+function kk(){ik()}
+function fm(){Yl(this)}
+function gm(){Yl(this)}
+function mg(a){Hf(this,a)}
+function mq(a){this.c=a}
+function bk(a){this.b=a}
+function Cp(a){this.b=a}
+function Sp(a){this.b=a}
+function V(a){Cb();this.f=a}
+function nk(a){V.call(this,a)}
+function rk(a){V.call(this,a)}
+function Sk(a){V.call(this,a)}
+function Wk(a){V.call(this,a)}
+function kl(a){V.call(this,a)}
+function Yl(a){a.b=new fc}
+function Ul(){this.b=new fc}
+function rb(){rb=rr;qb=new ub}
+function lr(){lr=rr;kr=new gr}
+function jr(a,b){return b}
+function ac(a,b){a.b+=b}
+function bc(a,b){a.b+=b}
+function cc(a,b){a.b+=b}
+function dc(a,b){a.b+=b}
+function or(a,b){lr();a[Ls]=b}
+function nr(a,b){lr();ar(a,b)}
+function _q(a,b,c){rp(a.b,b,c)}
+function Jg(){rf();Hf(this,Tr)}
+function pl(a){Sk.call(this,a)}
+function Hk(a){return isNaN(a)}
+function Jj(a){return new Oi(a)}
+function Zj(a){return new Oj(a)}
+function dl(a){return a<0?-a:a}
+function hl(a,b){return a<b?a:b}
+function gl(a,b){return a>b?a:b}
+function xe(a,b){return !we(a,b)}
+function ye(a,b){return !ve(a,b)}
+function ir(a,b){return new b(a)}
+function Oj(a){this.b=new Yn(a)}
+function Nj(){this.b=(Un(),Rn)}
+function ak(){this.b=(Qo(),Fo)}
+function Wo(){Qo();return zo}
+function mr(a,b){lr();_q(kr,a,b)}
+function br(a,b){a[b]||(a[b]={})}
+function kq(a){return a.b<a.c.c}
+function Vn(a){return a.b<<3|a.c.c}
+function Mi(a){return a.f*a.b[0]}
+function Je(a){return a.l|a.m<<22}
+function op(b,a){return b.f[Qr+a]}
+function Yp(a,b){this.c=a;this.b=b}
+function Ro(a,b){this.b=a;this.c=b}
+function Iq(a,b){this.b=a;this.c=b}
+function bm(a,b){ac(a.b,b);return a}
+function cm(a,b){bc(a.b,b);return a}
+function dm(a,b){cc(a.b,b);return a}
+function pr(a){lr();return er(kr,a)}
+function qr(a){lr();return fr(kr,a)}
+function Oi(a){Oh();oi.call(this,a)}
+function Ni(){Oh();oi.call(this,Tr)}
+function cg(a){dg.call(this,a,0)}
+function Kg(a){mg.call(this,a.tS())}
+function el(a){return Math.floor(a)}
+function yl(b,a){return b.indexOf(a)}
+function qp(b,a){return Qr+a in b.f}
+function uc(a,b){return a.cM&&a.cM[b]}
+function re(a,b){return ee(a,b,false)}
+function bn(a,b){return cn(a.b,a.e,b)}
+function ce(a){return de(a.l,a.m,a.h)}
+function Ac(a){return a==null?null:a}
+function sf(a){return a.r()<0?Mf(a):a}
+function ob(a){return a.$H||(a.$H=++jb)}
+function zc(a){return a.tM==rr||tc(a,1)}
+function tc(a,b){return a.cM&&!!a.cM[b]}
+function vl(b,a){return b.charCodeAt(a)}
+function hm(a){Yl(this);cc(this.b,a)}
+function oi(a){Oh();pi.call(this,a,10)}
+function Aq(a,b,c,d){a.splice(b,c,d)}
+function dq(a,b){(a<0||a>=b)&&hq(a,b)}
+function xc(a,b){return a!=null&&tc(a,b)}
+function db(a){return yc(a)?Db(wc(a)):Lr}
+function Z(a){return yc(a)?$(wc(a)):a+Lr}
+function Fl(a){return lc(Vd,{6:1},1,a,0)}
+function vq(){this.b=lc(Td,{6:1},0,0,0)}
+function Pl(){Pl=rr;Ml={};Ol={}}
+function Yo(){Yo=rr;Xo=Jk((Qo(),zo))}
+function ik(){if(!hk){hk=true;jk()}}
+function Gj(){if(!Fj){Fj=true;Hj()}}
+function Wj(){if(!Vj){Vj=true;new kk;Xj()}}
+function gr(){this.b=new Fq;new Fq;new Fq}
+function X(a){Cb();this.c=a;Bb(new Tb,this)}
+function Pi(a){Oh();oi.call(this,Hm(a,0))}
+function gg(a){hg.call(this,a,0,a.length)}
+function fg(a,b){cg.call(this,a);If(this,b)}
+function ze(a,b){ee(a,b,true);return ae}
+function tq(a,b){dq(b,a.c);return a.b[b]}
+function rq(a,b){nc(a.b,a.c++,b);return true}
+function _l(a,b,c){dc(a.b,Ll(b,0,c));return a}
+function kb(a,b,c){return a.apply(b,c);var d}
+function em(a,b,c){return ec(a.b,b,b,c),a}
+function Af(a,b,c){return yf(a,b,Bc(a.f),c)}
+function xf(a,b,c){return yf(a,b,Bc(a.f),Uo(c))}
+function Bl(c,a,b){return c.substr(a,b-a)}
+function Al(b,a){return b.substr(a,b.length-a)}
+function fl(a){return Math.log(a)*Math.LOG10E}
+function cb(a){return a==null?null:a.name}
+function $(a){return a==null?null:a.message}
+function yc(a){return a!=null&&a.tM!=rr&&!tc(a,1)}
+function ec(a,b,c,d){a.b=Bl(a.b,0,b)+d+Al(a.b,c)}
+function eg(a,b,c){dg.call(this,a,b);If(this,c)}
+function pg(a,b){this.g=a;this.f=b;this.b=sg(a)}
+function si(a,b,c){Oh();this.f=a;this.e=b;this.b=c}
+function sl(a){this.b='Unknown';this.d=a;this.c=-1}
+function yk(a,b){var c;c=new wk;c.d=a+b;return c}
+function dr(a,b){var c;c=mp(a.b,b);return wc(c)}
+function fb(a){var b;return b=a,zc(b)?b.hC():ob(b)}
+function To(a){Qo();return Ok((Yo(),Xo),a)}
+function qe(a,b){return de(a.l&b.l,a.m&b.m,a.h&b.h)}
+function De(a,b){return de(a.l|b.l,a.m|b.m,a.h|b.h)}
+function Le(a,b){return de(a.l^b.l,a.m^b.m,a.h^b.h)}
+function Bm(a,b){return (a.b[~~b>>5]&1<<(b&31))!=0}
+function Cq(a,b){var c;for(c=0;c<b;++c){a[c]=false}}
+function Lf(a,b,c){var d;d=Kf(a,b);If(d,c);return d}
+function zb(a,b){a.length>=b&&a.splice(0,b);return a}
+function wb(a,b){!a&&(a=[]);a[a.length]=b;return a}
+function Ph(a,b){if(mi(a,b)){return tm(a,b)}return a}
+function ii(a,b){if(!mi(a,b)){return tm(a,b)}return a}
+function _d(a){if(xc(a,15)){return a}return new X(a)}
+function Eb(){try{null.a()}catch(a){return a}}
+function Ak(a){var b;b=new wk;b.d=Lr+a;b.c=1;return b}
+function eb(a,b){var c;return c=a,zc(c)?c.eQ(b):c===b}
+function se(a,b){return a.l==b.l&&a.m==b.m&&a.h==b.h}
+function Ce(a,b){return a.l!=b.l||a.m!=b.m||a.h!=b.h}
+function de(a,b,c){return _=new Se,_.l=a,_.m=b,_.h=c,_}
+function rp(a,b,c){return !b?tp(a,c):sp(a,b,c,~~ob(b))}
+function Eq(a,b){return Ac(a)===Ac(b)||a!=null&&eb(a,b)}
+function Xq(a,b){return Ac(a)===Ac(b)||a!=null&&eb(a,b)}
+function hq(a,b){throw new Wk('Index: '+a+', Size: '+b)}
+function Xh(a,b){if(b<0){throw new nk(ts)}return tm(a,b)}
+function dg(a,b){if(!a){throw new jl}this.f=b;Tf(this,a)}
+function og(a,b){if(!a){throw new jl}this.f=b;Tf(this,a)}
+function ig(a,b,c,d){hg.call(this,a,b,c);If(this,d)}
+function jg(a,b){hg.call(this,a,0,a.length);If(this,b)}
+function ng(a,b){hg.call(this,Cl(a),0,a.length);If(this,b)}
+function lm(a){V.call(this,'String index out of range: '+a)}
+function Zl(a,b){dc(a.b,String.fromCharCode(b));return a}
+function pn(a,b){tn(a.b,a.b,a.e,b.b,b.e);Sh(a);a.c=-2}
+function Tf(a,b){a.d=b;a.b=b.ab();a.b<54&&(a.g=Ie(ai(b)))}
+function qc(){qc=rr;oc=[];pc=[];rc(new ic,oc,pc)}
+function Ch(){if(!Bh){Bh=true;new Yj;new Ij;Dh()}}
+function Sl(){if(Nl==256){Ml=Ol;Ol={};Nl=0}++Nl}
+function cr(a){var b;b=a[Ls];if(!b){b=[];a[Ls]=b}return b}
+function zk(a,b,c){var d;d=new wk;d.d=a+b;d.c=c?8:0;return d}
+function xk(a,b,c){var d;d=new wk;d.d=a+b;d.c=4;d.b=c;return d}
+function lc(a,b,c,d,e){var f;f=jc(e,d);mc(a,b,c,f);return f}
+function Ll(a,b,c){var d;d=b+c;El(a.length,b,d);return Gl(a,b,d)}
+function mo(a,b){go();return b<fo.length?lo(a,fo[b]):ei(a,po(b))}
+function me(a){return a.l+a.m*4194304+a.h*17592186044416}
+function vc(a,b){if(a!=null&&!uc(a,b)){throw new Ek}return a}
+function lq(a){if(a.b>=a.c.c){throw new Oq}return tq(a.c,a.b++)}
+function wl(a,b){if(!xc(b,1)){return false}return String(a)==b}
+function lb(){if(ib++==0){sb((rb(),qb));return true}return false}
+function fi(a){if(a.f<0){throw new nk('start < 0: '+a)}return xo(a)}
+function pm(){V.call(this,'Add not supported on this collection')}
+function Fq(){this.b=[];this.f={};this.d=false;this.c=null;this.e=0}
+function qi(a,b){Oh();this.f=a;this.e=1;this.b=mc(Od,{6:1},-1,[b])}
+function sc(a,b,c){qc();for(var d=0,e=b.length;d<e;++d){a[b[d]]=c[d]}}
+function xl(a,b,c,d){var e;for(e=0;e<b;++e){c[d++]=a.charCodeAt(e)}}
+function Wh(a,b){var c;for(c=a.e-1;c>=0&&a.b[c]==b[c];--c){}return c<0}
+function tp(a,b){var c;c=a.c;a.c=b;if(!a.d){a.d=true;++a.e}return c}
+function $l(a,b){dc(a.b,String.fromCharCode.apply(null,b));return a}
+function am(a,b,c,d){b==null&&(b=Mr);bc(a.b,b.substr(c,d-c));return a}
+function sn(a,b,c,d){var e;e=lc(Od,{6:1},-1,b,1);tn(e,a,b,c,d);return e}
+function mc(a,b,c,d){qc();sc(d,oc,pc);d.aC=a;d.cM=b;d.qI=c;return d}
+function uq(a,b,c){for(;c<a.c;++c){if(Xq(b,a.b[c])){return c}}return -1}
+function sq(a,b,c){(b<0||b>a.c)&&hq(b,a.c);Aq(a.b,b,0,c);++a.c}
+function nn(a,b){var c;c=on(a.b,a.e,b);if(c==1){a.b[a.e]=1;++a.e}a.c=-2}
+function Sh(a){while(a.e>0&&a.b[--a.e]==0){}a.b[a.e++]==0&&(a.f=0)}
+function Gg(a){if(we(a,ur)&&xe(a,xr)){return df[Je(a)]}return new qg(a,0)}
+function ji(a,b){if(b==0||a.f==0){return a}return b>0?wm(a,b):zm(a,-b)}
+function li(a,b){if(b==0||a.f==0){return a}return b>0?zm(a,b):wm(a,-b)}
+function $h(a){var b;if(a.f==0){return -1}b=Zh(a);return (b<<5)+_k(a.b[b])}
+function bl(a){var b;b=Je(a);return b!=0?_k(b):_k(Je(Fe(a,32)))+32}
+function Sb(a,b){var c;c=Mb(a,b);return c.length==0?(new Fb).o(b):zb(c,1)}
+function Gl(a,b,c){a=a.slice(b,c);return String.fromCharCode.apply(null,a)}
+function rc(a,b,c){var d=0,e;for(var f in a){if(e=a[f]){b[d]=f;c[d]=e;++d}}}
+function up(e,a,b){var c,d=e.f;a=Qr+a;a in d?(c=d[a]):++e.e;d[a]=b;return c}
+function gn(a,b,c,d){var e;e=lc(Od,{6:1},-1,b+1,1);hn(e,a,b,c,d);return e}
+function Cl(a){var b,c;c=a.length;b=lc(Md,{6:1},-1,c,1);xl(a,c,b,0);return b}
+function _e(a){var b;b=bf(a);if(isNaN(b)){throw new pl(Zr+a+$r)}return b}
+function Fg(a){if(!isFinite(a)||isNaN(a)){throw new pl(hs)}return new mg(Lr+a)}
+function wc(a){if(a!=null&&(a.tM==rr||tc(a,1))){throw new Ek}return a}
+function Qf(a,b){var c;c=new og((!a.d&&(a.d=Li(a.g)),a.d),a.f);If(c,b);return c}
+function bg(a,b){var c;c=new Pi(Zf(a));if(sm(c)<b){return ai(c)}throw new nk(cs)}
+function ei(a,b){if(b.f==0){return Nh}if(a.f==0){return Nh}return go(),ho(a,b)}
+function bi(a,b){var c;if(b.f<=0){throw new nk(us)}c=hi(a,b);return c.f<0?fn(c,b):c}
+function Ip(a){var b;b=new vq;a.d&&rq(b,new Sp(a));kp(a,b);jp(a,b);this.b=new mq(b)}
+function lp(a,b){return b==null?a.d:xc(b,1)?qp(a,vc(b,1)):pp(a,b,~~fb(b))}
+function mp(a,b){return b==null?a.c:xc(b,1)?op(a,vc(b,1)):np(a,b,~~fb(b))}
+function Bc(a){return ~~Math.max(Math.min(a,2147483647),-2147483648)}
+function qg(a,b){this.f=b;this.b=tg(a);this.b<54?(this.g=Ie(a)):(this.d=Ki(a))}
+function kg(a){if(!isFinite(a)||isNaN(a)){throw new pl(hs)}Hf(this,a.toPrecision(20))}
+function mb(b){return function(){try{return nb(b,this,arguments)}catch(a){throw a}}}
+function nb(a,b,c){var d;d=lb();try{return kb(a,b,c)}finally{d&&tb((rb(),qb));--ib}}
+function Ok(a,b){var c;c=a[Qr+b];if(c){return c}if(b==null){throw new jl}throw new Rk}
+function sb(a){var b,c;if(a.b){c=null;do{b=a.b;a.b=null;c=xb(b,c)}while(a.b);a.b=c}}
+function tb(a){var b,c;if(a.c){c=null;do{b=a.c;a.c=null;c=xb(b,c)}while(a.c);a.c=c}}
+function _k(a){var b,c;if(a==0){return 32}else{c=0;for(b=1;(b&a)==0;b<<=1){++c}return c}}
+function Jk(a){var b,c,d,e;b={};for(d=0,e=a.length;d<e;++d){c=a[d];b[Qr+c.b]=c}return b}
+function Rb(a){var b;b=zb(Sb(a,Eb()),3);b.length==0&&(b=zb((new Fb).k(),1));return b}
+function Wn(a){var b;b=new gm;$l(b,Sn);bm(b,a.b);b.b.b+=ys;$l(b,Tn);cm(b,a.c);return b.b.b}
+function Rh(a){var b;b=lc(Od,{6:1},-1,a.e,1);nm(a.b,0,b,0,a.e);return new si(a.f,a.e,b)}
+function Bf(a,b){var c;c=lc(Wd,{6:1},16,2,0);nc(c,0,Df(a,b));nc(c,1,Xf(a,Kf(c[0],b)));return c}
+function Cf(a,b,c){var d;d=lc(Wd,{6:1},16,2,0);nc(d,0,Ef(a,b,c));nc(d,1,Xf(a,Kf(d[0],b)));return d}
+function $o(a,b){var c;while(a.Pb()){c=a.Qb();if(b==null?c==null:eb(b,c)){return a}}return null}
+function Zh(a){var b;if(a.c==-2){if(a.f==0){b=-1}else{for(b=0;a.b[b]==0;++b){}}a.c=b}return a.c}
+function bb(a){var b;return a==null?Mr:yc(a)?cb(wc(a)):xc(a,1)?Nr:(b=a,zc(b)?b.gC():Gc).d}
+function Uf(a){if(a.b<54){return a.g<0?-1:a.g>0?1:0}return (!a.d&&(a.d=Li(a.g)),a.d).r()}
+function Mf(a){if(a.b<54){return new pg(-a.g,a.f)}return new og((!a.d&&(a.d=Li(a.g)),a.d).cb(),a.f)}
+function El(a,b,c){if(b<0){throw new lm(b)}if(c<b){throw new lm(c-b)}if(c>a){throw new lm(c)}}
+function lg(a,b){if(!isFinite(a)||isNaN(a)){throw new pl(hs)}Hf(this,a.toPrecision(20));If(this,b)}
+function Gk(a,b){if(isNaN(a)){return isNaN(b)?0:1}else if(isNaN(b)){return -1}return a<b?-1:a>b?1:0}
+function uk(a,b){if(b<2||b>36){return 0}if(a<0||a>=b){return 0}return a<10?48+a&65535:97+a-10&65535}
+function er(a,b){var c;if(!b){return null}c=b[Ls];if(c){return c}c=ir(b,dr(a,b.gC()));b[Ls]=c;return c}
+function ke(a){var b,c;c=$k(a.h);if(c==32){b=$k(a.m);return b==32?$k(a.l)+32:b+20-10}else{return c-12}}
+function be(a){var b,c,d;b=a&4194303;c=~~a>>22&4194303;d=a<0?1048575:0;return de(b,c,d)}
+function Qe(){Qe=rr;Me=de(4194303,4194303,524287);Ne=de(0,0,524288);Oe=ue(1);ue(2);Pe=ue(0)}
+function mn(a,b){hn(a.b,a.b,a.e,b.b,b.e);a.e=hl(gl(a.e,b.e)+1,a.b.length);Sh(a);a.c=-2}
+function um(a,b){var c;c=~~b>>5;a.e+=c+($k(a.b[a.e-1])-(b&31)>=0?0:1);xm(a.b,a.b,c,b&31);Sh(a);a.c=-2}
+function Tm(a,b){var c,d;c=~~b>>5;if(a.e<c||a.ab()<=b){return}d=32-(b&31);a.e=c+1;a.b[c]&=d<32?~~-1>>>d:0;Sh(a)}
+function ai(a){var b;b=a.e>1?De(Ee(ue(a.b[1]),32),qe(ue(a.b[0]),yr)):qe(ue(a.b[0]),yr);return Ae(ue(a.f),b)}
+function jn(a,b,c){var d;for(d=c-1;d>=0&&a[d]==b[d];--d){}return d<0?0:xe(qe(ue(a[d]),yr),qe(ue(b[d]),yr))?-1:1}
+function ym(a,b,c){var d,e,f;d=0;for(e=0;e<c;++e){f=b[e];a[e]=f<<1|d;d=~~f>>>31}d!=0&&(a[c]=d)}
+function ge(a,b,c,d,e){var f;f=Fe(a,b);c&&je(f);if(e){a=ie(a,b);d?(ae=Be(a)):(ae=de(a.l,a.m,a.h))}return f}
+function gwtOnLoad(b,c,d,e){$moduleName=c;$moduleBase=d;if(b)try{Jr($d)()}catch(a){b(c)}else{Jr($d)()}}
+function fr(a,b){var c,d,e;if(b==null){return null}d=cr(b);e=d;for(c=0;c<b.length;++c){e[c]=er(a,b[c])}return d}
+function Mb(a,b){var c,d,e;e=b&&b.stack?b.stack.split('\n'):[];for(c=0,d=e.length;c<d;++c){e[c]=a.n(e[c])}return e}
+function Um(a,b){var c,d;d=~~b>>5==a.e-1&&a.b[a.e-1]==1<<(b&31);if(d){for(c=0;d&&c<a.e-1;++c){d=a.b[c]==0}}return d}
+function _h(a){var b;if(a.d!=0){return a.d}for(b=0;b<a.b.length;++b){a.d=a.d*33+(a.b[b]&-1)}a.d=a.d*a.f;return a.d}
+function Hg(a,b){if(b==0){return Gg(a)}if(se(a,ur)&&b>=0&&b<pf.length){return pf[b]}return new qg(a,b)}
+function Ig(a){if(a==Bc(a)){return Hg(ur,Bc(a))}if(a>=0){return new qg(ur,2147483647)}return new qg(ur,-2147483648)}
+function Li(a){Oh();if(a<0){if(a!=-1){return new ui(-1,-a)}return Ih}else return a<=10?Kh[Bc(a)]:new ui(1,a)}
+function zg(a){var b=qf;!b&&(b=qf=/^[+-]?\d*$/i);if(b.test(a)){return parseInt(a,10)}else{return Number.NaN}}
+function kp(e,a){var b=e.f;for(var c in b){if(c.charCodeAt(0)==58){var d=new Yp(e,c.substring(1));a.Kb(d)}}}
+function Rl(a){Pl();var b=Qr+a;var c=Ol[b];if(c!=null){return c}c=Ml[b];c==null&&(c=Ql(a));Sl();return Ol[b]=c}
+function Be(a){var b,c,d;b=~a.l+1&4194303;c=~a.m+(b==0?1:0)&4194303;d=~a.h+(b==0&&c==0?1:0)&1048575;return de(b,c,d)}
+function je(a){var b,c,d;b=~a.l+1&4194303;c=~a.m+(b==0?1:0)&4194303;d=~a.h+(b==0&&c==0?1:0)&1048575;a.l=b;a.m=c;a.h=d}
+function Q(a){var b,c,d;c=lc(Ud,{6:1},13,a.length,0);for(d=0,b=a.length;d<b;++d){if(!a[d]){throw new jl}c[d]=a[d]}}
+function Cb(){var a,b,c,d;c=Rb(new Tb);d=lc(Ud,{6:1},13,c.length,0);for(a=0,b=d.length;a<b;++a){d[a]=new sl(c[a])}Q(d)}
+function fk(){var a,b,c;c=(Qo(),Qo(),zo);b=lc(Sd,{6:1},5,c.length,0);for(a=0;a<c.length;++a)b[a]=new bk(c[a]);return b}
+function ki(a){var b,c,d,e;return a.f==0?a:(e=a.e,c=e+1,b=lc(Od,{6:1},-1,c,1),ym(b,a.b,e),d=new si(a.f,c,b),Sh(d),d)}
+function Ym(a,b,c,d){var e,f;e=c.e;f=lc(Od,{6:1},-1,(e<<1)+1,1);io(a.b,hl(e,a.e),b.b,hl(e,b.e),f);Zm(f,c,d);return Pm(f,c)}
+function Vh(a,b){var c;if(a===b){return true}if(xc(b,17)){c=vc(b,17);return a.f==c.f&&a.e==c.e&&Wh(a,c.b)}return false}
+function Zk(a){var b;if(a<0){return -2147483648}else if(a==0){return 0}else{for(b=1073741824;(b&a)==0;b>>=1){}return b}}
+function sm(a){var b,c,d;if(a.f==0){return 0}b=a.e<<5;c=a.b[a.e-1];if(a.f<0){d=Zh(a);d==a.e-1&&(c=~~(c-1))}b-=$k(c);return b}
+function io(a,b,c,d,e){go();if(b==0||d==0){return}b==1?(e[d]=ko(e,c,d,a[0])):d==1?(e[b]=ko(e,a,b,c[0])):jo(a,c,e,b,d)}
+function en(a,b,c,d,e){var f,g;g=a;for(f=c.ab()-1;f>=0;--f){g=Ym(g,g,d,e);(c.b[~~f>>5]&1<<(f&31))!=0&&(g=Ym(g,b,d,e))}return g}
+function on(a,b,c){var d,e;d=qe(ue(c),yr);for(e=0;Ce(d,ur)&&e<b;++e){d=pe(d,qe(ue(a[e]),yr));a[e]=Je(d);d=Fe(d,32)}return Je(d)}
+function hg(b,c,d){var a,e;try{Hf(this,Ll(b,c,d))}catch(a){a=_d(a);if(xc(a,14)){e=a;throw new pl(e.f)}else throw a}}
+function Dg(a){if(a<-2147483648){throw new nk('Overflow')}else if(a>2147483647){throw new nk('Underflow')}else{return Bc(a)}}
+function Xn(a,b){Un();if(a<0){throw new Sk('Digits < 0')}if(!b){throw new kl('null RoundingMode')}this.b=a;this.c=b}
+function Ki(a){Oh();if(xe(a,ur)){if(Ce(a,wr)){return new ti(-1,Be(a))}return Ih}else return ye(a,tr)?Kh[Je(a)]:new ti(1,a)}
+function tg(a){var b;xe(a,ur)&&(a=de(~a.l&4194303,~a.m&4194303,~a.h&1048575));return 64-(b=Je(Fe(a,32)),b!=0?$k(b):$k(Je(a))+32)}
+function pe(a,b){var c,d,e;c=a.l+b.l;d=a.m+b.m+(~~c>>22);e=a.h+b.h+(~~d>>22);return de(c&4194303,d&4194303,e&1048575)}
+function He(a,b){var c,d,e;c=a.l-b.l;d=a.m-b.m+(~~c>>22);e=a.h-b.h+(~~d>>22);return de(c&4194303,d&4194303,e&1048575)}
+function Sm(a,b){var c;c=b-1;if(a.f>0){while(!a.gb(c)){--c}return b-1-c}else{while(a.gb(c)){--c}return b-1-gl(c,a.bb())}}
+function fe(a,b){if(a.h==524288&&a.m==0&&a.l==0){b&&(ae=de(0,0,0));return ce((Qe(),Oe))}b&&(ae=de(a.l,a.m,a.h));return de(0,0,0)}
+function Ff(a,b){var c;if(a===b){return true}if(xc(b,16)){c=vc(b,16);return c.f==a.f&&(a.b<54?c.g==a.g:a.d.eQ(c.d))}return false}
+function cn(a,b,c){var d,e,f,g;f=ur;for(d=b-1;d>=0;--d){g=pe(Ee(f,32),qe(ue(a[d]),yr));e=Nm(g,c);f=ue(Je(Fe(e,32)))}return Je(f)}
+function wm(a,b){var c,d,e,f;c=~~b>>5;b&=31;e=a.e+c+(b==0?0:1);d=lc(Od,{6:1},-1,e,1);xm(d,a.b,c,b);f=new si(a.f,e,d);Sh(f);return f}
+function ue(a){var b,c;if(a>-129&&a<128){b=a+128;oe==null&&(oe=lc(Pd,{6:1},2,256,0));c=oe[b];!c&&(c=oe[b]=be(a));return c}return be(a)}
+function Ai(a){Oh();var b,c,d;if(a<Mh.length){return Mh[a]}c=~~a>>5;b=a&31;d=lc(Od,{6:1},-1,c+1,1);d[c]=1<<b;return new si(1,c+1,d)}
+function ri(a){Oh();if(a.length==0){this.f=0;this.e=1;this.b=mc(Od,{6:1},-1,[0])}else{this.f=1;this.e=a.length;this.b=a;Sh(this)}}
+function Dl(c){if(c.length==0||c[0]>ys&&c[c.length-1]>ys){return c}var a=c.replace(/^(\s*)/,Lr);var b=a.replace(/\s*$/,Lr);return b}
+function Yk(a){a-=~~a>>1&1431655765;a=(~~a>>2&858993459)+(a&858993459);a=(~~a>>4)+a&252645135;a+=~~a>>8;a+=~~a>>16;return a&63}
+function nc(a,b,c){if(c!=null){if(a.qI>0&&!uc(c,a.qI)){throw new qk}if(a.qI<0&&(c.tM==rr||tc(c,1))){throw new qk}}return a[b]=c}
+function Qh(a,b){if(a.f>b.f){return 1}if(a.f<b.f){return -1}if(a.e>b.e){return a.f}if(a.e<b.e){return -b.f}return a.f*jn(a.b,b.b,a.e)}
+function Rf(a,b){var c;c=a.f-b;if(a.b<54){if(a.g==0){return Ig(c)}return new pg(a.g,Dg(c))}return new dg((!a.d&&(a.d=Li(a.g)),a.d),Dg(c))}
+function jp(i,a){var b=i.b;for(var c in b){var d=parseInt(c,10);if(c==d){var e=b[d];for(var f=0,g=e.length;f<g;++f){a.Kb(e[f])}}}}
+function np(i,a,b){var c=i.b[b];if(c){for(var d=0,e=c.length;d<e;++d){var f=c[d];var g=f.Rb();if(i.Ob(a,g)){return f.Sb()}}}return null}
+function pp(i,a,b){var c=i.b[b];if(c){for(var d=0,e=c.length;d<e;++d){var f=c[d];var g=f.Rb();if(i.Ob(a,g)){return true}}}return false}
+function Bq(a,b){var c,d,e,f;d=0;c=a.length-1;while(d<=c){e=d+(~~(c-d)>>1);f=a[e];if(f<b){d=e+1}else if(f>b){c=e-1}else{return e}}return -d-1}
+function Pk(a){var b;b=_e(a);if(b>3.4028234663852886E38){return Infinity}else if(b<-3.4028234663852886E38){return -Infinity}return b}
+function Ie(a){if(se(a,(Qe(),Ne))){return -9223372036854775808}if(!we(a,Pe)){return -me(Be(a))}return a.l+a.m*4194304+a.h*17592186044416}
+function Bb(a,b){var c,d,e,f;e=Sb(a,yc(b.c)?wc(b.c):null);f=lc(Ud,{6:1},13,e.length,0);for(c=0,d=f.length;c<d;++c){f[c]=new sl(e[c])}Q(f)}
+function yb(a){var b,c,d;d=Lr;a=Dl(a);b=a.indexOf(Or);if(b!=-1){c=a.indexOf('function')==0?8:0;d=Dl(a.substr(c,b-c))}return d.length>0?d:Pr}
+function ie(a,b){var c,d,e;if(b<=22){c=a.l&(1<<b)-1;d=e=0}else if(b<=44){c=a.l;d=a.m&(1<<b-22)-1;e=0}else{c=a.l;d=a.m;e=a.h&(1<<b-44)-1}return de(c,d,e)}
+function Db(b){var c=Lr;try{for(var d in b){if(d!='name'&&d!='message'&&d!='toString'){try{c+='\n '+d+Kr+b[d]}catch(a){}}}}catch(a){}return c}
+function ti(a,b){this.f=a;if(se(qe(b,zr),ur)){this.e=1;this.b=mc(Od,{6:1},-1,[Je(b)])}else{this.e=2;this.b=mc(Od,{6:1},-1,[Je(b),Je(Fe(b,32))])}}
+function ui(a,b){this.f=a;if(b<4294967296){this.e=1;this.b=mc(Od,{6:1},-1,[~~b])}else{this.e=2;this.b=mc(Od,{6:1},-1,[~~(b%4294967296),~~(b/4294967296)])}}
+function Xm(a,b){var c,d;d=new ri(lc(Od,{6:1},-1,1<<b,1));d.e=1;d.b[0]=1;d.f=1;for(c=1;c<b;++c){Bm(ei(a,d),c)&&(d.b[~~c>>5]|=1<<(c&31))}return d}
+function Jm(a){var b,c,d;b=qe(ue(a.b[0]),yr);c=sr;d=vr;do{Ce(qe(Ae(b,c),d),ur)&&(c=De(c,d));d=Ee(d,1)}while(xe(d,Fr));c=Be(c);return Je(qe(c,yr))}
+function Gm(a){var b,c,d;if(we(a,ur)){c=re(a,Ar);d=ze(a,Ar)}else{b=Ge(a,1);c=re(b,Br);d=ze(b,Br);d=pe(Ee(d,1),qe(a,sr))}return De(Ee(d,32),qe(c,yr))}
+function ko(a,b,c,d){go();var e,f;e=ur;for(f=0;f<c;++f){e=pe(Ae(qe(ue(b[f]),yr),qe(ue(d),yr)),qe(ue(Je(e)),yr));a[f]=Je(e);e=Ge(e,32)}return Je(e)}
+function _m(a,b,c){var d,e,f,g,i;e=c.e<<5;d=bi(a.eb(e),c);i=bi(Ai(e),c);f=Jm(c);c.e==1?(g=en(i,d,b,c,f)):(g=dn(i,d,b,c,f));return Ym(g,(Oh(),Jh),c,f)}
+function Om(a,b,c){var d,e,f,g,i,j;d=c.bb();e=c.fb(d);g=_m(a,b,e);i=an(a,b,d);f=Xm(e,d);j=ei(rn(i,g),f);Tm(j,d);j.f<0&&(j=fn(j,Ai(d)));return fn(g,ei(e,j))}
+function xb(b,c){var a,d,e,f;for(d=0,e=b.length;d<e;++d){f=b[d];try{f[1]?f[0].Ub()&&(c=wb(c,f)):f[0].Ub()}catch(a){a=_d(a);if(!xc(a,12))throw a}}return c}
+function bf(a){var b=$e;!b&&(b=$e=/^\s*[+-]?((\d+\.?\d*)|(\.\d+))([eE][+-]?\d+)?[dDfF]?\s*$/i);if(b.test(a)){return parseFloat(a)}else{return Number.NaN}}
+function pi(a,b){if(a==null){throw new jl}if(b<2||b>36){throw new pl('Radix out of range')}if(a.length==0){throw new pl('Zero length BigInteger')}Ei(this,a,b)}
+function Vq(){Uq();var a,b,c;c=Tq+++(new Date).getTime();a=Bc(Math.floor(c*5.9604644775390625E-8))&16777215;b=Bc(c-a*16777216);this.b=a^1502;this.c=b^15525485}
+function un(a,b,c,d){var e;if(c>d){return 1}else if(c<d){return -1}else{for(e=c-1;e>=0&&a[e]==b[e];--e){}return e<0?0:xe(qe(ue(a[e]),yr),qe(ue(b[e]),yr))?-1:1}}
+function In(a,b){var c,d,e,f;e=a.e;d=lc(Od,{6:1},-1,e,1);hl(Zh(a),Zh(b));for(c=0;c<b.e;++c){d[c]=a.b[c]|b.b[c]}for(;c<e;++c){d[c]=a.b[c]}f=new si(1,e,d);return f}
+function Mn(a,b){var c,d,e,f;e=a.e;d=lc(Od,{6:1},-1,e,1);c=hl(Zh(a),Zh(b));for(;c<b.e;++c){d[c]=a.b[c]^b.b[c]}for(;c<a.e;++c){d[c]=a.b[c]}f=new si(1,e,d);Sh(f);return f}
+function Bn(a,b){var c,d,e,f;e=lc(Od,{6:1},-1,a.e,1);d=hl(a.e,b.e);for(c=Zh(a);c<d;++c){e[c]=a.b[c]&~b.b[c]}for(;c<a.e;++c){e[c]=a.b[c]}f=new si(1,a.e,e);Sh(f);return f}
+function Dn(a,b){var c,d,e,f;e=hl(a.e,b.e);c=gl(Zh(a),Zh(b));if(c>=e){return Oh(),Nh}d=lc(Od,{6:1},-1,e,1);for(;c<e;++c){d[c]=a.b[c]&b.b[c]}f=new si(1,e,d);Sh(f);return f}
+function Nf(a,b){var c;if(b==0){return lf}if(b<0||b>999999999){throw new nk(bs)}c=a.f*b;return a.b==0&&a.g!=-1?Ig(c):new dg((!a.d&&(a.d=Li(a.g)),a.d).db(b),Dg(c))}
+function tk(a,b){if(b<2||b>36){return -1}if(a>=48&&a<48+(b<10?b:10)){return a-48}if(a>=97&&a<b+97-10){return a-97+10}if(a>=65&&a<b+65-10){return a-65+10}return -1}
+function Uq(){Uq=rr;var a,b,c;Rq=lc(Nd,{6:1},-1,25,1);Sq=lc(Nd,{6:1},-1,33,1);c=1.52587890625E-5;for(a=32;a>=0;--a){Sq[a]=c;c*=0.5}b=1;for(a=24;a>=0;--a){Rq[a]=b;b*=0.5}}
+function oo(a,b){go();var c,d;d=(Oh(),Jh);c=a;for(;b>1;b>>=1){(b&1)!=0&&(d=ei(d,c));c.e==1?(c=ei(c,c)):(c=new ri(qo(c.b,c.e,lc(Od,{6:1},-1,c.e<<1,1))))}d=ei(d,c);return d}
+function nl(){nl=rr;ml=mc(Md,{6:1},-1,[48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122])}
+function rm(a){var b,c;b=0;if(a.f==0){return 0}c=Zh(a);if(a.f>0){for(;c<a.e;++c){b+=Yk(a.b[c])}}else{b+=Yk(-a.b[c]);for(++c;c<a.e;++c){b+=Yk(~a.b[c])}b=(a.e<<5)-b}return b}
+function ne(a,b){var c,d,e;e=a.h-b.h;if(e<0){return false}c=a.l-b.l;d=a.m-b.m+(~~c>>22);e+=~~d>>22;if(e<0){return false}a.l=c&4194303;a.m=d&4194303;a.h=e&1048575;return true}
+function al(a){var b,c,d;b=lc(Md,{6:1},-1,8,1);c=(nl(),ml);d=7;if(a>=0){while(a>15){b[d--]=c[a&15];a>>=4}}else{while(d>0){b[d--]=c[a&15];a>>=4}}b[d]=c[a&15];return Gl(b,d,8)}
+function vn(a,b){if(b.f==0||a.f==0){return Oh(),Nh}if(Vh(b,(Oh(),Ih))){return a}if(Vh(a,Ih)){return b}return a.f>0?b.f>0?Dn(a,b):wn(a,b):b.f>0?wn(b,a):a.e>b.e?xn(a,b):xn(b,a)}
+function yn(a,b){if(b.f==0){return a}if(a.f==0){return Oh(),Nh}if(Vh(a,(Oh(),Ih))){return new Pi(En(b))}if(Vh(b,Ih)){return Nh}return a.f>0?b.f>0?Bn(a,b):Cn(a,b):b.f>0?An(a,b):zn(a,b)}
+function Gf(a){var b;if(a.c!=0){return a.c}if(a.b<54){b=te(a.g);a.c=Je(qe(b,wr));a.c=33*a.c+Je(qe(Fe(b,32),wr));a.c=17*a.c+Bc(a.f);return a.c}a.c=17*a.d.hC()+Bc(a.f);return a.c}
+function vg(a,b,c,d){var e,f,g,i,j;f=(j=a/b,j>0?Math.floor(j):Math.ceil(j));g=a%b;i=Gk(a*b,0);if(g!=0){e=Gk((g<=0?0-g:g)*2,b<=0?0-b:b);f+=Bg(Bc(f)&1,i*(5+e),d)}return new pg(f,c)}
+function jc(a,b){var c=new Array(b);if(a==3){for(var d=0;d<b;++d){var e=new Object;e.l=e.m=e.h=0;c[d]=e}}else if(a>0){var e=[null,0,false][a];for(var d=0;d<b;++d){c[d]=e}}return c}
+function tn(a,b,c,d,e){var f,g;f=ur;for(g=0;g<e;++g){f=pe(f,He(qe(ue(b[g]),yr),qe(ue(d[g]),yr)));a[g]=Je(f);f=Fe(f,32)}for(;g<c;++g){f=pe(f,qe(ue(b[g]),yr));a[g]=Je(f);f=Fe(f,32)}}
+function xm(a,b,c,d){var e,f;if(d==0){nm(b,0,a,c,a.length-c)}else{f=32-d;a[a.length-1]=0;for(e=a.length-1;e>c;--e){a[e]|=~~b[e-c-1]>>>f;a[e-1]=b[e-c-1]<<d}}for(e=0;e<c;++e){a[e]=0}}
+function rg(a,b,c){if(c<hf.length&&gl(a.b,b.b+jf[Bc(c)])+1<54){return new pg(a.g+b.g*hf[Bc(c)],a.f)}return new og(fn((!a.d&&(a.d=Li(a.g)),a.d),mo((!b.d&&(b.d=Li(b.g)),b.d),Bc(c))),a.f)}
+function Ue(a){return $stats({moduleName:$moduleName,sessionId:$sessionId,subSystem:'startup',evtGroup:'moduleStartup',millis:(new Date).getTime(),type:'onModuleLoadStart',className:a})}
+function vm(a,b){var c,d,e;e=a.r();if(b==0||a.r()==0){return}d=~~b>>5;a.e-=d;if(!Am(a.b,a.e,a.b,d,b&31)&&e<0){for(c=0;c<a.e&&a.b[c]==-1;++c){a.b[c]=0}c==a.e&&++a.e;++a.b[c]}Sh(a);a.c=-2}
+function ve(a,b){var c,d;c=~~a.h>>19;d=~~b.h>>19;return c==0?d!=0||a.h>b.h||a.h==b.h&&a.m>b.m||a.h==b.h&&a.m==b.m&&a.l>b.l:!(d==0||a.h<b.h||a.h==b.h&&a.m<b.m||a.h==b.h&&a.m==b.m&&a.l<=b.l)}
+function we(a,b){var c,d;c=~~a.h>>19;d=~~b.h>>19;return c==0?d!=0||a.h>b.h||a.h==b.h&&a.m>b.m||a.h==b.h&&a.m==b.m&&a.l>=b.l:!(d==0||a.h<b.h||a.h==b.h&&a.m<b.m||a.h==b.h&&a.m==b.m&&a.l<b.l)}
+function Rm(a,b){var c,d,e;c=bl(a);d=bl(b);e=c<d?c:d;c!=0&&(a=Ge(a,c));d!=0&&(b=Ge(b,d));do{if(we(a,b)){a=He(a,b);a=Ge(a,bl(a))}else{b=He(b,a);b=Ge(b,bl(b))}}while(Ce(a,ur));return Ee(b,e)}
+function Fn(a,b){if(Vh(b,(Oh(),Ih))||Vh(a,Ih)){return Ih}if(b.f==0){return a}if(a.f==0){return b}return a.f>0?b.f>0?a.e>b.e?In(a,b):In(b,a):Gn(a,b):b.f>0?Gn(b,a):Zh(b)>Zh(a)?Hn(b,a):Hn(a,b)}
+function sg(a){var b,c;if(a>-140737488355328&&a<140737488355328){if(a==0){return 0}b=a<0;b&&(a=-a);c=Bc(el(Math.log(a)/0.6931471805599453));(!b||a!=Math.pow(2,c))&&++c;return c}return tg(te(a))}
+function Yh(a,b){var c,d;c=a._();d=b._();if(c.r()==0){return d}else if(d.r()==0){return c}if((c.e==1||c.e==2&&c.b[1]>0)&&(d.e==1||d.e==2&&d.b[1]>0)){return Ki(Rm(ai(c),ai(d)))}return Qm(Rh(c),Rh(d))}
+function ci(a,b){var c;if(b.f<=0){throw new nk(us)}if(!(a.gb(0)||b.gb(0))){throw new nk(vs)}if(b.e==1&&b.b[0]==1){return Nh}c=Wm(bi(a._(),b),b);if(c.f==0){throw new nk(vs)}c=a.f<0?rn(b,c):c;return c}
+function Am(a,b,c,d,e){var f,g,i;f=true;for(g=0;g<d;++g){f=f&c[g]==0}if(e==0){nm(c,d,a,0,b)}else{i=32-e;f=f&c[g]<<i==0;for(g=0;g<b-1;++g){a[g]=~~c[g+d]>>>e|c[g+d+1]<<i}a[g]=~~c[g+d]>>>e;++g}return f}
+function Ql(a){var b,c,d,e;b=0;d=a.length;e=d-4;c=0;while(c<e){b=a.charCodeAt(c+3)+31*(a.charCodeAt(c+2)+31*(a.charCodeAt(c+1)+31*(a.charCodeAt(c)+31*b)))|0;c+=4}while(c<d){b=b*31+vl(a,c++)}return b|0}
+function Pm(a,b){var c,d,e,f,g;f=b.e;c=a[f]!=0;if(!c){e=b.b;c=true;for(d=f-1;d>=0;--d){if(a[d]!=e[d]){c=a[d]!=0&&ve(qe(ue(a[d]),yr),qe(ue(e[d]),yr));break}}}g=new si(1,f+1,a);c&&pn(g,b);Sh(g);return g}
+function Kf(a,b){var c;c=a.f+b.f;if(a.b==0&&a.g!=-1||b.b==0&&b.g!=-1){return Ig(c)}if(a.b+b.b<54){return new pg(a.g*b.g,Dg(c))}return new dg(ei((!a.d&&(a.d=Li(a.g)),a.d),(!b.d&&(b.d=Li(b.g)),b.d)),Dg(c))}
+function sp(k,a,b,c){var d=k.b[c];if(d){for(var e=0,f=d.length;e<f;++e){var g=d[e];var i=g.Rb();if(k.Ob(a,i)){var j=g.Sb();g.Tb(b);return j}}}else{d=k.b[c]=[]}var g=new Iq(a,b);d.push(g);++k.e;return null}
+function an(a,b,c){var d,e,f,g,i;g=(Oh(),Jh);e=Rh(b);d=Rh(a);a.gb(0)&&Tm(e,c-1);Tm(d,c);for(f=e.ab()-1;f>=0;--f){i=Rh(g);Tm(i,c);g=ei(g,i);if((e.b[~~f>>5]&1<<(f&31))!=0){g=ei(g,d);Tm(g,c)}}Tm(g,c);return g}
+function ar(a,b){var c,d,e,f,g,i,j;j=zl(a,Ks,0);i=$wnd;for(g=0;g<j.length;++g){if(!wl(j[g],'client')){br(i,j[g]);i=i[j[g]]}}c=zl(b,Ks,0);for(e=0,f=c.length;e<f;++e){d=c[e];if(!wl(Dl(d),Lr)){br(i,d);i=i[d]}}}
+function gi(a,b){var c;if(b<0){throw new nk('Negative exponent')}if(b==0){return Jh}else if(b==1||a.eQ(Jh)||a.eQ(Nh)){return a}if(!a.gb(0)){c=1;while(!a.gb(c)){++c}return ei(Ai(c*b),a.fb(c).db(b))}return oo(a,b)}
+function Ee(a,b){var c,d,e;b&=63;if(b<22){c=a.l<<b;d=a.m<<b|~~a.l>>22-b;e=a.h<<b|~~a.m>>22-b}else if(b<44){c=0;d=a.l<<b-22;e=a.m<<b-22|~~a.l>>44-b}else{c=0;d=0;e=a.l<<b-44}return de(c&4194303,d&4194303,e&1048575)}
+function Ge(a,b){var c,d,e,f;b&=63;c=a.h&1048575;if(b<22){f=~~c>>>b;e=~~a.m>>b|c<<22-b;d=~~a.l>>b|a.m<<22-b}else if(b<44){f=0;e=~~c>>>b-22;d=~~a.m>>b-22|a.h<<44-b}else{f=0;e=0;d=~~c>>>b-44}return de(d&4194303,e&4194303,f&1048575)}
+function Uo(a){Qo();switch(a){case 2:return Ao;case 1:return Bo;case 3:return Co;case 5:return Do;case 6:return Eo;case 4:return Fo;case 7:return Go;case 0:return Ho;default:throw new Sk('Invalid rounding mode');}}
+function mi(a,b){var c,d,e;if(b==0){return (a.b[0]&1)!=0}if(b<0){throw new nk(ts)}e=~~b>>5;if(e>=a.e){return a.f<0}c=a.b[e];b=1<<(b&31);if(a.f<0){d=Zh(a);if(e<d){return false}else d==e?(c=-c):(c=~c)}return (c&b)!=0}
+function Pf(a){var b,c;if(a.e>0){return a.e}b=1;c=1;if(a.b<54){a.b>=1&&(c=a.g);b+=Math.log(c<=0?0-c:c)*Math.LOG10E}else{b+=(a.b-1)*0.3010299956639812;Th((!a.d&&(a.d=Li(a.g)),a.d),po(b)).r()!=0&&++b}a.e=Bc(b);return a.e}
+function zh(a){rf();var b,c;c=Lj(a);if(c==ks)b=Fg(a[0]);else if(c==ks)b=Gg(ue(a[0]));else if(c==ns)b=Hg(ue(a[0]),a[1]);else throw new V('Unknown call signature for bd = java.math.BigDecimal.valueOf: '+c);return new Kg(b)}
+function Qi(a){Oh();var b,c;c=Lj(a);if(c==ms)b=new oi(a[0].toString());else if(c=='string number')b=new pi(a[0].toString(),a[1]);else throw new V('Unknown call signature for obj = new java.math.BigInteger: '+c);return new Pi(b)}
+function Un(){Un=rr;On=new Xn(34,(Qo(),Eo));Pn=new Xn(7,Eo);Qn=new Xn(16,Eo);Rn=new Xn(0,Fo);Sn=mc(Md,{6:1},-1,[112,114,101,99,105,115,105,111,110,61]);Tn=mc(Md,{6:1},-1,[114,111,117,110,100,105,110,103,77,111,100,101,61])}
+function Jn(a,b){if(b.f==0){return a}if(a.f==0){return b}if(Vh(b,(Oh(),Ih))){return new Pi(En(a))}if(Vh(a,Ih)){return new Pi(En(b))}return a.f>0?b.f>0?a.e>b.e?Mn(a,b):Mn(b,a):Kn(a,b):b.f>0?Kn(b,a):Zh(b)>Zh(a)?Ln(b,a):Ln(a,b)}
+function Cn(a,b){var c,d,e,f,g,i;d=Zh(b);e=Zh(a);if(d>=a.e){return a}g=hl(a.e,b.e);f=lc(Od,{6:1},-1,g,1);c=e;for(;c<d;++c){f[c]=a.b[c]}if(c==d){f[c]=a.b[c]&b.b[c]-1;++c}for(;c<g;++c){f[c]=a.b[c]&b.b[c]}i=new si(1,g,f);Sh(i);return i}
+function Wf(a){var b,c,d,e,f;b=1;c=nf.length-1;d=a.f;if(a.b==0&&a.g!=-1){return new mg(Tr)}f=(!a.d&&(a.d=Li(a.g)),a.d);while(!f.gb(0)){e=Uh(f,nf[b]);if(e[1].r()==0){d-=b;b<c&&++b;f=e[0]}else{if(b==1){break}b=1}}return new dg(f,Dg(d))}
+function jo(a,b,c,d,e){var f,g,i,j;if(Ac(a)===Ac(b)&&d==e){qo(a,d,c);return}for(i=0;i<d;++i){g=ur;f=a[i];for(j=0;j<e;++j){g=pe(pe(Ae(qe(ue(f),yr),qe(ue(b[j]),yr)),qe(ue(c[i+j]),yr)),qe(ue(Je(g)),yr));c[i+j]=Je(g);g=Ge(g,32)}c[i+e]=Je(g)}}
+function hi(a,b){var c,d,e,f,g;if(b.f==0){throw new nk(ss)}g=a.e;c=b.e;if((g!=c?g>c?1:-1:jn(a.b,b.b,g))==-1){return a}e=lc(Od,{6:1},-1,c,1);if(c==1){e[0]=cn(a.b,g,b.b[0])}else{d=g-c+1;e=Km(null,d,a.b,g,b.b,c)}f=new si(a.f,c,e);Sh(f);return f}
+function $k(a){var b,c,d;if(a<0){return 0}else if(a==0){return 32}else{d=-(~~a>>16);b=~~d>>16&16;c=16-b;a=~~a>>b;d=a-256;b=~~d>>16&8;c+=b;a<<=b;d=a-4096;b=~~d>>16&4;c+=b;a<<=b;d=a-16384;b=~~d>>16&2;c+=b;a<<=b;d=~~a>>14;b=d&~(~~d>>1);return c+2-b}}
+function kn(a,b){var c;if(a.f==0){nm(b.b,0,a.b,0,b.e)}else if(b.f==0){return}else if(a.f==b.f){hn(a.b,a.b,a.e,b.b,b.e)}else{c=un(a.b,b.b,a.e,b.e);if(c>0){tn(a.b,a.b,a.e,b.b,b.e)}else{qn(a.b,a.b,a.e,b.b,b.e);a.f=-a.f}}a.e=gl(a.e,b.e)+1;Sh(a);a.c=-2}
+function ln(a,b){var c,d;c=Qh(a,b);if(a.f==0){nm(b.b,0,a.b,0,b.e);a.f=-b.f}else if(a.f!=b.f){hn(a.b,a.b,a.e,b.b,b.e);a.f=c}else{d=un(a.b,b.b,a.e,b.e);if(d>0){tn(a.b,a.b,a.e,b.b,b.e)}else{qn(a.b,a.b,a.e,b.b,b.e);a.f=-a.f}}a.e=gl(a.e,b.e)+1;Sh(a);a.c=-2}
+function di(a,b,c){var d,e;if(c.f<=0){throw new nk(us)}d=a;if((c.e==1&&c.b[0]==1)|b.f>0&d.f==0){return Nh}if(d.f==0&&b.f==0){return Jh}if(b.f<0){d=ci(a,c);b=b.cb()}e=c.gb(0)?_m(d._(),b,c):Om(d._(),b,c);d.f<0&&b.gb(0)&&(e=bi(ei(rn(c,Jh),e),c));return e}
+function $m(a,b,c,d,e){var f,g,i;f=ur;g=ur;for(i=0;i<d;++i){f=(go(),pe(Ae(qe(ue(c[i]),yr),qe(ue(e),yr)),qe(ue(Je(f)),yr)));g=pe(He(qe(ue(a[b+i]),yr),qe(f,yr)),g);a[b+i]=Je(g);g=Fe(g,32);f=Ge(f,32)}g=pe(He(qe(ue(a[b+d]),yr),f),g);a[b+d]=Je(g);return Je(Fe(g,32))}
+function ho(a,b){go();var c,d,e,f,g,i,j,k,n;if(b.e>a.e){i=a;a=b;b=i}if(b.e<63){return no(a,b)}g=(a.e&-2)<<4;k=a.fb(g);n=b.fb(g);d=rn(a,k.eb(g));e=rn(b,n.eb(g));j=ho(k,n);c=ho(d,e);f=ho(rn(k,d),rn(e,n));f=fn(fn(f,j),c);f=f.eb(g);j=j.eb(g<<1);return fn(fn(j,f),c)}
+function le(a){var b,c,d;c=a.l;if((c&c-1)!=0){return -1}d=a.m;if((d&d-1)!=0){return -1}b=a.h;if((b&b-1)!=0){return -1}if(b==0&&d==0&&c==0){return -1}if(b==0&&d==0&&c!=0){return _k(c)}if(b==0&&d!=0&&c==0){return _k(d)+22}if(b!=0&&d==0&&c==0){return _k(b)+44}return -1}
+function wn(a,b){var c,d,e,f,g,i,j;e=Zh(a);d=Zh(b);if(d>=a.e){return Oh(),Nh}i=a.e;g=lc(Od,{6:1},-1,i,1);c=e>d?e:d;if(c==d){g[c]=-b.b[c]&a.b[c];++c}f=hl(b.e,a.e);for(;c<f;++c){g[c]=~b.b[c]&a.b[c]}if(c>=b.e){for(;c<a.e;++c){g[c]=a.b[c]}}j=new si(1,i,g);Sh(j);return j}
+function Jf(a,b){if(a.b==0&&a.g!=-1){return Ig(b>0?b:0)}if(b>=0){if(a.b<54){return new pg(a.g,Dg(b))}return new dg((!a.d&&(a.d=Li(a.g)),a.d),Dg(b))}if(-b<hf.length&&a.b+jf[Bc(-b)]<54){return new pg(a.g*hf[Bc(-b)],0)}return new dg(mo((!a.d&&(a.d=Li(a.g)),a.d),Bc(-b)),0)}
+function Fe(a,b){var c,d,e,f,g;b&=63;c=a.h;d=(c&524288)!=0;d&&(c|=-1048576);if(b<22){g=~~c>>b;f=~~a.m>>b|c<<22-b;e=~~a.l>>b|a.m<<22-b}else if(b<44){g=d?1048575:0;f=~~c>>b-22;e=~~a.m>>b-22|c<<44-b}else{g=d?1048575:0;f=d?4194303:0;e=~~c>>b-44}return de(e&4194303,f&4194303,g&1048575)}
+function Oh(){Oh=rr;var a;Jh=new qi(1,1);Lh=new qi(1,10);Nh=new qi(0,0);Ih=new qi(-1,1);Kh=mc(Xd,{6:1},17,[Nh,Jh,new qi(1,2),new qi(1,3),new qi(1,4),new qi(1,5),new qi(1,6),new qi(1,7),new qi(1,8),new qi(1,9),Lh]);Mh=lc(Xd,{6:1},17,32,0);for(a=0;a<Mh.length;++a){nc(Mh,a,Ki(Ee(sr,a)))}}
+function lo(a,b){go();var c,d,e,f,g,i,j,k,n;k=a.f;if(k==0){return Oh(),Nh}d=a.e;c=a.b;if(d==1){e=Ae(qe(ue(c[0]),yr),qe(ue(b),yr));j=Je(e);g=Je(Ge(e,32));return g==0?new qi(k,j):new si(k,2,mc(Od,{6:1},-1,[j,g]))}i=d+1;f=lc(Od,{6:1},-1,i,1);f[d]=ko(f,c,d,b);n=new si(k,i,f);Sh(n);return n}
+function no(a,b){var c,d,e,f,g,i,j,k,n,o,q;d=a.e;f=b.e;i=d+f;j=a.f!=b.f?-1:1;if(i==2){n=Ae(qe(ue(a.b[0]),yr),qe(ue(b.b[0]),yr));q=Je(n);o=Je(Ge(n,32));return o==0?new qi(j,q):new si(j,2,mc(Od,{6:1},-1,[q,o]))}c=a.b;e=b.b;g=lc(Od,{6:1},-1,i,1);io(c,d,e,f,g);k=new si(j,i,g);Sh(k);return k}
+function Hn(a,b){var c,d,e,f,g,i;d=Zh(b);e=Zh(a);if(e>=b.e){return b}else if(d>=a.e){return a}g=hl(a.e,b.e);f=lc(Od,{6:1},-1,g,1);if(d==e){f[e]=-(-a.b[e]|-b.b[e]);c=e}else{for(c=d;c<e;++c){f[c]=b.b[c]}f[c]=b.b[c]&a.b[c]-1}for(++c;c<g;++c){f[c]=a.b[c]&b.b[c]}i=new si(-1,g,f);Sh(i);return i}
+function zm(a,b){var c,d,e,f,g;d=~~b>>5;b&=31;if(d>=a.e){return a.f<0?(Oh(),Ih):(Oh(),Nh)}f=a.e-d;e=lc(Od,{6:1},-1,f+1,1);Am(e,f,a.b,d,b);if(a.f<0){for(c=0;c<d&&a.b[c]==0;++c){}if(c<d||b>0&&a.b[c]<<32-b!=0){for(c=0;c<f&&e[c]==-1;++c){e[c]=0}c==f&&++f;++e[c]}}g=new si(a.f,f,e);Sh(g);return g}
+function vo(a,b){uo();var c,d;if(b<=0||a.e==1&&a.b[0]==2){return true}if(!mi(a,0)){return false}if(a.e==1&&(a.b[0]&-1024)==0){return Bq(to,a.b[0])>=0}for(d=1;d<to.length;++d){if(cn(a.b,a.e,to[d])==0){return false}}c=sm(a);for(d=2;c<ro[d];++d){}b=d<1+(~~(b-1)>>1)?d:1+(~~(b-1)>>1);return wo(a,b)}
+function Qm(a,b){var c,d,e,f;c=a.bb();d=b.bb();e=c<d?c:d;vm(a,c);vm(b,d);if(Qh(a,b)==1){f=a;a=b;b=f}do{if(b.e==1||b.e==2&&b.b[1]>0){b=Ki(Rm(ai(a),ai(b)));break}if(b.e>a.e*1.2){b=hi(b,a);b.r()!=0&&vm(b,b.bb())}else{do{pn(b,a);vm(b,b.bb())}while(Qh(b,a)>=0)}f=b;b=a;a=f}while(f.f!=0);return b.eb(e)}
+function Sf(a,b,c){var d;if(!c){throw new jl}d=b-a.f;if(d==0){return a}if(d>0){if(d<hf.length&&a.b+jf[Bc(d)]<54){return new pg(a.g*hf[Bc(d)],b)}return new dg(mo((!a.d&&(a.d=Li(a.g)),a.d),Bc(d)),b)}if(a.b<54&&-d<hf.length){return vg(a.g,hf[Bc(-d)],b,c)}return ug((!a.d&&(a.d=Li(a.g)),a.d),po(-d),b,c)}
+function cl(a,b){var c,d,e,f;if(b==10||b<2||b>36){return Lr+Ke(a)}c=lc(Md,{6:1},-1,65,1);d=(nl(),ml);e=64;f=ue(b);if(we(a,ur)){while(we(a,f)){c[e--]=d[Je(ze(a,f))];a=ee(a,f,false)}c[e]=d[Je(a)]}else{while(ye(a,Be(f))){c[e--]=d[Je(Be(ze(a,f)))];a=ee(a,f,false)}c[e--]=d[Je(Be(a))];c[e]=45}return Gl(c,e,65)}
+function Of(a,b,c){var d,e,f,g,i,j;f=b<0?-b:b;g=c.b;e=Bc(fl(f))+1;i=c;if(b==0||a.b==0&&a.g!=-1&&b>0){return Nf(a,b)}if(f>999999999||g==0&&b<0||g>0&&e>g){throw new nk(bs)}g>0&&(i=new Xn(g+e+1,c.c));d=Qf(a,i);j=~~Zk(f)>>1;while(j>0){d=Lf(d,d,i);(f&j)==j&&(d=Lf(d,a,i));j>>=1}b<0&&(d=zf(lf,d,i));If(d,c);return d}
+function tf(a,b){var c;c=a.f-b.f;if(a.b==0&&a.g!=-1){if(c<=0){return b}if(b.b==0&&b.g!=-1){return a}}else if(b.b==0&&b.g!=-1){if(c>=0){return a}}if(c==0){if(gl(a.b,b.b)+1<54){return new pg(a.g+b.g,a.f)}return new og(fn((!a.d&&(a.d=Li(a.g)),a.d),(!b.d&&(b.d=Li(b.g)),b.d)),a.f)}else return c>0?rg(a,b,c):rg(b,a,-c)}
+function Nm(a,b){var c,d,e,f,g;d=qe(ue(b),yr);if(we(a,ur)){f=ee(a,d,false);g=ze(a,d)}else{c=Ge(a,1);e=ue(~~b>>>1);f=ee(c,e,false);g=ze(c,e);g=pe(Ee(g,1),qe(a,sr));if((b&1)!=0){if(!ve(f,g)){g=He(g,f)}else{if(ye(He(f,g),d)){g=pe(g,He(d,f));f=He(f,sr)}else{g=pe(g,He(Ee(d,1),f));f=He(f,vr)}}}}return De(Ee(g,32),qe(f,yr))}
+function Ei(a,b,c){var d,e,f,g,i,j,k,n,o,q,r,s,t,u;r=b.length;k=r;if(b.charCodeAt(0)==45){o=-1;q=1;--r}else{o=1;q=0}g=(Em(),Dm)[c];f=~~(r/g);u=r%g;u!=0&&++f;j=lc(Od,{6:1},-1,f,1);d=Cm[c-2];i=0;s=q+(u==0?g:u);for(t=q;t<k;t=s,s=s+g){e=af(b.substr(t,s-t),c);n=(go(),ko(j,j,i,d));n+=on(j,i,e);j[i++]=n}a.f=o;a.e=i;a.b=j;Sh(a)}
+function te(a){var b,c,d,e,f;if(isNaN(a)){return Qe(),Pe}if(a<-9223372036854775808){return Qe(),Ne}if(a>=9223372036854775807){return Qe(),Me}e=false;if(a<0){e=true;a=-a}d=0;if(a>=17592186044416){d=Bc(a/17592186044416);a-=d*17592186044416}c=0;if(a>=4194304){c=Bc(a/4194304);a-=c*4194304}b=Bc(a);f=de(b,c,d);e&&je(f);return f}
+function Ke(a){var b,c,d,e,f;if(a.l==0&&a.m==0&&a.h==0){return Tr}if(a.h==524288&&a.m==0&&a.l==0){return '-9223372036854775808'}if(~~a.h>>19!=0){return Ur+Ke(Be(a))}c=a;d=Lr;while(!(c.l==0&&c.m==0&&c.h==0)){e=ue(1000000000);c=ee(c,e,true);b=Lr+Je(ae);if(!(c.l==0&&c.m==0&&c.h==0)){f=9-b.length;for(;f>0;--f){b=Tr+b}}d=b+d}return d}
+function Uh(a,b){var c,d,e,f,g,i,j,k,n,o,q,r,s;f=b.f;if(f==0){throw new nk(ss)}e=b.e;d=b.b;if(e==1){return Lm(a,d[0],f)}q=a.b;r=a.e;c=r!=e?r>e?1:-1:jn(q,d,r);if(c<0){return mc(Xd,{6:1},17,[Nh,a])}s=a.f;i=r-e+1;j=s==f?1:-1;g=lc(Od,{6:1},-1,i,1);k=Km(g,i,q,r,d,e);n=new si(j,i,g);o=new si(s,e,k);Sh(n);Sh(o);return mc(Xd,{6:1},17,[n,o])}
+function Zf(a){var b;if(a.f==0||a.b==0&&a.g!=-1){return !a.d&&(a.d=Li(a.g)),a.d}else if(a.f<0){return ei((!a.d&&(a.d=Li(a.g)),a.d),po(-a.f))}else{if(a.f>(a.e>0?a.e:el((a.b-1)*0.3010299956639812)+1)||a.f>(!a.d&&(a.d=Li(a.g)),a.d).bb()){throw new nk(cs)}b=Uh((!a.d&&(a.d=Li(a.g)),a.d),po(a.f));if(b[1].r()!=0){throw new nk(cs)}return b[0]}}
+function qn(a,b,c,d,e){var f,g;f=ur;if(c<e){for(g=0;g<c;++g){f=pe(f,He(qe(ue(d[g]),yr),qe(ue(b[g]),yr)));a[g]=Je(f);f=Fe(f,32)}for(;g<e;++g){f=pe(f,qe(ue(d[g]),yr));a[g]=Je(f);f=Fe(f,32)}}else{for(g=0;g<e;++g){f=pe(f,He(qe(ue(d[g]),yr),qe(ue(b[g]),yr)));a[g]=Je(f);f=Fe(f,32)}for(;g<c;++g){f=He(f,qe(ue(b[g]),yr));a[g]=Je(f);f=Fe(f,32)}}}
+function Lm(a,b,c){var d,e,f,g,i,j,k,n,o,q,r,s;q=a.b;r=a.e;s=a.f;if(r==1){d=qe(ue(q[0]),yr);e=qe(ue(b),yr);f=ee(d,e,false);j=ze(d,e);s!=c&&(f=Be(f));s<0&&(j=Be(j));return mc(Xd,{6:1},17,[Ki(f),Ki(j)])}i=s==c?1:-1;g=lc(Od,{6:1},-1,r,1);k=mc(Od,{6:1},-1,[Mm(g,q,r,b)]);n=new si(i,r,g);o=new si(s,1,k);Sh(n);Sh(o);return mc(Xd,{6:1},17,[n,o])}
+function Zm(a,b,c){var d,e,f,g,i,j,k;i=b.b;j=b.e;k=ur;for(d=0;d<j;++d){e=ur;g=Je((go(),Ae(qe(ue(a[d]),yr),qe(ue(c),yr))));for(f=0;f<j;++f){e=pe(pe(Ae(qe(ue(g),yr),qe(ue(i[f]),yr)),qe(ue(a[d+f]),yr)),qe(ue(Je(e)),yr));a[d+f]=Je(e);e=Ge(e,32)}k=pe(k,pe(qe(ue(a[d+j]),yr),e));a[d+j]=Je(k);k=Ge(k,32)}a[j<<1]=Je(k);for(f=0;f<j+1;++f){a[f]=a[f+j]}}
+function af(a,b){var c,d,e,f;if(a==null){throw new pl(Mr)}if(b<2||b>36){throw new pl('radix '+b+' out of range')}d=a.length;e=d>0&&a.charCodeAt(0)==45?1:0;for(c=e;c<d;++c){if(tk(a.charCodeAt(c),b)==-1){throw new pl(Zr+a+$r)}}f=parseInt(a,b);if(isNaN(f)){throw new pl(Zr+a+$r)}else if(f<-2147483648||f>2147483647){throw new pl(Zr+a+$r)}return f}
+function En(a){var b,c;if(a.f==0){return Oh(),Ih}if(Vh(a,(Oh(),Ih))){return Nh}c=lc(Od,{6:1},-1,a.e+1,1);if(a.f>0){if(a.b[a.e-1]!=-1){for(b=0;a.b[b]==-1;++b){}}else{for(b=0;b<a.e&&a.b[b]==-1;++b){}if(b==a.e){c[b]=1;return new si(-a.f,b+1,c)}}}else{for(b=0;a.b[b]==0;++b){c[b]=-1}}c[b]=a.b[b]+a.f;for(++b;b<a.e;++b){c[b]=a.b[b]}return new si(-a.f,b,c)}
+function Bg(a,b,c){var d;d=0;switch(c.c){case 7:if(b!=0){throw new nk(cs)}break;case 0:d=b==0?0:b<0?-1:1;break;case 2:d=(b==0?0:b<0?-1:1)>0?b==0?0:b<0?-1:1:0;break;case 3:d=(b==0?0:b<0?-1:1)<0?b==0?0:b<0?-1:1:0;break;case 4:(b<0?-b:b)>=5&&(d=b==0?0:b<0?-1:1);break;case 5:(b<0?-b:b)>5&&(d=b==0?0:b<0?-1:1);break;case 6:(b<0?-b:b)+a>5&&(d=b==0?0:b<0?-1:1);}return d}
+function Vf(a,b,c){var d,e,f,g,i,j;i=te(hf[c]);g=He(te(a.f),ue(c));j=te(a.g);f=ee(j,i,false);e=ze(j,i);if(Ce(e,ur)){d=se(He(Ee(xe(e,ur)?Be(e):e,1),i),ur)?0:xe(He(Ee(xe(e,ur)?Be(e):e,1),i),ur)?-1:1;f=pe(f,ue(Bg(Je(f)&1,(se(e,ur)?0:xe(e,ur)?-1:1)*(5+d),b.c)));if(fl(Ie(xe(f,ur)?Be(f):f))>=b.b){f=re(f,tr);g=He(g,sr)}}a.f=Dg(Ie(g));a.e=b.b;a.g=Ie(f);a.b=tg(f);a.d=null}
+function tm(a,b){var c,d,e,f,g,i,j,k,n;k=a.f==0?1:a.f;g=~~b>>5;c=b&31;j=gl(g+1,a.e)+1;i=lc(Od,{6:1},-1,j,1);d=1<<c;nm(a.b,0,i,0,a.e);if(a.f<0){if(g>=a.e){i[g]=d}else{e=Zh(a);if(g>e){i[g]^=d}else if(g<e){i[g]=-d;for(f=g+1;f<e;++f){i[f]=-1}i[f]=i[f]--}else{f=g;i[g]=-(-i[g]^d);if(i[g]==0){for(++f;i[f]==-1;++f){i[f]=0}++i[f]}}}}else{i[g]^=d}n=new si(k,j,i);Sh(n);return n}
+function wo(a,b){var c,d,e,f,g,i,j,k,n;g=rn(a,(Oh(),Jh));c=g.ab();f=g.bb();i=g.fb(f);j=new Vq;for(d=0;d<b;++d){if(d<to.length){k=so[d]}else{do{k=new ni(c,j)}while(Qh(k,a)>=0||k.f==0||k.e==1&&k.b[0]==1)}n=di(k,i,a);if(n.e==1&&n.b[0]==1||n.eQ(g)){continue}for(e=1;e<f;++e){if(n.eQ(g)){continue}n=bi(ei(n,n),a);if(n.e==1&&n.b[0]==1){return false}}if(!n.eQ(g)){return false}}return true}
+function Mm(a,b,c,d){var e,f,g,i,j,k,n;k=ur;f=qe(ue(d),yr);for(i=c-1;i>=0;--i){n=De(Ee(k,32),qe(ue(b[i]),yr));if(we(n,ur)){j=ee(n,f,false);k=ze(n,f)}else{e=Ge(n,1);g=ue(~~d>>>1);j=ee(e,g,false);k=ze(e,g);k=pe(Ee(k,1),qe(n,sr));if((d&1)!=0){if(!ve(j,k)){k=He(k,j)}else{if(ye(He(j,k),f)){k=pe(k,He(f,j));j=He(j,sr)}else{k=pe(k,He(Ee(f,1),j));j=He(j,vr)}}}}a[i]=Je(qe(j,yr))}return Je(k)}
+function he(a,b,c,d,e,f){var g,i,j,k,n,o,q;k=ke(b)-ke(a);g=Ee(b,k);j=de(0,0,0);while(k>=0){i=ne(a,g);if(i){k<22?(j.l|=1<<k,undefined):k<44?(j.m|=1<<k-22,undefined):(j.h|=1<<k-44,undefined);if(a.l==0&&a.m==0&&a.h==0){break}}o=g.m;q=g.h;n=g.l;g.h=~~q>>>1;g.m=~~o>>>1|(q&1)<<21;g.l=~~n>>>1|(o&1)<<21;--k}c&&je(j);if(f){if(d){ae=Be(a);e&&(ae=He(ae,(Qe(),Oe)))}else{ae=de(a.l,a.m,a.h)}}return j}
+function dn(a,b,c,d,e){var f,g,i,j,k,n,o;k=lc(Xd,{6:1},17,8,0);n=a;nc(k,0,b);o=Ym(b,b,d,e);for(g=1;g<=7;++g){nc(k,g,Ym(k[g-1],o,d,e))}for(g=c.ab()-1;g>=0;--g){if((c.b[~~g>>5]&1<<(g&31))!=0){j=1;f=g;for(i=g-3>0?g-3:0;i<=g-1;++i){if((c.b[~~i>>5]&1<<(i&31))!=0){if(i<f){f=i;j=j<<g-i^1}else{j=j^1<<i-f}}}for(i=f;i<=g;++i){n=Ym(n,n,d,e)}n=Ym(k[~~(j-1)>>1],n,d,e);g=f}else{n=Ym(n,n,d,e)}}return n}
+function Ln(a,b){var c,d,e,f,g,i,j;i=gl(a.e,b.e);g=lc(Od,{6:1},-1,i,1);e=Zh(a);d=Zh(b);c=d;if(e==d){g[d]=-a.b[d]^-b.b[d]}else{g[d]=-b.b[d];f=hl(b.e,e);for(++c;c<f;++c){g[c]=~b.b[c]}if(c==b.e){for(;c<e;++c){g[c]=-1}g[c]=a.b[c]-1}else{g[c]=-a.b[c]^~b.b[c]}}f=hl(a.e,b.e);for(++c;c<f;++c){g[c]=a.b[c]^b.b[c]}for(;c<a.e;++c){g[c]=a.b[c]}for(;c<b.e;++c){g[c]=b.b[c]}j=new si(1,i,g);Sh(j);return j}
+function qo(a,b,c){var d,e,f,g;for(e=0;e<b;++e){d=ur;for(g=e+1;g<b;++g){d=pe(pe(Ae(qe(ue(a[e]),yr),qe(ue(a[g]),yr)),qe(ue(c[e+g]),yr)),qe(ue(Je(d)),yr));c[e+g]=Je(d);d=Ge(d,32)}c[e+b]=Je(d)}ym(c,c,b<<1);d=ur;for(e=0,f=0;e<b;++e,++f){d=pe(pe(Ae(qe(ue(a[e]),yr),qe(ue(a[e]),yr)),qe(ue(c[f]),yr)),qe(ue(Je(d)),yr));c[f]=Je(d);d=Ge(d,32);++f;d=pe(d,qe(ue(c[f]),yr));c[f]=Je(d);d=Ge(d,32)}return c}
+function vf(a,b){var c,d,e,f,g,i;e=Uf(a);i=Uf(b);if(e==i){if(a.f==b.f&&a.b<54&&b.b<54){return a.g<b.g?-1:a.g>b.g?1:0}d=a.f-b.f;c=(a.e>0?a.e:el((a.b-1)*0.3010299956639812)+1)-(b.e>0?b.e:el((b.b-1)*0.3010299956639812)+1);if(c>d+1){return e}else if(c<d-1){return -e}else{f=(!a.d&&(a.d=Li(a.g)),a.d);g=(!b.d&&(b.d=Li(b.g)),b.d);d<0?(f=ei(f,po(-d))):d>0&&(g=ei(g,po(d)));return Qh(f,g)}}else return e<i?-1:1}
+function If(a,b){var c,d,e,f,g,i,j;f=b.b;if((a.e>0?a.e:el((a.b-1)*0.3010299956639812)+1)-f<0||f==0){return}d=a.q()-f;if(d<=0){return}if(a.b<54){Vf(a,b,d);return}i=po(d);e=Uh((!a.d&&(a.d=Li(a.g)),a.d),i);g=a.f-d;if(e[1].r()!=0){c=Qh(ki(e[1]._()),i);c=Bg(e[0].gb(0)?1:0,e[1].r()*(5+c),b.c);c!=0&&nc(e,0,fn(e[0],Ki(ue(c))));j=new cg(e[0]);if(j.q()>f){nc(e,0,Th(e[0],(Oh(),Lh)));--g}}a.f=Dg(g);a.e=f;Tf(a,e[0])}
+function Yf(a,b,c){var d,e,f,g;d=b.f-a.f;if(b.b==0&&b.g!=-1||a.b==0&&a.g!=-1||c.b==0){return Qf(Xf(a,b),c)}if((b.e>0?b.e:el((b.b-1)*0.3010299956639812)+1)<d-1){if(c.b<(a.e>0?a.e:el((a.b-1)*0.3010299956639812)+1)){g=Uf(a);if(g!=b.r()){f=fn(lo((!a.d&&(a.d=Li(a.g)),a.d),10),Ki(ue(g)))}else{f=rn((!a.d&&(a.d=Li(a.g)),a.d),Ki(ue(g)));f=fn(lo(f,10),Ki(ue(g*9)))}e=new og(f,a.f+1);return Qf(e,c)}}return Qf(Xf(a,b),c)}
+function rn(a,b){var c,d,e,f,g,i,j,k,n,o;g=a.f;j=b.f;if(j==0){return a}if(g==0){return b.cb()}f=a.e;i=b.e;if(f+i==2){c=qe(ue(a.b[0]),yr);d=qe(ue(b.b[0]),yr);g<0&&(c=Be(c));j<0&&(d=Be(d));return Ki(He(c,d))}e=f!=i?f>i?1:-1:jn(a.b,b.b,f);if(e==-1){o=-j;n=g==j?sn(b.b,i,a.b,f):gn(b.b,i,a.b,f)}else{o=g;if(g==j){if(e==0){return Oh(),Nh}n=sn(a.b,f,b.b,i)}else{n=gn(a.b,f,b.b,i)}}k=new si(o,n.length,n);Sh(k);return k}
+function zn(a,b){var c,d,e,f,g,i,j;e=Zh(a);d=Zh(b);if(e>=b.e){return Oh(),Nh}i=b.e;g=lc(Od,{6:1},-1,i,1);c=e;if(e<d){g[e]=-a.b[e];f=hl(a.e,d);for(++c;c<f;++c){g[c]=~a.b[c]}if(c==a.e){for(;c<d;++c){g[c]=-1}g[c]=b.b[c]-1}else{g[c]=~a.b[c]&b.b[c]-1}}else d<e?(g[e]=-a.b[e]&b.b[e]):(g[e]=-a.b[e]&b.b[e]-1);f=hl(a.e,b.e);for(++c;c<f;++c){g[c]=~a.b[c]&b.b[c]}for(;c<b.e;++c){g[c]=b.b[c]}j=new si(1,i,g);Sh(j);return j}
+function Th(a,b){var c,d,e,f,g,i,j,k,n,o;if(b.f==0){throw new nk(ss)}e=b.f;if(b.e==1&&b.b[0]==1){return b.f>0?a:a.cb()}n=a.f;k=a.e;d=b.e;if(k+d==2){o=re(qe(ue(a.b[0]),yr),qe(ue(b.b[0]),yr));n!=e&&(o=Be(o));return Ki(o)}c=k!=d?k>d?1:-1:jn(a.b,b.b,k);if(c==0){return n==e?Jh:Ih}if(c==-1){return Nh}g=k-d+1;f=lc(Od,{6:1},-1,g,1);i=n==e?1:-1;d==1?Mm(f,a.b,k,b.b[0]):Km(f,g,a.b,k,b.b,d);j=new si(i,g,f);Sh(j);return j}
+function hn(a,b,c,d,e){var f,g;f=pe(qe(ue(b[0]),yr),qe(ue(d[0]),yr));a[0]=Je(f);f=Fe(f,32);if(c>=e){for(g=1;g<e;++g){f=pe(f,pe(qe(ue(b[g]),yr),qe(ue(d[g]),yr)));a[g]=Je(f);f=Fe(f,32)}for(;g<c;++g){f=pe(f,qe(ue(b[g]),yr));a[g]=Je(f);f=Fe(f,32)}}else{for(g=1;g<c;++g){f=pe(f,pe(qe(ue(b[g]),yr),qe(ue(d[g]),yr)));a[g]=Je(f);f=Fe(f,32)}for(;g<e;++g){f=pe(f,qe(ue(d[g]),yr));a[g]=Je(f);f=Fe(f,32)}}Ce(f,ur)&&(a[g]=Je(f))}
+function go(){go=rr;var a,b;bo=lc(Xd,{6:1},17,32,0);co=lc(Xd,{6:1},17,32,0);eo=mc(Od,{6:1},-1,[1,5,25,125,625,3125,15625,78125,390625,1953125,9765625,48828125,244140625,1220703125]);fo=mc(Od,{6:1},-1,[1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000]);a=sr;for(b=0;b<=18;++b){nc(bo,b,Ki(a));nc(co,b,Ki(Ee(a,b)));a=Ae(a,Hr)}for(;b<co.length;++b){nc(bo,b,ei(bo[b-1],bo[1]));nc(co,b,ei(co[b-1],(Oh(),Lh)))}}
+function yf(a,b,c,d){var e,f,g;if(!d){throw new jl}if(b.b==0&&b.g!=-1){throw new nk(_r)}e=a.f-b.f-c;if(a.b<54&&b.b<54){if(e==0){return vg(a.g,b.g,c,d)}else if(e>0){if(e<hf.length&&b.b+jf[Bc(e)]<54){return vg(a.g,b.g*hf[Bc(e)],c,d)}}else{if(-e<hf.length&&a.b+jf[Bc(-e)]<54){return vg(a.g*hf[Bc(-e)],b.g,c,d)}}}f=(!a.d&&(a.d=Li(a.g)),a.d);g=(!b.d&&(b.d=Li(b.g)),b.d);e>0?(g=mo(g,Bc(e))):e<0&&(f=mo(f,Bc(-e)));return ug(f,g,c,d)}
+function Gn(a,b){var c,d,e,f,g,i,j;d=Zh(b);e=Zh(a);if(e>=b.e){return b}i=b.e;g=lc(Od,{6:1},-1,i,1);if(d<e){for(c=d;c<e;++c){g[c]=b.b[c]}}else if(e<d){c=e;g[e]=-a.b[e];f=hl(a.e,d);for(++c;c<f;++c){g[c]=~a.b[c]}if(c!=a.e){g[c]=~(-b.b[c]|a.b[c])}else{for(;c<d;++c){g[c]=-1}g[c]=b.b[c]-1}++c}else{c=e;g[e]=-(-b.b[e]|a.b[e]);++c}f=hl(b.e,a.e);for(;c<f;++c){g[c]=b.b[c]&~a.b[c]}for(;c<b.e;++c){g[c]=b.b[c]}j=new si(-1,i,g);Sh(j);return j}
+function _f(a){var b,c,d,e;d=Hm((!a.d&&(a.d=Li(a.g)),a.d),0);if(a.f==0||a.b==0&&a.g!=-1&&a.f<0){return d}b=Uf(a)<0?1:0;c=a.f;e=new gm(d.length+1+dl(Bc(a.f)));b==1&&(e.b.b+=Ur,e);if(a.f>0){c-=d.length-b;if(c>=0){e.b.b+=es;for(;c>ef.length;c-=ef.length){$l(e,ef)}_l(e,ef,Bc(c));dm(e,Al(d,b))}else{c=b-c;dm(e,Bl(d,b,Bc(c)));e.b.b+=ds;dm(e,Al(d,Bc(c)))}}else{dm(e,Al(d,b));for(;c<-ef.length;c+=ef.length){$l(e,ef)}_l(e,ef,Bc(-c))}return e.b.b}
+function ug(a,b,c,d){var e,f,g,i,j,k,n;g=Uh(a,b);i=g[0];k=g[1];if(k.r()==0){return new dg(i,c)}n=a.r()*b.r();if(b.ab()<54){j=ai(k);f=ai(b);e=se(He(Ee(xe(j,ur)?Be(j):j,1),xe(f,ur)?Be(f):f),ur)?0:xe(He(Ee(xe(j,ur)?Be(j):j,1),xe(f,ur)?Be(f):f),ur)?-1:1;e=Bg(i.gb(0)?1:0,n*(5+e),d)}else{e=Qh(ki(k._()),b._());e=Bg(i.gb(0)?1:0,n*(5+e),d)}if(e!=0){if(i.ab()<54){return Hg(pe(ai(i),ue(e)),c)}i=fn(i,Ki(ue(e)));return new dg(i,c)}return new dg(i,c)}
+function ag(a){var b,c,d,e,f;if(a.i!=null){return a.i}if(a.b<32){a.i=Im(te(a.g),Bc(a.f));return a.i}e=Hm((!a.d&&(a.d=Li(a.g)),a.d),0);if(a.f==0){return e}b=(!a.d&&(a.d=Li(a.g)),a.d).r()<0?2:1;c=e.length;d=-a.f+c-b;f=new fm;cc(f.b,e);if(a.f>0&&d>=-6){if(d>=0){em(f,c-Bc(a.f),ds)}else{ec(f.b,b-1,b-1,es);em(f,b+1,Ll(ef,0,-Bc(d)-1))}}else{if(c-b>=1){ec(f.b,b,b,ds);++c}ec(f.b,c,c,fs);d>0&&em(f,++c,gs);em(f,++c,Lr+Ke(te(d)))}a.i=f.b.b;return a.i}
+function xn(a,b){var c,d,e,f,g,i,j;e=Zh(a);f=Zh(b);if(e>=b.e){return a}d=f>e?f:e;f>e?(c=-b.b[d]&~a.b[d]):f<e?(c=~b.b[d]&-a.b[d]):(c=-b.b[d]&-a.b[d]);if(c==0){for(++d;d<b.e&&(c=~(a.b[d]|b.b[d]))==0;++d){}if(c==0){for(;d<a.e&&(c=~a.b[d])==0;++d){}if(c==0){i=a.e+1;g=lc(Od,{6:1},-1,i,1);g[i-1]=1;j=new si(-1,i,g);return j}}}i=a.e;g=lc(Od,{6:1},-1,i,1);g[d]=-c;for(++d;d<b.e;++d){g[d]=a.b[d]|b.b[d]}for(;d<a.e;++d){g[d]=a.b[d]}j=new si(-1,i,g);return j}
+function zl(o,a,b){var c=new RegExp(a,'g');var d=[];var e=0;var f=o;var g=null;while(true){var i=c.exec(f);if(i==null||f==Lr||e==b-1&&b>0){d[e]=f;break}else{d[e]=f.substring(0,i.index);f=f.substring(i.index+i[0].length,f.length);c.lastIndex=0;if(g==f){d[e]=f.substring(0,1);f=f.substring(1)}g=f;e++}}if(b==0&&o.length>0){var j=d.length;while(j>0&&d[j-1]==Lr){--j}j<d.length&&d.splice(j,d.length-j)}var k=Fl(d.length);for(var n=0;n<d.length;++n){k[n]=d[n]}return k}
+function po(a){go();var b,c,d,e;b=Bc(a);if(a<co.length){return co[b]}else if(a<=50){return (Oh(),Lh).db(b)}else if(a<=1000){return bo[1].db(b).eb(b)}if(a>1000000){throw new nk('power of ten too big')}if(a<=2147483647){return bo[1].db(b).eb(b)}d=bo[1].db(2147483647);e=d;c=te(a-2147483647);b=Bc(a%2147483647);while(ve(c,Ir)){e=ei(e,d);c=He(c,Ir)}e=ei(e,bo[1].db(b));e=e.eb(2147483647);c=te(a-2147483647);while(ve(c,Ir)){e=e.eb(2147483647);c=He(c,Ir)}e=e.eb(b);return e}
+function $d(){var a;!!$stats&&Ue('com.iriscouch.gwtapp.client.BigDecimalApp');ik(new kk);Wj(new Yj);Gj(new Ij);Ch(new Eh);!!$stats&&Ue('com.google.gwt.user.client.UserAgentAsserter');a=We();wl(Sr,a)||($wnd.alert('ERROR: Possible problem with your *.gwt.xml module file.\nThe compile time user.agent value (safari) does not match the runtime user.agent value ('+a+'). Expect more errors.\n'),undefined);!!$stats&&Ue('com.google.gwt.user.client.DocumentModeAsserter');Ve()}
+function Vo(a){Qo();var b,c,d,e,f;if(a==null){throw new jl}d=Cl(a);c=d.length;if(c<Po.length||c>Oo.length){throw new Rk}f=null;e=null;if(d[0]==67){e=Ao;f=Io}else if(d[0]==68){e=Bo;f=Jo}else if(d[0]==70){e=Co;f=Ko}else if(d[0]==72){if(c>6){if(d[5]==68){e=Do;f=Lo}else if(d[5]==69){e=Eo;f=Mo}else if(d[5]==85){e=Fo;f=No}}}else if(d[0]==85){if(d[1]==80){e=Ho;f=Po}else if(d[1]==78){e=Go;f=Oo}}if(!!e&&c==f.length){for(b=1;b<c&&d[b]==f[b];++b){}if(b==c){return e}}throw new Rk}
+function ni(a,b){var d,e,f,g,i,j;Oh();var c;if(a<0){throw new Sk('numBits must be non-negative')}if(a==0){this.f=0;this.e=1;this.b=mc(Od,{6:1},-1,[0])}else{this.f=1;this.e=~~(a+31)>>5;this.b=lc(Od,{6:1},-1,this.e,1);for(c=0;c<this.e;++c){this.b[c]=Bc((g=b.b*15525485+b.c*1502,j=b.c*15525485+11,d=Math.floor(j*5.9604644775390625E-8),g+=d,j-=d*16777216,g%=16777216,b.b=g,b.c=j,f=b.b*256,i=el(b.c*Sq[32]),e=f+i,e>=2147483648&&(e-=4294967296),e))}this.b[this.e-1]>>>=-a&31;Sh(this)}}
+function fn(a,b){var c,d,e,f,g,i,j,k,n,o,q,r;g=a.f;j=b.f;if(g==0){return b}if(j==0){return a}f=a.e;i=b.e;if(f+i==2){c=qe(ue(a.b[0]),yr);d=qe(ue(b.b[0]),yr);if(g==j){k=pe(c,d);r=Je(k);q=Je(Ge(k,32));return q==0?new qi(g,r):new si(g,2,mc(Od,{6:1},-1,[r,q]))}return Ki(g<0?He(d,c):He(c,d))}else if(g==j){o=g;n=f>=i?gn(a.b,f,b.b,i):gn(b.b,i,a.b,f)}else{e=f!=i?f>i?1:-1:jn(a.b,b.b,f);if(e==0){return Oh(),Nh}if(e==1){o=g;n=sn(a.b,f,b.b,i)}else{o=j;n=sn(b.b,i,a.b,f)}}k=new si(o,n.length,n);Sh(k);return k}
+function Yn(a){Un();var b,c,d,e;if(a==null){throw new kl('null string')}b=Cl(a);if(b.length<27||b.length>45){throw new Sk(Hs)}for(d=0;d<Sn.length&&b[d]==Sn[d];++d){}if(d<Sn.length){throw new Sk(Hs)}c=tk(b[d],10);if(c==-1){throw new Sk(Hs)}this.b=this.b*10+c;++d;do{c=tk(b[d],10);if(c==-1){if(b[d]==32){++d;break}throw new Sk(Hs)}this.b=this.b*10+c;if(this.b<0){throw new Sk(Hs)}++d}while(true);for(e=0;e<Tn.length&&b[d]==Tn[e];++d,++e){}if(e<Tn.length){throw new Sk(Hs)}this.c=Vo(Ll(b,d,b.length-d))}
+function Em(){Em=rr;Cm=mc(Od,{6:1},-1,[-2147483648,1162261467,1073741824,1220703125,362797056,1977326743,1073741824,387420489,1000000000,214358881,429981696,815730721,1475789056,170859375,268435456,410338673,612220032,893871739,1280000000,1801088541,113379904,148035889,191102976,244140625,308915776,387420489,481890304,594823321,729000000,887503681,1073741824,1291467969,1544804416,1838265625,60466176]);Dm=mc(Od,{6:1},-1,[-1,-1,31,19,15,13,11,11,10,9,9,8,8,8,8,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5])}
+function uf(a,b,c){var d,e,f,g,i;d=a.f-b.f;if(b.b==0&&b.g!=-1||a.b==0&&a.g!=-1||c.b==0){return Qf(tf(a,b),c)}if((a.e>0?a.e:el((a.b-1)*0.3010299956639812)+1)<d-1){e=b;g=a}else if((b.e>0?b.e:el((b.b-1)*0.3010299956639812)+1)<-d-1){e=a;g=b}else{return Qf(tf(a,b),c)}if(c.b>=(e.e>0?e.e:el((e.b-1)*0.3010299956639812)+1)){return Qf(tf(a,b),c)}f=e.r();if(f==g.r()){i=fn(lo((!e.d&&(e.d=Li(e.g)),e.d),10),Ki(ue(f)))}else{i=rn((!e.d&&(e.d=Li(e.g)),e.d),Ki(ue(f)));i=fn(lo(i,10),Ki(ue(f*9)))}e=new og(i,e.f+1);return Qf(e,c)}
+function $f(a){var b,c,d,e,f,g,i,j;g=Hm((!a.d&&(a.d=Li(a.g)),a.d),0);if(a.f==0){return g}b=(!a.d&&(a.d=Li(a.g)),a.d).r()<0?2:1;d=g.length;e=-a.f+d-b;j=new hm(g);if(a.f>0&&e>=-6){if(e>=0){em(j,d-Bc(a.f),ds)}else{ec(j.b,b-1,b-1,es);em(j,b+1,Ll(ef,0,-Bc(e)-1))}}else{c=d-b;i=Bc(e%3);if(i!=0){if((!a.d&&(a.d=Li(a.g)),a.d).r()==0){i=i<0?-i:3-i;e+=i}else{i=i<0?i+3:i;e-=i;b+=i}if(c<3){for(f=i-c;f>0;--f){em(j,d++,Tr)}}}if(d-b>=1){ec(j.b,b,b,ds);++d}if(e!=0){ec(j.b,d,d,fs);e>0&&em(j,++d,gs);em(j,++d,Lr+Ke(te(e)))}}return j.b.b}
+function nm(a,b,c,d,e){var f,g,i,j,k,n,o,q,r;if(a==null||c==null){throw new jl}q=a.gC();j=c.gC();if((q.c&4)==0||(j.c&4)==0){throw new rk('Must be array types')}o=q.b;g=j.b;if(!((o.c&1)!=0?o==g:(g.c&1)==0)){throw new rk('Array types must match')}r=a.length;k=c.length;if(b<0||d<0||e<0||b+e>r||d+e>k){throw new Vk}if(((o.c&1)==0||(o.c&4)!=0)&&q!=j){n=vc(a,11);f=vc(c,11);if(Ac(a)===Ac(c)&&b<d){b+=e;for(i=d+e;i-->d;){nc(f,i,n[--b])}}else{for(i=d+e;d<i;){nc(f,d++,n[b++])}}}else{Array.prototype.splice.apply(c,[d,e].concat(a.slice(b,b+e)))}}
+function xo(a){uo();var b,c,d,e,f,g,i;f=lc(Od,{6:1},-1,to.length,1);d=lc(Zd,{6:1},-1,1024,2);if(a.e==1&&a.b[0]>=0&&a.b[0]<to[to.length-1]){for(c=0;a.b[0]>=to[c];++c){}return so[c]}i=new si(1,a.e,lc(Od,{6:1},-1,a.e+1,1));nm(a.b,0,i.b,0,a.e);mi(a,0)?nn(i,2):(i.b[0]|=1);e=i.ab();for(b=2;e<ro[b];++b){}for(c=0;c<to.length;++c){f[c]=bn(i,to[c])-1024}while(true){Cq(d,d.length);for(c=0;c<to.length;++c){f[c]=(f[c]+1024)%to[c];e=f[c]==0?0:to[c]-f[c];for(;e<1024;e+=to[c]){d[e]=true}}for(e=0;e<1024;++e){if(!d[e]){g=Rh(i);nn(g,e);if(wo(g,b)){return g}}}nn(i,1024)}}
+function Qo(){Qo=rr;Ho=new Ro('UP',0);Bo=new Ro('DOWN',1);Ao=new Ro('CEILING',2);Co=new Ro('FLOOR',3);Fo=new Ro('HALF_UP',4);Do=new Ro('HALF_DOWN',5);Eo=new Ro('HALF_EVEN',6);Go=new Ro('UNNECESSARY',7);zo=mc(Yd,{6:1},19,[Ho,Bo,Ao,Co,Fo,Do,Eo,Go]);Io=mc(Md,{6:1},-1,[67,69,73,76,73,78,71]);Jo=mc(Md,{6:1},-1,[68,79,87,78]);Ko=mc(Md,{6:1},-1,[70,76,79,79,82]);Lo=mc(Md,{6:1},-1,[72,65,76,70,95,68,79,87,78]);Mo=mc(Md,{6:1},-1,[72,65,76,70,95,69,86,69,78]);No=mc(Md,{6:1},-1,[72,65,76,70,95,85,80]);Oo=mc(Md,{6:1},-1,[85,78,78,69,67,69,83,83,65,82,89]);Po=mc(Md,{6:1},-1,[85,80])}
+function wf(a,b){var c,d,e,f,g,i,j,k,n,o;k=(!a.d&&(a.d=Li(a.g)),a.d);n=(!b.d&&(b.d=Li(b.g)),b.d);c=a.f-b.f;g=0;e=1;i=kf.length-1;if(b.b==0&&b.g!=-1){throw new nk(_r)}if(k.r()==0){return Ig(c)}d=Yh(k,n);k=Th(k,d);n=Th(n,d);f=n.bb();n=n.fb(f);do{o=Uh(n,kf[e]);if(o[1].r()==0){g+=e;e<i&&++e;n=o[0]}else{if(e==1){break}e=1}}while(true);if(!n._().eQ((Oh(),Jh))){throw new nk('Non-terminating decimal expansion; no exact representable decimal result')}n.r()<0&&(k=k.cb());j=Dg(c+(f>g?f:g));e=f-g;k=e>0?(go(),e<eo.length?lo(k,eo[e]):e<bo.length?ei(k,bo[e]):ei(k,bo[1].db(e))):k.eb(-e);return new dg(k,j)}
+function ee(a,b,c){var d,e,f,g,i,j;if(b.l==0&&b.m==0&&b.h==0){throw new nk('divide by zero')}if(a.l==0&&a.m==0&&a.h==0){c&&(ae=de(0,0,0));return de(0,0,0)}if(b.h==524288&&b.m==0&&b.l==0){return fe(a,c)}j=false;if(~~b.h>>19!=0){b=Be(b);j=true}g=le(b);f=false;e=false;d=false;if(a.h==524288&&a.m==0&&a.l==0){e=true;f=true;if(g==-1){a=ce((Qe(),Me));d=true;j=!j}else{i=Fe(a,g);j&&je(i);c&&(ae=de(0,0,0));return i}}else if(~~a.h>>19!=0){f=true;a=Be(a);d=true;j=!j}if(g!=-1){return ge(a,g,j,f,c)}if(!we(a,b)){c&&(f?(ae=Be(a)):(ae=de(a.l,a.m,a.h)));return de(0,0,0)}return he(d?a:de(a.l,a.m,a.h),b,j,f,e,c)}
+function An(a,b){var c,d,e,f,g,i,j,k;e=Zh(a);f=Zh(b);if(e>=b.e){return a}j=gl(a.e,b.e);d=e;if(f>e){i=lc(Od,{6:1},-1,j,1);g=hl(a.e,f);for(;d<g;++d){i[d]=a.b[d]}if(d==a.e){for(d=f;d<b.e;++d){i[d]=b.b[d]}}}else{c=-a.b[e]&~b.b[e];if(c==0){g=hl(b.e,a.e);for(++d;d<g&&(c=~(a.b[d]|b.b[d]))==0;++d){}if(c==0){for(;d<b.e&&(c=~b.b[d])==0;++d){}for(;d<a.e&&(c=~a.b[d])==0;++d){}if(c==0){++j;i=lc(Od,{6:1},-1,j,1);i[j-1]=1;k=new si(-1,j,i);return k}}}i=lc(Od,{6:1},-1,j,1);i[d]=-c;++d}g=hl(b.e,a.e);for(;d<g;++d){i[d]=a.b[d]|b.b[d]}for(;d<a.e;++d){i[d]=a.b[d]}for(;d<b.e;++d){i[d]=b.b[d]}k=new si(-1,j,i);return k}
+function Lj(a){var b=[];for(var c in a){var d=typeof a[c];d!=ws?(b[b.length]=d):a[c] instanceof Array?(b[b.length]=js):$wnd&&$wnd.bigdecimal&&$wnd.bigdecimal.BigInteger&&a[c] instanceof $wnd.bigdecimal.BigInteger?(b[b.length]=is):$wnd&&$wnd.bigdecimal&&$wnd.bigdecimal.BigDecimal&&a[c] instanceof $wnd.bigdecimal.BigDecimal?(b[b.length]=ps):$wnd&&$wnd.bigdecimal&&$wnd.bigdecimal.RoundingMode&&a[c] instanceof $wnd.bigdecimal.RoundingMode?(b[b.length]=xs):$wnd&&$wnd.bigdecimal&&$wnd.bigdecimal.MathContext&&a[c] instanceof $wnd.bigdecimal.MathContext?(b[b.length]=os):(b[b.length]=ws)}return b.join(ys)}
+function Ae(a,b){var c,d,e,f,g,i,j,k,n,o,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G;c=a.l&8191;d=~~a.l>>13|(a.m&15)<<9;e=~~a.m>>4&8191;f=~~a.m>>17|(a.h&255)<<5;g=~~(a.h&1048320)>>8;i=b.l&8191;j=~~b.l>>13|(b.m&15)<<9;k=~~b.m>>4&8191;n=~~b.m>>17|(b.h&255)<<5;o=~~(b.h&1048320)>>8;C=c*i;D=d*i;E=e*i;F=f*i;G=g*i;if(j!=0){D+=c*j;E+=d*j;F+=e*j;G+=f*j}if(k!=0){E+=c*k;F+=d*k;G+=e*k}if(n!=0){F+=c*n;G+=d*n}o!=0&&(G+=c*o);r=C&4194303;s=(D&511)<<13;q=r+s;u=~~C>>22;v=~~D>>9;w=(E&262143)<<4;x=(F&31)<<17;t=u+v+w+x;z=~~E>>18;A=~~F>>5;B=(G&4095)<<8;y=z+A+B;t+=~~q>>22;q&=4194303;y+=~~t>>22;t&=4194303;y&=1048575;return de(q,t,y)}
+function zf(a,b,c){var d,e,f,g,i,j,k,n;n=Ie(pe(ue(c.b),vr))+(b.e>0?b.e:el((b.b-1)*0.3010299956639812)+1)-(a.e>0?a.e:el((a.b-1)*0.3010299956639812)+1);e=a.f-b.f;j=e;f=1;i=nf.length-1;k=mc(Xd,{6:1},17,[(!a.d&&(a.d=Li(a.g)),a.d)]);if(c.b==0||a.b==0&&a.g!=-1||b.b==0&&b.g!=-1){return wf(a,b)}if(n>0){nc(k,0,ei((!a.d&&(a.d=Li(a.g)),a.d),po(n)));j+=n}k=Uh(k[0],(!b.d&&(b.d=Li(b.g)),b.d));g=k[0];if(k[1].r()!=0){d=Qh(ki(k[1]),(!b.d&&(b.d=Li(b.g)),b.d));g=fn(ei(g,(Oh(),Lh)),Ki(ue(k[0].r()*(5+d))));++j}else{while(!g.gb(0)){k=Uh(g,nf[f]);if(k[1].r()==0&&j-f>=e){j-=f;f<i&&++f;g=k[0]}else{if(f==1){break}f=1}}}return new eg(g,Dg(j),c)}
+function Wm(a,b){var c,d,e,f,g,i,j,k,n,o,q;if(a.f==0){throw new nk(vs)}if(!b.gb(0)){return Vm(a,b)}f=b.e*32;o=Rh(b);q=Rh(a);g=gl(q.e,o.e);j=new si(1,1,lc(Od,{6:1},-1,g+1,1));k=new si(1,1,lc(Od,{6:1},-1,g+1,1));k.b[0]=1;c=0;d=o.bb();e=q.bb();if(d>e){vm(o,d);vm(q,e);um(j,e);c+=d-e}else{vm(o,d);vm(q,e);um(k,d);c+=e-d}j.f=1;while(q.r()>0){while(Qh(o,q)>0){pn(o,q);n=o.bb();vm(o,n);mn(j,k);um(k,n);c+=n}while(Qh(o,q)<=0){pn(q,o);if(q.r()==0){break}n=q.bb();vm(q,n);mn(k,j);um(j,n);c+=n}}if(!(o.e==1&&o.b[0]==1)){throw new nk(vs)}Qh(j,b)>=0&&pn(j,b);j=rn(b,j);i=Jm(b);if(c>f){j=Ym(j,(Oh(),Jh),b,i);c=c-f}j=Ym(j,Ai(f-c),b,i);return j}
+function Xf(a,b){var c;c=a.f-b.f;if(a.b==0&&a.g!=-1){if(c<=0){return Mf(b)}if(b.b==0&&b.g!=-1){return a}}else if(b.b==0&&b.g!=-1){if(c>=0){return a}}if(c==0){if(gl(a.b,b.b)+1<54){return new pg(a.g-b.g,a.f)}return new og(rn((!a.d&&(a.d=Li(a.g)),a.d),(!b.d&&(b.d=Li(b.g)),b.d)),a.f)}else if(c>0){if(c<hf.length&&gl(a.b,b.b+jf[Bc(c)])+1<54){return new pg(a.g-b.g*hf[Bc(c)],a.f)}return new og(rn((!a.d&&(a.d=Li(a.g)),a.d),mo((!b.d&&(b.d=Li(b.g)),b.d),Bc(c))),a.f)}else{c=-c;if(c<hf.length&&gl(a.b+jf[Bc(c)],b.b)+1<54){return new pg(a.g*hf[Bc(c)]-b.g,b.f)}return new og(rn(mo((!a.d&&(a.d=Li(a.g)),a.d),Bc(c)),(!b.d&&(b.d=Li(b.g)),b.d)),b.f)}}
+function Df(a,b){var c,d,e,f,g,i,j;mc(Xd,{6:1},17,[(!a.d&&(a.d=Li(a.g)),a.d)]);f=a.f-b.f;j=0;c=1;e=nf.length-1;if(b.b==0&&b.g!=-1){throw new nk(_r)}if((b.e>0?b.e:el((b.b-1)*0.3010299956639812)+1)+f>(a.e>0?a.e:el((a.b-1)*0.3010299956639812)+1)+1||a.b==0&&a.g!=-1){d=(Oh(),Nh)}else if(f==0){d=Th((!a.d&&(a.d=Li(a.g)),a.d),(!b.d&&(b.d=Li(b.g)),b.d))}else if(f>0){g=po(f);d=Th((!a.d&&(a.d=Li(a.g)),a.d),ei((!b.d&&(b.d=Li(b.g)),b.d),g));d=ei(d,g)}else{g=po(-f);d=Th(ei((!a.d&&(a.d=Li(a.g)),a.d),g),(!b.d&&(b.d=Li(b.g)),b.d));while(!d.gb(0)){i=Uh(d,nf[c]);if(i[1].r()==0&&j-c>=f){j-=c;c<e&&++c;d=i[0]}else{if(c==1){break}c=1}}f=j}return d.r()==0?Ig(f):new dg(d,Dg(f))}
+function Fm(a,b){Em();var c,d,e,f,g,i,j,k,n,o,q,r,s,t,u,v,w,x;u=a.f;o=a.e;i=a.b;if(u==0){return Tr}if(o==1){j=i[0];x=qe(ue(j),yr);u<0&&(x=Be(x));return cl(x,b)}if(b==10||b<2||b>36){return Hm(a,0)}d=Math.log(b)/Math.log(2);s=Bc(sm(new Pi(a.f<0?new si(1,a.e,a.b):a))/d+(u<0?1:0))+1;t=lc(Md,{6:1},-1,s,1);f=s;if(b!=16){v=lc(Od,{6:1},-1,o,1);nm(i,0,v,0,o);w=o;e=Dm[b];c=Cm[b-2];while(true){r=Mm(v,v,w,c);q=f;do{t[--f]=uk(r%b,b)}while((r=~~(r/b))!=0&&f!=0);g=e-q+f;for(k=0;k<g&&f>0;++k){t[--f]=48}for(k=w-1;k>0&&v[k]==0;--k){}w=k+1;if(w==1&&v[0]==0){break}}}else{for(k=0;k<o;++k){for(n=0;n<8&&f>0;++n){r=~~i[k]>>(n<<2)&15;t[--f]=uk(r,16)}}}while(t[f]==48){++f}u==-1&&(t[--f]=45);return Ll(t,f,s-f)}
+function Km(a,b,c,d,e,f){var g,i,j,k,n,o,q,r,s,t,u,v,w,x,y,z,A;u=lc(Od,{6:1},-1,d+1,1);v=lc(Od,{6:1},-1,f+1,1);j=$k(e[f-1]);if(j!=0){xm(v,e,0,j);xm(u,c,0,j)}else{nm(c,0,u,0,d);nm(e,0,v,0,f)}k=v[f-1];o=b-1;q=d;while(o>=0){if(u[q]==k){n=-1}else{w=pe(Ee(qe(ue(u[q]),yr),32),qe(ue(u[q-1]),yr));z=Nm(w,k);n=Je(z);y=Je(Fe(z,32));if(n!=0){x=false;++n;do{--n;if(x){break}s=Ae(qe(ue(n),yr),qe(ue(v[f-2]),yr));A=pe(Ee(ue(y),32),qe(ue(u[q-2]),yr));t=pe(qe(ue(y),yr),qe(ue(k),yr));$k(Je(Ge(t,32)))<32?(x=true):(y=Je(t))}while(ve(Le(s,Gr),Le(A,Gr)))}}if(n!=0){g=$m(u,q-f,v,f,n);if(g!=0){--n;i=ur;for(r=0;r<f;++r){i=pe(i,pe(qe(ue(u[q-f+r]),yr),qe(ue(v[r]),yr)));u[q-f+r]=Je(i);i=Ge(i,32)}}}a!=null&&(a[o]=n);--q;--o}if(j!=0){Am(v,f,u,0,j);return v}nm(u,0,v,0,f);return u}
+function Vm(a,b){var c,d,e,f,g,i,j,k,n,o,q;f=gl(a.e,b.e);n=lc(Od,{6:1},-1,f+1,1);q=lc(Od,{6:1},-1,f+1,1);nm(b.b,0,n,0,b.e);nm(a.b,0,q,0,a.e);k=new si(b.f,b.e,n);o=new si(a.f,a.e,q);i=new si(0,1,lc(Od,{6:1},-1,f+1,1));j=new si(1,1,lc(Od,{6:1},-1,f+1,1));j.b[0]=1;c=0;d=0;g=b.ab();while(!Um(k,c)&&!Um(o,d)){e=Sm(k,g);if(e!=0){um(k,e);if(c>=d){um(i,e)}else{vm(j,d-c<e?d-c:e);e-(d-c)>0&&um(i,e-d+c)}c+=e}e=Sm(o,g);if(e!=0){um(o,e);if(d>=c){um(j,e)}else{vm(i,c-d<e?c-d:e);e-(c-d)>0&&um(j,e-c+d)}d+=e}if(k.r()==o.r()){if(c<=d){ln(k,o);ln(i,j)}else{ln(o,k);ln(j,i)}}else{if(c<=d){kn(k,o);kn(i,j)}else{kn(o,k);kn(j,i)}}if(o.r()==0||k.r()==0){throw new nk(vs)}}if(Um(o,d)){i=j;o.r()!=k.r()&&(k=k.cb())}k.gb(g)&&(i.r()<0?(i=i.cb()):(i=rn(b,i)));i.r()<0&&(i=fn(i,b));return i}
+function We(){var c=navigator.userAgent.toLowerCase();var d=function(a){return parseInt(a[1])*1000+parseInt(a[2])};if(function(){return c.indexOf(Wr)!=-1}())return Wr;if(function(){return c.indexOf('webkit')!=-1||function(){if(c.indexOf('chromeframe')!=-1){return true}if(typeof window['ActiveXObject']!=Xr){try{var b=new ActiveXObject('ChromeTab.ChromeFrame');if(b){b.registerBhoIfNeeded();return true}}catch(a){}}return false}()}())return Sr;if(function(){return c.indexOf(Yr)!=-1&&$doc.documentMode>=9}())return 'ie9';if(function(){return c.indexOf(Yr)!=-1&&$doc.documentMode>=8}())return 'ie8';if(function(){var a=/msie ([0-9]+)\.([0-9]+)/.exec(c);if(a&&a.length==3)return d(a)>=6000}())return 'ie6';if(function(){return c.indexOf('gecko')!=-1}())return 'gecko1_8';return 'unknown'}
+function Kn(a,b){var c,d,e,f,g,i,j,k;j=gl(b.e,a.e);e=Zh(b);f=Zh(a);if(e<f){i=lc(Od,{6:1},-1,j,1);d=e;i[e]=b.b[e];g=hl(b.e,f);for(++d;d<g;++d){i[d]=b.b[d]}if(d==b.e){for(;d<a.e;++d){i[d]=a.b[d]}}}else if(f<e){i=lc(Od,{6:1},-1,j,1);d=f;i[f]=-a.b[f];g=hl(a.e,e);for(++d;d<g;++d){i[d]=~a.b[d]}if(d==e){i[d]=~(a.b[d]^-b.b[d]);++d}else{for(;d<e;++d){i[d]=-1}for(;d<b.e;++d){i[d]=b.b[d]}}}else{d=e;c=a.b[e]^-b.b[e];if(c==0){g=hl(a.e,b.e);for(++d;d<g&&(c=a.b[d]^~b.b[d])==0;++d){}if(c==0){for(;d<a.e&&(c=~a.b[d])==0;++d){}for(;d<b.e&&(c=~b.b[d])==0;++d){}if(c==0){j=j+1;i=lc(Od,{6:1},-1,j,1);i[j-1]=1;k=new si(-1,j,i);return k}}}i=lc(Od,{6:1},-1,j,1);i[d]=-c;++d}g=hl(b.e,a.e);for(;d<g;++d){i[d]=~(~b.b[d]^a.b[d])}for(;d<a.e;++d){i[d]=a.b[d]}for(;d<b.e;++d){i[d]=b.b[d]}k=new si(-1,j,i);Sh(k);return k}
+function rf(){rf=rr;var a,b;lf=new qg(sr,0);mf=new qg(tr,0);of=new qg(ur,0);df=lc(Wd,{6:1},16,11,0);ef=lc(Md,{6:1},-1,100,1);ff=mc(Nd,{6:1},-1,[1,5,25,125,625,3125,15625,78125,390625,1953125,9765625,48828125,244140625,1220703125,6103515625,30517578125,152587890625,762939453125,3814697265625,19073486328125,95367431640625,476837158203125,2384185791015625]);gf=lc(Od,{6:1},-1,ff.length,1);hf=mc(Nd,{6:1},-1,[1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000,10000000000,100000000000,1000000000000,10000000000000,100000000000000,1000000000000000,10000000000000000]);jf=lc(Od,{6:1},-1,hf.length,1);pf=lc(Wd,{6:1},16,11,0);a=0;for(;a<pf.length;++a){nc(df,a,new qg(ue(a),0));nc(pf,a,new qg(ur,a));ef[a]=48}for(;a<ef.length;++a){ef[a]=48}for(b=0;b<gf.length;++b){gf[b]=sg(ff[b])}for(b=0;b<jf.length;++b){jf[b]=sg(hf[b])}nf=(go(),co);kf=bo}
+function Hf(a,b){var c,d,e,f,g,i,j,k,n,o;c=0;i=0;g=b.length;n=new gm(b.length);if(0<g&&b.charCodeAt(0)==43){++i;++c;if(i<g&&(b.charCodeAt(i)==43||b.charCodeAt(i)==45)){throw new pl(Zr+b+$r)}}e=0;o=false;for(;i<g&&b.charCodeAt(i)!=46&&b.charCodeAt(i)!=101&&b.charCodeAt(i)!=69;++i){o||(b.charCodeAt(i)==48?++e:(o=true))}am(n,b,c,i);if(i<g&&b.charCodeAt(i)==46){++i;c=i;for(;i<g&&b.charCodeAt(i)!=101&&b.charCodeAt(i)!=69;++i){o||(b.charCodeAt(i)==48?++e:(o=true))}a.f=i-c;am(n,b,c,i)}else{a.f=0}if(i<g&&(b.charCodeAt(i)==101||b.charCodeAt(i)==69)){++i;c=i;if(i<g&&b.charCodeAt(i)==43){++i;i<g&&b.charCodeAt(i)!=45&&++c}j=b.substr(c,g-c);a.f=a.f-af(j,10);if(a.f!=Bc(a.f)){throw new pl('Scale out of range.')}}k=n.b.b;if(k.length<16){a.g=zg(k);if(Hk(a.g)){throw new pl(Zr+b+$r)}a.b=sg(a.g)}else{Tf(a,new oi(k))}a.e=n.b.b.length-e;for(f=0;f<n.b.b.length;++f){d=vl(n.b.b,f);if(d!=45&&d!=48){break}--a.e}}
+function Im(a,b){Em();var c,d,e,f,g,i,j,k,n,o;g=xe(a,ur);g&&(a=Be(a));if(se(a,ur)){switch(b){case 0:return Tr;case 1:return zs;case 2:return As;case 3:return Bs;case 4:return Cs;case 5:return Ds;case 6:return Es;default:k=new fm;b<0?(k.b.b+=Fs,k):(k.b.b+=Gs,k);cc(k.b,b==-2147483648?'2147483648':Lr+-b);return k.b.b;}}j=lc(Md,{6:1},-1,19,1);c=18;o=a;do{i=o;o=re(o,tr);j[--c]=Je(pe(Cr,He(i,Ae(o,tr))))&65535}while(Ce(o,ur));d=He(He(He(Dr,ue(c)),ue(b)),sr);if(b==0){g&&(j[--c]=45);return Ll(j,c,18-c)}if(b>0&&we(d,Er)){if(we(d,ur)){e=c+Je(d);for(f=17;f>=e;--f){j[f+1]=j[f]}j[++e]=46;g&&(j[--c]=45);return Ll(j,c,18-c+1)}for(f=2;xe(ue(f),pe(Be(d),sr));++f){j[--c]=48}j[--c]=46;j[--c]=48;g&&(j[--c]=45);return Ll(j,c,18-c)}n=c+1;k=new gm;g&&(k.b.b+=Ur,k);if(18-n>=1){Zl(k,j[c]);k.b.b+=ds;dc(k.b,Ll(j,c+1,18-c-1))}else{dc(k.b,Ll(j,c,18-c))}k.b.b+=fs;ve(d,ur)&&(k.b.b+=gs,k);cc(k.b,Lr+Ke(d));return k.b.b}
+function Ef(a,b,c){var d,e,f,g,i,j,k,n,o,q,r,s,t;n=c.b;e=Pf(a)-b.q();k=nf.length-1;f=a.f-b.f;o=f;r=e-f+1;q=lc(Xd,{6:1},17,2,0);if(n==0||a.b==0&&a.g!=-1||b.b==0&&b.g!=-1){return Df(a,b)}if(r<=0){nc(q,0,(Oh(),Nh))}else if(f==0){nc(q,0,Th((!a.d&&(a.d=Li(a.g)),a.d),(!b.d&&(b.d=Li(b.g)),b.d)))}else if(f>0){nc(q,0,Th((!a.d&&(a.d=Li(a.g)),a.d),ei((!b.d&&(b.d=Li(b.g)),b.d),po(f))));o=f<(n-r+1>0?n-r+1:0)?f:n-r+1>0?n-r+1:0;nc(q,0,ei(q[0],po(o)))}else{g=-f<(n-e>0?n-e:0)?-f:n-e>0?n-e:0;q=Uh(ei((!a.d&&(a.d=Li(a.g)),a.d),po(g)),(!b.d&&(b.d=Li(b.g)),b.d));o+=g;g=-o;if(q[1].r()!=0&&g>0){d=(new cg(q[1])).q()+g-b.q();if(d==0){nc(q,1,Th(ei(q[1],po(g)),(!b.d&&(b.d=Li(b.g)),b.d)));d=dl(q[1].r())}if(d>0){throw new nk(as)}}}if(q[0].r()==0){return Ig(f)}t=q[0];j=new cg(q[0]);s=j.q();i=1;while(!t.gb(0)){q=Uh(t,nf[i]);if(q[1].r()==0&&(s-i>=n||o-i>=f)){s-=i;o-=i;i<k&&++i;t=q[0]}else{if(i==1){break}i=1}}if(s>n){throw new nk(as)}j.f=Dg(o);Tf(j,t);return j}
+function Ve(){var a,b,c;b=$doc.compatMode;a=mc(Vd,{6:1},1,[Vr]);for(c=0;c<a.length;++c){if(wl(a[c],b)){return}}a.length==1&&wl(Vr,a[0])&&wl('BackCompat',b)?"GWT no longer supports Quirks Mode (document.compatMode=' BackCompat').<br>Make sure your application's host HTML page has a Standards Mode (document.compatMode=' CSS1Compat') doctype,<br>e.g. by using &lt;!doctype html&gt; at the start of your application's HTML page.<br><br>To continue using this unsupported rendering mode and risk layout problems, suppress this message by adding<br>the following line to your*.gwt.xml module file:<br>&nbsp;&nbsp;&lt;extend-configuration-property name=\"document.compatMode\" value=\""+b+'"/&gt;':"Your *.gwt.xml module configuration prohibits the use of the current doucment rendering mode (document.compatMode=' "+b+"').<br>Modify your application's host HTML page doctype, or update your custom 'document.compatMode' configuration property settings."}
+function Lg(a){rf();var b,c;c=Lj(a);if(c==is)b=new cg(new oi(a[0].toString()));else if(c=='BigInteger number')b=new dg(new oi(a[0].toString()),a[1]);else if(c=='BigInteger number MathContext')b=new eg(new oi(a[0].toString()),a[1],new Yn(a[2].toString()));else if(c=='BigInteger MathContext')b=new fg(new oi(a[0].toString()),new Yn(a[1].toString()));else if(c==js)b=new gg(Cl(a[0].toString()));else if(c=='array number number')b=new hg(Cl(a[0].toString()),a[1],a[2]);else if(c=='array number number MathContext')b=new ig(Cl(a[0].toString()),a[1],a[2],new Yn(a[3].toString()));else if(c=='array MathContext')b=new jg(Cl(a[0].toString()),new Yn(a[1].toString()));else if(c==ks)b=new kg(a[0]);else if(c==ls)b=new lg(a[0],new Yn(a[1].toString()));else if(c==ms)b=new mg(a[0].toString());else if(c=='string MathContext')b=new ng(a[0].toString(),new Yn(a[1].toString()));else throw new V('Unknown call signature for obj = new java.math.BigDecimal: '+c);return new Kg(b)}
+function uo(){uo=rr;var a;ro=mc(Od,{6:1},-1,[0,0,1854,1233,927,747,627,543,480,431,393,361,335,314,295,279,265,253,242,232,223,216,181,169,158,150,145,140,136,132,127,123,119,114,110,105,101,96,92,87,83,78,73,69,64,59,54,49,44,38,32,26,1]);to=mc(Od,{6:1},-1,[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021]);so=lc(Xd,{6:1},17,to.length,0);for(a=0;a<to.length;++a){nc(so,a,Ki(ue(to[a])))}}
+function Xj(){nr(rs,Lr);if($wnd.bigdecimal.MathContext){var b=$wnd.bigdecimal.MathContext}$wnd.bigdecimal.MathContext=Jr(function(){if(arguments.length==1&&arguments[0]!=null&&arguments[0].gC()==Uc){this.__gwt_instance=arguments[0]}else if(arguments.length==0){this.__gwt_instance=new Nj;or(this.__gwt_instance,this)}else if(arguments.length==1){this.__gwt_instance=Zj(arguments[0]);or(this.__gwt_instance,this)}});var c=$wnd.bigdecimal.MathContext.prototype=new Object;if(b){for(p in b){$wnd.bigdecimal.MathContext[p]=b[p]}}c.getPrecision=jr(Number,Jr(function(){var a=this.__gwt_instance.Hb();return a}));c.getRoundingMode=Jr(function(){var a=this.__gwt_instance.Ib();return pr(a)});c.hashCode=jr(Number,Jr(function(){var a=this.__gwt_instance.hC();return a}));c.toString=Jr(function(){var a=this.__gwt_instance.tS();return a});$wnd.bigdecimal.MathContext.DECIMAL128=Jr(function(){var a=new Oj(Wn((Un(),On)));return pr(a)});$wnd.bigdecimal.MathContext.DECIMAL32=Jr(function(){var a=new Oj(Wn((Un(),Pn)));return pr(a)});$wnd.bigdecimal.MathContext.DECIMAL64=Jr(function(){var a=new Oj(Wn((Un(),Qn)));return pr(a)});$wnd.bigdecimal.MathContext.UNLIMITED=Jr(function(){var a=new Oj(Wn((Un(),Rn)));return pr(a)});mr(Uc,$wnd.bigdecimal.MathContext)}
+function Hm(a,b){Em();var c,d,e,f,g,i,j,k,n,o,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E;z=a.f;q=a.e;e=a.b;if(z==0){switch(b){case 0:return Tr;case 1:return zs;case 2:return As;case 3:return Bs;case 4:return Cs;case 5:return Ds;case 6:return Es;default:x=new fm;b<0?(x.b.b+=Fs,x):(x.b.b+=Gs,x);ac(x.b,-b);return x.b.b;}}v=q*10+1+7;w=lc(Md,{6:1},-1,v+1,1);c=v;if(q==1){g=e[0];if(g<0){E=qe(ue(g),yr);do{r=E;E=re(E,tr);w[--c]=48+Je(He(r,Ae(E,tr)))&65535}while(Ce(E,ur))}else{E=g;do{r=E;E=~~(E/10);w[--c]=48+(r-E*10)&65535}while(E!=0)}}else{B=lc(Od,{6:1},-1,q,1);D=q;nm(e,0,B,0,q);F:while(true){y=ur;for(j=D-1;j>=0;--j){C=pe(Ee(y,32),qe(ue(B[j]),yr));t=Gm(C);B[j]=Je(t);y=ue(Je(Fe(t,32)))}u=Je(y);s=c;do{w[--c]=48+u%10&65535}while((u=~~(u/10))!=0&&c!=0);d=9-s+c;for(i=0;i<d&&c>0;++i){w[--c]=48}n=D-1;for(;B[n]==0;--n){if(n==0){break F}}D=n+1}while(w[c]==48){++c}}o=z<0;f=v-c-b-1;if(b==0){o&&(w[--c]=45);return Ll(w,c,v-c)}if(b>0&&f>=-6){if(f>=0){k=c+f;for(n=v-1;n>=k;--n){w[n+1]=w[n]}w[++k]=46;o&&(w[--c]=45);return Ll(w,c,v-c+1)}for(n=2;n<-f+1;++n){w[--c]=48}w[--c]=46;w[--c]=48;o&&(w[--c]=45);return Ll(w,c,v-c)}A=c+1;x=new gm;o&&(x.b.b+=Ur,x);if(v-A>=1){Zl(x,w[c]);x.b.b+=ds;dc(x.b,Ll(w,c+1,v-c-1))}else{dc(x.b,Ll(w,c,v-c))}x.b.b+=fs;f>0&&(x.b.b+=gs,x);cc(x.b,Lr+f);return x.b.b}
+function jk(){nr(rs,Lr);if($wnd.bigdecimal.RoundingMode){var c=$wnd.bigdecimal.RoundingMode}$wnd.bigdecimal.RoundingMode=Jr(function(){if(arguments.length==1&&arguments[0]!=null&&arguments[0].gC()==Wc){this.__gwt_instance=arguments[0]}else if(arguments.length==0){this.__gwt_instance=new ak;or(this.__gwt_instance,this)}});var d=$wnd.bigdecimal.RoundingMode.prototype=new Object;if(c){for(p in c){$wnd.bigdecimal.RoundingMode[p]=c[p]}}$wnd.bigdecimal.RoundingMode.valueOf=Jr(function(a){var b=new bk((Qo(),Ok((Yo(),Xo),a)));return pr(b)});$wnd.bigdecimal.RoundingMode.values=Jr(function(){var a=fk();return qr(a)});d.name=Jr(function(){var a=this.__gwt_instance.Jb();return a});d.toString=Jr(function(){var a=this.__gwt_instance.tS();return a});$wnd.bigdecimal.RoundingMode.CEILING=Jr(function(){var a=new bk((Qo(),Ao));return pr(a)});$wnd.bigdecimal.RoundingMode.DOWN=Jr(function(){var a=new bk((Qo(),Bo));return pr(a)});$wnd.bigdecimal.RoundingMode.FLOOR=Jr(function(){var a=new bk((Qo(),Co));return pr(a)});$wnd.bigdecimal.RoundingMode.HALF_DOWN=Jr(function(){var a=new bk((Qo(),Do));return pr(a)});$wnd.bigdecimal.RoundingMode.HALF_EVEN=Jr(function(){var a=new bk((Qo(),Eo));return pr(a)});$wnd.bigdecimal.RoundingMode.HALF_UP=Jr(function(){var a=new bk((Qo(),Fo));return pr(a)});$wnd.bigdecimal.RoundingMode.UNNECESSARY=Jr(function(){var a=new bk((Qo(),Go));return pr(a)});$wnd.bigdecimal.RoundingMode.UP=Jr(function(){var a=new bk((Qo(),Ho));return pr(a)});mr(Wc,$wnd.bigdecimal.RoundingMode)}
+function Hj(){nr(rs,Lr);if($wnd.bigdecimal.BigInteger){var d=$wnd.bigdecimal.BigInteger}$wnd.bigdecimal.BigInteger=Jr(function(){if(arguments.length==1&&arguments[0]!=null&&arguments[0].gC()==Sc){this.__gwt_instance=arguments[0]}else if(arguments.length==0){this.__gwt_instance=new Ni;or(this.__gwt_instance,this)}else if(arguments.length==1){this.__gwt_instance=Jj(arguments[0]);or(this.__gwt_instance,this)}});var e=$wnd.bigdecimal.BigInteger.prototype=new Object;if(d){for(p in d){$wnd.bigdecimal.BigInteger[p]=d[p]}}$wnd.bigdecimal.BigInteger.__init__=Jr(function(a){var b=Qi(a);return pr(b)});e.abs=Jr(function(){var a=this.__gwt_instance._();return pr(a)});e.add=Jr(function(a){var b=this.__gwt_instance.hb(a.__gwt_instance);return pr(b)});e.and=Jr(function(a){var b=this.__gwt_instance.ib(a.__gwt_instance);return pr(b)});e.andNot=Jr(function(a){var b=this.__gwt_instance.jb(a.__gwt_instance);return pr(b)});e.bitCount=jr(Number,Jr(function(){var a=this.__gwt_instance.kb();return a}));e.bitLength=jr(Number,Jr(function(){var a=this.__gwt_instance.ab();return a}));e.clearBit=Jr(function(a){var b=this.__gwt_instance.lb(a);return pr(b)});e.compareTo=jr(Number,Jr(function(a){var b=this.__gwt_instance.mb(a.__gwt_instance);return b}));e.divide=Jr(function(a){var b=this.__gwt_instance.nb(a.__gwt_instance);return pr(b)});e.doubleValue=jr(Number,Jr(function(){var a=this.__gwt_instance.z();return a}));e.equals=jr(Number,Jr(function(a){var b=this.__gwt_instance.eQ(a);return b}));e.flipBit=Jr(function(a){var b=this.__gwt_instance.pb(a);return pr(b)});e.floatValue=jr(Number,Jr(function(){var a=this.__gwt_instance.A();return a}));e.gcd=Jr(function(a){var b=this.__gwt_instance.qb(a.__gwt_instance);return pr(b)});e.getLowestSetBit=jr(Number,Jr(function(){var a=this.__gwt_instance.bb();return a}));e.hashCode=jr(Number,Jr(function(){var a=this.__gwt_instance.hC();return a}));e.intValue=jr(Number,Jr(function(){var a=this.__gwt_instance.B();return a}));e.isProbablePrime=jr(Number,Jr(function(a){var b=this.__gwt_instance.rb(a);return b}));e.max=Jr(function(a){var b=this.__gwt_instance.tb(a.__gwt_instance);return pr(b)});e.min=Jr(function(a){var b=this.__gwt_instance.ub(a.__gwt_instance);return pr(b)});e.mod=Jr(function(a){var b=this.__gwt_instance.vb(a.__gwt_instance);return pr(b)});e.modInverse=Jr(function(a){var b=this.__gwt_instance.wb(a.__gwt_instance);return pr(b)});e.modPow=Jr(function(a,b){var c=this.__gwt_instance.xb(a.__gwt_instance,b.__gwt_instance);return pr(c)});e.multiply=Jr(function(a){var b=this.__gwt_instance.yb(a.__gwt_instance);return pr(b)});e.negate=Jr(function(){var a=this.__gwt_instance.cb();return pr(a)});e.nextProbablePrime=Jr(function(){var a=this.__gwt_instance.zb();return pr(a)});e.not=Jr(function(){var a=this.__gwt_instance.Ab();return pr(a)});e.or=Jr(function(a){var b=this.__gwt_instance.Bb(a.__gwt_instance);return pr(b)});e.pow=Jr(function(a){var b=this.__gwt_instance.db(a);return pr(b)});e.remainder=Jr(function(a){var b=this.__gwt_instance.Cb(a.__gwt_instance);return pr(b)});e.setBit=Jr(function(a){var b=this.__gwt_instance.Db(a);return pr(b)});e.shiftLeft=Jr(function(a){var b=this.__gwt_instance.eb(a);return pr(b)});e.shiftRight=Jr(function(a){var b=this.__gwt_instance.fb(a);return pr(b)});e.signum=jr(Number,Jr(function(){var a=this.__gwt_instance.r();return a}));e.subtract=Jr(function(a){var b=this.__gwt_instance.Eb(a.__gwt_instance);return pr(b)});e.testBit=jr(Number,Jr(function(a){var b=this.__gwt_instance.gb(a);return b}));e.toString_va=Jr(function(a){var b=this.__gwt_instance.Fb(a);return b});e.xor=Jr(function(a){var b=this.__gwt_instance.Gb(a.__gwt_instance);return pr(b)});e.divideAndRemainder=Jr(function(a){var b=this.__gwt_instance.ob(a.__gwt_instance);return qr(b)});e.longValue=jr(Number,Jr(function(){var a=this.__gwt_instance.sb();return a}));$wnd.bigdecimal.BigInteger.valueOf=Jr(function(a){var b=(Oh(),new Pi(Ki(te(a))));return pr(b)});$wnd.bigdecimal.BigInteger.ONE=Jr(function(){var a=(Oh(),new Pi(Jh));return pr(a)});$wnd.bigdecimal.BigInteger.TEN=Jr(function(){var a=(Oh(),new Pi(Lh));return pr(a)});$wnd.bigdecimal.BigInteger.ZERO=Jr(function(){var a=(Oh(),new Pi(Nh));return pr(a)});mr(Sc,$wnd.bigdecimal.BigInteger)}
+function Dh(){nr(rs,Lr);if($wnd.bigdecimal.BigDecimal){var c=$wnd.bigdecimal.BigDecimal}$wnd.bigdecimal.BigDecimal=Jr(function(){if(arguments.length==1&&arguments[0]!=null&&arguments[0].gC()==Qc){this.__gwt_instance=arguments[0]}else if(arguments.length==0){this.__gwt_instance=new Jg;or(this.__gwt_instance,this)}});var d=$wnd.bigdecimal.BigDecimal.prototype=new Object;if(c){for(p in c){$wnd.bigdecimal.BigDecimal[p]=c[p]}}$wnd.bigdecimal.BigDecimal.ROUND_CEILING=2;$wnd.bigdecimal.BigDecimal.ROUND_DOWN=1;$wnd.bigdecimal.BigDecimal.ROUND_FLOOR=3;$wnd.bigdecimal.BigDecimal.ROUND_HALF_DOWN=5;$wnd.bigdecimal.BigDecimal.ROUND_HALF_EVEN=6;$wnd.bigdecimal.BigDecimal.ROUND_HALF_UP=4;$wnd.bigdecimal.BigDecimal.ROUND_UNNECESSARY=7;$wnd.bigdecimal.BigDecimal.ROUND_UP=0;$wnd.bigdecimal.BigDecimal.__init__=Jr(function(a){var b=Lg(a);return pr(b)});d.abs_va=Jr(function(a){var b=this.__gwt_instance.s(a);return pr(b)});d.add_va=Jr(function(a){var b=this.__gwt_instance.t(a);return pr(b)});d.byteValueExact=jr(Number,Jr(function(){var a=this.__gwt_instance.u();return a}));d.compareTo=jr(Number,Jr(function(a){var b=this.__gwt_instance.v(a.__gwt_instance);return b}));d.divide_va=Jr(function(a){var b=this.__gwt_instance.y(a);return pr(b)});d.divideToIntegralValue_va=Jr(function(a){var b=this.__gwt_instance.x(a);return pr(b)});d.doubleValue=jr(Number,Jr(function(){var a=this.__gwt_instance.z();return a}));d.equals=jr(Number,Jr(function(a){var b=this.__gwt_instance.eQ(a);return b}));d.floatValue=jr(Number,Jr(function(){var a=this.__gwt_instance.A();return a}));d.hashCode=jr(Number,Jr(function(){var a=this.__gwt_instance.hC();return a}));d.intValue=jr(Number,Jr(function(){var a=this.__gwt_instance.B();return a}));d.intValueExact=jr(Number,Jr(function(){var a=this.__gwt_instance.C();return a}));d.max=Jr(function(a){var b=this.__gwt_instance.F(a.__gwt_instance);return pr(b)});d.min=Jr(function(a){var b=this.__gwt_instance.G(a.__gwt_instance);return pr(b)});d.movePointLeft=Jr(function(a){var b=this.__gwt_instance.H(a);return pr(b)});d.movePointRight=Jr(function(a){var b=this.__gwt_instance.I(a);return pr(b)});d.multiply_va=Jr(function(a){var b=this.__gwt_instance.J(a);return pr(b)});d.negate_va=Jr(function(a){var b=this.__gwt_instance.K(a);return pr(b)});d.plus_va=Jr(function(a){var b=this.__gwt_instance.L(a);return pr(b)});d.pow_va=Jr(function(a){var b=this.__gwt_instance.M(a);return pr(b)});d.precision=jr(Number,Jr(function(){var a=this.__gwt_instance.q();return a}));d.remainder_va=Jr(function(a){var b=this.__gwt_instance.N(a);return pr(b)});d.round=Jr(function(a){var b=this.__gwt_instance.O(a.__gwt_instance);return pr(b)});d.scale=jr(Number,Jr(function(){var a=this.__gwt_instance.P();return a}));d.scaleByPowerOfTen=Jr(function(a){var b=this.__gwt_instance.Q(a);return pr(b)});d.setScale_va=Jr(function(a){var b=this.__gwt_instance.R(a);return pr(b)});d.shortValueExact=jr(Number,Jr(function(){var a=this.__gwt_instance.S();return a}));d.signum=jr(Number,Jr(function(){var a=this.__gwt_instance.r();return a}));d.stripTrailingZeros=Jr(function(){var a=this.__gwt_instance.T();return pr(a)});d.subtract_va=Jr(function(a){var b=this.__gwt_instance.U(a);return pr(b)});d.toBigInteger=Jr(function(){var a=this.__gwt_instance.V();return pr(a)});d.toBigIntegerExact=Jr(function(){var a=this.__gwt_instance.W();return pr(a)});d.toEngineeringString=Jr(function(){var a=this.__gwt_instance.X();return a});d.toPlainString=Jr(function(){var a=this.__gwt_instance.Y();return a});d.toString=Jr(function(){var a=this.__gwt_instance.tS();return a});d.ulp=Jr(function(){var a=this.__gwt_instance.Z();return pr(a)});d.unscaledValue=Jr(function(){var a=this.__gwt_instance.$();return pr(a)});d.divideAndRemainder_va=Jr(function(a){var b=this.__gwt_instance.w(a);return qr(b)});d.longValue=jr(Number,Jr(function(){var a=this.__gwt_instance.E();return a}));d.longValueExact=jr(Number,Jr(function(){var a=this.__gwt_instance.D();return a}));$wnd.bigdecimal.BigDecimal.valueOf_va=Jr(function(a){var b=zh(a);return pr(b)});$wnd.bigdecimal.BigDecimal.log=jr(Number,Jr(function(a){rf();typeof console!==Xr&&console.log&&console.log(a)}));$wnd.bigdecimal.BigDecimal.logObj=jr(Number,Jr(function(a){rf();typeof console!==Xr&&console.log&&typeof JSON!==Xr&&JSON.stringify&&console.log('object: '+JSON.stringify(a))}));$wnd.bigdecimal.BigDecimal.ONE=Jr(function(){var a=(rf(),new Kg(lf));return pr(a)});$wnd.bigdecimal.BigDecimal.TEN=Jr(function(){var a=(rf(),new Kg(mf));return pr(a)});$wnd.bigdecimal.BigDecimal.ZERO=Jr(function(){var a=(rf(),new Kg(of));return pr(a)});mr(Qc,$wnd.bigdecimal.BigDecimal)}
+var Lr='',ys=' ',$r='"',Or='(',gs='+',Is=', ',Ur='-',ds='.',Tr='0',es='0.',zs='0.0',As='0.00',Bs='0.000',Cs='0.0000',Ds='0.00000',Es='0.000000',Gs='0E',Fs='0E+',Qr=':',Kr=': ',Js='=',ps='BigDecimal',qs='BigDecimal MathContext',Ts='BigDecimal;',is='BigInteger',ss='BigInteger divide by zero',vs='BigInteger not invertible.',us='BigInteger: modulus not positive',Us='BigInteger;',Vr='CSS1Compat',_r='Division by zero',as='Division impossible',fs='E',Zr='For input string: "',hs='Infinite or NaN',bs='Invalid Operation',os='MathContext',ts='Negative bit address',cs='Rounding necessary',xs='RoundingMode',Vs='RoundingMode;',Nr='String',Rr='[',Ss='[Lcom.iriscouch.gwtapp.client.',Os='[Ljava.lang.',Ws='[Ljava.math.',Ks='\\.',Ls='__gwtex_wrap',Pr='anonymous',js='array',Hs='bad string format',rs='bigdecimal',Ns='com.google.gwt.core.client.',Ps='com.google.gwt.core.client.impl.',Rs='com.iriscouch.gwtapp.client.',Ms='java.lang.',Qs='java.math.',Xs='java.util.',Yr='msie',Mr='null',ks='number',ls='number MathContext',ns='number number',ws='object',Wr='opera',Ys='org.timepedia.exporter.client.',Sr='safari',ms='string',Xr='undefined';var _,Gr={l:0,m:0,h:524288},zr={l:0,m:4193280,h:1048575},Er={l:4194298,m:4194303,h:1048575},wr={l:4194303,m:4194303,h:1048575},ur={l:0,m:0,h:0},sr={l:1,m:0,h:0},vr={l:2,m:0,h:0},Hr={l:5,m:0,h:0},tr={l:10,m:0,h:0},xr={l:11,m:0,h:0},Dr={l:18,m:0,h:0},Cr={l:48,m:0,h:0},Br={l:877824,m:119,h:0},Ar={l:1755648,m:238,h:0},Ir={l:4194303,m:511,h:0},yr={l:4194303,m:1023,h:0},Fr={l:0,m:1024,h:0};_=H.prototype={};_.eQ=function I(a){return this===a};_.gC=function J(){return gd};_.hC=function K(){return ob(this)};_.tS=function L(){return this.gC().d+'@'+al(this.hC())};_.toString=function(){return this.tS()};_.tM=rr;_.cM={};_=P.prototype=new H;_.gC=function R(){return nd};_.j=function S(){return this.f};_.tS=function T(){var a,b;a=this.gC().d;b=this.j();return b!=null?a+Kr+b:a};_.cM={6:1,15:1};_.f=null;_=O.prototype=new P;_.gC=function U(){return ad};_.cM={6:1,15:1};_=V.prototype=N.prototype=new O;_.gC=function W(){return hd};_.cM={6:1,12:1,15:1};_=X.prototype=M.prototype=new N;_.gC=function Y(){return Fc};_.j=function ab(){this.d==null&&(this.e=bb(this.c),this.b=Z(this.c),this.d=Or+this.e+'): '+this.b+db(this.c),undefined);return this.d};_.cM={6:1,12:1,15:1};_.b=null;_.c=null;_.d=null;_.e=null;_=gb.prototype=new H;_.gC=function hb(){return Hc};var ib=0,jb=0;_=ub.prototype=pb.prototype=new gb;_.gC=function vb(){return Ic};_.b=null;_.c=null;var qb;_=Fb.prototype=Ab.prototype=new H;_.k=function Gb(){var a={};var b=[];var c=arguments.callee.caller.caller;while(c){var d=this.n(c.toString());b.push(d);var e=Qr+d;var f=a[e];if(f){var g,i;for(g=0,i=f.length;g<i;g++){if(f[g]===c){return b}}}(f||(a[e]=[])).push(c);c=c.caller}return b};_.n=function Hb(a){return yb(a)};_.gC=function Ib(){return Lc};_.o=function Jb(a){return []};_=Lb.prototype=new Ab;_.k=function Nb(){return zb(this.o(Eb()),this.p())};_.gC=function Ob(){return Kc};_.o=function Pb(a){return Mb(this,a)};_.p=function Qb(){return 2};_=Tb.prototype=Kb.prototype=new Lb;_.k=function Ub(){return Rb(this)};_.n=function Vb(a){var b,c;if(a.length==0){return Pr}c=Dl(a);c.indexOf('at ')==0&&(c=Al(c,3));b=c.indexOf(Rr);b==-1&&(b=c.indexOf(Or));if(b==-1){return Pr}else{c=Dl(c.substr(0,b-0))}b=yl(c,String.fromCharCode(46));b!=-1&&(c=Al(c,b+1));return c.length>0?c:Pr};_.gC=function Wb(){return Jc};_.o=function Xb(a){return Sb(this,a)};_.p=function Yb(){return 3};_=Zb.prototype=new H;_.gC=function $b(){return Nc};_=fc.prototype=_b.prototype=new Zb;_.gC=function gc(){return Mc};_.b=Lr;_=ic.prototype=hc.prototype=new H;_.gC=function kc(){return this.aC};_.aC=null;_.qI=0;var oc,pc;var ae=null;var oe=null;var Me,Ne,Oe,Pe;_=Se.prototype=Re.prototype=new H;_.gC=function Te(){return Oc};_.cM={2:1};_=Ze.prototype=new H;_.gC=function cf(){return fd};_.cM={6:1,10:1};var $e=null;_=qg.prototype=pg.prototype=og.prototype=ng.prototype=mg.prototype=lg.prototype=kg.prototype=jg.prototype=ig.prototype=hg.prototype=gg.prototype=fg.prototype=eg.prototype=dg.prototype=cg.prototype=Ye.prototype=new Ze;_.eQ=function wg(a){return Ff(this,a)};_.gC=function xg(){return pd};_.hC=function yg(){return Gf(this)};_.q=function Ag(){return Pf(this)};_.r=function Cg(){return Uf(this)};_.tS=function Eg(){return ag(this)};_.cM={6:1,8:1,10:1,16:1};_.b=0;_.c=0;_.d=null;_.e=0;_.f=0;_.g=0;_.i=null;var df,ef,ff,gf,hf,jf,kf=null,lf,mf,nf=null,of,pf,qf=null;_=Kg.prototype=Jg.prototype=Xe.prototype=new Ye;_.s=function Mg(a){var b,c,d;d=Lj(a);if(d==Lr)b=Uf(this)<0?Mf(this):this;else if(d==os)b=sf(Qf(this,new Yn(a[0].toString())));else throw new V('Unknown call signature for interim = super.abs: '+d);c=new Kg(b);return c};_.t=function Ng(a){var b,c,d;d=Lj(a);if(d==ps)b=tf(this,new mg(a[0].toString()));else if(d==qs)b=uf(this,new mg(a[0].toString()),new Yn(a[1].toString()));else throw new V('Unknown call signature for interim = super.add: '+d);c=new Kg(b);return c};_.u=function Og(){return ~~(Je(bg(this,8))<<24)>>24};_.v=function Pg(a){return vf(this,a)};_.w=function Qg(a){var b,c,d,e;e=Lj(a);if(e==ps)c=Bf(this,new mg(a[0].toString()));else if(e==qs)c=Cf(this,new mg(a[0].toString()),new Yn(a[1].toString()));else throw new V('Unknown call signature for interim = super.divideAndRemainder: '+e);d=lc(Qd,{6:1},3,c.length,0);for(b=0;b<c.length;++b)d[b]=new Kg(c[b]);return d};_.x=function Rg(a){var b,c,d;d=Lj(a);if(d==ps)b=Df(this,new mg(a[0].toString()));else if(d==qs)b=Ef(this,new mg(a[0].toString()),new Yn(a[1].toString()));else throw new V('Unknown call signature for interim = super.divideToIntegralValue: '+d);c=new Kg(b);return c};_.y=function Sg(a){var b,c,d;d=Lj(a);if(d==ps)b=wf(this,new mg(a[0].toString()));else if(d=='BigDecimal number')b=xf(this,new mg(a[0].toString()),a[1]);else if(d=='BigDecimal number number')b=yf(this,new mg(a[0].toString()),a[1],Uo(a[2]));else if(d=='BigDecimal number RoundingMode')b=yf(this,new mg(a[0].toString()),a[1],To(a[2].toString()));else if(d==qs)b=zf(this,new mg(a[0].toString()),new Yn(a[1].toString()));else if(d=='BigDecimal RoundingMode')b=Af(this,new mg(a[0].toString()),To(a[1].toString()));else throw new V('Unknown call signature for interim = super.divide: '+d);c=new Kg(b);return c};_.z=function Tg(){return _e(ag(this))};_.eQ=function Ug(a){return Ff(this,a)};_.A=function Vg(){var a,b;return a=Uf(this),b=this.b-this.f/0.3010299956639812,b<-149||a==0?(a*=0):b>129?(a*=Infinity):(a=_e(ag(this))),a};_.gC=function Wg(){return Qc};_.hC=function Xg(){return Gf(this)};_.B=function Yg(){return this.f<=-32||this.f>(this.e>0?this.e:el((this.b-1)*0.3010299956639812)+1)?0:Mi(new Pi(this.f==0||this.b==0&&this.g!=-1?(!this.d&&(this.d=Li(this.g)),this.d):this.f<0?ei((!this.d&&(this.d=Li(this.g)),this.d),po(-this.f)):Th((!this.d&&(this.d=Li(this.g)),this.d),po(this.f))))};_.C=function Zg(){return Je(bg(this,32))};_.D=function $g(){return Je(bg(this,32))};_.E=function _g(){return _e(ag(this))};_.F=function ah(a){return new Kg(vf(this,a)>=0?this:a)};_.G=function bh(a){return new Kg(vf(this,a)<=0?this:a)};_.H=function ch(a){return new Kg(Jf(this,this.f+a))};_.I=function dh(a){return new Kg(Jf(this,this.f-a))};_.J=function eh(a){var b,c,d;d=Lj(a);if(d==ps)b=Kf(this,new mg(a[0].toString()));else if(d==qs)b=Lf(this,new mg(a[0].toString()),new Yn(a[1].toString()));else throw new V('Unknown call signature for interim = super.multiply: '+d);c=new Kg(b);return c};_.K=function fh(a){var b,c,d;d=Lj(a);if(d==Lr)b=Mf(this);else if(d==os)b=Mf(Qf(this,new Yn(a[0].toString())));else throw new V('Unknown call signature for interim = super.negate: '+d);c=new Kg(b);return c};_.L=function gh(a){var b,c,d;d=Lj(a);if(d==Lr)b=this;else if(d==os)b=Qf(this,new Yn(a[0].toString()));else throw new V('Unknown call signature for interim = super.plus: '+d);c=new Kg(b);return c};_.M=function hh(a){var b,c,d;d=Lj(a);if(d==ks)b=Nf(this,a[0]);else if(d==ls)b=Of(this,a[0],new Yn(a[1].toString()));else throw new V('Unknown call signature for interim = super.pow: '+d);c=new Kg(b);return c};_.q=function ih(){return Pf(this)};_.N=function jh(a){var b,c,d;d=Lj(a);if(d==ps)b=Bf(this,new mg(a[0].toString()))[1];else if(d==qs)b=Cf(this,new mg(a[0].toString()),new Yn(a[1].toString()))[1];else throw new V('Unknown call signature for interim = super.remainder: '+d);c=new Kg(b);return c};_.O=function kh(a){return new Kg(Qf(this,new Yn(Wn(a.b))))};_.P=function lh(){return Bc(this.f)};_.Q=function mh(a){return new Kg(Rf(this,a))};_.R=function nh(a){var b,c,d;d=Lj(a);if(d==ks)b=Sf(this,a[0],(Qo(),Go));else if(d==ns)b=Sf(this,a[0],Uo(a[1]));else if(d=='number RoundingMode')b=Sf(this,a[0],To(a[1].toString()));else throw new V('Unknown call signature for interim = super.setScale: '+d);c=new Kg(b);return c};_.S=function oh(){return ~~(Je(bg(this,16))<<16)>>16};_.r=function ph(){return Uf(this)};_.T=function qh(){return new Kg(Wf(this))};_.U=function rh(a){var b,c,d;d=Lj(a);if(d==ps)b=Xf(this,new mg(a[0].toString()));else if(d==qs)b=Yf(this,new mg(a[0].toString()),new Yn(a[1].toString()));else throw new V('Unknown call signature for interim = super.subtract: '+d);c=new Kg(b);return c};_.V=function sh(){return new Pi(this.f==0||this.b==0&&this.g!=-1?(!this.d&&(this.d=Li(this.g)),this.d):this.f<0?ei((!this.d&&(this.d=Li(this.g)),this.d),po(-this.f)):Th((!this.d&&(this.d=Li(this.g)),this.d),po(this.f)))};_.W=function th(){return new Pi(Zf(this))};_.X=function uh(){return $f(this)};_.Y=function vh(){return _f(this)};_.tS=function wh(){return ag(this)};_.Z=function xh(){return new Kg(new pg(1,this.f))};_.$=function yh(){return new Pi((!this.d&&(this.d=Li(this.g)),this.d))};_.cM={3:1,6:1,8:1,10:1,16:1,24:1};_=Eh.prototype=Ah.prototype=new H;_.gC=function Fh(){return Pc};var Bh=false;_=ui.prototype=ti.prototype=si.prototype=ri.prototype=qi.prototype=pi.prototype=oi.prototype=ni.prototype=Hh.prototype=new Ze;_._=function vi(){return this.f<0?new si(1,this.e,this.b):this};_.ab=function wi(){return sm(this)};_.eQ=function xi(a){return Vh(this,a)};_.gC=function yi(){return qd};_.bb=function zi(){return $h(this)};_.hC=function Bi(){return _h(this)};_.cb=function Ci(){return this.f==0?this:new si(-this.f,this.e,this.b)};_.db=function Di(a){return gi(this,a)};_.eb=function Fi(a){return ji(this,a)};_.fb=function Gi(a){return li(this,a)};_.r=function Hi(){return this.f};_.gb=function Ii(a){return mi(this,a)};_.tS=function Ji(){return Hm(this,0)};_.cM={6:1,8:1,10:1,17:1};_.b=null;_.c=-2;_.d=0;_.e=0;_.f=0;var Ih,Jh,Kh,Lh,Mh=null,Nh;_=Pi.prototype=Oi.prototype=Ni.prototype=Gh.prototype=new Hh;_._=function Ri(){return new Pi(this.f<0?new si(1,this.e,this.b):this)};_.hb=function Si(a){return new Pi(fn(this,a))};_.ib=function Ti(a){return new Pi(vn(this,a))};_.jb=function Ui(a){return new Pi(yn(this,a))};_.kb=function Vi(){return rm(this)};_.ab=function Wi(){return sm(this)};_.lb=function Xi(a){return new Pi(Ph(this,a))};_.mb=function Yi(a){return Qh(this,a)};_.nb=function Zi(a){return new Pi(Th(this,a))};_.ob=function $i(a){var b,c,d;c=Uh(this,a);d=lc(Rd,{6:1},4,c.length,0);for(b=0;b<c.length;++b)d[b]=new Pi(c[b]);return d};_.z=function _i(){return _e(Hm(this,0))};_.eQ=function aj(a){return Vh(this,a)};_.pb=function bj(a){return new Pi(Xh(this,a))};_.A=function cj(){return Pk(Hm(this,0))};_.qb=function dj(a){return new Pi(Yh(this,a))};_.gC=function ej(){return Sc};_.bb=function fj(){return $h(this)};_.hC=function gj(){return _h(this)};_.B=function hj(){return Mi(this)};_.rb=function ij(a){return vo(new Pi(this.f<0?new si(1,this.e,this.b):this),a)};_.sb=function jj(){return _e(Hm(this,0))};_.tb=function kj(a){return new Pi(Qh(this,a)==1?this:a)};_.ub=function lj(a){return new Pi(Qh(this,a)==-1?this:a)};_.vb=function mj(a){return new Pi(bi(this,a))};_.wb=function nj(a){return new Pi(ci(this,a))};_.xb=function oj(a,b){return new Pi(di(this,a,b))};_.yb=function pj(a){return new Pi(ei(this,a))};_.cb=function qj(){return new Pi(this.f==0?this:new si(-this.f,this.e,this.b))};_.zb=function rj(){return new Pi(fi(this))};_.Ab=function sj(){return new Pi(En(this))};_.Bb=function tj(a){return new Pi(Fn(this,a))};_.db=function uj(a){return new Pi(gi(this,a))};_.Cb=function vj(a){return new Pi(hi(this,a))};_.Db=function wj(a){return new Pi(ii(this,a))};_.eb=function xj(a){return new Pi(ji(this,a))};_.fb=function yj(a){return new Pi(li(this,a))};_.r=function zj(){return this.f};_.Eb=function Aj(a){return new Pi(rn(this,a))};_.gb=function Bj(a){return mi(this,a)};_.Fb=function Cj(a){var b,c;c=Lj(a);if(c==Lr)b=Hm(this,0);else if(c==ks)b=Fm(this,a[0]);else throw new V('Unknown call signature for result = super.toString: '+c);return b};_.Gb=function Dj(a){return new Pi(Jn(this,a))};_.cM={4:1,6:1,8:1,10:1,17:1,24:1};_=Ij.prototype=Ej.prototype=new H;_.gC=function Kj(){return Rc};var Fj=false;_=Oj.prototype=Nj.prototype=Mj.prototype=new H;_.gC=function Pj(){return Uc};_.Hb=function Qj(){return this.b.b};_.Ib=function Rj(){return new bk(this.b.c)};_.hC=function Sj(){return Vn(this.b)};_.tS=function Tj(){return Wn(this.b)};_.cM={24:1};_.b=null;_=Yj.prototype=Uj.prototype=new H;_.gC=function $j(){return Tc};var Vj=false;_=bk.prototype=ak.prototype=_j.prototype=new H;_.gC=function ck(){return Wc};_.Jb=function dk(){return this.b.b};_.tS=function ek(){return this.b.b};_.cM={5:1,24:1};_.b=null;_=kk.prototype=gk.prototype=new H;_.gC=function lk(){return Vc};var hk=false;_=nk.prototype=mk.prototype=new N;_.gC=function ok(){return Xc};_.cM={6:1,12:1,15:1};_=rk.prototype=qk.prototype=pk.prototype=new N;_.gC=function sk(){return Yc};_.cM={6:1,12:1,15:1};_=wk.prototype=vk.prototype=new H;_.gC=function Bk(){return $c};_.tS=function Ck(){return ((this.c&2)!=0?'interface ':(this.c&1)!=0?Lr:'class ')+this.d};_.b=null;_.c=0;_.d=null;_=Ek.prototype=Dk.prototype=new N;_.gC=function Fk(){return Zc};_.cM={6:1,12:1,15:1};_=Ik.prototype=new H;_.eQ=function Kk(a){return this===a};_.gC=function Lk(){return _c};_.hC=function Mk(){return ob(this)};_.tS=function Nk(){return this.b};_.cM={6:1,8:1,9:1};_.b=null;_.c=0;_=Sk.prototype=Rk.prototype=Qk.prototype=new N;_.gC=function Tk(){return bd};_.cM={6:1,12:1,15:1};_=Wk.prototype=Vk.prototype=Uk.prototype=new N;_.gC=function Xk(){return cd};_.cM={6:1,12:1,15:1};_=kl.prototype=jl.prototype=il.prototype=new N;_.gC=function ll(){return dd};_.cM={6:1,12:1,15:1};var ml;_=pl.prototype=ol.prototype=new Qk;_.gC=function ql(){return ed};_.cM={6:1,12:1,15:1};_=sl.prototype=rl.prototype=new H;_.gC=function tl(){return id};_.tS=function ul(){return this.b+ds+this.d+'(Unknown Source'+(this.c>=0?Qr+this.c:Lr)+')'};_.cM={6:1,13:1};_.b=null;_.c=0;_.d=null;_=String.prototype;_.eQ=function Hl(a){return wl(this,a)};_.gC=function Il(){return md};_.hC=function Jl(){return Rl(this)};_.tS=function Kl(){return this};_.cM={1:1,6:1,7:1,8:1};var Ml,Nl=0,Ol;_=Ul.prototype=Tl.prototype=new H;_.gC=function Vl(){return jd};_.tS=function Wl(){return this.b.b};_.cM={7:1};_=hm.prototype=gm.prototype=fm.prototype=Xl.prototype=new H;_.gC=function im(){return kd};_.tS=function jm(){return this.b.b};_.cM={7:1};_=lm.prototype=km.prototype=new Uk;_.gC=function mm(){return ld};_.cM={6:1,12:1,14:1,15:1};_=pm.prototype=om.prototype=new N;_.gC=function qm(){return od};_.cM={6:1,12:1,15:1};var Cm,Dm;_=Yn.prototype=Xn.prototype=Nn.prototype=new H;_.eQ=function Zn(a){return xc(a,18)&&vc(a,18).b==this.b&&vc(a,18).c==this.c};_.gC=function $n(){return rd};_.hC=function _n(){return Vn(this)};_.tS=function ao(){return Wn(this)};_.cM={6:1,18:1};_.b=0;_.c=null;var On,Pn,Qn,Rn,Sn,Tn;var bo,co,eo,fo;var ro,so,to;_=Ro.prototype=yo.prototype=new Ik;_.gC=function So(){return sd};_.cM={6:1,8:1,9:1,19:1};var zo,Ao,Bo,Co,Do,Eo,Fo,Go,Ho,Io,Jo,Ko,Lo,Mo,No,Oo,Po;var Xo;_=Zo.prototype=new H;_.Kb=function _o(a){throw new pm};_.Lb=function ap(a){var b;b=$o(this.Mb(),a);return !!b};_.gC=function bp(){return td};_.tS=function cp(){var a,b,c,d;c=new Ul;a=null;c.b.b+=Rr;b=this.Mb();while(b.Pb()){a!=null?(cc(c.b,a),c):(a=Is);d=b.Qb();cc(c.b,d===this?'(this Collection)':Lr+d)}c.b.b+=']';return c.b.b};_=ep.prototype=new H;_.eQ=function fp(a){var b,c,d,e,f;if(a===this){return true}if(!xc(a,21)){return false}e=vc(a,21);if(this.e!=e.e){return false}for(c=new Ip((new Cp(e)).b);kq(c.b);){b=vc(lq(c.b),22);d=b.Rb();f=b.Sb();if(!(d==null?this.d:xc(d,1)?Qr+vc(d,1) in this.f:pp(this,d,~~fb(d)))){return false}if(!Xq(f,d==null?this.c:xc(d,1)?op(this,vc(d,1)):np(this,d,~~fb(d)))){return false}}return true};_.gC=function gp(){return Cd};_.hC=function hp(){var a,b,c;c=0;for(b=new Ip((new Cp(this)).b);kq(b.b);){a=vc(lq(b.b),22);c+=a.hC();c=~~c}return c};_.tS=function ip(){var a,b,c,d;d='{';a=false;for(c=new Ip((new Cp(this)).b);kq(c.b);){b=vc(lq(c.b),22);a?(d+=Is):(a=true);d+=Lr+b.Rb();d+=Js;d+=Lr+b.Sb()}return d+'}'};_.cM={21:1};_=dp.prototype=new ep;_.Ob=function vp(a,b){return Ac(a)===Ac(b)||a!=null&&eb(a,b)};_.gC=function wp(){return yd};_.cM={21:1};_.b=null;_.c=null;_.d=false;_.e=0;_.f=null;_=yp.prototype=new Zo;_.eQ=function zp(a){var b,c,d;if(a===this){return true}if(!xc(a,23)){return false}c=vc(a,23);if(c.b.e!=this.Nb()){return false}for(b=new Ip(c.b);kq(b.b);){d=vc(lq(b.b),22);if(!this.Lb(d)){return false}}return true};_.gC=function Ap(){return Dd};_.hC=function Bp(){var a,b,c;a=0;for(b=this.Mb();b.Pb();){c=b.Qb();if(c!=null){a+=fb(c);a=~~a}}return a};_.cM={23:1};_=Cp.prototype=xp.prototype=new yp;_.Lb=function Dp(a){var b,c,d;if(xc(a,22)){b=vc(a,22);c=b.Rb();if(lp(this.b,c)){d=mp(this.b,c);return Eq(b.Sb(),d)}}return false};_.gC=function Ep(){return vd};_.Mb=function Fp(){return new Ip(this.b)};_.Nb=function Gp(){return this.b.e};_.cM={23:1};_.b=null;_=Ip.prototype=Hp.prototype=new H;_.gC=function Jp(){return ud};_.Pb=function Kp(){return kq(this.b)};_.Qb=function Lp(){return vc(lq(this.b),22)};_.b=null;_=Np.prototype=new H;_.eQ=function Op(a){var b;if(xc(a,22)){b=vc(a,22);if(Xq(this.Rb(),b.Rb())&&Xq(this.Sb(),b.Sb())){return true}}return false};_.gC=function Pp(){return Bd};_.hC=function Qp(){var a,b;a=0;b=0;this.Rb()!=null&&(a=fb(this.Rb()));this.Sb()!=null&&(b=fb(this.Sb()));return a^b};_.tS=function Rp(){return this.Rb()+Js+this.Sb()};_.cM={22:1};_=Sp.prototype=Mp.prototype=new Np;_.gC=function Tp(){return wd};_.Rb=function Up(){return null};_.Sb=function Vp(){return this.b.c};_.Tb=function Wp(a){return tp(this.b,a)};_.cM={22:1};_.b=null;_=Yp.prototype=Xp.prototype=new Np;_.gC=function Zp(){return xd};_.Rb=function $p(){return this.b};_.Sb=function _p(){return op(this.c,this.b)};_.Tb=function aq(a){return up(this.c,this.b,a)};_.cM={22:1};_.b=null;_.c=null;_=bq.prototype=new Zo;_.Kb=function cq(a){sq(this,this.Nb(),a);return true};_.eQ=function eq(a){var b,c,d,e,f;if(a===this){return true}if(!xc(a,20)){return false}f=vc(a,20);if(this.Nb()!=f.c){return false}d=new mq(this);e=new mq(f);while(d.b<d.c.c){b=lq(d);c=lq(e);if(!(b==null?c==null:eb(b,c))){return false}}return true};_.gC=function fq(){return Ad};_.hC=function gq(){var a,b,c;b=1;a=new mq(this);while(a.b<a.c.c){c=lq(a);b=31*b+(c==null?0:fb(c));b=~~b}return b};_.Mb=function iq(){return new mq(this)};_.cM={20:1};_=mq.prototype=jq.prototype=new H;_.gC=function nq(){return zd};_.Pb=function oq(){return kq(this)};_.Qb=function pq(){return lq(this)};_.b=0;_.c=null;_=vq.prototype=qq.prototype=new bq;_.Kb=function wq(a){return rq(this,a)};_.Lb=function xq(a){return uq(this,a,0)!=-1};_.gC=function yq(){return Ed};_.Nb=function zq(){return this.c};_.cM={6:1,20:1};_.c=0;_=Fq.prototype=Dq.prototype=new dp;_.gC=function Gq(){return Fd};_.cM={6:1,21:1};_=Iq.prototype=Hq.prototype=new Np;_.gC=function Jq(){return Gd};_.Rb=function Kq(){return this.b};_.Sb=function Lq(){return this.c};_.Tb=function Mq(a){var b;b=this.c;this.c=a;return b};_.cM={22:1};_.b=null;_.c=null;_=Oq.prototype=Nq.prototype=new N;_.gC=function Pq(){return Hd};_.cM={6:1,12:1,15:1};_=Vq.prototype=Qq.prototype=new H;_.gC=function Wq(){return Id};_.b=0;_.c=0;var Rq,Sq,Tq=0;_=Zq.prototype=new H;_.gC=function $q(){return Kd};_=gr.prototype=Yq.prototype=new Zq;_.gC=function hr(){return Jd};var kr;var Jr=mb;var gd=yk(Ms,'Object'),_c=yk(Ms,'Enum'),nd=yk(Ms,'Throwable'),ad=yk(Ms,'Exception'),hd=yk(Ms,'RuntimeException'),Fc=yk(Ns,'JavaScriptException'),Gc=yk(Ns,'JavaScriptObject$'),Hc=yk(Ns,'Scheduler'),Ec=Ak('int'),Od=xk(Lr,'[I',Ec),Td=xk(Os,'Object;',gd),Ld=Ak('boolean'),Zd=xk(Lr,'[Z',Ld),Ic=yk(Ps,'SchedulerImpl'),Lc=yk(Ps,'StackTraceCreator$Collector'),id=yk(Ms,'StackTraceElement'),Ud=xk(Os,'StackTraceElement;',id),Kc=yk(Ps,'StackTraceCreator$CollectorMoz'),Jc=yk(Ps,'StackTraceCreator$CollectorChrome'),Nc=yk(Ps,'StringBufferImpl'),Mc=yk(Ps,'StringBufferImplAppend'),md=yk(Ms,Nr),Vd=xk(Os,'String;',md),Oc=yk('com.google.gwt.lang.','LongLibBase$LongEmul'),Pd=xk('[Lcom.google.gwt.lang.','LongLibBase$LongEmul;',Oc),fd=yk(Ms,'Number'),pd=yk(Qs,ps),Qc=yk(Rs,ps),Qd=xk(Ss,Ts,Qc),Pc=yk(Rs,'BigDecimalExporterImpl'),qd=yk(Qs,is),Sc=yk(Rs,is),Rd=xk(Ss,Us,Sc),Rc=yk(Rs,'BigIntegerExporterImpl'),Uc=yk(Rs,os),Tc=yk(Rs,'MathContextExporterImpl'),Wc=yk(Rs,xs),Sd=xk(Ss,Vs,Wc),Vc=yk(Rs,'RoundingModeExporterImpl'),Xc=yk(Ms,'ArithmeticException'),cd=yk(Ms,'IndexOutOfBoundsException'),Yc=yk(Ms,'ArrayStoreException'),Cc=Ak('char'),Md=xk(Lr,'[C',Cc),$c=yk(Ms,'Class'),Zc=yk(Ms,'ClassCastException'),bd=yk(Ms,'IllegalArgumentException'),dd=yk(Ms,'NullPointerException'),ed=yk(Ms,'NumberFormatException'),jd=yk(Ms,'StringBuffer'),kd=yk(Ms,'StringBuilder'),ld=yk(Ms,'StringIndexOutOfBoundsException'),od=yk(Ms,'UnsupportedOperationException'),Wd=xk(Ws,Ts,pd),Dc=Ak('double'),Nd=xk(Lr,'[D',Dc),Xd=xk(Ws,Us,qd),rd=yk(Qs,os),sd=zk(Qs,xs,Wo),Yd=xk(Ws,Vs,sd),td=yk(Xs,'AbstractCollection'),Cd=yk(Xs,'AbstractMap'),yd=yk(Xs,'AbstractHashMap'),Dd=yk(Xs,'AbstractSet'),vd=yk(Xs,'AbstractHashMap$EntrySet'),ud=yk(Xs,'AbstractHashMap$EntrySetIterator'),Bd=yk(Xs,'AbstractMapEntry'),wd=yk(Xs,'AbstractHashMap$MapEntryNull'),xd=yk(Xs,'AbstractHashMap$MapEntryString'),Ad=yk(Xs,'AbstractList'),zd=yk(Xs,'AbstractList$IteratorImpl'),Ed=yk(Xs,'ArrayList'),Fd=yk(Xs,'HashMap'),Gd=yk(Xs,'MapEntryImpl'),Hd=yk(Xs,'NoSuchElementException'),Id=yk(Xs,'Random'),Kd=yk(Ys,'ExporterBaseImpl'),Jd=yk(Ys,'ExporterBaseActual');$stats && $stats({moduleName:'gwtapp',sessionId:$sessionId,subSystem:'startup',evtGroup:'moduleStartup',millis:(new Date()).getTime(),type:'moduleEvalEnd'});if (gwtapp && gwtapp.onScriptLoad)gwtapp.onScriptLoad(gwtOnLoad);
+gwtOnLoad(null, 'ModuleName', 'moduleBase');
+})();
+
+exports.RoundingMode = window.bigdecimal.RoundingMode;
+exports.MathContext = window.bigdecimal.MathContext;
+
+fix_and_export('BigDecimal');
+fix_and_export('BigInteger');
+
+// This is an unfortunate kludge because Java methods and constructors cannot accept vararg parameters.
+function fix_and_export(class_name) {
+  var Src = window.bigdecimal[class_name];
+  var Fixed = Src;
+  if(Src.__init__) {
+    Fixed = function wrap_constructor() {
+      var args = Array.prototype.slice.call(arguments);
+      return Src.__init__(args);
+    };
+
+    Fixed.prototype = Src.prototype;
+
+    for (var a in Src)
+      if(Src.hasOwnProperty(a)) {
+        if((typeof Src[a] != 'function') || !a.match(/_va$/))
+          Fixed[a] = Src[a];
+        else {
+          var pub_name = a.replace(/_va$/, '');
+          Fixed[pub_name] = function wrap_classmeth () {
+            var args = Array.prototype.slice.call(arguments);
+            return wrap_classmeth.inner_method(args);
+          };
+          Fixed[pub_name].inner_method = Src[a];
+        }
+      }
+
+  }
+
+  var proto = Fixed.prototype;
+  for (var a in proto) {
+    if(proto.hasOwnProperty(a) && (typeof proto[a] == 'function') && a.match(/_va$/)) {
+      var pub_name = a.replace(/_va$/, '');
+      proto[pub_name] = function wrap_meth() {
+        var args = Array.prototype.slice.call(arguments);
+        return wrap_meth.inner_method.apply(this, [args]);
+      };
+      proto[pub_name].inner_method = proto[a];
+      delete proto[a];
+    }
+  }
+
+  exports[class_name] = Fixed;
+}
+
+})(typeof exports !== 'undefined' ? exports : (typeof window !== 'undefined' ? window : {}));
Binary files 1.3.0+dfsg-1/perf/lib/bigdecimal_GWT/BigDecTest.class and 8.0.2+ds-1/perf/lib/bigdecimal_GWT/BigDecTest.class differ
diff -pruN 1.3.0+dfsg-1/perf/lib/bigdecimal_GWT/BigDecTest.java 8.0.2+ds-1/perf/lib/bigdecimal_GWT/BigDecTest.java
--- 1.3.0+dfsg-1/perf/lib/bigdecimal_GWT/BigDecTest.java	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/perf/lib/bigdecimal_GWT/BigDecTest.java	2019-01-13 22:17:07.000000000 +0000
@@ -0,0 +1,60 @@
+// javac BigDecTest.java
+// java BigDecTest
+
+import java.math.BigDecimal;
+
+public class BigDecTest
+{
+    public static void main(String[] args) {
+
+    	int i;
+    	BigDecimal x, y, r;
+
+        // remainder
+
+    	x = new BigDecimal("9.785496E-2");
+    	y = new BigDecimal("-5.9219189762E-2");
+    	r = x.remainder(y);
+        System.out.println( r.toString() );
+    	// 0.038635770238
+
+        
+    	x = new BigDecimal("1.23693014661017964112E-5");
+    	y = new BigDecimal("-6.9318042E-7");
+    	r = x.remainder(y);
+    	System.out.println( r.toPlainString() );
+    	// 0.0000005852343261017964112
+
+        
+        // divide
+
+    	x = new BigDecimal("6.9609119610E-78");
+        y = new BigDecimal("4E-48");
+    	r = x.divide(y, 40, 6);                     // ROUND_HALF_EVEN
+    	System.out.println( r.toString() );
+    	// 1.7402279902E-30
+
+        
+        x = new BigDecimal("5.383458817E-83");
+        y = new BigDecimal("8E-54");
+        r = x.divide(y, 40, 6);
+        System.out.println( r.toString() );
+        // 6.7293235212E-30
+
+        
+        // compareTo
+
+    	x = new BigDecimal("0.04");
+        y = new BigDecimal("0.079393068");
+    	i = x.compareTo(y);
+    	System.out.println(i);
+    	// -1
+
+    	x = new BigDecimal("7.88749578569876987785987658649E-10");
+        y = new BigDecimal("4.2545098709E-6");
+    	i = x.compareTo(y);
+    	System.out.println(i);
+    	// -1
+    }
+}
+
diff -pruN 1.3.0+dfsg-1/perf/lib/bigdecimal_GWT/bugs.js 8.0.2+ds-1/perf/lib/bigdecimal_GWT/bugs.js
--- 1.3.0+dfsg-1/perf/lib/bigdecimal_GWT/bugs.js	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/perf/lib/bigdecimal_GWT/bugs.js	2019-01-13 22:17:07.000000000 +0000
@@ -0,0 +1,53 @@
+// node bugs
+// Compare with BigDecTest.java
+
+var i, x, y, r,
+    BigDecimal = require('./bigdecimal').BigDecimal;
+
+// remainder
+
+x = new BigDecimal("9.785496E-2");
+y = new BigDecimal("-5.9219189762E-2");
+r = x.remainder(y);
+console.log( r.toString() );
+//           0.09785496
+// Should be 0.038635770238
+
+x = new BigDecimal("1.23693014661017964112E-5");
+y = new BigDecimal("-6.9318042E-7");
+r = x.remainder(y);
+console.log( r.toPlainString() );
+//           0.0000123693014661017964112
+// Should be 0.0000005852343261017964112
+
+ // divide
+
+x = new BigDecimal("6.9609119610E-78");
+y = new BigDecimal("4E-48");
+r = x.divide(y, 40, 6);               // ROUND_HALF_EVEN
+console.log( r.toString() );
+//           1.7402279903E-30
+// Should be 1.7402279902E-30
+
+x = new BigDecimal("5.383458817E-83");
+y = new BigDecimal("8E-54");
+r = x.divide(y, 40, 6);
+console.log( r.toString() );
+//           6.7293235213E-30
+// Should be 6.7293235212E-30
+
+ // compareTo
+
+x = new BigDecimal("0.04");
+y = new BigDecimal("0.079393068");
+i = x.compareTo(y);
+console.log(i);
+//            1
+// Should be -1
+
+x = new BigDecimal("7.88749578569876987785987658649E-10");
+y = new BigDecimal("4.2545098709E-6");
+i = x.compareTo(y);
+console.log(i);
+//            1
+// Should be -1
\ No newline at end of file
diff -pruN 1.3.0+dfsg-1/perf/lib/bigdecimal_GWT/LICENCE.txt 8.0.2+ds-1/perf/lib/bigdecimal_GWT/LICENCE.txt
--- 1.3.0+dfsg-1/perf/lib/bigdecimal_GWT/LICENCE.txt	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/perf/lib/bigdecimal_GWT/LICENCE.txt	2019-01-13 22:17:07.000000000 +0000
@@ -0,0 +1,205 @@
+https://github.com/iriscouch/bigdecimal.js
+
+BigDecimal for Javascript is licensed under the Apache License, version 2.0:
+
+                             Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
\ No newline at end of file
diff -pruN 1.3.0+dfsg-1/perf/lib/bigdecimal_ICU4J/BigDecimal-all-last.js 8.0.2+ds-1/perf/lib/bigdecimal_ICU4J/BigDecimal-all-last.js
--- 1.3.0+dfsg-1/perf/lib/bigdecimal_ICU4J/BigDecimal-all-last.js	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/perf/lib/bigdecimal_ICU4J/BigDecimal-all-last.js	2019-01-13 22:17:07.000000000 +0000
@@ -0,0 +1,5724 @@
+/** @license Copyright (c) 2012 Daniel Trebbien and other contributors
+Portions Copyright (c) 2003 STZ-IDA and PTV AG, Karlsruhe, Germany
+Portions Copyright (c) 1995-2001 International Business Machines Corporation and others
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder.
+*/
+(function () {
+
+var MathContext = (function () {
+/* Generated from 'MathContext.nrx' 8 Sep 2000 11:07:48 [v2.00] */
+/* Options: Binary Comments Crossref Format Java Logo Strictargs Strictcase Trace2 Verbose3 */
+//--package com.ibm.icu.math;
+
+/* ------------------------------------------------------------------ */
+/* MathContext -- Math context settings                               */
+/* ------------------------------------------------------------------ */
+/* Copyright IBM Corporation, 1997, 2000.  All Rights Reserved.       */
+/*                                                                    */
+/*   The MathContext object encapsulates the settings used by the     */
+/*   BigDecimal class; it could also be used by other arithmetics.    */
+/* ------------------------------------------------------------------ */
+/* Notes:                                                             */
+/*                                                                    */
+/* 1. The properties are checked for validity on construction, so     */
+/*    the BigDecimal class may assume that they are correct.          */
+/* ------------------------------------------------------------------ */
+/* Author:    Mike Cowlishaw                                          */
+/* 1997.09.03 Initial version (edited from netrexx.lang.RexxSet)      */
+/* 1997.09.12 Add lostDigits property                                 */
+/* 1998.05.02 Make the class immutable and final; drop set methods    */
+/* 1998.06.05 Add Round (rounding modes) property                     */
+/* 1998.06.25 Rename from DecimalContext; allow digits=0              */
+/* 1998.10.12 change to com.ibm.icu.math package                          */
+/* 1999.02.06 add javadoc comments                                    */
+/* 1999.03.05 simplify; changes from discussion with J. Bloch         */
+/* 1999.03.13 1.00 release to IBM Centre for Java Technology          */
+/* 1999.07.10 1.04 flag serialization unused                          */
+/* 2000.01.01 1.06 copyright update                                   */
+/* ------------------------------------------------------------------ */
+
+
+/* JavaScript conversion (c) 2003 STZ-IDA and PTV AG, Karlsruhe, Germany */
+
+
+
+/**
+ * The <code>MathContext</code> immutable class encapsulates the
+ * settings understood by the operator methods of the {@link BigDecimal}
+ * class (and potentially other classes).  Operator methods are those
+ * that effect an operation on a number or a pair of numbers.
+ * <p>
+ * The settings, which are not base-dependent, comprise:
+ * <ol>
+ * <li><code>digits</code>:
+ * the number of digits (precision) to be used for an operation
+ * <li><code>form</code>:
+ * the form of any exponent that results from the operation
+ * <li><code>lostDigits</code>:
+ * whether checking for lost digits is enabled
+ * <li><code>roundingMode</code>:
+ * the algorithm to be used for rounding.
+ * </ol>
+ * <p>
+ * When provided, a <code>MathContext</code> object supplies the
+ * settings for an operation directly.
+ * <p>
+ * When <code>MathContext.DEFAULT</code> is provided for a
+ * <code>MathContext</code> parameter then the default settings are used
+ * (<code>9, SCIENTIFIC, false, ROUND_HALF_UP</code>).
+ * <p>
+ * In the <code>BigDecimal</code> class, all methods which accept a
+ * <code>MathContext</code> object defaults) also have a version of the
+ * method which does not accept a MathContext parameter.  These versions
+ * carry out unlimited precision fixed point arithmetic (as though the
+ * settings were (<code>0, PLAIN, false, ROUND_HALF_UP</code>).
+ * <p>
+ * The instance variables are shared with default access (so they are
+ * directly accessible to the <code>BigDecimal</code> class), but must
+ * never be changed.
+ * <p>
+ * The rounding mode constants have the same names and values as the
+ * constants of the same name in <code>java.math.BigDecimal</code>, to
+ * maintain compatibility with earlier versions of
+ * <code>BigDecimal</code>.
+ *
+ * @see     BigDecimal
+ * @author  Mike Cowlishaw
+ * @stable ICU 2.0
+ */
+
+//--public final class MathContext implements java.io.Serializable{
+ //--private static final java.lang.String $0="MathContext.nrx";
+
+ //-- methods
+ MathContext.prototype.getDigits = getDigits;
+ MathContext.prototype.getForm = getForm;
+ MathContext.prototype.getLostDigits = getLostDigits;
+ MathContext.prototype.getRoundingMode = getRoundingMode;
+ MathContext.prototype.toString = toString;
+ MathContext.prototype.isValidRound = isValidRound;
+
+
+ /* ----- Properties ----- */
+ /* properties public constant */
+ /**
+  * Plain (fixed point) notation, without any exponent.
+  * Used as a setting to control the form of the result of a
+  * <code>BigDecimal</code> operation.
+  * A zero result in plain form may have a decimal part of one or
+  * more zeros.
+  *
+  * @see #ENGINEERING
+  * @see #SCIENTIFIC
+  * @stable ICU 2.0
+  */
+ //--public static final int PLAIN=0; // [no exponent]
+ MathContext.PLAIN = MathContext.prototype.PLAIN = 0; // [no exponent]
+
+ /**
+  * Standard floating point notation (with scientific exponential
+  * format, where there is one digit before any decimal point).
+  * Used as a setting to control the form of the result of a
+  * <code>BigDecimal</code> operation.
+  * A zero result in plain form may have a decimal part of one or
+  * more zeros.
+  *
+  * @see #ENGINEERING
+  * @see #PLAIN
+  * @stable ICU 2.0
+  */
+ //--public static final int SCIENTIFIC=1; // 1 digit before .
+ MathContext.SCIENTIFIC = MathContext.prototype.SCIENTIFIC = 1; // 1 digit before .
+
+ /**
+  * Standard floating point notation (with engineering exponential
+  * format, where the power of ten is a multiple of 3).
+  * Used as a setting to control the form of the result of a
+  * <code>BigDecimal</code> operation.
+  * A zero result in plain form may have a decimal part of one or
+  * more zeros.
+  *
+  * @see #PLAIN
+  * @see #SCIENTIFIC
+  * @stable ICU 2.0
+  */
+ //--public static final int ENGINEERING=2; // 1-3 digits before .
+ MathContext.ENGINEERING = MathContext.prototype.ENGINEERING = 2; // 1-3 digits before .
+
+ // The rounding modes match the original BigDecimal class values
+ /**
+  * Rounding mode to round to a more positive number.
+  * Used as a setting to control the rounding mode used during a
+  * <code>BigDecimal</code> operation.
+  * <p>
+  * If any of the discarded digits are non-zero then the result
+  * should be rounded towards the next more positive digit.
+  * @stable ICU 2.0
+  */
+ //--public static final int ROUND_CEILING=2;
+ MathContext.ROUND_CEILING = MathContext.prototype.ROUND_CEILING = 2;
+
+ /**
+  * Rounding mode to round towards zero.
+  * Used as a setting to control the rounding mode used during a
+  * <code>BigDecimal</code> operation.
+  * <p>
+  * All discarded digits are ignored (truncated).  The result is
+  * neither incremented nor decremented.
+  * @stable ICU 2.0
+  */
+ //--public static final int ROUND_DOWN=1;
+ MathContext.ROUND_DOWN = MathContext.prototype.ROUND_DOWN = 1;
+
+ /**
+  * Rounding mode to round to a more negative number.
+  * Used as a setting to control the rounding mode used during a
+  * <code>BigDecimal</code> operation.
+  * <p>
+  * If any of the discarded digits are non-zero then the result
+  * should be rounded towards the next more negative digit.
+  * @stable ICU 2.0
+  */
+ //--public static final int ROUND_FLOOR=3;
+ MathContext.ROUND_FLOOR = MathContext.prototype.ROUND_FLOOR = 3;
+
+ /**
+  * Rounding mode to round to nearest neighbor, where an equidistant
+  * value is rounded down.
+  * Used as a setting to control the rounding mode used during a
+  * <code>BigDecimal</code> operation.
+  * <p>
+  * If the discarded digits represent greater than half (0.5 times)
+  * the value of a one in the next position then the result should be
+  * rounded up (away from zero).  Otherwise the discarded digits are
+  * ignored.
+  * @stable ICU 2.0
+  */
+ //--public static final int ROUND_HALF_DOWN=5;
+ MathContext.ROUND_HALF_DOWN = MathContext.prototype.ROUND_HALF_DOWN = 5;
+
+ /**
+  * Rounding mode to round to nearest neighbor, where an equidistant
+  * value is rounded to the nearest even neighbor.
+  * Used as a setting to control the rounding mode used during a
+  * <code>BigDecimal</code> operation.
+  * <p>
+  * If the discarded digits represent greater than half (0.5 times)
+  * the value of a one in the next position then the result should be
+  * rounded up (away from zero).  If they represent less than half,
+  * then the result should be rounded down.
+  * <p>
+  * Otherwise (they represent exactly half) the result is rounded
+  * down if its rightmost digit is even, or rounded up if its
+  * rightmost digit is odd (to make an even digit).
+  * @stable ICU 2.0
+  */
+ //--public static final int ROUND_HALF_EVEN=6;
+ MathContext.ROUND_HALF_EVEN = MathContext.prototype.ROUND_HALF_EVEN = 6;
+
+ /**
+  * Rounding mode to round to nearest neighbor, where an equidistant
+  * value is rounded up.
+  * Used as a setting to control the rounding mode used during a
+  * <code>BigDecimal</code> operation.
+  * <p>
+  * If the discarded digits represent greater than or equal to half
+  * (0.5 times) the value of a one in the next position then the result
+  * should be rounded up (away from zero).  Otherwise the discarded
+  * digits are ignored.
+  * @stable ICU 2.0
+  */
+ //--public static final int ROUND_HALF_UP=4;
+ MathContext.ROUND_HALF_UP = MathContext.prototype.ROUND_HALF_UP = 4;
+
+ /**
+  * Rounding mode to assert that no rounding is necessary.
+  * Used as a setting to control the rounding mode used during a
+  * <code>BigDecimal</code> operation.
+  * <p>
+  * Rounding (potential loss of information) is not permitted.
+  * If any of the discarded digits are non-zero then an
+  * <code>ArithmeticException</code> should be thrown.
+  * @stable ICU 2.0
+  */
+ //--public static final int ROUND_UNNECESSARY=7;
+ MathContext.ROUND_UNNECESSARY = MathContext.prototype.ROUND_UNNECESSARY = 7;
+
+ /**
+  * Rounding mode to round away from zero.
+  * Used as a setting to control the rounding mode used during a
+  * <code>BigDecimal</code> operation.
+  * <p>
+  * If any of the discarded digits are non-zero then the result will
+  * be rounded up (away from zero).
+  * @stable ICU 2.0
+  */
+ //--public static final int ROUND_UP=0;
+ MathContext.ROUND_UP = MathContext.prototype.ROUND_UP = 0;
+
+
+ /* properties shared */
+ /**
+  * The number of digits (precision) to be used for an operation.
+  * A value of 0 indicates that unlimited precision (as many digits
+  * as are required) will be used.
+  * <p>
+  * The {@link BigDecimal} operator methods use this value to
+  * determine the precision of results.
+  * Note that leading zeros (in the integer part of a number) are
+  * never significant.
+  * <p>
+  * <code>digits</code> will always be non-negative.
+  *
+  * @serial
+  */
+ //--int digits;
+
+ /**
+  * The form of results from an operation.
+  * <p>
+  * The {@link BigDecimal} operator methods use this value to
+  * determine the form of results, in particular whether and how
+  * exponential notation should be used.
+  *
+  * @see #ENGINEERING
+  * @see #PLAIN
+  * @see #SCIENTIFIC
+  * @serial
+  */
+ //--int form; // values for this must fit in a byte
+
+ /**
+  * Controls whether lost digits checking is enabled for an
+  * operation.
+  * Set to <code>true</code> to enable checking, or
+  * to <code>false</code> to disable checking.
+  * <p>
+  * When enabled, the {@link BigDecimal} operator methods check
+  * the precision of their operand or operands, and throw an
+  * <code>ArithmeticException</code> if an operand is more precise
+  * than the digits setting (that is, digits would be lost).
+  * When disabled, operands are rounded to the specified digits.
+  *
+  * @serial
+  */
+ //--boolean lostDigits;
+
+ /**
+  * The rounding algorithm to be used for an operation.
+  * <p>
+  * The {@link BigDecimal} operator methods use this value to
+  * determine the algorithm to be used when non-zero digits have to
+  * be discarded in order to reduce the precision of a result.
+  * The value must be one of the public constants whose name starts
+  * with <code>ROUND_</code>.
+  *
+  * @see #ROUND_CEILING
+  * @see #ROUND_DOWN
+  * @see #ROUND_FLOOR
+  * @see #ROUND_HALF_DOWN
+  * @see #ROUND_HALF_EVEN
+  * @see #ROUND_HALF_UP
+  * @see #ROUND_UNNECESSARY
+  * @see #ROUND_UP
+  * @serial
+  */
+ //--int roundingMode;
+
+ /* properties private constant */
+ // default settings
+ //--private static final int DEFAULT_FORM=SCIENTIFIC;
+ //--private static final int DEFAULT_DIGITS=9;
+ //--private static final boolean DEFAULT_LOSTDIGITS=false;
+ //--private static final int DEFAULT_ROUNDINGMODE=ROUND_HALF_UP;
+ MathContext.prototype.DEFAULT_FORM=MathContext.prototype.SCIENTIFIC;
+ MathContext.prototype.DEFAULT_DIGITS=9;
+ MathContext.prototype.DEFAULT_LOSTDIGITS=false;
+ MathContext.prototype.DEFAULT_ROUNDINGMODE=MathContext.prototype.ROUND_HALF_UP;
+
+ /* properties private constant */
+
+ //--private static final int MIN_DIGITS=0; // smallest value for DIGITS.
+ //--private static final int MAX_DIGITS=999999999; // largest value for DIGITS.  If increased,
+ MathContext.prototype.MIN_DIGITS=0; // smallest value for DIGITS.
+ MathContext.prototype.MAX_DIGITS=999999999; // largest value for DIGITS.  If increased,
+ // the BigDecimal class may need update.
+ // list of valid rounding mode values, most common two first
+ //--private static final int ROUNDS[]=new int[]{ROUND_HALF_UP,ROUND_UNNECESSARY,ROUND_CEILING,ROUND_DOWN,ROUND_FLOOR,ROUND_HALF_DOWN,ROUND_HALF_EVEN,ROUND_UP};
+ MathContext.prototype.ROUNDS=new Array(MathContext.prototype.ROUND_HALF_UP,MathContext.prototype.ROUND_UNNECESSARY,MathContext.prototype.ROUND_CEILING,MathContext.prototype.ROUND_DOWN,MathContext.prototype.ROUND_FLOOR,MathContext.prototype.ROUND_HALF_DOWN,MathContext.prototype.ROUND_HALF_EVEN,MathContext.prototype.ROUND_UP);
+
+
+ //--private static final java.lang.String ROUNDWORDS[]=new java.lang.String[]{"ROUND_HALF_UP","ROUND_UNNECESSARY","ROUND_CEILING","ROUND_DOWN","ROUND_FLOOR","ROUND_HALF_DOWN","ROUND_HALF_EVEN","ROUND_UP"}; // matching names of the ROUNDS values
+ MathContext.prototype.ROUNDWORDS=new Array("ROUND_HALF_UP","ROUND_UNNECESSARY","ROUND_CEILING","ROUND_DOWN","ROUND_FLOOR","ROUND_HALF_DOWN","ROUND_HALF_EVEN","ROUND_UP"); // matching names of the ROUNDS values
+
+
+
+
+ /* properties private constant unused */
+
+ // Serialization version
+ //--private static final long serialVersionUID=7163376998892515376L;
+
+ /* properties public constant */
+ /**
+  * A <code>MathContext</code> object initialized to the default
+  * settings for general-purpose arithmetic.  That is,
+  * <code>digits=9 form=SCIENTIFIC lostDigits=false
+  * roundingMode=ROUND_HALF_UP</code>.
+  *
+  * @see #SCIENTIFIC
+  * @see #ROUND_HALF_UP
+  * @stable ICU 2.0
+  */
+ //--public static final com.ibm.icu.math.MathContext DEFAULT=new com.ibm.icu.math.MathContext(DEFAULT_DIGITS,DEFAULT_FORM,DEFAULT_LOSTDIGITS,DEFAULT_ROUNDINGMODE);
+ MathContext.prototype.DEFAULT=new MathContext(MathContext.prototype.DEFAULT_DIGITS,MathContext.prototype.DEFAULT_FORM,MathContext.prototype.DEFAULT_LOSTDIGITS,MathContext.prototype.DEFAULT_ROUNDINGMODE);
+
+
+
+
+ /* ----- Constructors ----- */
+
+ /**
+  * Constructs a new <code>MathContext</code> with a specified
+  * precision.
+  * The other settings are set to the default values
+  * (see {@link #DEFAULT}).
+  *
+  * An <code>IllegalArgumentException</code> is thrown if the
+  * <code>setdigits</code> parameter is out of range
+  * (&lt;0 or &gt;999999999).
+  *
+  * @param setdigits     The <code>int</code> digits setting
+  *                      for this <code>MathContext</code>.
+  * @throws IllegalArgumentException parameter out of range.
+  * @stable ICU 2.0
+  */
+
+ //--public MathContext(int setdigits){
+ //-- this(setdigits,DEFAULT_FORM,DEFAULT_LOSTDIGITS,DEFAULT_ROUNDINGMODE);
+ //-- return;}
+
+
+ /**
+  * Constructs a new <code>MathContext</code> with a specified
+  * precision and form.
+  * The other settings are set to the default values
+  * (see {@link #DEFAULT}).
+  *
+  * An <code>IllegalArgumentException</code> is thrown if the
+  * <code>setdigits</code> parameter is out of range
+  * (&lt;0 or &gt;999999999), or if the value given for the
+  * <code>setform</code> parameter is not one of the appropriate
+  * constants.
+  *
+  * @param setdigits     The <code>int</code> digits setting
+  *                      for this <code>MathContext</code>.
+  * @param setform       The <code>int</code> form setting
+  *                      for this <code>MathContext</code>.
+  * @throws IllegalArgumentException parameter out of range.
+  * @stable ICU 2.0
+  */
+
+ //--public MathContext(int setdigits,int setform){
+ //-- this(setdigits,setform,DEFAULT_LOSTDIGITS,DEFAULT_ROUNDINGMODE);
+ //-- return;}
+
+ /**
+  * Constructs a new <code>MathContext</code> with a specified
+  * precision, form, and lostDigits setting.
+  * The roundingMode setting is set to its default value
+  * (see {@link #DEFAULT}).
+  *
+  * An <code>IllegalArgumentException</code> is thrown if the
+  * <code>setdigits</code> parameter is out of range
+  * (&lt;0 or &gt;999999999), or if the value given for the
+  * <code>setform</code> parameter is not one of the appropriate
+  * constants.
+  *
+  * @param setdigits     The <code>int</code> digits setting
+  *                      for this <code>MathContext</code>.
+  * @param setform       The <code>int</code> form setting
+  *                      for this <code>MathContext</code>.
+  * @param setlostdigits The <code>boolean</code> lostDigits
+  *                      setting for this <code>MathContext</code>.
+  * @throws IllegalArgumentException parameter out of range.
+  * @stable ICU 2.0
+  */
+
+ //--public MathContext(int setdigits,int setform,boolean setlostdigits){
+ //-- this(setdigits,setform,setlostdigits,DEFAULT_ROUNDINGMODE);
+ //-- return;}
+
+ /**
+  * Constructs a new <code>MathContext</code> with a specified
+  * precision, form, lostDigits, and roundingMode setting.
+  *
+  * An <code>IllegalArgumentException</code> is thrown if the
+  * <code>setdigits</code> parameter is out of range
+  * (&lt;0 or &gt;999999999), or if the value given for the
+  * <code>setform</code> or <code>setroundingmode</code> parameters is
+  * not one of the appropriate constants.
+  *
+  * @param setdigits       The <code>int</code> digits setting
+  *                        for this <code>MathContext</code>.
+  * @param setform         The <code>int</code> form setting
+  *                        for this <code>MathContext</code>.
+  * @param setlostdigits   The <code>boolean</code> lostDigits
+  *                        setting for this <code>MathContext</code>.
+  * @param setroundingmode The <code>int</code> roundingMode setting
+  *                        for this <code>MathContext</code>.
+  * @throws IllegalArgumentException parameter out of range.
+  * @stable ICU 2.0
+  */
+
+ //--public MathContext(int setdigits,int setform,boolean setlostdigits,int setroundingmode){super();
+ function MathContext() {
+  //-- members
+  this.digits = 0;
+  this.form = 0; // values for this must fit in a byte
+  this.lostDigits = false;
+  this.roundingMode = 0;
+
+  //-- overloaded ctor
+  var setform = this.DEFAULT_FORM;
+  var setlostdigits = this.DEFAULT_LOSTDIGITS;
+  var setroundingmode = this.DEFAULT_ROUNDINGMODE;
+  if (MathContext.arguments.length == 4)
+   {
+    setform = MathContext.arguments[1];
+    setlostdigits = MathContext.arguments[2];
+    setroundingmode = MathContext.arguments[3];
+   }
+  else if (MathContext.arguments.length == 3)
+   {
+    setform = MathContext.arguments[1];
+    setlostdigits = MathContext.arguments[2];
+   }
+  else if (MathContext.arguments.length == 2)
+   {
+    setform = MathContext.arguments[1];
+   }
+  else if (MathContext.arguments.length != 1)
+   {
+    throw "MathContext(): " + MathContext.arguments.length + " arguments given; expected 1 to 4";
+   }
+  var setdigits = MathContext.arguments[0];
+
+
+  // set values, after checking
+  if (setdigits!=this.DEFAULT_DIGITS)
+   {
+    if (setdigits<this.MIN_DIGITS)
+     throw "MathContext(): Digits too small: "+setdigits;
+    if (setdigits>this.MAX_DIGITS)
+     throw "MathContext(): Digits too large: "+setdigits;
+   }
+  {/*select*/
+  if (setform==this.SCIENTIFIC)
+   {} // [most common]
+  else if (setform==this.ENGINEERING)
+   {}
+  else if (setform==this.PLAIN)
+   {}
+  else{
+   throw "MathContext() Bad form value: "+setform;
+  }
+  }
+  if ((!(this.isValidRound(setroundingmode))))
+   throw "MathContext(): Bad roundingMode value: "+setroundingmode;
+  this.digits=setdigits;
+  this.form=setform;
+  this.lostDigits=setlostdigits; // [no bad value possible]
+  this.roundingMode=setroundingmode;
+  return;}
+
+ /**
+  * Returns the digits setting.
+  * This value is always non-negative.
+  *
+  * @return an <code>int</code> which is the value of the digits
+  *         setting
+  * @stable ICU 2.0
+  */
+
+ //--public int getDigits(){
+ function getDigits() {
+  return this.digits;
+  }
+
+ /**
+  * Returns the form setting.
+  * This will be one of
+  * {@link #ENGINEERING},
+  * {@link #PLAIN}, or
+  * {@link #SCIENTIFIC}.
+  *
+  * @return an <code>int</code> which is the value of the form setting
+  * @stable ICU 2.0
+  */
+
+ //--public int getForm(){
+ function getForm() {
+  return this.form;
+  }
+
+ /**
+  * Returns the lostDigits setting.
+  * This will be either <code>true</code> (enabled) or
+  * <code>false</code> (disabled).
+  *
+  * @return a <code>boolean</code> which is the value of the lostDigits
+  *           setting
+  * @stable ICU 2.0
+  */
+
+ //--public boolean getLostDigits(){
+ function getLostDigits() {
+  return this.lostDigits;
+  }
+
+ /**
+  * Returns the roundingMode setting.
+  * This will be one of
+  * {@link  #ROUND_CEILING},
+  * {@link  #ROUND_DOWN},
+  * {@link  #ROUND_FLOOR},
+  * {@link  #ROUND_HALF_DOWN},
+  * {@link  #ROUND_HALF_EVEN},
+  * {@link  #ROUND_HALF_UP},
+  * {@link  #ROUND_UNNECESSARY}, or
+  * {@link  #ROUND_UP}.
+  *
+  * @return an <code>int</code> which is the value of the roundingMode
+  *         setting
+  * @stable ICU 2.0
+  */
+
+ //--public int getRoundingMode(){
+ function getRoundingMode() {
+  return this.roundingMode;
+  }
+
+ /** Returns the <code>MathContext</code> as a readable string.
+  * The <code>String</code> returned represents the settings of the
+  * <code>MathContext</code> object as four blank-delimited words
+  * separated by a single blank and with no leading or trailing blanks,
+  * as follows:
+  * <ol>
+  * <li>
+  * <code>digits=</code>, immediately followed by
+  * the value of the digits setting as a numeric word.
+  * <li>
+  * <code>form=</code>, immediately followed by
+  * the value of the form setting as an uppercase word
+  * (one of <code>SCIENTIFIC</code>, <code>PLAIN</code>, or
+  * <code>ENGINEERING</code>).
+  * <li>
+  * <code>lostDigits=</code>, immediately followed by
+  * the value of the lostDigits setting
+  * (<code>1</code> if enabled, <code>0</code> if disabled).
+  * <li>
+  * <code>roundingMode=</code>, immediately followed by
+  * the value of the roundingMode setting as a word.
+  * This word will be the same as the name of the corresponding public
+  * constant.
+  * </ol>
+  * <p>
+  * For example:
+  * <br><code>
+  * digits=9 form=SCIENTIFIC lostDigits=0 roundingMode=ROUND_HALF_UP
+  * </code>
+  * <p>
+  * Additional words may be appended to the result of
+  * <code>toString</code> in the future if more properties are added
+  * to the class.
+  *
+  * @return a <code>String</code> representing the context settings.
+  * @stable ICU 2.0
+  */
+
+ //--public java.lang.String toString(){
+ function toString() {
+  //--java.lang.String formstr=null;
+  var formstr=null;
+  //--int r=0;
+  var r=0;
+  //--java.lang.String roundword=null;
+  var roundword=null;
+  {/*select*/
+  if (this.form==this.SCIENTIFIC)
+   formstr="SCIENTIFIC";
+  else if (this.form==this.ENGINEERING)
+   formstr="ENGINEERING";
+  else{
+   formstr="PLAIN";/* form=PLAIN */
+  }
+  }
+  {var $1=this.ROUNDS.length;r=0;r:for(;$1>0;$1--,r++){
+   if (this.roundingMode==this.ROUNDS[r])
+    {
+     roundword=this.ROUNDWORDS[r];
+     break r;
+    }
+   }
+  }/*r*/
+  return "digits="+this.digits+" "+"form="+formstr+" "+"lostDigits="+(this.lostDigits?"1":"0")+" "+"roundingMode="+roundword;
+  }
+
+
+ /* <sgml> Test whether round is valid. </sgml> */
+ // This could be made shared for use by BigDecimal for setScale.
+
+ //--private static boolean isValidRound(int testround){
+ function isValidRound(testround) {
+  //--int r=0;
+  var r=0;
+  {var $2=this.ROUNDS.length;r=0;r:for(;$2>0;$2--,r++){
+   if (testround==this.ROUNDS[r])
+    return true;
+   }
+  }/*r*/
+  return false;
+  }
+return MathContext;
+})();
+
+var BigDecimal = (function (MathContext) {
+/* Generated from 'BigDecimal.nrx' 8 Sep 2000 11:10:50 [v2.00] */
+/* Options: Binary Comments Crossref Format Java Logo Strictargs Strictcase Trace2 Verbose3 */
+//--package com.ibm.icu.math;
+//--import java.math.BigInteger;
+//--import com.ibm.icu.impl.Utility;
+
+/* ------------------------------------------------------------------ */
+/* BigDecimal -- Decimal arithmetic for Java                          */
+/* ------------------------------------------------------------------ */
+/* Copyright IBM Corporation, 1996, 2000.  All Rights Reserved.       */
+/*                                                                    */
+/* The BigDecimal class provides immutable arbitrary-precision        */
+/* floating point (including integer) decimal numbers.                */
+/*                                                                    */
+/* As the numbers are decimal, there is an exact correspondence       */
+/* between an instance of a BigDecimal object and its String          */
+/* representation; the BigDecimal class provides direct conversions   */
+/* to and from String and character array objects, and well as        */
+/* conversions to and from the Java primitive types (which may not    */
+/* be exact).                                                         */
+/* ------------------------------------------------------------------ */
+/* Notes:                                                             */
+/*                                                                    */
+/* 1. A BigDecimal object is never changed in value once constructed; */
+/*    this avoids the need for locking.  Note in particular that the  */
+/*    mantissa array may be shared between many BigDecimal objects,   */
+/*    so that once exposed it must not be altered.                    */
+/*                                                                    */
+/* 2. This class looks at MathContext class fields directly (for      */
+/*    performance).  It must not and does not change them.            */
+/*                                                                    */
+/* 3. Exponent checking is delayed until finish(), as we know         */
+/*    intermediate calculations cannot cause 31-bit overflow.         */
+/*    [This assertion depends on MAX_DIGITS in MathContext.]          */
+/*                                                                    */
+/* 4. Comments for the public API now follow the javadoc conventions. */
+/*    The NetRexx -comments option is used to pass these comments     */
+/*    through to the generated Java code (with -format, if desired).  */
+/*                                                                    */
+/* 5. System.arraycopy is faster than explicit loop as follows        */
+/*      Mean length 4:  equal                                         */
+/*      Mean length 8:  x2                                            */
+/*      Mean length 16: x3                                            */
+/*      Mean length 24: x4                                            */
+/*    From prior experience, we expect mean length a little below 8,  */
+/*    but arraycopy is still the one to use, in general, until later  */
+/*    measurements suggest otherwise.                                 */
+/*                                                                    */
+/* 6. 'DMSRCN' referred to below is the original (1981) IBM S/370     */
+/*    assembler code implementation of the algorithms below; it is    */
+/*    now called IXXRCN and is available with the OS/390 and VM/ESA   */
+/*    operating systems.                                              */
+/* ------------------------------------------------------------------ */
+/* Change History:                                                    */
+/* 1997.09.02 Initial version (derived from netrexx.lang classes)     */
+/* 1997.09.12 Add lostDigits checking                                 */
+/* 1997.10.06 Change mantissa to a byte array                         */
+/* 1997.11.22 Rework power [did not prepare arguments, etc.]          */
+/* 1997.12.13 multiply did not prepare arguments                      */
+/* 1997.12.14 add did not prepare and align arguments correctly       */
+/* 1998.05.02 0.07 packaging changes suggested by Sun and Oracle      */
+/* 1998.05.21 adjust remainder operator finalization                  */
+/* 1998.06.04 rework to pass MathContext to finish() and round()      */
+/* 1998.06.06 change format to use round(); support rounding modes    */
+/* 1998.06.25 rename to BigDecimal and begin merge                    */
+/*            zero can now have trailing zeros (i.e., exp\=0)         */
+/* 1998.06.28 new methods: movePointXxxx, scale, toBigInteger         */
+/*                         unscaledValue, valueof                     */
+/* 1998.07.01 improve byteaddsub to allow array reuse, etc.           */
+/* 1998.07.01 make null testing explicit to avoid JIT bug [Win32]     */
+/* 1998.07.07 scaled division  [divide(BigDecimal, int, int)]         */
+/* 1998.07.08 setScale, faster equals                                 */
+/* 1998.07.11 allow 1E6 (no sign) <sigh>; new double/float conversion */
+/* 1998.10.12 change package to com.ibm.icu.math                          */
+/* 1998.12.14 power operator no longer rounds RHS [to match ANSI]     */
+/*            add toBigDecimal() and BigDecimal(java.math.BigDecimal) */
+/* 1998.12.29 improve byteaddsub by using table lookup                */
+/* 1999.02.04 lostdigits=0 behaviour rounds instead of digits+1 guard */
+/* 1999.02.05 cleaner code for BigDecimal(char[])                     */
+/* 1999.02.06 add javadoc comments                                    */
+/* 1999.02.11 format() changed from 7 to 2 method form                */
+/* 1999.03.05 null pointer checking is no longer explicit             */
+/* 1999.03.05 simplify; changes from discussion with J. Bloch:        */
+/*            null no longer permitted for MathContext; drop boolean, */
+/*            byte, char, float, short constructor, deprecate double  */
+/*            constructor, no blanks in string constructor, add       */
+/*            offset and length version of char[] constructor;        */
+/*            add valueOf(double); drop booleanValue, charValue;      */
+/*            add ...Exact versions of remaining convertors           */
+/* 1999.03.13 add toBigIntegerExact                                   */
+/* 1999.03.13 1.00 release to IBM Centre for Java Technology          */
+/* 1999.05.27 1.01 correct 0-0.2 bug under scaled arithmetic          */
+/* 1999.06.29 1.02 constructors should not allow exponent > 9 digits  */
+/* 1999.07.03 1.03 lost digits should not be checked if digits=0      */
+/* 1999.07.06      lost digits Exception message changed              */
+/* 1999.07.10 1.04 more work on 0-0.2 (scaled arithmetic)             */
+/* 1999.07.17      improve messages from pow method                   */
+/* 1999.08.08      performance tweaks                                 */
+/* 1999.08.15      fastpath in multiply                               */
+/* 1999.11.05 1.05 fix problem in intValueExact [e.g., 5555555555]    */
+/* 1999.12.22 1.06 remove multiply fastpath, and improve performance  */
+/* 2000.01.01      copyright update [Y2K has arrived]                 */
+/* 2000.06.18 1.08 no longer deprecate BigDecimal(double)             */
+/* ------------------------------------------------------------------ */
+
+
+/* JavaScript conversion (c) 2003 STZ-IDA and PTV AG, Karlsruhe, Germany */
+
+
+
+function div(a, b) {
+    return (a-(a%b))/b;
+}
+
+BigDecimal.prototype.div = div;
+
+function arraycopy(src, srcindex, dest, destindex, length) {
+    var i;
+    if (destindex > srcindex) {
+        // in case src and dest are equals, but also doesn't hurt
+        // if they are different
+        for (i = length-1; i >= 0; --i) {
+            dest[i+destindex] = src[i+srcindex];
+        }
+    } else {
+        for (i = 0; i < length; ++i) {
+            dest[i+destindex] = src[i+srcindex];
+        }
+    }
+}
+
+BigDecimal.prototype.arraycopy = arraycopy;
+
+function createArrayWithZeros(length) {
+    var retVal = new Array(length);
+    var i;
+    for (i = 0; i < length; ++i) {
+        retVal[i] = 0;
+    }
+    return retVal;
+}
+
+BigDecimal.prototype.createArrayWithZeros = createArrayWithZeros;
+
+
+/**
+ * The <code>BigDecimal</code> class implements immutable
+ * arbitrary-precision decimal numbers.  The methods of the
+ * <code>BigDecimal</code> class provide operations for fixed and
+ * floating point arithmetic, comparison, format conversions, and
+ * hashing.
+ * <p>
+ * As the numbers are decimal, there is an exact correspondence between
+ * an instance of a <code>BigDecimal</code> object and its
+ * <code>String</code> representation; the <code>BigDecimal</code> class
+ * provides direct conversions to and from <code>String</code> and
+ * character array (<code>char[]</code>) objects, as well as conversions
+ * to and from the Java primitive types (which may not be exact) and
+ * <code>BigInteger</code>.
+ * <p>
+ * In the descriptions of constructors and methods in this documentation,
+ * the value of a <code>BigDecimal</code> number object is shown as the
+ * result of invoking the <code>toString()</code> method on the object.
+ * The internal representation of a decimal number is neither defined
+ * nor exposed, and is not permitted to affect the result of any
+ * operation.
+ * <p>
+ * The floating point arithmetic provided by this class is defined by
+ * the ANSI X3.274-1996 standard, and is also documented at
+ * <code>http://www2.hursley.ibm.com/decimal</code>
+ * <br><i>[This URL will change.]</i>
+ *
+ * <h3>Operator methods</h3>
+ * <p>
+ * Operations on <code>BigDecimal</code> numbers are controlled by a
+ * {@link MathContext} object, which provides the context (precision and
+ * other information) for the operation. Methods that can take a
+ * <code>MathContext</code> parameter implement the standard arithmetic
+ * operators for <code>BigDecimal</code> objects and are known as
+ * <i>operator methods</i>.  The default settings provided by the
+ * constant {@link MathContext#DEFAULT} (<code>digits=9,
+ * form=SCIENTIFIC, lostDigits=false, roundingMode=ROUND_HALF_UP</code>)
+ * perform general-purpose floating point arithmetic to nine digits of
+ * precision.  The <code>MathContext</code> parameter must not be
+ * <code>null</code>.
+ * <p>
+ * Each operator method also has a version provided which does
+ * not take a <code>MathContext</code> parameter.  For this version of
+ * each method, the context settings used are <code>digits=0,
+ * form=PLAIN, lostDigits=false, roundingMode=ROUND_HALF_UP</code>;
+ * these settings perform fixed point arithmetic with unlimited
+ * precision, as defined for the original BigDecimal class in Java 1.1
+ * and Java 1.2.
+ * <p>
+ * For monadic operators, only the optional <code>MathContext</code>
+ * parameter is present; the operation acts upon the current object.
+ * <p>
+ * For dyadic operators, a <code>BigDecimal</code> parameter is always
+ * present; it must not be <code>null</code>.
+ * The operation acts with the current object being the left-hand operand
+ * and the <code>BigDecimal</code> parameter being the right-hand operand.
+ * <p>
+ * For example, adding two <code>BigDecimal</code> objects referred to
+ * by the names <code>award</code> and <code>extra</code> could be
+ * written as any of:
+ * <p><code>
+ *     award.add(extra)
+ * <br>award.add(extra, MathContext.DEFAULT)
+ * <br>award.add(extra, acontext)
+ * </code>
+ * <p>
+ * (where <code>acontext</code> is a <code>MathContext</code> object),
+ * which would return a <code>BigDecimal</code> object whose value is
+ * the result of adding <code>award</code> and <code>extra</code> under
+ * the appropriate context settings.
+ * <p>
+ * When a <code>BigDecimal</code> operator method is used, a set of
+ * rules define what the result will be (and, by implication, how the
+ * result would be represented as a character string).
+ * These rules are defined in the BigDecimal arithmetic documentation
+ * (see the URL above), but in summary:
+ * <ul>
+ * <li>Results are normally calculated with up to some maximum number of
+ * significant digits.
+ * For example, if the <code>MathContext</code> parameter for an operation
+ * were <code>MathContext.DEFAULT</code> then the result would be
+ * rounded to 9 digits; the division of 2 by 3 would then result in
+ * 0.666666667.
+ * <br>
+ * You can change the default of 9 significant digits by providing the
+ * method with a suitable <code>MathContext</code> object. This lets you
+ * calculate using as many digits as you need -- thousands, if necessary.
+ * Fixed point (scaled) arithmetic is indicated by using a
+ * <code>digits</code> setting of 0 (or omitting the
+ * <code>MathContext</code> parameter).
+ * <br>
+ * Similarly, you can change the algorithm used for rounding from the
+ * default "classic" algorithm.
+ * <li>
+ * In standard arithmetic (that is, when the <code>form</code> setting
+ * is not <code>PLAIN</code>), a zero result is always expressed as the
+ * single digit <code>'0'</code> (that is, with no sign, decimal point,
+ * or exponent part).
+ * <li>
+ * Except for the division and power operators in standard arithmetic,
+ * trailing zeros are preserved (this is in contrast to binary floating
+ * point operations and most electronic calculators, which lose the
+ * information about trailing zeros in the fractional part of results).
+ * <br>
+ * So, for example:
+ * <p><code>
+ *     new BigDecimal("2.40").add(     new BigDecimal("2"))      =&gt; "4.40"
+ * <br>new BigDecimal("2.40").subtract(new BigDecimal("2"))      =&gt; "0.40"
+ * <br>new BigDecimal("2.40").multiply(new BigDecimal("2"))      =&gt; "4.80"
+ * <br>new BigDecimal("2.40").divide(  new BigDecimal("2"), def) =&gt; "1.2"
+ * </code>
+ * <p>where the value on the right of the <code>=&gt;</code> would be the
+ * result of the operation, expressed as a <code>String</code>, and
+ * <code>def</code> (in this and following examples) refers to
+ * <code>MathContext.DEFAULT</code>).
+ * This preservation of trailing zeros is desirable for most
+ * calculations (including financial calculations).
+ * If necessary, trailing zeros may be easily removed using division by 1.
+ * <li>
+ * In standard arithmetic, exponential form is used for a result
+ * depending on its value and the current setting of <code>digits</code>
+ * (the default is 9 digits).
+ * If the number of places needed before the decimal point exceeds the
+ * <code>digits</code> setting, or the absolute value of the number is
+ * less than <code>0.000001</code>, then the number will be expressed in
+ * exponential notation; thus
+ * <p><code>
+ *   new BigDecimal("1e+6").multiply(new BigDecimal("1e+6"), def)
+ * </code>
+ * <p>results in <code>1E+12</code> instead of
+ * <code>1000000000000</code>, and
+ * <p><code>
+ *   new BigDecimal("1").divide(new BigDecimal("3E+10"), def)
+ * </code>
+ * <p>results in <code>3.33333333E-11</code> instead of
+ * <code>0.0000000000333333333</code>.
+ * <p>
+ * The form of the exponential notation (scientific or engineering) is
+ * determined by the <code>form</code> setting.
+ * <eul>
+ * <p>
+ * The names of methods in this class follow the conventions established
+ * by <code>java.lang.Number</code>, <code>java.math.BigInteger</code>,
+ * and <code>java.math.BigDecimal</code> in Java 1.1 and Java 1.2.
+ *
+ * @see     MathContext
+ * @author  Mike Cowlishaw
+ * @stable ICU 2.0
+ */
+
+//--public class BigDecimal extends java.lang.Number implements java.io.Serializable,java.lang.Comparable{
+//-- private static final java.lang.String $0="BigDecimal.nrx";
+
+ //-- methods
+ BigDecimal.prototype.abs = abs;
+ BigDecimal.prototype.add = add;
+ BigDecimal.prototype.compareTo = compareTo;
+ BigDecimal.prototype.divide = divide;
+ BigDecimal.prototype.divideInteger = divideInteger;
+ BigDecimal.prototype.max = max;
+ BigDecimal.prototype.min = min;
+ BigDecimal.prototype.multiply = multiply;
+ BigDecimal.prototype.negate = negate;
+ BigDecimal.prototype.plus = plus;
+ BigDecimal.prototype.pow = pow;
+ BigDecimal.prototype.remainder = remainder;
+ BigDecimal.prototype.subtract = subtract;
+ BigDecimal.prototype.equals = equals;
+ BigDecimal.prototype.format = format;
+ BigDecimal.prototype.intValueExact = intValueExact;
+ BigDecimal.prototype.movePointLeft = movePointLeft;
+ BigDecimal.prototype.movePointRight = movePointRight;
+ BigDecimal.prototype.scale = scale;
+ BigDecimal.prototype.setScale = setScale;
+ BigDecimal.prototype.signum = signum;
+ BigDecimal.prototype.toString = toString;
+ BigDecimal.prototype.layout = layout;
+ BigDecimal.prototype.intcheck = intcheck;
+ BigDecimal.prototype.dodivide = dodivide;
+ BigDecimal.prototype.bad = bad;
+ BigDecimal.prototype.badarg = badarg;
+ BigDecimal.prototype.extend = extend;
+ BigDecimal.prototype.byteaddsub = byteaddsub;
+ BigDecimal.prototype.diginit = diginit;
+ BigDecimal.prototype.clone = clone;
+ BigDecimal.prototype.checkdigits = checkdigits;
+ BigDecimal.prototype.round = round;
+ BigDecimal.prototype.allzero = allzero;
+ BigDecimal.prototype.finish = finish;
+
+ // Convenience methods
+ BigDecimal.prototype.isGreaterThan = isGreaterThan;
+ BigDecimal.prototype.isLessThan = isLessThan;
+ BigDecimal.prototype.isGreaterThanOrEqualTo = isGreaterThanOrEqualTo;
+ BigDecimal.prototype.isLessThanOrEqualTo = isLessThanOrEqualTo;
+ BigDecimal.prototype.isPositive = isPositive;
+ BigDecimal.prototype.isNegative = isNegative;
+ BigDecimal.prototype.isZero = isZero;
+
+
+ /* ----- Constants ----- */
+ /* properties constant public */ // useful to others
+ // the rounding modes (copied here for upwards compatibility)
+ /**
+  * Rounding mode to round to a more positive number.
+  * @see MathContext#ROUND_CEILING
+  * @stable ICU 2.0
+  */
+ //--public static final int ROUND_CEILING=com.ibm.icu.math.MathContext.ROUND_CEILING;
+ BigDecimal.ROUND_CEILING = BigDecimal.prototype.ROUND_CEILING = MathContext.prototype.ROUND_CEILING;
+
+ /**
+  * Rounding mode to round towards zero.
+  * @see MathContext#ROUND_DOWN
+  * @stable ICU 2.0
+  */
+ //--public static final int ROUND_DOWN=com.ibm.icu.math.MathContext.ROUND_DOWN;
+ BigDecimal.ROUND_DOWN = BigDecimal.prototype.ROUND_DOWN = MathContext.prototype.ROUND_DOWN;
+
+ /**
+  * Rounding mode to round to a more negative number.
+  * @see MathContext#ROUND_FLOOR
+  * @stable ICU 2.0
+  */
+ //--public static final int ROUND_FLOOR=com.ibm.icu.math.MathContext.ROUND_FLOOR;
+ BigDecimal.ROUND_FLOOR = BigDecimal.prototype.ROUND_FLOOR = MathContext.prototype.ROUND_FLOOR;
+
+ /**
+  * Rounding mode to round to nearest neighbor, where an equidistant
+  * value is rounded down.
+  * @see MathContext#ROUND_HALF_DOWN
+  * @stable ICU 2.0
+  */
+ //--public static final int ROUND_HALF_DOWN=com.ibm.icu.math.MathContext.ROUND_HALF_DOWN;
+ BigDecimal.ROUND_HALF_DOWN = BigDecimal.prototype.ROUND_HALF_DOWN = MathContext.prototype.ROUND_HALF_DOWN;
+
+ /**
+  * Rounding mode to round to nearest neighbor, where an equidistant
+  * value is rounded to the nearest even neighbor.
+  * @see MathContext#ROUND_HALF_EVEN
+  * @stable ICU 2.0
+  */
+ //--public static final int ROUND_HALF_EVEN=com.ibm.icu.math.MathContext.ROUND_HALF_EVEN;
+ BigDecimal.ROUND_HALF_EVEN = BigDecimal.prototype.ROUND_HALF_EVEN = MathContext.prototype.ROUND_HALF_EVEN;
+
+ /**
+  * Rounding mode to round to nearest neighbor, where an equidistant
+  * value is rounded up.
+  * @see MathContext#ROUND_HALF_UP
+  * @stable ICU 2.0
+  */
+ //--public static final int ROUND_HALF_UP=com.ibm.icu.math.MathContext.ROUND_HALF_UP;
+ BigDecimal.ROUND_HALF_UP = BigDecimal.prototype.ROUND_HALF_UP = MathContext.prototype.ROUND_HALF_UP;
+
+ /**
+  * Rounding mode to assert that no rounding is necessary.
+  * @see MathContext#ROUND_UNNECESSARY
+  * @stable ICU 2.0
+  */
+ //--public static final int ROUND_UNNECESSARY=com.ibm.icu.math.MathContext.ROUND_UNNECESSARY;
+ BigDecimal.ROUND_UNNECESSARY = BigDecimal.prototype.ROUND_UNNECESSARY = MathContext.prototype.ROUND_UNNECESSARY;
+
+ /**
+  * Rounding mode to round away from zero.
+  * @see MathContext#ROUND_UP
+  * @stable ICU 2.0
+  */
+ //--public static final int ROUND_UP=com.ibm.icu.math.MathContext.ROUND_UP;
+ BigDecimal.ROUND_UP = BigDecimal.prototype.ROUND_UP = MathContext.prototype.ROUND_UP;
+
+ /* properties constant private */ // locals
+ //--private static final byte ispos=1; // ind: indicates positive (must be 1)
+ //--private static final byte iszero=0; // ind: indicates zero     (must be 0)
+ //--private static final byte isneg=-1; // ind: indicates negative (must be -1)
+ BigDecimal.prototype.ispos = 1;
+ BigDecimal.prototype.iszero = 0;
+ BigDecimal.prototype.isneg = -1;
+ // [later could add NaN, +/- infinity, here]
+
+ //--private static final int MinExp=-999999999; // minimum exponent allowed
+ //--private static final int MaxExp=999999999; // maximum exponent allowed
+ //--private static final int MinArg=-999999999; // minimum argument integer
+ //--private static final int MaxArg=999999999; // maximum argument integer
+ BigDecimal.prototype.MinExp=-999999999; // minimum exponent allowed
+ BigDecimal.prototype.MaxExp=999999999; // maximum exponent allowed
+ BigDecimal.prototype.MinArg=-999999999; // minimum argument integer
+ BigDecimal.prototype.MaxArg=999999999; // maximum argument integer
+
+ //--private static final com.ibm.icu.math.MathContext plainMC=new com.ibm.icu.math.MathContext(0,com.ibm.icu.math.MathContext.PLAIN); // context for plain unlimited math
+ BigDecimal.prototype.plainMC=new MathContext(0, MathContext.prototype.PLAIN);
+
+ /* properties constant private unused */ // present but not referenced
+
+ // Serialization version
+ //--private static final long serialVersionUID=8245355804974198832L;
+
+ //--private static final java.lang.String copyright=" Copyright (c) IBM Corporation 1996, 2000.  All rights reserved. ";
+
+ /* properties static private */
+ // Precalculated constant arrays (used by byteaddsub)
+ //--private static byte bytecar[]=new byte[(90+99)+1]; // carry/borrow array
+ //--private static byte bytedig[]=diginit(); // next digit array
+ BigDecimal.prototype.bytecar = new Array((90+99)+1);
+ BigDecimal.prototype.bytedig = diginit();
+
+ /**
+  * The <code>BigDecimal</code> constant "0".
+  *
+  * @see #ONE
+  * @see #TEN
+  * @stable ICU 2.0
+  */
+ //--public static final com.ibm.icu.math.BigDecimal ZERO=new com.ibm.icu.math.BigDecimal((long)0); // use long as we want the int constructor
+ // .. to be able to use this, for speed
+BigDecimal.ZERO = BigDecimal.prototype.ZERO = new BigDecimal("0");
+
+ /**
+  * The <code>BigDecimal</code> constant "1".
+  *
+  * @see #TEN
+  * @see #ZERO
+  * @stable ICU 2.0
+  */
+ //--public static final com.ibm.icu.math.BigDecimal ONE=new com.ibm.icu.math.BigDecimal((long)1); // use long as we want the int constructor
+ // .. to be able to use this, for speed
+BigDecimal.ONE = BigDecimal.prototype.ONE = new BigDecimal("1");
+
+ /**
+  * The <code>BigDecimal</code> constant "10".
+  *
+  * @see #ONE
+  * @see #ZERO
+  * @stable ICU 2.0
+  */
+ //--public static final com.ibm.icu.math.BigDecimal TEN=new com.ibm.icu.math.BigDecimal(10);
+ BigDecimal.TEN = BigDecimal.prototype.TEN = new BigDecimal("10");
+
+ /* ----- Instance properties [all private and immutable] ----- */
+ /* properties private */
+
+ /**
+  * The indicator. This may take the values:
+  * <ul>
+  * <li>ispos  -- the number is positive
+  * <li>iszero -- the number is zero
+  * <li>isneg  -- the number is negative
+  * </ul>
+  *
+  * @serial
+  */
+ //--private byte ind; // assumed undefined
+ // Note: some code below assumes IND = Sign [-1, 0, 1], at present.
+ // We only need two bits for this, but use a byte [also permits
+ // smooth future extension].
+
+ /**
+  * The formatting style. This may take the values:
+  * <ul>
+  * <li>MathContext.PLAIN        -- no exponent needed
+  * <li>MathContext.SCIENTIFIC   -- scientific notation required
+  * <li>MathContext.ENGINEERING  -- engineering notation required
+  * </ul>
+  * <p>
+  * This property is an optimization; it allows us to defer number
+  * layout until it is actually needed as a string, hence avoiding
+  * unnecessary formatting.
+  *
+  * @serial
+  */
+ //--private byte form=(byte)com.ibm.icu.math.MathContext.PLAIN; // assumed PLAIN
+ // We only need two bits for this, at present, but use a byte
+ // [again, to allow for smooth future extension]
+
+ /**
+  * The value of the mantissa.
+  * <p>
+  * Once constructed, this may become shared between several BigDecimal
+  * objects, so must not be altered.
+  * <p>
+  * For efficiency (speed), this is a byte array, with each byte
+  * taking a value of 0 -> 9.
+  * <p>
+  * If the first byte is 0 then the value of the number is zero (and
+  * mant.length=1, except when constructed from a plain number, for
+  * example, 0.000).
+  *
+  * @serial
+  */
+ //--private byte mant[]; // assumed null
+
+ /**
+  * The exponent.
+  * <p>
+  * For fixed point arithmetic, scale is <code>-exp</code>, and can
+  * apply to zero.
+  *
+  * Note that this property can have a value less than MinExp when
+  * the mantissa has more than one digit.
+  *
+  * @serial
+  */
+ //--private int exp;
+ // assumed 0
+
+ /* ---------------------------------------------------------------- */
+ /* Constructors                                                     */
+ /* ---------------------------------------------------------------- */
+
+ /**
+  * Constructs a <code>BigDecimal</code> object from a
+  * <code>java.math.BigDecimal</code>.
+  * <p>
+  * Constructs a <code>BigDecimal</code> as though the parameter had
+  * been represented as a <code>String</code> (using its
+  * <code>toString</code> method) and the
+  * {@link #BigDecimal(java.lang.String)} constructor had then been
+  * used.
+  * The parameter must not be <code>null</code>.
+  * <p>
+  * <i>(Note: this constructor is provided only in the
+  * <code>com.ibm.icu.math</code> version of the BigDecimal class.
+  * It would not be present in a <code>java.math</code> version.)</i>
+  *
+  * @param bd The <code>BigDecimal</code> to be translated.
+  * @stable ICU 2.0
+  */
+
+ //--public BigDecimal(java.math.BigDecimal bd){
+ //-- this(bd.toString());
+ //-- return;}
+
+ /**
+  * Constructs a <code>BigDecimal</code> object from a
+  * <code>BigInteger</code>, with scale 0.
+  * <p>
+  * Constructs a <code>BigDecimal</code> which is the exact decimal
+  * representation of the <code>BigInteger</code>, with a scale of
+  * zero.
+  * The value of the <code>BigDecimal</code> is identical to the value
+  * of the <code>BigInteger</code>.
+  * The parameter must not be <code>null</code>.
+  * <p>
+  * The <code>BigDecimal</code> will contain only decimal digits,
+  * prefixed with a leading minus sign (hyphen) if the
+  * <code>BigInteger</code> is negative.  A leading zero will be
+  * present only if the <code>BigInteger</code> is zero.
+  *
+  * @param bi The <code>BigInteger</code> to be converted.
+  * @stable ICU 2.0
+  */
+
+ //--public BigDecimal(java.math.BigInteger bi){
+ //-- this(bi.toString(10));
+ //-- return;}
+ // exp remains 0
+
+ /**
+  * Constructs a <code>BigDecimal</code> object from a
+  * <code>BigInteger</code> and a scale.
+  * <p>
+  * Constructs a <code>BigDecimal</code> which is the exact decimal
+  * representation of the <code>BigInteger</code>, scaled by the
+  * second parameter, which may not be negative.
+  * The value of the <code>BigDecimal</code> is the
+  * <code>BigInteger</code> divided by ten to the power of the scale.
+  * The <code>BigInteger</code> parameter must not be
+  * <code>null</code>.
+  * <p>
+  * The <code>BigDecimal</code> will contain only decimal digits, (with
+  * an embedded decimal point followed by <code>scale</code> decimal
+  * digits if the scale is positive), prefixed with a leading minus
+  * sign (hyphen) if the <code>BigInteger</code> is negative.  A
+  * leading zero will be present only if the <code>BigInteger</code> is
+  * zero.
+  *
+  * @param  bi    The <code>BigInteger</code> to be converted.
+  * @param  scale The <code>int</code> specifying the scale.
+  * @throws NumberFormatException if the scale is negative.
+  * @stable ICU 2.0
+  */
+
+ //--public BigDecimal(java.math.BigInteger bi,int scale){
+ //-- this(bi.toString(10));
+ //-- if (scale<0)
+ //--  throw new java.lang.NumberFormatException("Negative scale:"+" "+scale);
+ //-- exp=(int)-scale; // exponent is -scale
+ //-- return;}
+
+ /**
+  * Constructs a <code>BigDecimal</code> object from an array of characters.
+  * <p>
+  * Constructs a <code>BigDecimal</code> as though a
+  * <code>String</code> had been constructed from the character array
+  * and the {@link #BigDecimal(java.lang.String)} constructor had then
+  * been used. The parameter must not be <code>null</code>.
+  * <p>
+  * Using this constructor is faster than using the
+  * <code>BigDecimal(String)</code> constructor if the string is
+  * already available in character array form.
+  *
+  * @param inchars The <code>char[]</code> array containing the number
+  *                to be converted.
+  * @throws NumberFormatException if the parameter is not a valid
+  *                number.
+  * @stable ICU 2.0
+  */
+
+ //--public BigDecimal(char inchars[]){
+ //-- this(inchars,0,inchars.length);
+ //-- return;}
+
+ /**
+  * Constructs a <code>BigDecimal</code> object from an array of characters.
+  * <p>
+  * Constructs a <code>BigDecimal</code> as though a
+  * <code>String</code> had been constructed from the character array
+  * (or a subarray of that array) and the
+  * {@link #BigDecimal(java.lang.String)} constructor had then been
+  * used. The first parameter must not be <code>null</code>, and the
+  * subarray must be wholly contained within it.
+  * <p>
+  * Using this constructor is faster than using the
+  * <code>BigDecimal(String)</code> constructor if the string is
+  * already available within a character array.
+  *
+  * @param inchars The <code>char[]</code> array containing the number
+  *                to be converted.
+  * @param offset  The <code>int</code> offset into the array of the
+  *                start of the number to be converted.
+  * @param length  The <code>int</code> length of the number.
+  * @throws NumberFormatException if the parameter is not a valid
+  *                number for any reason.
+  * @stable ICU 2.0
+  */
+
+ //--public BigDecimal(char inchars[],int offset,int length){super();
+ function BigDecimal() {
+  //-- members
+  this.ind = 0;
+  this.form = MathContext.prototype.PLAIN;
+  this.mant = null;
+  this.exp = 0;
+
+  //-- overloaded ctor
+  if (BigDecimal.arguments.length == 0)
+   return;
+  var inchars;
+  var offset;
+  var length;
+  if (BigDecimal.arguments.length == 1)
+   {
+    inchars = BigDecimal.arguments[0];
+    offset = 0;
+    length = inchars.length;
+   }
+  else
+   {
+    inchars = BigDecimal.arguments[0];
+    offset = BigDecimal.arguments[1];
+    length = BigDecimal.arguments[2];
+   }
+  if (typeof inchars == "string")
+   {
+    inchars = inchars.split("");
+   }
+
+  //--boolean exotic;
+  var exotic;
+  //--boolean hadexp;
+  var hadexp;
+  //--int d;
+  var d;
+  //--int dotoff;
+  var dotoff;
+  //--int last;
+  var last;
+  //--int i=0;
+  var i=0;
+  //--char si=0;
+  var si=0;
+  //--boolean eneg=false;
+  var eneg=false;
+  //--int k=0;
+  var k=0;
+  //--int elen=0;
+  var elen=0;
+  //--int j=0;
+  var j=0;
+  //--char sj=0;
+  var sj=0;
+  //--int dvalue=0;
+  var dvalue=0;
+  //--int mag=0;
+  var mag=0;
+  // This is the primary constructor; all incoming strings end up
+  // here; it uses explicit (inline) parsing for speed and to avoid
+  // generating intermediate (temporary) objects of any kind.
+  // 1998.06.25: exponent form built only if E/e in string
+  // 1998.06.25: trailing zeros not removed for zero
+  // 1999.03.06: no embedded blanks; allow offset and length
+  if (length<=0)
+   this.bad("BigDecimal(): ", inchars); // bad conversion (empty string)
+  // [bad offset will raise array bounds exception]
+
+  /* Handle and step past sign */
+  this.ind=this.ispos; // assume positive
+  if (inchars[0]==('-'))
+   {
+    length--;
+    if (length==0)
+     this.bad("BigDecimal(): ", inchars); // nothing after sign
+    this.ind=this.isneg;
+    offset++;
+   }
+  else
+   if (inchars[0]==('+'))
+    {
+     length--;
+     if (length==0)
+      this.bad("BigDecimal(): ", inchars); // nothing after sign
+     offset++;
+    }
+
+  /* We're at the start of the number */
+  exotic=false; // have extra digits
+  hadexp=false; // had explicit exponent
+  d=0; // count of digits found
+  dotoff=-1; // offset where dot was found
+  last=-1; // last character of mantissa
+  {var $1=length;i=offset;i:for(;$1>0;$1--,i++){
+   si=inchars[i];
+   if (si>='0')  // test for Arabic digit
+    if (si<='9')
+     {
+      last=i;
+      d++; // still in mantissa
+      continue i;
+     }
+   if (si=='.')
+    { // record and ignore
+     if (dotoff>=0)
+      this.bad("BigDecimal(): ", inchars); // two dots
+     dotoff=i-offset; // offset into mantissa
+     continue i;
+    }
+   if (si!='e')
+    if (si!='E')
+     { // expect an extra digit
+      if (si<'0' || si>'9')
+       this.bad("BigDecimal(): ", inchars); // not a number
+      // defer the base 10 check until later to avoid extra method call
+      exotic=true; // will need conversion later
+      last=i;
+      d++; // still in mantissa
+      continue i;
+     }
+   /* Found 'e' or 'E' -- now process explicit exponent */
+   // 1998.07.11: sign no longer required
+   if ((i-offset)>(length-2))
+    this.bad("BigDecimal(): ", inchars); // no room for even one digit
+   eneg=false;
+   if ((inchars[i+1])==('-'))
+    {
+     eneg=true;
+     k=i+2;
+    }
+   else
+    if ((inchars[i+1])==('+'))
+     k=i+2;
+    else
+     k=i+1;
+   // k is offset of first expected digit
+   elen=length-((k-offset)); // possible number of digits
+   if ((elen==0)||(elen>9))
+    this.bad("BigDecimal(): ", inchars); // 0 or more than 9 digits
+   {var $2=elen;j=k;j:for(;$2>0;$2--,j++){
+    sj=inchars[j];
+    if (sj<'0')
+     this.bad("BigDecimal(): ", inchars); // always bad
+    if (sj>'9')
+     { // maybe an exotic digit
+      /*if (si<'0' || si>'9')
+       this.bad(inchars); // not a number
+      dvalue=java.lang.Character.digit(sj,10); // check base
+      if (dvalue<0)
+       bad(inchars); // not base 10*/
+      this.bad("BigDecimal(): ", inchars);
+     }
+    else
+     dvalue=sj-'0';
+    this.exp=(this.exp*10)+dvalue;
+    }
+   }/*j*/
+   if (eneg)
+    this.exp=-this.exp; // was negative
+   hadexp=true; // remember we had one
+   break i; // we are done
+   }
+  }/*i*/
+
+  /* Here when all inspected */
+  if (d==0)
+   this.bad("BigDecimal(): ", inchars); // no mantissa digits
+  if (dotoff>=0)
+   this.exp=(this.exp+dotoff)-d; // adjust exponent if had dot
+
+  /* strip leading zeros/dot (leave final if all 0's) */
+  {var $3=last-1;i=offset;i:for(;i<=$3;i++){
+   si=inchars[i];
+   if (si=='0')
+    {
+     offset++;
+     dotoff--;
+     d--;
+    }
+   else
+    if (si=='.')
+     {
+      offset++; // step past dot
+      dotoff--;
+     }
+    else
+     if (si<='9')
+      break i;/* non-0 */
+     else
+      {/* exotic */
+       //if ((java.lang.Character.digit(si,10))!=0)
+        break i; // non-0 or bad
+       // is 0 .. strip like '0'
+       //offset++;
+       //dotoff--;
+       //d--;
+      }
+   }
+  }/*i*/
+
+  /* Create the mantissa array */
+  this.mant=new Array(d); // we know the length
+  j=offset; // input offset
+  if (exotic)
+   {exotica:do{ // slow: check for exotica
+    {var $4=d;i=0;i:for(;$4>0;$4--,i++){
+     if (i==dotoff)
+      j++; // at dot
+     sj=inchars[j];
+     if (sj<='9')
+      this.mant[i]=sj-'0';/* easy */
+     else
+      {
+       //dvalue=java.lang.Character.digit(sj,10);
+       //if (dvalue<0)
+        this.bad("BigDecimal(): ", inchars); // not a number after all
+       //mant[i]=(byte)dvalue;
+      }
+     j++;
+     }
+    }/*i*/
+   }while(false);}/*exotica*/
+  else
+   {simple:do{
+    {var $5=d;i=0;i:for(;$5>0;$5--,i++){
+     if (i==dotoff)
+      j++;
+     this.mant[i]=inchars[j]-'0';
+     j++;
+     }
+    }/*i*/
+   }while(false);}/*simple*/
+
+  /* Looks good.  Set the sign indicator and form, as needed. */
+  // Trailing zeros are preserved
+  // The rule here for form is:
+  //   If no E-notation, then request plain notation
+  //   Otherwise act as though add(0,DEFAULT) and request scientific notation
+  // [form is already PLAIN]
+  if (this.mant[0]==0)
+   {
+    this.ind=this.iszero; // force to show zero
+    // negative exponent is significant (e.g., -3 for 0.000) if plain
+    if (this.exp>0)
+     this.exp=0; // positive exponent can be ignored
+    if (hadexp)
+     { // zero becomes single digit from add
+      this.mant=this.ZERO.mant;
+      this.exp=0;
+     }
+   }
+  else
+   { // non-zero
+    // [ind was set earlier]
+    // now determine form
+    if (hadexp)
+     {
+      this.form=MathContext.prototype.SCIENTIFIC;
+      // 1999.06.29 check for overflow
+      mag=(this.exp+this.mant.length)-1; // true exponent in scientific notation
+      if ((mag<this.MinExp)||(mag>this.MaxExp))
+       this.bad("BigDecimal(): ", inchars);
+     }
+   }
+  // say 'BD(c[]): mant[0] mantlen exp ind form:' mant[0] mant.length exp ind form
+  return;
+  }
+
+ /**
+  * Constructs a <code>BigDecimal</code> object directly from a
+  * <code>double</code>.
+  * <p>
+  * Constructs a <code>BigDecimal</code> which is the exact decimal
+  * representation of the 64-bit signed binary floating point
+  * parameter.
+  * <p>
+  * Note that this constructor it an exact conversion; it does not give
+  * the same result as converting <code>num</code> to a
+  * <code>String</code> using the <code>Double.toString()</code> method
+  * and then using the {@link #BigDecimal(java.lang.String)}
+  * constructor.
+  * To get that result, use the static {@link #valueOf(double)}
+  * method to construct a <code>BigDecimal</code> from a
+  * <code>double</code>.
+  *
+  * @param num The <code>double</code> to be converted.
+  * @throws NumberFormatException if the parameter is infinite or
+  *            not a number.
+  * @stable ICU 2.0
+  */
+
+ //--public BigDecimal(double num){
+ //-- // 1999.03.06: use exactly the old algorithm
+ //-- // 2000.01.01: note that this constructor does give an exact result,
+ //-- //             so perhaps it should not be deprecated
+ //-- // 2000.06.18: no longer deprecated
+ //-- this((new java.math.BigDecimal(num)).toString());
+ //-- return;}
+
+ /**
+  * Constructs a <code>BigDecimal</code> object directly from a
+  * <code>int</code>.
+  * <p>
+  * Constructs a <code>BigDecimal</code> which is the exact decimal
+  * representation of the 32-bit signed binary integer parameter.
+  * The <code>BigDecimal</code> will contain only decimal digits,
+  * prefixed with a leading minus sign (hyphen) if the parameter is
+  * negative.
+  * A leading zero will be present only if the parameter is zero.
+  *
+  * @param num The <code>int</code> to be converted.
+  * @stable ICU 2.0
+  */
+
+ //--public BigDecimal(int num){super();
+ //-- int mun;
+ //-- int i=0;
+ //-- // We fastpath commoners
+ //-- if (num<=9)
+ //--  if (num>=(-9))
+ //--   {singledigit:do{
+ //--    // very common single digit case
+ //--    {/*select*/
+ //--    if (num==0)
+ //--     {
+ //--      mant=ZERO.mant;
+ //--      ind=iszero;
+ //--     }
+ //--    else if (num==1)
+ //--     {
+ //--      mant=ONE.mant;
+ //--      ind=ispos;
+ //--     }
+ //--    else if (num==(-1))
+ //--     {
+ //--      mant=ONE.mant;
+ //--      ind=isneg;
+ //--     }
+ //--    else{
+ //--     {
+ //--      mant=new byte[1];
+ //--      if (num>0)
+ //--       {
+ //--        mant[0]=(byte)num;
+ //--        ind=ispos;
+ //--       }
+ //--      else
+ //--       { // num<-1
+ //--        mant[0]=(byte)((int)-num);
+ //--        ind=isneg;
+ //--       }
+ //--     }
+ //--    }
+ //--    }
+ //--    return;
+ //--   }while(false);}/*singledigit*/
+ //--
+ //-- /* We work on negative numbers so we handle the most negative number */
+ //-- if (num>0)
+ //--  {
+ //--   ind=ispos;
+ //--   num=(int)-num;
+ //--  }
+ //-- else
+ //--  ind=isneg;/* negative */ // [0 case already handled]
+ //-- // [it is quicker, here, to pre-calculate the length with
+ //-- // one loop, then allocate exactly the right length of byte array,
+ //-- // then re-fill it with another loop]
+ //-- mun=num; // working copy
+ //-- {i=9;i:for(;;i--){
+ //--  mun=mun/10;
+ //--  if (mun==0)
+ //--   break i;
+ //--  }
+ //-- }/*i*/
+ //-- // i is the position of the leftmost digit placed
+ //-- mant=new byte[10-i];
+ //-- {i=(10-i)-1;i:for(;;i--){
+ //--  mant[i]=(byte)-(((byte)(num%10)));
+ //--  num=num/10;
+ //--  if (num==0)
+ //--   break i;
+ //--  }
+ //-- }/*i*/
+ //-- return;
+ //-- }
+
+ /**
+  * Constructs a <code>BigDecimal</code> object directly from a
+  * <code>long</code>.
+  * <p>
+  * Constructs a <code>BigDecimal</code> which is the exact decimal
+  * representation of the 64-bit signed binary integer parameter.
+  * The <code>BigDecimal</code> will contain only decimal digits,
+  * prefixed with a leading minus sign (hyphen) if the parameter is
+  * negative.
+  * A leading zero will be present only if the parameter is zero.
+  *
+  * @param num The <code>long</code> to be converted.
+  * @stable ICU 2.0
+  */
+
+ //--public BigDecimal(long num){super();
+ //-- long mun;
+ //-- int i=0;
+ //-- // Not really worth fastpathing commoners in this constructor [also,
+ //-- // we use this to construct the static constants].
+ //-- // This is much faster than: this(String.valueOf(num).toCharArray())
+ //-- /* We work on negative num so we handle the most negative number */
+ //-- if (num>0)
+ //--  {
+ //--   ind=ispos;
+ //--   num=(long)-num;
+ //--  }
+ //-- else
+ //--  if (num==0)
+ //--   ind=iszero;
+ //--  else
+ //--   ind=isneg;/* negative */
+ //-- mun=num;
+ //-- {i=18;i:for(;;i--){
+ //--  mun=mun/10;
+ //--  if (mun==0)
+ //--   break i;
+ //--  }
+ //-- }/*i*/
+ //-- // i is the position of the leftmost digit placed
+ //-- mant=new byte[19-i];
+ //-- {i=(19-i)-1;i:for(;;i--){
+ //--  mant[i]=(byte)-(((byte)(num%10)));
+ //--  num=num/10;
+ //--  if (num==0)
+ //--   break i;
+ //--  }
+ //-- }/*i*/
+ //-- return;
+ //-- }
+
+ /**
+  * Constructs a <code>BigDecimal</code> object from a <code>String</code>.
+  * <p>
+  * Constructs a <code>BigDecimal</code> from the parameter, which must
+  * not be <code>null</code> and must represent a valid <i>number</i>,
+  * as described formally in the documentation referred to
+  * {@link BigDecimal above}.
+  * <p>
+  * In summary, numbers in <code>String</code> form must have at least
+  * one digit, may have a leading sign, may have a decimal point, and
+  * exponential notation may be used.  They follow conventional syntax,
+  * and may not contain blanks.
+  * <p>
+  * Some valid strings from which a <code>BigDecimal</code> might
+  * be constructed are:
+  * <pre>
+  *       "0"         -- Zero
+  *      "12"         -- A whole number
+  *     "-76"         -- A signed whole number
+  *      "12.70"      -- Some decimal places
+  *     "+0.003"      -- Plus sign is allowed
+  *      "17."        -- The same as 17
+  *        ".5"       -- The same as 0.5
+  *      "4E+9"       -- Exponential notation
+  *       "0.73e-7"   -- Exponential notation
+  * </pre>
+  * <p>
+  * (Exponential notation means that the number includes an optional
+  * sign and a power of ten following an '</code>E</code>' that
+  * indicates how the decimal point will be shifted.  Thus the
+  * <code>"4E+9"</code> above is just a short way of writing
+  * <code>4000000000</code>, and the <code>"0.73e-7"</code> is short
+  * for <code>0.000000073</code>.)
+  * <p>
+  * The <code>BigDecimal</code> constructed from the String is in a
+  * standard form, with no blanks, as though the
+  * {@link #add(BigDecimal)} method had been used to add zero to the
+  * number with unlimited precision.
+  * If the string uses exponential notation (that is, includes an
+  * <code>e</code> or an <code>E</code>), then the
+  * <code>BigDecimal</code> number will be expressed in scientific
+  * notation (where the power of ten is adjusted so there is a single
+  * non-zero digit to the left of the decimal point); in this case if
+  * the number is zero then it will be expressed as the single digit 0,
+  * and if non-zero it will have an exponent unless that exponent would
+  * be 0.  The exponent must fit in nine digits both before and after it
+  * is expressed in scientific notation.
+  * <p>
+  * Any digits in the parameter must be decimal; that is,
+  * <code>Character.digit(c, 10)</code> (where </code>c</code> is the
+  * character in question) would not return -1.
+  *
+  * @param string The <code>String</code> to be converted.
+  * @throws NumberFormatException if the parameter is not a valid
+  * number.
+  * @stable ICU 2.0
+  */
+
+ //--public BigDecimal(java.lang.String string){
+ //-- this(string.toCharArray(),0,string.length());
+ //-- return;}
+
+ /* <sgml> Make a default BigDecimal object for local use. </sgml> */
+
+ //--private BigDecimal(){super();
+ //-- return;
+ //-- }
+
+ /* ---------------------------------------------------------------- */
+ /* Operator methods [methods which take a context parameter]        */
+ /* ---------------------------------------------------------------- */
+
+ /**
+  * Returns a plain <code>BigDecimal</code> whose value is the absolute
+  * value of this <code>BigDecimal</code>.
+  * <p>
+  * The same as {@link #abs(MathContext)}, where the context is
+  * <code>new MathContext(0, MathContext.PLAIN)</code>.
+  * <p>
+  * The length of the decimal part (the scale) of the result will
+  * be <code>this.scale()</code>
+  *
+  * @return A <code>BigDecimal</code> whose value is the absolute
+  *         value of this <code>BigDecimal</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal abs(){
+ //- return this.abs(plainMC);
+ //- }
+
+ /**
+  * Returns a <code>BigDecimal</code> whose value is the absolute value
+  * of this <code>BigDecimal</code>.
+  * <p>
+  * If the current object is zero or positive, then the same result as
+  * invoking the {@link #plus(MathContext)} method with the same
+  * parameter is returned.
+  * Otherwise, the same result as invoking the
+  * {@link #negate(MathContext)} method with the same parameter is
+  * returned.
+  *
+  * @param  set The <code>MathContext</code> arithmetic settings.
+  * @return     A <code>BigDecimal</code> whose value is the absolute
+  *             value of this <code>BigDecimal</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal abs(com.ibm.icu.math.MathContext set){
+ function abs() {
+  var set;
+  if (abs.arguments.length == 1)
+   {
+    set = abs.arguments[0];
+   }
+  else if (abs.arguments.length == 0)
+   {
+    set = this.plainMC;
+   }
+  else
+   {
+    throw "abs(): " + abs.arguments.length + " arguments given; expected 0 or 1";
+   }
+  if (this.ind==this.isneg)
+   return this.negate(set);
+  return this.plus(set);
+  }
+
+ /**
+  * Returns a plain <code>BigDecimal</code> whose value is
+  * <code>this+rhs</code>, using fixed point arithmetic.
+  * <p>
+  * The same as {@link #add(BigDecimal, MathContext)},
+  * where the <code>BigDecimal</code> is <code>rhs</code>,
+  * and the context is <code>new MathContext(0, MathContext.PLAIN)</code>.
+  * <p>
+  * The length of the decimal part (the scale) of the result will be
+  * the maximum of the scales of the two operands.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the addition.
+  * @return     A <code>BigDecimal</code> whose value is
+  *             <code>this+rhs</code>, using fixed point arithmetic.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal add(com.ibm.icu.math.BigDecimal rhs){
+ //-- return this.add(rhs,plainMC);
+ //-- }
+
+ /**
+  * Returns a <code>BigDecimal</code> whose value is <code>this+rhs</code>.
+  * <p>
+  * Implements the addition (<b><code>+</code></b>) operator
+  * (as defined in the decimal documentation, see {@link BigDecimal
+  * class header}),
+  * and returns the result as a <code>BigDecimal</code> object.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the addition.
+  * @param  set The <code>MathContext</code> arithmetic settings.
+  * @return     A <code>BigDecimal</code> whose value is
+  *             <code>this+rhs</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal add(com.ibm.icu.math.BigDecimal rhs,com.ibm.icu.math.MathContext set){
+ function add() {
+  var set;
+  if (add.arguments.length == 2)
+   {
+    set = add.arguments[1];
+   }
+  else if (add.arguments.length == 1)
+   {
+    set = this.plainMC;
+   }
+  else
+   {
+    throw "add(): " + add.arguments.length + " arguments given; expected 1 or 2";
+   }
+  var rhs = add.arguments[0];
+  //--com.ibm.icu.math.BigDecimal lhs;
+  var lhs;
+  //--int reqdig;
+  var reqdig;
+  //--com.ibm.icu.math.BigDecimal res;
+  var res;
+  //--byte usel[];
+  var usel;
+  //--int usellen;
+  var usellen;
+  //--byte user[];
+  var user;
+  //--int userlen;
+  var userlen;
+  //--int newlen=0;
+  var newlen=0;
+  //--int tlen=0;
+  var tlen=0;
+  //--int mult=0;
+  var mult=0;
+  //--byte t[]=null;
+  var t=null;
+  //--int ia=0;
+  var ia=0;
+  //--int ib=0;
+  var ib=0;
+  //--int ea=0;
+  var ea=0;
+  //int eb=0;
+  var eb=0;
+  //byte ca=0;
+  var ca=0;
+  //--byte cb=0;
+  var cb=0;
+  /* determine requested digits and form */
+  if (set.lostDigits)
+   this.checkdigits(rhs,set.digits);
+  lhs=this; // name for clarity and proxy
+
+  /* Quick exit for add floating 0 */
+  // plus() will optimize to return same object if possible
+  if (lhs.ind==0)
+   if (set.form!=MathContext.prototype.PLAIN)
+    return rhs.plus(set);
+  if (rhs.ind==0)
+   if (set.form!=MathContext.prototype.PLAIN)
+    return lhs.plus(set);
+
+  /* Prepare numbers (round, unless unlimited precision) */
+  reqdig=set.digits; // local copy (heavily used)
+  if (reqdig>0)
+   {
+    if (lhs.mant.length>reqdig)
+     lhs=this.clone(lhs).round(set);
+    if (rhs.mant.length>reqdig)
+     rhs=this.clone(rhs).round(set);
+   // [we could reuse the new LHS for result in this case]
+   }
+
+  res=new BigDecimal(); // build result here
+
+  /* Now see how much we have to pad or truncate lhs or rhs in order
+     to align the numbers.  If one number is much larger than the
+     other, then the smaller cannot affect the answer [but we may
+     still need to pad with up to DIGITS trailing zeros]. */
+  // Note sign may be 0 if digits (reqdig) is 0
+  // usel and user will be the byte arrays passed to the adder; we'll
+  // use them on all paths except quick exits
+  usel=lhs.mant;
+  usellen=lhs.mant.length;
+  user=rhs.mant;
+  userlen=rhs.mant.length;
+  {padder:do{/*select*/
+  if (lhs.exp==rhs.exp)
+   {/* no padding needed */
+    // This is the most common, and fastest, path
+    res.exp=lhs.exp;
+   }
+  else if (lhs.exp>rhs.exp)
+   { // need to pad lhs and/or truncate rhs
+    newlen=(usellen+lhs.exp)-rhs.exp;
+    /* If, after pad, lhs would be longer than rhs by digits+1 or
+       more (and digits>0) then rhs cannot affect answer, so we only
+       need to pad up to a length of DIGITS+1. */
+    if (newlen>=((userlen+reqdig)+1))
+     if (reqdig>0)
+      {
+       // LHS is sufficient
+       res.mant=usel;
+       res.exp=lhs.exp;
+       res.ind=lhs.ind;
+       if (usellen<reqdig)
+        { // need 0 padding
+         res.mant=this.extend(lhs.mant,reqdig);
+         res.exp=res.exp-((reqdig-usellen));
+        }
+       return res.finish(set,false);
+      }
+    // RHS may affect result
+    res.exp=rhs.exp; // expected final exponent
+    if (newlen>(reqdig+1))
+     if (reqdig>0)
+      {
+       // LHS will be max; RHS truncated
+       tlen=(newlen-reqdig)-1; // truncation length
+       userlen=userlen-tlen;
+       res.exp=res.exp+tlen;
+       newlen=reqdig+1;
+      }
+    if (newlen>usellen)
+     usellen=newlen; // need to pad LHS
+   }
+  else{ // need to pad rhs and/or truncate lhs
+   newlen=(userlen+rhs.exp)-lhs.exp;
+   if (newlen>=((usellen+reqdig)+1))
+    if (reqdig>0)
+     {
+      // RHS is sufficient
+      res.mant=user;
+      res.exp=rhs.exp;
+      res.ind=rhs.ind;
+      if (userlen<reqdig)
+       { // need 0 padding
+        res.mant=this.extend(rhs.mant,reqdig);
+        res.exp=res.exp-((reqdig-userlen));
+       }
+      return res.finish(set,false);
+     }
+   // LHS may affect result
+   res.exp=lhs.exp; // expected final exponent
+   if (newlen>(reqdig+1))
+    if (reqdig>0)
+     {
+      // RHS will be max; LHS truncated
+      tlen=(newlen-reqdig)-1; // truncation length
+      usellen=usellen-tlen;
+      res.exp=res.exp+tlen;
+      newlen=reqdig+1;
+     }
+   if (newlen>userlen)
+    userlen=newlen; // need to pad RHS
+  }
+  }while(false);}/*padder*/
+
+  /* OK, we have aligned mantissas.  Now add or subtract. */
+  // 1998.06.27 Sign may now be 0 [e.g., 0.000] .. treat as positive
+  // 1999.05.27 Allow for 00 on lhs [is not larger than 2 on rhs]
+  // 1999.07.10 Allow for 00 on rhs [is not larger than 2 on rhs]
+  if (lhs.ind==this.iszero)
+   res.ind=this.ispos;
+  else
+   res.ind=lhs.ind; // likely sign, all paths
+  if (((lhs.ind==this.isneg)?1:0)==((rhs.ind==this.isneg)?1:0))  // same sign, 0 non-negative
+   mult=1;
+  else
+   {signdiff:do{ // different signs, so subtraction is needed
+    mult=-1; // will cause subtract
+    /* Before we can subtract we must determine which is the larger,
+       as our add/subtract routine only handles non-negative results
+       so we may need to swap the operands. */
+    {swaptest:do{/*select*/
+    if (rhs.ind==this.iszero)
+     {} // original A bigger
+    else if ((usellen<userlen)||(lhs.ind==this.iszero))
+     { // original B bigger
+      t=usel;
+      usel=user;
+      user=t; // swap
+      tlen=usellen;
+      usellen=userlen;
+      userlen=tlen; // ..
+      res.ind=-res.ind; // and set sign
+     }
+    else if (usellen>userlen)
+     {} // original A bigger
+    else{
+     {/* logical lengths the same */ // need compare
+      /* may still need to swap: compare the strings */
+      ia=0;
+      ib=0;
+      ea=usel.length-1;
+      eb=user.length-1;
+      {compare:for(;;){
+       if (ia<=ea)
+        ca=usel[ia];
+       else
+        {
+         if (ib>eb)
+          {/* identical */
+           if (set.form!=MathContext.prototype.PLAIN)
+            return this.ZERO;
+           // [if PLAIN we must do the subtract, in case of 0.000 results]
+           break compare;
+          }
+         ca=0;
+        }
+       if (ib<=eb)
+        cb=user[ib];
+       else
+        cb=0;
+       if (ca!=cb)
+        {
+         if (ca<cb)
+          {/* swap needed */
+           t=usel;
+           usel=user;
+           user=t; // swap
+           tlen=usellen;
+           usellen=userlen;
+           userlen=tlen; // ..
+           res.ind=-res.ind;
+          }
+         break compare;
+        }
+       /* mantissas the same, so far */
+       ia++;
+       ib++;
+       }
+      }/*compare*/
+     } // lengths the same
+    }
+    }while(false);}/*swaptest*/
+   }while(false);}/*signdiff*/
+
+  /* here, A is > B if subtracting */
+  // add [A+B*1] or subtract [A+(B*-1)]
+  res.mant=this.byteaddsub(usel,usellen,user,userlen,mult,false);
+  // [reuse possible only after chop; accounting makes not worthwhile]
+
+  // Finish() rounds before stripping leading 0's, then sets form, etc.
+  return res.finish(set,false);
+  }
+
+ /**
+  * Compares this <code>BigDecimal</code> to another, using unlimited
+  * precision.
+  * <p>
+  * The same as {@link #compareTo(BigDecimal, MathContext)},
+  * where the <code>BigDecimal</code> is <code>rhs</code>,
+  * and the context is <code>new MathContext(0, MathContext.PLAIN)</code>.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the comparison.
+  * @return     An <code>int</code> whose value is -1, 0, or 1 as
+  *             <code>this</code> is numerically less than, equal to,
+  *             or greater than <code>rhs</code>.
+  * @see    #compareTo(Object)
+  * @stable ICU 2.0
+  */
+
+ //--public int compareTo(com.ibm.icu.math.BigDecimal rhs){
+ //-- return this.compareTo(rhs,plainMC);
+ //-- }
+
+ /**
+  * Compares this <code>BigDecimal</code> to another.
+  * <p>
+  * Implements numeric comparison,
+  * (as defined in the decimal documentation, see {@link BigDecimal
+  * class header}),
+  * and returns a result of type <code>int</code>.
+  * <p>
+  * The result will be:
+  * <table cellpadding=2><tr>
+  * <td align=right><b>-1</b></td>
+  * <td>if the current object is less than the first parameter</td>
+  * </tr><tr>
+  * <td align=right><b>0</b></td>
+  * <td>if the current object is equal to the first parameter</td>
+  * </tr><tr>
+  * <td align=right><b>1</b></td>
+  * <td>if the current object is greater than the first parameter.</td>
+  * </tr></table>
+  * <p>
+  * A {@link #compareTo(Object)} method is also provided.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the comparison.
+  * @param  set The <code>MathContext</code> arithmetic settings.
+  * @return     An <code>int</code> whose value is -1, 0, or 1 as
+  *             <code>this</code> is numerically less than, equal to,
+  *             or greater than <code>rhs</code>.
+  * @see    #compareTo(Object)
+  * @stable ICU 2.0
+  */
+
+ //public int compareTo(com.ibm.icu.math.BigDecimal rhs,com.ibm.icu.math.MathContext set){
+ function compareTo() {
+  var set;
+  if (compareTo.arguments.length == 2)
+   {
+    set = compareTo.arguments[1];
+   }
+  else if (compareTo.arguments.length == 1)
+   {
+    set = this.plainMC;
+   }
+  else
+   {
+    throw "compareTo(): " + compareTo.arguments.length + " arguments given; expected 1 or 2";
+   }
+  var rhs = compareTo.arguments[0];
+  //--int thislength=0;
+  var thislength=0;
+  //--int i=0;
+  var i=0;
+  //--com.ibm.icu.math.BigDecimal newrhs;
+  var newrhs;
+  // rhs=null will raise NullPointerException, as per Comparable interface
+  if (set.lostDigits)
+   this.checkdigits(rhs,set.digits);
+  // [add will recheck in slowpath cases .. but would report -rhs]
+  if ((this.ind==rhs.ind)&&(this.exp==rhs.exp))
+   {
+    /* sign & exponent the same [very common] */
+    thislength=this.mant.length;
+    if (thislength<rhs.mant.length)
+     return -this.ind;
+    if (thislength>rhs.mant.length)
+     return this.ind;
+    /* lengths are the same; we can do a straight mantissa compare
+       unless maybe rounding [rounding is very unusual] */
+    if ((thislength<=set.digits)||(set.digits==0))
+     {
+      {var $6=thislength;i=0;i:for(;$6>0;$6--,i++){
+       if (this.mant[i]<rhs.mant[i])
+        return -this.ind;
+       if (this.mant[i]>rhs.mant[i])
+        return this.ind;
+       }
+      }/*i*/
+      return 0; // identical
+     }
+   /* drop through for full comparison */
+   }
+  else
+   {
+    /* More fastpaths possible */
+    if (this.ind<rhs.ind)
+     return -1;
+    if (this.ind>rhs.ind)
+     return 1;
+   }
+  /* carry out a subtract to make the comparison */
+  newrhs=this.clone(rhs); // safe copy
+  newrhs.ind=-newrhs.ind; // prepare to subtract
+  return this.add(newrhs,set).ind; // add, and return sign of result
+  }
+
+ /**
+  * Returns a plain <code>BigDecimal</code> whose value is
+  * <code>this/rhs</code>, using fixed point arithmetic.
+  * <p>
+  * The same as {@link #divide(BigDecimal, int)},
+  * where the <code>BigDecimal</code> is <code>rhs</code>,
+  * and the rounding mode is {@link MathContext#ROUND_HALF_UP}.
+  *
+  * The length of the decimal part (the scale) of the result will be
+  * the same as the scale of the current object, if the latter were
+  * formatted without exponential notation.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the division.
+  * @return     A plain <code>BigDecimal</code> whose value is
+  *             <code>this/rhs</code>, using fixed point arithmetic.
+  * @throws ArithmeticException if <code>rhs</code> is zero.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal divide(com.ibm.icu.math.BigDecimal rhs){
+ //-- return this.dodivide('D',rhs,plainMC,-1);
+ //-- }
+
+ /**
+  * Returns a plain <code>BigDecimal</code> whose value is
+  * <code>this/rhs</code>, using fixed point arithmetic and a
+  * rounding mode.
+  * <p>
+  * The same as {@link #divide(BigDecimal, int, int)},
+  * where the <code>BigDecimal</code> is <code>rhs</code>,
+  * and the second parameter is <code>this.scale()</code>, and
+  * the third is <code>round</code>.
+  * <p>
+  * The length of the decimal part (the scale) of the result will
+  * therefore be the same as the scale of the current object, if the
+  * latter were formatted without exponential notation.
+  * <p>
+  * @param  rhs   The <code>BigDecimal</code> for the right hand side of
+  *               the division.
+  * @param  round The <code>int</code> rounding mode to be used for
+  *               the division (see the {@link MathContext} class).
+  * @return       A plain <code>BigDecimal</code> whose value is
+  *               <code>this/rhs</code>, using fixed point arithmetic
+  *               and the specified rounding mode.
+  * @throws IllegalArgumentException if <code>round</code> is not a
+  *               valid rounding mode.
+  * @throws ArithmeticException if <code>rhs</code> is zero.
+  * @throws ArithmeticException if <code>round</code> is {@link
+  *               MathContext#ROUND_UNNECESSARY} and
+  *               <code>this.scale()</code> is insufficient to
+  *               represent the result exactly.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal divide(com.ibm.icu.math.BigDecimal rhs,int round){
+ //-- com.ibm.icu.math.MathContext set;
+ //-- set=new com.ibm.icu.math.MathContext(0,com.ibm.icu.math.MathContext.PLAIN,false,round); // [checks round, too]
+ //-- return this.dodivide('D',rhs,set,-1); // take scale from LHS
+ //-- }
+
+ /**
+  * Returns a plain <code>BigDecimal</code> whose value is
+  * <code>this/rhs</code>, using fixed point arithmetic and a
+  * given scale and rounding mode.
+  * <p>
+  * The same as {@link #divide(BigDecimal, MathContext)},
+  * where the <code>BigDecimal</code> is <code>rhs</code>,
+  * <code>new MathContext(0, MathContext.PLAIN, false, round)</code>,
+  * except that the length of the decimal part (the scale) to be used
+  * for the result is explicit rather than being taken from
+  * <code>this</code>.
+  * <p>
+  * The length of the decimal part (the scale) of the result will be
+  * the same as the scale of the current object, if the latter were
+  * formatted without exponential notation.
+  * <p>
+  * @param  rhs   The <code>BigDecimal</code> for the right hand side of
+  *               the division.
+  * @param  scale The <code>int</code> scale to be used for the result.
+  * @param  round The <code>int</code> rounding mode to be used for
+  *               the division (see the {@link MathContext} class).
+  * @return       A plain <code>BigDecimal</code> whose value is
+  *               <code>this/rhs</code>, using fixed point arithmetic
+  *               and the specified rounding mode.
+  * @throws IllegalArgumentException if <code>round</code> is not a
+  *               valid rounding mode.
+  * @throws ArithmeticException if <code>rhs</code> is zero.
+  * @throws ArithmeticException if <code>scale</code> is negative.
+  * @throws ArithmeticException if <code>round</code> is {@link
+  *               MathContext#ROUND_UNNECESSARY} and <code>scale</code>
+  *               is insufficient to represent the result exactly.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal divide(com.ibm.icu.math.BigDecimal rhs,int scale,int round){
+ //-- com.ibm.icu.math.MathContext set;
+ //-- if (scale<0)
+ //--  throw new java.lang.ArithmeticException("Negative scale:"+" "+scale);
+ //-- set=new com.ibm.icu.math.MathContext(0,com.ibm.icu.math.MathContext.PLAIN,false,round); // [checks round]
+ //-- return this.dodivide('D',rhs,set,scale);
+ //-- }
+
+ /**
+  * Returns a <code>BigDecimal</code> whose value is <code>this/rhs</code>.
+  * <p>
+  * Implements the division (<b><code>/</code></b>) operator
+  * (as defined in the decimal documentation, see {@link BigDecimal
+  * class header}),
+  * and returns the result as a <code>BigDecimal</code> object.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the division.
+  * @param  set The <code>MathContext</code> arithmetic settings.
+  * @return     A <code>BigDecimal</code> whose value is
+  *             <code>this/rhs</code>.
+  * @throws ArithmeticException if <code>rhs</code> is zero.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal divide(com.ibm.icu.math.BigDecimal rhs,com.ibm.icu.math.MathContext set){
+ function divide() {
+  var set;
+  var scale = -1;
+  if (divide.arguments.length == 2)
+   {
+    if (typeof divide.arguments[1] == 'number')
+     {
+      set=new MathContext(0,MathContext.prototype.PLAIN,false,divide.arguments[1]); // [checks round, too]
+     }
+    else
+     {
+      set = divide.arguments[1];
+     }
+   }
+  else if (divide.arguments.length == 3)
+   {
+    scale = divide.arguments[1];
+    if (scale<0)
+     throw "divide(): Negative scale: "+scale;
+    set=new MathContext(0,MathContext.prototype.PLAIN,false,divide.arguments[2]); // [checks round]
+   }
+  else if (divide.arguments.length == 1)
+   {
+    set = this.plainMC;
+   }
+  else
+   {
+    throw "divide(): " + divide.arguments.length + " arguments given; expected between 1 and 3";
+   }
+  var rhs = divide.arguments[0];
+  return this.dodivide('D',rhs,set,scale);
+  }
+
+ /**
+  * Returns a plain <code>BigDecimal</code> whose value is the integer
+  * part of <code>this/rhs</code>.
+  * <p>
+  * The same as {@link #divideInteger(BigDecimal, MathContext)},
+  * where the <code>BigDecimal</code> is <code>rhs</code>,
+  * and the context is <code>new MathContext(0, MathContext.PLAIN)</code>.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the integer division.
+  * @return     A <code>BigDecimal</code> whose value is the integer
+  *             part of <code>this/rhs</code>.
+  * @throws ArithmeticException if <code>rhs</code> is zero.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal divideInteger(com.ibm.icu.math.BigDecimal rhs){
+ //-- // scale 0 to drop .000 when plain
+ //-- return this.dodivide('I',rhs,plainMC,0);
+ //-- }
+
+ /**
+  * Returns a <code>BigDecimal</code> whose value is the integer
+  * part of <code>this/rhs</code>.
+  * <p>
+  * Implements the integer division operator
+  * (as defined in the decimal documentation, see {@link BigDecimal
+  * class header}),
+  * and returns the result as a <code>BigDecimal</code> object.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the integer division.
+  * @param  set The <code>MathContext</code> arithmetic settings.
+  * @return     A <code>BigDecimal</code> whose value is the integer
+  *             part of <code>this/rhs</code>.
+  * @throws ArithmeticException if <code>rhs</code> is zero.
+  * @throws ArithmeticException if the result will not fit in the
+  *             number of digits specified for the context.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal divideInteger(com.ibm.icu.math.BigDecimal rhs,com.ibm.icu.math.MathContext set){
+ function divideInteger() {
+  var set;
+  if (divideInteger.arguments.length == 2)
+   {
+    set = divideInteger.arguments[1];
+   }
+  else if (divideInteger.arguments.length == 1)
+   {
+    set = this.plainMC;
+   }
+  else
+   {
+    throw "divideInteger(): " + divideInteger.arguments.length + " arguments given; expected 1 or 2";
+   }
+  var rhs = divideInteger.arguments[0];
+  // scale 0 to drop .000 when plain
+  return this.dodivide('I',rhs,set,0);
+  }
+
+ /**
+  * Returns a plain <code>BigDecimal</code> whose value is
+  * the maximum of <code>this</code> and <code>rhs</code>.
+  * <p>
+  * The same as {@link #max(BigDecimal, MathContext)},
+  * where the <code>BigDecimal</code> is <code>rhs</code>,
+  * and the context is <code>new MathContext(0, MathContext.PLAIN)</code>.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the comparison.
+  * @return     A <code>BigDecimal</code> whose value is
+  *             the maximum of <code>this</code> and <code>rhs</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal max(com.ibm.icu.math.BigDecimal rhs){
+ //-- return this.max(rhs,plainMC);
+ //-- }
+
+ /**
+  * Returns a <code>BigDecimal</code> whose value is
+  * the maximum of <code>this</code> and <code>rhs</code>.
+  * <p>
+  * Returns the larger of the current object and the first parameter.
+  * <p>
+  * If calling the {@link #compareTo(BigDecimal, MathContext)} method
+  * with the same parameters would return <code>1</code> or
+  * <code>0</code>, then the result of calling the
+  * {@link #plus(MathContext)} method on the current object (using the
+  * same <code>MathContext</code> parameter) is returned.
+  * Otherwise, the result of calling the {@link #plus(MathContext)}
+  * method on the first parameter object (using the same
+  * <code>MathContext</code> parameter) is returned.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the comparison.
+  * @param  set The <code>MathContext</code> arithmetic settings.
+  * @return     A <code>BigDecimal</code> whose value is
+  *             the maximum of <code>this</code> and <code>rhs</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal max(com.ibm.icu.math.BigDecimal rhs,com.ibm.icu.math.MathContext set){
+ function max() {
+  var set;
+  if (max.arguments.length == 2)
+   {
+    set = max.arguments[1];
+   }
+  else if (max.arguments.length == 1)
+   {
+    set = this.plainMC;
+   }
+  else
+   {
+    throw "max(): " + max.arguments.length + " arguments given; expected 1 or 2";
+   }
+  var rhs = max.arguments[0];
+  if ((this.compareTo(rhs,set))>=0)
+   return this.plus(set);
+  else
+   return rhs.plus(set);
+  }
+
+ /**
+  * Returns a plain <code>BigDecimal</code> whose value is
+  * the minimum of <code>this</code> and <code>rhs</code>.
+  * <p>
+  * The same as {@link #min(BigDecimal, MathContext)},
+  * where the <code>BigDecimal</code> is <code>rhs</code>,
+  * and the context is <code>new MathContext(0, MathContext.PLAIN)</code>.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the comparison.
+  * @return     A <code>BigDecimal</code> whose value is
+  *             the minimum of <code>this</code> and <code>rhs</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal min(com.ibm.icu.math.BigDecimal rhs){
+ //-- return this.min(rhs,plainMC);
+ //-- }
+
+ /**
+  * Returns a <code>BigDecimal</code> whose value is
+  * the minimum of <code>this</code> and <code>rhs</code>.
+  * <p>
+  * Returns the smaller of the current object and the first parameter.
+  * <p>
+  * If calling the {@link #compareTo(BigDecimal, MathContext)} method
+  * with the same parameters would return <code>-1</code> or
+  * <code>0</code>, then the result of calling the
+  * {@link #plus(MathContext)} method on the current object (using the
+  * same <code>MathContext</code> parameter) is returned.
+  * Otherwise, the result of calling the {@link #plus(MathContext)}
+  * method on the first parameter object (using the same
+  * <code>MathContext</code> parameter) is returned.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the comparison.
+  * @param  set The <code>MathContext</code> arithmetic settings.
+  * @return     A <code>BigDecimal</code> whose value is
+  *             the minimum of <code>this</code> and <code>rhs</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal min(com.ibm.icu.math.BigDecimal rhs,com.ibm.icu.math.MathContext set){
+ function min() {
+  var set;
+  if (min.arguments.length == 2)
+   {
+    set = min.arguments[1];
+   }
+  else if (min.arguments.length == 1)
+   {
+    set = this.plainMC;
+   }
+  else
+   {
+    throw "min(): " + min.arguments.length + " arguments given; expected 1 or 2";
+   }
+  var rhs = min.arguments[0];
+  if ((this.compareTo(rhs,set))<=0)
+   return this.plus(set);
+  else
+   return rhs.plus(set);
+  }
+
+ /**
+  * Returns a plain <code>BigDecimal</code> whose value is
+  * <code>this*rhs</code>, using fixed point arithmetic.
+  * <p>
+  * The same as {@link #add(BigDecimal, MathContext)},
+  * where the <code>BigDecimal</code> is <code>rhs</code>,
+  * and the context is <code>new MathContext(0, MathContext.PLAIN)</code>.
+  * <p>
+  * The length of the decimal part (the scale) of the result will be
+  * the sum of the scales of the operands, if they were formatted
+  * without exponential notation.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the multiplication.
+  * @return     A <code>BigDecimal</code> whose value is
+  *             <code>this*rhs</code>, using fixed point arithmetic.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal multiply(com.ibm.icu.math.BigDecimal rhs){
+ //-- return this.multiply(rhs,plainMC);
+ //-- }
+
+ /**
+  * Returns a <code>BigDecimal</code> whose value is <code>this*rhs</code>.
+  * <p>
+  * Implements the multiplication (<b><code>*</code></b>) operator
+  * (as defined in the decimal documentation, see {@link BigDecimal
+  * class header}),
+  * and returns the result as a <code>BigDecimal</code> object.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the multiplication.
+  * @param  set The <code>MathContext</code> arithmetic settings.
+  * @return     A <code>BigDecimal</code> whose value is
+  *             <code>this*rhs</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal multiply(com.ibm.icu.math.BigDecimal rhs,com.ibm.icu.math.MathContext set){
+ function multiply() {
+  var set;
+  if (multiply.arguments.length == 2)
+   {
+    set = multiply.arguments[1];
+   }
+  else if (multiply.arguments.length == 1)
+   {
+    set = this.plainMC;
+   }
+  else
+   {
+    throw "multiply(): " + multiply.arguments.length + " arguments given; expected 1 or 2";
+   }
+  var rhs = multiply.arguments[0];
+  //--com.ibm.icu.math.BigDecimal lhs;
+  var lhs;
+  //--int padding;
+  var padding;
+  //--int reqdig;
+  var reqdig;
+  //--byte multer[]=null;
+  var multer=null;
+  //--byte multand[]=null;
+  var multand=null;
+  //--int multandlen;
+  var multandlen;
+  //--int acclen=0;
+  var acclen=0;
+  //--com.ibm.icu.math.BigDecimal res;
+  var res;
+  //--byte acc[];
+  var acc;
+  //--int n=0;
+  var n=0;
+  //--byte mult=0;
+  var mult=0;
+  if (set.lostDigits)
+   this.checkdigits(rhs,set.digits);
+  lhs=this; // name for clarity and proxy
+
+  /* Prepare numbers (truncate, unless unlimited precision) */
+  padding=0; // trailing 0's to add
+  reqdig=set.digits; // local copy
+  if (reqdig>0)
+   {
+    if (lhs.mant.length>reqdig)
+     lhs=this.clone(lhs).round(set);
+    if (rhs.mant.length>reqdig)
+     rhs=this.clone(rhs).round(set);
+   // [we could reuse the new LHS for result in this case]
+   }
+  else
+   {/* unlimited */
+    // fixed point arithmetic will want every trailing 0; we add these
+    // after the calculation rather than before, for speed.
+    if (lhs.exp>0)
+     padding=padding+lhs.exp;
+    if (rhs.exp>0)
+     padding=padding+rhs.exp;
+   }
+
+  // For best speed, as in DMSRCN, we use the shorter number as the
+  // multiplier and the longer as the multiplicand.
+  // 1999.12.22: We used to special case when the result would fit in
+  //             a long, but with Java 1.3 this gave no advantage.
+  if (lhs.mant.length<rhs.mant.length)
+   {
+    multer=lhs.mant;
+    multand=rhs.mant;
+   }
+  else
+   {
+    multer=rhs.mant;
+    multand=lhs.mant;
+   }
+
+  /* Calculate how long result byte array will be */
+  multandlen=(multer.length+multand.length)-1; // effective length
+  // optimize for 75% of the cases where a carry is expected...
+  if ((multer[0]*multand[0])>9)
+   acclen=multandlen+1;
+  else
+   acclen=multandlen;
+
+  /* Now the main long multiplication loop */
+  res=new BigDecimal(); // where we'll build result
+  acc=this.createArrayWithZeros(acclen); // accumulator, all zeros
+  // 1998.07.01: calculate from left to right so that accumulator goes
+  // to likely final length on first addition; this avoids a one-digit
+  // extension (and object allocation) each time around the loop.
+  // Initial number therefore has virtual zeros added to right.
+  {var $7=multer.length;n=0;n:for(;$7>0;$7--,n++){
+   mult=multer[n];
+   if (mult!=0)
+    { // [optimization]
+     // accumulate [accumulator is reusable array]
+     acc=this.byteaddsub(acc,acc.length,multand,multandlen,mult,true);
+    }
+   // divide multiplicand by 10 for next digit to right
+   multandlen--; // 'virtual length'
+   }
+  }/*n*/
+
+  res.ind=lhs.ind*rhs.ind; // final sign
+  res.exp=(lhs.exp+rhs.exp)-padding; // final exponent
+  // [overflow is checked by finish]
+
+  /* add trailing zeros to the result, if necessary */
+  if (padding==0)
+   res.mant=acc;
+  else
+   res.mant=this.extend(acc,acc.length+padding); // add trailing 0s
+  return res.finish(set,false);
+  }
+
+ /**
+  * Returns a plain <code>BigDecimal</code> whose value is
+  * <code>-this</code>.
+  * <p>
+  * The same as {@link #negate(MathContext)}, where the context is
+  * <code>new MathContext(0, MathContext.PLAIN)</code>.
+  * <p>
+  * The length of the decimal part (the scale) of the result will be
+  * be <code>this.scale()</code>
+  *
+  *
+  * @return A <code>BigDecimal</code> whose value is
+  *         <code>-this</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal negate(){
+ //-- return this.negate(plainMC);
+ //-- }
+
+ /**
+  * Returns a <code>BigDecimal</code> whose value is <code>-this</code>.
+  * <p>
+  * Implements the negation (Prefix <b><code>-</code></b>) operator
+  * (as defined in the decimal documentation, see {@link BigDecimal
+  * class header}),
+  * and returns the result as a <code>BigDecimal</code> object.
+  *
+  * @param  set The <code>MathContext</code> arithmetic settings.
+  * @return A <code>BigDecimal</code> whose value is
+  *         <code>-this</code>.
+  * @stable ICU 2.0
+  */
+
+ //public com.ibm.icu.math.BigDecimal negate(com.ibm.icu.math.MathContext set){
+ function negate() {
+  var set;
+  if (negate.arguments.length == 1)
+   {
+    set = negate.arguments[0];
+   }
+  else if (negate.arguments.length == 0)
+   {
+    set = this.plainMC;
+   }
+  else
+   {
+    throw "negate(): " + negate.arguments.length + " arguments given; expected 0 or 1";
+   }
+  //--com.ibm.icu.math.BigDecimal res;
+  var res;
+  // Originally called minus(), changed to matched Java precedents
+  // This simply clones, flips the sign, and possibly rounds
+  if (set.lostDigits)
+   this.checkdigits(null,set.digits);
+  res=this.clone(this); // safe copy
+  res.ind=-res.ind;
+  return res.finish(set,false);
+  }
+
+ /**
+  * Returns a plain <code>BigDecimal</code> whose value is
+  * <code>+this</code>.
+  * Note that <code>this</code> is not necessarily a
+  * plain <code>BigDecimal</code>, but the result will always be.
+  * <p>
+  * The same as {@link #plus(MathContext)}, where the context is
+  * <code>new MathContext(0, MathContext.PLAIN)</code>.
+  * <p>
+  * The length of the decimal part (the scale) of the result will be
+  * be <code>this.scale()</code>
+  *
+  * @return A <code>BigDecimal</code> whose value is
+  *         <code>+this</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal plus(){
+ //-- return this.plus(plainMC);
+ //-- }
+
+ /**
+  * Returns a <code>BigDecimal</code> whose value is
+  * <code>+this</code>.
+  * <p>
+  * Implements the plus (Prefix <b><code>+</code></b>) operator
+  * (as defined in the decimal documentation, see {@link BigDecimal
+  * class header}),
+  * and returns the result as a <code>BigDecimal</code> object.
+  * <p>
+  * This method is useful for rounding or otherwise applying a context
+  * to a decimal value.
+  *
+  * @param  set The <code>MathContext</code> arithmetic settings.
+  * @return A <code>BigDecimal</code> whose value is
+  *         <code>+this</code>.
+  * @stable ICU 2.0
+  */
+
+ //public com.ibm.icu.math.BigDecimal plus(com.ibm.icu.math.MathContext set){
+ function plus() {
+  var set;
+  if (plus.arguments.length == 1)
+   {
+    set = plus.arguments[0];
+   }
+  else if (plus.arguments.length == 0)
+   {
+    set = this.plainMC;
+   }
+  else
+   {
+    throw "plus(): " + plus.arguments.length + " arguments given; expected 0 or 1";
+   }
+  // This clones and forces the result to the new settings
+  // May return same object
+  if (set.lostDigits)
+   this.checkdigits(null,set.digits);
+  // Optimization: returns same object for some common cases
+  if (set.form==MathContext.prototype.PLAIN)
+   if (this.form==MathContext.prototype.PLAIN)
+    {
+     if (this.mant.length<=set.digits)
+      return this;
+     if (set.digits==0)
+      return this;
+    }
+  return this.clone(this).finish(set,false);
+  }
+
+ /**
+  * Returns a plain <code>BigDecimal</code> whose value is
+  * <code>this**rhs</code>, using fixed point arithmetic.
+  * <p>
+  * The same as {@link #pow(BigDecimal, MathContext)},
+  * where the <code>BigDecimal</code> is <code>rhs</code>,
+  * and the context is <code>new MathContext(0, MathContext.PLAIN)</code>.
+  * <p>
+  * The parameter is the power to which the <code>this</code> will be
+  * raised; it must be in the range 0 through 999999999, and must
+  * have a decimal part of zero.  Note that these restrictions may be
+  * removed in the future, so they should not be used as a test for a
+  * whole number.
+  * <p>
+  * In addition, the power must not be negative, as no
+  * <code>MathContext</code> is used and so the result would then
+  * always be 0.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the operation (the power).
+  * @return     A <code>BigDecimal</code> whose value is
+  *             <code>this**rhs</code>, using fixed point arithmetic.
+  * @throws ArithmeticException if <code>rhs</code> is out of range or
+  *             is not a whole number.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal pow(com.ibm.icu.math.BigDecimal rhs){
+ //-- return this.pow(rhs,plainMC);
+ //-- }
+ // The name for this method is inherited from the precedent set by the
+ // BigInteger and Math classes.
+
+ /**
+  * Returns a <code>BigDecimal</code> whose value is <code>this**rhs</code>.
+  * <p>
+  * Implements the power (<b><code>**</code></b>) operator
+  * (as defined in the decimal documentation, see {@link BigDecimal
+  * class header}),
+  * and returns the result as a <code>BigDecimal</code> object.
+  * <p>
+  * The first parameter is the power to which the <code>this</code>
+  * will be raised; it must be in the range -999999999 through
+  * 999999999, and must have a decimal part of zero.  Note that these
+  * restrictions may be removed in the future, so they should not be
+  * used as a test for a whole number.
+  * <p>
+  * If the <code>digits</code> setting of the <code>MathContext</code>
+  * parameter is 0, the power must be zero or positive.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the operation (the power).
+  * @param  set The <code>MathContext</code> arithmetic settings.
+  * @return     A <code>BigDecimal</code> whose value is
+  *             <code>this**rhs</code>.
+  * @throws ArithmeticException if <code>rhs</code> is out of range or
+  *             is not a whole number.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal pow(com.ibm.icu.math.BigDecimal rhs,com.ibm.icu.math.MathContext set){
+ function pow() {
+  var set;
+  if (pow.arguments.length == 2)
+   {
+    set = pow.arguments[1];
+   }
+  else if (pow.arguments.length == 1)
+   {
+    set = this.plainMC;
+   }
+  else
+   {
+    throw "pow(): " + pow.arguments.length + " arguments given; expected 1 or 2";
+   }
+  var rhs = pow.arguments[0];
+  //--int n;
+  var n;
+  //--com.ibm.icu.math.BigDecimal lhs;
+  var lhs;
+  //--int reqdig;
+  var reqdig;
+  //-- int workdigits=0;
+  var workdigits=0;
+  //--int L=0;
+  var L=0;
+  //--com.ibm.icu.math.MathContext workset;
+  var workset;
+  //--com.ibm.icu.math.BigDecimal res;
+  var res;
+  //--boolean seenbit;
+  var seenbit;
+  //--int i=0;
+  var i=0;
+  if (set.lostDigits)
+   this.checkdigits(rhs,set.digits);
+  n=rhs.intcheck(this.MinArg,this.MaxArg); // check RHS by the rules
+  lhs=this; // clarified name
+
+  reqdig=set.digits; // local copy (heavily used)
+  if (reqdig==0)
+   {
+    if (rhs.ind==this.isneg)
+     //--throw new java.lang.ArithmeticException("Negative power:"+" "+rhs.toString());
+     throw "pow(): Negative power: " + rhs.toString();
+    workdigits=0;
+   }
+  else
+   {/* non-0 digits */
+    if ((rhs.mant.length+rhs.exp)>reqdig)
+     //--throw new java.lang.ArithmeticException("Too many digits:"+" "+rhs.toString());
+     throw "pow(): Too many digits: " + rhs.toString();
+
+    /* Round the lhs to DIGITS if need be */
+    if (lhs.mant.length>reqdig)
+     lhs=this.clone(lhs).round(set);
+
+    /* L for precision calculation [see ANSI X3.274-1996] */
+    L=rhs.mant.length+rhs.exp; // length without decimal zeros/exp
+    workdigits=(reqdig+L)+1; // calculate the working DIGITS
+   }
+
+  /* Create a copy of set for working settings */
+  // Note: no need to check for lostDigits again.
+  // 1999.07.17 Note: this construction must follow RHS check
+  workset=new MathContext(workdigits,set.form,false,set.roundingMode);
+
+  res=this.ONE; // accumulator
+  if (n==0)
+   return res; // x**0 == 1
+  if (n<0)
+   n=-n; // [rhs.ind records the sign]
+  seenbit=false; // set once we've seen a 1-bit
+  {i=1;i:for(;;i++){ // for each bit [top bit ignored]
+   //n=n+n; // shift left 1 bit
+   n<<=1;
+   if (n<0)
+    { // top bit is set
+     seenbit=true; // OK, we're off
+     res=res.multiply(lhs,workset); // acc=acc*x
+    }
+   if (i==31)
+    break i; // that was the last bit
+   if ((!seenbit))
+    continue i; // we don't have to square 1
+   res=res.multiply(res,workset); // acc=acc*acc [square]
+   }
+  }/*i*/ // 32 bits
+  if (rhs.ind<0)  // was a **-n [hence digits>0]
+   res=this.ONE.divide(res,workset); // .. so acc=1/acc
+  return res.finish(set,true); // round and strip [original digits]
+  }
+
+ /**
+  * Returns a plain <code>BigDecimal</code> whose value is
+  * the remainder of <code>this/rhs</code>, using fixed point arithmetic.
+  * <p>
+  * The same as {@link #remainder(BigDecimal, MathContext)},
+  * where the <code>BigDecimal</code> is <code>rhs</code>,
+  * and the context is <code>new MathContext(0, MathContext.PLAIN)</code>.
+  * <p>
+  * This is not the modulo operator -- the result may be negative.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the remainder operation.
+  * @return     A <code>BigDecimal</code> whose value is the remainder
+  *             of <code>this/rhs</code>, using fixed point arithmetic.
+  * @throws ArithmeticException if <code>rhs</code> is zero.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal remainder(com.ibm.icu.math.BigDecimal rhs){
+ //-- return this.dodivide('R',rhs,plainMC,-1);
+ //-- }
+
+ /**
+  * Returns a <code>BigDecimal</code> whose value is the remainder of
+  * <code>this/rhs</code>.
+  * <p>
+  * Implements the remainder operator
+  * (as defined in the decimal documentation, see {@link BigDecimal
+  * class header}),
+  * and returns the result as a <code>BigDecimal</code> object.
+  * <p>
+  * This is not the modulo operator -- the result may be negative.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the remainder operation.
+  * @param  set The <code>MathContext</code> arithmetic settings.
+  * @return     A <code>BigDecimal</code> whose value is the remainder
+  *             of <code>this+rhs</code>.
+  * @throws ArithmeticException if <code>rhs</code> is zero.
+  * @throws ArithmeticException if the integer part of the result will
+  *             not fit in the number of digits specified for the
+  *             context.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal remainder(com.ibm.icu.math.BigDecimal rhs,com.ibm.icu.math.MathContext set){
+ function remainder() {
+  var set;
+  if (remainder.arguments.length == 2)
+   {
+    set = remainder.arguments[1];
+   }
+  else if (remainder.arguments.length == 1)
+   {
+    set = this.plainMC;
+   }
+  else
+   {
+    throw "remainder(): " + remainder.arguments.length + " arguments given; expected 1 or 2";
+   }
+  var rhs = remainder.arguments[0];
+  return this.dodivide('R',rhs,set,-1);
+  }
+
+ /**
+  * Returns a plain <code>BigDecimal</code> whose value is
+  * <code>this-rhs</code>, using fixed point arithmetic.
+  * <p>
+  * The same as {@link #subtract(BigDecimal, MathContext)},
+  * where the <code>BigDecimal</code> is <code>rhs</code>,
+  * and the context is <code>new MathContext(0, MathContext.PLAIN)</code>.
+  * <p>
+  * The length of the decimal part (the scale) of the result will be
+  * the maximum of the scales of the two operands.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the subtraction.
+  * @return     A <code>BigDecimal</code> whose value is
+  *             <code>this-rhs</code>, using fixed point arithmetic.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal subtract(com.ibm.icu.math.BigDecimal rhs){
+ //-- return this.subtract(rhs,plainMC);
+ //-- }
+
+ /**
+  * Returns a <code>BigDecimal</code> whose value is <code>this-rhs</code>.
+  * <p>
+  * Implements the subtraction (<b><code>-</code></b>) operator
+  * (as defined in the decimal documentation, see {@link BigDecimal
+  * class header}),
+  * and returns the result as a <code>BigDecimal</code> object.
+  *
+  * @param  rhs The <code>BigDecimal</code> for the right hand side of
+  *             the subtraction.
+  * @param  set The <code>MathContext</code> arithmetic settings.
+  * @return     A <code>BigDecimal</code> whose value is
+  *             <code>this-rhs</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal subtract(com.ibm.icu.math.BigDecimal rhs,com.ibm.icu.math.MathContext set){
+ function subtract() {
+  var set;
+  if (subtract.arguments.length == 2)
+   {
+    set = subtract.arguments[1];
+   }
+  else if (subtract.arguments.length == 1)
+   {
+    set = this.plainMC;
+   }
+  else
+   {
+    throw "subtract(): " + subtract.arguments.length + " arguments given; expected 1 or 2";
+   }
+  var rhs = subtract.arguments[0];
+  //--com.ibm.icu.math.BigDecimal newrhs;
+  var newrhs;
+  if (set.lostDigits)
+   this.checkdigits(rhs,set.digits);
+  // [add will recheck .. but would report -rhs]
+  /* carry out the subtraction */
+  // we could fastpath -0, but it is too rare.
+  newrhs=this.clone(rhs); // safe copy
+  newrhs.ind=-newrhs.ind; // prepare to subtract
+  return this.add(newrhs,set); // arithmetic
+  }
+
+ /* ---------------------------------------------------------------- */
+ /* Other methods                                                    */
+ /* ---------------------------------------------------------------- */
+
+ /**
+  * Converts this <code>BigDecimal</code> to a <code>byte</code>.
+  * If the <code>BigDecimal</code> has a non-zero decimal part or is
+  * out of the possible range for a <code>byte</code> (8-bit signed
+  * integer) result then an <code>ArithmeticException</code> is thrown.
+  *
+  * @return A <code>byte</code> equal in value to <code>this</code>.
+  * @throws ArithmeticException if <code>this</code> has a non-zero
+  *                 decimal part, or will not fit in a <code>byte</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public byte byteValueExact(){
+ //-- int num;
+ //-- num=this.intValueExact(); // will check decimal part too
+ //-- if ((num>127)|(num<(-128)))
+ //--  throw new java.lang.ArithmeticException("Conversion overflow:"+" "+this.toString());
+ //-- return (byte)num;
+ //-- }
+
+ /**
+  * Compares this <code>BigDecimal</code> with the value of the parameter.
+  * <p>
+  * If the parameter is <code>null</code>, or is not an instance of the
+  * <code>BigDecimal</code> type, an exception is thrown.
+  * Otherwise, the parameter is cast to type <code>BigDecimal</code>
+  * and the result of the {@link #compareTo(BigDecimal)} method,
+  * using the cast parameter, is returned.
+  * <p>
+  * The {@link #compareTo(BigDecimal, MathContext)} method should be
+  * used when a <code>MathContext</code> is needed for the comparison.
+  *
+  * @param  rhs The <code>Object</code> for the right hand side of
+  *             the comparison.
+  * @return     An <code>int</code> whose value is -1, 0, or 1 as
+  *             <code>this</code> is numerically less than, equal to,
+  *             or greater than <code>rhs</code>.
+  * @throws ClassCastException if <code>rhs</code> cannot be cast to
+  *                 a <code>BigDecimal</code> object.
+  * @see    #compareTo(BigDecimal)
+  * @stable ICU 2.0
+  */
+
+ //--public int compareTo(java.lang.Object rhsobj){
+ //-- // the cast in the next line will raise ClassCastException if necessary
+ //-- return compareTo((com.ibm.icu.math.BigDecimal)rhsobj,plainMC);
+ //-- }
+
+ /**
+  * Converts this <code>BigDecimal</code> to a <code>double</code>.
+  * If the <code>BigDecimal</code> is out of the possible range for a
+  * <code>double</code> (64-bit signed floating point) result then an
+  * <code>ArithmeticException</code> is thrown.
+  * <p>
+  * The double produced is identical to result of expressing the
+  * <code>BigDecimal</code> as a <code>String</code> and then
+  * converting it using the <code>Double(String)</code> constructor;
+  * this can result in values of <code>Double.NEGATIVE_INFINITY</code>
+  * or <code>Double.POSITIVE_INFINITY</code>.
+  *
+  * @return A <code>double</code> corresponding to <code>this</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public double doubleValue(){
+ //-- // We go via a String [as does BigDecimal in JDK 1.2]
+ //-- // Next line could possibly raise NumberFormatException
+ //-- return java.lang.Double.valueOf(this.toString()).doubleValue();
+ //-- }
+
+ /**
+  * Compares this <code>BigDecimal</code> with <code>rhs</code> for
+  * equality.
+  * <p>
+  * If the parameter is <code>null</code>, or is not an instance of the
+  * BigDecimal type, or is not exactly equal to the current
+  * <code>BigDecimal</code> object, then <i>false</i> is returned.
+  * Otherwise, <i>true</i> is returned.
+  * <p>
+  * "Exactly equal", here, means that the <code>String</code>
+  * representations of the <code>BigDecimal</code> numbers are
+  * identical (they have the same characters in the same sequence).
+  * <p>
+  * The {@link #compareTo(BigDecimal, MathContext)} method should be
+  * used for more general comparisons.
+  * @param  rhs The <code>Object</code> for the right hand side of
+  *             the comparison.
+  * @return     A <code>boolean</code> whose value <i>true</i> if and
+  *             only if the operands have identical string representations.
+  * @throws ClassCastException if <code>rhs</code> cannot be cast to
+  *                 a <code>BigDecimal</code> object.
+  * @stable ICU 2.0
+  * @see    #compareTo(Object)
+  * @see    #compareTo(BigDecimal)
+  * @see    #compareTo(BigDecimal, MathContext)
+  */
+
+ //--public boolean equals(java.lang.Object obj){
+ function equals(obj) {
+  //--com.ibm.icu.math.BigDecimal rhs;
+  var rhs;
+  //--int i=0;
+  var i=0;
+  //--char lca[]=null;
+  var lca=null;
+  //--char rca[]=null;
+  var rca=null;
+  // We are equal iff toString of both are exactly the same
+  if (obj==null)
+   return false; // not equal
+  if ((!(((obj instanceof BigDecimal)))))
+   return false; // not a decimal
+  rhs=obj; // cast; we know it will work
+  if (this.ind!=rhs.ind)
+   return false; // different signs never match
+  if (((this.mant.length==rhs.mant.length)&&(this.exp==rhs.exp))&&(this.form==rhs.form))
+
+   { // mantissas say all
+    // here with equal-length byte arrays to compare
+    {var $8=this.mant.length;i=0;i:for(;$8>0;$8--,i++){
+     if (this.mant[i]!=rhs.mant[i])
+      return false;
+     }
+    }/*i*/
+   }
+  else
+   { // need proper layout
+    lca=this.layout(); // layout to character array
+    rca=rhs.layout();
+    if (lca.length!=rca.length)
+     return false; // mismatch
+    // here with equal-length character arrays to compare
+    {var $9=lca.length;i=0;i:for(;$9>0;$9--,i++){
+     if (lca[i]!=rca[i])
+      return false;
+     }
+    }/*i*/
+   }
+  return true; // arrays have identical content
+  }
+
+ /**
+  * Converts this <code>BigDecimal</code> to a <code>float</code>.
+  * If the <code>BigDecimal</code> is out of the possible range for a
+  * <code>float</code> (32-bit signed floating point) result then an
+  * <code>ArithmeticException</code> is thrown.
+  * <p>
+  * The float produced is identical to result of expressing the
+  * <code>BigDecimal</code> as a <code>String</code> and then
+  * converting it using the <code>Float(String)</code> constructor;
+  * this can result in values of <code>Float.NEGATIVE_INFINITY</code>
+  * or <code>Float.POSITIVE_INFINITY</code>.
+  *
+  * @return A <code>float</code> corresponding to <code>this</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public float floatValue(){
+ //-- return java.lang.Float.valueOf(this.toString()).floatValue();
+ //-- }
+
+ /**
+  * Returns the <code>String</code> representation of this
+  * <code>BigDecimal</code>, modified by layout parameters.
+  * <p>
+  * <i>This method is provided as a primitive for use by more
+  * sophisticated classes, such as <code>DecimalFormat</code>, that
+  * can apply locale-sensitive editing of the result.  The level of
+  * formatting that it provides is a necessary part of the BigDecimal
+  * class as it is sensitive to and must follow the calculation and
+  * rounding rules for BigDecimal arithmetic.
+  * However, if the function is provided elsewhere, it may be removed
+  * from this class. </i>
+  * <p>
+  * The parameters, for both forms of the <code>format</code> method
+  * are all of type <code>int</code>.
+  * A value of -1 for any parameter indicates that the default action
+  * or value for that parameter should be used.
+  * <p>
+  * The parameters, <code>before</code> and <code>after</code>,
+  * specify the number of characters to be used for the integer part
+  * and decimal part of the result respectively.  Exponential notation
+  * is not used. If either parameter is -1 (which indicates the default
+  * action), the number of characters used will be exactly as many as
+  * are needed for that part.
+  * <p>
+  * <code>before</code> must be a positive number; if it is larger than
+  * is needed to contain the integer part, that part is padded on the
+  * left with blanks to the requested length. If <code>before</code> is
+  * not large enough to contain the integer part of the number
+  * (including the sign, for negative numbers) an exception is thrown.
+  * <p>
+  * <code>after</code> must be a non-negative number; if it is not the
+  * same size as the decimal part of the number, the number will be
+  * rounded (or extended with zeros) to fit.  Specifying 0 for
+  * <code>after</code> will cause the number to be rounded to an
+  * integer (that is, it will have no decimal part or decimal point).
+  * The rounding method will be the default,
+  * <code>MathContext.ROUND_HALF_UP</code>.
+  * <p>
+  * Other rounding methods, and the use of exponential notation, can
+  * be selected by using {@link #format(int,int,int,int,int,int)}.
+  * Using the two-parameter form of the method has exactly the same
+  * effect as using the six-parameter form with the final four
+  * parameters all being -1.
+  *
+  * @param  before The <code>int</code> specifying the number of places
+  *                before the decimal point.  Use -1 for 'as many as
+  *                are needed'.
+  * @param  after  The <code>int</code> specifying the number of places
+  *                after the decimal point.  Use -1 for 'as many as are
+  *                needed'.
+  * @return        A <code>String</code> representing this
+  *                <code>BigDecimal</code>, laid out according to the
+  *                specified parameters
+  * @throws ArithmeticException if the number cannot be laid out as
+  *                requested.
+  * @throws IllegalArgumentException if a parameter is out of range.
+  * @stable ICU 2.0
+  * @see    #toString
+  * @see    #toCharArray
+  */
+
+ //--public java.lang.String format(int before,int after){
+ //-- return format(before,after,-1,-1,com.ibm.icu.math.MathContext.SCIENTIFIC,ROUND_HALF_UP);
+ //-- }
+
+ /**
+  * Returns the <code>String</code> representation of this
+  * <code>BigDecimal</code>, modified by layout parameters and allowing
+  * exponential notation.
+  * <p>
+  * <i>This method is provided as a primitive for use by more
+  * sophisticated classes, such as <code>DecimalFormat</code>, that
+  * can apply locale-sensitive editing of the result.  The level of
+  * formatting that it provides is a necessary part of the BigDecimal
+  * class as it is sensitive to and must follow the calculation and
+  * rounding rules for BigDecimal arithmetic.
+  * However, if the function is provided elsewhere, it may be removed
+  * from this class. </i>
+  * <p>
+  * The parameters are all of type <code>int</code>.
+  * A value of -1 for any parameter indicates that the default action
+  * or value for that parameter should be used.
+  * <p>
+  * The first two parameters (<code>before</code> and
+  * <code>after</code>) specify the number of characters to be used for
+  * the integer part and decimal part of the result respectively, as
+  * defined for {@link #format(int,int)}.
+  * If either of these is -1 (which indicates the default action), the
+  * number of characters used will be exactly as many as are needed for
+  * that part.
+  * <p>
+  * The remaining parameters control the use of exponential notation
+  * and rounding.  Three (<code>explaces</code>, <code>exdigits</code>,
+  * and <code>exform</code>) control the exponent part of the result.
+  * As before, the default action for any of these parameters may be
+  * selected by using the value -1.
+  * <p>
+  * <code>explaces</code> must be a positive number; it sets the number
+  * of places (digits after the sign of the exponent) to be used for
+  * any exponent part, the default (when <code>explaces</code> is -1)
+  * being to use as many as are needed.
+  * If <code>explaces</code> is not -1, space is always reserved for
+  * an exponent; if one is not needed (for example, if the exponent
+  * will be 0) then <code>explaces</code>+2 blanks are appended to the
+  * result.
+  * <!-- (This preserves vertical alignment of similarly formatted
+  *       numbers in a monospace font.) -->
+  * If <code>explaces</code> is not -1 and is not large enough to
+  * contain the exponent, an exception is thrown.
+  * <p>
+  * <code>exdigits</code> sets the trigger point for use of exponential
+  * notation. If, before any rounding, the number of places needed
+  * before the decimal point exceeds <code>exdigits</code>, or if the
+  * absolute value of the result is less than <code>0.000001</code>,
+  * then exponential form will be used, provided that
+  * <code>exdigits</code> was specified.
+  * When <code>exdigits</code> is -1, exponential notation will never
+  * be used. If 0 is specified for <code>exdigits</code>, exponential
+  * notation is always used unless the exponent would be 0.
+  * <p>
+  * <code>exform</code> sets the form for exponential notation (if
+  * needed).
+  * It  may be either {@link MathContext#SCIENTIFIC} or
+  * {@link MathContext#ENGINEERING}.
+  * If the latter, engineering, form is requested, up to three digits
+  * (plus sign, if negative) may be needed for the integer part of the
+  * result (<code>before</code>).  Otherwise, only one digit (plus
+  * sign, if negative) is needed.
+  * <p>
+  * Finally, the sixth argument, <code>exround</code>, selects the
+  * rounding algorithm to be used, and must be one of the values
+  * indicated by a public constant in the {@link MathContext} class
+  * whose name starts with <code>ROUND_</code>.
+  * The default (<code>ROUND_HALF_UP</code>) may also be selected by
+  * using the value -1, as before.
+  * <p>
+  * The special value <code>MathContext.ROUND_UNNECESSARY</code> may be
+  * used to detect whether non-zero digits are discarded -- if
+  * <code>exround</code> has this value than if non-zero digits would
+  * be discarded (rounded) during formatting then an
+  * <code>ArithmeticException</code> is thrown.
+  *
+  * @param  before   The <code>int</code> specifying the number of places
+  *                  before the decimal point.
+  *                  Use -1 for 'as many as are needed'.
+  * @param  after    The <code>int</code> specifying the number of places
+  *                  after the decimal point.
+  *                  Use -1 for 'as many as are needed'.
+  * @param  explaces The <code>int</code> specifying the number of places
+  *                  to be used for any exponent.
+  *                  Use -1 for 'as many as are needed'.
+  * @param  exdigits The <code>int</code> specifying the trigger
+  *                  (digits before the decimal point) which if
+  *                  exceeded causes exponential notation to be used.
+  *                  Use 0 to force exponential notation.
+  *                  Use -1 to force plain notation (no exponential
+  *                  notation).
+  * @param  exform   The <code>int</code> specifying the form of
+  *                  exponential notation to be used
+  *                  ({@link MathContext#SCIENTIFIC} or
+  *                  {@link MathContext#ENGINEERING}).
+  * @param  exround  The <code>int</code> specifying the rounding mode
+  *                  to use.
+  *                  Use -1 for the default, {@link MathContext#ROUND_HALF_UP}.
+  * @return          A <code>String</code> representing this
+  *                  <code>BigDecimal</code>, laid out according to the
+  *                  specified parameters
+  * @throws ArithmeticException if the number cannot be laid out as
+  *                  requested.
+  * @throws IllegalArgumentException if a parameter is out of range.
+  * @see    #toString
+  * @see    #toCharArray
+  * @stable ICU 2.0
+  */
+
+ //--public java.lang.String format(int before,int after,int explaces,int exdigits,int exformint,int exround){
+ function format() {
+  var explaces;
+  var exdigits;
+  var exformint;
+  var exround;
+  if (format.arguments.length == 6)
+   {
+    explaces = format.arguments[2];
+    exdigits = format.arguments[3];
+    exformint = format.arguments[4];
+    exround = format.arguments[5];
+   }
+  else if (format.arguments.length == 2)
+   {
+    explaces = -1;
+    exdigits = -1;
+    exformint = MathContext.prototype.SCIENTIFIC;
+    exround = this.ROUND_HALF_UP;
+   }
+  else
+   {
+    throw "format(): " + format.arguments.length + " arguments given; expected 2 or 6";
+   }
+  var before = format.arguments[0];
+  var after = format.arguments[1];
+  //--com.ibm.icu.math.BigDecimal num;
+  var num;
+  //--int mag=0;
+  var mag=0;
+  //--int thisafter=0;
+  var thisafter=0;
+  //--int lead=0;
+  var lead=0;
+  //--byte newmant[]=null;
+  var newmant=null;
+  //--int chop=0;
+  var chop=0;
+  //--int need=0;
+  var need=0;
+  //--int oldexp=0;
+  var oldexp=0;
+  //--char a[];
+  var a;
+  //--int p=0;
+  var p=0;
+  //--char newa[]=null;
+  var newa=null;
+  //--int i=0;
+  var i=0;
+  //--int places=0;
+  var places=0;
+
+
+  /* Check arguments */
+  if ((before<(-1))||(before==0))
+   this.badarg("format",1,before);
+  if (after<(-1))
+   this.badarg("format",2,after);
+  if ((explaces<(-1))||(explaces==0))
+   this.badarg("format",3,explaces);
+  if (exdigits<(-1))
+   this.badarg("format",4,exdigits);
+  {/*select*/
+  if (exformint==MathContext.prototype.SCIENTIFIC)
+   {}
+  else if (exformint==MathContext.prototype.ENGINEERING)
+   {}
+  else if (exformint==(-1))
+   exformint=MathContext.prototype.SCIENTIFIC;
+   // note PLAIN isn't allowed
+  else{
+   this.badarg("format",5,exformint);
+  }
+  }
+  // checking the rounding mode is done by trying to construct a
+  // MathContext object with that mode; it will fail if bad
+  if (exround!=this.ROUND_HALF_UP)
+   {try{ // if non-default...
+    if (exround==(-1))
+     exround=this.ROUND_HALF_UP;
+    else
+     new MathContext(9,MathContext.prototype.SCIENTIFIC,false,exround);
+   }
+   catch ($10){
+    this.badarg("format",6,exround);
+   }}
+
+  num=this.clone(this); // make private copy
+
+  /* Here:
+     num       is BigDecimal to format
+     before    is places before point [>0]
+     after     is places after point  [>=0]
+     explaces  is exponent places     [>0]
+     exdigits  is exponent digits     [>=0]
+     exformint is exponent form       [one of two]
+     exround   is rounding mode       [one of eight]
+     'before' through 'exdigits' are -1 if not specified
+  */
+
+  /* determine form */
+  {setform:do{/*select*/
+  if (exdigits==(-1))
+   num.form=MathContext.prototype.PLAIN;
+  else if (num.ind==this.iszero)
+   num.form=MathContext.prototype.PLAIN;
+  else{
+   // determine whether triggers
+   mag=num.exp+num.mant.length;
+   if (mag>exdigits)
+    num.form=exformint;
+   else
+    if (mag<(-5))
+     num.form=exformint;
+    else
+     num.form=MathContext.prototype.PLAIN;
+  }
+  }while(false);}/*setform*/
+
+  /* If 'after' was specified then we may need to adjust the
+     mantissa.  This is a little tricky, as we must conform to the
+     rules of exponential layout if necessary (e.g., we cannot end up
+     with 10.0 if scientific). */
+  if (after>=0)
+   {setafter:for(;;){
+    // calculate the current after-length
+    {/*select*/
+    if (num.form==MathContext.prototype.PLAIN)
+     thisafter=-num.exp; // has decimal part
+    else if (num.form==MathContext.prototype.SCIENTIFIC)
+     thisafter=num.mant.length-1;
+    else{ // engineering
+     lead=(((num.exp+num.mant.length)-1))%3; // exponent to use
+     if (lead<0)
+      lead=3+lead; // negative exponent case
+     lead++; // number of leading digits
+     if (lead>=num.mant.length)
+      thisafter=0;
+     else
+      thisafter=num.mant.length-lead;
+    }
+    }
+    if (thisafter==after)
+     break setafter; // we're in luck
+    if (thisafter<after)
+     { // need added trailing zeros
+      // [thisafter can be negative]
+      newmant=this.extend(num.mant,(num.mant.length+after)-thisafter);
+      num.mant=newmant;
+      num.exp=num.exp-((after-thisafter)); // adjust exponent
+      if (num.exp<this.MinExp)
+       throw "format(): Exponent Overflow: " + num.exp;
+      break setafter;
+     }
+    // We have too many digits after the decimal point; this could
+    // cause a carry, which could change the mantissa...
+    // Watch out for implied leading zeros in PLAIN case
+    chop=thisafter-after; // digits to lop [is >0]
+    if (chop>num.mant.length)
+     { // all digits go, no chance of carry
+      // carry on with zero
+      num.mant=this.ZERO.mant;
+      num.ind=this.iszero;
+      num.exp=0;
+      continue setafter; // recheck: we may need trailing zeros
+     }
+    // we have a digit to inspect from existing mantissa
+    // round the number as required
+    need=num.mant.length-chop; // digits to end up with [may be 0]
+    oldexp=num.exp; // save old exponent
+    num.round(need,exround);
+    // if the exponent grew by more than the digits we chopped, then
+    // we must have had a carry, so will need to recheck the layout
+    if ((num.exp-oldexp)==chop)
+     break setafter; // number did not have carry
+    // mantissa got extended .. so go around and check again
+    }
+   }/*setafter*/
+
+  a=num.layout(); // lay out, with exponent if required, etc.
+
+  /* Here we have laid-out number in 'a' */
+  // now apply 'before' and 'explaces' as needed
+  if (before>0)
+   {
+    // look for '.' or 'E'
+    {var $11=a.length;p=0;p:for(;$11>0;$11--,p++){
+     if (a[p]=='.')
+      break p;
+     if (a[p]=='E')
+      break p;
+     }
+    }/*p*/
+    // p is now offset of '.', 'E', or character after end of array
+    // that is, the current length of before part
+    if (p>before)
+     this.badarg("format",1,before); // won't fit
+    if (p<before)
+     { // need leading blanks
+      newa=new Array((a.length+before)-p);
+      {var $12=before-p;i=0;i:for(;$12>0;$12--,i++){
+       newa[i]=' ';
+       }
+      }/*i*/
+      //--java.lang.System.arraycopy((java.lang.Object)a,0,(java.lang.Object)newa,i,a.length);
+      this.arraycopy(a,0,newa,i,a.length);
+      a=newa;
+     }
+   // [if p=before then it's just the right length]
+   }
+
+  if (explaces>0)
+   {
+    // look for 'E' [cannot be at offset 0]
+    {var $13=a.length-1;p=a.length-1;p:for(;$13>0;$13--,p--){
+     if (a[p]=='E')
+      break p;
+     }
+    }/*p*/
+    // p is now offset of 'E', or 0
+    if (p==0)
+     { // no E part; add trailing blanks
+      newa=new Array((a.length+explaces)+2);
+      //--java.lang.System.arraycopy((java.lang.Object)a,0,(java.lang.Object)newa,0,a.length);
+      this.arraycopy(a,0,newa,0,a.length);
+      {var $14=explaces+2;i=a.length;i:for(;$14>0;$14--,i++){
+       newa[i]=' ';
+       }
+      }/*i*/
+      a=newa;
+     }
+    else
+     {/* found E */ // may need to insert zeros
+      places=(a.length-p)-2; // number so far
+      if (places>explaces)
+       this.badarg("format",3,explaces);
+      if (places<explaces)
+       { // need to insert zeros
+        newa=new Array((a.length+explaces)-places);
+        //--java.lang.System.arraycopy((java.lang.Object)a,0,(java.lang.Object)newa,0,p+2); // through E and sign
+        this.arraycopy(a,0,newa,0,p+2);
+        {var $15=explaces-places;i=p+2;i:for(;$15>0;$15--,i++){
+         newa[i]='0';
+         }
+        }/*i*/
+        //--java.lang.System.arraycopy((java.lang.Object)a,p+2,(java.lang.Object)newa,i,places); // remainder of exponent
+        this.arraycopy(a,p+2,newa,i,places);
+        a=newa;
+       }
+     // [if places=explaces then it's just the right length]
+     }
+   }
+  return a.join("");
+  }
+
+ /**
+  * Returns the hashcode for this <code>BigDecimal</code>.
+  * This hashcode is suitable for use by the
+  * <code>java.util.Hashtable</code> class.
+  * <p>
+  * Note that two <code>BigDecimal</code> objects are only guaranteed
+  * to produce the same hashcode if they are exactly equal (that is,
+  * the <code>String</code> representations of the
+  * <code>BigDecimal</code> numbers are identical -- they have the same
+  * characters in the same sequence).
+  *
+  * @return An <code>int</code> that is the hashcode for <code>this</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public int hashCode(){
+ //-- // Maybe calculate ourselves, later.  If so, note that there can be
+ //-- // more than one internal representation for a given toString() result.
+ //-- return this.toString().hashCode();
+ //-- }
+
+ /**
+  * Converts this <code>BigDecimal</code> to an <code>int</code>.
+  * If the <code>BigDecimal</code> has a non-zero decimal part it is
+  * discarded. If the <code>BigDecimal</code> is out of the possible
+  * range for an <code>int</code> (32-bit signed integer) result then
+  * only the low-order 32 bits are used. (That is, the number may be
+  * <i>decapitated</i>.)  To avoid unexpected errors when these
+  * conditions occur, use the {@link #intValueExact} method.
+  *
+  * @return An <code>int</code> converted from <code>this</code>,
+  *         truncated and decapitated if necessary.
+  * @stable ICU 2.0
+  */
+
+ //--public int intValue(){
+ //-- return toBigInteger().intValue();
+ //-- }
+
+ /**
+  * Converts this <code>BigDecimal</code> to an <code>int</code>.
+  * If the <code>BigDecimal</code> has a non-zero decimal part or is
+  * out of the possible range for an <code>int</code> (32-bit signed
+  * integer) result then an <code>ArithmeticException</code> is thrown.
+  *
+  * @return An <code>int</code> equal in value to <code>this</code>.
+  * @throws ArithmeticException if <code>this</code> has a non-zero
+  *                 decimal part, or will not fit in an
+  *                 <code>int</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public int intValueExact(){
+ function intValueExact() {
+  //--int lodigit;
+  var lodigit;
+  //--int useexp=0;
+  var useexp=0;
+  //--int result;
+  var result;
+  //--int i=0;
+  var i=0;
+  //--int topdig=0;
+  var topdig=0;
+  // This does not use longValueExact() as the latter can be much
+  // slower.
+  // intcheck (from pow) relies on this to check decimal part
+  if (this.ind==this.iszero)
+   return 0; // easy, and quite common
+  /* test and drop any trailing decimal part */
+  lodigit=this.mant.length-1;
+  if (this.exp<0)
+   {
+    lodigit=lodigit+this.exp; // reduces by -(-exp)
+    /* all decimal places must be 0 */
+    if ((!(this.allzero(this.mant,lodigit+1))))
+     throw "intValueExact(): Decimal part non-zero: " + this.toString();
+    if (lodigit<0)
+     return 0; // -1<this<1
+    useexp=0;
+   }
+  else
+   {/* >=0 */
+    if ((this.exp+lodigit)>9)  // early exit
+     throw "intValueExact(): Conversion overflow: "+this.toString();
+    useexp=this.exp;
+   }
+  /* convert the mantissa to binary, inline for speed */
+  result=0;
+  {var $16=lodigit+useexp;i=0;i:for(;i<=$16;i++){
+   result=result*10;
+   if (i<=lodigit)
+    result=result+this.mant[i];
+   }
+  }/*i*/
+
+  /* Now, if the risky length, check for overflow */
+  if ((lodigit+useexp)==9)
+   {
+    // note we cannot just test for -ve result, as overflow can move a
+    // zero into the top bit [consider 5555555555]
+    topdig=div(result,1000000000); // get top digit, preserving sign
+    if (topdig!=this.mant[0])
+     { // digit must match and be positive
+      // except in the special case ...
+      if (result==-2147483648)  // looks like the special
+       if (this.ind==this.isneg)  // really was negative
+        if (this.mant[0]==2)
+         return result; // really had top digit 2
+      throw "intValueExact(): Conversion overflow: "+this.toString();
+     }
+   }
+
+  /* Looks good */
+  if (this.ind==this.ispos)
+   return result;
+  return -result;
+  }
+
+ /**
+  * Converts this <code>BigDecimal</code> to a <code>long</code>.
+  * If the <code>BigDecimal</code> has a non-zero decimal part it is
+  * discarded. If the <code>BigDecimal</code> is out of the possible
+  * range for a <code>long</code> (64-bit signed integer) result then
+  * only the low-order 64 bits are used. (That is, the number may be
+  * <i>decapitated</i>.)  To avoid unexpected errors when these
+  * conditions occur, use the {@link #longValueExact} method.
+  *
+  * @return A <code>long</code> converted from <code>this</code>,
+  *         truncated and decapitated if necessary.
+  * @stable ICU 2.0
+  */
+
+ //--public long longValue(){
+ //-- return toBigInteger().longValue();
+ //-- }
+
+ /**
+  * Converts this <code>BigDecimal</code> to a <code>long</code>.
+  * If the <code>BigDecimal</code> has a non-zero decimal part or is
+  * out of the possible range for a <code>long</code> (64-bit signed
+  * integer) result then an <code>ArithmeticException</code> is thrown.
+  *
+  * @return A <code>long</code> equal in value to <code>this</code>.
+  * @throws ArithmeticException if <code>this</code> has a non-zero
+  *                 decimal part, or will not fit in a
+  *                 <code>long</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public long longValueExact(){
+ //-- int lodigit;
+ //-- int cstart=0;
+ //-- int useexp=0;
+ //-- long result;
+ //-- int i=0;
+ //-- long topdig=0;
+ //-- // Identical to intValueExact except for result=long, and exp>=20 test
+ //-- if (ind==0)
+ //--  return 0; // easy, and quite common
+ //-- lodigit=mant.length-1; // last included digit
+ //-- if (exp<0)
+ //--  {
+ //--   lodigit=lodigit+exp; // -(-exp)
+ //--   /* all decimal places must be 0 */
+ //--   if (lodigit<0)
+ //--    cstart=0;
+ //--   else
+ //--    cstart=lodigit+1;
+ //--   if ((!(allzero(mant,cstart))))
+ //--    throw new java.lang.ArithmeticException("Decimal part non-zero:"+" "+this.toString());
+ //--   if (lodigit<0)
+ //--    return 0; // -1<this<1
+ //--   useexp=0;
+ //--  }
+ //-- else
+ //--  {/* >=0 */
+ //--   if ((exp+mant.length)>18)  // early exit
+ //--    throw new java.lang.ArithmeticException("Conversion overflow:"+" "+this.toString());
+ //--   useexp=exp;
+ //--  }
+ //--
+ //-- /* convert the mantissa to binary, inline for speed */
+ //-- // note that we could safely use the 'test for wrap to negative'
+ //-- // algorithm here, but instead we parallel the intValueExact
+ //-- // algorithm for ease of checking and maintenance.
+ //-- result=(long)0;
+ //-- {int $17=lodigit+useexp;i=0;i:for(;i<=$17;i++){
+ //--  result=result*10;
+ //--  if (i<=lodigit)
+ //--   result=result+mant[i];
+ //--  }
+ //-- }/*i*/
+ //--
+ //-- /* Now, if the risky length, check for overflow */
+ //-- if ((lodigit+useexp)==18)
+ //--  {
+ //--   topdig=result/1000000000000000000L; // get top digit, preserving sign
+ //--   if (topdig!=mant[0])
+ //--    { // digit must match and be positive
+ //--     // except in the special case ...
+ //--     if (result==java.lang.Long.MIN_VALUE)  // looks like the special
+ //--      if (ind==isneg)  // really was negative
+ //--       if (mant[0]==9)
+ //--        return result; // really had top digit 9
+ //--     throw new java.lang.ArithmeticException("Conversion overflow:"+" "+this.toString());
+ //--    }
+ //--  }
+ //--
+ //-- /* Looks good */
+ //-- if (ind==ispos)
+ //--  return result;
+ //-- return (long)-result;
+ //-- }
+
+ /**
+  * Returns a plain <code>BigDecimal</code> whose decimal point has
+  * been moved to the left by a specified number of positions.
+  * The parameter, <code>n</code>, specifies the number of positions to
+  * move the decimal point.
+  * That is, if <code>n</code> is 0 or positive, the number returned is
+  * given by:
+  * <p><code>
+  * this.multiply(TEN.pow(new BigDecimal(-n)))
+  * </code>
+  * <p>
+  * <code>n</code> may be negative, in which case the method returns
+  * the same result as <code>movePointRight(-n)</code>.
+  *
+  * @param  n The <code>int</code> specifying the number of places to
+  *           move the decimal point leftwards.
+  * @return   A <code>BigDecimal</code> derived from
+  *           <code>this</code>, with the decimal point moved
+  *           <code>n</code> places to the left.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal movePointLeft(int n){
+ function movePointLeft(n) {
+  //--com.ibm.icu.math.BigDecimal res;
+  var res;
+  // very little point in optimizing for shift of 0
+  res=this.clone(this);
+  res.exp=res.exp-n;
+  return res.finish(this.plainMC,false); // finish sets form and checks exponent
+  }
+
+ /**
+  * Returns a plain <code>BigDecimal</code> whose decimal point has
+  * been moved to the right by a specified number of positions.
+  * The parameter, <code>n</code>, specifies the number of positions to
+  * move the decimal point.
+  * That is, if <code>n</code> is 0 or positive, the number returned is
+  * given by:
+  * <p><code>
+  * this.multiply(TEN.pow(new BigDecimal(n)))
+  * </code>
+  * <p>
+  * <code>n</code> may be negative, in which case the method returns
+  * the same result as <code>movePointLeft(-n)</code>.
+  *
+  * @param  n The <code>int</code> specifying the number of places to
+  *           move the decimal point rightwards.
+  * @return   A <code>BigDecimal</code> derived from
+  *           <code>this</code>, with the decimal point moved
+  *           <code>n</code> places to the right.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal movePointRight(int n){
+ function movePointRight(n) {
+  //--com.ibm.icu.math.BigDecimal res;
+  var res;
+  res=this.clone(this);
+  res.exp=res.exp+n;
+  return res.finish(this.plainMC,false);
+  }
+
+ /**
+  * Returns the scale of this <code>BigDecimal</code>.
+  * Returns a non-negative <code>int</code> which is the scale of the
+  * number. The scale is the number of digits in the decimal part of
+  * the number if the number were formatted without exponential
+  * notation.
+  *
+  * @return An <code>int</code> whose value is the scale of this
+  *         <code>BigDecimal</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public int scale(){
+ function scale() {
+  if (this.exp>=0)
+   return 0; // scale can never be negative
+  return -this.exp;
+  }
+
+ /**
+  * Returns a plain <code>BigDecimal</code> with a given scale.
+  * <p>
+  * If the given scale (which must be zero or positive) is the same as
+  * or greater than the length of the decimal part (the scale) of this
+  * <code>BigDecimal</code> then trailing zeros will be added to the
+  * decimal part as necessary.
+  * <p>
+  * If the given scale is less than the length of the decimal part (the
+  * scale) of this <code>BigDecimal</code> then trailing digits
+  * will be removed, and in this case an
+  * <code>ArithmeticException</code> is thrown if any discarded digits
+  * are non-zero.
+  * <p>
+  * The same as {@link #setScale(int, int)}, where the first parameter
+  * is the scale, and the second is
+  * <code>MathContext.ROUND_UNNECESSARY</code>.
+  *
+  * @param  scale The <code>int</code> specifying the scale of the
+  *               resulting <code>BigDecimal</code>.
+  * @return       A plain <code>BigDecimal</code> with the given scale.
+  * @throws ArithmeticException if <code>scale</code> is negative.
+  * @throws ArithmeticException if reducing scale would discard
+  *               non-zero digits.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal setScale(int scale){
+ //-- return setScale(scale,ROUND_UNNECESSARY);
+ //-- }
+
+ /**
+  * Returns a plain <code>BigDecimal</code> with a given scale.
+  * <p>
+  * If the given scale (which must be zero or positive) is the same as
+  * or greater than the length of the decimal part (the scale) of this
+  * <code>BigDecimal</code> then trailing zeros will be added to the
+  * decimal part as necessary.
+  * <p>
+  * If the given scale is less than the length of the decimal part (the
+  * scale) of this <code>BigDecimal</code> then trailing digits
+  * will be removed, and the rounding mode given by the second
+  * parameter is used to determine if the remaining digits are
+  * affected by a carry.
+  * In this case, an <code>IllegalArgumentException</code> is thrown if
+  * <code>round</code> is not a valid rounding mode.
+  * <p>
+  * If <code>round</code> is <code>MathContext.ROUND_UNNECESSARY</code>,
+  * an <code>ArithmeticException</code> is thrown if any discarded
+  * digits are non-zero.
+  *
+  * @param  scale The <code>int</code> specifying the scale of the
+  *               resulting <code>BigDecimal</code>.
+  * @param  round The <code>int</code> rounding mode to be used for
+  *               the division (see the {@link MathContext} class).
+  * @return       A plain <code>BigDecimal</code> with the given scale.
+  * @throws IllegalArgumentException if <code>round</code> is not a
+  *               valid rounding mode.
+  * @throws ArithmeticException if <code>scale</code> is negative.
+  * @throws ArithmeticException if <code>round</code> is
+  *               <code>MathContext.ROUND_UNNECESSARY</code>, and
+  *               reducing scale would discard non-zero digits.
+  * @stable ICU 2.0
+  */
+
+ //--public com.ibm.icu.math.BigDecimal setScale(int scale,int round){
+ function setScale() {
+  var round;
+  if (setScale.arguments.length == 2)
+   {
+    round = setScale.arguments[1];
+   }
+  else if (setScale.arguments.length == 1)
+   {
+    round = this.ROUND_UNNECESSARY;
+   }
+  else
+   {
+    throw "setScale(): " + setScale.arguments.length + " given; expected 1 or 2";
+   }
+  var scale = setScale.arguments[0];
+  //--int ourscale;
+  var ourscale;
+  //--com.ibm.icu.math.BigDecimal res;
+  var res;
+  //--int padding=0;
+  var padding=0;
+  //--int newlen=0;
+  var newlen=0;
+  // at present this naughtily only checks the round value if it is
+  // needed (used), for speed
+  ourscale=this.scale();
+  if (ourscale==scale)  // already correct scale
+   if (this.form==MathContext.prototype.PLAIN)  // .. and form
+    return this;
+  res=this.clone(this); // need copy
+  if (ourscale<=scale)
+   { // simply zero-padding/changing form
+    // if ourscale is 0 we may have lots of 0s to add
+    if (ourscale==0)
+     padding=res.exp+scale;
+    else
+     padding=scale-ourscale;
+    res.mant=this.extend(res.mant,res.mant.length+padding);
+    res.exp=-scale; // as requested
+   }
+  else
+   {/* ourscale>scale: shortening, probably */
+    if (scale<0)
+     //--throw new java.lang.ArithmeticException("Negative scale:"+" "+scale);
+     throw "setScale(): Negative scale: " + scale;
+    // [round() will raise exception if invalid round]
+    newlen=res.mant.length-((ourscale-scale)); // [<=0 is OK]
+    res=res.round(newlen,round); // round to required length
+    // This could have shifted left if round (say) 0.9->1[.0]
+    // Repair if so by adding a zero and reducing exponent
+    if (res.exp!=(-scale))
+     {
+      res.mant=this.extend(res.mant,res.mant.length+1);
+      res.exp=res.exp-1;
+     }
+   }
+  res.form=MathContext.prototype.PLAIN; // by definition
+  return res;
+  }
+
+ /**
+  * Converts this <code>BigDecimal</code> to a <code>short</code>.
+  * If the <code>BigDecimal</code> has a non-zero decimal part or is
+  * out of the possible range for a <code>short</code> (16-bit signed
+  * integer) result then an <code>ArithmeticException</code> is thrown.
+  *
+  * @return A <code>short</code> equal in value to <code>this</code>.
+  * @throws ArithmeticException if <code>this</code> has a non-zero
+  *                 decimal part, or will not fit in a
+  *                 <code>short</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public short shortValueExact(){
+ //-- int num;
+ //-- num=this.intValueExact(); // will check decimal part too
+ //-- if ((num>32767)|(num<(-32768)))
+ //--  throw new java.lang.ArithmeticException("Conversion overflow:"+" "+this.toString());
+ //-- return (short)num;
+ //-- }
+
+ /**
+  * Returns the sign of this <code>BigDecimal</code>, as an
+  * <code>int</code>.
+  * This returns the <i>signum</i> function value that represents the
+  * sign of this <code>BigDecimal</code>.
+  * That is, -1 if the <code>BigDecimal</code> is negative, 0 if it is
+  * numerically equal to zero, or 1 if it is positive.
+  *
+  * @return An <code>int</code> which is -1 if the
+  *         <code>BigDecimal</code> is negative, 0 if it is
+  *         numerically equal to zero, or 1 if it is positive.
+  * @stable ICU 2.0
+  */
+
+ //--public int signum(){
+ function signum() {
+  return this.ind; // [note this assumes values for ind.]
+  }
+
+ /**
+  * Converts this <code>BigDecimal</code> to a
+  * <code>java.math.BigDecimal</code>.
+  * <p>
+  * This is an exact conversion; the result is the same as if the
+  * <code>BigDecimal</code> were formatted as a plain number without
+  * any rounding or exponent and then the
+  * <code>java.math.BigDecimal(java.lang.String)</code> constructor
+  * were used to construct the result.
+  * <p>
+  * <i>(Note: this method is provided only in the
+  * <code>com.ibm.icu.math</code> version of the BigDecimal class.
+  * It would not be present in a <code>java.math</code> version.)</i>
+  *
+  * @return The <code>java.math.BigDecimal</code> equal in value
+  *         to this <code>BigDecimal</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public java.math.BigDecimal toBigDecimal(){
+ //-- return new java.math.BigDecimal(this.unscaledValue(),this.scale());
+ //-- }
+
+ /**
+  * Converts this <code>BigDecimal</code> to a
+  * <code>java.math.BigInteger</code>.
+  * <p>
+  * Any decimal part is truncated (discarded).
+  * If an exception is desired should the decimal part be non-zero,
+  * use {@link #toBigIntegerExact()}.
+  *
+  * @return The <code>java.math.BigInteger</code> equal in value
+  *         to the integer part of this <code>BigDecimal</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public java.math.BigInteger toBigInteger(){
+ //-- com.ibm.icu.math.BigDecimal res=null;
+ //-- int newlen=0;
+ //-- byte newmant[]=null;
+ //-- {/*select*/
+ //-- if ((exp>=0)&(form==com.ibm.icu.math.MathContext.PLAIN))
+ //--  res=this; // can layout simply
+ //-- else if (exp>=0)
+ //--  {
+ //--   res=clone(this); // safe copy
+ //--   res.form=(byte)com.ibm.icu.math.MathContext.PLAIN; // .. and request PLAIN
+ //--  }
+ //-- else{
+ //--  { // exp<0; scale to be truncated
+ //--   // we could use divideInteger, but we may as well be quicker
+ //--   if (((int)-this.exp)>=this.mant.length)
+ //--    res=ZERO; // all blows away
+ //--   else
+ //--    {
+ //--     res=clone(this); // safe copy
+ //--     newlen=res.mant.length+res.exp;
+ //--     newmant=new byte[newlen]; // [shorter]
+ //--     java.lang.System.arraycopy((java.lang.Object)res.mant,0,(java.lang.Object)newmant,0,newlen);
+ //--     res.mant=newmant;
+ //--     res.form=(byte)com.ibm.icu.math.MathContext.PLAIN;
+ //--     res.exp=0;
+ //--    }
+ //--  }
+ //-- }
+ //-- }
+ //-- return new BigInteger(new java.lang.String(res.layout()));
+ //-- }
+
+ /**
+  * Converts this <code>BigDecimal</code> to a
+  * <code>java.math.BigInteger</code>.
+  * <p>
+  * An exception is thrown if the decimal part (if any) is non-zero.
+  *
+  * @return The <code>java.math.BigInteger</code> equal in value
+  *         to the integer part of this <code>BigDecimal</code>.
+  * @throws ArithmeticException if <code>this</code> has a non-zero
+  *         decimal part.
+  * @stable ICU 2.0
+  */
+
+ //--public java.math.BigInteger toBigIntegerExact(){
+ //-- /* test any trailing decimal part */
+ //-- if (exp<0)
+ //--  { // possible decimal part
+ //--   /* all decimal places must be 0; note exp<0 */
+ //--   if ((!(allzero(mant,mant.length+exp))))
+ //--    throw new java.lang.ArithmeticException("Decimal part non-zero:"+" "+this.toString());
+ //--  }
+ //-- return toBigInteger();
+ //-- }
+
+ /**
+  * Returns the <code>BigDecimal</code> as a character array.
+  * The result of this method is the same as using the
+  * sequence <code>toString().toCharArray()</code>, but avoids creating
+  * the intermediate <code>String</code> and <code>char[]</code>
+  * objects.
+  *
+  * @return The <code>char[]</code> array corresponding to this
+  *         <code>BigDecimal</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public char[] toCharArray(){
+ //-- return layout();
+ //-- }
+
+ /**
+  * Returns the <code>BigDecimal</code> as a <code>String</code>.
+  * This returns a <code>String</code> that exactly represents this
+  * <code>BigDecimal</code>, as defined in the decimal documentation
+  * (see {@link BigDecimal class header}).
+  * <p>
+  * By definition, using the {@link #BigDecimal(String)} constructor
+  * on the result <code>String</code> will create a
+  * <code>BigDecimal</code> that is exactly equal to the original
+  * <code>BigDecimal</code>.
+  *
+  * @return The <code>String</code> exactly corresponding to this
+  *         <code>BigDecimal</code>.
+  * @see    #format(int, int)
+  * @see    #format(int, int, int, int, int, int)
+  * @see    #toCharArray()
+  * @stable ICU 2.0
+  */
+
+ //--public java.lang.String toString(){
+ function toString() {
+  return this.layout().join("");
+  }
+
+ /**
+  * Returns the number as a <code>BigInteger</code> after removing the
+  * scale.
+  * That is, the number is expressed as a plain number, any decimal
+  * point is then removed (retaining the digits of any decimal part),
+  * and the result is then converted to a <code>BigInteger</code>.
+  *
+  * @return The <code>java.math.BigInteger</code> equal in value to
+  *         this <code>BigDecimal</code> multiplied by ten to the
+  *         power of <code>this.scale()</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public java.math.BigInteger unscaledValue(){
+ //-- com.ibm.icu.math.BigDecimal res=null;
+ //-- if (exp>=0)
+ //--  res=this;
+ //-- else
+ //--  {
+ //--   res=clone(this); // safe copy
+ //--   res.exp=0; // drop scale
+ //--  }
+ //-- return res.toBigInteger();
+ //-- }
+
+ /**
+  * Translates a <code>double</code> to a <code>BigDecimal</code>.
+  * <p>
+  * Returns a <code>BigDecimal</code> which is the decimal
+  * representation of the 64-bit signed binary floating point
+  * parameter. If the parameter is infinite, or is not a number (NaN),
+  * a <code>NumberFormatException</code> is thrown.
+  * <p>
+  * The number is constructed as though <code>num</code> had been
+  * converted to a <code>String</code> using the
+  * <code>Double.toString()</code> method and the
+  * {@link #BigDecimal(java.lang.String)} constructor had then been used.
+  * This is typically not an exact conversion.
+  *
+  * @param  dub The <code>double</code> to be translated.
+  * @return     The <code>BigDecimal</code> equal in value to
+  *             <code>dub</code>.
+  * @throws NumberFormatException if the parameter is infinite or
+  *             not a number.
+  * @stable ICU 2.0
+  */
+
+ //--public static com.ibm.icu.math.BigDecimal valueOf(double dub){
+ //-- // Reminder: a zero double returns '0.0', so we cannot fastpath to
+ //-- // use the constant ZERO.  This might be important enough to justify
+ //-- // a factory approach, a cache, or a few private constants, later.
+ //-- return new com.ibm.icu.math.BigDecimal((new java.lang.Double(dub)).toString());
+ //-- }
+
+ /**
+  * Translates a <code>long</code> to a <code>BigDecimal</code>.
+  * That is, returns a plain <code>BigDecimal</code> whose value is
+  * equal to the given <code>long</code>.
+  *
+  * @param  lint The <code>long</code> to be translated.
+  * @return      The <code>BigDecimal</code> equal in value to
+  *              <code>lint</code>.
+  * @stable ICU 2.0
+  */
+
+ //--public static com.ibm.icu.math.BigDecimal valueOf(long lint){
+ //-- return valueOf(lint,0);
+ //-- }
+
+ /**
+  * Translates a <code>long</code> to a <code>BigDecimal</code> with a
+  * given scale.
+  * That is, returns a plain <code>BigDecimal</code> whose unscaled
+  * value is equal to the given <code>long</code>, adjusted by the
+  * second parameter, <code>scale</code>.
+  * <p>
+  * The result is given by:
+  * <p><code>
+  * (new BigDecimal(lint)).divide(TEN.pow(new BigDecimal(scale)))
+  * </code>
+  * <p>
+  * A <code>NumberFormatException</code> is thrown if <code>scale</code>
+  * is negative.
+  *
+  * @param  lint  The <code>long</code> to be translated.
+  * @param  scale The <code>int</code> scale to be applied.
+  * @return       The <code>BigDecimal</code> equal in value to
+  *               <code>lint</code>.
+  * @throws NumberFormatException if the scale is negative.
+  * @stable ICU 2.0
+  */
+
+ //--public static com.ibm.icu.math.BigDecimal valueOf(long lint,int scale){
+ //-- com.ibm.icu.math.BigDecimal res=null;
+ //-- {/*select*/
+ //-- if (lint==0)
+ //--  res=ZERO;
+ //-- else if (lint==1)
+ //--  res=ONE;
+ //-- else if (lint==10)
+ //--  res=TEN;
+ //-- else{
+ //--  res=new com.ibm.icu.math.BigDecimal(lint);
+ //-- }
+ //-- }
+ //-- if (scale==0)
+ //--  return res;
+ //-- if (scale<0)
+ //--  throw new java.lang.NumberFormatException("Negative scale:"+" "+scale);
+ //-- res=clone(res); // safe copy [do not mutate]
+ //-- res.exp=(int)-scale; // exponent is -scale
+ //-- return res;
+ //-- }
+
+ /* ---------------------------------------------------------------- */
+ /* Private methods                                                  */
+ /* ---------------------------------------------------------------- */
+
+ /* <sgml> Return char array value of a BigDecimal (conversion from
+       BigDecimal to laid-out canonical char array).
+    <p>The mantissa will either already have been rounded (following an
+       operation) or will be of length appropriate (in the case of
+       construction from an int, for example).
+    <p>We must not alter the mantissa, here.
+    <p>'form' describes whether we are to use exponential notation (and
+       if so, which), or if we are to lay out as a plain/pure numeric.
+    </sgml> */
+
+ //--private char[] layout(){
+ function layout() {
+  //--char cmant[];
+  var cmant;
+  //--int i=0;
+  var i=0;
+  //--java.lang.StringBuffer sb=null;
+  var sb=null;
+  //--int euse=0;
+  var euse=0;
+  //--int sig=0;
+  var sig=0;
+  //--char csign=0;
+  var csign=0;
+  //--char rec[]=null;
+  var rec=null;
+  //--int needsign;
+  var needsign;
+  //--int mag;
+  var mag;
+  //--int len=0;
+  var len=0;
+  cmant=new Array(this.mant.length); // copy byte[] to a char[]
+  {var $18=this.mant.length;i=0;i:for(;$18>0;$18--,i++){
+   cmant[i]=this.mant[i]+'';
+   }
+  }/*i*/
+
+  if (this.form!=MathContext.prototype.PLAIN)
+   {/* exponential notation needed */
+    //--sb=new java.lang.StringBuffer(cmant.length+15); // -x.xxxE+999999999
+    sb="";
+    if (this.ind==this.isneg)
+     sb += '-';
+    euse=(this.exp+cmant.length)-1; // exponent to use
+    /* setup sig=significant digits and copy to result */
+    if (this.form==MathContext.prototype.SCIENTIFIC)
+     { // [default]
+      sb += cmant[0]; // significant character
+      if (cmant.length>1)  // have decimal part
+       //--sb.append('.').append(cmant,1,cmant.length-1);
+       sb += '.';
+       sb += cmant.slice(1).join("");
+     }
+    else
+     {engineering:do{
+      sig=euse%3; // common
+      if (sig<0)
+       sig=3+sig; // negative exponent
+      euse=euse-sig;
+      sig++;
+      if (sig>=cmant.length)
+       { // zero padding may be needed
+        //--sb.append(cmant,0,cmant.length);
+        sb += cmant.join("");
+        {var $19=sig-cmant.length;for(;$19>0;$19--){
+         sb += '0';
+         }
+        }
+       }
+      else
+       { // decimal point needed
+        //--sb.append(cmant,0,sig).append('.').append(cmant,sig,cmant.length-sig);
+        sb += cmant.slice(0,sig).join("");
+        sb += '.';
+        sb += cmant.slice(sig).join("");
+       }
+     }while(false);}/*engineering*/
+    if (euse!=0)
+     {
+      if (euse<0)
+       {
+        csign='-';
+        euse=-euse;
+       }
+      else
+       csign='+';
+      //--sb.append('E').append(csign).append(euse);
+      sb += 'E';
+      sb += csign;
+      sb += euse;
+     }
+    //--rec=new Array(sb.length);
+    //--Utility.getChars(sb, 0,sb.length(),rec,0);
+    //--return rec;
+    return sb.split("");
+   }
+
+  /* Here for non-exponential (plain) notation */
+  if (this.exp==0)
+   {/* easy */
+    if (this.ind>=0)
+     return cmant; // non-negative integer
+    rec=new Array(cmant.length+1);
+    rec[0]='-';
+    //--java.lang.System.arraycopy((java.lang.Object)cmant,0,(java.lang.Object)rec,1,cmant.length);
+    this.arraycopy(cmant,0,rec,1,cmant.length);
+    return rec;
+   }
+
+  /* Need a '.' and/or some zeros */
+  needsign=((this.ind==this.isneg)?1:0); // space for sign?  0 or 1
+
+  /* MAG is the position of the point in the mantissa (index of the
+     character it follows) */
+  mag=this.exp+cmant.length;
+
+  if (mag<1)
+   {/* 0.00xxxx form */
+    len=(needsign+2)-this.exp; // needsign+2+(-mag)+cmant.length
+    rec=new Array(len);
+    if (needsign!=0)
+     rec[0]='-';
+    rec[needsign]='0';
+    rec[needsign+1]='.';
+    {var $20=-mag;i=needsign+2;i:for(;$20>0;$20--,i++){ // maybe none
+     rec[i]='0';
+     }
+    }/*i*/
+    //--java.lang.System.arraycopy((java.lang.Object)cmant,0,(java.lang.Object)rec,(needsign+2)-mag,cmant.length);
+    this.arraycopy(cmant,0,rec,(needsign+2)-mag,cmant.length);
+    return rec;
+   }
+
+  if (mag>cmant.length)
+   {/* xxxx0000 form */
+    len=needsign+mag;
+    rec=new Array(len);
+    if (needsign!=0)
+     rec[0]='-';
+    //--java.lang.System.arraycopy((java.lang.Object)cmant,0,(java.lang.Object)rec,needsign,cmant.length);
+    this.arraycopy(cmant,0,rec,needsign,cmant.length);
+    {var $21=mag-cmant.length;i=needsign+cmant.length;i:for(;$21>0;$21--,i++){ // never 0
+     rec[i]='0';
+     }
+    }/*i*/
+    return rec;
+   }
+
+  /* decimal point is in the middle of the mantissa */
+  len=(needsign+1)+cmant.length;
+  rec=new Array(len);
+  if (needsign!=0)
+   rec[0]='-';
+  //--java.lang.System.arraycopy((java.lang.Object)cmant,0,(java.lang.Object)rec,needsign,mag);
+  this.arraycopy(cmant,0,rec,needsign,mag);
+  rec[needsign+mag]='.';
+  //--java.lang.System.arraycopy((java.lang.Object)cmant,mag,(java.lang.Object)rec,(needsign+mag)+1,cmant.length-mag);
+  this.arraycopy(cmant,mag,rec,(needsign+mag)+1,cmant.length-mag);
+  return rec;
+  }
+
+ /* <sgml> Checks a BigDecimal argument to ensure it's a true integer
+       in a given range.
+    <p>If OK, returns it as an int. </sgml> */
+ // [currently only used by pow]
+
+ //--private int intcheck(int min,int max){
+ function intcheck(min, max) {
+  //--int i;
+  var i;
+  i=this.intValueExact(); // [checks for non-0 decimal part]
+  // Use same message as though intValueExact failed due to size
+  if ((i<min)||(i>max))
+   throw "intcheck(): Conversion overflow: "+i;
+  return i;
+  }
+
+ /* <sgml> Carry out division operations. </sgml> */
+ /*
+    Arg1 is operation code: D=divide, I=integer divide, R=remainder
+    Arg2 is the rhs.
+    Arg3 is the context.
+    Arg4 is explicit scale iff code='D' or 'I' (-1 if none).
+
+    Underlying algorithm (complications for Remainder function and
+    scaled division are omitted for clarity):
+
+      Test for x/0 and then 0/x
+      Exp =Exp1 - Exp2
+      Exp =Exp +len(var1) -len(var2)
+      Sign=Sign1 * Sign2
+      Pad accumulator (Var1) to double-length with 0's (pad1)
+      Pad Var2 to same length as Var1
+      B2B=1st two digits of var2, +1 to allow for roundup
+      have=0
+      Do until (have=digits+1 OR residue=0)
+        if exp<0 then if integer divide/residue then leave
+        this_digit=0
+        Do forever
+           compare numbers
+           if <0 then leave inner_loop
+           if =0 then (- quick exit without subtract -) do
+              this_digit=this_digit+1; output this_digit
+              leave outer_loop; end
+           Compare lengths of numbers (mantissae):
+           If same then CA=first_digit_of_Var1
+                   else CA=first_two_digits_of_Var1
+           mult=ca*10/b2b   -- Good and safe guess at divisor
+           if mult=0 then mult=1
+           this_digit=this_digit+mult
+           subtract
+           end inner_loop
+         if have\=0 | this_digit\=0 then do
+           output this_digit
+           have=have+1; end
+         var2=var2/10
+         exp=exp-1
+         end outer_loop
+      exp=exp+1   -- set the proper exponent
+      if have=0 then generate answer=0
+      Return to FINISHED
+      Result defined by MATHV1
+
+    For extended commentary, see DMSRCN.
+  */
+
+ //--private com.ibm.icu.math.BigDecimal dodivide(char code,com.ibm.icu.math.BigDecimal rhs,com.ibm.icu.math.MathContext set,int scale){
+ function dodivide(code, rhs, set, scale) {
+  //--com.ibm.icu.math.BigDecimal lhs;
+  var lhs;
+  //--int reqdig;
+  var reqdig;
+  //--int newexp;
+  var newexp;
+  //--com.ibm.icu.math.BigDecimal res;
+  var res;
+  //--int newlen;
+  var newlen;
+  //--byte var1[];
+  var var1;
+  //--int var1len;
+  var var1len;
+  //--byte var2[];
+  var var2;
+  //--int var2len;
+  var var2len;
+  //--int b2b;
+  var b2b;
+  //--int have;
+  var have;
+  //--int thisdigit=0;
+  var thisdigit=0;
+  //--int i=0;
+  var i=0;
+  //--byte v2=0;
+  var v2=0;
+  //--int ba=0;
+  var ba=0;
+  //--int mult=0;
+  var mult=0;
+  //--int start=0;
+  var start=0;
+  //--int padding=0;
+  var padding=0;
+  //--int d=0;
+  var d=0;
+  //--byte newvar1[]=null;
+  var newvar1=null;
+  //--byte lasthave=0;
+  var lasthave=0;
+  //--int actdig=0;
+  var actdig=0;
+  //--byte newmant[]=null;
+  var newmant=null;
+
+  if (set.lostDigits)
+   this.checkdigits(rhs,set.digits);
+  lhs=this; // name for clarity
+
+  // [note we must have checked lostDigits before the following checks]
+  if (rhs.ind==0)
+   throw "dodivide(): Divide by 0"; // includes 0/0
+  if (lhs.ind==0)
+   { // 0/x => 0 [possibly with .0s]
+    if (set.form!=MathContext.prototype.PLAIN)
+     return this.ZERO;
+    if (scale==(-1))
+     return lhs;
+    return lhs.setScale(scale);
+   }
+
+  /* Prepare numbers according to BigDecimal rules */
+  reqdig=set.digits; // local copy (heavily used)
+  if (reqdig>0)
+   {
+    if (lhs.mant.length>reqdig)
+     lhs=this.clone(lhs).round(set);
+    if (rhs.mant.length>reqdig)
+     rhs=this.clone(rhs).round(set);
+   }
+  else
+   {/* scaled divide */
+    if (scale==(-1))
+     scale=lhs.scale();
+    // set reqdig to be at least large enough for the computation
+    reqdig=lhs.mant.length; // base length
+    // next line handles both positive lhs.exp and also scale mismatch
+    if (scale!=(-lhs.exp))
+     reqdig=(reqdig+scale)+lhs.exp;
+    reqdig=(reqdig-((rhs.mant.length-1)))-rhs.exp; // reduce by RHS effect
+    if (reqdig<lhs.mant.length)
+     reqdig=lhs.mant.length; // clamp
+    if (reqdig<rhs.mant.length)
+     reqdig=rhs.mant.length; // ..
+   }
+
+  /* precalculate exponent */
+  newexp=((lhs.exp-rhs.exp)+lhs.mant.length)-rhs.mant.length;
+  /* If new exponent -ve, then some quick exits are possible */
+  if (newexp<0)
+   if (code!='D')
+    {
+     if (code=='I')
+      return this.ZERO; // easy - no integer part
+     /* Must be 'R'; remainder is [finished clone of] input value */
+     return this.clone(lhs).finish(set,false);
+    }
+
+  /* We need slow division */
+  res=new BigDecimal(); // where we'll build result
+  res.ind=(lhs.ind*rhs.ind); // final sign (for D/I)
+  res.exp=newexp; // initial exponent (for D/I)
+  res.mant=this.createArrayWithZeros(reqdig+1); // where build the result
+
+  /* Now [virtually pad the mantissae with trailing zeros */
+  // Also copy the LHS, which will be our working array
+  newlen=(reqdig+reqdig)+1;
+  var1=this.extend(lhs.mant,newlen); // always makes longer, so new safe array
+  var1len=newlen; // [remaining digits are 0]
+
+  var2=rhs.mant;
+  var2len=newlen;
+
+  /* Calculate first two digits of rhs (var2), +1 for later estimations */
+  b2b=(var2[0]*10)+1;
+  if (var2.length>1)
+   b2b=b2b+var2[1];
+
+  /* start the long-division loops */
+  have=0;
+  {outer:for(;;){
+   thisdigit=0;
+   /* find the next digit */
+   {inner:for(;;){
+    if (var1len<var2len)
+     break inner; // V1 too low
+    if (var1len==var2len)
+     { // compare needed
+      {compare:do{ // comparison
+       {var $22=var1len;i=0;i:for(;$22>0;$22--,i++){
+        // var1len is always <= var1.length
+        if (i<var2.length)
+         v2=var2[i];
+        else
+         v2=0;
+        if (var1[i]<v2)
+         break inner; // V1 too low
+        if (var1[i]>v2)
+         break compare; // OK to subtract
+        }
+       }/*i*/
+       /* reach here if lhs and rhs are identical; subtraction will
+          increase digit by one, and the residue will be 0 so we
+          are done; leave the loop with residue set to 0 (in case
+          code is 'R' or ROUND_UNNECESSARY or a ROUND_HALF_xxxx is
+          being checked) */
+       thisdigit++;
+       res.mant[have]=thisdigit;
+       have++;
+       var1[0]=0; // residue to 0 [this is all we'll test]
+       // var1len=1      -- [optimized out]
+       break outer;
+      }while(false);}/*compare*/
+      /* prepare for subtraction.  Estimate BA (lengths the same) */
+      ba=var1[0]; // use only first digit
+     } // lengths the same
+    else
+     {/* lhs longer than rhs */
+      /* use first two digits for estimate */
+      ba=var1[0]*10;
+      if (var1len>1)
+       ba=ba+var1[1];
+     }
+    /* subtraction needed; V1>=V2 */
+    mult=div((ba*10),b2b);
+    if (mult==0)
+     mult=1;
+    thisdigit=thisdigit+mult;
+    // subtract; var1 reusable
+    var1=this.byteaddsub(var1,var1len,var2,var2len,-mult,true);
+    if (var1[0]!=0)
+     continue inner; // maybe another subtract needed
+    /* V1 now probably has leading zeros, remove leading 0's and try
+       again. (It could be longer than V2) */
+    {var $23=var1len-2;start=0;start:for(;start<=$23;start++){
+     if (var1[start]!=0)
+      break start;
+     var1len--;
+     }
+    }/*start*/
+    if (start==0)
+     continue inner;
+    // shift left
+    //--java.lang.System.arraycopy((java.lang.Object)var1,start,(java.lang.Object)var1,0,var1len);
+    this.arraycopy(var1,start,var1,0,var1len);
+    }
+   }/*inner*/
+
+   /* We have the next digit */
+   if ((have!=0)||(thisdigit!=0))
+    { // put the digit we got
+     res.mant[have]=thisdigit;
+     have++;
+     if (have==(reqdig+1))
+      break outer; // we have all we need
+     if (var1[0]==0)
+      break outer; // residue now 0
+    }
+   /* can leave now if a scaled divide and exponent is small enough */
+   if (scale>=0)
+    if ((-res.exp)>scale)
+     break outer;
+   /* can leave now if not Divide and no integer part left  */
+   if (code!='D')
+    if (res.exp<=0)
+     break outer;
+   res.exp=res.exp-1; // reduce the exponent
+   /* to get here, V1 is less than V2, so divide V2 by 10 and go for
+      the next digit */
+   var2len--;
+   }
+  }/*outer*/
+
+  /* here when we have finished dividing, for some reason */
+  // have is the number of digits we collected in res.mant
+  if (have==0)
+   have=1; // res.mant[0] is 0; we always want a digit
+
+  if ((code=='I')||(code=='R'))
+   {/* check for integer overflow needed */
+    if ((have+res.exp)>reqdig)
+     throw "dodivide(): Integer overflow";
+
+    if (code=='R')
+     {remainder:do{
+      /* We were doing Remainder -- return the residue */
+      if (res.mant[0]==0)  // no integer part was found
+       return this.clone(lhs).finish(set,false); // .. so return lhs, canonical
+      if (var1[0]==0)
+       return this.ZERO; // simple 0 residue
+      res.ind=lhs.ind; // sign is always as LHS
+      /* Calculate the exponent by subtracting the number of padding zeros
+         we added and adding the original exponent */
+      padding=((reqdig+reqdig)+1)-lhs.mant.length;
+      res.exp=(res.exp-padding)+lhs.exp;
+
+      /* strip insignificant padding zeros from residue, and create/copy
+         the resulting mantissa if need be */
+      d=var1len;
+      {i=d-1;i:for(;i>=1;i--){if(!((res.exp<lhs.exp)&&(res.exp<rhs.exp)))break;
+       if (var1[i]!=0)
+        break i;
+       d--;
+       res.exp=res.exp+1;
+       }
+      }/*i*/
+      if (d<var1.length)
+       {/* need to reduce */
+        newvar1=new Array(d);
+        //--java.lang.System.arraycopy((java.lang.Object)var1,0,(java.lang.Object)newvar1,0,d); // shorten
+        this.arraycopy(var1,0,newvar1,0,d);
+        var1=newvar1;
+       }
+      res.mant=var1;
+      return res.finish(set,false);
+     }while(false);}/*remainder*/
+   }
+
+  else
+   {/* 'D' -- no overflow check needed */
+    // If there was a residue then bump the final digit (iff 0 or 5)
+    // so that the residue is visible for ROUND_UP, ROUND_HALF_xxx and
+    // ROUND_UNNECESSARY checks (etc.) later.
+    // [if we finished early, the residue will be 0]
+    if (var1[0]!=0)
+     { // residue not 0
+      lasthave=res.mant[have-1];
+      if (((lasthave%5))==0)
+       res.mant[have-1]=(lasthave+1);
+     }
+   }
+
+  /* Here for Divide or Integer Divide */
+  // handle scaled results first ['I' always scale 0, optional for 'D']
+  if (scale>=0)
+   {scaled:do{
+    // say 'scale have res.exp len' scale have res.exp res.mant.length
+    if (have!=res.mant.length)
+     // already padded with 0's, so just adjust exponent
+     res.exp=res.exp-((res.mant.length-have));
+    // calculate number of digits we really want [may be 0]
+    actdig=res.mant.length-(((-res.exp)-scale));
+    res.round(actdig,set.roundingMode); // round to desired length
+    // This could have shifted left if round (say) 0.9->1[.0]
+    // Repair if so by adding a zero and reducing exponent
+    if (res.exp!=(-scale))
+     {
+      res.mant=this.extend(res.mant,res.mant.length+1);
+      res.exp=res.exp-1;
+     }
+    return res.finish(set,true); // [strip if not PLAIN]
+   }while(false);}/*scaled*/
+
+  // reach here only if a non-scaled
+  if (have==res.mant.length)
+   { // got digits+1 digits
+    res.round(set);
+    have=reqdig;
+   }
+  else
+   {/* have<=reqdig */
+    if (res.mant[0]==0)
+     return this.ZERO; // fastpath
+    // make the mantissa truly just 'have' long
+    // [we could let finish do this, during strip, if we adjusted
+    // the exponent; however, truncation avoids the strip loop]
+    newmant=new Array(have); // shorten
+    //--java.lang.System.arraycopy((java.lang.Object)res.mant,0,(java.lang.Object)newmant,0,have);
+    this.arraycopy(res.mant,0,newmant,0,have);
+    res.mant=newmant;
+   }
+  return res.finish(set,true);
+  }
+
+ /* <sgml> Report a conversion exception. </sgml> */
+
+ //--private void bad(char s[]){
+ function bad(prefix, s) {
+  throw prefix + "Not a number: "+s;
+  }
+
+ /* <sgml> Report a bad argument to a method. </sgml>
+    Arg1 is method name
+    Arg2 is argument position
+    Arg3 is what was found */
+
+ //--private void badarg(java.lang.String name,int pos,java.lang.String value){
+ function badarg(name, pos, value) {
+  throw "Bad argument "+pos+" to "+name+": "+value;
+  }
+
+ /* <sgml> Extend byte array to given length, padding with 0s.  If no
+    extension is required then return the same array. </sgml>
+
+    Arg1 is the source byte array
+    Arg2 is the new length (longer)
+    */
+
+ //--private static final byte[] extend(byte inarr[],int newlen){
+ function extend(inarr, newlen) {
+  //--byte newarr[];
+  var newarr;
+  if (inarr.length==newlen)
+   return inarr;
+  newarr=createArrayWithZeros(newlen);
+  //--java.lang.System.arraycopy((java.lang.Object)inarr,0,(java.lang.Object)newarr,0,inarr.length);
+  this.arraycopy(inarr,0,newarr,0,inarr.length);
+  // 0 padding is carried out by the JVM on allocation initialization
+  return newarr;
+  }
+
+ /* <sgml> Add or subtract two >=0 integers in byte arrays
+    <p>This routine performs the calculation:
+    <pre>
+    C=A+(B*M)
+    </pre>
+    Where M is in the range -9 through +9
+    <p>
+    If M<0 then A>=B must be true, so the result is always
+    non-negative.
+
+    Leading zeros are not removed after a subtraction.  The result is
+    either the same length as the longer of A and B, or 1 longer than
+    that (if a carry occurred).
+
+    A is not altered unless Arg6 is 1.
+    B is never altered.
+
+    Arg1 is A
+    Arg2 is A length to use (if longer than A, pad with 0's)
+    Arg3 is B
+    Arg4 is B length to use (if longer than B, pad with 0's)
+    Arg5 is M, the multiplier
+    Arg6 is 1 if A can be used to build the result (if it fits)
+
+    This routine is severely performance-critical; *any* change here
+    must be measured (timed) to assure no performance degradation.
+    */
+ // 1996.02.20 -- enhanced version of DMSRCN algorithm (1981)
+ // 1997.10.05 -- changed to byte arrays (from char arrays)
+ // 1998.07.01 -- changed to allow destructive reuse of LHS
+ // 1998.07.01 -- changed to allow virtual lengths for the arrays
+ // 1998.12.29 -- use lookaside for digit/carry calculation
+ // 1999.08.07 -- avoid multiply when mult=1, and make db an int
+ // 1999.12.22 -- special case m=-1, also drop 0 special case
+
+ //--private static final byte[] byteaddsub(byte a[],int avlen,byte b[],int bvlen,int m,boolean reuse){
+ function byteaddsub(a, avlen, b, bvlen, m, reuse) {
+  //--int alength;
+  var alength;
+  //--int blength;
+  var blength;
+  //--int ap;
+  var ap;
+  //--int bp;
+  var bp;
+  //--int maxarr;
+  var maxarr;
+  //--byte reb[];
+  var reb;
+  //--boolean quickm;
+  var quickm;
+  //--int digit;
+  var digit;
+  //--int op=0;
+  var op=0;
+  //--int dp90=0;
+  var dp90=0;
+  //--byte newarr[];
+  var newarr;
+  //--int i=0;
+  var i=0;
+
+
+
+
+  // We'll usually be right if we assume no carry
+  alength=a.length; // physical lengths
+  blength=b.length; // ..
+  ap=avlen-1; // -> final (rightmost) digit
+  bp=bvlen-1; // ..
+  maxarr=bp;
+  if (maxarr<ap)
+   maxarr=ap;
+  reb=null; // result byte array
+  if (reuse)
+   if ((maxarr+1)==alength)
+    reb=a; // OK to reuse A
+  if (reb==null){
+   reb=this.createArrayWithZeros(maxarr+1); // need new array
+   }
+
+  quickm=false; // 1 if no multiply needed
+  if (m==1)
+   quickm=true; // most common
+  else
+   if (m==(-1))
+    quickm=true; // also common
+
+  digit=0; // digit, with carry or borrow
+  {op=maxarr;op:for(;op>=0;op--){
+   if (ap>=0)
+    {
+     if (ap<alength)
+      digit=digit+a[ap]; // within A
+     ap--;
+    }
+   if (bp>=0)
+    {
+     if (bp<blength)
+      { // within B
+       if (quickm)
+        {
+         if (m>0)
+          digit=digit+b[bp]; // most common
+         else
+          digit=digit-b[bp]; // also common
+        }
+       else
+        digit=digit+(b[bp]*m);
+      }
+     bp--;
+    }
+   /* result so far (digit) could be -90 through 99 */
+   if (digit<10)
+    if (digit>=0)
+     {quick:do{ // 0-9
+      reb[op]=digit;
+      digit=0; // no carry
+      continue op;
+     }while(false);}/*quick*/
+   dp90=digit+90;
+   reb[op]=this.bytedig[dp90]; // this digit
+   digit=this.bytecar[dp90]; // carry or borrow
+   }
+  }/*op*/
+
+  if (digit==0)
+   return reb; // no carry
+  // following line will become an Assert, later
+  // if digit<0 then signal ArithmeticException("internal.error ["digit"]")
+
+  /* We have carry -- need to make space for the extra digit */
+  newarr=null;
+  if (reuse)
+   if ((maxarr+2)==a.length)
+    newarr=a; // OK to reuse A
+  if (newarr==null)
+   newarr=new Array(maxarr+2);
+  newarr[0]=digit; // the carried digit ..
+  // .. and all the rest [use local loop for short numbers]
+  //--if (maxarr<10)
+   {var $24=maxarr+1;i=0;i:for(;$24>0;$24--,i++){
+    newarr[i+1]=reb[i];
+    }
+   }/*i*/
+  //--else
+   //--java.lang.System.arraycopy((java.lang.Object)reb,0,(java.lang.Object)newarr,1,maxarr+1);
+  return newarr;
+  }
+
+ /* <sgml> Initializer for digit array properties (lookaside). </sgml>
+    Returns the digit array, and initializes the carry array. */
+
+ //--private static final byte[] diginit(){
+ function diginit() {
+  //--byte work[];
+  var work;
+  //--int op=0;
+  var op=0;
+  //--int digit=0;
+  var digit=0;
+  work=new Array((90+99)+1);
+  {op=0;op:for(;op<=(90+99);op++){
+   digit=op-90;
+   if (digit>=0)
+    {
+     work[op]=(digit%10);
+     BigDecimal.prototype.bytecar[op]=(div(digit,10)); // calculate carry
+     continue op;
+    }
+   // borrowing...
+   digit=digit+100; // yes, this is right [consider -50]
+   work[op]=(digit%10);
+   BigDecimal.prototype.bytecar[op]=((div(digit,10))-10); // calculate borrow [NB: - after %]
+   }
+  }/*op*/
+  return work;
+  }
+
+ /* <sgml> Create a copy of BigDecimal object for local use.
+    <p>This does NOT make a copy of the mantissa array.
+    </sgml>
+    Arg1 is the BigDecimal to clone (non-null)
+    */
+
+ //--private static final com.ibm.icu.math.BigDecimal clone(com.ibm.icu.math.BigDecimal dec){
+ function clone(dec) {
+  //--com.ibm.icu.math.BigDecimal copy;
+  var copy;
+  copy=new BigDecimal();
+  copy.ind=dec.ind;
+  copy.exp=dec.exp;
+  copy.form=dec.form;
+  copy.mant=dec.mant;
+  return copy;
+  }
+
+ /* <sgml> Check one or two numbers for lost digits. </sgml>
+    Arg1 is RHS (or null, if none)
+    Arg2 is current DIGITS setting
+    returns quietly or throws an exception */
+
+ //--private void checkdigits(com.ibm.icu.math.BigDecimal rhs,int dig){
+ function checkdigits(rhs, dig) {
+  if (dig==0)
+   return; // don't check if digits=0
+  // first check lhs...
+  if (this.mant.length>dig)
+   if ((!(this.allzero(this.mant,dig))))
+    throw "Too many digits: "+this.toString();
+  if (rhs==null)
+   return; // monadic
+  if (rhs.mant.length>dig)
+   if ((!(this.allzero(rhs.mant,dig))))
+    throw "Too many digits: "+rhs.toString();
+  return;
+  }
+
+ /* <sgml> Round to specified digits, if necessary. </sgml>
+    Arg1 is requested MathContext [with length and rounding mode]
+    returns this, for convenience */
+
+ //--private com.ibm.icu.math.BigDecimal round(com.ibm.icu.math.MathContext set){
+ //-- return round(set.digits,set.roundingMode);
+ //-- }
+
+ /* <sgml> Round to specified digits, if necessary.
+    Arg1 is requested length (digits to round to)
+            [may be <=0 when called from format, dodivide, etc.]
+    Arg2 is rounding mode
+    returns this, for convenience
+
+    ind and exp are adjusted, but not cleared for a mantissa of zero
+
+    The length of the mantissa returned will be Arg1, except when Arg1
+    is 0, in which case the returned mantissa length will be 1.
+    </sgml>
+    */
+
+ //private com.ibm.icu.math.BigDecimal round(int len,int mode){
+ function round() {
+  var len;
+  var mode;
+  if (round.arguments.length == 2)
+   {
+    len = round.arguments[0];
+    mode = round.arguments[1];
+   }
+  else if (round.arguments.length == 1)
+   {
+    var set = round.arguments[0];
+    len = set.digits;
+    mode = set.roundingMode;
+   }
+  else
+   {
+    throw "round(): " + round.arguments.length + " arguments given; expected 1 or 2";
+   }
+  //int adjust;
+  var adjust;
+  //int sign;
+  var sign;
+  //byte oldmant[];
+  var oldmant;
+  //boolean reuse=false;
+  var reuse=false;
+  //--byte first=0;
+  var first=0;
+  //--int increment;
+  var increment;
+  //--byte newmant[]=null;
+  var newmant=null;
+  adjust=this.mant.length-len;
+  if (adjust<=0)
+   return this; // nowt to do
+
+  this.exp=this.exp+adjust; // exponent of result
+  sign=this.ind; // save [assumes -1, 0, 1]
+  oldmant=this.mant; // save
+  if (len>0)
+   {
+    // remove the unwanted digits
+    this.mant=new Array(len);
+    //--java.lang.System.arraycopy((java.lang.Object)oldmant,0,(java.lang.Object)mant,0,len);
+    this.arraycopy(oldmant,0,this.mant,0,len);
+    reuse=true; // can reuse mantissa
+    first=oldmant[len]; // first of discarded digits
+   }
+  else
+   {/* len<=0 */
+    this.mant=this.ZERO.mant;
+    this.ind=this.iszero;
+    reuse=false; // cannot reuse mantissa
+    if (len==0)
+     first=oldmant[0];
+    else
+     first=0; // [virtual digit]
+   }
+
+  // decide rounding adjustment depending on mode, sign, and discarded digits
+  increment=0; // bumper
+  {modes:do{/*select*/
+  if (mode==this.ROUND_HALF_UP)
+   { // default first [most common]
+    if (first>=5)
+     increment=sign;
+   }
+  else if (mode==this.ROUND_UNNECESSARY)
+   { // default for setScale()
+    // discarding any non-zero digits is an error
+    if ((!(this.allzero(oldmant,len))))
+     throw "round(): Rounding necessary";
+   }
+  else if (mode==this.ROUND_HALF_DOWN)
+   { // 0.5000 goes down
+    if (first>5)
+     increment=sign;
+    else
+     if (first==5)
+      if ((!(this.allzero(oldmant,len+1))))
+       increment=sign;
+   }
+  else if (mode==this.ROUND_HALF_EVEN)
+   { // 0.5000 goes down if left digit even
+    if (first>5)
+     increment=sign;
+    else
+     if (first==5)
+      {
+       if ((!(this.allzero(oldmant,len+1))))
+        increment=sign;
+       else /* 0.5000 */
+        if ((((this.mant[this.mant.length-1])%2))==1)
+         increment=sign;
+      }
+   }
+  else if (mode==this.ROUND_DOWN)
+   {} // never increment
+  else if (mode==this.ROUND_UP)
+   { // increment if discarded non-zero
+    if ((!(this.allzero(oldmant,len))))
+     increment=sign;
+   }
+  else if (mode==this.ROUND_CEILING)
+   { // more positive
+    if (sign>0)
+     if ((!(this.allzero(oldmant,len))))
+      increment=sign;
+   }
+  else if (mode==this.ROUND_FLOOR)
+   { // more negative
+    if (sign<0)
+     if ((!(this.allzero(oldmant,len))))
+      increment=sign;
+   }
+  else{
+   throw "round(): Bad round value: "+mode;
+  }
+  }while(false);}/*modes*/
+
+  if (increment!=0)
+   {bump:do{
+    if (this.ind==this.iszero)
+     {
+      // we must not subtract from 0, but result is trivial anyway
+      this.mant=this.ONE.mant;
+      this.ind=increment;
+     }
+    else
+     {
+      // mantissa is non-0; we can safely add or subtract 1
+      if (this.ind==this.isneg)
+       increment=-increment;
+      newmant=this.byteaddsub(this.mant,this.mant.length,this.ONE.mant,1,increment,reuse);
+      if (newmant.length>this.mant.length)
+       { // had a carry
+        // drop rightmost digit and raise exponent
+        this.exp++;
+        // mant is already the correct length
+        //java.lang.System.arraycopy((java.lang.Object)newmant,0,(java.lang.Object)mant,0,mant.length);
+        this.arraycopy(newmant,0,this.mant,0,this.mant.length);
+       }
+      else
+       this.mant=newmant;
+     }
+   }while(false);}/*bump*/
+  // rounding can increase exponent significantly
+  if (this.exp>this.MaxExp)
+   throw "round(): Exponent Overflow: "+this.exp;
+  return this;
+  }
+
+ /* <sgml> Test if rightmost digits are all 0.
+    Arg1 is a mantissa array to test
+    Arg2 is the offset of first digit to check
+            [may be negative; if so, digits to left are 0's]
+    returns 1 if all the digits starting at Arg2 are 0
+
+    Arg2 may be beyond array bounds, in which case 1 is returned
+    </sgml> */
+
+ //--private static final boolean allzero(byte array[],int start){
+ function allzero(array, start) {
+  //--int i=0;
+  var i=0;
+  if (start<0)
+   start=0;
+  {var $25=array.length-1;i=start;i:for(;i<=$25;i++){
+   if (array[i]!=0)
+    return false;
+   }
+  }/*i*/
+  return true;
+  }
+
+ /* <sgml> Carry out final checks and canonicalization
+    <p>
+    This finishes off the current number by:
+      1. Rounding if necessary (NB: length includes leading zeros)
+      2. Stripping trailing zeros (if requested and \PLAIN)
+      3. Stripping leading zeros (always)
+      4. Selecting exponential notation (if required)
+      5. Converting a zero result to just '0' (if \PLAIN)
+    In practice, these operations overlap and share code.
+    It always sets form.
+    </sgml>
+    Arg1 is requested MathContext (length to round to, trigger, and FORM)
+    Arg2 is 1 if trailing insignificant zeros should be removed after
+         round (for division, etc.), provided that set.form isn't PLAIN.
+   returns this, for convenience
+   */
+
+ //--private com.ibm.icu.math.BigDecimal finish(com.ibm.icu.math.MathContext set,boolean strip){
+ function finish(set, strip) {
+  //--int d=0;
+  var d=0;
+  //--int i=0;
+  var i=0;
+  //--byte newmant[]=null;
+  var newmant=null;
+  //--int mag=0;
+  var mag=0;
+  //--int sig=0;
+  var sig=0;
+  /* Round if mantissa too long and digits requested */
+  if (set.digits!=0)
+   if (this.mant.length>set.digits)
+    this.round(set);
+
+  /* If strip requested (and standard formatting), remove
+     insignificant trailing zeros. */
+  if (strip)
+   if (set.form!=MathContext.prototype.PLAIN)
+    {
+     d=this.mant.length;
+     /* see if we need to drop any trailing zeros */
+     {i=d-1;i:for(;i>=1;i--){
+      if (this.mant[i]!=0)
+       break i;
+      d--;
+      this.exp++;
+      }
+     }/*i*/
+     if (d<this.mant.length)
+      {/* need to reduce */
+       newmant=new Array(d);
+       //--java.lang.System.arraycopy((java.lang.Object)this.mant,0,(java.lang.Object)newmant,0,d);
+       this.arraycopy(this.mant,0,newmant,0,d);
+       this.mant=newmant;
+      }
+    }
+
+  this.form=MathContext.prototype.PLAIN; // preset
+
+  /* Now check for leading- and all- zeros in mantissa */
+  {var $26=this.mant.length;i=0;i:for(;$26>0;$26--,i++){
+   if (this.mant[i]!=0)
+    {
+     // non-0 result; ind will be correct
+     // remove leading zeros [e.g., after subtract]
+     if (i>0)
+      {delead:do{
+       newmant=new Array(this.mant.length-i);
+       //--java.lang.System.arraycopy((java.lang.Object)this.mant,i,(java.lang.Object)newmant,0,this.mant.length-i);
+       this.arraycopy(this.mant,i,newmant,0,this.mant.length-i);
+       this.mant=newmant;
+      }while(false);}/*delead*/
+     // now determine form if not PLAIN
+     mag=this.exp+this.mant.length;
+     if (mag>0)
+      { // most common path
+       if (mag>set.digits)
+        if (set.digits!=0)
+         this.form=set.form;
+       if ((mag-1)<=this.MaxExp)
+        return this; // no overflow; quick return
+      }
+     else
+      if (mag<(-5))
+       this.form=set.form;
+     /* check for overflow */
+     mag--;
+     if ((mag<this.MinExp)||(mag>this.MaxExp))
+      {overflow:do{
+       // possible reprieve if form is engineering
+       if (this.form==MathContext.prototype.ENGINEERING)
+        {
+         sig=mag%3; // leftover
+         if (sig<0)
+          sig=3+sig; // negative exponent
+         mag=mag-sig; // exponent to use
+         // 1999.06.29: second test here must be MaxExp
+         if (mag>=this.MinExp)
+          if (mag<=this.MaxExp)
+           break overflow;
+        }
+       throw "finish(): Exponent Overflow: "+mag;
+      }while(false);}/*overflow*/
+     return this;
+    }
+   }
+  }/*i*/
+
+  // Drop through to here only if mantissa is all zeros
+  this.ind=this.iszero;
+  {/*select*/
+  if (set.form!=MathContext.prototype.PLAIN)
+   this.exp=0; // standard result; go to '0'
+  else if (this.exp>0)
+   this.exp=0; // +ve exponent also goes to '0'
+  else{
+   // a plain number with -ve exponent; preserve and check exponent
+   if (this.exp<this.MinExp)
+    throw "finish(): Exponent Overflow: "+this.exp;
+  }
+  }
+  this.mant=this.ZERO.mant; // canonical mantissa
+  return this;
+  }
+
+ function isGreaterThan(other) {
+  return this.compareTo(other) > 0;
+ };
+ function isLessThan(other) {
+  return this.compareTo(other) < 0;
+ };
+ function isGreaterThanOrEqualTo(other) {
+  return this.compareTo(other) >= 0;
+ };
+ function isLessThanOrEqualTo(other) {
+  return this.compareTo(other) <= 0;
+ };
+ function isPositive() {
+  return this.compareTo(BigDecimal.prototype.ZERO) > 0;
+ };
+ function isNegative() {
+  return this.compareTo(BigDecimal.prototype.ZERO) < 0;
+ };
+ function isZero() {
+  return this.compareTo(BigDecimal.prototype.ZERO) === 0;
+ };
+return BigDecimal;
+})(MathContext); // BigDecimal depends on MathContext
+
+if (typeof define === "function" && define.amd != null) {
+	// AMD-loader compatible resource declaration
+	// require('bigdecimal') will return JS Object:
+	// {'BigDecimal':BigDecimalPointer, 'MathContext':MathContextPointer}
+	define({'BigDecimal':BigDecimal, 'MathContext':MathContext});
+} else if (typeof this === "object"){
+	// global-polluting outcome.
+	this.BigDecimal = BigDecimal;
+	this.MathContext = MathContext;
+}
+
+}).call(this); // in browser 'this' will be 'window' or simulated window object in AMD-loading scenarios.
diff -pruN 1.3.0+dfsg-1/perf/lib/bigdecimal_ICU4J/BigDecimal-all-last.min.js 8.0.2+ds-1/perf/lib/bigdecimal_ICU4J/BigDecimal-all-last.min.js
--- 1.3.0+dfsg-1/perf/lib/bigdecimal_ICU4J/BigDecimal-all-last.min.js	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/perf/lib/bigdecimal_ICU4J/BigDecimal-all-last.min.js	2019-01-13 22:17:07.000000000 +0000
@@ -0,0 +1,61 @@
+/*
+ Copyright (c) 2012 Daniel Trebbien and other contributors
+Portions Copyright (c) 2003 STZ-IDA and PTV AG, Karlsruhe, Germany
+Portions Copyright (c) 1995-2001 International Business Machines Corporation and others
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder.
+*/
+(function(){var y=function(){function h(){this.form=this.digits=0;this.lostDigits=!1;this.roundingMode=0;var v=this.DEFAULT_FORM,r=this.DEFAULT_LOSTDIGITS,f=this.DEFAULT_ROUNDINGMODE;if(4==h.arguments.length)v=h.arguments[1],r=h.arguments[2],f=h.arguments[3];else if(3==h.arguments.length)v=h.arguments[1],r=h.arguments[2];else if(2==h.arguments.length)v=h.arguments[1];else if(1!=h.arguments.length)throw"MathContext(): "+h.arguments.length+" arguments given; expected 1 to 4";var t=h.arguments[0];if(t!=
+this.DEFAULT_DIGITS){if(t<this.MIN_DIGITS)throw"MathContext(): Digits too small: "+t;if(t>this.MAX_DIGITS)throw"MathContext(): Digits too large: "+t;}if(v!=this.SCIENTIFIC&&v!=this.ENGINEERING&&v!=this.PLAIN)throw"MathContext() Bad form value: "+v;if(!this.isValidRound(f))throw"MathContext(): Bad roundingMode value: "+f;this.digits=t;this.form=v;this.lostDigits=r;this.roundingMode=f}h.prototype.getDigits=function(){return this.digits};h.prototype.getForm=function(){return this.form};h.prototype.getLostDigits=
+function(){return this.lostDigits};h.prototype.getRoundingMode=function(){return this.roundingMode};h.prototype.toString=function(){var h=null,r=0,f=null,h=this.form==this.SCIENTIFIC?"SCIENTIFIC":this.form==this.ENGINEERING?"ENGINEERING":"PLAIN",t=this.ROUNDS.length,r=0;a:for(;0<t;t--,r++)if(this.roundingMode==this.ROUNDS[r]){f=this.ROUNDWORDS[r];break a}return"digits="+this.digits+" form="+h+" lostDigits="+(this.lostDigits?"1":"0")+" roundingMode="+f};h.prototype.isValidRound=function(h){var r=0,
+f=this.ROUNDS.length,r=0;for(;0<f;f--,r++)if(h==this.ROUNDS[r])return!0;return!1};h.PLAIN=h.prototype.PLAIN=0;h.SCIENTIFIC=h.prototype.SCIENTIFIC=1;h.ENGINEERING=h.prototype.ENGINEERING=2;h.ROUND_CEILING=h.prototype.ROUND_CEILING=2;h.ROUND_DOWN=h.prototype.ROUND_DOWN=1;h.ROUND_FLOOR=h.prototype.ROUND_FLOOR=3;h.ROUND_HALF_DOWN=h.prototype.ROUND_HALF_DOWN=5;h.ROUND_HALF_EVEN=h.prototype.ROUND_HALF_EVEN=6;h.ROUND_HALF_UP=h.prototype.ROUND_HALF_UP=4;h.ROUND_UNNECESSARY=h.prototype.ROUND_UNNECESSARY=7;
+h.ROUND_UP=h.prototype.ROUND_UP=0;h.prototype.DEFAULT_FORM=h.prototype.SCIENTIFIC;h.prototype.DEFAULT_DIGITS=9;h.prototype.DEFAULT_LOSTDIGITS=!1;h.prototype.DEFAULT_ROUNDINGMODE=h.prototype.ROUND_HALF_UP;h.prototype.MIN_DIGITS=0;h.prototype.MAX_DIGITS=999999999;h.prototype.ROUNDS=[h.prototype.ROUND_HALF_UP,h.prototype.ROUND_UNNECESSARY,h.prototype.ROUND_CEILING,h.prototype.ROUND_DOWN,h.prototype.ROUND_FLOOR,h.prototype.ROUND_HALF_DOWN,h.prototype.ROUND_HALF_EVEN,h.prototype.ROUND_UP];h.prototype.ROUNDWORDS=
+"ROUND_HALF_UP ROUND_UNNECESSARY ROUND_CEILING ROUND_DOWN ROUND_FLOOR ROUND_HALF_DOWN ROUND_HALF_EVEN ROUND_UP".split(" ");h.prototype.DEFAULT=new h(h.prototype.DEFAULT_DIGITS,h.prototype.DEFAULT_FORM,h.prototype.DEFAULT_LOSTDIGITS,h.prototype.DEFAULT_ROUNDINGMODE);return h}(),L=function(h){function v(a,b){return(a-a%b)/b}function r(a){var b=Array(a),c;for(c=0;c<a;++c)b[c]=0;return b}function f(){this.ind=0;this.form=h.prototype.PLAIN;this.mant=null;this.exp=0;if(0!=f.arguments.length){var a,b,c;
+1==f.arguments.length?(a=f.arguments[0],b=0,c=a.length):(a=f.arguments[0],b=f.arguments[1],c=f.arguments[2]);"string"==typeof a&&(a=a.split(""));var d,e,n,g,k,l=0,m=0;e=!1;var q=m=m=l=0,p=0;g=0;0>=c&&this.bad("BigDecimal(): ",a);this.ind=this.ispos;"-"==a[0]?(c--,0==c&&this.bad("BigDecimal(): ",a),this.ind=this.isneg,b++):"+"==a[0]&&(c--,0==c&&this.bad("BigDecimal(): ",a),b++);e=d=!1;n=0;k=g=-1;q=c;l=b;a:for(;0<q;q--,l++){m=a[l];if("0"<=m&&"9">=m){k=l;n++;continue a}if("."==m){0<=g&&this.bad("BigDecimal(): ",
+a);g=l-b;continue a}if("e"!=m&&"E"!=m){("0">m||"9"<m)&&this.bad("BigDecimal(): ",a);d=!0;k=l;n++;continue a}l-b>c-2&&this.bad("BigDecimal(): ",a);e=!1;"-"==a[l+1]?(e=!0,l+=2):l="+"==a[l+1]?l+2:l+1;m=c-(l-b);(0==m||9<m)&&this.bad("BigDecimal(): ",a);c=m;m=l;for(;0<c;c--,m++)q=a[m],"0">q&&this.bad("BigDecimal(): ",a),"9"<q?this.bad("BigDecimal(): ",a):p=q-0,this.exp=10*this.exp+p;e&&(this.exp=-this.exp);e=!0;break a}0==n&&this.bad("BigDecimal(): ",a);0<=g&&(this.exp=this.exp+g-n);p=k-1;l=b;a:for(;l<=
+p;l++)if(m=a[l],"0"==m)b++,g--,n--;else if("."==m)b++,g--;else break a;this.mant=Array(n);m=b;if(d)for(b=n,l=0;0<b;b--,l++)l==g&&m++,q=a[m],"9">=q?this.mant[l]=q-0:this.bad("BigDecimal(): ",a),m++;else for(b=n,l=0;0<b;b--,l++)l==g&&m++,this.mant[l]=a[m]-0,m++;0==this.mant[0]?(this.ind=this.iszero,0<this.exp&&(this.exp=0),e&&(this.mant=this.ZERO.mant,this.exp=0)):e&&(this.form=h.prototype.SCIENTIFIC,g=this.exp+this.mant.length-1,(g<this.MinExp||g>this.MaxExp)&&this.bad("BigDecimal(): ",a))}}function t(){var a;
+if(1==t.arguments.length)a=t.arguments[0];else if(0==t.arguments.length)a=this.plainMC;else throw"abs(): "+t.arguments.length+" arguments given; expected 0 or 1";return this.ind==this.isneg?this.negate(a):this.plus(a)}function z(){var a;if(2==z.arguments.length)a=z.arguments[1];else if(1==z.arguments.length)a=this.plainMC;else throw"add(): "+z.arguments.length+" arguments given; expected 1 or 2";var b=z.arguments[0],c,d,e,n,g,k,l,m=0;d=m=0;var m=null,q=m=0,p=0,r=0,t=0,s=0;a.lostDigits&&this.checkdigits(b,
+a.digits);c=this;if(0==c.ind&&a.form!=h.prototype.PLAIN)return b.plus(a);if(0==b.ind&&a.form!=h.prototype.PLAIN)return c.plus(a);d=a.digits;0<d&&(c.mant.length>d&&(c=this.clone(c).round(a)),b.mant.length>d&&(b=this.clone(b).round(a)));e=new f;n=c.mant;g=c.mant.length;k=b.mant;l=b.mant.length;if(c.exp==b.exp)e.exp=c.exp;else if(c.exp>b.exp){m=g+c.exp-b.exp;if(m>=l+d+1&&0<d)return e.mant=n,e.exp=c.exp,e.ind=c.ind,g<d&&(e.mant=this.extend(c.mant,d),e.exp-=d-g),e.finish(a,!1);e.exp=b.exp;m>d+1&&0<d&&
+(m=m-d-1,l-=m,e.exp+=m,m=d+1);m>g&&(g=m)}else{m=l+b.exp-c.exp;if(m>=g+d+1&&0<d)return e.mant=k,e.exp=b.exp,e.ind=b.ind,l<d&&(e.mant=this.extend(b.mant,d),e.exp-=d-l),e.finish(a,!1);e.exp=c.exp;m>d+1&&0<d&&(m=m-d-1,g-=m,e.exp+=m,m=d+1);m>l&&(l=m)}e.ind=c.ind==this.iszero?this.ispos:c.ind;if((c.ind==this.isneg?1:0)==(b.ind==this.isneg?1:0))d=1;else{do{d=-1;do if(b.ind!=this.iszero)if(g<l||c.ind==this.iszero)m=n,n=k,k=m,m=g,g=l,l=m,e.ind=-e.ind;else if(!(g>l))c:for(q=m=0,p=n.length-1,r=k.length-1;;){if(m<=
+p)t=n[m];else{if(q>r){if(a.form!=h.prototype.PLAIN)return this.ZERO;break c}t=0}s=q<=r?k[q]:0;if(t!=s){t<s&&(m=n,n=k,k=m,m=g,g=l,l=m,e.ind=-e.ind);break c}m++;q++}while(0)}while(0)}e.mant=this.byteaddsub(n,g,k,l,d,!1);return e.finish(a,!1)}function A(){var a;if(2==A.arguments.length)a=A.arguments[1];else if(1==A.arguments.length)a=this.plainMC;else throw"compareTo(): "+A.arguments.length+" arguments given; expected 1 or 2";var b=A.arguments[0],c=0,c=0;a.lostDigits&&this.checkdigits(b,a.digits);if(this.ind==
+b.ind&&this.exp==b.exp){c=this.mant.length;if(c<b.mant.length)return-this.ind;if(c>b.mant.length)return this.ind;if(c<=a.digits||0==a.digits){a=c;c=0;for(;0<a;a--,c++){if(this.mant[c]<b.mant[c])return-this.ind;if(this.mant[c]>b.mant[c])return this.ind}return 0}}else{if(this.ind<b.ind)return-1;if(this.ind>b.ind)return 1}b=this.clone(b);b.ind=-b.ind;return this.add(b,a).ind}function u(){var a,b=-1;if(2==u.arguments.length)a="number"==typeof u.arguments[1]?new h(0,h.prototype.PLAIN,!1,u.arguments[1]):
+u.arguments[1];else if(3==u.arguments.length){b=u.arguments[1];if(0>b)throw"divide(): Negative scale: "+b;a=new h(0,h.prototype.PLAIN,!1,u.arguments[2])}else if(1==u.arguments.length)a=this.plainMC;else throw"divide(): "+u.arguments.length+" arguments given; expected between 1 and 3";return this.dodivide("D",u.arguments[0],a,b)}function B(){var a;if(2==B.arguments.length)a=B.arguments[1];else if(1==B.arguments.length)a=this.plainMC;else throw"divideInteger(): "+B.arguments.length+" arguments given; expected 1 or 2";
+return this.dodivide("I",B.arguments[0],a,0)}function C(){var a;if(2==C.arguments.length)a=C.arguments[1];else if(1==C.arguments.length)a=this.plainMC;else throw"max(): "+C.arguments.length+" arguments given; expected 1 or 2";var b=C.arguments[0];return 0<=this.compareTo(b,a)?this.plus(a):b.plus(a)}function D(){var a;if(2==D.arguments.length)a=D.arguments[1];else if(1==D.arguments.length)a=this.plainMC;else throw"min(): "+D.arguments.length+" arguments given; expected 1 or 2";var b=D.arguments[0];
+return 0>=this.compareTo(b,a)?this.plus(a):b.plus(a)}function E(){var a;if(2==E.arguments.length)a=E.arguments[1];else if(1==E.arguments.length)a=this.plainMC;else throw"multiply(): "+E.arguments.length+" arguments given; expected 1 or 2";var b=E.arguments[0],c,d,e,h=e=null,g,k=0,l,m=0,q=0;a.lostDigits&&this.checkdigits(b,a.digits);c=this;d=0;e=a.digits;0<e?(c.mant.length>e&&(c=this.clone(c).round(a)),b.mant.length>e&&(b=this.clone(b).round(a))):(0<c.exp&&(d+=c.exp),0<b.exp&&(d+=b.exp));c.mant.length<
+b.mant.length?(e=c.mant,h=b.mant):(e=b.mant,h=c.mant);g=e.length+h.length-1;k=9<e[0]*h[0]?g+1:g;l=new f;var k=this.createArrayWithZeros(k),p=e.length,m=0;for(;0<p;p--,m++)q=e[m],0!=q&&(k=this.byteaddsub(k,k.length,h,g,q,!0)),g--;l.ind=c.ind*b.ind;l.exp=c.exp+b.exp-d;l.mant=0==d?k:this.extend(k,k.length+d);return l.finish(a,!1)}function J(){var a;if(1==J.arguments.length)a=J.arguments[0];else if(0==J.arguments.length)a=this.plainMC;else throw"negate(): "+J.arguments.length+" arguments given; expected 0 or 1";
+var b;a.lostDigits&&this.checkdigits(null,a.digits);b=this.clone(this);b.ind=-b.ind;return b.finish(a,!1)}function K(){var a;if(1==K.arguments.length)a=K.arguments[0];else if(0==K.arguments.length)a=this.plainMC;else throw"plus(): "+K.arguments.length+" arguments given; expected 0 or 1";a.lostDigits&&this.checkdigits(null,a.digits);return a.form==h.prototype.PLAIN&&this.form==h.prototype.PLAIN&&(this.mant.length<=a.digits||0==a.digits)?this:this.clone(this).finish(a,!1)}function F(){var a;if(2==F.arguments.length)a=
+F.arguments[1];else if(1==F.arguments.length)a=this.plainMC;else throw"pow(): "+F.arguments.length+" arguments given; expected 1 or 2";var b=F.arguments[0],c,d,e,f=e=0,g,k=0;a.lostDigits&&this.checkdigits(b,a.digits);c=b.intcheck(this.MinArg,this.MaxArg);d=this;e=a.digits;if(0==e){if(b.ind==this.isneg)throw"pow(): Negative power: "+b.toString();e=0}else{if(b.mant.length+b.exp>e)throw"pow(): Too many digits: "+b.toString();d.mant.length>e&&(d=this.clone(d).round(a));f=b.mant.length+b.exp;e=e+f+1}e=
+new h(e,a.form,!1,a.roundingMode);f=this.ONE;if(0==c)return f;0>c&&(c=-c);g=!1;k=1;a:for(;;k++){c<<=1;0>c&&(g=!0,f=f.multiply(d,e));if(31==k)break a;if(!g)continue a;f=f.multiply(f,e)}0>b.ind&&(f=this.ONE.divide(f,e));return f.finish(a,!0)}function G(){var a;if(2==G.arguments.length)a=G.arguments[1];else if(1==G.arguments.length)a=this.plainMC;else throw"remainder(): "+G.arguments.length+" arguments given; expected 1 or 2";return this.dodivide("R",G.arguments[0],a,-1)}function H(){var a;if(2==H.arguments.length)a=
+H.arguments[1];else if(1==H.arguments.length)a=this.plainMC;else throw"subtract(): "+H.arguments.length+" arguments given; expected 1 or 2";var b=H.arguments[0];a.lostDigits&&this.checkdigits(b,a.digits);b=this.clone(b);b.ind=-b.ind;return this.add(b,a)}function w(){var a,b,c,d;if(6==w.arguments.length)a=w.arguments[2],b=w.arguments[3],c=w.arguments[4],d=w.arguments[5];else if(2==w.arguments.length)b=a=-1,c=h.prototype.SCIENTIFIC,d=this.ROUND_HALF_UP;else throw"format(): "+w.arguments.length+" arguments given; expected 2 or 6";
+var e=w.arguments[0],f=w.arguments[1],g,k=0,k=k=0,l=null,m=l=k=0;g=0;k=null;m=l=0;(-1>e||0==e)&&this.badarg("format",1,e);-1>f&&this.badarg("format",2,f);(-1>a||0==a)&&this.badarg("format",3,a);-1>b&&this.badarg("format",4,b);c!=h.prototype.SCIENTIFIC&&c!=h.prototype.ENGINEERING&&(-1==c?c=h.prototype.SCIENTIFIC:this.badarg("format",5,c));if(d!=this.ROUND_HALF_UP)try{-1==d?d=this.ROUND_HALF_UP:new h(9,h.prototype.SCIENTIFIC,!1,d)}catch(q){this.badarg("format",6,d)}g=this.clone(this);-1==b?g.form=h.prototype.PLAIN:
+g.ind==this.iszero?g.form=h.prototype.PLAIN:(k=g.exp+g.mant.length,g.form=k>b?c:-5>k?c:h.prototype.PLAIN);if(0<=f)a:for(;;){g.form==h.prototype.PLAIN?k=-g.exp:g.form==h.prototype.SCIENTIFIC?k=g.mant.length-1:(k=(g.exp+g.mant.length-1)%3,0>k&&(k=3+k),k++,k=k>=g.mant.length?0:g.mant.length-k);if(k==f)break a;if(k<f){l=this.extend(g.mant,g.mant.length+f-k);g.mant=l;g.exp-=f-k;if(g.exp<this.MinExp)throw"format(): Exponent Overflow: "+g.exp;break a}k-=f;if(k>g.mant.length){g.mant=this.ZERO.mant;g.ind=
+this.iszero;g.exp=0;continue a}l=g.mant.length-k;m=g.exp;g.round(l,d);if(g.exp-m==k)break a}b=g.layout();if(0<e){c=b.length;g=0;a:for(;0<c;c--,g++){if("."==b[g])break a;if("E"==b[g])break a}g>e&&this.badarg("format",1,e);if(g<e){k=Array(b.length+e-g);e-=g;l=0;for(;0<e;e--,l++)k[l]=" ";this.arraycopy(b,0,k,l,b.length);b=k}}if(0<a){e=b.length-1;g=b.length-1;a:for(;0<e;e--,g--)if("E"==b[g])break a;if(0==g){k=Array(b.length+a+2);this.arraycopy(b,0,k,0,b.length);a+=2;l=b.length;for(;0<a;a--,l++)k[l]=" ";
+b=k}else if(m=b.length-g-2,m>a&&this.badarg("format",3,a),m<a){k=Array(b.length+a-m);this.arraycopy(b,0,k,0,g+2);a-=m;l=g+2;for(;0<a;a--,l++)k[l]="0";this.arraycopy(b,g+2,k,l,m);b=k}}return b.join("")}function I(){var a;if(2==I.arguments.length)a=I.arguments[1];else if(1==I.arguments.length)a=this.ROUND_UNNECESSARY;else throw"setScale(): "+I.arguments.length+" given; expected 1 or 2";var b=I.arguments[0],c,d;c=c=0;c=this.scale();if(c==b&&this.form==h.prototype.PLAIN)return this;d=this.clone(this);
+if(c<=b)c=0==c?d.exp+b:b-c,d.mant=this.extend(d.mant,d.mant.length+c),d.exp=-b;else{if(0>b)throw"setScale(): Negative scale: "+b;c=d.mant.length-(c-b);d=d.round(c,a);d.exp!=-b&&(d.mant=this.extend(d.mant,d.mant.length+1),d.exp-=1)}d.form=h.prototype.PLAIN;return d}function y(){var a,b=0,c=0;a=Array(190);b=0;a:for(;189>=b;b++){c=b-90;if(0<=c){a[b]=c%10;f.prototype.bytecar[b]=v(c,10);continue a}c+=100;a[b]=c%10;f.prototype.bytecar[b]=v(c,10)-10}return a}function x(){var a,b;if(2==x.arguments.length)a=
+x.arguments[0],b=x.arguments[1];else if(1==x.arguments.length)b=x.arguments[0],a=b.digits,b=b.roundingMode;else throw"round(): "+x.arguments.length+" arguments given; expected 1 or 2";var c,d,e=!1,f=0,g;c=null;c=this.mant.length-a;if(0>=c)return this;this.exp+=c;c=this.ind;d=this.mant;0<a?(this.mant=Array(a),this.arraycopy(d,0,this.mant,0,a),e=!0,f=d[a]):(this.mant=this.ZERO.mant,this.ind=this.iszero,e=!1,f=0==a?d[0]:0);g=0;if(b==this.ROUND_HALF_UP)5<=f&&(g=c);else if(b==this.ROUND_UNNECESSARY){if(!this.allzero(d,
+a))throw"round(): Rounding necessary";}else if(b==this.ROUND_HALF_DOWN)5<f?g=c:5==f&&(this.allzero(d,a+1)||(g=c));else if(b==this.ROUND_HALF_EVEN)5<f?g=c:5==f&&(this.allzero(d,a+1)?1==this.mant[this.mant.length-1]%2&&(g=c):g=c);else if(b!=this.ROUND_DOWN)if(b==this.ROUND_UP)this.allzero(d,a)||(g=c);else if(b==this.ROUND_CEILING)0<c&&(this.allzero(d,a)||(g=c));else if(b==this.ROUND_FLOOR)0>c&&(this.allzero(d,a)||(g=c));else throw"round(): Bad round value: "+b;0!=g&&(this.ind==this.iszero?(this.mant=
+this.ONE.mant,this.ind=g):(this.ind==this.isneg&&(g=-g),c=this.byteaddsub(this.mant,this.mant.length,this.ONE.mant,1,g,e),c.length>this.mant.length?(this.exp++,this.arraycopy(c,0,this.mant,0,this.mant.length)):this.mant=c));if(this.exp>this.MaxExp)throw"round(): Exponent Overflow: "+this.exp;return this}f.prototype.div=v;f.prototype.arraycopy=function(a,b,c,d,e){var f;if(d>b)for(f=e-1;0<=f;--f)c[f+d]=a[f+b];else for(f=0;f<e;++f)c[f+d]=a[f+b]};f.prototype.createArrayWithZeros=r;f.prototype.abs=t;f.prototype.add=
+z;f.prototype.compareTo=A;f.prototype.divide=u;f.prototype.divideInteger=B;f.prototype.max=C;f.prototype.min=D;f.prototype.multiply=E;f.prototype.negate=J;f.prototype.plus=K;f.prototype.pow=F;f.prototype.remainder=G;f.prototype.subtract=H;f.prototype.equals=function(a){var b=0,c=null,d=null;if(null==a||!(a instanceof f)||this.ind!=a.ind)return!1;if(this.mant.length==a.mant.length&&this.exp==a.exp&&this.form==a.form)for(c=this.mant.length,b=0;0<c;c--,b++){if(this.mant[b]!=a.mant[b])return!1}else{c=
+this.layout();d=a.layout();if(c.length!=d.length)return!1;a=c.length;b=0;for(;0<a;a--,b++)if(c[b]!=d[b])return!1}return!0};f.prototype.format=w;f.prototype.intValueExact=function(){var a,b=0,c,d=0;a=0;if(this.ind==this.iszero)return 0;a=this.mant.length-1;if(0>this.exp){a+=this.exp;if(!this.allzero(this.mant,a+1))throw"intValueExact(): Decimal part non-zero: "+this.toString();if(0>a)return 0;b=0}else{if(9<this.exp+a)throw"intValueExact(): Conversion overflow: "+this.toString();b=this.exp}c=0;var e=
+a+b,d=0;for(;d<=e;d++)c*=10,d<=a&&(c+=this.mant[d]);if(9==a+b&&(a=v(c,1E9),a!=this.mant[0])){if(-2147483648==c&&this.ind==this.isneg&&2==this.mant[0])return c;throw"intValueExact(): Conversion overflow: "+this.toString();}return this.ind==this.ispos?c:-c};f.prototype.movePointLeft=function(a){var b;b=this.clone(this);b.exp-=a;return b.finish(this.plainMC,!1)};f.prototype.movePointRight=function(a){var b;b=this.clone(this);b.exp+=a;return b.finish(this.plainMC,!1)};f.prototype.scale=function(){return 0<=
+this.exp?0:-this.exp};f.prototype.setScale=I;f.prototype.signum=function(){return this.ind};f.prototype.toString=function(){return this.layout().join("")};f.prototype.layout=function(){var a,b=0,b=null,c=0,d=0;a=0;var d=null,e,b=0;a=Array(this.mant.length);c=this.mant.length;b=0;for(;0<c;c--,b++)a[b]=this.mant[b]+"";if(this.form!=h.prototype.PLAIN){b="";this.ind==this.isneg&&(b+="-");c=this.exp+a.length-1;if(this.form==h.prototype.SCIENTIFIC)b+=a[0],1<a.length&&(b+="."),b+=a.slice(1).join("");else if(d=
+c%3,0>d&&(d=3+d),c-=d,d++,d>=a.length)for(b+=a.join(""),a=d-a.length;0<a;a--)b+="0";else b+=a.slice(0,d).join(""),b=b+"."+a.slice(d).join("");0!=c&&(0>c?(a="-",c=-c):a="+",b+="E",b+=a,b+=c);return b.split("")}if(0==this.exp){if(0<=this.ind)return a;d=Array(a.length+1);d[0]="-";this.arraycopy(a,0,d,1,a.length);return d}c=this.ind==this.isneg?1:0;e=this.exp+a.length;if(1>e){b=c+2-this.exp;d=Array(b);0!=c&&(d[0]="-");d[c]="0";d[c+1]=".";var f=-e,b=c+2;for(;0<f;f--,b++)d[b]="0";this.arraycopy(a,0,d,c+
+2-e,a.length);return d}if(e>a.length){d=Array(c+e);0!=c&&(d[0]="-");this.arraycopy(a,0,d,c,a.length);e-=a.length;b=c+a.length;for(;0<e;e--,b++)d[b]="0";return d}b=c+1+a.length;d=Array(b);0!=c&&(d[0]="-");this.arraycopy(a,0,d,c,e);d[c+e]=".";this.arraycopy(a,e,d,c+e+1,a.length-e);return d};f.prototype.intcheck=function(a,b){var c;c=this.intValueExact();if(c<a||c>b)throw"intcheck(): Conversion overflow: "+c;return c};f.prototype.dodivide=function(a,b,c,d){var e,n,g,k,l,m,q,p,t,r=0,s=0,u=0;n=n=s=s=s=
+0;e=null;e=e=0;e=null;c.lostDigits&&this.checkdigits(b,c.digits);e=this;if(0==b.ind)throw"dodivide(): Divide by 0";if(0==e.ind)return c.form!=h.prototype.PLAIN?this.ZERO:-1==d?e:e.setScale(d);n=c.digits;0<n?(e.mant.length>n&&(e=this.clone(e).round(c)),b.mant.length>n&&(b=this.clone(b).round(c))):(-1==d&&(d=e.scale()),n=e.mant.length,d!=-e.exp&&(n=n+d+e.exp),n=n-(b.mant.length-1)-b.exp,n<e.mant.length&&(n=e.mant.length),n<b.mant.length&&(n=b.mant.length));g=e.exp-b.exp+e.mant.length-b.mant.length;
+if(0>g&&"D"!=a)return"I"==a?this.ZERO:this.clone(e).finish(c,!1);k=new f;k.ind=e.ind*b.ind;k.exp=g;k.mant=this.createArrayWithZeros(n+1);l=n+n+1;g=this.extend(e.mant,l);m=l;q=b.mant;p=l;t=10*q[0]+1;1<q.length&&(t+=q[1]);l=0;a:for(;;){r=0;b:for(;;){if(m<p)break b;if(m==p){c:do{var w=m,s=0;for(;0<w;w--,s++){u=s<q.length?q[s]:0;if(g[s]<u)break b;if(g[s]>u)break c}r++;k.mant[l]=r;l++;g[0]=0;break a}while(0);s=g[0]}else s=10*g[0],1<m&&(s+=g[1]);s=v(10*s,t);0==s&&(s=1);r+=s;g=this.byteaddsub(g,m,q,p,-s,
+!0);if(0!=g[0])continue b;u=m-2;s=0;c:for(;s<=u;s++){if(0!=g[s])break c;m--}if(0==s)continue b;this.arraycopy(g,s,g,0,m)}if(0!=l||0!=r){k.mant[l]=r;l++;if(l==n+1)break a;if(0==g[0])break a}if(0<=d&&-k.exp>d)break a;if("D"!=a&&0>=k.exp)break a;k.exp-=1;p--}0==l&&(l=1);if("I"==a||"R"==a){if(l+k.exp>n)throw"dodivide(): Integer overflow";if("R"==a){do{if(0==k.mant[0])return this.clone(e).finish(c,!1);if(0==g[0])return this.ZERO;k.ind=e.ind;n=n+n+1-e.mant.length;k.exp=k.exp-n+e.exp;n=m;s=n-1;b:for(;1<=
+s&&k.exp<e.exp&&k.exp<b.exp;s--){if(0!=g[s])break b;n--;k.exp+=1}n<g.length&&(e=Array(n),this.arraycopy(g,0,e,0,n),g=e);k.mant=g;return k.finish(c,!1)}while(0)}}else 0!=g[0]&&(e=k.mant[l-1],0==e%5&&(k.mant[l-1]=e+1));if(0<=d)return l!=k.mant.length&&(k.exp-=k.mant.length-l),e=k.mant.length-(-k.exp-d),k.round(e,c.roundingMode),k.exp!=-d&&(k.mant=this.extend(k.mant,k.mant.length+1),k.exp-=1),k.finish(c,!0);if(l==k.mant.length)k.round(c);else{if(0==k.mant[0])return this.ZERO;e=Array(l);this.arraycopy(k.mant,
+0,e,0,l);k.mant=e}return k.finish(c,!0)};f.prototype.bad=function(a,b){throw a+"Not a number: "+b;};f.prototype.badarg=function(a,b,c){throw"Bad argument "+b+" to "+a+": "+c;};f.prototype.extend=function(a,b){var c;if(a.length==b)return a;c=r(b);this.arraycopy(a,0,c,0,a.length);return c};f.prototype.byteaddsub=function(a,b,c,d,e,f){var g,h,l,m,q,p,r=0;g=p=0;g=a.length;h=c.length;b-=1;m=l=d-1;m<b&&(m=b);d=null;f&&m+1==g&&(d=a);null==d&&(d=this.createArrayWithZeros(m+1));q=!1;1==e?q=!0:-1==e&&(q=!0);
+p=0;r=m;a:for(;0<=r;r--){0<=b&&(b<g&&(p+=a[b]),b--);0<=l&&(l<h&&(p=q?0<e?p+c[l]:p-c[l]:p+c[l]*e),l--);if(10>p&&0<=p){do{d[r]=p;p=0;continue a}while(0)}p+=90;d[r]=this.bytedig[p];p=this.bytecar[p]}if(0==p)return d;c=null;f&&m+2==a.length&&(c=a);null==c&&(c=Array(m+2));c[0]=p;a=m+1;g=0;for(;0<a;a--,g++)c[g+1]=d[g];return c};f.prototype.diginit=y;f.prototype.clone=function(a){var b;b=new f;b.ind=a.ind;b.exp=a.exp;b.form=a.form;b.mant=a.mant;return b};f.prototype.checkdigits=function(a,b){if(0!=b){if(this.mant.length>
+b&&!this.allzero(this.mant,b))throw"Too many digits: "+this.toString();if(null!=a&&a.mant.length>b&&!this.allzero(a.mant,b))throw"Too many digits: "+a.toString();}};f.prototype.round=x;f.prototype.allzero=function(a,b){var c=0;0>b&&(b=0);var d=a.length-1,c=b;for(;c<=d;c++)if(0!=a[c])return!1;return!0};f.prototype.finish=function(a,b){var c=0,d=0,e=null,c=d=0;0!=a.digits&&this.mant.length>a.digits&&this.round(a);if(b&&a.form!=h.prototype.PLAIN){c=this.mant.length;d=c-1;a:for(;1<=d;d--){if(0!=this.mant[d])break a;
+c--;this.exp++}c<this.mant.length&&(e=Array(c),this.arraycopy(this.mant,0,e,0,c),this.mant=e)}this.form=h.prototype.PLAIN;c=this.mant.length;d=0;for(;0<c;c--,d++)if(0!=this.mant[d]){0<d&&(e=Array(this.mant.length-d),this.arraycopy(this.mant,d,e,0,this.mant.length-d),this.mant=e);d=this.exp+this.mant.length;if(0<d){if(d>a.digits&&0!=a.digits&&(this.form=a.form),d-1<=this.MaxExp)return this}else-5>d&&(this.form=a.form);d--;if(d<this.MinExp||d>this.MaxExp){b:do{if(this.form==h.prototype.ENGINEERING&&
+(c=d%3,0>c&&(c=3+c),d-=c,d>=this.MinExp&&d<=this.MaxExp))break b;throw"finish(): Exponent Overflow: "+d;}while(0)}return this}this.ind=this.iszero;if(a.form!=h.prototype.PLAIN)this.exp=0;else if(0<this.exp)this.exp=0;else if(this.exp<this.MinExp)throw"finish(): Exponent Overflow: "+this.exp;this.mant=this.ZERO.mant;return this};f.prototype.isGreaterThan=function(a){return 0<this.compareTo(a)};f.prototype.isLessThan=function(a){return 0>this.compareTo(a)};f.prototype.isGreaterThanOrEqualTo=function(a){return 0<=
+this.compareTo(a)};f.prototype.isLessThanOrEqualTo=function(a){return 0>=this.compareTo(a)};f.prototype.isPositive=function(){return 0<this.compareTo(f.prototype.ZERO)};f.prototype.isNegative=function(){return 0>this.compareTo(f.prototype.ZERO)};f.prototype.isZero=function(){return 0===this.compareTo(f.prototype.ZERO)};f.ROUND_CEILING=f.prototype.ROUND_CEILING=h.prototype.ROUND_CEILING;f.ROUND_DOWN=f.prototype.ROUND_DOWN=h.prototype.ROUND_DOWN;f.ROUND_FLOOR=f.prototype.ROUND_FLOOR=h.prototype.ROUND_FLOOR;
+f.ROUND_HALF_DOWN=f.prototype.ROUND_HALF_DOWN=h.prototype.ROUND_HALF_DOWN;f.ROUND_HALF_EVEN=f.prototype.ROUND_HALF_EVEN=h.prototype.ROUND_HALF_EVEN;f.ROUND_HALF_UP=f.prototype.ROUND_HALF_UP=h.prototype.ROUND_HALF_UP;f.ROUND_UNNECESSARY=f.prototype.ROUND_UNNECESSARY=h.prototype.ROUND_UNNECESSARY;f.ROUND_UP=f.prototype.ROUND_UP=h.prototype.ROUND_UP;f.prototype.ispos=1;f.prototype.iszero=0;f.prototype.isneg=-1;f.prototype.MinExp=-999999999;f.prototype.MaxExp=999999999;f.prototype.MinArg=-999999999;f.prototype.MaxArg=
+999999999;f.prototype.plainMC=new h(0,h.prototype.PLAIN);f.prototype.bytecar=Array(190);f.prototype.bytedig=y();f.ZERO=f.prototype.ZERO=new f("0");f.ONE=f.prototype.ONE=new f("1");f.TEN=f.prototype.TEN=new f("10");return f}(y);"function"===typeof define&&null!=define.amd?define({BigDecimal:L,MathContext:y}):"object"===typeof this&&(this.BigDecimal=L,this.MathContext=y)}).call(this);
diff -pruN 1.3.0+dfsg-1/perf/lib/bigdecimal_ICU4J/LICENCE.txt 8.0.2+ds-1/perf/lib/bigdecimal_ICU4J/LICENCE.txt
--- 1.3.0+dfsg-1/perf/lib/bigdecimal_ICU4J/LICENCE.txt	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/perf/lib/bigdecimal_ICU4J/LICENCE.txt	2019-01-13 22:17:07.000000000 +0000
@@ -0,0 +1,30 @@
+Copyright (c) 2012 Daniel Trebbien and other contributors
+Portions Copyright (c) 2003 STZ-IDA and PTV AG, Karlsruhe, Germany
+Portions Copyright (c) 1995-2001 International Business Machines Corporation and others
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder.
+
+
+
+ICU4J license - ICU4J 1.3.1 and later
+COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 1995-2001 International Business Machines Corporation and others 
+
+All rights reserved. 
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation. 
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+
+Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder. 
+
+
+--------------------------------------------------------------------------------
+All trademarks and registered trademarks mentioned herein are the property of their respective owners. 
\ No newline at end of file
diff -pruN 1.3.0+dfsg-1/perf/README.md 8.0.2+ds-1/perf/README.md
--- 1.3.0+dfsg-1/perf/README.md	1970-01-01 00:00:00.000000000 +0000
+++ 8.0.2+ds-1/perf/README.md	2019-01-13 22:17:07.000000000 +0000
@@ -0,0 +1,48 @@
+This directory contains two command-line applications *bigtime.js*  and *bigtime-OOM.js*, and for the browser *bignumber-vs-bigdecimal.html*, which enable some of the methods of bignumber.js to be tested against the JavaScript translations of the two versions of BigDecimal in the *lib* directory.
+
+* GWT: java.math.BigDecimal
+<https://github.com/iriscouch/bigdecimal.js>
+* ICU4J: com.ibm.icu.math.BigDecimal
+<https://github.com/dtrebbien/BigDecimal.js>
+
+The BigDecimal in Node's npm registry is the GWT version. It has some bugs: see the Node script *perf/lib/bigdecimal_GWT/bugs.js* for examples of flaws in its *remainder*, *divide* and *compareTo* methods.
+
+An example of using *bigtime.js* to compare the time taken by the bignumber.js `plus` method and the GWT BigDecimal `add` method:  
+
+    $ node bigtime plus 10000 40
+
+This will time 10000 calls to each, using operands of up to 40 random digits and will check that the results match.
+
+For help:
+
+    $ node bigtime -h
+
+*bigtime-OOM.js* works in the same way, but includes separate timings for object creation and method calls.
+
+In general, *bigtime.js* is recommended over *bigtime-OOM.js*, which may run out of memory.
+
+The usage of *bignumber-vs-bigdecimal.html* should be more or less self-explanatory.
+
+---
+
+###### Further notes:
+
+###### bigtime.js
+
+  * Creates random numbers and BigNumber and BigDecimal objects in batches.
+  * Unlikely to run out of memory.
+  * Doesn't show separate times for object creation and method calls.
+  * Tests methods with one or two operands (i.e. includes abs and negate).
+  * Doesn't indicate random number creation completion.
+  * Doesn't calculate average number of digits of operands.
+  * Creates random numbers in exponential notation.
+
+###### bigtime-OOM.js
+
+  * Creates random numbers and BigNumber and BigDecimal objects all in one go.
+  * May run out of memory, e.g. if iterations > 500000 and random digits > 40.
+  * Shows separate times for object creation and method calls.
+  * Only tests methods with two operands (i.e. no abs or negate).
+  * Indicates random number creation completion.
+  * Calculates average number of digits of operands.
+  * Creates random numbers in normal notation.
diff -pruN 1.3.0+dfsg-1/README.md 8.0.2+ds-1/README.md
--- 1.3.0+dfsg-1/README.md	2013-11-08 16:56:48.000000000 +0000
+++ 8.0.2+ds-1/README.md	2019-01-13 22:17:07.000000000 +0000
@@ -1,233 +1,274 @@
+![bignumber.js](https://raw.githubusercontent.com/MikeMcl/bignumber.js/gh-pages/bignumberjs.png)
 
-# bignumber.js #
+A JavaScript library for arbitrary-precision decimal and non-decimal arithmetic.
+
+[![Build Status](https://travis-ci.org/MikeMcl/bignumber.js.svg)](https://travis-ci.org/MikeMcl/bignumber.js)
+
+<br />
 
-A JavaScript library for arbitrary-precision decimal and non-decimal arithmetic.  
-     
 ## Features
 
-  - Faster, smaller, and perhaps easier to use than JavaScript versions of Java's BigDecimal
-  - 5 KB minified and gzipped
+  - Integers and decimals
   - Simple API but full-featured
-  - Works with numbers with or without fraction digits in bases from 2 to 64 inclusive
+  - Faster, smaller, and perhaps easier to use than JavaScript versions of Java's BigDecimal
+  - 8 KB minified and gzipped
   - Replicates the `toExponential`, `toFixed`, `toPrecision` and `toString` methods of JavaScript's Number type
   - Includes a `toFraction` and a correctly-rounded `squareRoot` method
-  - Stores values in an accessible decimal floating point format
+  - Supports cryptographically-secure pseudo-random number generation
   - No dependencies
-  - Comprehensive [documentation](http://mikemcl.github.io/bignumber.js/) and test set 
-
-If an even smaller and simpler library is required see [big.js](https://github.com/MikeMcl/big.js/).   
-It's half the size but only works with decimal numbers and only has half the methods.   
-It also does not allow `NaN` or `Infinity`, or have the configuration options of this library. 
-
-## Load
+  - Wide platform compatibility: uses JavaScript 1.5 (ECMAScript 3) features only
+  - Comprehensive [documentation](http://mikemcl.github.io/bignumber.js/) and test set
 
-The library is the single JavaScript file *bignumber.js* (or minified, *bignumber.min.js*).   
+![API](https://raw.githubusercontent.com/MikeMcl/bignumber.js/gh-pages/API.png)
 
-It can be loaded via a script tag in an HTML document for the browser
+If a smaller and simpler library is required see [big.js](https://github.com/MikeMcl/big.js/).
+It's less than half the size but only works with decimal numbers and only has half the methods.
+It also does not allow `NaN` or `Infinity`, or have the configuration options of this library.
 
-    <script src='./relative/path/to/bignumber.js'></script>
-   
-or as a CommonJS, [Node.js](http://nodejs.org) or AMD module using `require`. 
+See also [decimal.js](https://github.com/MikeMcl/decimal.js/), which among other things adds support for non-integer powers, and performs all operations to a specified number of significant digits.
 
-For Node, put the *bignumber.js* file into the same directory as the file that is requiring it and use
+## Load
 
-    var BigNumber = require('./bignumber'); 
+The library is the single JavaScript file *bignumber.js* (or minified, *bignumber.min.js*).
 
-or put it in a *node_modules* directory within the directory and use `require('bignumber')`. 
+Browser:
 
-The library is also available from the [npm](https://npmjs.org/) registry, so
+```html
+<script src='path/to/bignumber.js'></script>
+```
 
-    $ npm install bignumber.js
+[Node.js](http://nodejs.org):
 
-will install this entire directory in a *node_modules* directory within the current directory.  
- 
-To load with AMD loader libraries such as [requireJS](http://requirejs.org/):
+```bash
+$ npm install bignumber.js
+```
 
-    require(['bignumber'], function(BigNumber) {  
-        // Use BigNumber here in local scope. No global BigNumber. 
-    });
+```javascript
+const BigNumber = require('bignumber.js');
+```
 
-## Use
+ES6 module:
 
-*In all examples below, `var`, semicolons and `toString` calls are not shown.    
-If a commented-out value is in quotes it means `toString` has been called on the preceding expression.*
+```javascript
+import BigNumber from "./bignumber.mjs"
+```
 
-The library exports a single function: BigNumber, the constructor of BigNumber instances.    
-It accepts a value of type Number *(up to 15 significant digits only)*, String or BigNumber Object,   
+AMD loader libraries such as [requireJS](http://requirejs.org/):
 
-    x = new BigNumber(123.4567)
-    y = BigNumber('123456.7e-3')                     // 'new' is optional
-    z = new BigNumber(x)
-    x.equals(y) && y.equals(z) && x.equals(z)        // true
+```javascript
+require(['bignumber'], function(BigNumber) {
+    // Use BigNumber here in local scope. No global BigNumber.
+});
+```
 
-and a base from 2 to 36 inclusive can be specified.
+## Use
 
-    x = new BigNumber(1011, 2)           // "11" 
-    y = new BigNumber('zz.9', 36)        // "1295.25"
-    z = x.plus(y)                        // "1306.25"
+The library exports a single constructor function, [`BigNumber`](http://mikemcl.github.io/bignumber.js/#bignumber), which accepts a value of type Number, String or BigNumber,
 
-A BigNumber is immutable in the sense that it is not changed by its methods.  
+```javascript
+let x = new BigNumber(123.4567);
+let y = BigNumber('123456.7e-3');
+let z = new BigNumber(x);
+x.isEqualTo(y) && y.isEqualTo(z) && x.isEqualTo(z);      // true
+```
 
-    0.3 - 0.1                     // 0.19999999999999998  
-    x = new BigNumber(0.3)            
-    x.minus(0.1)                  // "0.2"
-    x                             // "0.3"
+To get the string value of a BigNumber use [`toString()`](http://mikemcl.github.io/bignumber.js/#toS) or [`toFixed()`](http://mikemcl.github.io/bignumber.js/#toFix). Using `toFixed()` prevents exponential notation being returned, no matter how large or small the value.
 
-The methods that return a BigNumber can be chained.
+```javascript
+let x = new BigNumber('1111222233334444555566');
+x.toString();                       // "1.111222233334444555566e+21"
+x.toFixed();                        // "1111222233334444555566"
+```
 
-    x.dividedBy(y).plus(z).times(9).floor()
-    x.times('1.23456780123456789e+9').plus(9876.5432321).dividedBy('4444562598.111772').ceil()
+If the limited precision of Number values is not well understood, it is recommended to create BigNumbers from String values rather than Number values to avoid a potential loss of precision.
 
-Method names over 5 letters in length have a shorter alias.
+*In all further examples below, `let`, semicolons and `toString` calls are not shown. If a commented-out value is in quotes it means `toString` has been called on the preceding expression.*
 
-    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
+```javascript
+// Precision loss from using numeric literals with more than 15 significant digits.
+new BigNumber(1.0000000000000001)         // '1'
+new BigNumber(88259496234518.57)          // '88259496234518.56'
+new BigNumber(99999999999999999999)       // '100000000000000000000'
 
-Like JavaScript's Number type, there are `toExponential`, `toFixed` and `toPrecision` methods
+// Precision loss from using numeric literals outside the range of Number values.
+new BigNumber(2e+308)                     // 'Infinity'
+new BigNumber(1e-324)                     // '0'
 
-    x = new BigNumber(255.5)        
-    x.toExponential(5)              // "2.55500e+2"
-    x.toFixed(5)                    // "255.50000"
-    x.toPrecision(5)                // "255.50"
+// Precision loss from the unexpected result of arithmetic with Number values.
+new BigNumber(0.7 + 0.1)                  // '0.7999999999999999'
+```
 
- and a base can be specified for `toString`.
+When creating a BigNumber from a Number, note that a BigNumber is created from a Number's decimal `toString()` value not from its underlying binary value. If the latter is required, then pass the Number's `toString(2)` value and specify base 2.
 
-    x.toString(16)        // "ff.8"
+```javascript
+new BigNumber(Number.MAX_VALUE.toString(2), 2)
+```
 
-The maximum number of decimal places of, and the rounding mode applied to, the results of operations involving division (i.e. division, square root, base conversion, and negative power operations) is set by a configuration object passed to the `config` method of the `BigNumber` constructor.       
-The other arithmetic operations always give the exact result.
+BigNumbers can be created from values in bases from 2 to 36. See [`ALPHABET`](http://mikemcl.github.io/bignumber.js/#alphabet) to extend this range.
 
-    BigNumber.config({ DECIMAL_PLACES: 10, ROUNDING_MODE: 4 })
-    // Alternatively, BigNumber.config( 10, 4 );
+```javascript
+a = new BigNumber(1011, 2)          // "11"
+b = new BigNumber('zz.9', 36)       // "1295.25"
+c = a.plus(b)                       // "1306.25"
+```
 
-    x = new BigNumber(2);
-    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"
-
-There is a `toFraction` method with an optional *maximum denominator* argument
-
-    y = new BigNumber(355)
-    pi = y.dividedBy(113)        // "3.1415929204"
-    pi.toFraction()              // [ "7853982301", "2500000000" ]
-    pi.toFraction(1000)          // [ "355", "113" ]
-
-and `isNaN` and `isFinite` methods, as `NaN` and `Infinity` are valid `BigNumber` values.
-
-    x = new BigNumber(NaN)                                           // "NaN"
-    y = new BigNumber(Infinity)                                      // "Infinity"
-    x.isNaN() && !y.isNaN() && !x.isFinite() && !y.isFinite()        // true
+Performance is better if base 10 is NOT specified for decimal values. Only specify base 10 when it is desired that the number of decimal places of the input value be limited to the current [`DECIMAL_PLACES`](http://mikemcl.github.io/bignumber.js/#decimal-places) setting.
 
-The value of a BigNumber is stored in a decimal floating point format in terms of a coefficient, exponent and sign.
+A BigNumber is immutable in the sense that it is not changed by its methods.
 
-    x = new BigNumber(-123.456); 
-    x.c                                 // "1,2,3,4,5,6"    coefficient (i.e. significand)
-    x.e                                 // 2                exponent 
-    x.s                                 // -1               sign
+```javascript
+0.3 - 0.1                           // 0.19999999999999998
+x = new BigNumber(0.3)
+x.minus(0.1)                        // "0.2"
+x                                   // "0.3"
+```
 
-For futher information see the [API](http://mikemcl.github.io/bignumber.js/) reference from the *doc* folder.
+The methods that return a BigNumber can be chained.
 
-## Test
+```javascript
+x.dividedBy(y).plus(z).times(9)
+x.times('1.23456780123456789e+9').plus(9876.5432321).dividedBy('4444562598.111772').integerValue()
+```
+
+Some of the longer method names have a shorter alias.
+
+```javascript
+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
+```
+
+As with JavaScript's Number type, there are [`toExponential`](http://mikemcl.github.io/bignumber.js/#toE), [`toFixed`](http://mikemcl.github.io/bignumber.js/#toFix) and [`toPrecision`](http://mikemcl.github.io/bignumber.js/#toP) methods.
+
+```javascript
+x = new BigNumber(255.5)
+x.toExponential(5)                  // "2.55500e+2"
+x.toFixed(5)                        // "255.50000"
+x.toPrecision(5)                    // "255.50"
+x.toNumber()                        //  255.5
+```
+
+ A base can be specified for [`toString`](http://mikemcl.github.io/bignumber.js/#toS). Performance is better if base 10 is NOT specified, i.e. use `toString()` not `toString(10)`. Only specify base 10 when it is desired that the number of decimal places be limited to the current [`DECIMAL_PLACES`](http://mikemcl.github.io/bignumber.js/#decimal-places) setting.
+
+ ```javascript
+ x.toString(16)                     // "ff.8"
+ ```
+
+There is a [`toFormat`](http://mikemcl.github.io/bignumber.js/#toFor) method which may be useful for internationalisation.
+
+```javascript
+y = new BigNumber('1234567.898765')
+y.toFormat(2)                       // "1,234,567.90"
+```
 
-The *test* directory contains the test scripts for each method. 
+The maximum number of decimal places of the result of an operation involving division (i.e. a division, square root, base conversion or negative power operation) is set using the `set` or `config` method of the `BigNumber` constructor.
 
-The tests can be run with Node or a browser.   
+The other arithmetic operations always give the exact result.
 
-For a quick test of all the methods, from a command-line shell at the *test/* directory
+```javascript
+BigNumber.set({ DECIMAL_PLACES: 10, ROUNDING_MODE: 4 })
 
-    $ node quick-test
+x = new BigNumber(2)
+y = new BigNumber(3)
+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"
+```
+
+There is a [`toFraction`](http://mikemcl.github.io/bignumber.js/#toFr) method with an optional *maximum denominator* argument
+
+```javascript
+y = new BigNumber(355)
+pi = y.dividedBy(113)               // "3.1415929204"
+pi.toFraction()                     // [ "7853982301", "2500000000" ]
+pi.toFraction(1000)                 // [ "355", "113" ]
+```
+
+and [`isNaN`](http://mikemcl.github.io/bignumber.js/#isNaN) and [`isFinite`](http://mikemcl.github.io/bignumber.js/#isF) methods, as `NaN` and `Infinity` are valid `BigNumber` values.
+
+```javascript
+x = new BigNumber(NaN)                                           // "NaN"
+y = new BigNumber(Infinity)                                      // "Infinity"
+x.isNaN() && !y.isNaN() && !x.isFinite() && !y.isFinite()        // true
+```
 
-To test a single method in more depth, e.g.
+The value of a BigNumber is stored in a decimal floating point format in terms of a coefficient, exponent and sign.
 
-    $ node toFraction
+```javascript
+x = new BigNumber(-123.456);
+x.c                                 // [ 123, 45600000000000 ]  coefficient (i.e. significand)
+x.e                                 // 2                        exponent
+x.s                                 // -1                       sign
+```
 
-To test all the methods in more depth
+For advanced usage, multiple BigNumber constructors can be created, each with their own independent configuration.
 
-    $ node every-test
+```javascript
+// Set DECIMAL_PLACES for the original BigNumber constructor
+BigNumber.set({ DECIMAL_PLACES: 10 })
 
-For the browser, see *quick-test.html*, *single-test.html* and *every-test.html* in the *test/browser* directory.  
- 
-*bignumber-vs-number.html* enables some of the methods of bignumber.js to be compared with those of JavaScript's Number type.  
+// Create another BigNumber constructor, optionally passing in a configuration object
+BN = BigNumber.clone({ DECIMAL_PLACES: 5 })
 
-## Performance
+x = new BigNumber(1)
+y = new BN(1)
 
-The *perf* directory contains two applications and a *lib* directory containing the BigDecimal libraries used by both.   
- 
-*bignumber-vs-bigdecimal.html* tests the performance of bignumber.js against the JavaScript translations of two versions of BigDecimal, its use should be more or less self-explanatory.
-(The GWT version doesn't work in IE 6.)  
+x.div(3)                            // '0.3333333333'
+y.div(3)                            // '0.33333'
+```
 
-* GWT: java.math.BigDecimal   
-<https://github.com/iriscouch/bigdecimal.js>
-* ICU4J: com.ibm.icu.math.BigDecimal    
-<https://github.com/dtrebbien/BigDecimal.js>     
+To avoid having to call `toString` or `valueOf` on a BigNumber to get its value in the Node.js REPL or when using `console.log` use
 
-The BigDecimal in Node's npm registry is the GWT version. Despite its seeming popularity I have found it to have some serious bugs, see the Node script *perf/lib/bigdecimal_GWT/bugs.js* for examples of flaws in its *remainder*, *divide* and *compareTo* methods.   
+```javascript
+BigNumber.prototype[require('util').inspect.custom] = BigNumber.prototype.valueOf;
+```
 
-*bigtime.js* is a Node command-line application which tests the performance of bignumber.js against the GWT version of BigDecimal from the npm registry.  
+For further information see the [API](http://mikemcl.github.io/bignumber.js/) reference in the *doc* directory.
 
-For example, to compare the time taken by the bignumber.js `plus` method and the BigDecimal `add` method:  
-    
-    $ node bigtime plus 10000 40      
-    
-This will time 10000 calls to each, using operands of up to 40 random digits and will check that the results match.   
-   
-For help:
+## Test
 
-    $ node bigtime -h
+The *test/modules* directory contains the test scripts for each method.
 
-See the README in the directory for more information.
+The tests can be run with Node.js or a browser. For Node.js use
 
-## Build
+    $ npm test
 
-I.e. minify.
+or
 
-For Node, if uglify-js is installed globally ( `npm install uglify-js -g` ) then 
+    $ node test/test
 
-    uglifyjs -o ./bignumber.min.js ./bignumber.js
+To test a single method, use, for example
 
-will create *bignumber.min.js*.   
+    $ node test/methods/toFraction
 
-## Feedback
+For the browser, open *test/test.html*.
 
-Open an issue, or email  
+## Build
 
-Michael   
-<a href="mailto:M8ch88l@gmail.com">M8ch88l@gmail.com</a>
+For Node, if [uglify-js](https://github.com/mishoo/UglifyJS2) is installed
 
-Bitcoin donation to:  
-**1CauoGYrEoJFhcyxGVaiLTE6f3WCaSUjnm**  
-Thank you
+    npm install uglify-js -g
 
-## Licence
+then
 
-MIT.
+    npm run build
 
-See LICENCE.
+will create *bignumber.min.js*.
 
-## Change Log
+A source map will also be created in the root directory.
 
-####1.3.0
-* 08/11/2013 Ensure correct rounding of `sqrt` in all, rather than almost all, cases.
-* Maximum radix to 64.
+## Feedback
 
-####1.2.1
-* 17/10/2013 Sign of zero when x < 0 and x + (-x) = 0.
+Open an issue, or email
 
-####1.2.0
-* 19/9/2013 Throw Error objects for stack.
+Michael
 
-####1.1.1
-* 22/8/2013 Show original value in constructor error message.
+<a href="mailto:M8ch88l@gmail.com">M8ch88l@gmail.com</a>
 
-####1.1.0
-* 1/8/2013 Allow numbers with trailing radix point.  
+## Licence
 
-####1.0.1
-* Bugfix: error messages with incorrect method name 
+The MIT Licence.
 
-####1.0.0
-* 8/11/2012 Initial release   
+See [LICENCE](https://github.com/MikeMcl/bignumber.js/blob/master/LICENCE).
diff -pruN 1.3.0+dfsg-1/test/abs.js 8.0.2+ds-1/test/abs.js
--- 1.3.0+dfsg-1/test/abs.js	2013-11-08 16:56:48.000000000 +0000
+++ 8.0.2+ds-1/test/abs.js	1970-01-01 00:00:00.000000000 +0000
@@ -1,1080 +0,0 @@
-var count = (function abs(BigNumber) {
-    var start = +new Date(),
-        log,
-        error,
-        passed = 0,
-        total = 0;
-
-    if (typeof window === 'undefined') {
-        log = console.log;
-        error = console.error;
-    } else {
-        log = function (str) { document.body.innerHTML += str.replace('\n', '<br>') };
-        error = function (str) { document.body.innerHTML += '<div style="color: red">' +
-          str.replace('\n', '<br>') + '</div>' };
-    }
-
-    if (!BigNumber && typeof require === 'function') BigNumber = require('../bignumber');
-
-    function assert(expected, actual) {
-        total++;
-        if (expected !== actual) {
-           error('\n Test number: ' + total + ' failed');
-           error(' Expected: ' + expected);
-           error(' Actual:   ' + actual);
-           //process.exit();
-        }
-        else {
-            passed++;
-            //log('\n Expected and actual: ' + actual);
-        }
-    }
-
-    function T(expected, value){
-        assert(String(expected), new BigNumber(String(value)).abs().toString());
-    }
-
-    log('\n Testing abs...');
-
-    BigNumber.config({
-        DECIMAL_PLACES : 20,
-        ROUNDING_MODE : 4,
-        ERRORS : true,
-        RANGE : 1E9,
-        EXPONENTIAL_AT : [-7, 21]
-    });
-
-    T(1, 1);
-    T(1, -1);
-    T(0.5, '0.5');
-    T(0.5, '-0.5');
-    T(0.1, 0.1);
-    T(0.1, -0.1);
-    T(1.1, 1.1);
-    T(1.1, -1.1);
-    T(1.5, '1.5');
-    T(1.5, '-1.5');
-
-    T(0.00001, '-1e-5');
-    T(9000000000, '-9e9');
-    T(123456.7891011, -123456.7891011);
-    T(999.999, '-999.999');
-    T(99, 99);
-    T(1, new BigNumber(-1));
-    T(0.001, new BigNumber(0.001));
-    T(0.001, new BigNumber('-0.001'));
-
-    T('Infinity', Infinity);
-    T('Infinity', -Infinity);
-    T(NaN, NaN);
-    T(NaN, -NaN);
-    T(0, 0);
-    T(0, -0);
-
-    var minusZero = 1 / (-1 / 0);
-
-    function isMinusZero(n) {
-        return n.toString() === '0' && n.s == -1;
-    }
-
-    T(0, 0);
-    T(0, -0);
-    T(0, minusZero);
-
-    assert(true, isMinusZero(new BigNumber('-0')));
-    assert(true, isMinusZero(new BigNumber(minusZero)));
-    assert(false, isMinusZero(new BigNumber(-0).abs()));
-    assert(false, isMinusZero(new BigNumber(minusZero).abs()));
-    assert(true, !isMinusZero(new BigNumber('-0').abs()));
-    assert(true, !isMinusZero(new BigNumber(minusZero).abs()));
-
-    BigNumber.config({EXPONENTIAL_AT : 100});
-
-    T(Number.MIN_VALUE, Number.MIN_VALUE);
-    T(Number.MIN_VALUE, -Number.MIN_VALUE);
-    T(Number.MAX_VALUE, Number.MAX_VALUE);
-    T(Number.MAX_VALUE, -Number.MAX_VALUE);
-
-    var two_30 = 1 << 30;
-
-    T(two_30, two_30);
-    T(two_30, -two_30);
-
-    T(two_30 + 1, two_30 + 1);
-    T(two_30 + 1, -two_30 - 1);
-
-    T(two_30 - 1, two_30 - 1);
-    T(two_30 - 1, -two_30 + 1);
-
-    var two_31 = 2 * two_30;
-
-    T(two_31, two_31);
-    T(two_31, -two_31);
-
-    T(two_31 + 1, two_31 + 1);
-    T(two_31 + 1, -two_31 - 1);
-
-    T(two_31 - 1, two_31 - 1);
-    T(two_31 - 1, -two_31 + 1);
-
-    BigNumber.config({ EXPONENTIAL_AT : [-7, 21] });
-
-    T(NaN, 'NaN');
-    T('0', '0');
-    T('1', '-1');
-    T('11.121', '11.121');
-    T('0.023842', '-0.023842');
-    T('1.19', '-1.19');
-    T('9.622e-11', '-0.00000000009622');
-    T('5.09e-10', '-0.000000000509');
-    T('3838.2', '3838.2');
-    T('127', '127.0');
-    T('4.23073', '4.23073');
-    T('2.5469', '-2.5469');
-    T('29949', '-29949');
-    T('277.1', '-277.10');
-    T('4.97898e-15', '-0.00000000000000497898');
-    T('53.456', '53.456');
-    T('100564', '-100564');
-    T('12431.9', '-12431.9');
-    T('97633.7', '-97633.7');
-    T('220', '220');
-    T('188.67', '-188.67');
-    T('35', '-35');
-    T('2.6', '-2.6');
-    T('2.2e-19', '-0.000000000000000000220');
-    T('1.469', '-1.469');
-    T('150.7', '-150.7');
-    T('74', '-74');
-    T('3.52e-9', '-0.00000000352');
-    T('2221.7', '-2221.7');
-    T('0.000004211', '-0.000004211');
-    T('1', '-1');
-    T('5.886', '-5.886');
-    T('16', '16');
-    T('4.4493e-9', '0.0000000044493');
-    T('47.6', '47.6');
-    T('1.6', '-1.60');
-    T('1', '-1');
-    T('1.5', '-1.5');
-    T('5', '-5');
-    T('1', '-1');
-    T('8027', '8027');
-    T('6.36e-16', '-0.000000000000000636');
-    T('3.87766', '3.87766');
-    T('7.4', '-7.4');
-    T('4.449', '-4.449');
-    T('5.2218e-19', '-0.000000000000000000522180');
-    T('1.3769e-11', '-0.000000000013769');
-    T('7.898e-13', '-0.0000000000007898');
-    T('522.9', '-522.9');
-    T('16.1', '-16.1');
-    T('2.15', '2.15');
-    T('4.3', '4.3');
-    T('3', '-3');
-    T('2.8', '-2.8');
-    T('1', '-1');
-    T('0.0000128696', '-0.0000128696');
-    T('13.33', '-13.33');
-    T('0.00000132177', '-0.00000132177');
-    T('1.41516', '-1.41516');
-    T('180.4', '-180.4');
-    T('115079', '-115079');
-    T('959', '959');
-    T('714.4', '714.4');
-    T('1.4544', '1.4544');
-    T('53.691', '53.691');
-    T('2.03832e-12', '-0.00000000000203832');
-    T('1', '-1');
-    T('10.8', '10.8');
-    T('6189.2', '-6189.2');
-    T('6.30866', '6.30866');
-    T('62306', '62306');
-    T('4', '-4.0');
-    T('997.1', '-997.1');
-    T('27.4', '-27.40');
-    T('9242', '9242');
-    T('31.1', '-31.1');
-    T('23.4', '23.4');
-    T('451818', '-451818');
-    T('7', '-7');
-    T('1.9', '-1.9');
-    T('2', '-2');
-    T('112.983', '-112.983');
-    T('9.36e-8', '-0.0000000936');
-    T('12.8515', '12.8515');
-    T('73.1', '-73.1');
-    T('18.15', '18.150');
-    T('11997.8', '11997.8');
-    T('23.1', '-23.1');
-    T('82.022', '-82.022');
-    T('3.916e-20', '-0.00000000000000000003916');
-    T('3.3', '-3.3');
-    T('892.1', '-892.1');
-    T('24.4', '24.4');
-    T('72', '72.0');
-    T('0.0013346', '0.0013346');
-    T('10.4', '-10.4');
-    T('367.5', '367.5');
-    T('7', '-7');
-    T('127.195', '127.195');
-    T('7.89e-13', '-0.000000000000789');
-    T('63', '-63');
-    T('85821.2', '-85821.2');
-    T('95.6', '95.6');
-    T('8.9e-14', '-0.000000000000089');
-    T('112.1', '-112.1');
-    T('3.68', '-3.68');
-    T('9', '-9');
-    T('0.0000975', '-0.0000975');
-    T('393.6', '-393.6');
-    T('7.4', '-7.4');
-    T('69.62', '-69.62');
-    T('5201.3', '5201.3');
-    T('163', '163');
-    T('4.30732', '4.30732');
-    T('224.49', '-224.49');
-    T('319.8', '-319.8');
-    T('88.1', '-88.1');
-    T('2.7762e-8', '0.000000027762');
-    T('2.043e-7', '-0.0000002043');
-    T('75459.3', '-75459.3');
-    T('0.178', '0.178');
-    T('0.00001633', '0.00001633');
-    T('955', '955');
-    T('373898', '-373898');
-    T('9780.1', '9780.1');
-    T('503.47', '503.47');
-    T('3.44562', '-3.44562');
-    T('1.6', '-1.6');
-    T('1.22442', '-1.22442');
-    T('1.4', '1.4');
-    T('1219.1', '-1219.1');
-    T('2.7', '-2.7');
-    T('1057', '-1057');
-    T('1938', '1938');
-    T('1.1983', '1.1983');
-    T('0.0012', '-0.0012');
-    T('95.713', '-95.713');
-    T('2', '-2');
-    T('17.24', '-17.24');
-    T('10.3', '-10.3');
-    T('1', '-1');
-    T('65.8', '-65.8');
-    T('2.9', '2.9');
-    T('54149', '54149');
-    T('8', '-8');
-    T('1', '1.0');
-    T('4', '-4');
-    T('6.3', '-6.3');
-    T('5.25e-9', '0.00000000525');
-    T('52.3', '-52.3');
-    T('75290', '-75290');
-    T('5.9', '-5.9');
-    T('13.7', '13.7');
-    T('2.3982e-9', '0.0000000023982');
-    T('91.5', '-91.50');
-    T('2072.39', '2072.39');
-    T('385.6', '385.6');
-    T('4.77', '4.77');
-    T('18.72', '18.720');
-    T('2817', '-2817');
-    T('44535', '-44535');
-    T('655', '655');
-    T('2e-15', '-0.0000000000000020');
-    T('0.625', '0.6250');
-    T('2', '-2');
-    T('5.315', '5.315');
-    T('70.9', '70.90');
-    T('6.4', '6.4');
-    T('1824', '1824');
-    T('52.595', '52.595');
-    T('3662', '3662.0');
-    T('3.1', '3.1');
-    T('1.05032e-7', '0.000000105032');
-    T('997.063', '-997.063');
-    T('41746', '-41746');
-    T('24.0402', '24.0402');
-    T('0.009135', '0.009135');
-    T('2.34e-9', '-0.00000000234');
-    T('13.1', '13.1');
-    T('228.8', '228.8');
-    T('565.85', '565.85');
-    T('4e-20', '0.000000000000000000040');
-    T('1.73', '1.73');
-    T('38.9', '38.9');
-    T('1.02e-14', '-0.0000000000000102');
-    T('302.8', '-302.8');
-    T('7', '-7');
-    T('1', '-1');
-    T('0.00247', '0.00247');
-    T('2', '-2');
-    T('3.26', '-3.26');
-    T('8.8', '8.8');
-    T('90.6', '90.6');
-    T('8.3053e-17', '-0.000000000000000083053');
-    T('2.5', '-2.5');
-    T('376.2', '-376.2');
-    T('1.29', '1.29');
-    T('1.379', '-1.379');
-    T('40921.5', '-40921.5');
-    T('1', '-1');
-    T('12.5', '12.5');
-    T('10.1', '10.1');
-    T('1', '-1');
-    T('226636', '226636');
-    T('1', '-1');
-    T('1.7', '-1.7');
-    T('31.31', '31.31');
-    T('79.9', '-79.9');
-    T('4.027e-13', '0.0000000000004027');
-    T('43.838', '43.838');
-    T('6.47', '-6.47');
-    T('5.292e-19', '0.0000000000000000005292');
-    T('4.6', '-4.6');
-    T('15918', '-15918.0');
-    T('239.45', '239.45');
-    T('1.02', '-1.02');
-    T('14101', '-14101');
-    T('7', '-7');
-    T('367.34', '367.34');
-    T('5', '-5');
-    T('19.9', '-19.9');
-    T('269.45', '-269.45');
-    T('10.34', '-10.34');
-    T('3.32882e-12', '-0.00000000000332882');
-    T('5.9', '5.9');
-    T('9', '-9.0');
-    T('1.3597', '-1.3597');
-    T('8', '8.0');
-    T('1', '1.0');
-    T('312.5', '312.5');
-    T('1.554', '-1.554');
-    T('210.985', '-210.985');
-    T('1', '-1');
-    T('1.24', '-1.24');
-    T('513865', '-513865');
-    T('6748', '-6748');
-    T('591.51', '-591.51');
-    T('2.2', '-2.2');
-    T('19.5495', '19.5495');
-    T('3.3', '3.3');
-    T('30', '-30');
-    T('94', '-94');
-    T('217.55', '217.55');
-    T('2', '-2');
-    T('99', '99');
-    T('4.067', '-4.067');
-    T('702.57', '702.57');
-    T('3.7', '-3.70');
-    T('4', '4.0');
-    T('192944', '192944');
-    T('0.000022', '0.000022');
-    T('47.6', '47.60');
-    T('0.391', '0.3910');
-    T('35', '-35');
-    T('100', '-100');
-    T('3.3', '-3.3');
-    T('32.432', '32.432');
-    T('1.07849e-18', '0.00000000000000000107849');
-    T('2', '-2.0');
-    T('23.27', '23.27');
-    T('4.054e-15', '-0.000000000000004054');
-    T('7.6', '-7.6');
-    T('1305', '1305');
-    T('1.501', '-1.501');
-    T('3.4', '3.4');
-    T('22.5', '-22.5');
-    T('1.0916', '1.0916');
-    T('2', '-2');
-    T('58.271', '58.271');
-    T('1.73e-12', '0.00000000000173');
-    T('1.3458e-15', '0.0000000000000013458');
-    T('309.87', '-309.87');
-    T('5.318', '-5.318');
-    T('1.5302e-8', '0.000000015302');
-    T('596765', '596765');
-    T('54.42', '-54.42');
-    T('6.549e-20', '0.00000000000000000006549');
-    T('29', '29');
-    T('46.025', '46.025');
-    T('2556.78', '-2556.78');
-    T('0.00287721', '0.00287721');
-    T('1.63', '-1.63');
-    T('0.00041', '0.00041');
-    T('698', '698');
-    T('134.4', '134.4');
-    T('2.1', '2.1');
-    T('2.07', '-2.07');
-    T('122.869', '122.869');
-    T('0.00017', '-0.00017');
-    T('18.6', '18.6');
-    T('7', '-7');
-    T('0.0180557', '0.0180557');
-    T('5', '-5');
-    T('6.2', '-6.2');
-    T('8', '-8');
-    T('450.96', '-450.96');
-    T('20.2', '-20.2');
-    T('176.52', '176.52');
-    T('0.00017', '-0.000170');
-    T('5', '-5');
-    T('1', '-1');
-    T('1.37856e-14', '0.0000000000000137856');
-    T('76.3048', '76.3048');
-    T('1803.7', '-1803.7');
-    T('74', '74');
-    T('1.7e-12', '0.0000000000017');
-    T('48.7', '-48.7');
-    T('4.48', '-4.48');
-    T('1.4', '-1.4');
-    T('7.69', '-7.69');
-    T('23.5987', '23.5987');
-    T('3074', '3074.0');
-    T('8.06e-15', '-0.00000000000000806');
-    T('21.3757', '-21.3757');
-    T('35', '35');
-    T('11.056', '11.0560');
-    T('3.36e-14', '-0.0000000000000336');
-    T('49139.4', '-49139.4');
-    T('32.654', '-32.654');
-    T('34035.4', '34035.4');
-    T('15.22', '15.22');
-    T('62', '62.0');
-    T('8.89156', '-8.89156');
-    T('14', '14');
-    T('0.006', '-0.0060');
-    T('1.5', '1.5');
-    T('7', '-7');
-    T('1.6e-11', '0.000000000016');
-    T('26.6427', '26.6427');
-    T('1.5e-18', '-0.0000000000000000015');
-    T('1.52838e-15', '0.00000000000000152838');
-    T('119.1', '119.1');
-    T('0.004283', '0.004283');
-    T('818', '-818');
-    T('194', '194');
-    T('104.788', '-104.788');
-    T('3.74e-11', '0.0000000000374');
-    T('6.162', '-6.162');
-    T('5.19214e-18', '-0.00000000000000000519214');
-    T('1.4', '-1.4');
-    T('1.27', '-1.27');
-    T('7.83822e-12', '-0.00000000000783822');
-    T('1', '-1');
-    T('4.4', '4.4');
-    T('7.37382e-12', '0.00000000000737382');
-    T('13.618', '13.618');
-    T('1.03', '-1.03');
-    T('3.7457e-13', '0.00000000000037457');
-    T('5.2', '-5.2');
-    T('3.5', '3.5');
-    T('364', '-364');
-    T('7.336', '7.336');
-    T('1.1447e-16', '-0.00000000000000011447');
-    T('510.63', '-510.63');
-    T('5.8', '5.8');
-    T('7.8', '7.8');
-    T('2.96', '-2.96');
-    T('15.64', '-15.64');
-    T('187863', '-187863');
-    T('2.73', '-2.73');
-    T('2.671', '-2.671');
-    T('18.179', '-18.179');
-    T('855885', '855885');
-    T('4.16', '4.16');
-    T('5.722e-18', '0.000000000000000005722');
-    T('67.62', '67.62');
-    T('813.31', '813.31');
-    T('40.2', '40.20');
-    T('0.00002515', '0.00002515');
-    T('0.0196', '0.01960');
-    T('13.165', '13.165');
-    T('6.743', '-6.743');
-    T('1', '-1');
-    T('200.56', '-200.56');
-    T('1.932', '1.932');
-    T('92.9', '92.90');
-    T('16.74', '16.74');
-    T('4.5554e-7', '-0.00000045554');
-    T('2.1296e-15', '-0.0000000000000021296');
-    T('2.088', '2.088');
-    T('2577', '2577');
-    T('45.4', '-45.4');
-    T('41.3', '-41.3');
-    T('3.63', '-3.63');
-    T('1.09', '-1.09');
-    T('1', '-1');
-    T('3.7', '-3.7');
-    T('204.54', '204.54');
-    T('235.6', '235.6');
-    T('384', '-384');
-    T('0.0207', '0.02070');
-    T('680', '680');
-    T('1.09', '1.09');
-    T('109.2', '109.2');
-    T('0.00010117', '0.00010117');
-    T('13.81', '13.81');
-    T('192.3', '192.3');
-    T('1', '-1');
-    T('1.2', '1.2');
-    T('4.1', '-4.1');
-    T('2.5', '2.5');
-    T('8.4076', '-8.4076');
-    T('0.0517', '0.0517');
-    T('6.3923', '-6.3923');
-    T('506.179', '-506.179');
-    T('375886', '375886');
-    T('618858', '-618858');
-    T('8.5e-11', '0.000000000085');
-    T('6', '-6.0');
-    T('2.4', '2.40');
-    T('0.0000013', '-0.0000013');
-    T('1.064', '-1.064');
-    T('1', '-1');
-    T('4', '-4');
-    T('4.5', '-4.5');
-    T('93.6206', '93.6206');
-    T('3.07e-18', '0.00000000000000000307');
-
-    BigNumber.config({EXPONENTIAL_AT : 0});
-
-    T('5.2452468128e+1', '-5.2452468128e+1');
-    T('1.41525905257189365008396e+16', '1.41525905257189365008396e+16');
-    T('2.743068083928e+11', '2.743068083928e+11');
-    T('1.52993064722314247378724599e+26', '-1.52993064722314247378724599e+26');
-    T('3.7205576746e+10', '3.7205576746e+10');
-    T('8.680996444609343472665e+17', '8.680996444609343472665e+17');
-    T('1.254549e+3', '1.254549e+3');
-    T('6.23417196172381875892300762819e-18', '6.23417196172381875892300762819e-18');
-    T('1.31179940821919284431e+19', '1.31179940821919284431e+19');
-    T('9.7697726168e+7', '9.7697726168e+7');
-    T('2.663e-10', '-2.663e-10');
-    T('1.26574209965030360615518e+17', '-1.26574209965030360615518e+17');
-    T('1.052e+3', '1.052e+3');
-    T('4.452945872502e+6', '-4.452945872502e+6');
-    T('2.95732460816619226e+13', '2.95732460816619226e+13');
-    T('1.1923100194288654481424e+18', '-1.1923100194288654481424e+18');
-    T('8.99315449050893705e+6', '8.99315449050893705e+6');
-    T('5.200726538434486963e+8', '5.200726538434486963e+8');
-    T('1.182618278949368566264898065e+18', '1.182618278949368566264898065e+18');
-    T('3.815873266712e-20', '-3.815873266712e-20');
-    T('1.316675370382742615e+6', '-1.316675370382742615e+6');
-    T('2.1032502e+6', '-2.1032502e+6');
-    T('1.8e+1', '1.8e+1');
-    T('1.033525906631680944018544811261e-13', '1.033525906631680944018544811261e-13');
-    T('1.102361746443461856816e+14', '-1.102361746443461856816e+14');
-    T('8.595358491143959e+1', '8.595358491143959e+1');
-    T('3.6908859412618413e+9', '-3.6908859412618413e+9');
-    T('2.25907048615912944e+5', '-2.25907048615912944e+5');
-    T('1.7441871813329475518e+19', '-1.7441871813329475518e+19');
-    T('3.805493087068952925e-11', '-3.805493087068952925e-11');
-    T('3.58049465451e+9', '-3.58049465451e+9');
-    T('8.0688614291e+10', '-8.0688614291e+10');
-    T('3.337855e+4', '-3.337855e+4');
-    T('2.59977855e+8', '2.59977855e+8');
-    T('4.96353e+4', '-4.96353e+4');
-    T('7.47233581107861762e-13', '7.47233581107861762e-13');
-    T('1.73948e-2', '1.73948e-2');
-    T('5.784e-15', '5.784e-15');
-    T('4.448338479762497e-8', '4.448338479762497e-8');
-    T('3.9008023052e+8', '3.9008023052e+8');
-    T('3e+0', '3e+0');
-    T('8.61435e-9', '8.61435e-9');
-    T('4.37e+1', '-4.37e+1');
-    T('8.4034159379836e-18', '-8.4034159379836e-18');
-    T('2.002857355721079885824481e+7', '2.002857355721079885824481e+7');
-    T('7.000871862e+6', '-7.000871862e+6');
-    T('2.2902057767e+9', '2.2902057767e+9');
-    T('5.9896443375617e+8', '5.9896443375617e+8');
-    T('1.53503650707e-11', '-1.53503650707e-11');
-    T('2.0508347e+6', '2.0508347e+6');
-    T('4.789433e+2', '-4.789433e+2');
-    T('8.28161975302168665599e+11', '8.28161975302168665599e+11');
-    T('1.2518396296278445e-5', '1.2518396296278445e-5');
-    T('1.44290332e+8', '-1.44290332e+8');
-    T('4.6570237501625609051773e-12', '4.6570237501625609051773e-12');
-    T('7.8514960198282212436e+19', '7.8514960198282212436e+19');
-    T('1.6197e-20', '1.6197e-20');
-    T('6.51635176e+0', '-6.51635176e+0');
-    T('4.49618e+3', '-4.49618e+3');
-    T('1.32052259561417e-1', '-1.32052259561417e-1');
-    T('2.09089580968e-18', '2.09089580968e-18');
-    T('1.4064735615678257623873854709e-1', '1.4064735615678257623873854709e-1');
-    T('3.14172e+0', '-3.14172e+0');
-    T('1.7458792e+1', '1.7458792e+1');
-    T('9.97831655282e+11', '9.97831655282e+11');
-    T('1.94594e+1', '-1.94594e+1');
-    T('1.2174602334491e+5', '-1.2174602334491e+5');
-    T('1.12135222651239e+6', '-1.12135222651239e+6');
-    T('6.3160490484343918e-20', '6.3160490484343918e-20');
-    T('1.9238315686509393329629520842e+24', '1.9238315686509393329629520842e+24');
-    T('9.915274405618026e+11', '-9.915274405618026e+11');
-    T('2.3564687894712721487205001557e+28', '2.3564687894712721487205001557e+28');
-    T('8.127315365677288172165e+2', '8.127315365677288172165e+2');
-    T('4.93e+0', '-4.93e+0');
-    T('1.41530382e+0', '-1.41530382e+0');
-    T('4.86451432707435321820779e+19', '-4.86451432707435321820779e+19');
-    T('1.4162540859e+0', '-1.4162540859e+0');
-    T('4.646e+2', '-4.646e+2');
-    T('2.1172e-14', '-2.1172e-14');
-    T('8.69000536011392432707132752e-11', '8.69000536011392432707132752e-11');
-    T('2.52776394053478133209e+20', '2.52776394053478133209e+20');
-    T('8.500211152e+9', '8.500211152e+9');
-    T('1.36178922026634255436879e+23', '1.36178922026634255436879e+23');
-    T('4.6398705910903109e+3', '-4.6398705910903109e+3');
-    T('2.15872185740218265392874524e+18', '2.15872185740218265392874524e+18');
-    T('2.4663508855569609277266393e-3', '-2.4663508855569609277266393e-3');
-    T('5.247072789229625795e+11', '-5.247072789229625795e+11');
-    T('1.142743622516581e-15', '-1.142743622516581e-15');
-    T('3.70055552960951165e-4', '-3.70055552960951165e-4');
-    T('1.01218e+3', '1.01218e+3');
-    T('3.622286100282e+2', '3.622286100282e+2');
-    T('9.5526239814e+3', '9.5526239814e+3');
-    T('2.7619598176203983624994361644e+28', '2.7619598176203983624994361644e+28');
-    T('6.8696488497688008067537526e-6', '6.8696488497688008067537526e-6');
-    T('2.48936e+1', '2.48936e+1');
-    T('3.27658301230616e+14', '3.27658301230616e+14');
-    T('2.1887387e+0', '-2.1887387e+0');
-    T('1.4779696309033248e+16', '1.4779696309033248e+16');
-    T('1.471782313713309789663e+4', '1.471782313713309789663e+4');
-    T('2.0674554e+2', '-2.0674554e+2');
-    T('1.763392540310312024e+9', '1.763392540310312024e+9');
-    T('2.66209467493293140387227569744e+26', '-2.66209467493293140387227569744e+26');
-    T('1.4522423854706487171671160683e-16', '1.4522423854706487171671160683e-16');
-    T('5.5534571375626084341933639e-18', '-5.5534571375626084341933639e-18');
-    T('3.670610508911e-18', '-3.670610508911e-18');
-    T('1.8e+1', '1.8e+1');
-    T('4.21466540619392e+14', '-4.21466540619392e+14');
-    T('4.57881788773078611890575215e-13', '-4.57881788773078611890575215e-13');
-    T('1.14912007700989046355e+20', '1.14912007700989046355e+20');
-    T('1.10572e+0', '1.10572e+0');
-    T('5.45027073427600086838788178e+8', '5.45027073427600086838788178e+8');
-    T('5.3607527344097728e-14', '-5.3607527344097728e-14');
-    T('1.20985e+0', '1.20985e+0');
-    T('2.173758396975e+4', '-2.173758396975e+4');
-    T('1.443459545123362e+10', '1.443459545123362e+10');
-    T('8.26154936079048787963e-19', '8.26154936079048787963e-19');
-    T('1.24e+0', '-1.24e+0');
-    T('6.61e+1', '6.61e+1');
-    T('8.37241281e-15', '-8.37241281e-15');
-    T('1.4673863119972e+5', '1.4673863119972e+5');
-    T('1.052445707646628e+15', '1.052445707646628e+15');
-    T('2.770216401480935105227985046e+0', '2.770216401480935105227985046e+0');
-    T('1e-2', '-1e-2');
-    T('2.0530189404000503380382112e+7', '-2.0530189404000503380382112e+7');
-    T('7.73428930734513129e+5', '7.73428930734513129e+5');
-    T('2.969e-2', '2.969e-2');
-    T('3.355869237729311e-19', '3.355869237729311e-19');
-    T('7.585426017526e+3', '7.585426017526e+3');
-    T('1.6544419963706446557685646278e+23', '-1.6544419963706446557685646278e+23');
-    T('2.92136474375552641396809118574e-18', '2.92136474375552641396809118574e-18');
-    T('3.38424409165604660854e+4', '-3.38424409165604660854e+4');
-    T('1.173591570196350093112e+11', '-1.173591570196350093112e+11');
-    T('7.8375092064291352e+1', '-7.8375092064291352e+1');
-    T('1.88191e+3', '1.88191e+3');
-    T('4.6761e-2', '-4.6761e-2');
-    T('5.988129995539574e+10', '5.988129995539574e+10');
-    T('2.5390529009345115e+2', '2.5390529009345115e+2');
-    T('2.132229656150917182e+5', '-2.132229656150917182e+5');
-    T('1.0719725506854825717e-19', '-1.0719725506854825717e-19');
-    T('4.3681500769125575941008112847e+28', '-4.3681500769125575941008112847e+28');
-    T('1.35927075893264893848008382e-13', '-1.35927075893264893848008382e-13');
-    T('1.9240692976139e-18', '-1.9240692976139e-18');
-    T('4.49668506275546883445e+20', '4.49668506275546883445e+20');
-    T('5.19198662387790072e+9', '5.19198662387790072e+9');
-    T('1.51188431866457089e+16', '-1.51188431866457089e+16');
-    T('1.4463331863500941e+12', '1.4463331863500941e+12');
-    T('1e+0', '-1e+0');
-    T('2.50029927958615945e+1', '-2.50029927958615945e+1');
-    T('1.001415164502846757e+3', '-1.001415164502846757e+3');
-    T('1.45526428e+8', '-1.45526428e+8');
-    T('5.813181844e-3', '-5.813181844e-3');
-    T('2.4481022856740302965057941113e+10', '2.4481022856740302965057941113e+10');
-    T('5.55e+1', '-5.55e+1');
-    T('3.36356932710712e+11', '-3.36356932710712e+11');
-    T('5.28080163e+8', '5.28080163e+8');
-    T('5.3879740593083469994135e+13', '-5.3879740593083469994135e+13');
-    T('6.6759148438881472902e+19', '-6.6759148438881472902e+19');
-    T('1.26e-20', '1.26e-20');
-    T('1.005680289388988e+10', '-1.005680289388988e+10');
-    T('1.4855958598e+0', '-1.4855958598e+0');
-    T('2.94014963598446075495453768e+24', '-2.94014963598446075495453768e+24');
-    T('5.219896118644e+12', '-5.219896118644e+12');
-    T('6.8e+0', '-6.8e+0');
-    T('5.492e-9', '-5.492e-9');
-    T('1.0038e+4', '-1.0038e+4');
-    T('2.781382585e+5', '2.781382585e+5');
-    T('3.30150670653876784e+17', '-3.30150670653876784e+17');
-    T('1.87927e+5', '-1.87927e+5');
-    T('1.4774557974305197453804758396e+16', '-1.4774557974305197453804758396e+16');
-    T('6.05644990832733182152086098e+18', '-6.05644990832733182152086098e+18');
-    T('2.78459055955765755e-14', '-2.78459055955765755e-14');
-    T('2.66385931106395122e+6', '2.66385931106395122e+6');
-    T('3.3683073647556597682246e-9', '-3.3683073647556597682246e-9');
-    T('7.081e+2', '7.081e+2');
-    T('2.73122035866217320954404e+6', '2.73122035866217320954404e+6');
-    T('1.2434001e-7', '1.2434001e-7');
-    T('1.135877627944001e+14', '1.135877627944001e+14');
-    T('5.59534951548380080886141393126e+21', '5.59534951548380080886141393126e+21');
-    T('5.7723782191795798882571e+9', '-5.7723782191795798882571e+9');
-    T('1.5162957113185485632499369443e-12', '-1.5162957113185485632499369443e-12');
-    T('4.29309951955288963780116e+6', '4.29309951955288963780116e+6');
-    T('3.9722643229317825409e+13', '3.9722643229317825409e+13');
-    T('1.011489199242414759e-17', '1.011489199242414759e-17');
-    T('1.253643670639200989056241e-19', '-1.253643670639200989056241e-19');
-    T('4.4836025129185e+8', '4.4836025129185e+8');
-    T('6.3777231879677253018091496e-20', '6.3777231879677253018091496e-20');
-    T('4.76278478201471177044e+11', '4.76278478201471177044e+11');
-    T('1.05e+2', '-1.05e+2');
-    T('8.2407974521826916377252018422e+18', '8.2407974521826916377252018422e+18');
-    T('2.00932156087e+4', '2.00932156087e+4');
-    T('1.965992456941204354956867603e-17', '-1.965992456941204354956867603e-17');
-    T('5.333218599567659131313e+2', '-5.333218599567659131313e+2');
-    T('1.286162439284e+10', '-1.286162439284e+10');
-    T('8.1336617205815143346477183e+16', '-8.1336617205815143346477183e+16');
-    T('1.762845949430042e+13', '-1.762845949430042e+13');
-    T('7.837280986421e+12', '7.837280986421e+12');
-    T('2.84048190010833793e+13', '2.84048190010833793e+13');
-    T('3.25755301782427035301e+20', '-3.25755301782427035301e+20');
-    T('2.58959421885729898387238225e+13', '2.58959421885729898387238225e+13');
-    T('1.8851093513683294449e+10', '-1.8851093513683294449e+10');
-    T('1.21916240456196024666e+20', '-1.21916240456196024666e+20');
-    T('5.840503333749926899855535241e-6', '5.840503333749926899855535241e-6');
-    T('2.998914116e+4', '2.998914116e+4');
-    T('5.97277308650934e+10', '5.97277308650934e+10');
-    T('6.56e+2', '6.56e+2');
-    T('1.56235984592541e+12', '-1.56235984592541e+12');
-    T('3.71e+1', '3.71e+1');
-    T('5.41937441824138694e+16', '-5.41937441824138694e+16');
-    T('6.116633e-5', '-6.116633e-5');
-    T('5.45e+2', '-5.45e+2');
-    T('2.9449785444e+3', '-2.9449785444e+3');
-    T('6.6706550091070638245894e+7', '-6.6706550091070638245894e+7');
-    T('1.39231027e-9', '1.39231027e-9');
-    T('7.45311483e+8', '7.45311483e+8');
-    T('7.6856950378651228179663e+18', '7.6856950378651228179663e+18');
-    T('3.094636736003620629e+8', '-3.094636736003620629e+8');
-    T('5.876896131624540495694931644e+7', '-5.876896131624540495694931644e+7');
-    T('1.10975974e+8', '-1.10975974e+8');
-    T('1.741e+0', '1.741e+0');
-    T('2.351595813466272408066e-4', '-2.351595813466272408066e-4');
-    T('1.519156959043394168562e+20', '1.519156959043394168562e+20');
-    T('1.620081571051799e+7', '1.620081571051799e+7');
-    T('7.316815038867932520586761e+23', '7.316815038867932520586761e+23');
-    T('3.094134522833396822e+0', '3.094134522833396822e+0');
-    T('1.168234556e+2', '-1.168234556e+2');
-    T('1.503324779432e+4', '1.503324779432e+4');
-    T('5.6710777e-9', '5.6710777e-9');
-    T('2.1463873346182e-6', '2.1463873346182e-6');
-    T('1.2934324795526700185311026007e+28', '-1.2934324795526700185311026007e+28');
-    T('1.237009087265757433674283664e+11', '1.237009087265757433674283664e+11');
-    T('1.226806049797304683867e-18', '1.226806049797304683867e-18');
-    T('5e+0', '-5e+0');
-    T('1.091168788407093537887970016e+15', '-1.091168788407093537887970016e+15');
-    T('3.87166413612272027e+12', '3.87166413612272027e+12');
-    T('1.411514e+5', '1.411514e+5');
-    T('1.0053454672509859631996e+22', '1.0053454672509859631996e+22');
-    T('6.9265714e+0', '6.9265714e+0');
-    T('1.04627709e+4', '1.04627709e+4');
-    T('1.74378341199e+9', '1.74378341199e+9');
-    T('8.427721739784805398864e+21', '-8.427721739784805398864e+21');
-    T('3.0433401636913618083715e-20', '3.0433401636913618083715e-20');
-    T('8.596751182989204e-17', '8.596751182989204e-17');
-    T('2.83012114501087201358049280895e-3', '2.83012114501087201358049280895e-3');
-    T('6.0621417107465763e-13', '6.0621417107465763e-13');
-    T('7.927e+0', '7.927e+0');
-    T('1.95309091153617e+6', '-1.95309091153617e+6');
-    T('3.479245772e-4', '3.479245772e-4');
-    T('9.1256366370332e-20', '-9.1256366370332e-20');
-    T('6.357737394e-19', '-6.357737394e-19');
-    T('4.016038725869e-1', '4.016038725869e-1');
-    T('2.3600611340992838105408e-2', '-2.3600611340992838105408e-2');
-    T('1.1982e+3', '1.1982e+3');
-    T('1.895744317788222501065084139e+17', '1.895744317788222501065084139e+17');
-    T('3.2450271098259184465439822499e+5', '3.2450271098259184465439822499e+5');
-    T('1.1699868235212007000965506e+25', '-1.1699868235212007000965506e+25');
-    T('7.988985662262809183538221216e+27', '-7.988985662262809183538221216e+27');
-    T('1.476540158366695285164548325e+7', '-1.476540158366695285164548325e+7');
-    T('8.8357361253e+1', '-8.8357361253e+1');
-    T('2.6019583787920961e+15', '-2.6019583787920961e+15');
-    T('2.617913486220978003463345e+24', '2.617913486220978003463345e+24');
-    T('8.22380392476331112656616e+14', '-8.22380392476331112656616e+14');
-    T('5.738943e+2', '-5.738943e+2');
-    T('1.04315155601043625824403526143e+24', '-1.04315155601043625824403526143e+24');
-    T('5.1800101324564241e-1', '-5.1800101324564241e-1');
-    T('3.5101750876959537987e-8', '3.5101750876959537987e-8');
-    T('2.1857385393e+3', '-2.1857385393e+3');
-    T('2.29674272702302434336e+13', '2.29674272702302434336e+13');
-    T('2.64606405319747e+14', '2.64606405319747e+14');
-    T('2.1888980498865372455451e+1', '-2.1888980498865372455451e+1');
-    T('1.51602e+0', '-1.51602e+0');
-    T('5.8047548e+7', '5.8047548e+7');
-    T('1.17525103769842428108679e+6', '-1.17525103769842428108679e+6');
-    T('8.47642371517851e-1', '-8.47642371517851e-1');
-    T('6.0574e+0', '-6.0574e+0');
-    T('2.59202859815854485362744156646e-3', '2.59202859815854485362744156646e-3');
-    T('1.040746238422014004691755e+15', '1.040746238422014004691755e+15');
-    T('1.7064734811115159257936e+22', '-1.7064734811115159257936e+22');
-    T('7.26051238227573319908663048e+26', '7.26051238227573319908663048e+26');
-    T('7.4795685183599759424050861e+6', '-7.4795685183599759424050861e+6');
-    T('2.9817e-16', '-2.9817e-16');
-    T('2.298907884272330951e+6', '2.298907884272330951e+6');
-    T('4.0531847e-8', '4.0531847e-8');
-    T('2.6189e+4', '-2.6189e+4');
-    T('3.911906e+3', '-3.911906e+3');
-    T('9.408498865993245868145865993e+2', '-9.408498865993245868145865993e+2');
-    T('4.05451047373376774e-7', '4.05451047373376774e-7');
-    T('2.08836709959016517e+6', '-2.08836709959016517e+6');
-    T('6.3417891663e+10', '6.3417891663e+10');
-    T('8.08596745e+9', '8.08596745e+9');
-    T('2.5865615419545921e+13', '2.5865615419545921e+13');
-    T('1.5731674925482283378868e+22', '-1.5731674925482283378868e+22');
-    T('1.19068602e+1', '-1.19068602e+1');
-    T('5.3687670881355020502668e-3', '-5.3687670881355020502668e-3');
-    T('1.2488884456407e+10', '-1.2488884456407e+10');
-    T('2.51800212e+3', '-2.51800212e+3');
-    T('3.738131519976930832896022e+24', '-3.738131519976930832896022e+24');
-    T('6e+0', '6e+0');
-    T('1.24131e+5', '-1.24131e+5');
-    T('9.22635e+3', '-9.22635e+3');
-    T('4e+0', '4e+0');
-    T('1.83e+1', '1.83e+1');
-    T('1.846025e+6', '-1.846025e+6');
-    T('1.27e+1', '1.27e+1');
-    T('2.24e+1', '2.24e+1');
-    T('2.476323257183413822109348e-18', '-2.476323257183413822109348e-18');
-    T('1.926752842e-7', '1.926752842e-7');
-    T('8.80612762892681839383e-19', '8.80612762892681839383e-19');
-    T('1.101085e+3', '-1.101085e+3');
-    T('3.4906077350467600648759e+22', '3.4906077350467600648759e+22');
-    T('1.04494855994965735236868e+23', '1.04494855994965735236868e+23');
-    T('1.58387879923230822739579e+19', '1.58387879923230822739579e+19');
-    T('4.213902971419525700930675e+19', '-4.213902971419525700930675e+19');
-    T('9.13804011600009749427632034e+0', '9.13804011600009749427632034e+0');
-    T('1.84491548817806624708211e+23', '-1.84491548817806624708211e+23');
-    T('1.948625124086563483825890385e+22', '1.948625124086563483825890385e+22');
-    T('1.3e+0', '1.3e+0');
-    T('1.32939216745e+12', '1.32939216745e+12');
-    T('7.078251628e+6', '7.078251628e+6');
-    T('1.7313022e+2', '1.7313022e+2');
-    T('3.415584872774897359156e+0', '3.415584872774897359156e+0');
-    T('5.51297107980065895009041695e+23', '5.51297107980065895009041695e+23');
-    T('2.5113503918614988744859e-15', '2.5113503918614988744859e-15');
-    T('1.630239450859331215249576367e+27', '1.630239450859331215249576367e+27');
-    T('5.4721390329589760404415744136e+18', '-5.4721390329589760404415744136e+18');
-    T('2.945751278429364126367812e-17', '2.945751278429364126367812e-17');
-    T('4.2782880893227686126997e+4', '4.2782880893227686126997e+4');
-    T('1.9847055931e+1', '-1.9847055931e+1');
-    T('2.261026e+3', '-2.261026e+3');
-    T('1.52615708575e+9', '1.52615708575e+9');
-    T('4.55553743697189921932e+5', '-4.55553743697189921932e+5');
-    T('4.222829719336993778496867e+12', '4.222829719336993778496867e+12');
-    T('4.485e+3', '4.485e+3');
-    T('5.2e+0', '-5.2e+0');
-    T('1.845091473820299081635836e+6', '1.845091473820299081635836e+6');
-    T('5.46863948617381450255744e-14', '-5.46863948617381450255744e-14');
-    T('3.0245e+4', '3.0245e+4');
-    T('1.53486267119215101935302e-6', '-1.53486267119215101935302e-6');
-    T('6.4843132478784299210571e+16', '6.4843132478784299210571e+16');
-    T('4.386363241636966071e+13', '-4.386363241636966071e+13');
-    T('7.581683508504e+6', '7.581683508504e+6');
-    T('1.09730944345409824e+16', '1.09730944345409824e+16');
-    T('3.594503e+6', '-3.594503e+6');
-    T('4.443273220375505949638436659e+1', '4.443273220375505949638436659e+1');
-    T('1.70867026016477719112e+20', '-1.70867026016477719112e+20');
-    T('1.29553439888e+11', '-1.29553439888e+11');
-    T('1.1130502308247230952431e-11', '1.1130502308247230952431e-11');
-    T('6.058565749e+10', '-6.058565749e+10');
-    T('3.87180284987679e-10', '-3.87180284987679e-10');
-    T('3.49184930268913133535e+19', '3.49184930268913133535e+19');
-    T('9e+0', '9e+0');
-    T('1.28461567447442016927071963077e-8', '-1.28461567447442016927071963077e-8');
-    T('2.72815445800161137e-19', '2.72815445800161137e-19');
-    T('5.849268583211e-4', '5.849268583211e-4');
-    T('3.19417089569942412006e+3', '-3.19417089569942412006e+3');
-    T('1.9e+1', '-1.9e+1');
-    T('3.3872886317814608310483125577e+6', '3.3872886317814608310483125577e+6');
-    T('3.99977971703789643632671956e+9', '-3.99977971703789643632671956e+9');
-    T('1.998549e-5', '1.998549e-5');
-    T('7.18512424913e-15', '7.18512424913e-15');
-    T('9.365052273317995234261e+21', '9.365052273317995234261e+21');
-    T('2.569e+3', '-2.569e+3');
-    T('9.460553674215355e+3', '-9.460553674215355e+3');
-    T('1.22541e+2', '-1.22541e+2');
-    T('2.180882957e-2', '-2.180882957e-2');
-    T('3.963983308804e-5', '3.963983308804e-5');
-    T('4.9059909584804e+11', '4.9059909584804e+11');
-    T('3.89345544e+8', '-3.89345544e+8');
-    T('3.13811755993550161609599737307e+9', '3.13811755993550161609599737307e+9');
-    T('2.1684124657298e+7', '2.1684124657298e+7');
-    T('4e+0', '4e+0');
-    T('1.89e+1', '-1.89e+1');
-    T('1.0500428125617165569673e+6', '1.0500428125617165569673e+6');
-    T('3.45971690973815432646e+9', '-3.45971690973815432646e+9');
-    T('4e+0', '-4e+0');
-    T('1.2826728638181755448600624e+4', '-1.2826728638181755448600624e+4');
-    T('5.2490288314345e+5', '5.2490288314345e+5');
-    T('8.46401e+0', '8.46401e+0');
-    T('2.15070506987596858e-9', '2.15070506987596858e-9');
-    T('1.4569180505e+5', '-1.4569180505e+5');
-    T('1.75535288191468954993283e+8', '-1.75535288191468954993283e+8');
-    T('1.83e-19', '1.83e-19');
-    T('3.77847393193912874449578e+6', '3.77847393193912874449578e+6');
-    T('2.823610210086368e+0', '2.823610210086368e+0');
-    T('3.2326e+4', '-3.2326e+4');
-    T('7.21208310236919171558e+7', '-7.21208310236919171558e+7');
-    T('2.537182162994085967e+11', '2.537182162994085967e+11');
-    T('2.4881474405e-15', '2.4881474405e-15');
-    T('6.8484737e+6', '6.8484737e+6');
-    T('8.09636762896763e+1', '8.09636762896763e+1');
-    T('1.387805e+1', '-1.387805e+1');
-    T('1.949086825141843503e-3', '-1.949086825141843503e-3');
-    T('8.22006002683570972726913386e+26', '-8.22006002683570972726913386e+26');
-    T('8.82e+1', '-8.82e+1');
-    T('9.8e+0', '-9.8e+0');
-    T('5.73018e+5', '-5.73018e+5');
-    T('2.039854296e-18', '2.039854296e-18');
-    T('3.85806698884e+2', '3.85806698884e+2');
-    T('7.761351239715879e-15', '-7.761351239715879e-15');
-    T('2.37976961448611739e-13', '2.37976961448611739e-13');
-    T('1.625694436559179391897024e-12', '-1.625694436559179391897024e-12');
-    T('2.612e+1', '-2.612e+1');
-    T('8.317023570754122191146041e+24', '8.317023570754122191146041e+24');
-    T('8.128823e-9', '8.128823e-9');
-    T('3.316888938212137e-7', '3.316888938212137e-7');
-    T('4.590734e+2', '4.590734e+2');
-    T('9.95284154681380079083087718e-7', '9.95284154681380079083087718e-7');
-    T('1.379051e-15', '1.379051e-15');
-    T('2.543347781939297185736e+21', '-2.543347781939297185736e+21');
-    T('1.41496183748704601485699e-10', '-1.41496183748704601485699e-10');
-    T('3.11665e+5', '-3.11665e+5');
-    T('6.4377728353162694052697e+1', '6.4377728353162694052697e+1');
-    T('1.36920115218557491e+17', '1.36920115218557491e+17');
-    T('1.27e+1', '-1.27e+1');
-    T('5.1e-4', '5.1e-4');
-    T('4.124e+3', '4.124e+3');
-    T('7.96e+0', '7.96e+0');
-    T('1.0109019145999979839008159507e-20', '1.0109019145999979839008159507e-20');
-    T('1.507784067070212e+12', '1.507784067070212e+12');
-    T('5.03530585620864526983697e+10', '5.03530585620864526983697e+10');
-    T('5.87771648701709094e-3', '-5.87771648701709094e-3');
-    T('2.6641175511284360931e+19', '2.6641175511284360931e+19');
-    T('3.5430949752e+3', '-3.5430949752e+3');
-    T('1.434481e+6', '1.434481e+6');
-    T('6.95e+0', '6.95e+0');
-    T('2.7922814988487634078255e+17', '2.7922814988487634078255e+17');
-    T('1e+0', '-1e+0');
-    T('1.34094272275111823704509269719e+9', '-1.34094272275111823704509269719e+9');
-    T('5.2e+0', '5.2e+0');
-    T('5.961731008805248930549e+0', '5.961731008805248930549e+0');
-    T('1.95863217313239788358925850999e+27', '1.95863217313239788358925850999e+27');
-    T('1.115927378282807678794111117e+18', '-1.115927378282807678794111117e+18');
-    T('6.6448e-6', '-6.6448e-6');
-    T('1.210298078691983e-7', '1.210298078691983e-7');
-    T('1.55022703113469956595e+8', '-1.55022703113469956595e+8');
-    T('2.519409262126392490249e+9', '-2.519409262126392490249e+9');
-    T('8.3744112435155841906e+19', '8.3744112435155841906e+19');
-    T('5.56052914013431e-4', '5.56052914013431e-4');
-    T('1.847716075495989e+13', '-1.847716075495989e+13');
-    T('5.78580529835020695846e+19', '-5.78580529835020695846e+19');
-    T('7.3177e-15', '-7.3177e-15');
-    T('5.8018949e+6', '-5.8018949e+6');
-    T('1.234850494854913982840923624126e+30', '1.234850494854913982840923624126e+30');
-    T('3.1e+0', '3.1e+0');
-    T('3.085340434810406103e+4', '3.085340434810406103e+4');
-    T('1.461332e+6', '1.461332e+6');
-    T('2.042933164181166e-9', '2.042933164181166e-9');
-    T('1.14852656434391849784404293276e-6', '1.14852656434391849784404293276e-6');
-    T('8.56930722573e-11', '8.56930722573e-11');
-    T('7.753629727831898e+11', '7.753629727831898e+11');
-    T('2.5807119689e+5', '-2.5807119689e+5');
-    T('6.5889872564e+7', '6.5889872564e+7');
-    T('6.2e+0', '6.2e+0');
-    T('7.16926024589772e+14', '-7.16926024589772e+14');
-    T('2.444762609546357e-12', '2.444762609546357e-12');
-    T('1.58017211706879e+2', '-1.58017211706879e+2');
-    T('2.74612804105217564273009e+23', '-2.74612804105217564273009e+23');
-    T('8.2105e+3', '-8.2105e+3');
-    T('6.2289747e+7', '-6.2289747e+7');
-    T('4.47847136680063365276e+21', '-4.47847136680063365276e+21');
-    T('7.599263848474204e+15', '-7.599263848474204e+15');
-    T('9.534064037670226206e-11', '-9.534064037670226206e-11');
-    T('5.3511395608925655035624181e+7', '-5.3511395608925655035624181e+7');
-    T('2.536656469414e+8', '2.536656469414e+8');
-    T('4.454301005499233196018257e+16', '-4.454301005499233196018257e+16');
-    T('2.3289800995961777747097e+10', '-2.3289800995961777747097e+10');
-    T('2.7363696755334e+6', '-2.7363696755334e+6');
-    T('2.56e+2', '2.56e+2');
-    T('7.3430201092837e+2', '7.3430201092837e+2');
-    T('1.114804e+5', '1.114804e+5');
-    T('3.1845809556698336607622e+4', '-3.1845809556698336607622e+4');
-    T('1.7780378655260403138e+19', '-1.7780378655260403138e+19');
-    T('3.608970926e-15', '3.608970926e-15');
-    T('1.949e+3', '-1.949e+3');
-    T('1.9021837e+4', '-1.9021837e+4');
-    T('1.5e+0', '1.5e+0');
-    T('3.1155266673e+10', '-3.1155266673e+10');
-    T('4e+0', '-4e+0');
-    T('9.09316542545977506e+14', '9.09316542545977506e+14');
-    T('2.15531740334146749845e+8', '2.15531740334146749845e+8');
-    T('1.5605317646e+8', '1.5605317646e+8');
-    T('3.8806066633613066e+13', '-3.8806066633613066e+13');
-    T('1.653298e+6', '1.653298e+6');
-    T('7.920024310736e-20', '7.920024310736e-20');
-    T('2.27611872e+8', '2.27611872e+8');
-    T('2.76569307109179036145271e-15', '-2.76569307109179036145271e-15');
-    T('1.425171314e+8', '1.425171314e+8');
-    T('1.3702555167748408653e+11', '-1.3702555167748408653e+11');
-    T('5.146936435e+9', '5.146936435e+9');
-    T('4.183285814905222880076696e+19', '-4.183285814905222880076696e+19');
-    T('2.270923702039578057376e-16', '2.270923702039578057376e-16');
-    T('9.4963549e-12', '9.4963549e-12');
-    T('1.453060439e-3', '1.453060439e-3');
-    T('2.97303365e+2', '2.97303365e+2');
-    T('1.16485757109e+2', '-1.16485757109e+2');
-    T('7.7984946334626919799413338378e+5', '-7.7984946334626919799413338378e+5');
-    T('1.905453e+5', '1.905453e+5');
-    T('5.36989497616503e-20', '5.36989497616503e-20');
-    T('4.3e+0', '4.3e+0');
-    T('2.70434008699476809368089518776e+25', '-2.70434008699476809368089518776e+25');
-    T('2.8813069851e+10', '2.8813069851e+10');
-    T('7e+0', '7e+0');
-    T('1.0577487e-18', '-1.0577487e-18');
-    T('6.8e+1', '6.8e+1');
-    T('1e+0', '-1e+0');
-    T('8.446803887694575079e+6', '-8.446803887694575079e+6');
-    T('2.3384835e-6', '-2.3384835e-6');
-    T('1.072e-13', '1.072e-13');
-    T('7.13295350162e-5', '7.13295350162e-5');
-    T('4.59897478609e+3', '4.59897478609e+3');
-    T('4.11875744698515118e+11', '4.11875744698515118e+11');
-    T('3.12339620225171e+5', '3.12339620225171e+5');
-    T('3.79932554e+1', '3.79932554e+1');
-    T('2.457332691061964e+4', '-2.457332691061964e+4');
-    T('3.944602320705902e+6', '-3.944602320705902e+6');
-    T('3.164305812145e+4', '-3.164305812145e+4');
-    T('7.22239735515689399e+1', '-7.22239735515689399e+1');
-    T('5.261981e+3', '-5.261981e+3');
-    T('2.3642968462845e+7', '2.3642968462845e+7');
-    T('3.9326785e+3', '-3.9326785e+3');
-    T('8.5853e-11', '-8.5853e-11');
-    T('2.60532943946e+0', '2.60532943946e+0');
-    T('3.64630216318427246476533e+18', '-3.64630216318427246476533e+18');
-    T('3.031732127749e-3', '3.031732127749e-3');
-    T('2.49298080885329502254338e-12', '-2.49298080885329502254338e-12');
-    T('8.81838341457179780743504843e+2', '-8.81838341457179780743504843e+2');
-    T('2.285650225267766689304972e+5', '2.285650225267766689304972e+5');
-    T('4.5790517211306242e+7', '4.5790517211306242e+7');
-    T('3.0033340092338313923473428e+16', '-3.0033340092338313923473428e+16');
-    T('2.83879929283797623e+1', '-2.83879929283797623e+1');
-    T('4.5266377717178121183759377414e-5', '4.5266377717178121183759377414e-5');
-    T('5.3781e+4', '-5.3781e+4');
-    T('6.722035208213298413522819127e-18', '-6.722035208213298413522819127e-18');
-    T('3.02865707828281230987116e+23', '-3.02865707828281230987116e+23');
-    T('5.5879983320336874473209567979e+28', '-5.5879983320336874473209567979e+28');
-
-    log('\n ' + passed + ' of ' + total + ' tests passed in ' + (+new Date() - start) + ' ms \n');
-    return [passed, total];;
-})(this.BigNumber);
-if (typeof module !== 'undefined' && module.exports) module.exports = count;
\ No newline at end of file
diff -pruN 1.3.0+dfsg-1/test/base-in.js 8.0.2+ds-1/test/base-in.js
--- 1.3.0+dfsg-1/test/base-in.js	2013-11-08 16:56:48.000000000 +0000
+++ 8.0.2+ds-1/test/base-in.js	1970-01-01 00:00:00.000000000 +0000
@@ -1,455 +0,0 @@
-var count = (function baseIn(BigNumber) {
-    var start = +new Date(),
-        log,
-        error,
-        undefined,
-        passed = 0,
-        total = 0;
-
-    if (typeof window === 'undefined') {
-        log = console.log;
-        error = console.error;
-    } else {
-        log = function (str) { document.body.innerHTML += str.replace('\n', '<br>') };
-        error = function (str) { document.body.innerHTML += '<div style="color: red">' +
-          str.replace('\n', '<br>') + '</div>' };
-    }
-
-    if (!BigNumber && typeof require === 'function') BigNumber = require('../bignumber');
-
-    function assert(expected, actual) {
-        total++;
-        if (expected !== actual) {
-           error('\n Test number: ' + total + ' failed');
-           error(' Expected: ' + expected);
-           error(' Actual:   ' + actual);
-           //process.exit();
-        }
-        else {
-            passed++;
-            //log('\n Expected and actual: ' + actual);
-        }
-    }
-
-    function assertException(func, message) {
-        var actual;
-        total++;
-        try {
-            func();
-        } catch (e) {
-            actual = e;
-        }
-        if (actual && actual.name == 'BigNumber Error') {
-            passed++;
-            //log('\n Expected and actual: ' + actual);
-        } else {
-            error('\n Test number: ' + total + ' failed');
-            error('\n Expected: ' + message + ' to raise a BigNumber Error.');
-            error(' Actual:   ' + (actual || 'no exception'));
-            //process.exit();
-        }
-    }
-
-    function T(expected, value, base) {
-        assert(expected, new BigNumber(value, base).toString())
-    }
-
-    log('\n Testing base-in...');
-
-    BigNumber.config({
-        DECIMAL_PLACES : 20,
-        ROUNDING_MODE : 4,
-        ERRORS : true,
-        RANGE : 1E9,
-        EXPONENTIAL_AT : 1E9
-    });
-
-    // Test integers of all bases against Number.toString(base).
-    for (var i = 2; i < 37; i++) {
-        for (var j = -100; j < 101; j++) {
-            T(j.toString(), j.toString(i), i);
-            var k = Math.floor(Math.random() * Math.pow(2, Math.floor(Math.random() * 52) + 1));
-            T(k.toString(), k.toString(i), i);
-        }
-    }
-
-    T('0', 0, 2);
-    T('0', 0, 10);
-    T('0', -0, 36);
-    T('-5', -101, 2);
-    T('-101', -101, 10);
-
-    // TEST NUMBERS WITH FRACTION DIGITS.
-
-    // Test rounding.
-    BigNumber.config({DECIMAL_PLACES : 0, ROUNDING_MODE : 0});
-    T('1', '0.1', 2);
-    T('-1', '-0.1', 2);
-    T('1000', '999.5', 10);
-    T('-1000', '-999.5', 10);
-
-    BigNumber.config({ROUNDING_MODE : 1});
-    T('0', '0.1', 2);
-    T('0', '-0.1', 2);
-    T('999', '999.5', 10);
-    T('-999', '-999.5', 10);
-
-    BigNumber.config({ROUNDING_MODE : 2});
-    T('1', '0.1', 2);
-    T('0', '-0.1', 2);
-    T('1000', '999.5', 10);
-    T('-999', '-999.5', 10);
-
-    BigNumber.config({ROUNDING_MODE : 3});
-    T('0', '0.1', 2);
-    T('-1', '-0.1', 2);
-    T('999', '999.5', 10);
-    T('-1000', '-999.5', 10);
-
-    BigNumber.config({ROUNDING_MODE : 4});
-    T('1', '0.1', 2);
-    T('-1', '-0.1', 2);
-    T('1000', '999.5', 10);
-    T('-1000', '-999.5', 10);
-
-    BigNumber.config({ROUNDING_MODE : 5});
-    T('0', '0.1', 2);
-    T('0', '-0.1', 2);
-    T('999', '999.5', 10);
-    T('-999', '-999.5', 10);
-
-    BigNumber.config({ROUNDING_MODE : 6});
-    T('0', '0.1', 2);
-    T('0', '-0.1', 2);
-    T('1000', '999.5', 10);
-    T('-1000', '-999.5', 10);
-    T('999', '999.4', 10);
-    T('-999', '-999.4', 10);
-    T('1000', '999.500001', 10);
-    T('-1000', '-999.500001', 10);
-
-    BigNumber.config({ROUNDING_MODE : 7});
-    T('1', '0.1', 2);
-    T('0', '-0.1', 2);
-    T('1000', '999.5', 10);
-    T('-999', '-999.5', 10);
-
-    BigNumber.config({ROUNDING_MODE : 8});
-    T('0', '0.1', 2);
-    T('-1', '-0.1', 2);
-    T('999', '999.5', 10);
-    T('-1000', '-999.5', 10);
-
-    BigNumber.config({DECIMAL_PLACES : 20, ROUNDING_MODE : 3});
-    T('546141272243.39871532041499605905', '111111100101000100011100111100010110011.011001100001001000110101000011011001100010111000110000101011000010100010110111100010010000011010100100001111010010100', 2);
-    T('-761392382117509615082995635394.835132598876953125', '-1001100111000011000100000100010111000100100100101110010100101000000110101101100101101101010011000010.110101011100101101000', 2);
-    T('18181', '100011100000101.00', 2);
-    T('-12.5', '-1100.10', 2);
-    T('43058907596428432974475252.68192645050244227178', '10001110011110000101000000111011011100000010011100000001111011111011101110111111110100.10101110100100101011101101011011001011110111001101', 2);
-    T('-50063197524405820261198.16624174237994681863', '-1010100110011110111001101110101001100100001000111000001111110000001101001110.001010101000111011010001100111101100000001111110011001111100001101111001', 2);
-    T('12659149135078325508.50965366452082459802', '1010111110101110010101010001000100111011000010010111110100000100.100000100111100010101001100111010110011101001011100101110', 2);
-    T('-6387062313767439324325.28595431079156696797', '-1010110100011111001001011101001100100001111011000110000100101010010100101.0100100100110100010011010011110100', 2);
-    T('1396.09066858848154879524', '10101110100.0001011100110110000011100111111001001101100', 2);
-    T('-13243297892469.48301514260489275543', '-11000000101101110010000100010000100001110101.0111101110100110111000010110000011110101111101100110', 2);
-    T('343872.5', '1010011111101000000.10', 2);
-    T('-27858197522682350277663998.90234375', '-1011100001011001100111110100111101101100011110100111111111001110111101001110011111110.111001110', 2);
-    T('11350269087477005972403595905463622183936313327592261705214528.375', '11100010000001100111100001010001011000011110001001101101000011011111011100111010110101011100111001110110111111001001000111101000100100011110011011110011001011101010001100001001111010111110010101001000000.011', 2);
-    T('-4582111067006609431937422134.8848765093534893822', '-11101100111000111011110000101010101111000001100010100011111001000111010110000001001100110110.11100010100001110100010001010100101011', 2);
-    T('517236958880385002164572266126922644', '11000111001110111000000001111111110000110111101111101110011100111000000111101011000000001100011110010000101001110010100', 2);
-    T('-21553306071707458208211095787817816237164981584743591.29723221556402690258', '-111001100110110101111011010110011000011000100110010000110101110110101011101011100001010010101000000110111100101000110100111001000111001101111100100110111001010100110010100111.01001100000101110110100100010101001010100100010100101', 2);
-
-    BigNumber.config({DECIMAL_PLACES : 20, ROUNDING_MODE : 6});
-    T('90182851032808914967166718343839124510737262515334936.05372908711433410645', '11110001000010011001110001010101001001001000011011110000101001011001110011010100000001001000011000010101101101000111110111101000001101000101100000101011100110000010111100011000.0000110111000001001100001', 2);
-    T('-328.28125', '-101001000.010010', 2);
-    T('606266547022938105478897519250152.63383591632958904971', '1110111100100001010001101110110111100101000011011110001111001011010010100111110100011000101110100101011101000.1010001001000011000100100001001110101010011100000110001', 2);
-    T('-1236693955.36249679178679391345', '-1001001101101100111001111000011.010111001100110010010110111110011010000100010011010101010111111100000101001010101', 2);
-    T('6881574.93937801730607199391', '11010010000000100100110.1111000001111011000100111110011011101001001100001101001011001010111', 2);
-    T('-341919.144535064697265625', '-1010011011110011111.0010010100000000010', 2);
-    T('97.10482025146484375', '1100001.000110101101010110000', 2);
-    T('-120914.40625', '-11101100001010010.01101', 2);
-    T('8080777260861123367657', '1101101100000111101001111111010001111010111011001010100101001001011101001', 2);
-    T('-284229731050264281.85682739554010822758', '-1111110001110010010110111100111001110110110001011011011001.11011011010110010000101001001010001010010110', 2);
-    T('1243984453515709828041525111137171813652.844970703125', '1110100111110111101011000011100001010011001110000000111100101100010010000100010000101010011101011011001000001111100011010100010100.110110000101', 2);
-    T('-4208558618976524911747722597.24609066132409893216', '-11011001100100111100111100111110001011100111101001010011111110000111001100101110110101100101.00111110111111111100110000101110001111001110111010101110000111110100111001110011010001101111001101011000001011100101111011110000001101001111000', 2);
-    T('1268683183361093666211101090.703125', '1000001100101101110000111010010111000000111000111110001110111001010100000111111100110100010.10110100', 2);
-    T('-105641.26311671037711231997', '-11001110010101001.010000110101101110011101111000100001100111001110000111000011001001001000110101110001101111001101000000111000011100001001011101111100001011101010111101100010010001110111001110101010110001101110010011', 2);
-    T('473340007892909227396827894000137.5', '1011101010110011001000000110110101100101110011110011001100111100110101100011010101000010000000010101000001001.1000', 2);
-    T('-32746.47657717438337214735', '-111111111101010.011110100000000011110110001100011111111100100101111010110001110100001011010010001011101111001100110011001010010110001000111100011100', 2);
-    T('192.49070453643798828125', '11000000.01111101100111101101000', 2);
-    T('-1379984360196.47138547711438150145', '-10100000101001101011110100100001100000100.01111000101011001011011111111000000001', 2);
-
-    BigNumber.config({DECIMAL_PLACES : 40, ROUNDING_MODE : 2});
-    T('-729.0001524157902758725803993293705227861606', '-1000000.00000001', 3);
-    T('-4096.0000152587890625', '-1000000.00000001', 4);
-    T('-15625.00000256', '-1000000.00000001', 5);
-    T('-46656.0000005953741807651272671848803536046334', '-1000000.00000001', 6);
-    T('-117649.0000001734665255574303432156634721649541', '-1000000.00000001', 7);
-    T('-262144.000000059604644775390625', '-1000000.00000001', 8);
-    T('-531441.0000000232305731254187746379102835730507', '-1000000.00000001', 9);
-    T('-1000000.00000001', '-1000000.00000001', 10);
-    T('-1771561.0000000046650738020973341431092840981941', '-1000000.00000001', 11);
-    T('-2985984.000000002325680393613778387440938881268', '-1000000.00000001', 12);
-    T('-4826809.0000000012258947398402566721524761600832', '-1000000.00000001', 13);
-    T('-7529536.0000000006776036154587122781861854381443', '-1000000.00000001', 14);
-    T('-11390625.0000000003901844231062338058222831885383', '-1000000.00000001', 15);
-    T('-16777216.00000000023283064365386962890625', '-1000000.00000001', 16);
-    T('-24137569.0000000001433536083296850401481727781882', '-1000000.00000001', 17);
-    T('-34012224.0000000000907444262711670884293370452072', '-1000000.00000001', 18);
-    T('-47045881.0000000000588804597472215429921222500439', '-1000000.00000001', 19);
-    T('-64000000.0000000000390625', '-1000000.00000001', 20);
-    T('-85766121.0000000000264390375792455941496210138949', '-1000000.00000001', 21);
-    T('-113379904.0000000000182229445394427114965206410085', '-1000000.00000001', 22);
-    T('-148035889.0000000000127696005408659110598172017909', '-1000000.00000001', 23);
-    T('-191102976.0000000000090846890375538218259411675049', '-1000000.00000001', 24);
-    T('-244140625.0000000000065536', '-1000000.00000001', 25);
-    T('-308915776.0000000000047886513275010026255956100003', '-1000000.00000001', 26);
-    T('-387420489.0000000000035407061614721497695336509027', '-1000000.00000001', 27);
-    T('-481890304.0000000000026468891228855948366647868677', '-1000000.00000001', 28);
-    T('-594823321.000000000001999014833671504164315094574', '-1000000.00000001', 29);
-    T('-729000000.0000000000015241579027587258039932937052', '-1000000.00000001', 30);
-    T('-887503681.0000000000011724827159637921277158030113', '-1000000.00000001', 31);
-    T('-1073741824.0000000000009094947017729282379150390625', '-1000000.00000001', 32);
-    T('-1291467969.0000000000007110309102419347878538765581', '-1000000.00000001', 33);
-    T('-1544804416.0000000000005599750325378321880787999147', '-1000000.00000001', 34);
-    T('-1838265625.0000000000004440743054270216786320984887', '-1000000.00000001', 35);
-    T('-2176782336.0000000000003544704151217464391770978328', '-1000000.00000001', 36);
-
-    BigNumber.config({DECIMAL_PLACES : 51, ROUNDING_MODE : 4});
-    T('1072424547177.982891327541533302850175278158817253467459228776101', 'donxvwix.zdts', 36);
-
-    BigNumber.config({DECIMAL_PLACES : 86});
-    T('824178538787196749922434027872451367594239056.93473392033316110609748881918323116875731371037529199959272159196515804304815690839727', '402kfhkd37bt5n8scr1ir9ndlrnipig.s17oe7rkhi91bh', 30);
-
-    BigNumber.config({DECIMAL_PLACES : 84});
-    T('9560389177469634483515162.499335215204179931606951906984830542647805834768203380512715304247460734647288652625', '195qdkkqsa8shmhp9e.edr89', 29);
-
-    BigNumber.config({DECIMAL_PLACES : 65});
-    T('5955289028666603391738616069969.70235175643053599414353772852590894151261634747374296179598348968', '8qp28dk3js2iqksmqaqnq.lntnif5qh', 31);
-
-    BigNumber.config({DECIMAL_PLACES : 49});
-    T('27603501710202437282037.4945845176631161140013607910579053986520224457133', '42545302442500101544532043113.254455200225412543300022520330204033', 6);
-
-    BigNumber.config({DECIMAL_PLACES : 39});
-    T('9464300204295306111422098057.77248824166891668678144149703717008528', '25473f3dbce5cf3hg8318d7.dg52d120b14ea966a7ag06a2gh03', 18);
-
-    BigNumber.config({DECIMAL_PLACES : 15});
-    T('133262758349237628352120716402.993431117739119', '3bkobquqthhfbndsmv3i.vp8o0sc4ldtji02mmgqr7blpdjgk', 32);
-
-    BigNumber.config({DECIMAL_PLACES : 65});
-    T('171510920999634527633.53051379043557196404057602235264411208736518600450525086556631034', '1fqecn4264r1is.ijur8yj41twl9', 35);
-
-    BigNumber.config({DECIMAL_PLACES : 48});
-    T('325927753012307620476767402981591827744994693483231017778102969592507', 'c16de7aa5bf90c3755ef4dea45e982b351b6e00cd25a82dcfe0646abb', 16);
-
-    BigNumber.config({DECIMAL_PLACES : 48});
-    T('72783.559378210242248003991012349918599484318629885897', '11c4f.8f33690f15e13146d99092446da', 16);
-
-    BigNumber.config({DECIMAL_PLACES : 81});
-    T('8535432796511493691316991730196733707212461.36382685871580896850891461623808', '9l0ah4mf8a0kcgn44oji4kh7l6fbenb.929jlggo43612jfn', 25);
-
-    BigNumber.config({DECIMAL_PLACES : 7});
-    T('0', '0', 2);
-    T('3', '3', 24);
-    T('0.037037', '0.1', 27);
-    T('101412023101671912143604060399016691636944374947585694881897391246499475847835837224977373985157443438754012038820105175407623679155088073411120684342336808325631625647896282357928709212286943830565579566232670291284084535962556769836340401310575784301282705195128879424575312893.9', '999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999.99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999991999999999999999999999999999999999999', 11);
-    T('15398955012055570438.9425184', 'ST87ST87ST87S.S87TS87TS87TS', 30);
-    T('2126934655697951.030303', '11111111111.1111111111111', 34);
-    T('-288494149172542947905560340081675757349.9789739', '-P98IJYP96JHYP95DPHJWPH09Y.Y98HO8WH58HW', 35);
-
-    BigNumber.config({DECIMAL_PLACES : 31});
-    T('4060090888512781039564383580983002345701981946441239.3428571428571428571428571428571', '4hv6vl92gvkmumr0a6ley0dhkwmwfe35oo.c', 35);
-
-    BigNumber.config({DECIMAL_PLACES : 90});
-    T('20398136837.975941624007641435905199481124700109083958314345873245346912136478926756110974638825468924', '5MI4K5MF.MA66B0L4HK8DK35LI3D0G9JFF7LBB27LAKH3E4FCEJM', 23);
-
-    BigNumber.config({DECIMAL_PLACES : 38});
-    T('42689628837110945219.60963984922125154547359100149049425936', 'D37AFB2193DJ265.CGHI7F1BK1I9GJ', 21);
-
-    BigNumber.config({DECIMAL_PLACES : 59});
-    T('893835640746065892983175797034880314945754459977061255725623898879842611', '4231231434203102220114420330232412332321132204022241104411014023324140104333412232222433424401214430421', 5);
-
-    BigNumber.config({DECIMAL_PLACES : 100});
-    T('175', '67', 28);
-
-    BigNumber.config({DECIMAL_PLACES : 59});
-    T('683674717563732788139425742102304147', '23BXVQVK5NK29XCNPM7JWQQC', 35);
-
-    BigNumber.config({DECIMAL_PLACES : 63});
-    T('21872738004815869.777777777777777777777777777777777777777777777777777777777777778', 'E8NB0D88AN2D.IG', 24);
-
-    BigNumber.config({DECIMAL_PLACES : 2});
-    T('4839094569478687835499021764036676797809986482983355.46', '9G041CFCPN92FSECBIHHL1F1I74FJMGAKTR.EAJ7JQ', 31);
-
-    BigNumber.config({DECIMAL_PLACES : 2});
-    T('198496092814270915085258754228681831655498041942', '24310400201333231203024322334002413400114320223240014320424444320232', 5);
-
-    BigNumber.config({DECIMAL_PLACES : 5});
-    T('7371249.07083', '93089.23M993NGABNLEP', 30);
-
-    BigNumber.config({DECIMAL_PLACES : 47});
-    T('799580158552527670.51524163982781306375625835799992154433181428013', '1C5C994CD5A7E49A.7ADE19484CE921B8EE7', 15);
-
-    BigNumber.config({DECIMAL_PLACES : 64});
-    T('16165422251964685360633312857381850497426314130782805.0722805578590765752365085976081394656988159695365026477063128458', '184254BE3B14F86L7HPKEOIIJKHCQ3DDBCPG5.20IJJ', 28);
-
-    BigNumber.config({DECIMAL_PLACES : 66});
-    T('321903599394345741344181790866033344020400577177.313819548430693134687858394581066124770210878514089611637812764975', 'GKE2D93H4K55C41EA627I1867CEFFCHBHE8I.6C85JF7D0BFDJFK4K', 21);
-
-    BigNumber.config({DECIMAL_PLACES : 38});
-    T('66906978329149775053912152738679.85034153550858840284188803538614532877', '2011110022202010100200021000121022200222101110012102220102212010111.21122122002110012111112102002110221102120102', 3);
-
-    BigNumber.config({DECIMAL_PLACES : 49});
-    T('1334535467.5658391510074236740492770511046811319813437111801', '45033235646.365040260503443445435151335014', 7);
-
-    BigNumber.config({DECIMAL_PLACES : 62});
-    T('26234523211578269977959969', 'LMDG5KNKLAUCSCNH1.0', 32);
-
-    BigNumber.config({DECIMAL_PLACES : 21});
-    T('572315667420.390625', '10250053005734.31', 8);
-
-    BigNumber.config({DECIMAL_PLACES : 0});
-    T('135378457250661080667637636173904073793598540954140', '1002012000221022001212121111002202200112011211012200211202012002222102020101100001022121022011000222110010.012011121', 3);
-    T('19121180169114878494408529193061279888621355', '30130433145052134410320001411315120554033203511455405455', 6);
-    T('121756633', '1I0JBBC.F628AF202451951181911H3HGID95I855056I', 20);
-    T('3943269', '7370130.225184', 9);
-    T('491578', '1700072.2013436326', 8);
-    T('7793119763346', '6A06CF7K7G.58CD39A32GE', 22);
-    T('7529497809730458840', '4BI52A83H0F7720.6G912C3J4I6H7HI1I41', 20);
-    T('46865454464741700656', 'BF6CDEA9FDBKKB.6G9A74QO718PHAK', 27);
-    T('304', 'F4.18180D', 20);
-    T('744', '453.61845741C18C5B7AC08A', 13);
-    T('246', '77.MS', 34);
-    T('191110529149', '2617704640174.75763527113244751520622', 8);
-    T('6', '6.8E2FCGH', 18);
-    T('11952558583', '49E4EDC8C.C86', 15);
-    T('1486467157880871503427980640713668', 'C0776B7908614278DD33549496D36.539A196725', 14);
-    T('13069', '5C43.B25BB7338', 13);
-    T('811', 'R1.6', 30);
-    T('1092443496', '1443DA51.G5FHF0121H2F', 19);
-    T('995982886869648407459143', '1HJAHK0FKDN4LN29FI.3DDG4GCBBFJGOM648JBCCCBE5', 25);
-    T('2563', '42D.9MBNBD3CHC961K4', 25);
-    T('5165465768912078514086932864', '5165465768912078514086932864.15061794310893065985169641395', 10);
-    T('5471', 'B6F.18F0HFAK', 22);
-    T('10463269570005574', '2V0X3OKD7B9.VOFRSL', 36);
-    T('303213556691515289188893743415846', '5AMIB6B7CEFJKJEL5H6CD1K5.H7996', 24);
-    T('73885536580075722710224913630', '111011101011110010101110111100111100010011001101110011011001010001110110111100101100010011011101.1111100101011011100000101001010110110010001000000010100000111100001010100111110101', 2);
-    T('72678037004728932464472011232185435761', '1J6F1EG58J959DDJ54HKBIHG6625B', 22);
-    T('7', '111.01010000111000100001000010011011000100101010011111100110111011100011000000010110001010111000011000010110011101001010', 2);
-    T('281006', '1000100100110101101.110001110000001100011001010100001110101111001100101111110011010100011110111010101000110000100010110010001011101010011000010000100001010100010100000000011010001011110101111110101101110100000000001', 2);
-    T('8573576497511403672686', '1110100001100011001000110011111111011101101000100111100001101010001101101.11100010000011111000001110011100111', 2);
-    T('40455365809845824222189300824558751', '1111100101010011010100000001111111110100101001001000000110111101001100011110001000011011101100010100100110010011110.10111100000011011111100110100101101111110001110100011100000000001111111001111100011011100011010', 2);
-    T('46275491328393338072', '101000001000110011100100100010111101100011100011011101110011010111.10011001111111100010011010101101010001010001001000111100010101011101100011', 2);
-    T('1433628110429482851535358742130957026457687710451052766168752', '11100100011000111101111111011100111100111011101101110010101011100111000110111010010011111010101010111010101011110111101010101000011010110011101111010011110011110111001010101001011010100000011010101111.10', 2);
-    T('888', '1101111000.01110001001100110110011001000100101110001110101011110000100001101001000011010011111110111001001110100110001101011001011100101000000010010111111111111101101010110010101011010000101110000101100101100000101110011011000101110101', 2);
-    T('1901556394517909524025875', '110010010101010111001010000100101110100000111100010000110000001011001001000010011.0010111010110101000001000001101010001100111101111100111010011011001000100000111010011011101110010000', 2);
-    T('260195957172449000', '1110011100011001101101100000101111010000011010111011101000.000100000111110001011101010011011010100011100110111010101001010101000011110101100010100111100100110000110101', 2);
-    T('654853', '10011111111000000101.000100010010100101001111011111101101010010001000100110110101110110010111010110000110010001001101010010110010110100101011100011101001110111000111000010001001100', 2);
-    T('186', '10111001.11001111010', 2);
-    T('45580573', '10101101111000000100011100.1010101100100100101110001110001111101010110011101110001000000100111011011101011011', 2);
-    T('74504933', '100011100001101101011100100.1110010001101110101110100000110010010100000111101100100011011001011011111', 2);
-    T('2', '10.001010111110111010100000011010000001011010110111001010001110100110111001100100001000011110101100101', 2);
-    T('10653067', '101000101000110110001011.0001110000101000100000101011010100000001011100001111110001101001110110111011010000011011000000100011', 2);
-    T('3103819016502701158728118887794', '100111001011001111101011101010010100101011001111011000001000110100100001001011110010001110010101110001.111111100111100100100111001000101011110011110011000000000001101010111101100010100010100001100000101110100111010000010011001', 2);
-    T('70726621184417493343184041374', '111001001000011110110000100110010000100100000101010100001010011100110000100100110011010110011110.0101000011101101100111001110000111010111010111101101101100000101011010001011010111010', 2);
-    T('4639750624206524979284798532410213523141234414', '11010000000011011011100110011110101101001101111100011101110100111010111000110000010010000001101010101110011101110011101101000111011101010000111011101101.11111111000111101101010110010011', 2);
-    T('2377749182359', '100010100110011100111001010011011110010110.11010', 2);
-    T('26', '11001.100111001011111001010011010101011000110110111100011100101101101111000001101001000011101', 2);
-    T('389501027984', '101101010110000000100100000011010010000.01010001000000010100011101101100001111011001', 2);
-    T('5169', '1010000110001.0010001010100001011111010000111010001110110111011111110001010000100100010110000110111001110101100011110100110100111001011100100111101000100011110001011011000011011000100001100000000100001010010001010110001010010010101011', 2);
-    T('2072974714841016', '111010111010101110000001001100000011010011110110111.10011111010001011000011011010001100', 2);
-    T('3', '10.11', 2);
-    T('6569814675686107322725113', '10101101111001101100101111000000001011111101000101100011110001110110011001011111001.00100011110010001110011001100001000011000010100101011100101000100101111011011101000001110100101001001001100010100001001100011010011011', 2);
-    T('984456092178345483540429', '11010000011101110111100011000000110111000100100101100011101001111001011111001100.10110000010110000110100110110001100010111001', 2);
-    T('6729551587237203748588625739672573822682543614592964521541035860', '100000101101111001111011010110111111110111000100001010001101001110111111101100011101010001101011100011010110010100001100111110101010111110001111100010000111000010100001010011000111100000000000101001110011101010100', 2);
-    T('329347347', '10011101000010111000100010011.0001101000000100000000011101110101011001000011111100110110000100100011110001110110010011001000011010001100010010000101010001111000110', 2);
-
-    /*
-    BigNumber.config({DECIMAL_PLACES : 5000});
-    T('6022239845523628300792137851333617197616053606580805361460444571405159915948416057193556599026984420186847535714193186506779546.45562364433149048376909884425264838196627845956471301832353037216028002220557941081995561235866533298815815922678466806108234749212464649692584770778636508682771855319769124974649405509297732509500507702362168384314107653609786430967640203107454687605887412794096157913528626853706056446855881531545195000734665133919578058463901659136523244159808597378906266443321758454939816465192126295342280568880123960605134416002321981988529228618898697072789772080291342478304351440847738944612720456898241717924298967008171252854355869450188166408302699162551054528159131912895298938197347616702659802404073209181609536327921587288300421033874114565425368107966522446454855931005917304136935908432754883056828263061549088965135169569684456008477541982066123091033968877584432281431379815341125413388350665252537980749041131051878291040173564632382596634048981529497244126378198699352829834835751033446902713765443032376617851981166182096456938914400530557912226087362980440980578460246231055456778104006415527727260144095903127275419414807349147304707405254543427544838982731455334927521421806120799785694323203756123916853431908716090161389876298981034132804663437564753354768639621168658600102486177710685317251506858936381061516323456154147708084807303368146788089168077930658523442473995088742325773226839695051398002486616767897842485900547744342133455226785895506239035265653618936400640974168752824304125514038750444312714907633618171991355429431759439952307076477817217105979944570733869770158307019913889590797598165139754807215433076623400151503800862360578168290788982250598565524133502841168163050960633073023086590377971028607254136702588526777419958903274032568187324150715013909702207304519885442684246154424782763896029535730853643906929626045280406345718447643848365642454794436200184559384104514455046474916698853542487141393373504315472859932883938412782930021292976807483126232761531618262529099148770786402625394165285080740814372385937680961636708062338551092904431743317072664203085901678724391714803254679215220462002284827189814215842974479924985602985736840346662287388320297983891277984351215430795679480190118537345626368022990139894769505155754558312126932952671414774316202379066527423168541384888466209214314154656662254580694814197800298638656821314275995533216305058772309199532434503635943016121377240397454883296750491850460737680808149474215115525147893924328495593024234124241923099439564731922184295950348564035465169266840591302330909689592731054406376096204521212856678638595326253266853596009793769540552472576546585623610514603873467842223218383413469519311698301974531524237384072650293621563877939654382136609518592602998975525783497411981332278754077646791148254910680215716571959847794999990247155904843380251881145330210230503708687521912940355094829433297671479621259952291050451507069861516277689852652120824074226408244695466776128994445706937283501626742574832399257358784925070613374733443923318045672485243752481960132066316477982467772782652564401225093039509921674057244503251628994886108332809253787838807087045292349084813153418737514141651084390353861740493248726168058140952618277156388955744920898401233144729995305891815236381631092752549773465825925187270747564816278320933350674627641648384663562427197990911234109442852754919229966716090476391048342193483833862003532792898637819146892137188859066257902207068814887904172213161571698554092509870791904603500154815868135120390375352892915790562057269104998986616170310087063962096170912045311169499205938470776723319613174250097225084425676690856982407000880056724620818824503061125725461684399498255127313452269964097609152404362732856503883361007911375417900940044634592803539714125533402906835228146503351037643506565226937040944039386627046902360157120659188931448110133381205133170527455488802527077001776856346493147507947490287029277744578775527372923256995419864299678429507426389922953403127483507515479327442988251888961453922972301510643563216583092771781978061366034284974632235631032912241967179283080214267387399797724014498036440569206078211810225217786455419707373248180986740603131905953623973926533609693886155905704306604100315482559358455550018630679789876126218887092040393676456180793809957296390894821682732929521075917502388856575712596709103037671223414578669707747332478371632108168893761388532592606235363056704156483680099201459584177626289636906715420355110405019316492710052426228518585155223882424429151702414484321844004913577523588611847871639322325737509992577988369672218344719659244872142799432036756062631109614278597717292745716623038732618863518899700937188424653264323754203446589769545236970901181775744966400800101730416875793459251675109469665985644198416152029852905095989068691042302222376893958470550095432860142880876451168971479312433163514921818509750264250472945722655641064950528004153004188190549429918759335822341644887168398385954219498973215722761336436971169084930492144143419812959401754073906781284401436962270645729138821367459312144327', '58LURTSHGLIURSHG8O7YH8OG754YOG8O7YGYG75EOY5EYGO87EYOG87YG407Y87Y1IUHJROLIGKHGERGRE.GEHKRGUERYG0908Y76981YIUGHFIJVRBKOFUHEWO8T9343097', 36);
-    */
-
-    BigNumber.config({DECIMAL_PLACES : 20});
-
-    assertException(function () {new BigNumber('2', 0).toString()}, "('2', 0)");
-    assertException(function () {new BigNumber('2', 2).toString()}, "('2', 2)");
-    assertException(function () {new BigNumber('2', '-2').toString()}, "('2', '-2')");
-    assertException(function () {new BigNumber('0.000g', 16).toString()}, "('0.000g', 16)");
-    assertException(function () {new BigNumber('453.43', 4).toString()}, "('453.43', 4)");
-    assertException(function () {new BigNumber('1', 1).toString()}, "('1', 1)");
-    assertException(function () {new BigNumber('1.23', 36.01).toString()}, "('1.23', 36.01)");
-    assertException(function () {new BigNumber('1.23', 65).toString()}, "('1.23', 65)");
-
-    assertException(function () {new BigNumber(12.345, NaN).toString()}, "(12.345, NaN)");
-    assertException(function () {new BigNumber(12.345, 'NaN').toString()}, "(12.345, 'NaN')");
-    assertException(function () {new BigNumber(12.345, []).toString()}, "(12.345, [])");
-    assertException(function () {new BigNumber(12.345, {}).toString()}, "(12.345, {})");
-    assertException(function () {new BigNumber(12.345, '').toString()}, "(12.345, '')");
-    assertException(function () {new BigNumber(12.345, ' ').toString()}, "(12.345, ' ')");
-    assertException(function () {new BigNumber(12.345, 'hello').toString()}, "(12.345, 'hello')");
-    assertException(function () {new BigNumber(12.345, '\t').toString()}, "(12.345, '\t')");
-    assertException(function () {new BigNumber(12.345, new Date).toString()}, "(12.345, new Date)");
-    assertException(function () {new BigNumber(12.345, new RegExp).toString()}, "(12.345, new RegExp)");
-    assertException(function () {new BigNumber(101, 2.02).toString()}, "(101, 2.02)");
-    assertException(function () {new BigNumber(12.345, 10.5).toString()}, "(12.345, 10.5)");
-
-    T('NaN', 'NaN', undefined);
-    T('NaN', 'NaN', null);
-    T('NaN', NaN, 2);
-    T('NaN', '-NaN', 2);
-    T('NaN', -NaN, 10);
-    T('NaN', 'NaN', 10);
-    T('12.345', 12.345, new BigNumber(10));
-    T('12.345', 12.345, null);
-    T('12.345', 12.345, '1e1');
-    T('12.345', 12.345, undefined);
-    T('Infinity', 'Infinity', 2);
-    T('Infinity', 'Infinity', 10);
-    T('-Infinity', '-Infinity', 2);
-    T('-Infinity', '-Infinity', 10);
-    T('101725686101180', '101725686101180', undefined);
-    T('101725686101180', '101725686101180', 10);
-
-    BigNumber.config({ERRORS : false});
-
-    T('2', '2', 0);
-    T('NaN', '2', 2);
-    T('2', '2', '-2');
-    T('NaN', '0.000g', 16);
-    T('NaN', '453.43', 4);
-    T('1', '1', 1);
-    T('1.23', '1.23', 65);
-
-    T('NaN', 'NaN', 'NaN');
-    T('NaN', 'NaN', undefined);
-    T('NaN', 'NaN', null);
-    T('NaN', NaN, 2);
-    T('NaN', '-NaN', 2);
-    T('NaN', -NaN, 10);
-    T('NaN', 'NaN', 10);
-    T('12.345', 12.345, new BigNumber(10));
-    T('12.345', 12.345, null);
-    T('12.345', 12.345, undefined);
-    T('12.345', 12.345, NaN);
-    T('12.345', 12.345, 'NaN');
-    T('12.345', 12.345, []);
-    T('12.345', 12.345, {});
-    T('12.345', 12.345, '');
-    T('12.345', 12.345, ' ');
-    T('12.345', 12.345, 'hello');
-    T('12.345', 12.345, '\t');
-    T('12.345', 12.345, new Date);
-    T('12.345', 12.345, new RegExp);
-    T('5', 101, 2.02);
-    T('12.345', 12.345, 10.5);
-    T('12.345', 12.345, '1e1');
-    T('Infinity', 'Infinity', 2);
-    T('Infinity', Infinity, 10);
-    T('-Infinity', -Infinity, 2);
-    T('-Infinity', '-Infinity', 10);
-    T('101725686101180', '101725686101180', undefined);
-    T('101725686101180', '101725686101180', 10);
-
-    log('\n ' + passed + ' of ' + total + ' tests passed in ' + (+new Date() - start) + ' ms \n');
-    return [passed, total];;
-})(this.BigNumber);
-if (typeof module !== 'undefined' && module.exports) module.exports = count;
\ No newline at end of file
diff -pruN 1.3.0+dfsg-1/test/base-out.js 8.0.2+ds-1/test/base-out.js
--- 1.3.0+dfsg-1/test/base-out.js	2013-11-08 16:56:48.000000000 +0000
+++ 8.0.2+ds-1/test/base-out.js	1970-01-01 00:00:00.000000000 +0000
@@ -1,10817 +0,0 @@
-var count = (function baseOut(BigNumber) {
-    var start = +new Date(),
-        log,
-        error,
-        undefined,
-        passed = 0,
-        total = 0;
-
-    if (typeof window === 'undefined') {
-        log = console.log;
-        error = console.error;
-    } else {
-        log = function (str) { document.body.innerHTML += str.replace('\n', '<br>') };
-        error = function (str) { document.body.innerHTML += '<div style="color: red">' +
-          str.replace('\n', '<br>') + '</div>' };
-    }
-
-    if (!BigNumber && typeof require === 'function') BigNumber = require('../bignumber');
-
-    function assert(expected, actual) {
-        total++;
-        if (expected !== actual) {
-           error('\n Test number: ' + total + ' failed');
-           error(' Expected: ' + expected);
-           error(' Actual:   ' + actual);
-           //process.exit();
-        }
-        else {
-            passed++;
-            //log('\n Expected and actual: ' + actual);
-        }
-    }
-
-    function assertException(func, message) {
-        var actual;
-        total++;
-        try {
-            func();
-        } catch (e) {
-            actual = e;
-        }
-        if (actual && actual.name == 'BigNumber Error') {
-            passed++;
-            //log('\n Expected and actual: ' + actual);
-        } else {
-            error('\n Test number: ' + total + ' failed');
-            error('\n Expected: ' + message + ' to raise a BigNumber Error.');
-            error(' Actual:   ' + (actual || 'no exception'));
-            //process.exit();
-        }
-    }
-
-    function T(expected, value, base) {
-        assert(expected, new BigNumber(value).toString(base))
-    }
-
-    log('\n Testing base-out...');
-
-    BigNumber.config({
-        DECIMAL_PLACES : 20,
-        ROUNDING_MODE : 4,
-        ERRORS : true,
-        RANGE : 1E9,
-        EXPONENTIAL_AT : 1E9
-    });
-
-    // ---------------------------------------------------------------- v8 start
-
-    T('NaN', NaN, 16);
-    T('Infinity', 1/0, 16);
-    T('-Infinity', -1/0, 16);
-    T('0', 0, 16);
-    T('9', 9, 16);
-    T('5a', 90, 16);
-
-    T('0', -0, 16);
-    T('-9', -9, 16);
-    T('-5a', -90, 16);
-    T('4294967296', Math.pow(2,32), undefined);
-    T('ffffffff', Math.pow(2,32)-1, 16);
-    T('11111111111111111111111111111111', Math.pow(2,32)-1, 2);
-    T('100000000000000000000000000000000', Math.pow(2,32), 2);
-    T('100000000000000000000000000000001', Math.pow(2,32) + 1, 2);
-    T('-11111111111111111111111111111111', -(Math.pow(2,32)-1), 2);
-    T('-100000000000000000000000000000000', -Math.pow(2,32), 2);
-    T('-100000000000000000000000000000001', -(Math.pow(2,32) + 1), 2);
-
-    T('5yc1z', 10000007, 36);
-    T('0', 0, 36);
-    T('0', 0, 16);
-    T('0', 0, 10);
-    T('0', 0, 8);
-    T('0', 0, 2);
-
-    T('-5yc1z', -10000007, 36);
-    T('1000', 1000, undefined);
-    T('0.00001', 0.00001, undefined);
-    T('1000000000000000128', '1000000000000000128', undefined);
-    T('0.000001', 0.000001, undefined);
-    T('8.8', 8.5, 16);
-    T('-8.8', -8.5, 16);
-
-    // ------------------------------------------------------------------ v8 end
-
-    // 10000 integer base conversions generated from java BigInteger.toString(radix) with random values.
-    T('440155688144172', '101725686101180', 9);
-    T('101012012002102211212101002012121211210112201112022122012110220101', '11665560554201545341275846801989', 3);
-    T('16g621gjdfj387g8f', '878682490721226942575', 20);
-    T('23296228463551556aa7a803294013169936813630895547', '20254039346778828988686906345231844106054371456414', 11);
-    T('86', '294', 36);
-    T('j6angf77m93m', '29321388122089630', 24);
-    T('171634571716400543513334300705612071133717535572246575453160', '364584667335183828987221775272570428237696628507956848', 8);
-    T('79ih09ddbmoj6chgi', '5317189538963113735021341', 31);
-    T('17140110747560', '1043696177008', 8);
-    T('5mf9glgacka1oj', '8798568215457188744', 25);
-    T('14i0i1bijh5bb66318hjbe39el8ed7', '1038225938103094195672715196371622399149', 22);
-    T('3779577535435531065475', '3779577535435531065475', 10);
-    T('1101000100001000000110100100011100000101001', '7182272837673', 2);
-    T('v1r0gswws8mg7rg877gua', '132336254343195067504822207481070', 34);
-    T('1caiusm1ngmh8', '1101263079273875608', 31);
-    T('bcd583cc3014846', '132516316064365582', 14);
-    T('1656', '942', 8);
-    T('2iq2q6a', '1046997262', 27);
-    T('s0tb0wwdorr1don43twqe', '65743744003104369805298454218408', 33);
-    T('4', '4', 17);
-    T('13eb7d6c25678', '2652301005605213', 19);
-    T('63595846315682339605641914681670020', '63595846315682339605641914681670020', 10);
-    T('3192', '53640', 26);
-    T('18jd4fccghe', '86689784393126', 24);
-    T('ahn8jmcronn1imiwqqf6894boecrwtt', '92552461943195873402655551990866403102200950223', 34);
-    T('732a68649252780573256384a0762a874827823929485545', '64359755261128349657756381355778457151559256253657', 11);
-    T('o0502ci441waab54sxss84sdbiq3', '5373042738281691949642803579987183092210407', 34);
-    T('1021112001100000210210', '13373890500', 3);
-    T('40202343000', '39887250', 5);
-    T('8720081b5e09269094e56202843449cb', '24377982076224740260643696757107121341', 15);
-    T('1iomc2mqsn5qpt8h1f569gs852', '13789591701124129450628724568456423352', 30);
-    T('1eom414n8l1d9nfel48f1bmqmm0nmle0j3', '266719145838127409543902693002813822731463432657', 27);
-    T('13k56oq3m631lo954n2ohok7', '2181841744266177308465040173350263', 28);
-    T('454023134354435330523150501153110052125254133003305331', '863587285752958267795174798408995811866775', 6);
-    T('1d6ekejh1ik9hk6k718', '2338861492105483120978650', 22);
-    T('2', '2', 29);
-    T('1e6c', '15573', 21);
-    T('g57c69', '52060929', 20);
-    T('12020002010112222111002201112002020022001101201021102000', '303840883816576562846336400', 3);
-    T('117e081886a2b7dhh6b7ddc9g9dah881', '4703193157526229832838915604553828591088', 19);
-    T('120', '48', 6);
-    T('r3ph9dgk57p', '74774633365798895', 35);
-    T('8a0a2kj0d87f3m42i17h31kl60k28e4de70', '167827516964906460076306119782216338842769448945', 23);
-    T('2l055f3b4noi9po87stgqmchln5387', '18531519454051111130681336099858607562067947', 30);
-    T('421062013993955192a2221428707a96575292bb', '115579778299459540087492544347756755742382977', 13);
-    T('1bibgea4if', '526155599692', 19);
-    T('1497d29d3476a2a9780b34d03dd8d7b', '32297467668609167750315214037242897', 14);
-    T('1100', '12', 2);
-    T('3', '3', 10);
-    T('aj768i29h4hiaa4c21ehiad1ejcia8ig', '235542570596088783891401514707500777363576', 20);
-    T('0', '0', 26);
-    T('1057782', '1057782', 10);
-    T('10110000100', '67806', 3);
-    T('130301232102', '7543698', 4);
-    T('3iuna', '5311190', 35);
-    T('12120101010001002202210212202210210222212101010111220211201121001202001', '4647047674765599509161881404042506', 3);
-    T('19c1p4e5sc', '77422104704616', 34);
-    T('20jd875f0sb7eob641f2j2rogg5i22f', '150648633114646195779853741265975908572439118', 29);
-    T('fe5pdnmr6agww3hvvh1m5y6084tkm4qi', '11317796537927193164907314114830625186030646924078', 35);
-    T('115gekg30bl34558', '144730350757318919194', 22);
-    T('3fagc3b8m35ahj6346g1mbkh885b5159g2', '3176675255123809025734896069538375765072180396', 23);
-    T('5686he7d5bb824gci8i3e78c7j0ih', '14283076803292405590664992623911672377', 20);
-    T('1jmnldb1lfkrjoe75k7o3rednhb1f8h0', '1242551650400204544842102196394576048943170972', 28);
-    T('60bf8d3f1cb70827109c', '456880688358819786854556', 16);
-    T('340432530435433213034435253441422121', '6339719167942344530566282177', 6);
-    T('i38g07j7ie95b2g3533dfi075', '982752454390853323739173663368665', 21);
-    T('1h6t', '42509', 30);
-    T('642677755550042022420042650122720673705371422153432', '9341223088519577080757976073309527669316572954', 8);
-    T('4ddho197n710a2m273kka0e23l4g0h85b', '2462195801283263655162466534079464545810817636', 25);
-    T('1243240323034002400230042343332120411442100332', '45148599779050957102730921831342', 5);
-    T('88scnc9d', '228014337833', 31);
-    T('1170484020308451032231073707375108400760815', '14346468379928007582608703547513785950258', 9);
-    T('4823304938154542868234529244227621001', '4823304938154542868234529244227621001', 10);
-    T('1651372117475740354637456547', '4427164671782016593583463', 8);
-    T('7i2233ggjhb94938eb1bjeh9ah01c', '21220547440397899830782173177438536032', 20);
-    T('38e2f51l5226upuurq', '212488028484539189554322396', 33);
-    T('2302012223231313010303032233111031210011020131110321321303332231113103032', '62060333685205067717083070636012166725334222', 4);
-    T('978074cbc72b612330461c399a6cd9a5246e', '1383648770009475636965471306920429322557754', 15);
-    T('ttla4bfhg8ogcqe72ur1432jjo76ghc', '42713337532562165277151943846110614488089838124', 32);
-    T('61482faj92i2287770b', '1588859334544847514778811', 20);
-    T('3053066362454436563436414156651113001465631', '970611871710418073313798574789753891', 7);
-    T('28b74a2sl5cr8s1ki0sro011', '9881987714990620033551204066568469', 29);
-    T('9alod3a4n9ncieiqihlpehs8cqd1sd10dj2mb', '415054010142313409024004868502578691674339253356722226', 29);
-    T('120131131131201001210300133101113223032122100210332221130303031030', '2080853698331650615760995253176321127244', 4);
-    T('ihk308048gi1', '6604552742887513', 21);
-    T('a', '10', 28);
-    T('41179', '2854566', 29);
-    T('h0qpo1102o4h2k', '69043303761626479331', 27);
-    T('9g4baafceihhgf518g7bm7h20nkhed8b07m64', '471227319810157894343865948670273836507237979925524', 24);
-    T('dho5eqfqowsqv1meq8bquhml', '4406294486817687943635096558491220991', 35);
-    T('29bb5fdpe1kes', '1813313296055953458', 31);
-    T('8ff84083f', '62334898476', 17);
-    T('70a2g249a1da182if3bhf4db31b', '167580219569043944485242667799058497', 21);
-    T('5fl2a1id1b2jolhmhjlk7na7g', '51071422881267420196649258348708342', 26);
-    T('100022', '251', 3);
-    T('432', '282', 8);
-    T('3wr3swm6ubjrkvt', '16294970748730625951364', 35);
-    T('17168', '11807', 9);
-    T('35584293177335052090482862003912891468038390', '35584293177335052090482862003912891468038390', 10);
-    T('7998aldd', '33899695237', 24);
-    T('4kij6bl8043lpba7', '8045734455699535180463', 26);
-    T('4gla1701h5602l588', '29045123944032022935020', 23);
-    T('4krb3', '3804633', 30);
-    T('3211002241324002022113342004130434213023003244232433', '1531292744433422364552476748786320993', 5);
-    T('27', '39', 16);
-    T('3o6qpgd0', '104034477683', 31);
-    T('5dg2c119a0892cb61353d9b1', '116223645530706451323585167475', 17);
-    T('1156036607174723020034543345673164620146641', '103357460209213083948351046056291650977', 8);
-    T('41ib89ghdgeidg0039be199c3a4', '27490663465965934673955627614337404', 20);
-    T('e7k93m5', '6879430493', 28);
-    T('120223324040024130101444123240111221103312343230410102202103302323', '3849970071333132024959950921403659216898884713', 5);
-    T('jg36bjg950j6i9m8oi8glle21kh3j1kfc', '10649691942461568427422892625442894260778934762', 25);
-    T('4w4a6teferq6r5ik5ut62fual', '13835986798310811924322665391394254965', 33);
-    T('312490955c70', '5539379829789', 13);
-    T('emtaesbe76h7dk71h4bt3h8kg3bn69', '101339233480279275559007163118630302631547889', 30);
-    T('3p619b5fmg0l1632dd7dlo2kh', '88631790446416440440286264005548442', 27);
-    T('1341', '2757', 13);
-    T('f43426ggb18h6510e7fe84fh310b', '511382471492848290663092376073298210', 19);
-    T('6j41em7raogenfrjhgjkfkfh3eu', '3945233626117535310773506175958783010154', 31);
-    T('111641556162423641100614510003', '3807645289032672695383142', 7);
-    T('2696427c2f1cad979g08685g71f0h7h4hbh48289f4f', '124382154384973091480024194947893719797603463814945307', 18);
-    T('11845026586657305823549960872429', '11845026586657305823549960872429', 10);
-    T('1h64s71x4rusnjlx5s7', '9260237785040115157604241362', 35);
-    T('10311042615', '300721440', 7);
-    T('2451143b5ba7ca6943a', '262895985819802223782', 13);
-    T('jo11nn24j791mg1i8j1mhc47p255', '3189124189951034463858246698569851705767', 26);
-    T('10011232230103110332', '281029981502', 4);
-    T('iaa7a6e611gih', '41068316481138638', 19);
-    T('1912f60k5nd203ej1', '58775002826689939438559', 26);
-    T('2459b78a913708732', '438882964276198934', 12);
-    T('308258662', '133548968', 9);
-    T('347175', '118397', 8);
-    T('2l383movaqq6vge0t51d1asb5', '3534985310385748495852148058236481893', 32);
-    T('1002011011221201220110020010111000021211000120100020001121', '1695352250587759269039520513', 3);
-    T('121', '25', 4);
-    T('a0480880954109d', '292517771808862273', 15);
-    T('3g5c6881d68a6g3g7ded8f00ddc3', '6605800905697912313930823429368376', 17);
-    T('g9bnclea0di628jg02k69b75iaf6mld17akh', '33275613302454138474042464061355756382668628304497', 24);
-    T('3410345247354238502664518577282', '146560013392255863392167155830', 9);
-    T('21121101020212000010110210100', '58005313126803', 3);
-    T('2331003220030000131011220331231', '3405742490204409709', 4);
-    T('kepi6h75hclp6o', '210478662369536496313', 29);
-    T('14320202403220110112112043411443103144334124004312122302230433132031244204244', '256316960412695093498974392340639287985576426301944324', 5);
-    T('21oh0', '812300', 25);
-    T('637302200571726036177', '78099699617401957027', 9);
-    T('3h8nrbxu09bl9y59qd0x76mh', '2169701554867548714090537334110301769', 36);
-    T('5ei5i1ji6hf23g10036fbcgh9kg7b2c8cace9e', '265177220460106545362048683909814340097671193815436', 22);
-    T('2il', '1605', 24);
-    T('md18bbl3ikih980m8ijjm5hk37aboh7i26c4', '190769957856763978202455746822271950952451735582179', 25);
-    T('49a947b15', '11910266120', 15);
-    T('5563068134037605066000072214445077281483844846461', '35846490510257461400361080273583563758784437804', 9);
-    T('2326og3ij7pqp6nrqmbkkh6d4', '5822237723786017480562091732598915027', 33);
-    T('120133110323003200013220212133103302121120320212', '30316511656490491221060718118', 4);
-    T('16mdhr19sd5c5d5c0jjav97fu9o1', '267673848646358103096813679060486949796693', 34);
-    T('jga1bjl82k4ah11179fk5', '33833463661666075552032677215', 23);
-    T('c20kujdb', '514029069323', 33);
-    T('11226540043034355', '39624784159854', 7);
-    T('v', '31', 34);
-    T('14502011231234', '23602310374', 6);
-    T('kgl06leab96536b72hh13b4gd12', '5267876931068834999207837763071495773', 23);
-    T('jl7of6l89i2iabafma', '22471829516120804540402146', 26);
-    T('1450007a44290518221a532', '114367864225072949311955', 11);
-    T('298fe1gbg9c72', '1491696784725786', 17);
-    T('250711224523642463565466455623', '408358568053857594342267795', 8);
-    T('9flo2bq373qjcgkp3e6k71qnonehh', '316990433419229469352412547876129922440461', 28);
-    T('1203662265620020640221323330644160123013', '1179984859885559189864263643508373', 7);
-    T('16x9ld', '72095953', 36);
-    T('67d8i74a4e8gg43', '73378543709714711958', 23);
-    T('58398378841218155357', '58398378841218155357', 10);
-    T('dy3hf3dta7', '1101392127345132', 35);
-    T('ko6nkrons9d0fc0bil4i3qi63e8ff816f302', '31822762789078625728496093591661767305613028321798487', 29);
-    T('198g4ec36ah639', '31806677232541503', 18);
-    T('45243354620633', '461990081612', 7);
-    T('775823b0c15', '4319863197095', 15);
-    T('g28he7j4icef0bcbjgj8', '1201572315079967980347229812', 23);
-    T('g4d4dqb4', '169104269893', 27);
-    T('18jc9hh8c8im15d8a09i8', '5496196321990395030043538936', 24);
-    T('4g9282g604cbh7da78c99ca7', '365574202021938047866967922307', 18);
-    T('e5rf3kpheo', '206076021040648', 29);
-    T('713414314586b73', '27941755511268212', 13);
-    T('619739902555681054508877700190814647189340192531531', '619739902555681054508877700190814647189340192531531', 10);
-    T('20111011002200122', '93082868', 3);
-    T('100230221211233101331231031001203331331003102231102112012330112112330000132301133133021', '6247333955182528679256744382669521818617928418195401', 4);
-    T('31464741215652662410302172736', '61905218854453628692395486', 8);
-    T('708nesooj9eefjp', '3352746100369361432095', 30);
-    T('8fidd470c39jbio0fqbmo4r8ad', '12923744867491474626257779584052881637', 28);
-    T('1151171074647051031165674252760067', '764101851531641191689328779319', 8);
-    T('11043032215231230545441315401541344541210241405152211', '34556143670121676351099193602542355133167', 6);
-    T('7451b5a50511996bac9b28b0', '306395754266354995755659445', 13);
-    T('13ir12f', '2389675047', 36);
-    T('2e', '72', 29);
-    T('112551341310022250543503544424133243522435', '100211013146144877918564374426903', 6);
-    T('15g4rioci4g3qfn9da47hln', '177378797438603886266961020628820', 29);
-    T('313qoor3rl62hs', '111971617480570505788', 32);
-    T('11be338996c3222d74125b207e1c94c74384dc344', '123816432746013151845557555294618280342247674364', 15);
-    T('510151', '1885261', 13);
-    T('al5ra6h4', '293932103440', 31);
-    T('7p7gq6ao', '171498767724', 30);
-    T('4aip7ke83a0mnoa31e9hc64c', '3668246283124124964717547932816798', 27);
-    T('26ffmuj7qfj5urc', '2600404271332517411692', 32);
-    T('1228jnkc879102l6klfmhgeh7b3k9kjem3chmk', '1271226839086861348134838781391638338414049937252452', 24);
-    T('3m1dkpcjl6se25ees', '941019906537302808213671', 29);
-    T('nvk4t2ijr0pt6a', '885016896759055316170', 32);
-    T('353463695235911', '353463695235911', 10);
-    T('2592c02eb41095d60c7b3ae4c19254bcb7e451', '77783442256833108339948757455065770782318226', 15);
-    T('101001110010100101010011101100111001101001100111101111111000101011011111000010011111', '12630360807685587318206623', 2);
-    T('10a94b226bd2a3cb347d8239a354494baa876d3c', '7719527647026016534723119044578909360854733857', 15);
-    T('10112100000101212222210120202020120022212020022002012220222222110100101012200010201221221112010100', '22465908588350531170561340022119338184319644550', 3);
-    T('3526', '1294', 7);
-    T('trqchmprtris8jhmt53mgfph2bqlk1rdlj', '166379098618921452590839536518689519047997516551349', 30);
-    T('amqtg5blk7b3', '540363976066013685', 33);
-    T('5bb8f0da136651ih36if43c9', '1446604699008863640297362261438', 19);
-    T('169095c1igm9lagle03', '18254265908591826520258753', 25);
-    T('5ca72lphe8b1g6na87l028nk7', '49874912506100858512179674721524459', 26);
-    T('db2hm3or5qm99cejggihbqj24o', '20227071482916596230414576969129951720', 28);
-    T('3e06d7bed9cl3hmcdh4rk6d', '518456522736295870554795311386837', 29);
-    T('3783552669408621336694762820722', '3783552669408621336694762820722', 10);
-    T('8plkxhiid9r48fmxut8j', '1097250217160493743377273093271', 34);
-    T('114c00b88e376egfab533', '4369484999824057755698184', 17);
-    T('14983603362604292572455838465420099066461810', '14983603362604292572455838465420099066461810', 10);
-    T('509d164ce8562017ac87ed954c322aabb3eee76', '2478749182617286136760963476865027709609349886', 15);
-    T('3fkhedjllk072h2jdi0722fndca0nm2jh9d', '309586105474608741121591603678170578618026772773', 24);
-    T('1iq6sj905ic2n1b75s3bhc97qjj82iclshg7', '2522966691781107980265563729308641205273869137106927', 29);
-    T('2a6cba18b56b3', '155884237022909', 14);
-    T('8bddeba1aaa3c4d55a4b1496ae4556aa273d', '1280685511801156504844254243757080956139633', 15);
-    T('2cd', '2733', 34);
-    T('8n6fnlac07f83b3hl5a2cdnjen9fig989', '1316884479548601245836236435764995581418738953', 24);
-    T('6fj39908aajh0f7eici5g653270g2', '18248065317134624862612052897609976322', 20);
-    T('100442024203540041', '17296877228281', 6);
-    T('864lljmcga', '14895956013429', 23);
-    T('ida78k0lnm720jk42co06325dndfincdcf', '251216020257140411511559806773250633017763086565', 25);
-    T('2202302331132212020233000022322031121', '12012243725278503478105', 4);
-    T('6i6jabi6j', '532166217509', 23);
-    T('6cmh6r7doponp2ajcjoo2pn87eakbgg', '167803056903383062748024010526394587708233856', 28);
-    T('2360598122619478480207180074620237', '2360598122619478480207180074620237', 10);
-    T('4fdgfae5ai1dfggc57jb56gfdhh', '32108887594999276898768884821885557', 20);
-    T('30316cbc668127583b5c359b17195c7680c', '225869808340726521462856371477325948274', 13);
-    T('b0a4c9igh1d34258f', '33188485929923604704131', 22);
-    T('9b81ii', '75424770', 24);
-    T('150j0jm2n63ana812', '27968036853522567739402', 25);
-    T('2rxjdeshl7hv031gh8x8tal1', '913145329049266795302812350123389486', 35);
-    T('11ba64655696c81c01230a5c4', '622476147856099856056476548', 13);
-    T('2if7c15b64menb5f381mbffsq5552gb4d22pn', '116879749441690585814553354811233856559766636508284681', 29);
-    T('a89d1e8ba7d4b79c033a15d0d12e', '600946350698036566145005181087894', 15);
-    T('65kkch4kkab51720gk72de14i4m1i65j1h5j', '2863074376250121461194200964351550106115034432936', 23);
-    T('hq9iq11x71vufsis5', '141103623069429330755986709', 36);
-    T('31352441130112145', '9239969893601', 6);
-    T('1e6g5c3c8', '63619126397', 21);
-    T('32bcbi7d25g42l', '880900685973582625', 22);
-    T('111627132417321114752432320745434507337525667340540534056666', '220880699124044497678574383774865426395965086166441398', 8);
-    T('31ajm2h13k3kcceeb9', '432180494217866849859531', 23);
-    T('30hj3', '848956', 23);
-    T('h2eaee905c464gh13c1g3a24bffbd7b157a7d8243', '2788179404237205827575664664460917404793610485107907', 18);
-    T('6l5fmeo4r8q9ksh0e16dqs2a', '29054682041642997983411270167870486', 29);
-    T('9bgeg983a9gb072ia', '2776374479824499829805', 19);
-    T('427303573032681547102347847', '27865476405856977419599954', 9);
-    T('58186560531623536388240774584465008', '1644634101768983314712700937410068', 9);
-    T('gud5evq5j', '23798093687167', 33);
-    T('273989b4c4b2b65507308785c9601b1991866b1', '5472576971132404535367740776182484421987974', 13);
-    T('52e226', '3945861', 15);
-    T('c4bg1f73', '5037578485', 17);
-    T('0', '0', 7);
-    T('2ga84ck3k8lf1b6g81e4d1o10adildo4fb73d3', '14063518582163403576381156810721420380483851225111578', 25);
-    T('18398a17693a99a73829311597a8009a998', '449495260282451489496065134468852961', 11);
-    T('0', '0', 10);
-    T('2322cb943a7c0e49c0adecc89ae8c8', '28247920028932853396658049010936738', 15);
-    T('4a7lmeeehee0m0e2f88h3fhi9jae36', '13754660732035427506299787750012455330113', 23);
-    T('66om3l', '61326346', 25);
-    T('1jaxmqc44xcgutokt3', '440143628927856861597987927', 36);
-    T('43402144002311022321023', '11357849767776388', 5);
-    T('f1q', '15418', 32);
-    T('94bm3khgmeh6h666e51h4hkb1ba70lb0', '15037888711417055917959334087989947554028156', 23);
-    T('468836dc5e0921dc805d0ca944655824a80', '43081374214668891982097847922924570176495', 15);
-    T('7aia5ft68j2ah9tdnij8hbf2436', '1869214551753119688855382398317532507696', 30);
-    T('14a3b3', '1352627', 16);
-    T('upklpfh648l1', '1555511519818102177', 33);
-    T('3642604410156200265653560662320144226060043062566313031', '17044221773211127840838069782217144740567292173', 7);
-    T('11111001010110010000011011010110111010011011110010100101011010010000111011110110011011011100001110000001110010101000001101', '5178750376444939350710857550952606221', 2);
-    T('25914', '69645', 13);
-    T('22201121210', '171768', 3);
-    T('1299ea6145a33955gg494827fgfb4', '160233176579923489744786615302245782', 18);
-    T('2404400303345455302', '273021872765366', 6);
-    T('2780589741896838784693', '2780589741896838784693', 10);
-    T('120051666651454430105', '102765715947351287', 7);
-    T('go', '488', 29);
-    T('7hdkmh4echjjf94fc851b7cm9a6309he06fhk', '81727387424011034101131466677491869453894982060018', 23);
-    T('33313031310333101301210101232121100102032301201220123220033121130222032003202122', '1448964781656315513831338629339319660846289270938', 4);
-    T('1f4ejan70ggb73lk5bia4djdjelig6', '17342687637043286986515244372299021023238', 24);
-    T('9', '9', 22);
-    T('100110', '38', 2);
-    T('101010011010001001110001110111110010010100011100110100001101101110100100001101001', '1602153026925525548353641', 2);
-    T('dce94', '701914', 15);
-    T('1ecgdk4ch2ki2gal6geikc9fmgm6gc8a8mb', '135755121543031059870445637631947092289577070619', 24);
-    T('hviu8xaubwr6cba0mkh6xhcmkgrudf98np4', '563888921489815885331467969078334098692735774824158929', 35);
-    T('16b72', '32774', 12);
-    T('3fkd07k', '2106600098', 29);
-    T('121344424133143434114024144', '2193410290272017424', 5);
-    T('ej561m9bckcn7i03ja6mj2a1m1alm85ej9mhc', '720924047901203102542178589784759717033703825426724', 24);
-    T('6dkib54b13fncbkcefo7lafkdkae78m59l', '88812159262476475867698690215386920230540581496', 25);
-    T('5947916744591013134669825015156762693936309', '5947916744591013134669825015156762693936309', 10);
-    T('97fj791568miadhqtj6dci02', '87089150165580623669373687837670202', 30);
-    T('3ocb5459mcgps', '2026781564861859178', 30);
-    T('828g6fdkbfje1kaji14fk361', '20909317220805593816802833365225', 21);
-    T('q5', '941', 36);
-    T('8alo9sgaa', '4187460686272', 29);
-    T('5j6nf244ahl3k83f24l5imff20a0ik2ij45', '490788188097844322838594090172370516724231182117', 24);
-    T('4kfem4ifgc376m7fhfiab7ji51n', '78208441448030014437846328864355857976', 27);
-    T('22ga1if26hi9', '5021678125886084', 25);
-    T('6h8110747bb4ec5', '5526770097051812790', 19);
-    T('3kmiao', '64421584', 28);
-    T('35b2ef5i09feda6bf2dfg56cfhc54123h74573h', '90100642513830363534883950760191394857528151082877', 20);
-    T('4j10knam', '29062827147', 25);
-    T('9dj8geg', '620710696', 20);
-    T('100100101111011101011001111110000010001001100010101110000010010011111100100011110010001010000110100000010111011111110', '95386528077312833528510117745536766', 2);
-    T('37odmlq4t1cphe42', '46784748191707671321722', 30);
-    T('3cg8jhkdc1b1dd644hf6g3ff4fhbc', '37974153903814605133910844090810871839', 21);
-    T('2d90a4719837dbaca346e54796196aa4c39a29d7028', '72320014326190529207268511298086237053386258031788', 15);
-    T('221112010143201440041132340304141040211331000103002002341243330240031303', '103772284529022914388035430657679022322741387814578', 5);
-    T('234', '123', 7);
-    T('1gbj8j3f3g4fc7afcg', '23985271553951719606256', 20);
-    T('16dhfi679ge8cdahc0f5c3de64', '126062950519944159766121561159030', 19);
-    T('2110001020000212001221110002112102201001012101102121211212111212200211202111112122101002222112', '576441067410056461483703142176818271029941704', 3);
-    T('1400010200522020432130022505551242315132004422311315214250500552', '17595958038682732910920374172787533846127463600692', 6);
-    T('1100', '36', 3);
-    T('132133002330203222133230301300333012000022322212301213111003301031330013313211', '43509780485649606280607371868487166230944316901', 4);
-    T('111111220020010200200211011122002020002221111000112101211122021112110021011010120000011110110011', '3184810401058738852989667333232201616049894969', 3);
-    T('p2190d2m471f14c7m5jinn', '128683057515715021320115217552355', 29);
-    T('66607051535464671602731746325356021372265', '9099202145653789818834446363266512053', 8);
-    T('rxxwxwhb9cp2sndulf513ch', '137941140090442856448979588513676333', 34);
-    T('5v1as3h7gkt', '9098519834770439', 33);
-    T('23323330311211123313232', '52498284264942', 4);
-    T('1j6l4lj3lda2ah', '927009955843875697', 23);
-    T('10u4an3sxhdjqbpdd1', '111253813312875559803626727', 34);
-    T('n65aacems59afhei0i128qcjobg', '5898638281362823389060707803600314054946', 30);
-    T('1c69', '16597', 22);
-    T('472035076601272777773466260770745221025541771310455547267433', '940021031620376267748547570264155096359926520862306075', 8);
-    T('72', '79', 11);
-    T('19398c170gfcg64f843af17bgaa1a241947c', '129947852827238055712040360831603626896491442', 18);
-    T('101418606067268463402226345262270255081', '1857887598344404806997185438936620857', 9);
-    T('81mgdn230a75egkmiald7995gagm911', '2059707806285597627503761733243610129021017', 24);
-    T('2gllk780bm04e8lfmcekjgcfh07d27', '286479826696535775464273610901096241568391', 26);
-    T('122120012022201210200121222211001112112110221211212120212010011011001', '542747711299361252116322470317832', 3);
-    T('36bjnnofqm2f7ibl0n8hel8re350b7ff', '2349614933088599651464732173196752378742407779', 28);
-    T('2', '2', 17);
-    T('1901f2f75eddf8bif1dai18d2d', '486612954588567587212842937829253', 20);
-    T('fpr72ngapr11bdjarrjra8m3q0idnhcg7', '324494898071507461877053978943272748028566739783', 28);
-    T('mriospvubhhkbhhknl2', '84091461121613338404016434744', 34);
-    T('1gbxzhqfotpmsr', '247967926192484011179', 36);
-    T('171c43', '1119888', 15);
-    T('719d9ae0j06dc5k', '148475592775622801804', 24);
-    T('bfacgjw4l', '16123175442252', 33);
-    T('27nc9ja3ildcbpu92tmf', '48762307359506883152233969612', 31);
-    T('35100215607256233370100157131103657413347736114726441', '332554887108209374458014391052845453182019808545', 8);
-    T('2d', '43', 15);
-    T('61g7883dd3a55cfamm4307l26gd5qn', '1958734810273792705789246918934822143371545', 27);
-    T('jaa6397qhgfh47nj48ad3f4pg', '436699483716932159117919657451490464', 27);
-    T('7a9e8u030c2mlmislh2iq', '4925854031564503132850322969410', 31);
-    T('8dc', '3147', 19);
-    T('165130926947488295413682234912291953857277202438', '165130926947488295413682234912291953857277202438', 10);
-    T('2', '2', 35);
-    T('g7n4l', '15007121', 31);
-    T('2000201212021200110122', '21205710026', 3);
-    T('256e27c683g7e28444fe68dfg37', '227373590164376719118580707971549', 17);
-    T('3589ma16bn', '8514389402783', 24);
-    T('peqek92fb83fml55k4f7qa567ja', '1079505469268043886172306636663444862734', 28);
-    T('i6okun8rle5lgo2klrg7r24l1o48r9', '812263483616430907150828319601346058339361641', 32);
-    T('ffjb', '167409', 22);
-    T('16899758c5637027cc4509197a0806151b1b', '1472124298781451615642290787701974764196', 13);
-    T('dk50dq28hq0b9', '7265988549586872339', 30);
-    T('79f', '2191', 17);
-    T('69', '99', 15);
-    T('72da992618353861841c01d4687073a8d516', '93886242244818385595059361163892476186560', 14);
-    T('aki9bbh89fh87m8l1aa4a9l5g7bffm0h88385', '114763233555248086785759194797816098143926938310370', 23);
-    T('184b51amh5', '3542898368285', 24);
-    T('10034412103112330433111411132332013242104321130404032331313343', '4474599918067555064654041662068659458463598', 5);
-    T('rj5hgcjcce4heh0bafh', '5821635304368037800119927690', 29);
-    T('i237h1j32f357', '232647752169124233', 22);
-    T('23127102426b', '4010576357201', 13);
-    T('111111101111110011111000011001110101001101110000000011000', '143545575800234008', 2);
-    T('676884', '405319', 9);
-    T('42k68dbf4fcc250l5k282505m4imcfc', '293284630414438750039663958568928524711326', 23);
-    T('g31j84ai', '20678305818', 20);
-    T('0', '0', 3);
-    T('1ar451i41igd3prsian71prim0lseslbh', '86238754807491960819075362998411526539819962332', 29);
-    T('111011100110001111100001101100100100', '63992372004', 2);
-    T('bc053tka9gjboqptfug8764vteewhtn', '40826388795618571128129367769621369352492615884', 33);
-    T('bb972', '248486', 12);
-    T('i1qamkq1pfuin9eo', '3989956977379744422840672', 36);
-    T('361524917', '361524917', 10);
-    T('57b08jkec82938i3khak1b6c', '13806151720864861977227556530364', 21);
-    T('6ech2h1890', '94263489226286', 29);
-    T('1j5o5jmn9jafbdn4nn', '6738409255222242873889819', 28);
-    T('15cmpsn09too2c', '43116122218866434124', 32);
-    T('811', '980', 11);
-    T('4', '4', 9);
-    T('3492n', '2546183', 30);
-    T('c503f', '1026883', 17);
-    T('c8841d8a3e0c3184a1d13f24b7c8abcbf36', '1091713357762058306584556087055815769112374', 16);
-    T('101111111110', '3070', 2);
-    T('crsczl5y5f6wtp9lh3gh798ir8lusu', '17339136471721411584933213471118181624608588590', 36);
-    T('1fq5bta3pagdp8okhgs53f7clioamk37ko8', '255008927803374998828799238728878199583965626637728', 30);
-    T('210873084153651612242427773566076226832', '3874424403685633658520167970745713578', 9);
-    T('3db0523a24e245743553', '86803771432248580685703', 15);
-    T('40324414', '323734', 5);
-    T('5d6ka3abcc68880h', '767243912601976420529', 22);
-    T('c38lqjl46kabetl5qlj1r9oitjij', '92343694633170266121595556492720749580659', 30);
-    T('40552355236034366411121260630', '1894076705177959214150189', 7);
-    T('f8o42sl1bgh8oefa73djm5nbcqj2pfkiqd', '250697214887739481273552937511044544495638076630497', 31);
-    T('ldb4lgkib', '30103008932711', 33);
-    T('2', '2', 19);
-    T('pk06i2ceg0', '272020641434528', 28);
-    T('1010001000100010110011010000100001000001111010001100001000000001011001110100101110101000001010001110101011100111111100100001010010110010000011001000110101100011100000110001', '3791391092894496185657389426598978260806574313715761', 2);
-    T('2930', '4788', 12);
-    T('11011011001101101111100101010011000101000100', '15064322355524', 2);
-    T('4nz549mpd2ekdoe', '28653665664075364608062', 36);
-    T('k1b3b27gf1', '15943538449567', 21);
-    T('1fl9ian76dblfa44hgkle1j2la', '145148177867836192856283849258501785', 25);
-    T('5sr', '6759', 34);
-    T('0', '0', 10);
-    T('f9h', '12029', 28);
-    T('30ijdbbc1fb48dqb5h0a54ij3', '163061899281675414544508578695564599', 28);
-    T('11499i6bb7j9jcl22gfc691jkaijl9g70644hjf5', '23854750315423368837146215349983736231413256524952211', 22);
-    T('1os4p3n5ytmn', '164971754456015943', 35);
-    T('gbek5ifl9uvccwl', '29691120613113956443083', 33);
-    T('244668499127028e83bb4181', '2565913383528918683684970721', 15);
-    T('4t3cdnbdu3hi', '125493059871385556', 31);
-    T('33444410431312132044442214340', '141551939616015585595', 5);
-    T('f0e18mang1ckb83o6d02lm5p7mo4a2j4', '1098667950936590953496178062298824527159019274', 26);
-    T('10000010110111110100000101001001001011110100001100011111011011000110110011100000000101101', '316429297174908011263148077', 2);
-    T('10010111000101010011011101101001010010011100110100111100001', '340208393737103841', 2);
-    T('4455190b50557152a56aa689', '28956950424301470445177161', 12);
-    T('30178a990619211a65284', '2027761131843662253152', 11);
-    T('32adibdic3507e964', '904264457185802878114', 19);
-    T('1402203332505114241034521554031304', '80106131292450875184746488', 6);
-    T('1b7e6bfdgaf8h618hh396d94gf99660f2ah3', '140638185851643426335154839361249634663210461', 18);
-    T('4n02qr0qcjn', '1428131533975659', 28);
-    T('722062570016143', '32030085618787', 8);
-    T('12h1wrii6xf1isrxgxotoxf0k4rs', '240306175962933523255986233934776980691330', 34);
-    T('271132ed2156b56ba2264090d5', '624075202158401303369210786825', 15);
-    T('cbbe0ifb0ecg0eefifca0861754ad2gi2e5acc9af', '17820079854097348669358676176262454365377640065197275', 19);
-    T('d488h34b78i092jn5ki28d4hd0a2def3', '80631173055200461094000840558382509399473899', 24);
-    T('kai', '14868', 27);
-    T('74663674130162363012065031725670307006351247702', '2650448086139415170144453379569169365028802', 8);
-    T('410ek648686h', '3853830909449054', 23);
-    T('112122110102210020020200021022102221202202200122111210110112201002', '16764033406503354998216612366594', 3);
-    T('5a9ag0c99d9faad76g1eg9egegg3b6bc98d4140', '2801521663446241132823944236302962625699717089212', 18);
-    T('bfbi5a6afj45iah666dk760bd509af6', '219330264685128598444241632527479365312816', 22);
-    T('oi3j09e1m2dd9498c12fd1', '5622045359644445263576289494076', 25);
-    T('1403606123334625332112530636430620636042', '1439558915530889901212705116835520', 7);
-    T('111111100100110000000000001000101001001001101101011000001011100001010001100110111110010111111101000100000010001001111000111011111000100101000100000100000001111100011011101011101000', '1522300117779563676992926268294212750701795813499189992', 2);
-    T('32f9e995', '1301412242', 17);
-    T('2l900ee2', '9976339380', 23);
-    T('v998ik9huu', '1451808320253717', 33);
-    T('20460428a2a42366480a4650481749aa', '391102418677365044663717119852919', 11);
-    T('111111000111011011001001111100100111', '67770294055', 2);
-    T('50ce3', '4629574', 31);
-    T('54ig18iqae2tph', '606662590569600162167', 35);
-    T('4f4jav5ke8j9w', '10607946018036371326', 34);
-    T('435gmb5r5s9bbkbqo8pn8nis', '17742072943258762084938672774179567', 29);
-    T('210010022141321034344014413321311333243103213404021224344141321142101100141', '11655341046605487362673272556680098862550253021893796', 5);
-    T('11703652371245327270875136818411753701245105114621364', '50015363250812413592978674160611932885342581878621', 9);
-    T('100110111011000001111100110000100110011010001010000000100000011101101011110100000100010110011101001000010000100101010101010011111010110100011101', '13562459849657731179062132755251654390951197', 2);
-    T('f55ch081bgiqjfoi580i5027j5ibnm4g', '93717655210173870936123983046544755878321950936', 30);
-    T('14c7bd9g8fgegf4598ig78db559egei', '286902761703352399115713383654173395387', 19);
-    T('if9644b9hjb53je550iggh2095h', '125985325474900384130099682358723717', 20);
-    T('436j48e17g8hhbad8l02', '309158322644714941880361057', 23);
-    T('19395107722a624381360a3a37388491485545493', '837334765628822776393052128437254413732612', 11);
-    T('2f2ebnnd84moej1fh5g', '284114881218993578999222252', 28);
-    T('2266ce3388fee3c292256', '2599310186932964178862678', 16);
-    T('12f09b', '2839808', 19);
-    T('3v1lrp1nu0', '139695817285568', 32);
-    T('26234', '26234', 10);
-    T('8546683557740281816235016708082647838436361741010513', '39956203753802223948047814344332292828203738992921', 9);
-    T('224130321113431331234124334203030021101242314334043412423133', '446347968128646822230071497717582810279793', 5);
-    T('122784354735470573734278130737225806820754754778367', '648246815949675714466794273511802263245293730952', 9);
-    T('522bb0cac72011727319b7ab67075037aba2', '5030349684335489902148585919042821411528', 13);
-    T('784afb326df4e14f44919e903da2daab2c6a8c2b7', '10988016479801545098971638340838655979698598232759', 16);
-    T('1', '1', 6);
-    T('1a', '40', 30);
-    T('1140625615021215040452466121535636111', '3254092286706201839308923015042', 7);
-    T('15oonil2fhic899aaec4im0hpda0ghi', '3458063037512129270731260341461940831158412', 26);
-    T('5qf0e4a8gcpyoh', '680672672565382003132', 35);
-    T('r6t5mdbk2bhbksd79sk267f7kj6etr76ch2', '13843573438903736667979936265567288587972581206329575', 31);
-    T('5i5a32b13if5hd6b27ie1abd4d7831fb83335fh', '23338871699861348992667980731442144357549336414583', 19);
-    T('965h512b2a26efd4hihi4h7ch5deb10ig', '776421006283852166648096674359365276607441', 19);
-    T('23cc00a57842c825b2b73', '190753980657808903079377', 14);
-    T('84fgd0b838027260hghf3b1i', '6911861868573500849174840828438', 20);
-    T('32024343310', '33434205', 5);
-    T('2g25ae07b9bd0d8953dgg9c9', '215312595589787196108811324581', 18);
-    T('2c7516b990ec844c7a113d5gc84977g6', '380417281882594767106673659584705172801', 17);
-    T('3937e11053978eaa8b', '356239468690396944881', 15);
-    T('423540545131050354211054225420050220141241010244114235255451', '36191168862496053559216924657081367445614940343', 6);
-    T('1mq', '1349', 27);
-    T('41336630208066014426507600014561516256045788602138888685', '126394964103942872413285726629499765226015930689454252', 9);
-    T('23812465082116078023663065846540105844417', '359745322984251038213859961958548558564', 9);
-    T('32731602b73c56641e0a549720ac684047dc186d2e', '5250067280281468268057767492160429729760400843844', 15);
-    T('207', '457', 15);
-    T('221016156567502', '9966232203074', 8);
-    T('3', '3', 4);
-    T('149390610a9a', '5397912566784', 14);
-    T('1', '1', 31);
-    T('1100210011201102102100222212220201010222002011211211201', '79222020471668857707359281', 3);
-    T('oumnfcjqawvoiu2umob4hel', '63683659777115454000636977806709805', 33);
-    T('121a8gdf0bg5ee492017d', '4565149191282994738546034', 17);
-    T('101100010010', '2834', 2);
-    T('sfb31qelcjas', '348085994301840276', 29);
-    T('761570133215525640271', '8966391655604633785', 8);
-    T('k6ljbii1b950a29q', '290193032454717352772096', 30);
-    T('14444133312304020024142413311244142024204432230212103022143102', '8669102161750148059985951449842543267771652', 5);
-    T('4fg703204ae6653c6b3j4a9jf2ej1j', '257208195071681839222502187276784439639', 20);
-    T('1c0f6se081r4nf9rfr9te43d1e5c13', '24646533503075931130110785406893472989210500', 31);
-    T('5855387560621204', '1226716470634171', 9);
-    T('256907', '3289405', 17);
-    T('99igokmb20gb41jlqag2731bjn641pa8m11', '149265576178669580878869535449967114241115964835709', 28);
-    T('17g40f10cl36712efi6bc47g777e801bm77421fi', '170939473992155811269351752741318276877107096372302484', 23);
-    T('64647672689', '64647672689', 10);
-    T('1643632561314231340041002365410010553', '5171467731134228257724052634904', 7);
-    T('47d', '1149', 16);
-    T('393ba729770d6505a3118287502dcc939639a85a1803', '70352045253191285526358196586767060137043932511707', 14);
-    T('1khg50kik085caak5a', '59864078118328974774637', 21);
-    T('5tcqa', '4844590', 30);
-    T('4bn43k601jd9rsbjtjelutf1u5krrthabjc', '2226709914233178306419196997863309807078435719529623', 31);
-    T('j21c171a63p', '21463980112681081', 32);
-    T('735f0a94g0', '853457045557', 17);
-    T('31', '58', 19);
-    T('11303315150321412253104251022353441041322125054241231155444320242', '79348974866336815279783368738596691903140624659106', 6);
-    T('emtnivvcvpbofbjwx00q5r', '7042313029555078022883072758212719', 36);
-    T('1111111011110011111100001011100110001010100001111100110011010001101011000001000000001100000011101000111101100011000110111111110111111111111111010101011', '2842819740151363791267849959009928040708832939', 2);
-    T('11124', '789', 5);
-    T('263460', '160029', 9);
-    T('132020230022232233001012312110000320', '2223628314707328843832', 4);
-    T('qmatp6x7x0i7kwww9ru3g74fg31u', '13041558211114994891605591496874198058411615', 35);
-    T('1212432456235400016312330136544614313425566221424415544351423', '667449638793600765524787631521077125935234478926704', 7);
-    T('613b8b5', '101955765', 16);
-    T('1nbehnbn3k7io1e9h6', '2156225812589011334673092', 26);
-    T('101530101442425775517477023774', '158785455373148008304355324', 8);
-    T('8393265877750', '8393265877750', 10);
-    T('gejki8ped057na8', '1068784882324809922800', 26);
-    T('35524gbcgd415cg72e5385a3a687bbfa', '2698475481148714592199279711100304788108', 18);
-    T('1li6168emf0glp8b74bcgnf49', '16707705100794731252094321598976869', 26);
-    T('4ujg9feb5lsbwn83p1ftqv85a966nujwd', '19276486249671857007076018238589272537818685313529', 33);
-    T('7k', '167', 21);
-    T('bbwtg5482u5u125jwaw4grahxsl2wv6', '99870770755356292494097529732122977160595962180', 34);
-    T('12102302311130033133311221232311233111030032222222300300020200302332222313211130221', '36792782803022052519563878572962189298755425949481', 4);
-    T('39fd0kdiglo6f1', '13594585461735594178', 27);
-    T('30214311524250615152333025534506', '480518635808621857675890962', 7);
-    T('33736082402621341865465256743878261', '952533655583805522673631866039924', 9);
-    T('15536323540072537510214740648724651474', '328944392163793117310283327346967335', 9);
-    T('baajk2e9jcgcbk4a', '783476238643207986019', 21);
-    T('78s0h42a7', '3656391077499', 29);
-    T('5jipugkahalhjqpash1', '3937423681465917065890170274', 31);
-    T('aba12217aa326a16084a45', '505448814884269683427541', 12);
-    T('g8db2dff76', '5311016260900', 19);
-    T('fblgab2', '4774316536', 26);
-    T('cw0b3rp0nqac6rkqjm1a', '2807837344213103415524527607870', 35);
-    T('2220221212200221020001120101000021222', '438934738823378954', 3);
-    T('853iy2c2t9n5skt9ncntdinxj9hw', '8528601144540421131583349837423197612512212', 36);
-    T('enld1pqd72iiaah331p4c31sjricj', '8459371819370199255275975857354512812858013', 31);
-    T('374160464102717737077444644401061474361141636', '21456498302081433312710883059235111093150', 8);
-    T('5bnlih4kc679j7c1g4k3hak8eanfk2cd75', '74243343685087721564583592254567964316602539555', 25);
-    T('i291e', '2362778', 19);
-    T('ff4e0b01g44379g699bgc30c8gb2a1e393a01b', '53454133794642577998107664307448664264718891224', 17);
-    T('h6g', '19872', 34);
-    T('hff', '6437', 19);
-    T('201301132320130302211011203213010', '38937807697351162308', 4);
-    T('el2i1c1kvnf4n9a', '17306001852428266396970', 32);
-    T('llor', '586647', 30);
-    T('18f0l3un7hx6v3l6xu6whg0c854kolmeb', '12695193933193179158621509296985565216876568630503', 34);
-    T('2ehm00rlkmf', '1053398216187932', 29);
-    T('60lb29l4bkkbb6bnlccd5557h43h78', '209357188819429378059650212593873946932683', 25);
-    T('r4b', '33226', 35);
-    T('31222304042332433414413402401331030144230123012203422141033420300', '1789049338874374103059075210410623287931935700', 5);
-    T('13abbda6aa99c3c209c60266c69080c', '30726786430113013257219600561452028', 14);
-    T('262643168493430786031', '262643168493430786031', 10);
-    T('1100122100212202211210011021210022012211112201000122102110221222202200012220101210', '601798443643669936350054442563165420687', 3);
-    T('14otqenu046jhlxo4ptmng1u', '190810415328770416971685556952127736', 34);
-    T('da4h7jm2gf386iojnaq5ce1d25gl', '15818738612601844466551284963021649225125', 28);
-    T('100110100000100110110110010101000101011000001100010101011110100101000010101001100000001110111010100101010010', '195266285040805814110355923380562', 2);
-    T('488342231251751346242311', '44247487379947531811290', 9);
-    T('2h8bfc33dhb130bgd6d37', '37877193351326116690267633', 18);
-    T('3r2q2kd0md', '135336655487693', 32);
-    T('23332231413342023', '7332327145311', 6);
-    T('265735ecgdd4b353h3472743a3', '56608285630040709994361807982867', 18);
-    T('36gq75xn8dkj1vgvsz00l', '42502936499191450526350062396117', 36);
-    T('eh7dtarl9r36qaa4mhmk7', '9778676538945889058686790375871', 31);
-    T('14803558684458a2993a0a32099467a0614194730', '647203408320127342024090091627696455000077', 11);
-    T('1451431412002040323331043104330', '400960425098607615886590', 6);
-    T('297p13lh5gepa3ecdhhco', '99373684147185210906053364513', 27);
-    T('1301432143220', '394412310', 5);
-    T('33', '87', 28);
-    T('432231350515154632', '1041384299764405', 7);
-    T('313121410300242022022133', '39718036029485918', 5);
-    T('6b63', '27491', 16);
-    T('682b3', '189426', 13);
-    T('7219653551a624979495a91a8', '70891355956396038181400257', 11);
-    T('33002231111131', '252368221', 4);
-    T('4d88ggej8i58d', '59239205589626625', 22);
-    T('34451601353532653611436161142566545211336115564531652', '323278188886248967529158547940775990624674072', 7);
-    T('1is5noptlnirtdb3fvp5n', '2015588554685716212306054997175', 32);
-    T('bha5cgdkjk0d', '4144765439844616', 21);
-    T('27a25d8j516cdi4d7b', '70786447958357042929196', 21);
-    T('1586', '2030', 11);
-    T('31342760667031767334646421766116726252335314714', '1108212082493888677367272229520408961194444', 8);
-    T('28546553', '14143782', 9);
-    T('257jd0p4o', '460207294324', 26);
-    T('2lafklt78vxkn9xllik', '9683449653483437263505971556', 34);
-    T('2d3777760a984a21c97a0d20c628c419cab2bfc67f', '66084232243819558824679961490043082487366953191039', 16);
-    T('2eqb5xje', '127870218160', 34);
-    T('272343723733570133550665013', '880462300728651545799179', 8);
-    T('3kji6mhdk8no7jc8a9emhqr', '552688352219570858171515412726536', 29);
-    T('45472185506624743014572972163525387956841', '45472185506624743014572972163525387956841', 10);
-    T('27330316426437424646561612652414263301414200342717', '522342837272716004737400194551917026620851663', 8);
-    T('2b32df51f67de8g8834c19eec0c3c9320bbc943a4c6', '12688544036802134995824223195793070866654304069676611', 17);
-    T('101214044003251242303202220534005133043421420054520404513042300402350', '85236281669632536888419124917731749716268802441235130', 6);
-    T('33', '27', 8);
-    T('22014g67ff8bf1c644c2081d17bed81171c6526e75', '594721012934655345095358079862004270167442813594302', 17);
-    T('2uejffgbg594', '75792588512668236', 31);
-    T('6hedef5cg89aehbg029334ehibff5b', '84126707114035006726317668787251510718', 19);
-    T('12c9942167ae93c737fc5ff39d', '1488492491002839592133151683485', 16);
-    T('c2c44', '797764', 16);
-    T('22112301432130424314234114214121144302343011224233033111040443413213434424', '2596351663106652674437417994841482826828643522405614', 5);
-    T('447886b857b4442ae33e07b9c620', '244322955053028014376497119444380', 15);
-    T('fe787f84cf0ae7655d44db4e793b2a98ae8f', '22167524012235587957931446373184044722073231', 16);
-    T('ce00gfa61b35502ddea6ae08fa9e3c', '32311970180252432302213442175559249026', 18);
-    T('6410235531675374505654365627', '15755268886904815024728983', 8);
-    T('10421g292f1g86520b7g99743ffg', '1691511665188307722429188808830042', 17);
-    T('hfhae73', '608398905', 18);
-    T('1b02pnbb9fk2kt7hgejkfghaarsm03', '9380211704840395733125589366849221945645803', 30);
-    T('1cmfc4mbkho', '303773375379894', 27);
-    T('1011201211112002120002000021221000200212210122022200221211100002211020111201222', '19303102056479652797750726699461962392', 3);
-    T('fmf7k2vvfli7js7qddj08lrrsvjjkqhlqp', '734369787776964304691750078309244157228282267883353', 32);
-    T('b9r33ab', '10045230494', 31);
-    T('2144b7bc8951804726196a6a744886dcc1ba41ad002cb', '563023243497677865341196187925034677481508487973787', 14);
-    T('ab7', '1579', 12);
-    T('11111101111011111000010011100001100110110110000101100', '8934565388446764', 2);
-    T('121201210112011002210112122011102121100111200121201121221210210101', '19152206217272003533575256015003', 3);
-    T('87ike7hc4c4e4csrtrunnah4', '165014231640248173568866466973234731', 31);
-    T('6f40aa9gd3529589f6d6e8', '4857078092896960066845279294', 19);
-    T('1000112300233023320333000013301220131002213013133010032002130232121200112', '22424670700759204990548756345478151954602006', 4);
-    T('12010020202022011121200110122022012210210002011121220002010110220200022221212120022', '2270509037526981909994030317330177692336', 3);
-    T('jtcrk8briibmd1', '734874456187380029857', 32);
-    T('323ab6b303a0kh2cg', '4439310393102239451589', 21);
-    T('132213311303211212102223130230213013330011030112320113113131211020222200130222310101', '179019401287519987440897017633826802507494397750545', 4);
-    T('10421aa279', '10865826370', 13);
-    T('28cbajpejjf18u', '264768966115047556535', 35);
-    T('1u7nolh6bd6v0', '4507977116539696462', 34);
-    T('54wmga17c', '7244724152205', 33);
-    T('13uviq1i1r00087sqj8qncs9lo8', '1529924306777719202810742088266389182216', 32);
-    T('5ds4b7nu00morbk', '6415012024329735794036', 32);
-    T('34410186233', '12187121115', 9);
-    T('47a1c4hbmma0gjf3b5kn914n4n', '381569904666915560937256750088358248', 25);
-    T('54ttopkk9fmtu6764m54', '111825156831061493422412579685', 31);
-    T('mgn', '18989', 29);
-    T('10505055444011541442103154442231040330004242', '3299912455302280343771981626079042', 6);
-    T('7g38gcdfb0972cd176561eff', '587323076724641878770901613469', 18);
-    T('49106l58aqblku24m2mc62shsm30p9q5j3', '1474965748795651704391869363110766509836712354573853', 34);
-    T('50258', '192550', 14);
-    T('5025aa24a', '4090471668', 13);
-    T('17515037027696b9a135497bab85868', '384282956567691349139467954115216', 12);
-    T('573j1fe75j8a9f29ii7d34cb3jbbf', '14387834859916761337851572818723836635', 20);
-    T('186b6b31486165c0bc8c778fd49af12ea08f7dad332', '571028668500605890623232664155788301681845784466226', 16);
-    T('2313123220321101131302220130003331201011233103120', '227077642865109202959441786072', 4);
-    T('7eejonl537c40faim9b', '222874151472317796433717213', 26);
-    T('8k0oy5j231dhtdv5t8q7w5', '2283030198732051810335111155170075', 35);
-    T('435045040612115113266114321225361030034215', '202006427408006640757853847254122093', 7);
-    T('2akkgn3g1jsabehm6kgnnrpl26s2t4b', '3329280104777703639665143207138900680219128971', 32);
-    T('20', '40', 20);
-    T('111101011111010111100011011101010001111100010010110111101111010111011010000', '36297363457553334775504', 2);
-    T('3222123012301022200330013311022', '4222998842413448522', 4);
-    T('a2587983019413965124039', '832724865093143284531509', 11);
-    T('akej63bg59kj4okd4oh5il012j8j0p', '1167589559975024794478346165128293255822901', 26);
-    T('23c2he446d2g0a6gdi0fdee2gb6e5c', '26583275300599088108871698596507139368', 19);
-    T('1jkeh637ms7gofnk8ood5i5kk1j22d', '4312562387308133742326791929397236729866296', 29);
-    T('78837f5f773015da983e', '1792798252228672996730116', 17);
-    T('1416c69100c21b05a22264796b', '9291730109537657404686437398', 13);
-    T('93d8a93d28', '191813134864', 14);
-    T('394a2167461768638586b2914b0b80667386548658', '667335229599904318812161808924349330646817188', 12);
-    T('1wdsuoqsut7um45fo7d4', '140917464962232105605575506580', 33);
-    T('4icn278aa75564g6j2olk7kl7fl5ga1n', '102797064941780765797751135934146317345959423', 25);
-    T('9i002055a4hi6jaaadg3', '51904577968178133729685523', 20);
-    T('1cvfqsut', '72490601641', 34);
-    T('fj2je594k1j0bhf93b2de72373', '18079705921653558686576826974593824', 21);
-    T('4240320213321034004', '17415886111754', 5);
-    T('711966f187geaeb5bc7d207e32a43da8265e186864g5', '573279130756576280449162350505323079502754368266400507', 17);
-    T('49271274804b36c488411958c67c8bb9c1486455', '130788357055261430585631300892818257979129537', 13);
-    T('2dj4ib63771dfig859hcc0ab17hc03j', '2897080031583056937886505492750169216079', 20);
-    T('2aef3ee6f864b26772c23cf6', '13287600730756091106849602806', 16);
-    T('frcnn9hib7eog6f34l23', '628128512915374991101180138563', 32);
-    T('1010111000111110100011011011100101010011110000101011000000010000010011101001010001111101111001110000010100010000111100100110001011001011110010100010111010010010100', '7958075089772384277251993017934409136873707500692', 2);
-    T('46h51n7bh5n7n86njh37fhihc3d79cj8h', '628335332219766512635376856539379172420010897', 24);
-    T('pciq4mdi1q9q22q9n3g', '2848254632326814305960656020', 28);
-    T('1', '1', 29);
-    T('2f826f687ie3h5h39', '1815538753739148366869', 20);
-    T('85224600844450714154447', '8452979833566085087057', 9);
-    T('2ncrhr4rasjjeqaajq4341jr09r', '1642784213600589272925380877043975840644', 31);
-    T('a00', '1210', 11);
-    T('56c717da4g7863c4127229b838b42dgbbf7g1132', '5242908799066029717292077136248328396959421188623', 17);
-    T('293684b63150b4456438340064cbc788c4b01', '34310245908660290962930216560562702368986', 13);
-    T('40cc56abcc240', '94978404251094', 13);
-    T('218903cf27a47178b456e4cea5e470f7ae51670db5', '586417501992499293536891609375926193432812131092364', 17);
-    T('d15wq1nleg7u549dadd0718e', '2183292000236241138234881147030692666', 34);
-    T('1113023440200122202434101414400101', '147253000878996390387526', 5);
-    T('193c4c1a69add29d9a5101ced0568697d923', '2198325248780085112365807036920470754023715', 16);
-    T('11a507516c68d662f15d9', '1333191524844399246644697', 16);
-    T('138246022172800612014535', '12723226204164688321097', 9);
-    T('2f', '67', 26);
-    T('n9bbffps4ij483m9p4lfeon74jmdernad', '4319880888388973123665036793081840398907295990013', 30);
-    T('9nrr20re0e90il9hi49fijfrk3el', '11668527008401372147103143919940731784397', 28);
-    T('110200020222202010012012000002001020120022212111121202111121101021', '14508751609178069453862292358287', 3);
-    T('401014110441023423013340310213213401002003324434144220111030', '701341637605553414959898651614073338832015', 5);
-    T('16d1438563c3dab89cac1b8a2b02c9ab92652cd016087', '402145454893768368538070238910742261904151734958103', 14);
-    T('16c430ih94bdgcd', '1078369041154387027', 19);
-    T('6rrmvjny73f40mqhlbav2u92ly8xhs0yl', '174704136528249902816525420461236150502024477152961', 35);
-    T('6h0g8ijlelligfeh699i4lfm4', '8948723159164161623690376517243348', 24);
-    T('909697005b', '186948429217', 14);
-    T('205ftjhgh6bthp9i71h51r9mrade01sii1jkr', '301112010317868572084712100360200322156165974734024727', 30);
-    T('20ij24h4d1j9jj50', '1890604943011908121375', 25);
-    T('221011001021222000210020222201200120101000', '101921456153063705544', 3);
-    T('m2nhkcpq0r16jd3jgm', '160361482760888867774119965', 29);
-    T('14065304637358947988886', '14065304637358947988886', 10);
-    T('jg2ii78j380j', '6924453033870937', 21);
-    T('mi0m64bfip6rsb53ol2oscllcoe', '2381613436643734921316429121959549049180', 29);
-    T('11101000111010011101011001100100101001110111101110110100011001011111101111100100111011111100010011101111001010001100', '75584728662217792152893436906631820', 2);
-    T('90169650', '90169650', 10);
-    T('0', '0', 23);
-    T('9m7fl', '4504599', 26);
-    T('462207311743', '41106117603', 8);
-    T('apjbn7lln0l9xau8pxi', '39637920958143725832613021304', 34);
-    T('127dc0ab6f59gd8955b', '16097431569685397455342', 17);
-    T('273h4fd', '81667075', 18);
-    T('1isgbdtssth73e6es382gs5k13rci6ob9u', '74377241800512845181909478165136810275516650892606', 32);
-    T('3', '3', 25);
-    T('ad4684a', '124002745', 15);
-    T('4aa54680539bb5a81c6a665694717a30a525a0045', '1744843150071734423605691580172448713985937039', 13);
-    T('5c8n1tpje68ud2mu125nttg62entnlc', '7683611140873419478117143666838299771020435116', 32);
-    T('fa7f', '187971', 23);
-    T('22215', '3107', 6);
-    T('52a326814a947496353844318285bb39b066903', '534626397264431225021347981842706300601235', 12);
-    T('322011015154252234042', '12393630663355754', 6);
-    T('a2669c148f4ea9e', '731388268367899294', 16);
-    T('5d10e2dd05007', '12587319228711547', 19);
-    T('ed2a498f218583395d57871', '4587441849070983049702111345', 16);
-    T('16bdq35kl27kdjj71no6sf4k0', '152793950271880209148219854505487346', 29);
-    T('10431071513a9ck3iaa47hdgecchf9he29', '43381023423292724420039310610763756891127936', 21);
-    T('5dbf71b1', '7269656621', 20);
-    T('10011010111100000001000010101000111000100111', '10647241395751', 2);
-    T('jpkpcjbvt1kvasvw0o3', '42599410634040128543688914739', 33);
-    T('128308731332831865326', '16111972802247011835', 9);
-    T('35434021473746', '2030987278310', 8);
-    T('127cc6cdaf7qa1kc', '3203387745871429565940', 27);
-    T('10766710063735420744724674434722341532775011206477', '200309946175742618027595387139557376886377791', 8);
-    T('32112213201233103231130113312210200302012032213313131032', '4657944669466625109696536299665230', 4);
-    T('1bn51ig3p6da10fi41e', '83689955139542057791275209', 27);
-    T('14j0emmo11eae3de0agnk4ff', '169171441207698617319338544456015', 25);
-    T('1102002220022000112001222221211021202000220200', '4169673548357936837733', 3);
-    T('7', '7', 14);
-    T('340204213', '6175089', 6);
-    T('1e', '32', 18);
-    T('18c7c1610d38c2a024785', '136841031302109468114513', 14);
-    T('31ueglor3822uu3gf35hm7gje1qj9jt6pe', '50259653982330318278094715762420803895196428266256', 31);
-    T('236321451394c64', '8928832987449509', 13);
-    T('5cslpmcp2rs872s2fr8rc2d2squils2w2', '21087793377200031159635076834353655172712568202115', 33);
-    T('10gf', '7178', 19);
-    T('7d0i834f9lbf8dl7977c1066d', '3633925888734055009195256007865654', 23);
-    T('7iswwap4lp8p8j6i3pu2qnd04', '21064442780596247994135825814304247484', 33);
-    T('1101001000000100000001010101100110000010101111011111001011110100000010011011101011110011000111101001111001101110110011000101001101100111011111111111011001111010000000000', '613876598207563084074184752663166261629198587982848', 2);
-    T('r38bdsmlfkj5o5fgpn2sr37fh', '3394192241536374888033574057729932943', 29);
-    T('pen', '24482', 31);
-    T('1000100010101010011110010010110101110000011100110', '300531517677798', 2);
-    T('374680', '1894648', 14);
-    T('8a814d4d17641016e7', '857434943927347654942', 15);
-    T('995aia8i7i534cd5a', '407923137231020478898464', 26);
-    T('2', '2', 10);
-    T('ei0k088eed6b8baak8863593jk5jg2f3bj0ce', '5914160321016074730951144567079146927255110936222', 21);
-    T('605d40ca01bba94b5807', '36039226245164182578223', 14);
-    T('2691817922ahd8h70hgfg450i6c', '15587210948018755081634733837607332', 20);
-    T('22i4', '22664', 22);
-    T('292529d755fcad39c17', '35683399481751866213677', 17);
-    T('37a1997195385c7547', '31127908670407785724', 13);
-    T('3cfh6q7qs3e8jee6tkjlpqq9a5i8itae', '21107782523772991850229603406241369125689392414', 30);
-    T('7258001566030', '2060303030955', 9);
-    T('1003141020014213142400041342114334000420', '1868009637795830437567875110', 5);
-    T('2610ijgk2', '86541700184', 21);
-    T('1msi', '47658', 30);
-    T('3411241353543406436103214661', '236290896186624501227090', 7);
-    T('kqqku6nh', '886989350792', 33);
-    T('9dg966gcfea13ibihfhbi5ab3dh91189652h', '33298588133944531766622520550241012455771090057', 20);
-    T('126d4x7', '1644209985', 34);
-    T('b38kcknna398q', '12799947735241434394', 32);
-    T('119597325350', '333730723810', 11);
-    T('44toq1pb0t6sg08i2s76clauklu2ma', '73890216568631498105831170089909975464059440', 31);
-    T('10100001111011110000000110100110101010010101001001111011110000101000110111000010000000100010111011', '200464110595405607835630307515', 2);
-    T('qpkff9xbvnrd1n8t', '3872892307770646972701359', 35);
-    T('15c07e8c84e0c2bi', '19681700319754445162', 19);
-    T('13575006b4598b303a5410114ab2769b9578a58a237', '2728161815957558299608324450916107759586273483', 12);
-    T('17l9ag', '18489184', 27);
-    T('5m05rwmt4y', '443630110370824', 35);
-    T('3ci69diccggg440b5', '2389318437192755872225', 20);
-    T('1idml3gk', '80950718952', 34);
-    T('127928787d5515718a438393d750a759455ca565b34', '1621680550245507449770648650226492957703885128306', 14);
-    T('6t0gwhcj9gtqhtqv1e8vwinisj5r83mng', '26914594023358001953145365010867100117166476629602', 33);
-    T('66rfq', '10393190', 36);
-    T('l666idhbjuae0g3068871ejrtsokejq', '30248459681883725436709460504274517072248715898', 32);
-    T('150620403643664355463463322516301634404212612006326044340316311', '43130882606292506635424332740606360103280488114152080', 7);
-    T('41862475647386600025768161687222', '1609441597409751564405007398428', 9);
-    T('265bb6js6mfj0thebap9qw3poall', '2273949182220992377824887028606074878128297', 36);
-    T('2e80b229c', '145582396026', 22);
-    T('448hp32fj2m6dg3fm759hf7mljjpn67n1h6fmo', '94146978337401409225278981432841045277813022960667856', 26);
-    T('c530a0916607a5c2671239577c4a97', '2499620725800614133816439595702949', 13);
-    T('97k68ef0g5jaj5d423nm3823', '518314667420525656062603410445363', 24);
-    T('1252', '320', 6);
-    T('754125931534429694233291', '754125931534429694233291', 10);
-    T('3fg8dg94585b3940c4cb6e07f41bfcf61aea', '334073125271035216894226588458437368734495030', 18);
-    T('1010662343214312332313544054462240410550513026053443303634422611', '178309037555490506292600092100168566672657290807577202', 7);
-    T('30wc', '129757', 35);
-    T('4320aaac', '266240883', 13);
-    T('1539a246a76a609648858', '26736559541986486658071', 13);
-    T('4', '4', 33);
-    T('29gefgf8fg2bbc0j2gae2dfdg5aab081g7523edbad', '547963388106591613005337267146277208966777017739948613', 20);
-    T('92d6a085a2c34a7428ed', '203795832889664860683148', 15);
-    T('264652754111247167745300734100146216146065', '30046186741840723600384513771105209397', 8);
-    T('23b62849704471426559815', '1286298360248279428215377', 12);
-    T('222h1338d29055hgif', '11581651006107396744198', 19);
-    T('8b7e0', '4473522', 27);
-    T('1717051362601647', '67007056380839', 8);
-    T('420547635403', '36601543427', 8);
-    T('4n11affqj', '1822050938139', 28);
-    T('101001100001010001110111111101100110001101100111011011101110000011111111011100', '196072603810916493443036', 2);
-    T('kjj3ich1hi8927', '3235928371344402790', 21);
-    T('1026cbcceedf14b4084c26ddb8d60', '28586225584974591487797016899842612', 17);
-    T('5100303210200143452311', '113393272692833971', 6);
-    T('31c', '3312', 33);
-    T('b8a04fb11aadbgcd194aebfcaa140fg85aha', '986969674191993486338612160880717878632568844', 18);
-    T('qx25up2', '41667188532', 34);
-    T('2042243400202111330011234030111430404114414112200340102313410330022024', '3694289161066978099428391349384630089650597110889', 5);
-    T('7e4cib6408d', '128053581918877', 21);
-    T('3dkla1bq60rov4', '400737723756673959989', 35);
-    T('1112001210', '29937', 3);
-    T('11000022220202112001012222221012122202100012010210220211221201112011000021', '90389162760212801316792406240633498', 3);
-    T('104402113303233132403332320314443334301340343223200420040204122102', '3232890541201633751697810007380727413369989027', 5);
-    T('31347902', '31347902', 10);
-    T('du', '472', 34);
-    T('111000100110111111111101111111100010111000011111110101000111011000110010110000100100010110010100101000101000111100010011110101010011101110011011100', '157803884622143105853315584471057717069995228', 2);
-    T('2la86sdx095fp9olfp3cd', '34638184595229945075220814528557', 36);
-    T('mbppcgg', '16326236296', 30);
-    T('ik3heeah89k44040852hcbjdad1bd0dgj26356d', '3328101869145288095897995482276848932558602785015740', 21);
-    T('248lhk5e9bh6', '2087440191630642', 23);
-    T('48b381a9cc6bd2259838e067176d166b03de75b48b52', '1710407976429394820093761786315250202911786143975802', 15);
-    T('11120241101421342112022021114234', '5852950522529808769944', 5);
-    T('10a86b3888445869a814001084b9b71a27b8854486', '189496275017394315065342874001655116260299430', 12);
-    T('113650166605747526017701737745742053073656134564465203303', '443294363845688739540957905727674168806539626088131', 8);
-    T('1403535540244734200354', '13901404808061976812', 8);
-    T('oi2e0u6dv564iip091kv1svcs', '279954224614775983979370462509946073923', 35);
-    T('3m81k0kg3dk87dhgk8e605k9c', '1907459221327034327466909784285991', 23);
-    T('122463220110011161460202464352', '4317537278759647032243456', 7);
-    T('12a2112333a', '32837849428', 11);
-    T('343e', '55524', 26);
-    T('7', '7', 9);
-    T('5340a04h093ha55', '8454246524189420105', 20);
-    T('1t6597dtoc6a60r96asbjt2kkdkmdhgdg', '365699081636314950725064929820331423361435603806', 30);
-    T('70accd12646c3668ad5a94bcb5a46a9594d615dbb4', '691498804549708730481403267581768571471127086226', 14);
-    T('14231502342125123444', '1058783927560948', 6);
-    T('h16uh99gks0oke4jm1', '1112042758022780182454147425', 33);
-    T('180235996184901794802', '180235996184901794802', 10);
-    T('199eqcuo494p', '33035755412380307', 31);
-    T('15vcnwm360nhtrsdcg170j95ic9', '16344915028963724309159916980885883220604', 35);
-    T('1fbbac5129573', '558254565528947', 16);
-    T('74712131706533505237435313', '287567912644119793384139', 8);
-    T('2120102201101112121220222000121120121200212022010202121020200001022', '79471474421937214637587196749697', 3);
-    T('6k56ciqjbp09cecihitc2s9ci401s1o', '1373800350782015189643171446697543684559252254', 30);
-    T('483911671045098021', '483911671045098021', 10);
-    T('6ls4rklq68eg57k39771ongp5', '1901116087770507341357362812137376155', 30);
-    T('62534342550506655221142232301622406', '346261030417237040471354955721', 7);
-    T('3d3gi2aec6h4iaj274341ij04b8adb5i6424', '12574335526418428815722193942856616209362929644', 20);
-    T('9dhgbffi73bm8ig6j6gmb465bgfg', '56087289901202292671877462355609399160', 23);
-    T('jo0mgo65i01d2', '1189795222467969702', 25);
-    T('2fmgko7cif2id3n4', '7641584157166496651380', 27);
-    T('11ers038dn31h4q0jwwitaigbls', '6861444888213865174920042415409636982706', 34);
-    T('38204aa633aa43727a069aba97ab5495546', '18117724934806126020578044715213143494', 12);
-    T('4383536346071054764058653730600', '188091218363927447542822724322', 9);
-    T('16195113650897769995630', '16195113650897769995630', 10);
-    T('b07264b2abe1878a5340ceead0', '2785665573207221854518665183445', 15);
-    T('2sfd3nd98gbq14g7j1q57csr07p3eenjlcr', '492057936249730728996372928617044050859159675362287', 30);
-    T('5b5192543b4a303561a88b728', '473197943789271561906525776', 12);
-    T('1b91780b06a70cf46e5fa0fa8e63407e80030f027a', '40291024919626546988689644749021723762456102109818', 16);
-    T('1hvatyxzin2h7omp4c2vx1ngdnegv7pzju', '3412107642788556261980502714401988369603559696843578', 36);
-    T('4bjd23t2r9gpt2dbrjpwtuw', '11115017221742953718461821513987449', 33);
-    T('8302a02', '14659515', 11);
-    T('p5rfvi61d3hfog2h9tabq5lbaa8h9lr', '35942528587984060838184369332151588523281524411', 32);
-    T('4g34hp2kfaa79kk3dgfo0emn528609', '499893475952157966556029154241504867485217', 26);
-    T('9k8kf4kea69420f4b85h42gf9if75', '104943512895974446884235378529723561312', 21);
-    T('3gdjkct3qhipsqae8uz', '35635251197434521507651851867', 36);
-    T('66kk1e4bk592m8dk', '1679888991376791562911', 23);
-    T('3', '3', 20);
-    T('10h6pig', '316807208', 26);
-    T('iq49obnbtrfnr97tl', '22747999482124841946226613', 32);
-    T('5136777371700436', '182450142019870', 8);
-    T('23gddce4e', '15588339003', 17);
-    T('53', '93', 18);
-    T('366abb213203b8f4cd9e1788f81deegc664cb', '5191961241144177945785597152999737524951590787', 18);
-    T('5c171421', '2343354801', 17);
-    T('5', '5', 36);
-    T('110113511313646244303100', '31375848110336055984', 7);
-    T('d62116b5b5eba94c98e1', '297260523753065332755511', 15);
-    T('25a90a2b75d596836e10d26ec831', '763841862190387816235893777156145', 16);
-    T('25142514424542535314551544304432', '3822616861518711367435556', 6);
-    T('1', '1', 22);
-    T('60gcc66e9d5h7i96g84', '629571193297266217720396', 19);
-    T('557', '2537', 22);
-    T('57b890a83c6a982606918', '106570504349447291847546', 13);
-    T('1ko1l0ioi13ml70237k46e', '418030558143625054474397580789', 25);
-    T('gjq69grls56a81maharg3k1h9ne80k3gb8', '92627603492627444203230902129810925855579328295738', 30);
-    T('198e45c5b8957ca80347ee693c5', '6210993456975719701341596528735', 15);
-    T('1c622c6a62cbcb908073c', '37242012395034880960188', 13);
-    T('8067bcggh07c550c58312f4gf730feajdgg0', '27542586791389756078137842819468361236131150720', 20);
-    T('1339017669669006742006795785006474', '1339017669669006742006795785006474', 10);
-    T('110110010011000000100001111100110101001101010111100100111001000111000001011100011001111011010100100000010100101101110000110010', '72173098483072489213930426080106306610', 2);
-    T('1akbifk7n24n', '11471452525560295', 28);
-    T('11010011001001100111100101011100111011011110100100', '928648793405348', 2);
-    T('692a2496995', '419167655681', 12);
-    T('374e3f2798d3b581c2335f3cc', '4554993763503222341647341469656', 18);
-    T('5rsbkqfkfcoj29ajdi', '630903110773372341792602744', 34);
-    T('33300232000244330423420200441024144200431020022134234241320011403', '2017080979900182548533705442612218309222032103', 5);
-    T('d8e68i33ekfb03hli', '40331655796578387904428', 22);
-    T('9ckk1o6p70dhgk60a3kjkekfjn05mef3g8oh7h', '214478514683523014526073551129543814424042054284209707', 26);
-    T('du9ofj3b04aecjm6i8uk222wnj67mumte', '54453279705597662566198782922581780169626751344881', 33);
-    T('a985nf1qf87n8f938gfp3gr4k81g9gjca1o', '165026316421448486404656724055483635522214133933780', 28);
-    T('44554275695', '114358237746', 11);
-    T('6c70a1aa65089aab372c819690a90c6898', '40090597115431771839762779123955361890', 13);
-    T('86044b053d0daaa6b', '18360481564891608503', 14);
-    T('b9g0kjlh7ic1gd503k4he', '8071692227413319882891853540', 22);
-    T('6b6lgm8glf152jl0ki91aldk2lo5n9c', '475619065001030234952948540234894886223466110', 29);
-    T('87a7a8', '1405170', 11);
-    T('1a7a31c5863d7402', '272823800502213130', 14);
-    T('jcjj6h518h1472jaj', '12877770189538637943819', 20);
-    T('1cfxr1lh5ox', '4919839455772689', 36);
-    T('310288811367762633415531745156071681653', '5684663159794685190217985404311834111', 9);
-    T('14037', '9511', 9);
-    T('21304440200313123441220313012000130041114333011322430023430432130', '1261979446859029545623380849346186459988139665', 5);
-    T('fbd45cc9e2', '1081599642082', 16);
-    T('519c09d40a70404490053c29b986', '45172525747251864110145361563666', 14);
-    T('19', '45', 36);
-    T('j58dfca6dnhf0ncbn49gkgbm69a2nlb0j9ch0', '936333578326698695534344960444912288238423306547864', 24);
-    T('1120000152232022252110140241032312245311023234334032342030250', '59734827155605610430522117739886928577205767446', 6);
-    T('18kakpghglhn6hnp7', '58343831352748592126197', 26);
-    T('3204102231020302334334000041132202', '399742489157707275724052', 5);
-    T('76r7khersf2irrlc07pm', '44183444942343119517736482557', 29);
-    T('10110011010100010000101111100010111', '24067464983', 2);
-    T('9049021262545393024579091866492398542902', '9049021262545393024579091866492398542902', 10);
-    T('3', '3', 26);
-    T('3veoda0voe2luvu4k', '12515452726305126989433740', 34);
-    T('1s8uc49044sv7fuccu7', '18407131120081731496593356287', 36);
-    T('5dbb78e8bkl9', '8462954128212225', 24);
-    T('31k43g71i6l49knimql', '342583482343807445741585613', 28);
-    T('kik9bjahj6ego855e4p747mcnj46ej11h49763', '468224983002703595759182810826586464545958811319348899', 26);
-    T('13442134313121140343404', '4281453440168604', 5);
-    T('7j3l8g4pm64k892n3dpbfpl1', '2709736655099210675851690721591311', 26);
-    T('24cg6b802a04fcdg5ae11fe7fg6ffdbg4cf0c7', '7666093592391929958225523158661060374109385283', 17);
-    T('29752369384011377360244601230116502477113293803222359', '29752369384011377360244601230116502477113293803222359', 10);
-    T('5c7ch4dcfjl3m5ca7c4dd180ac5', '4235317763416835730488450279827445669', 24);
-    T('2035677377165', '141448576629', 8);
-    T('1014', '6882', 19);
-    T('50amqhdu1dahb479ah6hefe0p18abc1', '2759244699893958338366015509269119092121474036', 31);
-    T('31solno38be6ms7z0l32lezy', '1902149044738223750663383610950532398', 36);
-    T('51vaai09fb1a015ap7ic8e2dkdid0d13', '599793397183230055183156703483234422199767481181', 33);
-    T('ef9g06g61ga899g028ahi376hfb5ad', '179724417572923541328982412809644535193', 19);
-    T('30461305635630120110', '35333469582885698', 7);
-    T('304320404024431014001134123224020123023411323323310331123', '4423498436624887900904435210623464152038', 5);
-    T('5tchpra8cb7gljnqmln', '12687862955738067803782907150', 33);
-    T('1a9c03j1ifa7bccc9gj407lj3ma0d46akbp', '21869065306730387940320360093107271014796230532621', 28);
-    T('90ag62b53a29861ge4h90', '115163310974925364653762918', 18);
-    T('621e835f12ad64e909cf7', '7413676543182627283180791', 16);
-    T('2', '2', 7);
-    T('7630b7863d3f7j2dgd5bhc200d0f68gb5i', '313413466559810937691188229453692824598698991', 21);
-    T('73g65db', '460210271', 20);
-    T('89a53768777804667091962684a82141855084708827488a283', '104534620147629781560246588908903729115824398664090794', 11);
-    T('4nehl018cm4eha03ch2nhc7qr0o4sk', '12351795250155371862634726792610964318320229', 29);
-    T('36472233456', '12991747029', 9);
-    T('32d0113076633053bg7b3709g318g996c6f7', '36792759299975206676907084433244583181437716', 17);
-    T('13mkp5t2fulgpft1', '66633458682354245995171', 33);
-    T('ait1ia1bl303ms1spcn2nr2iiboj9ent', '65672776682779904820651918660598404908077846319', 30);
-    T('3abhdcj86', '90360583766', 20);
-    T('6225d58f7849kc20437131', '35642008659327399615108918817', 21);
-    T('53pl04gjp4hag07ahf6gqqml', '22162199821100339000975528379110427', 29);
-    T('g06', '5190', 18);
-    T('20p98o15if0p78l6720837', '1055700859046956086847060755701', 26);
-    T('53i8', '48014', 21);
-    T('epk6lkjbak073be', '1636219455447096840209', 27);
-    T('222bbibi7c8gfg30664781e67i953j', '113089149702236219736580991019929354079', 20);
-    T('216qomeeo9db41m6k03bbb1j9e', '1244900192918777003082880510514807396', 27);
-    T('11b93e', '849209', 15);
-    T('7mifim9aek5b', '12095932884795779', 24);
-    T('b4b46h7bae18d8bg7deb', '7972552227341225059016915', 18);
-    T('207551b6c0195', '115523483441287', 14);
-    T('3p', '103', 26);
-    T('197f9idk9iig0l3bke9d1k62cgc8j5a79h', '284292035870134579813298295972717503315861875', 22);
-    T('155963d4d8h4f8i1hbgcb', '132504736945942923398014651', 20);
-    T('304801222557410412641765610074071503', '7660601613972756521838449165642178', 9);
-    T('a5f39b2250eff541ech35162ea4', '4476738604960162450815500774841664', 18);
-    T('54a88663121c64617d71b4a122209cd2c0390', '11605880739459970698798281924031905080986435', 15);
-    T('4ab695565b5', '666873944885', 13);
-    T('5ca1md', '78319993', 27);
-    T('3qslq250dvz741jhl8', '1072784063532716370614632652', 36);
-    T('185230488c4261398a2544cb00c34742bcb23288', '45731671516320241574807720089017159625203497', 13);
-    T('24141422340244200340140401', '856829699562036976', 5);
-    T('17de6483675cb29063c', '7044803064789933295164', 16);
-    T('429850987a9175209439859143545288466071015673385618', '4548955205287866147144947183033535389148611528651380', 11);
-    T('83gc50deckf7g2i95i3fk2f8jjjb7hlc5dg36', '17356768087450686226472673111107289905971168186576', 22);
-    T('7344c055395b32a41819c', '137912936874177212298706', 13);
-    T('1011010001011000101010000000000110111101010000111101010101000011001110001001011101011100001101101110011011110101101010011000100110101111', '61368670450547755504412274420309228620207', 2);
-    T('1000011111100010111001111100000100000000111001111111100100011100110101001010011010100111110100101001000100101000100010100000001100111001001101001110011111100000000111001010010111', '203364476148734435560803274724374642023080004086166167', 2);
-    T('ah3g35d548ea4bfh9d1fc292h94e193feg2e75dfb', '1780619835592323113116024582457203219155826657157669', 18);
-    T('855mqlyozhw069jiod', '2333132714739048924227135053', 36);
-    T('102022201201110020112212212022121021200011000220200', '903223172393847799242732', 3);
-    T('9bhy9w1e41l55fw61', '74170005765265656927173017', 36);
-    T('h592d8637d2dd0k5163gj', '4801712957170939177303758961', 21);
-    T('5', '5', 22);
-    T('2', '2', 29);
-    T('12000150142656341264053255555626', '202870200111145673769893502', 7);
-    T('257e51f', '107482369', 19);
-    T('2ecc612', '49071634', 16);
-    T('15355035253621352061261230366305602135543424420434543365', '54172534486662629705202470905166502672672269648', 7);
-    T('249h996cke9b0be5nc3l70fnc93h20ibg', '320569955418628440453489001255451094189328792', 24);
-    T('f3adom1ngq3u4irb01s2j4', '314624319053987691295478037262950', 31);
-    T('27a12175892a7a0160424168a35996613950b421869823b5', '1397433081866498613503527062681137551712252447761337', 12);
-    T('340632544630522633415662322031104260443650626022261224', '2214784384390370140259383269354114041805894388', 7);
-    T('6q6nce5eecdqkdkmjnje4mpchc', '4241070534916309906119738425533045869', 27);
-    T('113235054406626436112', '96665647902597209', 7);
-    T('12101301021001012300301111100123103322132000323213300011001223332331322131313', '8959721927373131398259946028619287042425595767', 4);
-    T('16kr4', '762808', 28);
-    T('2854737432023865746217633237845436746', '66621795309306392625749774020755759', 9);
-    T('19cb300183bb', '3169302143434', 13);
-    T('1012555568138a1b741846165585aa7b35a3b49475a', '2134175130500831128858578786794170081433983030', 12);
-    T('271106223317652510470133141417013436324344447232', '8063865882119118770028661617297344888458906', 8);
-    T('1j1', '1317', 28);
-    T('14bb4a5d83f3d4bf43b66adada6b0e993784', '1805977369681030296729705669300424034301828', 16);
-    T('1c83c397a04ac034190703b42b8a86c20119ac58', '54795371938228469135901266442543827602116802', 13);
-    T('49i16f5i7j2d76egccdde1c66ji93i82276731bd', '2471244346578176698373748682028711809826870228344633', 20);
-    T('131132', '5167', 5);
-    T('3e72bc538', '139294601405', 21);
-    T('111342330121004', '7759223254', 5);
-    T('g35', '4680', 17);
-    T('jj0h5371ddah0iahf6bh1', '5538389688853463873501657539', 21);
-    T('22pirudfu9e7mgq5ki34m731h9fngq6', '1151434291285406691472999364496269523410514631', 31);
-    T('79jcqqap3nbjkdb74jdc80qi1rl', '310580897107477820585107874712335706009', 28);
-    T('1p', '59', 34);
-    T('l84m984fde6354hgf936ug56kb8ntuo4q6', '348786713144351173808729528284372110071543438511290', 31);
-    T('5e0jot7ec7fa', '521409833288888610', 35);
-    T('20120222120202001200221101201011011000002122021022201010120111010122121222221222021100212021210202', '41942954018106129338036588729324918948010233105', 3);
-    T('93809gd4ghg1e170a', '1116205695833217173038', 18);
-    T('446230341604256064105154511213003600435153634235', '24648873732798551638045236958735680691288', 7);
-    T('1e1f', '15471', 21);
-    T('12520004233203303235', '902764818264263', 6);
-    T('13434033002003004402141124302242203344214233214324410224001421242', '970702797270984391835801113220919489871123322', 5);
-    T('5522220135303151503503131051350101251', '60854636647067381415610435615', 6);
-    T('r3178ou9caakpsh7bhbe', '587232889506503339619803819571', 31);
-    T('11344b48925c928590a9b65965790a531ab71ac0181456', '147070368225022849438278483344224755447603064318709', 13);
-    T('11132233130311012310113133213321303', '404377318206700682867', 4);
-    T('21243103211203011430314411440423000341224401022424403242114230442442334232', '2453393003559216570036598154088578511990647212855567', 5);
-    T('77138783429395', '77138783429395', 10);
-    T('e0hi', '378528', 30);
-    T('1sfro', '2720469', 35);
-    T('10a803a13b3aacb313d20ad45d79895db83072', '2688774325186814939420907831934492554488940', 14);
-    T('28c33418ca402312012c065c', '604690168281921446532949930', 14);
-    T('184', '349', 15);
-    T('2571c597721b', '20456544556601', 15);
-    T('kk6sqj7rr4hme2lhds', '150208264567193002800858826', 29);
-    T('566bdhgd6gf6f3i325i3eid7i6adf4h1h7382h', '1098869380632307597689024002479488625096341992121', 19);
-    T('48cvcjovvcps6w5ih0vvgg1ebtfsrm', '463163236652429988640359361211359679555574220', 33);
-    T('958baz1ki4nyqglpbas5lh1qksb7zikeivp', '750728967818084621222424385256922764057494617052439317', 36);
-    T('86151740892663982775089', '86151740892663982775089', 10);
-    T('213b', '4613', 13);
-    T('r7k5rw7lm1vngtxhj', '86816834093372879138789857', 34);
-    T('217025023377545890216047915201', '217025023377545890216047915201', 10);
-    T('28216429043406a128001999103968938669743', '10267451898484492247566507299193901416802', 11);
-    T('ikn5rh010c', '198281469065244', 28);
-    T('cdn3t8', '302754578', 30);
-    T('4a2681940051031157a53278652494885604968a144380017571', '636699130425199233901707564276961890453203238857370317', 11);
-    T('214001300333', '115259468', 5);
-    T('1bdec674867daeb454bedc3125b72e1582686e0c', '13235662457450871047945698439432593046607531537', 15);
-    T('1461101624363430103541030526563133043332334410035661345255', '2513783613053608388287524826007109061198917911061', 7);
-    T('1fdc0qd1nfs2j', '3466820238745915791', 34);
-    T('1ec2fd96j50ll', '21357449083341579', 22);
-    T('1021722', '271314', 8);
-    T('cj9ea1c3dd12880g3hei6c13fc1gk5e1gj192d', '108044509832522390985019647621567967006917730046839', 21);
-    T('22022a15a1242a4050a4a5802758aa2', '514622640579936481914636293866778', 12);
-    T('1d8d052c67dd79a1a2754', '165172435194406497470358', 14);
-    T('5f', '185', 34);
-    T('68771d2b5d82g', '3784863040815843', 17);
-    T('35116201514255324122021325201040', '590116123779691041518146077', 7);
-    T('7036036165443146', '248356246275686', 8);
-    T('b5ik3rusjxloun0e7nwk22bd0afic50jnwn', '351480021513874030859064287892370214007546506744437693', 35);
-    T('4457450hil348', '53898766295660932', 22);
-    T('hd1oj4rtqlkdf98x4vmxj0h3xx', '6943386874692972087645952788769858758738', 35);
-    T('3mao2pk4o2', '29204186262374', 27);
-    T('2n4cnm9w7j2g7s6kw5h5u1tz36knpqdbj', '167360655322446028749706425278701718029623161912047', 36);
-    T('264026a0ac626cd3b644714478899c', '4233598300815455570056021723238862', 14);
-    T('1132004131214141022204432310342112034223000012120', '4747410412074476042164830201172785', 5);
-    T('14c69b7', '6669566', 13);
-    T('6i8jh5495mljld5imn', '1967338742655672740382887', 24);
-    T('11011010100100111010010', '7162322', 2);
-    T('2sacrn05cl5dn81476l6pg3g0jkldgltrtn', '491130187805084132256352213258420044325768153618193', 30);
-    T('7629eg25216062g0bhccc54f310g475gf2d851h02', '1193072249536776238087255066419340494300241692433118', 18);
-    T('5110242554012351311222', '113996815429002782', 6);
-    T('3pih350290ji1ba39npfee1b67nadop', '11222243968353715216614952364432075435971389', 26);
-    T('g351f93h270h7b7hki', '4691673247887821898764850', 24);
-    T('6470565', '1732981', 8);
-    T('5335763184182038172006046108484131152678603', '64393019391265736471397626369582559266481', 9);
-    T('10000100100110110001000101100111011100111010011011001101110010111100101111001001100001', '40077624010777577544413793', 2);
-    T('d37d676ed324d97e91', '28833401401805729291779', 18);
-    T('2111db1644e3db18d1ef1e0d61gdgaee5c6', '1411526454880979898913723256921011458189878', 17);
-    T('35bacc513809d', '193736987400347', 14);
-    T('14l0ii8ci49k14i991el2j18997ai', '47432159257624618593218965255177560530', 22);
-    T('4kfshu6linig20uv100p44ds0emo3npg0a0u', '222236758510407484956912068045177884120458517136025630', 32);
-    T('3h66nirrqm0i7uf35145j8', '74031708866092624643936753260340', 31);
-    T('1kcnj2glh16sc9cl5b5db31o61oirjc', '126951344107855183929498621767034725464772792', 29);
-    T('1', '1', 27);
-    T('40h0kg91a5ldc', '88364370457256098', 23);
-    T('2kgb8kg39ajji17bhagd9mc1f578mbk7o', '5312546317931594372611431312678286944856393334', 26);
-    T('106454014536a137614909484877aa42a8318', '32549768237359567248289108586482266373', 11);
-    T('102020022121120220010200010122201201000102120101212112102021202121021101', '9373515480802386787336379528216869', 3);
-    T('113jamevd0ea', '52240096897795498', 33);
-    T('4dbb076838d50e5b00b29235081314e9ec', '3183265672012968496848943540783648620747', 15);
-    T('2236k2ihi51', '35074324315654', 21);
-    T('2044', '460', 6);
-    T('8i787d5ge3dopd9p48f1', '13622774573376163046429858386', 27);
-    T('111', '7', 2);
-    T('1012645216266112554320010312', '67619419391382234277050', 7);
-    T('3103801', '1656208', 9);
-    T('25a3g8b0ggja0bc0g', '1491257047471328092816', 20);
-    T('100100011011111000010110101011000000011101100010001110110111', '656366019324289975', 2);
-    T('2hy6l5cg1dt4ggq62', '19885494590425537842223226', 36);
-    T('gm0nqp0hpr4200fnkk9n', '102288227674562835100668366757', 29);
-    T('t9q0hhsxm67aglisrrvnl', '124812001386691713133980119986343', 34);
-    T('1757193', '1757193', 10);
-    T('8b63e2dca39c336b18', '2571294983995377543960', 16);
-    T('pjai3cvvbrto2t7s7vv5', '1014281637785517689396544143333', 32);
-    T('2l', '91', 35);
-    T('27a', '565', 15);
-    T('164qesjrk8v565v75ffd6wnf909to5h767k', '13879928000835241925467631555592155788584903540287490', 34);
-    T('9b8d19742d4', '2843752747826', 14);
-    T('b30f159f05chc4h', '4186384634788528049', 18);
-    T('2dbq', '102086', 35);
-    T('12f67hg2a8i64jbfhlhfk5', '17420544768736569554233288737', 22);
-    T('1100', '12', 2);
-    T('hari895bivb6v7ur8uhti8b5mnaq0j55to', '2237261580805951883828359760940720036427289454035019', 33);
-    T('1731mf3', '604246471', 28);
-    T('377e2roj', '137186257447', 33);
-    T('161d6be75eb7926a271576e8e6a07e67513bea4c6', '155734848943868815828395124475901609082268815461', 15);
-    T('200212032120020222230330311120311003232310222230102113323103000322230302220301231111032', '12196082923051903043941661056550160063059733091112270', 4);
-    T('31bl50i5hfnj2g92205knjn8m26aoni1i4n969', '16193982856683928575461552404913450912093921320287034', 25);
-    T('66h', '3053', 22);
-    T('3uqesuhcjwdakwf4g', '7780167401827423762290433', 33);
-    T('2eop91d5nt5193i92xfin7oiam1f9w3uvc4', '28605886795171609313172129799075303081247927522208376', 34);
-    T('129828a42a1a983', '479396571777467', 11);
-    T('qo5fjm47e83j', '149519533662546148', 27);
-    T('120930d30a1c6cca9c9c85d68a9d', '10109362297846202081439662847219', 14);
-    T('433434112303022113322421334420042341432322243420342410412010213', '103176224496584812657695985895438714073938183', 5);
-    T('2aa745d38106c55880246', '231591415358075620700166', 14);
-    T('10a23548709447811b5468951600', '147092018792966563018352675616', 12);
-    T('1muuqpq6h', '2989050560877', 34);
-    T('105h58mn7cho3e6ao1e8n8lnj3cj9k3539f', '341896959260587485518394721610662378353223908365', 25);
-    T('121a5813986070394bb7144864aa7329b9301ba', '120406122800356790683822388154769546350622', 12);
-    T('11100010020210011200001011221110201100212001011121020120012011211000002002101100102120012222', '37860101293024691849726322460894592104690511', 3);
-    T('2uaofdemihchuxnsi22cl3i60goox', '22006538653225073786749125118104638524377073', 34);
-    T('d329q', '8058230', 28);
-    T('26686dhpl7e1p9lb1qrlpn3fbmj8e4f96q', '1267711441005450956992875908126805624422712405650', 28);
-    T('2pjkq', '3291644', 33);
-    T('5ne50bnhcg8jh63h4b8gak89', '332489330535230011694478313343433', 24);
-    T('42d', '4173', 32);
-    T('7ncf8namfjbg1kk97p70j8j524ioddmg5fo6m', '6868243522317166196967869805047542008508489290755130', 26);
-    T('3c1440de515e09b31f73cdd0da6e2', '19496787444412678571409607909811938', 16);
-    T('4ml9dlae0ci8kbladibmmd62mi7bk79mack8', '2286569324205503763236162887597617701852950700129', 23);
-    T('i5g1c1039jc3bfbj3jg6250g15g51h8e398g', '62844649752973800818784289497153800322395867776', 20);
-    T('7427745', '3975116', 9);
-    T('54153260107451562218510277555707018420', '54153260107451562218510277555707018420', 10);
-    T('5aee981853bc993326395be', '428950049262896681474864804', 15);
-    T('add56j4b9hcai87c357j8ga5i', '576203698240315171997261396983665', 21);
-    T('25ea2g068b67dh1f1h9bch38f0g8h', '326308845239382288473188087950535697', 18);
-    T('1a12f68igh7e1ha195db27g5i9247g7a59', '2417780901753180332851584091382890457838743', 19);
-    T('dqgoc94ej889u5pcvhcnvmhlt5ohscn', '19737221570425505289342027022964526059214139799', 32);
-    T('2246d7744eb3e897', '942853654698726067', 15);
-    T('2', '2', 28);
-    T('2dclih6geh7hib9f1i8mjib5lf8i0ibicmh01ij', '14418043617625234175059607245813179917796405933128627', 23);
-    T('4w5q', '210901', 35);
-    T('112112113201334001133324303214103244132203441240131112102002404130442240443', '6830926531027276927950105054067971781356898029258873', 5);
-    T('156d6c3431108a479a72d969727', '877359658879832942505464566647', 14);
-    T('206143367232576283626041763949358536', '206143367232576283626041763949358536', 10);
-    T('3ntm', '145508', 34);
-    T('61216176216205012773031', '454507717401133184537', 8);
-    T('de94dkh6425m06qhqe2attru6bceaq', '