Skip to content
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

digits(n, base=-b) fails for n > typemax(n)÷2 #29183

Closed
StefanKarpinski opened this issue Sep 14, 2018 · 1 comment
Closed

digits(n, base=-b) fails for n > typemax(n)÷2 #29183

StefanKarpinski opened this issue Sep 14, 2018 · 1 comment
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@StefanKarpinski
Copy link
Member

digits has the same issue that ndigits had before #29148:

julia> digits(typemax(UInt), base=-2)
ERROR: InexactError: check_top_bit(UInt64, 18446744073709551615)
Stacktrace:
 [1] throw_inexacterror(::Symbol, ::Any, ::UInt64) at ./boot.jl:567
 [2] check_top_bit at ./boot.jl:581 [inlined]
 [3] toInt64 at ./boot.jl:642 [inlined]
 [4] Type at ./boot.jl:717 [inlined]
 [5] Type at ./boot.jl:741 [inlined]
 [6] convert at ./number.jl:7 [inlined]
 [7] #digits!#309(::Int64, ::Function, ::Array{Int64,1}, ::UInt64) at ./intfuncs.jl:747
 [8] #digits! at ./none:0 [inlined]
 [9] #digits#308(::Int64, ::Int64, ::Function, ::Type{Int64}, ::UInt64) at ./intfuncs.jl:709
 [10] #digits at ./none:0 [inlined]
 [11] #digits#307 at ./intfuncs.jl:705 [inlined]
 [12] (::getfield(Base, Symbol("#kw##digits")))(::NamedTuple{(:base,),Tuple{Int64}}, ::typeof(digits), ::UInt64) at ./none:0
 [13] top-level scope at none:0

Can probably be fixed using the same trick.

@rfourquet rfourquet self-assigned this Sep 14, 2018
rfourquet added a commit that referenced this issue Sep 14, 2018
@StefanKarpinski StefanKarpinski added the bug Indicates an unexpected problem or unintended behavior label Sep 14, 2018
@goggle
Copy link
Contributor

goggle commented Oct 22, 2019

This can probably be closed because of #29205.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants