Skip to content

Support configurable rounding modes in sigfig.round - #61

Closed
MikeBusuttil with Copilot wants to merge 4 commits into
masterfrom
copilot/add-option-to-round-down
Closed

MikeBusuttil with Copilot wants to merge 4 commits into
masterfrom
copilot/add-option-to-round-down

Conversation

Copilot AI commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

sigfig.round lacked directional rounding while preserving a specified number of significant figures. This adds a mode keyword supporting all eight decimal rounding modes.

  • API: Export rounding constants from sigfig; apply mode to significant-figure, decimal-place, and uncertainty rounding. Keep ROUND_HALF_UP as the default.
  • Documentation: Add “Rounding Modes,” distinguishing toward-zero rounding (ROUND_DOWN) from toward-negative-infinity rounding (ROUND_FLOOR).
  • Coverage: Add regression cases for each mode, negative values, carry boundaries, uncertainty, and decimal-context independence.
from sigfig import round, ROUND_DOWN

round(199, sigfigs=1, mode=ROUND_DOWN)  # 100
round(999, sigfigs=2, mode=ROUND_DOWN)  # 990

Copilot AI linked an issue Sep 18, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits September 18, 2026 14:51
Co-authored-by: MikeBusuttil <31480000+MikeBusuttil@users.noreply.github.com>
Co-authored-by: MikeBusuttil <31480000+MikeBusuttil@users.noreply.github.com>
Copilot AI changed the title [WIP] Add option to round down with rounding modes Support configurable rounding modes in sigfig.round Sep 18, 2026
Copilot AI requested a review from MikeBusuttil September 18, 2026 14:54
Comment thread test/test.py

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move all new test cases out of here and into test_equality.csv

Base automatically changed from next-steps to master September 18, 2026 21:27
@MikeBusuttil

Copy link
Copy Markdown
Collaborator

resolved in #64

@MikeBusuttil
MikeBusuttil deleted the copilot/add-option-to-round-down branch September 18, 2026 21:28
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.

Add option to round down

2 participants