From: Dmitry Stogov Date: Sun, 27 Jul 2008 11:29:59 +0000 (+0000) Subject: Fix for bug #43487 (Wrong conversion of float to string) X-Git-Tag: BEFORE_HEAD_NS_CHANGE~1015 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=72392022d58922a3a0d26d812dfd7faac7542d00;p=php Fix for bug #43487 (Wrong conversion of float to string) --- diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c index 7f06b0e9ec..d42350c66f 100644 --- a/Zend/zend_strtod.c +++ b/Zend/zend_strtod.c @@ -991,9 +991,9 @@ static Bigint * diff(Bigint *a, Bigint *b) /* {{{ */ static double ulp (double _x) /* {{{ */ { - _double x; + volatile _double x; register Long L; - _double a; + volatile _double a; value(x) = _x; L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1; @@ -1035,7 +1035,7 @@ b2d { ULong *xa, *xa0, w, y, z; int k; - _double d; + volatile _double d; #ifdef VAX ULong d0, d1; #else @@ -1101,7 +1101,7 @@ static Bigint * d2b(double _d, int *e, int *bits) /* {{{ */ Bigint *b; int de, i, k; ULong *x, y, z; - _double d; + volatile _double d; #ifdef VAX ULong d0, d1; #endif @@ -1223,7 +1223,7 @@ static Bigint * d2b(double _d, int *e, int *bits) /* {{{ */ static double ratio (Bigint *a, Bigint *b) /* {{{ */ { - _double da, db; + volatile _double da, db; int k, ka, kb; value(da) = b2d(a, &ka); @@ -1492,7 +1492,7 @@ ZEND_API char * zend_dtoa(double _d, int mode, int ndigits, int *decpt, int *sig Bigint *b, *b1, *delta, *mlo, *mhi, *S, *tmp; double ds; char *s, *s0; - _double d, d2, eps; + volatile _double d, d2, eps; value(d) = _d; @@ -2056,7 +2056,7 @@ ZEND_API double zend_strtod (CONST char *s00, char **se) /* {{{ */ e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; CONST char *s, *s0, *s1; double aadj, aadj1, adj; - _double rv, rv0; + volatile _double rv, rv0; Long L; ULong y, z; Bigint *bb, *bb1, *bd, *bd0, *bs, *delta, *tmp;