cvs: /php3/functions math.c
| From: | Hartmut Holzgraefe | Date: | Wed, 01 Mar 2000 19:36:16 +0000 |
| Subject: | cvs: /php3/functions math.c | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-16224@lists.php.net to get a copy of this message | ||
hholzgra Wed Mar 1 11:36:16 2000 EDT
Modified files:
/php3/functions math.c
Log:
round(-0.1) will now return 0 instead of -0
Index: php3/functions/math.c
diff -u php3/functions/math.c:1.50 php3/functions/math.c:1.51
--- php3/functions/math.c:1.50 Tue Feb 22 07:13:57 2000
+++ php3/functions/math.c Wed Mar 1 11:36:15 2000
@@ -28,7 +28,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: math.c,v 1.50 2000/02/22 15:13:57 eschmid Exp $ */
+/* $Id: math.c,v 1.51 2000/03/01 19:36:15 hholzgra Exp $ */
#include "php.h"
#include "internal_functions.h"
#include "phpmath.h"
@@ -145,7 +145,10 @@
convert_string_to_number(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);
}
if (value->type == IS_LONG) {
RETURN_DOUBLE((double)value->value.lval);