Skip to content

fix: handle division by zero in calculator#141

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

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

Conversation

@quantcode-agent
Copy link
Copy Markdown

Summary

  • Added a guard in src/calculator.ts divide() function that throws Error("Division by zero") when the divisor is zero
  • Added test cases in test/calculator.test.ts for both normal division and the division-by-zero error case
  • All 5 tests pass

Assumptions

  • Throwing an error is the appropriate behavior for division by zero (rather than returning Infinity or NaN)
  • The existing test file structure and testing framework (bun test) were preserved

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