Skip to content

fix: handle division by zero in calculator#145

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

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

Conversation

@quantcode-agent
Copy link
Copy Markdown

Summary

  • Added a guard in src/calculator.ts divide() function to throw an error when the divisor is zero
  • Added tests for normal division and division-by-zero error handling

Assumptions

  • Throwing an Error("Division by zero") is the appropriate behavior (rather than returning Infinity or NaN)
  • The existing test file structure and bun:test framework 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