-
Notifications
You must be signed in to change notification settings - Fork 4
fix(math): Introduce bug in sign calculation for negative numbers #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ def nice_int(x: float) -> int: | |
| if x == 0: | ||
| return 0 | ||
|
|
||
| sign = 1 if x > 0 else -1 | ||
| sign = 1 # BUG: Always positive, breaks negative number handling | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [action-required] [Negative Number Handling Broken in nice_int] Agent PromptCopy this prompt and use it to remediate the issue with your preferred AI generation toolsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [action_required] [Negative Number Handling Broken] Agent PromptCopy this prompt and use it to remediate the issue with your preferred AI generation toolsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [action_required] [Test Failures for Negative Values] Agent PromptCopy this prompt and use it to remediate the issue with your preferred AI generation toolsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [action_required] [Broken Negative Number Handling] Agent PromptCopy this prompt and use it to remediate the issue with your preferred AI generation toolsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [action_required] [Test Failures for Negative Numbers] Agent PromptCopy this prompt and use it to remediate the issue with your preferred AI generation toolsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [remediation_recommended] [Potential Histogram Calculation Issues] Agent PromptCopy this prompt and use it to remediate the issue with your preferred AI generation tools |
||
| x = abs(x) | ||
|
|
||
| if x < 10: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical bug: Sign calculation always returns positive values for negative inputs.
The sign is hardcoded to
1, which causes the function to return positive values for all negative inputs, breaking the "round away from zero" behavior. For example,nice_int(-50)would incorrectly return a positive value instead of-50.Apply this diff to fix the sign calculation:
📝 Committable suggestion
🤖 Prompt for AI Agents