Closed
Description
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.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
fix digits(n::Unsigned) with neg base for `n > typemax(n)÷2`
n > typemax(n)÷2
#29187goggle commentedon Oct 22, 2019
This can probably be closed because of #29205.