Lines Matching full:decimal
2 * decimal.js v10.4.3
3 * An arbitrary-precision Decimal type for JavaScript.
4 * https://github.com/MikeMcl/decimal.js
42 // The initial configuration properties of the Decimal constructor.
46 // Most of these values can be changed at run-time using the `Decimal.config` method.
49 // E.g. `Decimal.config({ precision: 20 });`
65 // `Decimal.rounding = 4;`
66 // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
111 tag = '[object Decimal]',
128 // Decimal.prototype object
132 // Decimal prototype methods
200 * Return a new Decimal whose value is the absolute value of this Decimal.
211 * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
221 * Return a new Decimal whose value is the value of this Decimal clamped to the range
224 * min {number|string|Decimal}
225 * max {number|string|Decimal}
244 * 1 if the value of this Decimal is greater than the value of `y`,
245 * -1 if the value of this Decimal is less than the value of `y`,
247 * NaN if the value of either Decimal is NaN.
286 * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
324 * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
429 * Return the number of decimal places of the value of this Decimal.
468 * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
478 * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
490 * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
499 * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
509 * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
519 * Return true if the value of this Decimal is greater than or equal to the value of `y`,
530 * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
531 * Decimal.
598 * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
599 * Decimal.
678 * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
679 * Decimal.
711 * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
712 * this Decimal.
762 * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
763 * value of this Decimal.
805 * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
806 * of this Decimal.
844 * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
845 * value of this Decimal.
893 * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
894 * Decimal.
953 * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
954 * of this Decimal.
1033 * Return true if the value of this Decimal is a finite number, otherwise return false.
1042 * Return true if the value of this Decimal is an integer, otherwise return false.
1051 * Return true if the value of this Decimal is NaN, otherwise return false.
1060 * Return true if the value of this Decimal is negative, otherwise return false.
1069 * Return true if the value of this Decimal is positive, otherwise return false.
1078 * Return true if the value of this Decimal is 0 or -0, otherwise return false.
1087 * Return true if the value of this Decimal is less than `y`, otherwise return false.
1096 * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
1105 * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
1131 * [base] {number|string|Decimal} The base of the logarithm.
1163 // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
1185 // If the result is known to have an infinite decimal expansion, repeat this until it is clear
1192 // The above result correctly rounded using ROUND_CEILING to 1 decimal place should be 2.7, but it
1193 // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
1194 // the exact result would be assumed to be 2.6, which rounded using ROUND_CEILING to 1 decimal
1223 * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
1225 * arguments {number|string|Decimal}
1235 * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
1237 * arguments {number|string|Decimal}
1263 * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
1435 * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
1478 * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
1479 * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
1489 * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
1499 * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
1527 * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
1645 * Return the number of significant digits of the value of this Decimal.
1669 * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
1682 * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
1719 * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
1820 * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
1873 * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
1945 * Return a string representing the value of this Decimal in base 2, round to `sd` significant
1960 * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
1961 * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
1963 * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
1965 * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
1986 * Return a string representing the value of this Decimal in exponential notation rounded to
1987 * `dp` fixed decimal places using rounding mode `rounding`.
1989 * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
2015 * Return a string representing the value of this Decimal in normal (fixed-point) notation to
2016 * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
2021 * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
2054 * Return an array representing the value of this Decimal as a simple fraction with an integer
2061 * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
2127 * Return a string representing the value of this Decimal in base 16, round to `sd` significant
2142 * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
2143 * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
2145 * The return value will always have the same sign as this Decimal, unless either this Decimal
2150 * y {number|string|Decimal} The magnitude to round to a multiple of.
2206 * Return the value of this Decimal converted to a number primitive.
2216 * Return a string representing the value of this Decimal in base 8, round to `sd` significant
2231 * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
2270 * y {number|string|Decimal} The power to which to raise this Decimal.
2337 // new Decimal(2.32456).pow('2087987436534566.46411')
2374 * Return a string representing the value of this Decimal rounded to `sd` significant digits
2406 * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
2438 * Return a string representing the value of this Decimal.
2440 * Return exponential notation if this Decimal has a positive exponent equal to or greater than
2454 * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
2463 * Return a string representing the value of this Decimal.
2476 // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
2512 * parseDecimal Decimal
2513 * parseOther Decimal
2521 * naturalLogarithm, config, parseOther, random, Decimal
2767 // The digit array of a Decimal from toStringBinary may have trailing zeros.
3036 // Convert sd to decimal places.
3210 * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
3279 * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
3386 * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
3523 * Parse the value of a new Decimal `x` from string `str`.
3528 // Decimal point?
3605 * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
3670 // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
3676 if (p) x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal.pow(2, p));
3800 * Return the value of Decimal `x` as a string in base `baseOut`.
3945 // Decimal methods
3994 * Return a new Decimal whose value is the absolute value of `x`.
3996 * x {number|string|Decimal}
4005 * Return a new Decimal whose value is the arccosine in radians of `x`.
4007 * x {number|string|Decimal}
4016 * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
4019 * x {number|string|Decimal} A value in radians.
4028 * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
4031 * x {number|string|Decimal}
4032 * y {number|string|Decimal}
4041 * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
4044 * x {number|string|Decimal}
4053 * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
4056 * x {number|string|Decimal} A value in radians.
4065 * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
4068 * x {number|string|Decimal}
4077 * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
4080 * x {number|string|Decimal} A value in radians.
4089 * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
4095 * y {number|string|Decimal} The y-coordinate.
4096 * x {number|string|Decimal} The x-coordinate.
4158 * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
4161 * x {number|string|Decimal}
4170 * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEILING`.
4172 * x {number|string|Decimal}
4181 * Return a new Decimal whose value is `x` clamped to the range delineated by `min` and `max`.
4183 * x {number|string|Decimal}
4184 * min {number|string|Decimal}
4185 * max {number|string|Decimal}
4194 * Configure global settings for a Decimal constructor.
4208 * E.g. Decimal.config({ precision: 20, rounding: 4 })
4258 * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
4261 * x {number|string|Decimal} A value in radians.
4270 * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
4273 * x {number|string|Decimal} A value in radians.
4282 * Create and return a Decimal constructor with the same configuration properties as this Decimal
4290 * The Decimal constructor and exported function.
4291 * Return a new Decimal instance.
4293 * v {number|string|Decimal} A numeric value.
4296 function Decimal(v) { class
4300 // Decimal called without new.
4301 if (!(x instanceof Decimal)) return new Decimal(v);
4303 // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
4305 x.constructor = Decimal;
4312 if (!v.d || v.e > Decimal.maxE) {
4317 } else if (v.e < Decimal.minE) {
4356 if (e > Decimal.maxE) {
4359 } else if (e < Decimal.minE) {
4400 Decimal.prototype = P; class
4402 Decimal.ROUND_UP = 0;
4403 Decimal.ROUND_DOWN = 1;
4404 Decimal.ROUND_CEILING = 2;
4405 Decimal.ROUND_FLOOR = 3;
4406 Decimal.ROUND_HALF_UP = 4;
4407 Decimal.ROUND_HALF_DOWN = 5;
4408 Decimal.ROUND_HALF_EVEN = 6;
4409 Decimal.ROUND_HALF_CEILING = 7;
4410 Decimal.ROUND_HALF_FLOOR = 8;
4411 Decimal.EUCLIDEAN = 9;
4413 Decimal.config = Decimal.set = config;
4414 Decimal.clone = clone;
4415 Decimal.isDecimal = isDecimalInstance;
4417 Decimal.abs = abs;
4418 Decimal.acos = acos;
4419 Decimal.acosh = acosh; // ES6
4420 Decimal.add = add;
4421 Decimal.asin = asin;
4422 Decimal.asinh = asinh; // ES6
4423 Decimal.atan = atan;
4424 Decimal.atanh = atanh; // ES6
4425 Decimal.atan2 = atan2;
4426 Decimal.cbrt = cbrt; // ES6
4427 Decimal.ceil = ceil;
4428 Decimal.clamp = clamp;
4429 Decimal.cos = cos;
4430 Decimal.cosh = cosh; // ES6
4431 Decimal.div = div;
4432 Decimal.exp = exp;
4433 Decimal.floor = floor;
4434 Decimal.hypot = hypot; // ES6
4435 Decimal.ln = ln;
4436 Decimal.log = log;
4437 Decimal.log10 = log10; // ES6
4438 Decimal.log2 = log2; // ES6
4439 Decimal.max = max;
4440 Decimal.min = min;
4441 Decimal.mod = mod;
4442 Decimal.mul = mul;
4443 Decimal.pow = pow;
4444 Decimal.random = random;
4445 Decimal.round = round;
4446 Decimal.sign = sign; // ES6
4447 Decimal.sin = sin;
4448 Decimal.sinh = sinh; // ES6
4449 Decimal.sqrt = sqrt;
4450 Decimal.sub = sub;
4451 Decimal.sum = sum;
4452 Decimal.tan = tan;
4453 Decimal.tanh = tanh; // ES6
4454 Decimal.trunc = trunc; // ES6
4464 Decimal.config(obj);
4466 return Decimal;
4471 * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
4474 * x {number|string|Decimal}
4475 * y {number|string|Decimal}
4484 * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
4487 * x {number|string|Decimal} The power to which to raise the base of the natural log.
4496 * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
4498 * x {number|string|Decimal}
4507 * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
4512 * arguments {number|string|Decimal}
4541 * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
4546 return obj instanceof Decimal || obj && obj.toStringTag === tag || false;
4551 * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
4554 * x {number|string|Decimal}
4563 * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
4568 * x {number|string|Decimal} The argument of the logarithm.
4569 * y {number|string|Decimal} The base of the logarithm.
4578 * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
4581 * x {number|string|Decimal}
4590 * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
4593 * x {number|string|Decimal}
4602 * Return a new Decimal whose value is the maximum of the arguments.
4604 * arguments {number|string|Decimal}
4613 * Return a new Decimal whose value is the minimum of the arguments.
4615 * arguments {number|string|Decimal}
4624 * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
4627 * x {number|string|Decimal}
4628 * y {number|string|Decimal}
4637 * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
4640 * x {number|string|Decimal}
4641 * y {number|string|Decimal}
4650 * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
4653 * x {number|string|Decimal} The base.
4654 * y {number|string|Decimal} The exponent.
4663 * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
4664 * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
4768 * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
4772 * x {number|string|Decimal}
4788 * x {number|string|Decimal}
4798 * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
4801 * x {number|string|Decimal} A value in radians.
4810 * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
4813 * x {number|string|Decimal} A value in radians.
4822 * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
4825 * x {number|string|Decimal}
4834 * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
4837 * x {number|string|Decimal}
4838 * y {number|string|Decimal}
4847 * Return a new Decimal whose value is the sum of the arguments, rounded to `precision`
4852 * arguments {number|string|Decimal}
4869 * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
4872 * x {number|string|Decimal} A value in radians.
4881 * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
4884 * x {number|string|Decimal} A value in radians.
4893 * Return a new Decimal whose value is `x` truncated to an integer.
4895 * x {number|string|Decimal}
4904 P[Symbol.toStringTag] = 'Decimal';
4906 // Create and configure initial Decimal constructor.
4907 export var Decimal = P.constructor = clone(DEFAULTS);
4910 LN10 = new Decimal(LN10);
4911 PI = new Decimal(PI);
4913 export default Decimal;