This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / Built-in Functions / Input and Output / Number Formatting  /
NumberForm

  • NumberForm[ expr , n ] prints with approximate real numbers in expr given to n-digit precision.
  • NumberForm[ expr , n , f ] prints with approximate real numbers having n digits, with f digits to the right of the decimal point.
  • NumberForm works on integers as well as approximate real numbers.
  • The following options can be given:
  • All options except ExponentFunction apply to integers as well as approximate real numbers.
  • You can mix NumberForm and BaseForm.
  • NumberForm acts as a "wrapper", which affects printing, but not evaluation.
  • See the Mathematica book: Section 2.8.7.
  • See also: ScientificForm, EngineeringForm, AccountingForm, BaseForm, PaddedForm, N.

    Further Examples

    This breaks digits into blocks of length 3.

    In[1]:=

    Out[1]//NumberForm=

    You can specify any string to use as a separator between blocks of digits.

    In[2]:=

    Out[2]//NumberForm=

    This gives an explicit plus sign for positive numbers, and uses | in place of a decimal point.

    In[3]:=

    Out[3]//NumberForm=