Skip to content

Commit

Permalink
Better type error message for division by zero (#2907)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed May 23, 2024
1 parent ec975ca commit 924d41f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def nonZero(x: number): number {
MathOperation::Add => a + b,
MathOperation::Subtract => a - b,
MathOperation::Multiply => a * b,
MathOperation::Divide => a / nonZero(b),
MathOperation::Divide => (a / nonZero(b)) | error("Division by zero error."),
MathOperation::Power => a ** b,
MathOperation::Log => number::log(a) / number::log(b),
MathOperation::Maximum => max(a, b),
Expand Down

0 comments on commit 924d41f

Please sign in to comment.