/* {{{ proto int abs(int number)
Return the absolute value of the number */
-
PHP_FUNCTION(abs)
{
zval **value;
- if (ZEND_NUM_ARGS()!=1||zend_get_parameters_ex(1, &value)==FAILURE) {
+ if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &value) == FAILURE) {
WRONG_PARAM_COUNT;
}
RETURN_LONG(Z_LVAL_PP(value) < 0 ? -Z_LVAL_PP(value) : Z_LVAL_PP(value));
}
}
-
RETURN_FALSE;
}
-
/* }}} */
+
/* {{{ proto float ceil(float number)
Returns the next highest integer value of the number */
PHP_FUNCTION(ceil)
{
zval **value;
- if (ZEND_NUM_ARGS()!=1||zend_get_parameters_ex(1, &value)==FAILURE) {
+ if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &value) == FAILURE) {
WRONG_PARAM_COUNT;
}
RETURN_FALSE;
}
-
/* }}} */
+
/* {{{ proto float floor(float number)
Returns the next lowest integer value from the number */
PHP_FUNCTION(floor)
{
zval **value;
- if (ZEND_NUM_ARGS()!=1||zend_get_parameters_ex(1, &value)==FAILURE) {
+ if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &value) == FAILURE) {
WRONG_PARAM_COUNT;
}
RETURN_FALSE;
}
-
/* }}} */
-
/* {{{ proto float round(float number [, int precision])
Returns the number rounded to specified precision */
PHP_FUNCTION(round)
}
}
/* }}} */
+
/* {{{ proto float sin(float number)
Returns the sine of the number in radians */
-
PHP_FUNCTION(sin)
{
zval **num;
Z_DVAL_P(return_value) = sin(Z_DVAL_PP(num));
Z_TYPE_P(return_value) = IS_DOUBLE;
}
-
/* }}} */
+
/* {{{ proto float cos(float number)
Returns the cosine of the number in radians */
-
PHP_FUNCTION(cos)
{
zval **num;
Z_TYPE_P(return_value) = IS_DOUBLE;
}
/* }}} */
+
/* {{{ proto float tan(float number)
Returns the tangent of the number in radians */
PHP_FUNCTION(tan)
Z_DVAL_P(return_value) = tan(Z_DVAL_PP(num));
Z_TYPE_P(return_value) = IS_DOUBLE;
}
-
/* }}} */
+
/* {{{ proto float asin(float number)
Returns the arc sine of the number in radians */
-
PHP_FUNCTION(asin)
{
zval **num;
Z_DVAL_P(return_value) = asin(Z_DVAL_PP(num));
Z_TYPE_P(return_value) = IS_DOUBLE;
}
-
/* }}} */
+
/* {{{ proto float acos(float number)
Return the arc cosine of the number in radians */
-
PHP_FUNCTION(acos)
{
zval **num;
Z_DVAL_P(return_value) = acos(Z_DVAL_PP(num));
Z_TYPE_P(return_value) = IS_DOUBLE;
}
-
/* }}} */
+
/* {{{ proto float atan(float number)
Returns the arc tangent of the number in radians */
-
PHP_FUNCTION(atan)
{
zval **num;
Z_DVAL_P(return_value) = atan(Z_DVAL_PP(num));
Z_TYPE_P(return_value) = IS_DOUBLE;
}
-
/* }}} */
+
/* {{{ proto float atan2(float y, float x)
Returns the arc tangent of y/x, with the resulting quadrant determined by the signs of y and x */
-
PHP_FUNCTION(atan2)
{
zval **num1, **num2;
Z_DVAL_P(return_value) = atan2(Z_DVAL_PP(num1), Z_DVAL_PP(num2));
Z_TYPE_P(return_value) = IS_DOUBLE;
}
-
/* }}} */
+
/* {{{ proto float sinh(float number)
Returns the hyperbolic sine of the number, defined as (exp(number) - exp(-number))/2 */
-
PHP_FUNCTION(sinh)
{
zval **num;
Z_DVAL_P(return_value) = sinh(Z_DVAL_PP(num));
Z_TYPE_P(return_value) = IS_DOUBLE;
}
-
/* }}} */
+
/* {{{ proto float cosh(float number)
Returns the hyperbolic cosine of the number, defined as (exp(number) + exp(-number))/2 */
-
PHP_FUNCTION(cosh)
{
zval **num;
Z_TYPE_P(return_value) = IS_DOUBLE;
}
/* }}} */
+
/* {{{ proto float tanh(float number)
Returns the hyperbolic tangent of the number, defined as sinh(number)/cosh(number) */
PHP_FUNCTION(tanh)
Z_DVAL_P(return_value) = tanh(Z_DVAL_PP(num));
Z_TYPE_P(return_value) = IS_DOUBLE;
}
-
/* }}} */
#if !defined(PHP_WIN32) && !defined(NETWARE)
#endif /* HAVE_ATANH */
#endif /* !defined(PHP_WIN32) && !defined(NETWARE) */
-
/* {{{ proto float pi(void)
Returns an approximation of pi */
PHP_FUNCTION(pi)
}
/* }}} */
-
/* {{{ proto bool is_finite(float val)
Returns whether argument is finite */
PHP_FUNCTION(is_finite)
/* {{{ proto float exp(float number)
Returns e raised to the power of the number */
-
PHP_FUNCTION(exp)
{
zval **num;
Z_DVAL_P(return_value) = exp(Z_DVAL_PP(num));
Z_TYPE_P(return_value) = IS_DOUBLE;
}
-
/* }}} */
-
#if !defined(PHP_WIN32) && !defined(NETWARE)
/* {{{ proto float expm1(float number)
Returns exp(number) - 1, computed in a way that accurate even when the value of number is close to zero */
-
/*
WARNING: this function is expermental: it could change its name or
disappear in the next version of PHP!
*/
-
PHP_FUNCTION(expm1)
{
zval **num;
Z_DVAL_P(return_value) = expm1(Z_DVAL_PP(num));
Z_TYPE_P(return_value) = IS_DOUBLE;
}
-
/* }}} */
+
+#ifdef HAVE_LOG1P
/* {{{ proto float log1p(float number)
Returns log(1 + number), computed in a way that accurate even when the value of number is close to zero */
-
/*
WARNING: this function is expermental: it could change its name or
disappear in the next version of PHP!
*/
-
PHP_FUNCTION(log1p)
{
-#ifdef HAVE_LOG1P
zval **num;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
convert_to_double_ex(num);
Z_DVAL_P(return_value) = log1p(Z_DVAL_PP(num));
Z_TYPE_P(return_value) = IS_DOUBLE;
-#endif
}
-
/* }}} */
+#endif /* HAVE_LOG1P */
+#endif /* !defined(PHP_WIN32) && !defined(NETWARE) */
-#endif
/* {{{ proto float log(float number, [float base])
Returns the natural logarithm of the number, or the base log if base is specified */
-
PHP_FUNCTION(log)
{
zval **num, **base;
WRONG_PARAM_COUNT;
}
}
-
/* }}} */
+
/* {{{ proto float log10(float number)
Returns the base-10 logarithm of the number */
-
PHP_FUNCTION(log10)
{
zval **num;
Z_DVAL_P(return_value) = log10(Z_DVAL_PP(num));
Z_TYPE_P(return_value) = IS_DOUBLE;
}
-
/* }}} */
+
/* {{{ proto float sqrt(float number)
Returns the square root of the number */
-
PHP_FUNCTION(sqrt)
{
zval **num;
Z_DVAL_P(return_value) = sqrt(Z_DVAL_PP(num));
Z_TYPE_P(return_value) = IS_DOUBLE;
}
-
/* }}} */
-
/* {{{ proto float hypot(float num1, float num2)
Returns sqrt(num1*num1 + num2*num2) */
-
PHP_FUNCTION(hypot)
{
zval **num1, **num2;
#endif
Z_TYPE_P(return_value) = IS_DOUBLE;
}
-
/* }}} */
/* {{{ proto float deg2rad(float number)
Converts the number in degrees to the radian equivalent */
-
PHP_FUNCTION(deg2rad)
{
zval **deg;
convert_to_double_ex(deg);
RETVAL_DOUBLE((Z_DVAL_PP(deg) / 180.0) * M_PI);
}
-
/* }}} */
+
/* {{{ proto float rad2deg(float number)
Converts the radian number to the equivalent number in degrees */
-
PHP_FUNCTION(rad2deg)
{
zval **rad;
convert_to_double_ex(rad);
RETVAL_DOUBLE((Z_DVAL_PP(rad) / M_PI) * 180);
}
-
/* }}} */
-/* {{{ _php_math_basetolong */
+/* {{{ _php_math_basetolong */
/*
* Convert a string representation of a base(2-36) number to a long.
*/
-PHPAPI long
-_php_math_basetolong(zval *arg, int base) {
+PHPAPI long _php_math_basetolong(zval *arg, int base)
+{
long num = 0, digit, onum;
int i;
char c, *s;
return num;
}
-
/* }}} */
-/* {{{ _php_math_longtobase */
/* {{{ _php_math_basetozval */
-
/*
* Convert a string representation of a base(2-36) number to a zval.
*/
-PHPAPI int
-_php_math_basetozval(zval *arg, int base, zval *ret) {
+PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret)
+{
long num = 0;
double fnum = 0;
int i;
}
return SUCCESS;
}
-
/* }}} */
-/* {{{ _php_math_longtobase */
+/* {{{ _php_math_longtobase */
/*
* Convert a long to a string containing a base(2-36) representation of
* the number.
*/
-PHPAPI char *
-_php_math_longtobase(zval *arg, int base)
+PHPAPI char * _php_math_longtobase(zval *arg, int base)
{
static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
char buf[(sizeof(unsigned long) << 3) + 1];
return estrndup(ptr, end - ptr);
}
-
/* }}} */
-/* {{{ _php_math_zvaltobase */
+/* {{{ _php_math_zvaltobase */
/*
* Convert a zval to a string containing a base(2-36) representation of
* the number.
*/
-PHPAPI char *
-_php_math_zvaltobase(zval *arg, int base TSRMLS_DC)
+PHPAPI char * _php_math_zvaltobase(zval *arg, int base TSRMLS_DC)
{
static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
return _php_math_longtobase(arg, base);
}
-
/* }}} */
+
/* {{{ proto int bindec(string binary_number)
Returns the decimal equivalent of the binary number */
-
PHP_FUNCTION(bindec)
{
zval **arg;
RETURN_FALSE;
}
}
-
/* }}} */
+
/* {{{ proto int hexdec(string hexadecimal_number)
Returns the decimal equivalent of the hexadecimal number */
-
PHP_FUNCTION(hexdec)
{
zval **arg;
RETURN_FALSE;
}
}
-
/* }}} */
+
/* {{{ proto int octdec(string octal_number)
Returns the decimal equivalent of an octal string */
-
PHP_FUNCTION(octdec)
{
zval **arg;
RETURN_FALSE;
}
}
-
/* }}} */
+
/* {{{ proto string decbin(int decimal_number)
Returns a string containing a binary representation of the number */
-
PHP_FUNCTION(decbin)
{
zval **arg;
Z_STRLEN_P(return_value) = strlen(result);
Z_STRVAL_P(return_value) = result;
}
-
/* }}} */
+
/* {{{ proto string decoct(int decimal_number)
Returns a string containing an octal representation of the given number */
-
PHP_FUNCTION(decoct)
{
zval **arg;
Z_STRLEN_P(return_value) = strlen(result);
Z_STRVAL_P(return_value) = result;
}
-
/* }}} */
+
/* {{{ proto string dechex(int decimal_number)
Returns a string containing a hexadecimal representation of the given number */
-
PHP_FUNCTION(dechex)
{
zval **arg;
Z_STRLEN_P(return_value) = strlen(result);
Z_STRVAL_P(return_value) = result;
}
-
/* }}} */
+
/* {{{ proto string base_convert(string number, int frombase, int tobase)
Converts a number in a string from any base <= 36 to any base <= 36 */
-
PHP_FUNCTION(base_convert)
{
zval **number, **frombase, **tobase, temp;
result = _php_math_zvaltobase(&temp, Z_LVAL_PP(tobase) TSRMLS_CC);
RETVAL_STRING(result, 0);
}
-
/* }}} */
-/* {{{ _php_math_number_format */
+/* {{{ _php_math_number_format
+*/
PHPAPI char *_php_math_number_format(double d, int dec, char dec_point, char thousand_sep)
{
char *tmpbuf = NULL, *resbuf;
return resbuf;
}
-
/* }}} */
+
/* {{{ proto string number_format(float number [, int num_decimal_places [, string dec_seperator, string thousands_seperator]])
Formats a number with grouped thousands */
-
PHP_FUNCTION(number_format)
{
zval **num, **dec, **t_s, **d_p;
}
/* }}} */
-
+/* {{{ php_population_variance
+*/
static long double php_population_variance(zval *arr, zend_bool sample)
{
double mean, sum = 0.0, vr = 0.0;
}
return (vr / elements_num);
}
+/* }}} */
-/* {{{ proto float math_variance(array a[, bool sample = false])
+/* {{{ proto float math_variance(array a [, bool sample])
Returns the population variance */
PHP_FUNCTION(math_variance)
{
}
/* }}} */
-
-/* {{{ proto float math_std_dev(array a[, bool sample = false])
+/* {{{ proto float math_std_dev(array a [, bool sample])
Returns the standard deviation */
PHP_FUNCTION(math_std_dev)
{