cvs: php4 /ext/standard basic_functions.c math.c php_math.h

From: Date: Thu, 21 Feb 2002 11:44:42 +0000
Subject: cvs: php4 /ext/standard basic_functions.c math.c php_math.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-9415@lists.php.net to get a copy of this message
yohgaki Thu Feb 21 06:44:42 2002 EDT Modified files: /php4/ext/standard basic_functions.c math.c php_math.h Log: Added fmod() function # Is there any reason that math.c does not use errno? Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.443 php4/ext/standard/basic_functions.c:1.444 --- php4/ext/standard/basic_functions.c:1.443 Wed Feb 20 22:32:41 2002 +++ php4/ext/standard/basic_functions.c Thu Feb 21 06:44:39 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.443 2002/02/21 03:32:41 andrei Exp $ */ +/* $Id: basic_functions.c,v 1.444 2002/02/21 11:44:39 yohgaki Exp $ */ #include "php.h" #include "php_main.h" @@ -475,6 +475,7 @@ 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: php4/ext/standard/math.c diff -u php4/ext/standard/math.c:1.77 php4/ext/standard/math.c:1.78 --- php4/ext/standard/math.c:1.77 Mon Jan 28 11:06:27 2002 +++ php4/ext/standard/math.c Thu Feb 21 06:44:41 2002 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: math.c,v 1.77 2002/01/28 16:06:27 jon Exp $ */ +/* $Id: math.c,v 1.78 2002/02/21 11:44:41 yohgaki Exp $ */ #include "php.h" #include "php_math.h" @@ -1043,6 +1043,21 @@ WRONG_PARAM_COUNT; break; } +} +/* }}} */ + +/* {{{ 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; } /* }}} */ Index: php4/ext/standard/php_math.h diff -u php4/ext/standard/php_math.h:1.14 php4/ext/standard/php_math.h:1.15 --- php4/ext/standard/php_math.h:1.14 Wed Jan 9 18:59:04 2002 +++ php4/ext/standard/php_math.h Thu Feb 21 06:44:41 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_math.h,v 1.14 2002/01/09 23:59:04 jimw Exp $ */ +/* $Id: php_math.h,v 1.15 2002/02/21 11:44:41 yohgaki Exp $ */ #ifndef PHP_MATH_H #define PHP_MATH_H @@ -58,6 +58,7 @@ PHP_FUNCTION(octdec); PHP_FUNCTION(base_convert); PHP_FUNCTION(number_format); +PHP_FUNCTION(fmod); PHP_FUNCTION(deg2rad); PHP_FUNCTION(rad2deg);

« previous php.cvs (#9415) next »