pollita Thu Feb 6 17:23:37 2003 EDT Modified files: (Branch: PHP_4_3) /php4/ext/bcmath bcmath.c Log: MFH(r-1.51) Index: php4/ext/bcmath/bcmath.c diff -u php4/ext/bcmath/bcmath.c:1.39.4.5 php4/ext/bcmath/bcmath.c:1.39.4.6 --- php4/ext/bcmath/bcmath.c:1.39.4.5 Tue Feb 4 16:39:50 2003 +++ php4/ext/bcmath/bcmath.c Thu Feb 6 17:23:36 2003 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: bcmath.c,v 1.39.4.5 2003/02/04 21:39:50 pollita Exp $ */ +/* $Id: bcmath.c,v 1.39.4.6 2003/02/06 22:23:36 pollita Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -158,7 +158,8 @@ php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC); php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC); bc_add (first, second, &result, scale); - result->n_scale = scale; + if (result->n_scale > scale) + result->n_scale = scale; Z_STRVAL_P(return_value) = bc_num2str(result); Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); Z_TYPE_P(return_value) = IS_STRING; @@ -202,7 +203,8 @@ php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC); php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC); bc_sub (first, second, &result, scale); - result->n_scale = scale; + if (result->n_scale > scale) + result->n_scale = scale; Z_STRVAL_P(return_value) = bc_num2str(result); Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); Z_TYPE_P(return_value) = IS_STRING; @@ -246,7 +248,8 @@ php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC); php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC); bc_multiply (first, second, &result, scale TSRMLS_CC); - result->n_scale = scale; + if (result->n_scale > scale) + result->n_scale = scale; Z_STRVAL_P(return_value) = bc_num2str(result); Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); Z_TYPE_P(return_value) = IS_STRING; @@ -291,7 +294,8 @@ php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC); switch (bc_divide (first, second, &result, scale TSRMLS_CC)) { case 0: /* OK */ - result->n_scale = scale; + if (result->n_scale > scale) + result->n_scale = scale; Z_STRVAL_P(return_value) = bc_num2str(result); Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); Z_TYPE_P(return_value) = IS_STRING; @@ -381,7 +385,8 @@ php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC); php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC); bc_raise (first, second, &result, scale TSRMLS_CC); - result->n_scale = scale; + if (result->n_scale > scale) + result->n_scale = scale; Z_STRVAL_P(return_value) = bc_num2str(result); Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); Z_TYPE_P(return_value) = IS_STRING; @@ -421,7 +426,8 @@ bc_init_num(&result TSRMLS_CC); php_str2num(&result, Z_STRVAL_PP(left) TSRMLS_CC); if (bc_sqrt (&result, scale TSRMLS_CC) != 0) { - result->n_scale = scale; + if (result->n_scale > scale) + result->n_scale = scale; Z_STRVAL_P(return_value) = bc_num2str(result); Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value)); Z_TYPE_P(return_value) = IS_STRING;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php