用法:
digits([T<:Integer], n::Integer; base::T = 10, pad::Integer = 1)返回给定基数中 n 的数字的元素类型为 T (默认为 Int )的数组,可以选择用零填充到指定的大小。更重要的数字位于更高的索引处,例如 n == sum(digits[k]*base^(k-1) for k=1:length(digits)) 。
另请参见   、 ndigits   ,对于基数 2 也可参见 digits!   、 bitstring   。count_ones 
例子
julia> digits(10)
2-element Vector{Int64}:
 0
 1
julia> digits(10, base = 2)
4-element Vector{Int64}:
 0
 1
 0
 1
julia> digits(-256, base = 10, pad = 5)
5-element Vector{Int64}:
 -6
 -5
 -2
  0
  0
julia> n = rand(-999:999);
julia> n == evalpoly(13, digits(n, base = 13))
true相关用法
- Julia digits!用法及代码示例
- Julia div用法及代码示例
- Julia divrem用法及代码示例
- Julia displaysize用法及代码示例
- Julia diff用法及代码示例
- Julia dropdims用法及代码示例
- Julia delete!用法及代码示例
- Julia deleteat!用法及代码示例
- Julia denominator用法及代码示例
- Julia denominator()用法及代码示例
- Julia dump用法及代码示例
- Julia splice!用法及代码示例
- Julia @cfunction用法及代码示例
- Julia LibGit2.count用法及代码示例
- Julia LinearAlgebra.BLAS.dot用法及代码示例
- Julia break用法及代码示例
- Julia sizeof()用法及代码示例
- Julia :<=用法及代码示例
- Julia zero()用法及代码示例
- Julia rem用法及代码示例
- Julia ...用法及代码示例
- Julia setfield()用法及代码示例
- Julia rpad用法及代码示例
- Julia sort用法及代码示例
- Julia tail用法及代码示例
注:本文由纯净天空筛选整理自julialang.org 大神的英文原创作品 Base.digits — Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
