]> granicus.if.org Git - php/commitdiff
@ Fix bug in number_format (Jon Forsberg)
authorAndi Gutmans <andi@php.net>
Sat, 15 Apr 2000 13:53:32 +0000 (13:53 +0000)
committerAndi Gutmans <andi@php.net>
Sat, 15 Apr 2000 13:53:32 +0000 (13:53 +0000)
ext/standard/math.c

index fbc457abb42ad9acef98476eae6ec3dccf45f3db..3d15905823d0d7f2f92e6be55854f0fd566f91d3 100644 (file)
@@ -25,6 +25,7 @@
 #include "phpmath.h"
 
 #include <math.h>
+#include <float.h>
 
 #ifndef M_PI
 #define M_PI 3.14159265358979323846
@@ -612,7 +613,7 @@ char *_php_math_number_format(double d,int dec,char dec_point,char thousand_sep)
                d = -d;
        }
        dec = MAX(0,dec);
-       tmpbuf = (char *) emalloc(32+dec);
+       tmpbuf = (char *) emalloc(1+DBL_MAX_10_EXP+1+dec+1);
        
        tmplen=sprintf(tmpbuf,"%.*f",dec,d);