• Home
  • Raw
  • Download

Lines Matching full:decimal

6    *  decimal.js v10.5.0
7 * An arbitrary-precision Decimal type for JavaScript.
8 * https://github.com/MikeMcl/decimal.js
35 // The initial configuration properties of the Decimal constructor.
39 // Most of these values can be changed at run-time using the `Decimal.config` method.
42 // E.g. `Decimal.config({ precision: 20 });`
58 // `Decimal.rounding = 4;`
59 // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
101 Decimal, inexact, noConflict, quadrant,
108 tag = '[object Decimal]',
125 // Decimal.prototype object
129 // Decimal prototype methods
197 * Return a new Decimal whose value is the absolute value of this Decimal.
208 * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
218 * Return a new Decimal whose value is the value of this Decimal clamped to the range
221 * min {number|string|Decimal}
222 * max {number|string|Decimal}
240 * 1 if the value of this Decimal is greater than the value of `y`,
241 * -1 if the value of this Decimal is less than the value of `y`,
243 * NaN if the value of either Decimal is NaN.
282 * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
320 * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
425 * Return the number of decimal places of the value of this Decimal.
464 * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
474 * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
486 * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
495 * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
505 * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
515 * Return true if the value of this Decimal is greater than or equal to the value of `y`,
526 * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
527 * Decimal.
594 * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
595 * Decimal.
674 * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
675 * Decimal.
707 * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
708 * this Decimal.
758 * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
759 * value of this Decimal.
801 * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
802 * of this Decimal.
840 * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
841 * value of this Decimal.
889 * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
890 * Decimal.
949 * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
950 * of this Decimal.
1029 * Return true if the value of this Decimal is a finite number, otherwise return false.
1038 * Return true if the value of this Decimal is an integer, otherwise return false.
1047 * Return true if the value of this Decimal is NaN, otherwise return false.
1056 * Return true if the value of this Decimal is negative, otherwise return false.
1065 * Return true if the value of this Decimal is positive, otherwise return false.
1074 * Return true if the value of this Decimal is 0 or -0, otherwise return false.
1083 * Return true if the value of this Decimal is less than `y`, otherwise return false.
1092 * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
1101 * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
1127 * [base] {number|string|Decimal} The base of the logarithm.
1159 // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
1181 // If the result is known to have an infinite decimal expansion, repeat this until it is clear
1188 // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
1189 // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
1190 // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
1219 * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
1221 * arguments {number|string|Decimal}
1231 * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
1233 * arguments {number|string|Decimal}
1259 * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
1431 * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
1474 * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
1475 * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
1485 * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
1495 * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
1523 * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
1641 * Return the number of significant digits of the value of this Decimal.
1664 * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
1677 * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
1714 * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
1815 * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
1868 * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
1940 * Return a string representing the value of this Decimal in base 2, round to `sd` significant
1955 * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
1956 * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
1958 * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
1960 * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
1981 * Return a string representing the value of this Decimal in exponential notation rounded to
1982 * `dp` fixed decimal places using rounding mode `rounding`.
1984 * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
2010 * Return a string representing the value of this Decimal in normal (fixed-point) notation to
2011 * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
2016 * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
2049 * Return an array representing the value of this Decimal as a simple fraction with an integer
2056 * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
2121 * Return a string representing the value of this Decimal in base 16, round to `sd` significant
2136 * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
2137 * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
2139 * The return value will always have the same sign as this Decimal, unless either this Decimal
2144 * y {number|string|Decimal} The magnitude to round to a multiple of.
2200 * Return the value of this Decimal converted to a number primitive.
2210 * Return a string representing the value of this Decimal in base 8, round to `sd` significant
2225 * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
2264 * y {number|string|Decimal} The power to which to raise this Decimal.
2331 // new Decimal(2.32456).pow('2087987436534566.46411')
2368 * Return a string representing the value of this Decimal rounded to `sd` significant digits
2400 * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
2432 * Return a string representing the value of this Decimal.
2434 * Return exponential notation if this Decimal has a positive exponent equal to or greater than
2448 * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
2457 * Return a string representing the value of this Decimal.
2470 // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
2506 * parseDecimal Decimal
2507 * parseOther Decimal
2515 * naturalLogarithm, config, parseOther, random, Decimal
2760 // The digit array of a Decimal from toStringBinary may have trailing zeros.
3029 // Convert sd to decimal places.
3201 * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
3270 * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
3377 * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
3514 * Parse the value of a new Decimal `x` from string `str`.
3519 // Decimal point?
3596 * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
3660 // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
3666 if (p) x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal.pow(2, p));
3790 * Return the value of Decimal `x` as a string in base `baseOut`.
3935 // Decimal methods
3984 * Return a new Decimal whose value is the absolute value of `x`.
3986 * x {number|string|Decimal}
3995 * Return a new Decimal whose value is the arccosine in radians of `x`.
3997 * x {number|string|Decimal}
4006 * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
4009 * x {number|string|Decimal} A value in radians.
4018 * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
4021 * x {number|string|Decimal}
4022 * y {number|string|Decimal}
4031 * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
4034 * x {number|string|Decimal}
4043 * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
4046 * x {number|string|Decimal} A value in radians.
4055 * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
4058 * x {number|string|Decimal}
4067 * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
4070 * x {number|string|Decimal} A value in radians.
4079 * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
4085 * y {number|string|Decimal} The y-coordinate.
4086 * x {number|string|Decimal} The x-coordinate.
4148 * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
4151 * x {number|string|Decimal}
4160 * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
4162 * x {number|string|Decimal}
4171 * Return a new Decimal whose value is `x` clamped to the range delineated by `min` and `max`.
4173 * x {number|string|Decimal}
4174 * min {number|string|Decimal}
4175 * max {number|string|Decimal}
4184 * Configure global settings for a Decimal constructor.
4198 * E.g. Decimal.config({ precision: 20, rounding: 4 })
4246 * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
4249 * x {number|string|Decimal} A value in radians.
4258 * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
4261 * x {number|string|Decimal} A value in radians.
4270 * Create and return a Decimal constructor with the same configuration properties as this Decimal
4278 * The Decimal constructor and exported function.
4279 * Return a new Decimal instance.
4281 * v {number|string|Decimal} A numeric value.
4284 function Decimal(v) {
4288 // Decimal called without new.
4289 if (!(x instanceof Decimal)) return new Decimal(v);
4291 // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
4293 x.constructor = Decimal;
4300 if (!v.d || v.e > Decimal.maxE) {
4305 } else if (v.e < Decimal.minE) {
4344 if (e > Decimal.maxE) {
4347 } else if (e < Decimal.minE) {
4388 Decimal.prototype = P;
4390 Decimal.ROUND_UP = 0;
4391 Decimal.ROUND_DOWN = 1;
4392 Decimal.ROUND_CEIL = 2;
4393 Decimal.ROUND_FLOOR = 3;
4394 Decimal.ROUND_HALF_UP = 4;
4395 Decimal.ROUND_HALF_DOWN = 5;
4396 Decimal.ROUND_HALF_EVEN = 6;
4397 Decimal.ROUND_HALF_CEIL = 7;
4398 Decimal.ROUND_HALF_FLOOR = 8;
4399 Decimal.EUCLID = 9;
4401 Decimal.config = Decimal.set = config;
4402 Decimal.clone = clone;
4403 Decimal.isDecimal = isDecimalInstance;
4405 Decimal.abs = abs;
4406 Decimal.acos = acos;
4407 Decimal.acosh = acosh; // ES6
4408 Decimal.add = add;
4409 Decimal.asin = asin;
4410 Decimal.asinh = asinh; // ES6
4411 Decimal.atan = atan;
4412 Decimal.atanh = atanh; // ES6
4413 Decimal.atan2 = atan2;
4414 Decimal.cbrt = cbrt; // ES6
4415 Decimal.ceil = ceil;
4416 Decimal.clamp = clamp;
4417 Decimal.cos = cos;
4418 Decimal.cosh = cosh; // ES6
4419 Decimal.div = div;
4420 Decimal.exp = exp;
4421 Decimal.floor = floor;
4422 Decimal.hypot = hypot; // ES6
4423 Decimal.ln = ln;
4424 Decimal.log = log;
4425 Decimal.log10 = log10; // ES6
4426 Decimal.log2 = log2; // ES6
4427 Decimal.max = max;
4428 Decimal.min = min;
4429 Decimal.mod = mod;
4430 Decimal.mul = mul;
4431 Decimal.pow = pow;
4432 Decimal.random = random;
4433 Decimal.round = round;
4434 Decimal.sign = sign; // ES6
4435 Decimal.sin = sin;
4436 Decimal.sinh = sinh; // ES6
4437 Decimal.sqrt = sqrt;
4438 Decimal.sub = sub;
4439 Decimal.sum = sum;
4440 Decimal.tan = tan;
4441 Decimal.tanh = tanh; // ES6
4442 Decimal.trunc = trunc; // ES6
4452 Decimal.config(obj);
4454 return Decimal;
4459 * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
4462 * x {number|string|Decimal}
4463 * y {number|string|Decimal}
4472 * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
4475 * x {number|string|Decimal} The power to which to raise the base of the natural log.
4484 * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
4486 * x {number|string|Decimal}
4495 * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
4500 * arguments {number|string|Decimal}
4529 * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
4534 return obj instanceof Decimal || obj && obj.toStringTag === tag || false;
4539 * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
4542 * x {number|string|Decimal}
4551 * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
4556 * x {number|string|Decimal} The argument of the logarithm.
4557 * y {number|string|Decimal} The base of the logarithm.
4566 * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
4569 * x {number|string|Decimal}
4578 * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
4581 * x {number|string|Decimal}
4590 * Return a new Decimal whose value is the maximum of the arguments.
4592 * arguments {number|string|Decimal}
4601 * Return a new Decimal whose value is the minimum of the arguments.
4603 * arguments {number|string|Decimal}
4612 * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
4615 * x {number|string|Decimal}
4616 * y {number|string|Decimal}
4625 * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
4628 * x {number|string|Decimal}
4629 * y {number|string|Decimal}
4638 * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
4641 * x {number|string|Decimal} The base.
4642 * y {number|string|Decimal} The exponent.
4651 * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
4652 * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
4756 * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
4760 * x {number|string|Decimal}
4776 * x {number|string|Decimal}
4786 * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
4789 * x {number|string|Decimal} A value in radians.
4798 * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
4801 * x {number|string|Decimal} A value in radians.
4810 * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
4813 * x {number|string|Decimal}
4822 * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
4825 * x {number|string|Decimal}
4826 * y {number|string|Decimal}
4835 * Return a new Decimal whose value is the sum of the arguments, rounded to `precision`
4840 * arguments {number|string|Decimal}
4857 * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
4860 * x {number|string|Decimal} A value in radians.
4869 * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
4872 * x {number|string|Decimal} A value in radians.
4881 * Return a new Decimal whose value is `x` truncated to an integer.
4883 * x {number|string|Decimal}
4891 // Create and configure initial Decimal constructor.
4892 Decimal = clone(DEFAULTS);
4893 Decimal.prototype.constructor = Decimal;
4894 Decimal['default'] = Decimal.Decimal = Decimal;
4897 LN10 = new Decimal(LN10);
4898 PI = new Decimal(PI);
4907 return Decimal;
4914 P[Symbol.toStringTag] = 'Decimal';
4917 module.exports = Decimal;
4925 noConflict = globalScope.Decimal;
4926 Decimal.noConflict = function () {
4927 globalScope.Decimal = noConflict;
4928 return Decimal;
4931 globalScope.Decimal = Decimal;