Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions decimal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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`,
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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`
Expand Down Expand Up @@ -1410,6 +1419,8 @@
return external ? finalise(y, pr, rm) : y;
};

P[Symbol.for('-')] = P.sub;


/*
* n % 0 = N
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down