← Back to Overview

Rounding and precision

Round numbers to a specific number of decimal places or significant digits.

Fractional digits Jump to heading

Fractional digits are the number of digits to the right of the decimal point in a number.

{ 3.12345 :number maximumFractionDigits=2 }
{ 3 :number minimumFractionDigits=3 }

When using the minimumFractionDigits option, any missing decimal places in the original number are filled with zeros.

Significant digits Jump to heading

Significant digits are the number of digits that carry meaning in a number. They are used to indicate the precision of a measurement or calculation.

Any leading zeros are not considered significant. For example, 0.00123 has 3 significant digits, while 0.001230 has 4 significant digits.

{ 12.34 :number maximumSignificantDigits=3 }
{ 3 :number minimumSignificantDigits=3 }

When using the minimumSignificantDigits option, any missing significant digits in the original number are filled with zeros.

Related