Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upbpo-38629: implement __floor__ and __ceil__ for float #16985
Conversation
What is the performance impact on math.floor(1.0) and math.ceil(1.0)? Faster, slower, no significant impact? |
This comment has been minimized.
This comment has been minimized.
This PR needs tests. |
Thanks for this PR. Some changes are needed:
|
This comment has been minimized.
This comment has been minimized.
bedevere-bot
commented
Oct 29, 2019
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
This comment has been minimized.
This comment has been minimized.
I have made the requested changes; please review again |
This comment has been minimized.
This comment has been minimized.
bedevere-bot
commented
Oct 30, 2019
Thanks for making the requested changes! @mdickinson: please review the changes made to this pull request. |
This comment has been minimized.
This comment has been minimized.
I submitted benchmarks to bpo |
Changes LGTM; thank you! The performance is still a concern, but if some form of #16991 gets merged then that wouldn't be so much of an issue. @serhiy-storchaka @vstinner Does the current state of the PR seem okay to you? |
This comment has been minimized.
This comment has been minimized.
#16991 will solve the performance issue for exact floats, but not for subclasses. |
This comment has been minimized.
This comment has been minimized.
I don't think there's too much reason to care about fine-tuning of performance for |
This comment has been minimized.
This comment has been minimized.
me:
I checked the current implementation of math.floor(): there is a fast-path for exact type float which does something like I'm fine with calling the |
This comment has been minimized.
This comment has been minimized.
Oh, that's @serhiy-storchaka 's PR #16991 which has just been merged. I didn't notice ;-) |
LGTM. There is no performance overhead on math.floor() and math.ceil() for exact float. I'm fine with having a small overhead for float subclasses. I didn't measure the overhead, I expect it to be really small or even not significant. |
This comment has been minimized.
This comment has been minimized.
@mdickinson @serhiy-storchaka: I'm not sure that you agree, so I didn't merge the PR. I approve the PR, so I'm fine with merging it. What about you? |
This comment has been minimized.
This comment has been minimized.
@mdickinson @serhiy-storchaka: I plan to merge this PR next Friday (December 21) if no one replies. @isidentical: Please ping me next Friday if I forget to merge your PR. |
This comment has been minimized.
This comment has been minimized.
@vstinner Merging is fine with me. |
isidentical commentedOct 29, 2019
•
edited by bedevere-bot
https://bugs.python.org/issue38629