comparison src/core/ngx_string.c @ 3506:c3fa65192119

use double in %f format to allow %.15f precision
author Igor Sysoev <igor@sysoev.ru>
date Wed, 12 May 2010 13:12:31 +0000
parents 5d28d30ba1b1
children 76fc7ad463cb
comparison
equal deleted inserted replaced
3505:c631ef8beaaa 3506:c3fa65192119
73 * %[0][width][u][x|X]l long 73 * %[0][width][u][x|X]l long
74 * %[0][width|m][u][x|X]i ngx_int_t/ngx_uint_t 74 * %[0][width|m][u][x|X]i ngx_int_t/ngx_uint_t
75 * %[0][width][u][x|X]D int32_t/uint32_t 75 * %[0][width][u][x|X]D int32_t/uint32_t
76 * %[0][width][u][x|X]L int64_t/uint64_t 76 * %[0][width][u][x|X]L int64_t/uint64_t
77 * %[0][width|m][u][x|X]A ngx_atomic_int_t/ngx_atomic_uint_t 77 * %[0][width|m][u][x|X]A ngx_atomic_int_t/ngx_atomic_uint_t
78 * %[0][width][.width]f float 78 * %[0][width][.width]f double, max valid number fits to %18.15f
79 * %P ngx_pid_t 79 * %P ngx_pid_t
80 * %M ngx_msec_t 80 * %M ngx_msec_t
81 * %r rlim_t 81 * %r rlim_t
82 * %p void * 82 * %p void *
83 * %V ngx_str_t * 83 * %V ngx_str_t *
141 u_char * 141 u_char *
142 ngx_vslprintf(u_char *buf, u_char *last, const char *fmt, va_list args) 142 ngx_vslprintf(u_char *buf, u_char *last, const char *fmt, va_list args)
143 { 143 {
144 u_char *p, zero; 144 u_char *p, zero;
145 int d; 145 int d;
146 float f, scale; 146 double f, scale;
147 size_t len, slen; 147 size_t len, slen;
148 int64_t i64; 148 int64_t i64;
149 uint64_t ui64; 149 uint64_t ui64;
150 ngx_msec_t ms; 150 ngx_msec_t ms;
151 ngx_uint_t width, sign, hex, max_width, frac_width, n; 151 ngx_uint_t width, sign, hex, max_width, frac_width, n;
357 } 357 }
358 358
359 break; 359 break;
360 360
361 case 'f': 361 case 'f':
362 f = (float) va_arg(args, double); 362 f = va_arg(args, double);
363 363
364 if (f < 0) { 364 if (f < 0) {
365 *buf++ = '-'; 365 *buf++ = '-';
366 f = -f; 366 f = -f;
367 } 367 }