Rev 10 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 10 | Rev 3718 | ||
---|---|---|---|
Line 19... | Line 19... | ||
19 | void float2str(double d, char *p) |
19 | void float2str(double d, char *p) |
20 | { |
20 | { |
21 | char buf[64], *pp; |
21 | char buf[64], *pp; |
22 | int i; |
22 | int i; |
23 | if(d==0) { |
23 | if(d==0) { |
24 |
|
24 | ovlstrcpy(p,"0"); return; |
25 | } |
25 | } |
26 | i=10; /* simple precision cookup */ |
26 | i=10; /* simple precision cookup */ |
27 | snprintf(buf,sizeof(buf),"%%.%dg",i); |
27 | snprintf(buf,sizeof(buf),"%%.%dg",i); |
28 | snprintf(p,MAX_LINELEN,buf,(double) d); |
28 | snprintf(p,MAX_LINELEN,buf,(double) d); |
29 | pp=p;while(isspace(*pp)) pp++; |
29 | pp=p;while(isspace(*pp)) pp++; |
30 | if(pp>p) |
30 | if(pp>p) ovlstrcpy(p,pp); |
31 | } |
31 | } |
32 | 32 | ||
33 | /* substitute variable names by their environment strings |
33 | /* substitute variable names by their environment strings |
34 | * The buffer pointed to by p must have enough space |
34 | * The buffer pointed to by p must have enough space |
35 | * (defined by MAX_LINELEN). */ |
35 | * (defined by MAX_LINELEN). */ |