* Return `true` if a round up should be done given the last digit, the settings and other information about the value. * * @param {number} lastDigit * @param {object} settings * @param {string} negativeSign This variable comes from `_prepareValueForRounding()`, which return `'-'`
(lastDigit, settings, negativeSign, odd)
| 5988 | * @private |
| 5989 | */ |
| 5990 | static _shouldRoundUp(lastDigit, settings, negativeSign, odd) { |
| 5991 | return (lastDigit > 4 && settings.roundingMethod === AutoNumeric.options.roundingMethod.halfUpSymmetric) || // Round half up symmetric |
| 5992 | (lastDigit > 4 && settings.roundingMethod === AutoNumeric.options.roundingMethod.halfUpAsymmetric && negativeSign === '') || // Round half up asymmetric positive values |
| 5993 | (lastDigit > 5 && settings.roundingMethod === AutoNumeric.options.roundingMethod.halfUpAsymmetric && negativeSign === '-') || // Round half up asymmetric negative values |
| 5994 | (lastDigit > 5 && settings.roundingMethod === AutoNumeric.options.roundingMethod.halfDownSymmetric) || // Round half down symmetric |
| 5995 | (lastDigit > 5 && settings.roundingMethod === AutoNumeric.options.roundingMethod.halfDownAsymmetric && negativeSign === '') || // Round half down asymmetric positive values |
| 5996 | (lastDigit > 4 && settings.roundingMethod === AutoNumeric.options.roundingMethod.halfDownAsymmetric && negativeSign === '-') || // Round half down asymmetric negative values |
| 5997 | (lastDigit > 5 && settings.roundingMethod === AutoNumeric.options.roundingMethod.halfEvenBankersRounding) || |
| 5998 | (lastDigit === 5 && settings.roundingMethod === AutoNumeric.options.roundingMethod.halfEvenBankersRounding && odd === 1) || |
| 5999 | (lastDigit > 0 && settings.roundingMethod === AutoNumeric.options.roundingMethod.toCeilingTowardPositiveInfinity && negativeSign === '') || |
| 6000 | (lastDigit > 0 && settings.roundingMethod === AutoNumeric.options.roundingMethod.toFloorTowardNegativeInfinity && negativeSign === '-') || |
| 6001 | (lastDigit > 0 && settings.roundingMethod === AutoNumeric.options.roundingMethod.upRoundAwayFromZero); // Round up away from zero |
| 6002 | } |
| 6003 | |
| 6004 | /** |
| 6005 | * Truncates the decimal part of a number to the given number of decimal places `decimalPlacesToRoundTo`. |