How to | Change the Format of Numbers

While there is typically one representation for exact numbers, approximate numbers can be presented differently according to the conventions of different professions or personal preference. The Wolfram Language provides several ways to control the display of these numbers. Options for displaying numbers can also be specified by selecting the Numbers tab from Appearance in the Edit Preferences window.

Enter an integer:

Enter a rational number as the ratio of two integers. The Wolfram Language automatically cancels the common factors:

Enter an approximate real number by explicitly including a decimal point:

Enter a complex number:

Make a complex number with rational components:

Complex numbers can have mixed components:

    

To display an exact real number with a decimal point, turn it into an approximate real number. Here N turns into an approximate real number:

Also, any calculation mixing exact and approximate numbers gives an approximate result:

NumberForm displays a number to a given number of significant digits:

You can request n significant digits and k digits to the right of the decimal point by using the form NumberForm[expr,{n,k}]. If the digits are not known they are filled in with zeros:

If you use the Wolfram Language for accounting, use AccountingForm:

For scientific calculations, use ScientificForm:

You can also use EngineeringForm:

    

To change base, use BaseForm:

    

None of these forms allow further calculation; they are used for final display in tables, labels, and so on: