-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Closed
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
Description of the Issue:
The round
function does not seem to handle certain floating-point numbers correctly. For example, when rounding the number -1357.1357 to negative 4 decimal places, the function returns -0.0 instead of the expected 0.0.
Steps to Reproduce:
- Open a Python interpreter.
- Execute the following code:
print(round(-1357.1357, -4))
- Observe the output.
Expected Result: The output should be 0.0.
Actual Result: The output is -0.0.
Environment Details Tested:
--Python Version: 3.12.5, Operating System: Windows 11.
--Python Version: 3.12.3, Operating System: Ubuntu.
Additional Information: I have verified this issue on multiple machines and with different Python versions. The issue persists across all tested environments.
CPython versions tested on:
3.12, 3.13
Operating systems tested on:
Linux, Windows
Linked PRs
- gh-123811: test that round() can return signed zero #123829
- [3.13] gh-123811: test that round() can return signed zero (GH-123829) #123938
- [3.12] gh-123811: test that round() can return signed zero (GH-123829) #123939
- gh-123811: test that round(Decimal) can return signed zero #124007
- [3.13] gh-123811: Test that round(Decimal) can return signed zero (GH-124007) #124048
- [3.12] gh-123811: Test that round(Decimal) can return signed zero (GH-124007) #124049
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error