FromDigits
FromDigits[list]
constructs an integer from the list of its decimal digits.
FromDigits[list,b]
takes the digits to be given in base b.
FromDigits[list,MixedRadix[blist]]
uses the mixed radix with list of bases blist.
FromDigits["string"]
constructs an integer from a string of digits.
FromDigits["string","Roman"]
constructs an integer from Roman numerals.
Details
- FromDigits is effectively the inverse of IntegerDigits and IntegerString.
- FromDigits[{list,n},b] takes n to be an exponent, while FromDigits[{{a1,a2,…,{rep}},n},b] takes rep to be repeated, so that FromDigits can also be used as the inverse of RealDigits.
- Since IntegerDigits[n] discards the sign of n, FromDigits[IntegerDigits[n]] is Abs[n], not just n. »
- The digits in list and the base b need not be positive integers, and can be any expression. »
- If Indeterminate appears in list, it is assumed to signify unknown digits beyond the precision of an approximate real number. »
- FromDigits["string",b] takes the digits in "string" to be given in base b.
- In FromDigits["string",b], digits above 9 can be represented by letters a–z or A–Z.
Examples
open allclose allBasic Examples (5)
Scope (5)
Applications (3)
Properties & Relations (1)
Reconstruct a number of seconds from a list {days,hours,minutes,seconds}:
It can also be obtained with NumberCompose:
Perform the same computation using Quantity objects:
Possible Issues (3)
IntegerDigits drops the sign:
Without a base specified, the characters are interpreted as extensions of base-10 digits:
If no base is specified, the multicharacter strings are converted using base 10:
Text
Wolfram Research (1996), FromDigits, Wolfram Language function, https://reference.wolfram.com/language/ref/FromDigits.html (updated 2015).
CMS
Wolfram Language. 1996. "FromDigits." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/FromDigits.html.
APA
Wolfram Language. (1996). FromDigits. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FromDigits.html