diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2017-09-11 23:44:23 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2017-09-11 23:44:23 +0200 |
commit | 9aa6898b9be78bb1e138488c3204bb745a31aca7 (patch) | |
tree | c972d828b1864fca92693827cd39ce7bf6ee284b /ext/bcmath/libbcmath/src | |
parent | d103802003aaa808e07e52d957e346fe4fb75952 (diff) | |
download | php-git-9aa6898b9be78bb1e138488c3204bb745a31aca7.tar.gz |
Fixed bug #46781 (BC math handles minus zero incorrectly)
Actually, there is no negative zero at all. We obey Postel's law, and
still accept negative zeroes, but we store them as positive zeroes
after the conversion from string, i.e. we normalize before further
processing.
Diffstat (limited to 'ext/bcmath/libbcmath/src')
-rw-r--r-- | ext/bcmath/libbcmath/src/str2num.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/bcmath/libbcmath/src/str2num.c b/ext/bcmath/libbcmath/src/str2num.c index ef505e86e1..62544de80e 100644 --- a/ext/bcmath/libbcmath/src/str2num.c +++ b/ext/bcmath/libbcmath/src/str2num.c @@ -105,5 +105,8 @@ bc_str2num (bc_num *num, char *str, int scale) for (;strscale > 0; strscale--) *nptr++ = CH_VAL(*ptr++); } + + if (bc_is_zero (*num)) + (*num)->n_sign = PLUS; } |