diff --git a/decimal.js b/decimal.js index 1bb9a4a..da21b40 100644 --- a/decimal.js +++ b/decimal.js @@ -469,6 +469,8 @@ return divide(this, new this.constructor(y)); }; + P[Symbol.for('/')] = P.div; + /* * Return a new Decimal whose value is the integer part of dividing the value of this Decimal @@ -490,6 +492,8 @@ return this.cmp(y) === 0; }; + P[Symbol.for('==')] = P.eq; + /* * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the @@ -510,6 +514,7 @@ return this.cmp(y) > 0; }; + P[Symbol.for('>')] = P.gt; /* * Return true if the value of this Decimal is greater than or equal to the value of `y`, @@ -521,6 +526,7 @@ return k == 1 || k === 0; }; + P[Symbol.for('>=')] = P.gte; /* * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this @@ -1088,6 +1094,8 @@ return this.cmp(y) < 0; }; + P[Symbol.for('<')] = P.lt; + /* * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false. @@ -1097,6 +1105,7 @@ return this.cmp(y) < 1; }; + P[Symbol.for('<=')] = P.lte; /* * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision` @@ -1410,6 +1419,8 @@ return external ? finalise(y, pr, rm) : y; }; + P[Symbol.for('-')] = P.sub; + /* * n % 0 = N @@ -1470,6 +1481,8 @@ return x.minus(q); }; + P[Symbol.for('%')] = P.mod; + /* * Return a new Decimal whose value is the natural exponential of the value of this Decimal, @@ -1637,6 +1650,8 @@ return external ? finalise(y, pr, rm) : y; }; + P[Symbol.for('+')] = P.add; + /* * Return the number of significant digits of the value of this Decimal. @@ -1936,6 +1951,8 @@ return external ? finalise(y, Ctor.precision, Ctor.rounding) : y; }; + P[Symbol.for('*')] = P.mul; + /* * Return a string representing the value of this Decimal in base 2, round to `sd` significant @@ -2364,6 +2381,8 @@ return finalise(r, pr, rm); }; + P[Symbol.for('**')] = P.pow; + /* * Return a string representing the value of this Decimal rounded to `sd` significant digits