@signpostmarv/intermediary-number 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,16 @@ function abs(value) {
18
18
  : value);
19
19
  }
20
20
  function compare(value, to) {
21
+ if (value instanceof IntermediaryNumberInfinity
22
+ && to instanceof IntermediaryNumberInfinity) {
23
+ return 0;
24
+ }
25
+ else if (value instanceof IntermediaryNumberInfinity) {
26
+ return 1;
27
+ }
28
+ else if (to instanceof IntermediaryNumberInfinity) {
29
+ return -1;
30
+ }
21
31
  const comparable = IntermediaryNumber.reuse_or_create(value).toBigNumberOrFraction();
22
32
  let result;
23
33
  if (comparable instanceof BigNumber) {
@@ -499,6 +509,12 @@ export class IntermediaryCalculation {
499
509
  if ('/' === this.operation
500
510
  || left instanceof Fraction
501
511
  || right instanceof Fraction) {
512
+ if (left_operand instanceof IntermediaryNumberInfinity) {
513
+ return left_operand;
514
+ }
515
+ else if (right_operand instanceof IntermediaryNumberInfinity) {
516
+ return right_operand;
517
+ }
502
518
  return IntermediaryNumber.create(Fraction_operation_map[this.operation](((left instanceof BigNumber)
503
519
  ? left_operand.toFraction()
504
520
  : left), ((right instanceof BigNumber)
package/package.json CHANGED
@@ -27,5 +27,5 @@
27
27
  "bignumber.js": "^9.1.2",
28
28
  "fraction.js": "^4.3.7"
29
29
  },
30
- "version": "0.6.0"
30
+ "version": "0.6.2"
31
31
  }