Add engineering output mode

Similar to scientific mode, engineering mode also displays numbers in
base 10 exponential notation, with the difference that exponents are
always multiples of 3, to facilitate the interpretation in terms of
SI prefixes.

The mode is activated in config thru "engineering" or "eng. For base
and base2, it uses the special value 1000.
This commit is contained in:
Lucas Heitzmann Gabrielli
2021-06-07 14:11:07 -03:00
parent 3d33c6c6f4
commit 41b11ab785
8 changed files with 63 additions and 5 deletions

View File

@@ -165,8 +165,8 @@ DESCRIPTION
config("display", int)
The "display" parameter specifies the maximum number of digits after
the decimal point to be printed in real or exponential mode in
normal unformatted printing (print, strprint, fprint) or in
the decimal point to be printed in real, exponential or engineering
mode in normal unformatted printing (print, strprint, fprint) or in
formatted printing (printf, strprintf, fprintf) when precision is not
specified. The initial value for oldstd is 20, for newstd 10.
The parameter may be changed to the value d by either
@@ -234,6 +234,9 @@ DESCRIPTION
"sci"
"exp"
"engineering" base 10 notation with exponent base(10e6)
"eng" multiple of 3
Where multiple strings are given, the first string listed is what
config("mode") will return.