Skip to content

fix: handle division by zero in calculator#152

Open
quantcode-agent[bot] wants to merge 1 commit intomainfrom
quantcode/job-job-fca4b9b1
Open

fix: handle division by zero in calculator#152
quantcode-agent[bot] wants to merge 1 commit intomainfrom
quantcode/job-job-fca4b9b1

Conversation

@quantcode-agent
Copy link
Copy Markdown

Summary

  • Fixes division-by-zero bug in src/calculator.ts by throwing an Error("Division by zero is not allowed") when the divisor is 0
  • Adds tests verifying both normal division and the division-by-zero error case
  • All 5 tests pass

Assumptions

  • Throwing an Error is the appropriate response for division by zero (rather than returning NaN/null)
  • The error message "Division by zero is not allowed" is suitable for consumers of this function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants