Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork11.1k
ENH:__trunc__
for floating and integer types#28949
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
__trunc__
for floating types__trunc__
for floating typesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
don't forget about the stubs :)
Uh oh!
There was an error while loading.Please reload this page.
jorenham commentedMay 14, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I think it would make sense to also do this for >>>float.__trunc__<method '__trunc__' of 'float' objects>>>>int.__trunc__<method '__trunc__' of 'int' objects> The other rounding dunders are currently also present in both |
the type-test at |
Oh for sure, since the implementation is small, I'll squeeze it in here. Thanks for the info!
Ah that makes sense. |
__trunc__
for floating types__trunc__
for floating and integer types- Added edgcases for float- Added TCs for integer
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Joren Hammudoglu <jhammudoglu@gmail.com>
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
@jorenham a basic query on integer's typing: How did it get added? There is no diff indicating it's added:
|
I'm not sure I understand you question. Are you asking how to verify that the method you added in the stubs actually works? Because if so, you could do that by adding a type-test in |
Ah ok, got it. I was actually curious on how the typing for int.trunc got added to begin with. There is no change in int typing, but yet, it got added. |
Uh oh!
There was an error while loading.Please reload this page.
Changes
Add
__trunc__
for floating and integer typesTesting
Related
part of#13375
Todo
gentype_int
is slower than an explicitPyLong_FromDouble
, etc for floats