Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Number format code to display x significant figures

I know that the number of decimal places can be given by using 0's. However, I want to be able to display values to 4SF.

1.2345 -> '1.235'
12.345 -> '12.35'
123.45 -> '123.5'
1234.5 -> '1235'
12345  -> '12350'

Used in combination with this, I want to ultimately be able to express any value in this way:

1.2345 -> '1.235 '
123456 -> '123.5k'
12345678900000 -> '12.35T'
0.0000012345 -> '1.235μ'

This is for SI units. See metric prefix.

click to hide/show revision 2
Aligned displayed values.

Number format code to display x significant figures

I know that the number of decimal places can be given by using 0's. However, I want to be able to display values to 4SF.

1.2345 -> '1.235'
12.345 -> '12.35'
123.45 -> '123.5'
1234.5 -> '1235'
12345  -> '12350'

Used in combination with this, I want to ultimately be able to express any value in this way:

1.2345  -> '1.235 '
123456  -> '123.5k'
12345678900000 -> '12.35T'
0.0000012345  -> '1.235μ'

This is for SI units. See metric prefix.

click to hide/show revision 3
Added some more examples.

Number format code to display x significant figures

I know that the number of decimal places can be given by using 0's. However, I want to be able to display values to 4SF.

1.2345 -> '1.235'
12.345 -> '12.35'
123.45 -> '123.5'
1234.5 -> '1235'
12345  -> '12350'
0.1    -> '0.1000'
1      -> '1.000'
10     -> '10.00'
100    -> '100.0'
1000   -> '1000'

Used in combination with this, I want to ultimately be able to express any value in this way:

1.2345         -> '1.235 '
123456         -> '123.5k'
12345678900000 -> '12.35T'
0.0000012345   -> '1.235μ'

This is for SI units. See metric prefix.