From: Andrei Zmievski Date: Tue, 13 Jun 2000 04:31:02 +0000 (+0000) Subject: (php_math_number_format) Simplifying the logic also fixed bugs #4954 X-Git-Tag: php-4.0.1RC~228 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c85390a6916487ceb9d71057399360f4b9b36bb9;p=php (php_math_number_format) Simplifying the logic also fixed bugs #4954 and #4998. --- diff --git a/ext/standard/math.c b/ext/standard/math.c index c48fd1c0bb..26293eb293 100644 --- a/ext/standard/math.c +++ b/ext/standard/math.c @@ -636,14 +636,6 @@ char *_php_math_number_format(double d,int dec,char dec_point,char thousand_sep) return tmpbuf; } - if (dec_point!='.') { - for (t=tmpbuf; *t; t++) { - if (*t=='.') { - *t = dec_point; - break; - } - } - } if (dec) { reslen = dec+1 + (tmplen-dec-1) + (tmplen-1-dec-1)/3; } else { @@ -659,10 +651,11 @@ char *_php_math_number_format(double d,int dec,char dec_point,char thousand_sep) *t-- = 0; if (dec) { - while (*s!=dec_point) { + while (isdigit((int)*s)) { *t-- = *s--; } - *t-- = *s--; /* copy that dot */ + *t-- = dec_point; /* copy that dot */ + s--; } while(s>=tmpbuf) {