]> granicus.if.org Git - php/commitdiff
Added fmod() function
authorYasuo Ohgaki <yohgaki@php.net>
Thu, 21 Feb 2002 11:44:41 +0000 (11:44 +0000)
committerYasuo Ohgaki <yohgaki@php.net>
Thu, 21 Feb 2002 11:44:41 +0000 (11:44 +0000)
# Is there any reason that math.c does not use errno?

ext/standard/basic_functions.c
ext/standard/math.c
ext/standard/php_math.h

index 49cc891dbb4a19579b41d692207c422f29ad4938..12ce0f6e1a63e4f319041bd1f533797c552a6935 100644 (file)
@@ -475,6 +475,7 @@ function_entry basic_functions[] = {
        PHP_FE(dechex,                                                                                                                  NULL)
        PHP_FE(base_convert,                                                                                                    NULL)
        PHP_FE(number_format,                                                                                                   NULL)
+       PHP_FE(fmod,                                                                                                                    NULL)
        PHP_FE(ip2long,                                                                                                                 NULL)
        PHP_FE(long2ip,                                                                                                                 NULL)
 
index d594a5a21edb2d095545b9a4e101ed80bdde2a38..fea4be5f3b8cbc056c7116db3d48ce04a206a73b 100644 (file)
@@ -1046,6 +1046,21 @@ PHP_FUNCTION(number_format)
 }
 /* }}} */
 
+/* {{{ proto double fmod(double x, double y)
+   Returns the remainder of dividing x by y as a double */
+PHP_FUNCTION(fmod)
+{
+       double num1, num2;
+
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd",  &num1, &num2) == FAILURE) {
+               return;
+       }
+       
+       Z_DVAL_P(return_value) = fmod(num1, num2);
+       Z_TYPE_P(return_value) = IS_DOUBLE;
+}
+/* }}} */
+
 /*
  * Local variables:
  * tab-width: 4
index 496ccf1b808143eb5bd39fa9b2a51834c21fc52d..ceb6a0b09e506de63d7dd18192d11936ddb20a74 100644 (file)
@@ -58,6 +58,7 @@ PHP_FUNCTION(hexdec);
 PHP_FUNCTION(octdec);
 PHP_FUNCTION(base_convert);
 PHP_FUNCTION(number_format);
+PHP_FUNCTION(fmod);
 PHP_FUNCTION(deg2rad);
 PHP_FUNCTION(rad2deg);