Digits in Numbers
IntegerDigits[n] | a list of the decimal digits in the integer n |
IntegerDigits[n,b] | the digits of n in base b |
IntegerDigits[n,b,len] | the list of digits padded on the left with zeros to give total length len |
IntegerLength[n] | the number of decimal digits in n |
IntegerLength[n,b] | the number of base b digits in n |
IntegerExponent[n,b] | the number of zeros at the end of n in base b |
RealDigits[x] | a list of the decimal digits in the approximate real number x, together with the number of digits to the left of the decimal point |
RealDigits[x,b] | the digits of x in base b |
RealDigits[x,b,len] | the first len digits of x in base b |
RealDigits[x,b,len,n] | the first len digits starting with the coefficient of bn |
FromDigits[list] | construct a number from its decimal digit sequence |
FromDigits[list,b] | construct a number from its digit sequence in base b |
FromDigits["string"] | construct an integer from a string of digits |
FromDigits["string",b] | construct an integer from a string of digits in base b |
IntegerString[n] | a string of the decimal digits in the integer n |
IntegerString[n,b] | a string of the digits of n in base b |
Converting between numbers and lists or strings of digits.
This gives a list of digits, together with the number of digits that appear to the left of the decimal point.
b^^nnnn | a number in base b |
BaseForm[x,b] | print with x in base b |
IntegerString[n,b] | a string representing n in base b |
When the base is larger than 10, extra digits are represented by letters a–z.
"Output Formats for Numbers" describes how to print numbers in various formats. If you want to create your own formats, you will often need to use MantissaExponent to separate the pieces of real numbers.
MantissaExponent[x] | give a list containing the mantissa and exponent of x |
MantissaExponent[x,b] | give the mantissa and exponent in base b |
Separating the mantissa and exponent of numbers.