DecimalForm
DecimalForm[expr]
prints with approximate real numbers in expr always given in decimal form, without scientific notation.
DecimalForm[expr,n]
prints with approximate real numbers given in decimal form to n-digit precision.
DecimalForm[expr,{n,f}]
prints with approximate real numbers having n digits, with f digits to the right of the decimal point.
Details and Options
- DecimalForm is effectively equivalent to NumberForm with option ExponentFunction(Null&).
- The following options can be given:
-
DefaultPrintPrecision Automatic default print digits for machine numbers DigitBlock Infinity number of digits between breaks 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 SignPadding False whether to insert padding after the sign - The typeset form of DecimalForm[expr] is interpreted the same as expr when used in input. »
- When an input evaluates to DecimalForm[expr], DecimalForm does not appear in the output. »
Examples
open allclose allBasic Examples (2)
Scope (5)
Options (8)
DefaultPrintPrecision (1)
DigitBlock (2)
NumberPadding (1)
NumberSigns (1)
Properties & Relations (4)
Like DecimalForm, AccountingForm does not use scientific notation:
They differ in other aspects, like the representation of negative numbers:
NumberForm and PaddedForm have exponents for powers greater than 5:
ScientificForm has a single digit to the left of the decimal:
EngineeringForm uses exponents that are multiples of 3:
DecimalForm is effectively equivalent to NumberForm deactivating the option ExponentFunction:
The typeset form of DecimalForm[expr] is interpreted the same as expr when used in input:
Copy the output and paste it into an input cell. The 1000000. is interpreted as 1.`*^6:
When an input evaluates to DecimalForm[expr], DecimalForm does not appear in the output:
Out is assigned the value 1.`*^6, not DecimalForm[10.^6]:
Possible Issues (2)
Zeros will be added to the left of the decimal point for large numbers with few digits in input:
If the input precision is too small, a message will be issued:
The same message will be issued if few significant digits are requested:
Even when an output omits DecimalForm from the top level, it is not stripped from subexpressions:
The output does not have DecimalForm in it:
However, the variable e does have DecimalForm in it, which may affect subsequent evaluations:
The product is not evaluated due to the intervening DecimalForm:
Assign variables first and then apply DecimalForm to the result to maintain computability:
Text
Wolfram Research (2017), DecimalForm, Wolfram Language function, https://reference.wolfram.com/language/ref/DecimalForm.html.
CMS
Wolfram Language. 2017. "DecimalForm." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DecimalForm.html.
APA
Wolfram Language. (2017). DecimalForm. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DecimalForm.html