Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

Commit ae415b6

Browse files
committed
Simplified Decimal::sub
1 parent a8b49f4 commit ae415b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Decimal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function sub(Decimal $b, $scale = null)
300300
if ($this->isInfinite()) {
301301
if (!$b->isInfinite()) {
302302
return $this;
303-
} elseif ($this->isPositive() && $b->isNegative() || $this->isNegative() && $b->isPositive()) {
303+
} elseif (!$this->hasSameSign($b)) {
304304
return $this;
305305
} else { // elseif () {
306306
throw new \DomainException("Infinite numbers with the same sign can't be subtracted");

0 commit comments

Comments
 (0)