I've searched for how to do engineering notation, and found the same answer in several places (multiple threads here and on other sites) but that answer isn't correct. Formats such as ##0.0E+0 give a fixed number of decimal places in the mantissa, but proper engineering notation adjusts the number of decimal places to keep the number of signicant figures constant. See examples below.
[TABLE="width: 300"]
<tbody>[TR]
[TD]
[TD]
[TD]
[/TR]
[TR]
[TD]pi()*10^6
[/TD]
[TD]3.1E+6
[/TD]
[TD]3.14E+6
[/TD]
[/TR]
[TR]
[TD]pi()*10^5
[/TD]
[TD]314.2E+3
[/TD]
[TD]314E+3
[/TD]
[/TR]
[TR]
[TD]pi()*10^4
[/TD]
[TD]31.4E+3
[/TD]
[TD]31.4E+3
[/TD]
[/TR]
[TR]
[TD]pi()10^3
[/TD]
[TD]3.1E+3
[/TD]
[TD]3.14E+3
[/TD]
[/TR]
[TR]
[TD]pi*10^-4
[/TD]
[TD]314.2E-6
[/TD]
[TD]314E-6
[/TD]
[/TR]
</tbody>[/TABLE]
See the difference? In regular scientific notation there are always the same number of significant digits, one before the decimal and as specified after. Engineering notation is also supposed to have a constant number of significant digits.
So can anyone think of a way to do it right?
[TABLE="width: 300"]
<tbody>[TR]
[TD]
Number
[/TD][TD]
##0.3E+0
[/TD][TD]
Engineering
Notation
(three digits)
[/TD]Notation
(three digits)
[/TR]
[TR]
[TD]pi()*10^6
[/TD]
[TD]3.1E+6
[/TD]
[TD]3.14E+6
[/TD]
[/TR]
[TR]
[TD]pi()*10^5
[/TD]
[TD]314.2E+3
[/TD]
[TD]314E+3
[/TD]
[/TR]
[TR]
[TD]pi()*10^4
[/TD]
[TD]31.4E+3
[/TD]
[TD]31.4E+3
[/TD]
[/TR]
[TR]
[TD]pi()10^3
[/TD]
[TD]3.1E+3
[/TD]
[TD]3.14E+3
[/TD]
[/TR]
[TR]
[TD]pi*10^-4
[/TD]
[TD]314.2E-6
[/TD]
[TD]314E-6
[/TD]
[/TR]
</tbody>[/TABLE]
See the difference? In regular scientific notation there are always the same number of significant digits, one before the decimal and as specified after. Engineering notation is also supposed to have a constant number of significant digits.
So can anyone think of a way to do it right?