[rrd-users] Re: RRD graph formatting
Haroon Rafique
haroon.rafique at utoronto.ca
Mon Nov 1 22:26:53 MET 2004
On Today at 2:10pm, RN=>Robert Nelson <rnelson at windchannel.com> wrote:
RN> Hello,
RN>
RN> I was wondering if someone could explain to me the difference between
RN> %le, %lf, and %lg, and other formatting characters - or point me to
RN> the document to look in. I can't seem to find anything on the web page
RN> or in the man pages to describe this. Thanks.
RN>
Hi Rob,
I haven't seen a reply so far. From:
man 3 printf
on my machine (Gentoo Linux), I get:
e,E The double argument is rounded and converted in the style
[-]d.ddde<B1>dd where there is one digit before the
decimal-point character and the number of digits after it is
equal to the pre cision; if the precision is missing, it is
taken as 6; if the precision is zero, no decimal-point
character appears. An E conversion uses the letter E
(rather than e) to introduce the exponent. The exponent
always contains at least two digits; if the value is zero,
the exponent is 00.
f,F The double argument is rounded and converted to decimal
notation in the style [-]ddd.ddd, where the number of digits
after the decimal-point character is equal to the precision
specification. If the precision is missing, it is taken as
6; if the precision is explicitly zero, no decimal-point
character appears. If a decimal point appears, at least one
digit appears before it. (The SUSv2 does not know about F
and says that character string representations for infinity
and NaN may be made available. The C99 standard specifies
`[-]inf' or `[-]infinity' for infinity, and a string
starting with `nan' for NaN, in the case of f con- version,
and `[-]INF' or `[-]INFINITY' or `NAN*' in the case of F
conversion.)
g,G The double argument is converted in style f or e (or F or E
for G conversions). The precision specifies the number of
signifi- cant digits. If the precision is missing, 6 digits
are given; if the precision is zero, it is treated as 1.
Style e is used if the exponent from its conversion is less
than -4 or greater than or equal to the precision.
Trailing zeros are removed from the fractional part of the
result; a decimal point appears only if it is followed by at
least one digit.
Here's sample output from my /usr/bin/printf program (part of coreutils):
$ printf %lf 0.0
0.000000
$ printf %le 0.0
0.000000e+00
$ printf %lg 0.0
0
In my rrd graphs, I mostly use %lf followed by a space followed by %s.
>From man rrdgraph:
If an additional '%s' is found AFTER the marker, the value will
be scaled and an appropriate SI magnitude unit will be printed
in place of the '%s' marker.
Cheers,
--
Haroon Rafique
<haroon.rafique at utoronto.ca>
--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the rrd-users
mailing list