1PMNUMBERSTR(3)             Library Functions Manual             PMNUMBERSTR(3)
2
3
4

NAME

6       pmNumberStr, pmNumberStr_r - fixed width output format for numbers
7

C SYNOPSIS

9       #include <pcp/pmapi.h>
10
11       const char *pmNumberStr(double value);
12       char *pmNumberStr_r(double value, char *buf, int buflen);
13
14       cc ... -lpcp
15

DESCRIPTION

17       pmNumberStr  returns  the address of a 8-byte buffer that holds a null-
18       byte terminated representation of value suitable for output with  fixed
19       width fields.  The pmNumberStr_r function does the same, but stores the
20       result in a user-supplied buffer buf of  length  buflen,  which  should
21       have room for at least 8 bytes.
22
23       The  value  is  scaled  using multipliers in powers of ``one thousand''
24       (the decimal ``kilo'') and has a bias that provides  greater  precision
25       for positive numbers as opposed to negative numbers.
26
27       The  format  depends  on  the sign and magnitude of value as follows (d
28       represents a decimal digit):
29
30                    ┌──────────────────────────────────┬─────────┐
31value range            │ format  │
32                    ├──────────────────────────────────┼─────────┤
33                    │        > 999995000000000         │  inf?   
34                    │999995000000000 - 999995000000    │ ddd.ddT 
35                    │   999995000000 - 999995000       │ ddd.ddG 
36                    │      999995000 - 999995          │ ddd.ddM 
37                    │         999995 - 999.995         │ ddd.ddK 
38                    │        999.995 - 0.005           │ ddd.dd  │
39                    │          0.005 - -0.005          │   0.00  
40                    │         -0.005 - -99.95          │ -dd.dd  │
41                    │        -99.995 - -99995          │ -dd.ddK 
42                    │         -99995 - -99995000       │ -dd.ddM 
43                    │      -99995000 - -99995000000    │ -dd.ddG 
44                    │   -99995000000 - -99995000000000 │ -dd.ddT 
45                    │       < -99995000000000          │ -inf?   
46                    └──────────────────────────────────┴─────────┘
47       At the boundary points of the ranges, the chosen format will retain the
48       maximum number of significant digits.
49

NOTES

51       pmNumberStr  returns  a  pointer  to  a  static buffer and hence is not
52       thread-safe.  Multi-threaded applications should use pmNumberStr_r  in‐
53       stead.
54

SEE ALSO

56       printf(3)
57
58
59
60Performance Co-Pilot                  PCP                       PMNUMBERSTR(3)
Impressum