FromDigits

Documentation for FromDigits.jl.

Examples

julia> using FromDigits

julia> digits(739)
3-element Vector{Int64}:
 9
 3
 7

julia> fromdigits([9, 3, 7])
739

julia> fromdigits(fill(1, 19))
1111111111111111111

julia> fromdigits(fill(1, 20))
ERROR: OverflowError: 10 * 1111111111111111111 overflowed for type Int64
Stacktrace:
[...]

julia> fromdigits_unchecked(fill(1, 20))
-7335632962598440505

julia> fromdigits(BigInt, fill(1, 20))
11111111111111111111

julia> fromdigits(digits(UInt32, 12345))
0x00003039

julia> fromdigits(UInt16[0x1, 0x2, 0x3]; base=0x0010)
0x0321

Library

Public

FromDigits.fromdigitsFunction

Converts from digits to an integer. This is the inverse function of digits.

Returns the integer represented by the digits in the base. The result is of type T, which defaults to D.

See also fromdigits_unchecked.

source
FromDigits.fromdigitsMethod
fromdigits(digits::AbstractVector{D}; base::B=D(10)) where {B<:Integer, D<:Integer}

Returns the integer represented by the digits in the base.

The result is of type promote_type(B, D).

source
FromDigits.fromdigitsMethod
fromdigits(T::Type{<:Integer}, digits::AbstractVector{D}; base::B=D(10)) where {B<:Integer, D<:Integer}

Returns the integer represented by the digits in the base. The result is of type T.

source
FromDigits.fromdigits_uncheckedFunction

Converts from digits to an integer. This is the inverse function of digits.

This function does not check the validity of the digits nor overflows in the computations.

See also fromdigits.

source

Private