]> granicus.if.org Git - php/commitdiff
Bugfix #24063 (marcus/ilia)
authorMarcus Boerger <helly@php.net>
Fri, 8 Aug 2003 19:47:30 +0000 (19:47 +0000)
committerMarcus Boerger <helly@php.net>
Fri, 8 Aug 2003 19:47:30 +0000 (19:47 +0000)
main/snprintf.c

index d2cd7d967439c52f8081425a039bcda4bc96e034..bcd14f70361cb6434007638bd6ad24d3eef30c85 100644 (file)
@@ -344,9 +344,17 @@ ap_php_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag, char *buf)
                buf[0] = '\0';
                return (buf);
        }
-       while (p <= p1 && p < &buf[NDIG]) {
+       if (p <= p1 && p < &buf[NDIG]) {
                arg = modf(arg * 10, &fj);
-               *p++ = (int) fj + '0';
+               if ((int)fj==10) {
+                       *p++ = '1';
+                       fj = 0;
+                       *decpt = ++r2;
+               }
+               while (p <= p1 && p < &buf[NDIG]) {
+                       *p++ = (int) fj + '0';
+                       arg = modf(arg * 10, &fj);
+               }
        }
        if (p1 >= &buf[NDIG]) {
                buf[NDIG - 1] = '\0';