Lines Matching refs:rounding
52 // The rounding mode used when rounding to `precision`.
65 // `Decimal.rounding = 4;`
66 // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
67 rounding: 4, // 0 to 8 property
70 // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
80 // division (9) are commonly used for the modulus operation. The other rounding modes can also
309 rm = Ctor.rounding;
311 Ctor.rounding = 1;
316 Ctor.rounding = rm;
325 * `precision` significant digits using rounding mode `rounding`.
389 // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
390 // , i.e. approaching a rounding boundary, continue the iteration.
393 // On the first iteration only, check to see if rounding up gives the exact result as the
408 // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
412 // Truncate to the first rounding digit.
424 return finalise(r, e, Ctor.rounding, m);
469 * `precision` significant digits using rounding mode `rounding`.
479 * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
485 return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
564 rm = Ctor.rounding;
566 Ctor.rounding = 1;
593 return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
635 rm = Ctor.rounding;
637 Ctor.rounding = 1;
671 Ctor.rounding = rm;
702 rm = Ctor.rounding;
704 Ctor.rounding = 1;
706 return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
735 rm = Ctor.rounding;
750 Ctor.rounding = 1;
756 Ctor.rounding = rm;
790 rm = Ctor.rounding;
792 Ctor.rounding = 1;
799 Ctor.rounding = rm;
829 rm = Ctor.rounding;
831 Ctor.rounding = 1;
838 Ctor.rounding = rm;
872 rm = Ctor.rounding;
882 Ctor.rounding = 1;
887 Ctor.rounding = rm;
924 rm = Ctor.rounding;
942 Ctor.rounding = 1;
947 Ctor.rounding = rm;
976 rm = Ctor.rounding;
994 Ctor.rounding = 1;
1029 return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
1107 * significant digits using rounding mode `rounding`.
1116 * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
1117 * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
1140 rm = Ctor.rounding,
1180 // The result will have 5 rounding digits.
1183 // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
1207 // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
1265 * significant digits using rounding mode `rounding`.
1301 rm = Ctor.rounding;
1313 // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
1344 // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
1437 * `precision` significant digits using rounding mode `rounding`.
1454 return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
1457 // Prevent rounding of intermediate calculations.
1481 * significant digits using rounding mode `rounding`.
1491 * rounded to `precision` significant digits using rounding mode `rounding`.
1529 * significant digits using rounding mode `rounding`.
1563 rm = Ctor.rounding;
1671 * rounding mode `rounding`.
1678 return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
1706 rm = Ctor.rounding;
1708 Ctor.rounding = 1;
1713 Ctor.rounding = rm;
1721 * significant digits using rounding mode `rounding`.
1781 // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
1782 // 4999, i.e. approaching a rounding boundary, continue the iteration.
1785 // On the first iteration only, check to see if rounding up gives the exact result as the
1800 // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
1804 // Truncate to the first rounding digit.
1816 return finalise(r, e, Ctor.rounding, m);
1842 rm = Ctor.rounding;
1844 Ctor.rounding = 1;
1851 Ctor.rounding = rm;
1875 * digits using rounding mode `rounding`.
1941 return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
1947 * digits using rounding mode `rm`.
1962 * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
1979 if (rm === void 0) rm = Ctor.rounding;
1988 * `dp` fixed decimal places using rounding mode `rounding`.
2004 if (rm === void 0) rm = Ctor.rounding;
2017 * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
2041 if (rm === void 0) rm = Ctor.rounding;
2129 * digits using rounding mode `rm`.
2143 * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
2144 * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
2154 * 'toNearest() rounding mode not an integer: {rm}'
2155 * 'toNearest() rounding mode out of range: {rm}'
2170 rm = Ctor.rounding;
2174 rm = Ctor.rounding;
2218 * digits using rounding mode `rm`.
2233 * to `precision` significant digits using rounding mode `rounding`.
2264 * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
2288 rm = Ctor.rounding;
2334 Ctor.rounding = x.s = 1;
2336 // Estimate the extra guard digits needed to ensure five correct rounding digits from
2348 // Truncate to the required precision plus five rounding digits.
2351 // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
2356 // Truncate to the increased precision plus five rounding digits.
2359 // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
2368 Ctor.rounding = rm;
2376 * using rounding mode `rounding`.
2395 if (rm === void 0) rm = Ctor.rounding;
2408 * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
2416 * 'toSD() rounding mode not an integer: {rm}'
2417 * 'toSD() rounding mode out of range: {rm}'
2426 rm = Ctor.rounding;
2430 if (rm === void 0) rm = Ctor.rounding;
2565 * Check 5 rounding digits if `repeating` is null, 4 otherwise.
2575 // Is the rounding digit in the first word of d?
2584 // i is the index (0 - 6) of the rounding digit.
2585 // E.g. if within the word 3487563 the first rounding digit is 5,
2775 rm = Ctor.rounding;
2950 * Round `x` to `sd` significant digits using rounding mode `rm`.
2964 // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
2976 // Is the rounding digit in the first word of xd?
2982 // Get the rounding digit at index j of w.
3012 // Get the rounding digit at index j of w.
3017 // Are there any non-zero digits after the rounding digit?
3029 // Check whether the digit to the left of the rounding digit is odd.
3061 // E.g. 56700 becomes 56000 if 7 is the rounding digit.
3236 // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
3316 rm = Ctor.rounding,
3345 // necessary to ensure the first 4 rounding digits are correct.
3360 // Check to see if the first 4 rounding digits are [49]999.
3362 // e.g. with precision: 18, rounding: 1
3364 // `wpr - guard` is the index of first rounding digit.
3408 rm = Ctor.rounding,
3485 // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
3489 // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
3490 // been repeated previously) and the first 4 rounding digits 9999?
3492 // e.g. with precision: 12, rounding: 1
3494 // `wpr - guard` is the index of first rounding digit.
3812 if (rm === void 0) rm = Ctor.rounding;
3816 rm = Ctor.rounding;
3874 // The rounding digit, i.e. the digit after the digit that may be rounded up.
4018 * `precision` significant digits using rounding mode `rounding`.
4030 * digits using rounding mode `rounding`.
4043 * significant digits using rounding mode `rounding`.
4055 * `precision` significant digits using rounding mode `rounding`.
4067 * significant digits using rounding mode `rounding`.
4079 * `precision` significant digits using rounding mode `rounding`.
4091 * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
4119 rm = this.rounding,
4144 this.rounding = 1;
4148 this.rounding = rm;
4160 * digits using rounding mode `rounding`.
4200 * rounding {number}
4209 * E.g. Decimal.config({ precision: 20, rounding: 4 })
4219 'rounding', 0, 8,
4260 * digits using rounding mode `rounding`.
4272 * significant digits using rounding mode `rounding`.
4460 ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
4473 * digits using rounding mode `rounding`.
4486 * significant digits using rounding mode `rounding`.
4509 * rounded to `precision` significant digits using rounding mode `rounding`.
4553 * significant digits using rounding mode `rounding`.
4565 * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
4580 * significant digits using rounding mode `rounding`.
4592 * significant digits using rounding mode `rounding`.
4626 * using rounding mode `rounding`.
4639 * digits using rounding mode `rounding`.
4652 * significant digits using rounding mode `rounding`.
4769 * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
4771 * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
4777 return finalise(x = new this(x), x.e + 1, this.rounding);
4800 * using rounding mode `rounding`.
4812 * significant digits using rounding mode `rounding`.
4824 * digits using rounding mode `rounding`.
4836 * using rounding mode `rounding`.
4849 * significant digits using rounding mode `rounding`.
4865 return finalise(x, this.precision, this.rounding);
4871 * digits using rounding mode `rounding`.
4883 * significant digits using rounding mode `rounding`.