summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAndrei Zmievski <andrei@php.net>2000-06-13 04:31:02 +0000
committerAndrei Zmievski <andrei@php.net>2000-06-13 04:31:02 +0000
commitc85390a6916487ceb9d71057399360f4b9b36bb9 (patch)
treebe9454a5bcd7505ec2f545be00952af9e6a341e7 /ext
parent6303aec7ffbd0005fe6cebca5fb81d6dd87f666a (diff)
downloadphp-git-c85390a6916487ceb9d71057399360f4b9b36bb9.tar.gz
(php_math_number_format) Simplifying the logic also fixed bugs #4954
and #4998.
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/math.c13
1 files changed, 3 insertions, 10 deletions
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) {