8000 Enable MICROPY_PY_BUILTINS_ROUND_INT; make round() work better when flag is disabled by dhalbert · Pull Request #1896 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

Enable MICROPY_PY_BUILTINS_ROUND_INT; make round() work better when flag is disabled #1896

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

Merged
merged 2 commits into from
May 21, 2019

Conversation

dhalbert
Copy link
Collaborator

Fixes #1890.

Set MICROPY_PY_BUILTINS_ROUND_INT = 1 for all builds, which implements round(n, <negative ndigits>), so that, for instance round(189, -1) will round to the nearest 10.

Also tweaks the implementation so that even if MICROPY_PY_BUILTINS_ROUND_INT = 0, round(<int>, <positive ndigits>) will still work. Previously rounding an int with a specified ndigits would throw NotImplementedError.

Adds 151 bytes or so to a build.

@dhalbert dhalbert requested a review from tannewt May 17, 2019 20:05
@dhalbert dhalbert changed the title Enable MICROPY_PY_BUILTINS_ROUND_INT; make round() work beter when it… Enable MICROPY_PY_BUILTINS_ROUND_INT; make round() work better when flag is disabled May 17, 2019
@dhalbert
Copy link
Collaborator Author

@tannewt this is ready for review now to 4.0.x. Had to shrink CPX pinyin build.

Copy link
Member
@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

Thanks @dhalbert !

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.

2 participants
0