-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
make ndigits
more generic
#30384
make ndigits
more generic
#30384
Conversation
Are testing this in some way? If not, we should define a |
I don't think we have documentation on integer interfaces to make us expect that a So it feels like dispatching here on the super-type is just tailor-made for But unfortunatly I don't have a better idea at hand for |
Getting |
But |
That doesn't seem to be the case? Also, needing to define |
Ok... it works for me thanks to this line:
I totally agree. I would look into tackling the "TODO" about |
Aha, that explains it. I need to revise my StaticNumbers PR a bit. |
3660f0d
to
53a9ad1
Compare
BigInt(::Integer)
more genericndigits
more generic
Ok! Here's a version that addresses the issue via |
53a9ad1
to
599fdd9
Compare
Sounds good; done. |
base/intfuncs.jl
Outdated
b == 10 && return ndigits0z(x) | ||
b = Int(b) | ||
x = abs(x) | ||
if x isa Base.BitUnsigned |
There 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.
Sorry, my last comment was a mess, I think it should be here BitInteger
599fdd9
to
7774fdd
Compare
This fixes one of the problems with StaticNumbers.jl identified in #30374.
ndigits
andunsigned
don't work on all Integers. This just brings back the old implementation for integers that are neither signed or unsigned. Better ideas welcome.