Skip to content

Commit

Permalink
Added divide by zero check in MathProvider::divide() [closes #3]
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanRL committed Aug 26, 2015
1 parent a0e16c6 commit 07e6b3e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Samsara/Newton/Provider/MathProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public static function multipleMultiply(...$nums)

public static function divide($numerator, $denominator, $precision = null)
{
if ($denominator == 0) {
throw new \Exception('Cannot divide by zero.');
}

return bcdiv($numerator, $denominator, $precision);
}

Expand Down

0 comments on commit 07e6b3e

Please sign in to comment.