cvs: /php4/ext/standard math.c

From: Date: Wed, 01 Mar 2000 19:37:08 +0000
Subject: cvs: /php4/ext/standard math.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-11280@lists.php.net to get a copy of this message
hholzgra Wed Mar 1 11:37:08 2000 EDT Modified files: /php4/ext/standard math.c Log: round(-0.1) will now return 0 instead of -0 Index: php4/ext/standard/math.c diff -u php4/ext/standard/math.c:1.15 php4/ext/standard/math.c:1.16 --- php4/ext/standard/math.c:1.15 Thu Feb 24 00:39:02 2000 +++ php4/ext/standard/math.c Wed Mar 1 11:36:37 2000 @@ -101,6 +101,7 @@ /* }}} */ /* {{{ proto int round(double number) + Returns the rounded value of the number */ #ifndef HAVE_RINT @@ -128,7 +129,10 @@ convert_scalar_to_number_ex(value); if ((*value)->type == IS_DOUBLE) { - RETURN_DOUBLE(rint((*value)->value.dval)); + double d; + d=rint((*value)->value.dval); + if(d==0.0) d=0.0; /* workaround for rint() returning -0 instead of 0 */ + RETURN_DOUBLE(d); } else if ((*value)->type == IS_LONG) { RETURN_DOUBLE((double)(*value)->value.lval); }

« previous php.version4 (#11280) next »