NumberExpand

NumberExpand[x]

gives a list of the decimal digits of x multiplied by their corresponding powers of 10.

NumberExpand[x,b]

expands x in base b.

NumberExpand[x,b,len]

gives a list of length len.

Details

  • For any number x, Total[NumberExpand[x,]]==x.
  • For an integer x, NumberExpand[x] returns a list of integers.
  • For a rational x, the fractional part of x is added to the last element of NumberExpand[IntegerPart[x]].
  • For a non-exact number x, all elements of NumberExpand[x] but the last are exact.
  • For an exact number x, the length of NumberExpand[x] equals the number of digits in the integer part of x.
  • For a non-exact number x, NumberExpand[x] normally returns a list of length Round[Precision[x]].
  • For a non-exact number x and an exact base b, NumberExpand[x,b] normally returns a list of length Round[Precision[x] Log[b,10]].
  • If len is larger than Precision[x] Log[b,10], the remaining parts of the expansion are filled in as Indeterminate.
  • The base b in NumberExpand[x,b] can be a real number greater than 1.
  • For any number x of absolute value less than 1, the first element of NumberExpand[x,] is 0 or 0..
  • NumberExpand[0.] returns a list of length Floor[Accuracy[0.]]+2.

Examples

open allclose all

Basic Examples  (3)

Expand a number into a list of multiples of powers of 10:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Expand a number in base 2:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Specify the length of the output:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Scope  (5)

Generalizations & Extensions  (5)

Properties & Relations  (9)

Possible Issues  (1)

See Also

IntegerDigits  RealDigits  NumberDecompose

Introduced in 2016
(11.0)