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[expr]
prints using the default options of NumberForm.
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[expr]
prints using the default options of NumberForm.
Details and Options
- NumberForm works on integers as well as approximate real numbers.
- The following options can be given:
-
DefaultPrintPrecision Automatic default print digits for machine numbers DigitBlock Infinity number of digits between breaks ExponentFunction Automatic function to apply to exponents ExponentStep 1 steps by which exponents can increase NumberFormat Automatic function used to assemble the mantissa, base, and exponent NumberMultiplier "×" string to use to indicate multiplication NumberPadding {"","0"} strings to use for left and right padding NumberPoint "." decimal point string NumberSeparator {",", " "} string to insert at breaks between blocks NumberSigns {"-",""} strings to use for signs of negative and positive numbers ScientificNotationThreshold {-5,6} where to begin using scientific notation SignPadding False whether to insert padding after the sign - All options except ExponentFunction and ExponentStep apply to integers as well as approximate real numbers.
- You can mix NumberForm and BaseForm. »
- The typeset form of NumberForm[expr] is interpreted the same as expr when used in input. »
- When an input evaluates to NumberForm[expr], NumberForm does not appear in the output. »
Examples
open all close allBasic Examples (2)
Scope (6)
The default display for a machine number:
nE = N[E]Display more digits than the default:
NumberForm[nE, 10]NumberForm[nE, 3]NumberForm[RandomComplex[], 2]Format a high-precision number:
N[Pi, 50]NumberForm[%, 20]Change the display of numbers in a vector:
RandomReal[10, 5]NumberForm[%, 4]RandomReal[10, {3, 3}]NumberForm[%, 2]Change the display of inexact numbers in a mixed expression:
1 / 3.Sin[x / 7.]NumberForm[%, 3]This number renders in a notebook with two digits of precision:
Style[1.23456, PrintPrecision -> 2]Force the number to be rendered with default options:
NumberForm[%]Options (13)
DefaultPrintPrecision (1)
DigitBlock (2)
ExponentFunction (1)
Compute approximate powers of
:
p = N[E ^ Range[10, 50, 10]]Restrict exponents to multiples of 3:
NumberForm[p, ExponentFunction -> (3Quotient[#, 3]&)]Include exponents only for powers greater than 10:
NumberForm[p, ExponentFunction -> (If[-10 < # < 10, Null, #]&)]ExponentStep (1)
NumberFormat (1)
Display numbers in a Fortran‐like form:
v = {8. ^ 5, 11. ^ 7, 13. ^ 9}NumberForm[v, NumberFormat -> (Row[{#1, "e", #3}]&)]NumberForm[v, NumberFormat -> (#1&)]Display the exponents after converting to scientific form:
NumberForm[v, NumberFormat -> (#3&), ExponentFunction -> (#&)]NumberMultiplier (1)
NumberPadding (1)
NumberPoint (1)
NumberSeparator (1)
NumberSigns (1)
The default includes negative signs but not positive signs:
NumberForm[{-1 / 3., 2 / 3.}, 5]Include positive signs as well:
NumberForm[{-1 / 3., 2 / 3.}, 5, NumberSigns -> {"-", "+"}]NumberForm[{-1 / 3., 2 / 3.}, 5, NumberSigns -> {"minus ", "plus "}]ScientificNotationThreshold (1)
By default, real numbers between 10-5 and 106 in absolute value are printed in decimal form, and in scientific form otherwise:
NumberForm[{-0.00001234, 2.468032, 5234452.134}, 7]Change the transition thresholds:
NumberForm[{-0.00001234, 2.468032, 5234452.134}, 7, ScientificNotationThreshold -> {-4, 8}]Applications (1)
Properties & Relations (5)
NumberForm and PaddedForm use the same mantissas and exponents by default:
NumberForm[N[E ^ Range[10, 20, 2]], 10]PaddedForm[N[E ^ Range[10, 20, 2]], 10]ScientificForm has a single digit to the left of the decimal:
ScientificForm[N[E ^ Range[10, 20, 2]], 10]EngineeringForm uses exponents that are multiples of 3:
EngineeringForm[N[E ^ Range[10, 20, 2]], 10]AccountingForm does not have exponents:
AccountingForm[N[E ^ Range[10, 20, 2]], 10]b2 = BaseForm[123.45, 2]Represent the number precise to 3 decimal digits in base 2:
NumberForm[b2, 3]Reconstruct the base 10 number precise to 3 digits:
(2^^1.1110111)2 ^ 6Affect the display of numbers in MatrixForm or TableForm:
m = RandomReal[10 ^ 10, {3, 2}];{MatrixForm[m], NumberForm[MatrixForm[m], 3]}The typeset form of NumberForm[expr,n] is interpreted the same as expr when used in input:
{NumberForm[1.23, 2]}Copy the output and paste it into an input cell. The 1.2 is interpreted as 1.23:
{1.23}When an input evaluates to NumberForm[expr,n], NumberForm does not appear in the output:
NumberForm[1.23, 2]Out is assigned the value 1.23, not NumberForm[1.23,2]:
%Possible Issues (2)
Placeholder zeros may be needed if the requested precision is small:
NumberForm[12345.6, 3]Even when an output omits NumberForm from the top level, it is not stripped from subexpressions:
e = NumberForm[1.23, 2]The output does not have NumberForm in it:
%However, the variable e does have NumberForm in it, which may affect subsequent evaluations:
FullForm[e]The product is not evaluated due to the intervening NumberForm:
10 * eAssign variables first and then apply NumberForm to the result to maintain computability:
NumberForm[f = 1.23, 2]10 * fTech Notes
History
Introduced in 1988 (1.0) | Updated in 2003 (5.0) ▪ 2017 (11.2)
Text
Wolfram Research (1988), NumberForm, Wolfram Language function, https://reference.wolfram.com/language/ref/NumberForm.html (updated 2017).
CMS
Wolfram Language. 1988. "NumberForm." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/NumberForm.html.
APA
Wolfram Language. (1988). NumberForm. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NumberForm.html
BibTeX
@misc{reference.wolfram_2026_numberform, author="Wolfram Research", title="{NumberForm}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/NumberForm.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_numberform, organization={Wolfram Research}, title={NumberForm}, year={2017}, url={https://reference.wolfram.com/language/ref/NumberForm.html}, note=[Accessed: 12-June-2026]}