- Converted math.c to use new convert_to_number_ex() macro.
authorAndi Gutmans <andi@php.net>
Fri, 15 Oct 1999 06:31:40 +0000 (06:31 +0000)
committerAndi Gutmans <andi@php.net>
Fri, 15 Oct 1999 06:31:40 +0000 (06:31 +0000)
ext/standard/math.c
php4dllts.dsp
tests/testarray
tests/testfuncref

index 3753e337889320ab1e883a4dc2f634c5daeb674b..a606c28407ccc4724021b26d49caeead96ef9b42 100644 (file)
@@ -43,15 +43,11 @@ PHP_FUNCTION(abs)
                WRONG_PARAM_COUNT;
        }
 
-       if ((*value)->type == IS_STRING) {
-               zval_copy_ctor(*value);
-               convert_scalar_to_number(*value);
-       }
-
+       convert_scalar_to_number_ex(value);
+       
        if ((*value)->type == IS_DOUBLE) {
                RETURN_DOUBLE(fabs((*value)->value.dval));
-       }
-       else if ((*value)->type == IS_LONG) {
+       } else if ((*value)->type == IS_LONG) {
                RETURN_LONG(labs((*value)->value.lval));
        }
 
@@ -70,15 +66,11 @@ PHP_FUNCTION(ceil)
                WRONG_PARAM_COUNT;
        }
 
-       if ((*value)->type == IS_STRING) {
-               zval_copy_ctor(*value);
-               convert_scalar_to_number(*value);
-       }
+       convert_scalar_to_number_ex(value);
 
        if ((*value)->type == IS_DOUBLE) {
                RETURN_LONG((long)ceil((*value)->value.dval));
-       }
-       else if ((*value)->type == IS_LONG) {
+       } else if ((*value)->type == IS_LONG) {
                RETURN_LONG((*value)->value.lval);
        }
 
@@ -96,15 +88,11 @@ PHP_FUNCTION(floor) {
                WRONG_PARAM_COUNT;
        }
 
-       if ((*value)->type == IS_STRING) {
-               zval_copy_ctor(*value);
-               convert_scalar_to_number(*value);
-       }
+       convert_scalar_to_number_ex(value);
 
        if ((*value)->type == IS_DOUBLE) {
                RETURN_LONG((long)floor((*value)->value.dval));
-       }
-       else if ((*value)->type == IS_LONG) {
+       } else if ((*value)->type == IS_LONG) {
                RETURN_LONG((*value)->value.lval);
        }
 
@@ -136,14 +124,12 @@ PHP_FUNCTION(round)
        if (ARG_COUNT(ht) != 1 || getParametersEx(1, &value) == FAILURE) {
                WRONG_PARAM_COUNT;
        }
-       if ((*value)->type == IS_STRING) {
-               zval_copy_ctor(*value);
-               convert_scalar_to_number(*value);
-       }
+
+       convert_scalar_to_number_ex(value);
+
        if ((*value)->type == IS_DOUBLE) {
                RETURN_DOUBLE(rint((*value)->value.dval));
-       }
-       if ((*value)->type == IS_LONG) {
+       } else if ((*value)->type == IS_LONG) {
                RETURN_DOUBLE((double)(*value)->value.lval);
        }
        RETURN_FALSE;
index 8f73d1fac12957f3908ad13f83f56ff3e42d6f47..012f358640b8c06182ce99598bbef340515398e2 100644 (file)
@@ -866,6 +866,10 @@ SOURCE=.\LICENSE
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=.\NEWS\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=".\php.ini-dist"\r
 # End Source File\r
 # End Group\r
index 2928fff02538d47b816375c7b7e086f6ab51ccb2..a8d3d66a91f911874df1bbc529c4fda462251f92 100644 (file)
@@ -4,11 +4,11 @@ This is a small test...
  * this is a multiline comment...
  */
 
-//for ($j=0; $j<=200; $j++) {
+for ($j=0; $j<=20; $j++) {
        for ($i[0][0]=0; $i[0][0]<10000; $i[0][0]++) {
                $i[1] += $i[0][0];  // this is a single line comment
        }
-//}
+}
 
 /* this is another multi
 line
index 675c70de81c291bd9d84824568c072664016187a..217e4d14e0b7d00d62c0c57488c2ae65d44f87cf 100644 (file)
@@ -5,4 +5,6 @@ function foobar()
        print "foobar\n";
 }
 
+$foobar = "foobar";
+
 $a = ${"foo"."bar"}();