You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason will be displayed to describe this comment to others. Learn more.
Neat trick: I was worried about duplicated code (see the issue discussion), but it seems we can rely on the compiler to inline _float_div_mod and then strip out the redundant stuff.
Is there benefit to applying the same approach to float_rem? Apart from the possibility of a performance boost, it looks as though it would actually make the code simpler (removing existing duplication) and safer. And for floats, % is possibly used more often than // (for argument reduction, for example).
Apart from the possibility of a performance boost,
Sorry, of course that doesn't apply, since float_rem is already special-cased and doesn't go via divmod.
corona10
changed the title
bpo-39434: Remove unnecessary logic of float __floordiv__
bpo-39434: Improve float __floordiv__ performance and update error message
Jan 24, 2020
corona10
changed the title
bpo-39434: Improve float __floordiv__ performance and update error message
bpo-39434: Improve float __floordiv__ performance and error message
Jan 24, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://bugs.python.org/issue39434