6. Number Formatting

In PEMDAS, there are several different ways to format numbers and answers. Note that formatting does not change the actual number, it only changes what appears on the screen. In other words, if you have the significant figure precision set to 2, the number 5.4321 will be displayed as 5.4, but all calculations will use the 5.4321 value.

Formatting Types

There are several different ways that PEMDAS can format numbers:

• Float: Leaves the number alone.
• Scientific: Puts the number in scientific notation.
• Engineering: Puts the number in engineering notation, which is similar to scientific except the exponents are shown in multiples of 3.
• Percent: Puts the number into "percent" form, which is similar to Float, except the number has been multiplied by 100.
• Binary: Puts the number into binary (base 2) form. The number is prefixed with 0b. *
• Octal: Puts the number into octal (base 8) form. The number is prefixed with 0o. *
• Hexadecimal: Puts the number into hexadecimal (base 16) form. The number is prefixed with 0x. *

* Note that when Binary, Octal, or the Hexadecimal formatting is applied to a non-integer number, it will be floored prior to formatting. When this happens, a (Floored) notice will appear after the number. See below for examples.

Examples are in the sections below.

Float Formatting Type

Using the Float preference:

123456.78

= 123456.78

0.012345

= 0.012345

Scientific Formatting Type

Using the Scientific preference:

123456.78

= 1.2345678e5

0.012345

= 1.2345e-2

Using the Scientific preference, with decimal places limited to 4 (see the Decimal Places below for more information on limiting decimal places):

123456.78

= 1.235e5

0.012345

= 1.235e-2

Engineering Formatting Type

Using the Engineering preference.

123456.78

0.012345

0.012345

= 12.345e-3

Using the Engineering preference, with decimal places set to 4:

123456.78

= 123.4568e3

0.012345

= 12.3450e-3

Percentage Formatting Type

Using the Percentage preference, and Thousands Separators enabled:

123456.78

= 12,345,678%

0.012345

= 1.2345%

Binary Formatting Type

Using the Binary preference

123456.78

= 0b0001 1110 0010 0100 0000 (Floored)

0.012345

= 0b0 (Floored)

255

= 0b1111 1111

64

= 0b0100 0000

Octal Formatting Type

Using the Octal preference:

123456.78

= 0o361100 (Floored)

0.012345

= 0o0 (Floored)

255

= 0o377

64

= 0o100

123456.78

= 0x1E240 (Floored)

0.012345

= 0x0 (Floored)

255

= 0oFF

64

= 0x40

Significant Figures

You can limit the amount of significant figures that are displayed. If the number has fewer significant figures than the amount you specify, PEMDAS will leave the number alone.

Examples:

With significant figures being limited to 4 significant figures:

123456.78

= 123500

0.012345

= 0.01235

0.012

= 0.012

Decimal Places

You can set the amount of decimals to be displayed. This preference can be useful when dealing with things like money.

Examples:

With decimal places being set to 4 decimal places:

123456.78

= 123456.7800

0.012345

= 0.0123

0.012

= 0.0120

0.000012

= 0.0000

Thousands Separators

Thousand separators are only available when the number is formatted as a Float or a Percent. In locales that use a decimal (.) as a radix point, the thousands separator is a comma, while in regions that use a comma as a radix point, the thousands separator is a space.

Thousands separators are enabled by default. This can be changed in the Formatting tab on the back of the widget by unchecking the "Use Thousands Separators" preference. The thousands separator character can be modified by changing the "Thousands Separator" selection on the back of the widget.

Examples:

123456.78

= 123,456.78