summaryrefslogtreecommitdiff
path: root/ext/standard/math.c
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2000-04-15 13:53:32 +0000
committerAndi Gutmans <andi@php.net>2000-04-15 13:53:32 +0000
commitf2ff9eeef58fb9bbb4c3220712ded9c5eac2f861 (patch)
tree91896632af0894a5fd7f06f7e05cc02d3b54ec86 /ext/standard/math.c
parent81138a641adbf0b53b3219661bde5061fedfd405 (diff)
downloadphp-git-f2ff9eeef58fb9bbb4c3220712ded9c5eac2f861.tar.gz
@ Fix bug in number_format (Jon Forsberg)
Diffstat (limited to 'ext/standard/math.c')
-rw-r--r--ext/standard/math.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/standard/math.c b/ext/standard/math.c
index fbc457abb4..3d15905823 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -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);