changeset 3507:76fc7ad463cb

fix rounding issues in %f format
author Igor Sysoev <igor@sysoev.ru>
date Wed, 12 May 2010 13:13:11 +0000
parents c3fa65192119
children 05e964be70a2
files src/core/ngx_string.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/ngx_string.c
+++ b/src/core/ngx_string.c
@@ -386,7 +386,7 @@ ngx_vslprintf(u_char *buf, u_char *last,
                      * (int64_t) cast is required for msvc6:
                      * it can not convert uint64_t to double
                      */
-                    ui64 = (uint64_t) ((f - (int64_t) ui64) * scale);
+                    ui64 = (uint64_t) ((f - (int64_t) ui64) * scale + 0.5);
 
                     buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width);
                 }