apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Gottfrid" <dgottf...@gmail.com>
Subject issue w/ formatting %g
Date Fri, 25 May 2007 16:14:22 GMT
I see behavior from apr_psprintf using the %g format flag that I do
from normal printf on linux and solaris.  It doesn't prepend a leading
zero for values  between 1 and -1 -ie  .3 instead of 0.3

Is there any interested other than mine in changing this behavior?

derek


Sample

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <apr_strings.h>

int main(int argc, char **argv) {
        apr_pool_t *mpool;
        double g = .3;
        apr_status_t status = apr_initialize();
        status = apr_pool_create(&mpool,NULL);
        printf("%g\n",g);
        printf("%s\n",apr_psprintf(mpool,"%g",g));
        apr_pool_destroy(mpool);
        apr_terminate();
        return 0;
}

output:

0.3
.3

Mime
View raw message