 |
RealDigits
RealDigits[
x
] gives a list of the digits in the approximate real number x, together with the number of digits that are to the left of the decimal point. RealDigits[
x
,
b
] gives a list of base-b digits in x. RealDigits[
x
,
b
,
len
] gives a list of len digits. RealDigits[
x
,
b
,
len
,
n
] gives len digits starting with the coefficient of .
RealDigits[
x
] returns a list of digits whose length is equal to Precision[
x
]. RealDigits[
x
] and RealDigits[
x
,
b
] require that x be an approximate real number, returned for example by N. RealDigits[
x
,
b
,
len
] also works on exact numbers. If len is larger than Log[10,
b
]
Precision[
x
] remaining digits are filled in as Indeterminate. RealDigits[
x
,
b
,
len
,
n
] starts with the digit which is the coefficient of , truncating or padding with zeros as necessary. RealDigits[
x
,
b
,
len
,
-1] starts with the digit immediately to the right of the base b decimal point in x. The base b in RealDigits[
x
,
b
] need not be an integer. For any real b such that , RealDigits[
x
,
b
] successively finds the largest integer multiples of powers of b that can be removed while leaving a non-negative remainder. RealDigits[
x
] discards the sign of x. FromDigits can be used as the inverse of RealDigits. See the Mathematica book: Section 3.1.3. See also: MantissaExponent, IntegerDigits, BaseForm, FromDigits.
Further Examples
The second input gives the digits in an approximation to .
In[1]:= 
Out[1]= 
In[2]:= 
Out[2]= 
Similarly these are digits in base .
In[3]:= 
Out[3]= 
In[4]:= 
Out[4]= 
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT. SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION. | | | |
 | |
|