kalle Mon May 5 07:29:42 2008 UTC
Modified files: (Branch: PHP_5_3)
/php-src NEWS
/php-src/ext/standard basic_functions.c math.c php_math.h
/php-src/ext/standard/tests/math acosh_basic.phpt acosh_error.phpt
acosh_variation.phpt
asinh_basic.phpt asinh_error.phpt
asinh_variation.phpt
atanh_basic.phpt atanh_error.phpt
atanh_variation.phpt
Log:
Merge PHP_5_3 - Implemented Windows support for asinh(), acosh(), atanh(),
log1p() and expm1()
[DOC] Merge_5_3
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.173&r2=1.2027.2.547.2.965.2.174&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.173
php-src/NEWS:1.2027.2.547.2.965.2.174
--- php-src/NEWS:1.2027.2.547.2.965.2.173 Sun May 4 20:52:36 2008
+++ php-src/NEWS Mon May 5 07:29:41 2008
@@ -1,4 +1,4 @@
-PHP NEWS
+PHP
NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 20??, PHP 5.3.0
- Removed the experimental RPL (master/slave) functions from mysqli. (Andrey)
@@ -106,6 +106,7 @@
- Added request_order INI variable to control specifically $_REQUEST
behavior. (Stas)
- Added forward_static_call(_array) to complete LSB. (Mike Lively)
+- Added Windows support for asinh(), acosh(), atanh(), log1p() and expm1()
(Kalle)
- Improved PHP runtime speed and memory usage:
. Lazy EG(active_symbol_table) initialization. (Dmitry)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.31.2.64.2.29&r2=1.725.2.31.2.64.2.30&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.29
php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.30
--- php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.29 Mon Apr 21
14:32:57 2008
+++ php-src/ext/standard/basic_functions.c Mon May 5 07:29:41 2008
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.29 2008/04/21 14:32:57 iliaa Exp
$ */
+/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.30 2008/05/05 07:29:41 kalle Exp
$ */
#include "php.h"
#include "php_streams.h"
@@ -1933,26 +1933,20 @@
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-#ifdef HAVE_ASINH
static
ZEND_BEGIN_ARG_INFO(arginfo_asinh, 0)
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-#endif
-#ifdef HAVE_ACOSH
static
ZEND_BEGIN_ARG_INFO(arginfo_acosh, 0)
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-#endif
-#ifdef HAVE_ATANH
static
ZEND_BEGIN_ARG_INFO(arginfo_atanh, 0)
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-#endif
static
ZEND_BEGIN_ARG_INFO(arginfo_pi, 0)
@@ -1984,19 +1978,15 @@
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-#if !defined(PHP_WIN32) && !defined(NETWARE)
static
ZEND_BEGIN_ARG_INFO(arginfo_expm1, 0)
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-# ifdef HAVE_LOG1P
static
ZEND_BEGIN_ARG_INFO(arginfo_log1p, 0)
ZEND_ARG_INFO(0, number)
ZEND_END_ARG_INFO()
-# endif
-#endif /* !defined(PHP_WIN32) && !defined(NETWARE) */
static
ZEND_BEGIN_ARG_INFO_EX(arginfo_log, 0, 0, 1)
@@ -3291,23 +3281,10 @@
PHP_FE(sinh,
arginfo_sinh)
PHP_FE(cosh,
arginfo_cosh)
PHP_FE(tanh,
arginfo_tanh)
-
-#ifdef HAVE_ASINH
PHP_FE(asinh,
arginfo_asinh)
-#endif
-#ifdef HAVE_ACOSH
PHP_FE(acosh,
arginfo_acosh)
-#endif
-#ifdef HAVE_ATANH
- PHP_FE(atanh,
arginfo_atanh)
-#endif
-#if !defined(PHP_WIN32) && !defined(NETWARE)
PHP_FE(expm1,
arginfo_expm1)
-# ifdef HAVE_LOG1P
PHP_FE(log1p,
arginfo_log1p)
-# endif
-#endif
-
PHP_FE(pi,
arginfo_pi)
PHP_FE(is_finite,
arginfo_is_finite)
PHP_FE(is_nan,
arginfo_is_nan)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/math.c?r1=1.131.2.2.2.6.2.4&r2=1.131.2.2.2.6.2.5&diff_format=u
Index: php-src/ext/standard/math.c
diff -u php-src/ext/standard/math.c:1.131.2.2.2.6.2.4
php-src/ext/standard/math.c:1.131.2.2.2.6.2.5
--- php-src/ext/standard/math.c:1.131.2.2.2.6.2.4 Thu Feb 21 17:50:03 2008
+++ php-src/ext/standard/math.c Mon May 5 07:29:41 2008
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: math.c,v 1.131.2.2.2.6.2.4 2008/02/21 17:50:03 felipe Exp $ */
+/* $Id: math.c,v 1.131.2.2.2.6.2.5 2008/05/05 07:29:41 kalle Exp $ */
#include "php.h"
#include "php_math.h"
@@ -49,6 +49,67 @@
val = !zend_isnan(tmp_val) ? tmp_val : val; \
} \
+
+/* {{{ php_asinh
+*/
+double php_asinh(double z)
+{
+#ifdef HAVE_ASINH
+ return(asinh(z));
+#else
+ return(log(z + sqrt(1 + pow(z, 2))) / log(M_E));
+#endif
+}
+/* }}} */
+
+/* {{{ php_acosh
+*/
+double php_acosh(double x)
+{
+#ifdef HAVE_ACOSH
+ return(acosh(x));
+#else
+ return(log(x + sqrt(x * x - 1)));
+#endif
+}
+/* }}} */
+
+/* {{{ php_atanh
+*/
+double php_atanh(double z)
+{
+#ifdef HAVE_ATANH
+ return(atanh(z));
+#else
+ return(0.5 * log((1 + z) / (1 - z)));
+#endif
+}
+/* }}} */
+
+/* {{{ php_log1p
+*/
+double php_log1p(double x)
+{
+#ifdef HAVE_LOG1P
+ return(log1p(x));
+#else
+ return(log(1 + x));
+#endif
+}
+/* }}} */
+
+/* {{{ php_expm1
+*/
+double php_expm1(double x)
+{
+#if !defined(PHP_WIN32) && !defined(NETWARE)
+ return(expm1(x));
+#else
+ return(exp(x) - 1);
+#endif
+}
+/* }}}*/
+
/* {{{ proto int abs(int number)
Return the absolute value of the number */
PHP_FUNCTION(abs)
@@ -284,8 +345,6 @@
}
/* }}} */
-#if !defined(PHP_WIN32) && !defined(NETWARE)
-#ifdef HAVE_ASINH
/* {{{ proto float asinh(float number)
Returns the inverse hyperbolic sine of the number, i.e. the value whose
hyperbolic sine is number */
PHP_FUNCTION(asinh)
@@ -298,24 +357,20 @@
RETURN_DOUBLE(asinh(num));
}
/* }}} */
-#endif /* HAVE_ASINH */
-#ifdef HAVE_ACOSH
/* {{{ proto float acosh(float number)
Returns the inverse hyperbolic cosine of the number, i.e. the value whose
hyperbolic cosine is number */
-PHP_FUNCTION(acosh)
+PHP_FUNCTION(php_acosh)
{
double num;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) ==
FAILURE) {
return;
}
- RETURN_DOUBLE(acosh(num));
+ RETURN_DOUBLE(php_acosh(num));
}
/* }}} */
-#endif /* HAVE_ACOSH */
-#ifdef HAVE_ATANH
/* {{{ proto float atanh(float number)
Returns the inverse hyperbolic tangent of the number, i.e. the value whose
hyperbolic tangent is number */
PHP_FUNCTION(atanh)
@@ -325,11 +380,9 @@
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) ==
FAILURE) {
return;
}
- RETURN_DOUBLE(atanh(num));
+ RETURN_DOUBLE(php_atanh(num));
}
/* }}} */
-#endif /* HAVE_ATANH */
-#endif /* !defined(PHP_WIN32) && !defined(NETWARE) */
/* {{{ proto float pi(void)
Returns an approximation of pi */
@@ -442,7 +495,6 @@
}
/* }}} */
-#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 */
/*
@@ -456,11 +508,10 @@
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) ==
FAILURE) {
return;
}
- RETURN_DOUBLE(expm1(num));
+ RETURN_DOUBLE(php_expm1(num));
}
/* }}} */
-#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 */
/*
@@ -474,11 +525,9 @@
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) ==
FAILURE) {
return;
}
- RETURN_DOUBLE(log1p(num));
+ RETURN_DOUBLE(php_log1p(num));
}
/* }}} */
-#endif /* HAVE_LOG1P */
-#endif /* !defined(PHP_WIN32) && !defined(NETWARE) */
/* {{{ proto float log(float number, [float base])
Returns the natural logarithm of the number, or the base log if base is
specified */
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/php_math.h?r1=1.28.2.2.2.3.2.1&r2=1.28.2.2.2.3.2.2&diff_format=u
Index: php-src/ext/standard/php_math.h
diff -u php-src/ext/standard/php_math.h:1.28.2.2.2.3.2.1
php-src/ext/standard/php_math.h:1.28.2.2.2.3.2.2
--- php-src/ext/standard/php_math.h:1.28.2.2.2.3.2.1 Mon Dec 31 07:17:15 2007
+++ php-src/ext/standard/php_math.h Mon May 5 07:29:41 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_math.h,v 1.28.2.2.2.3.2.1 2007/12/31 07:17:15 sebastian Exp $ */
+/* $Id: php_math.h,v 1.28.2.2.2.3.2.2 2008/05/05 07:29:41 kalle Exp $ */
#ifndef PHP_MATH_H
#define PHP_MATH_H
@@ -72,23 +72,15 @@
*/
PHP_FUNCTION(hypot);
PHP_FUNCTION(expm1);
-#ifdef HAVE_LOG1P
PHP_FUNCTION(log1p);
-#endif
PHP_FUNCTION(sinh);
PHP_FUNCTION(cosh);
PHP_FUNCTION(tanh);
-#ifdef HAVE_ASINH
PHP_FUNCTION(asinh);
-#endif
-#ifdef HAVE_ACOSH
PHP_FUNCTION(acosh);
-#endif
-#ifdef HAVE_ATANH
PHP_FUNCTION(atanh);
-#endif
#include <math.h>
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/acosh_basic.phpt?r1=1.1.2.1&r2=1.1.2.1.2.1&diff_format=u
Index: php-src/ext/standard/tests/math/acosh_basic.phpt
diff -u php-src/ext/standard/tests/math/acosh_basic.phpt:1.1.2.1
php-src/ext/standard/tests/math/acosh_basic.phpt:1.1.2.1.2.1
--- php-src/ext/standard/tests/math/acosh_basic.phpt:1.1.2.1 Tue Sep 4
09:01:02 2007
+++ php-src/ext/standard/tests/math/acosh_basic.phpt Mon May 5 07:29:41 2008
@@ -1,10 +1,5 @@
--TEST--
Test return type and value for expected input acosh()
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN")
- die ("skip - function not supported on Windows");
-?>
--INI--
precision = 14
--FILE--
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/acosh_error.phpt?r1=1.1.2.1.2.2&r2=1.1.2.1.2.3&diff_format=u
Index: php-src/ext/standard/tests/math/acosh_error.phpt
diff -u php-src/ext/standard/tests/math/acosh_error.phpt:1.1.2.1.2.2
php-src/ext/standard/tests/math/acosh_error.phpt:1.1.2.1.2.3
--- php-src/ext/standard/tests/math/acosh_error.phpt:1.1.2.1.2.2 Thu Feb
21 17:47:33 2008
+++ php-src/ext/standard/tests/math/acosh_error.phpt Mon May 5 07:29:41 2008
@@ -1,10 +1,5 @@
--TEST--
Test wrong number of arguments for acosh()
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN" )
- die ("skip - function not supported on Windows");
-?>
--FILE--
<?php
/*
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/acosh_variation.phpt?r1=1.1.2.1.2.1&r2=1.1.2.1.2.2&diff_format=u
Index: php-src/ext/standard/tests/math/acosh_variation.phpt
diff -u php-src/ext/standard/tests/math/acosh_variation.phpt:1.1.2.1.2.1
php-src/ext/standard/tests/math/acosh_variation.phpt:1.1.2.1.2.2
--- php-src/ext/standard/tests/math/acosh_variation.phpt:1.1.2.1.2.1 Thu Feb
21 17:47:33 2008
+++ php-src/ext/standard/tests/math/acosh_variation.phpt Mon May 5
07:29:41 2008
@@ -1,10 +1,5 @@
--TEST--
Test variations in usage of acosh()
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN" )
- die ("skip - function not supported on Windows");
-?>
--INI--
precision = 10
--FILE--
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/asinh_basic.phpt?r1=1.1.2.1&r2=1.1.2.1.2.1&diff_format=u
Index: php-src/ext/standard/tests/math/asinh_basic.phpt
diff -u php-src/ext/standard/tests/math/asinh_basic.phpt:1.1.2.1
php-src/ext/standard/tests/math/asinh_basic.phpt:1.1.2.1.2.1
--- php-src/ext/standard/tests/math/asinh_basic.phpt:1.1.2.1 Tue Sep 4
09:01:02 2007
+++ php-src/ext/standard/tests/math/asinh_basic.phpt Mon May 5 07:29:41 2008
@@ -1,10 +1,5 @@
--TEST--
Test return type and value for expected input asinh()
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN")
- die ("skip - function not supported on Windows");
-?>
--INI--
precision = 14
--FILE--
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/asinh_error.phpt?r1=1.1.2.1.2.2&r2=1.1.2.1.2.3&diff_format=u
Index: php-src/ext/standard/tests/math/asinh_error.phpt
diff -u php-src/ext/standard/tests/math/asinh_error.phpt:1.1.2.1.2.2
php-src/ext/standard/tests/math/asinh_error.phpt:1.1.2.1.2.3
--- php-src/ext/standard/tests/math/asinh_error.phpt:1.1.2.1.2.2 Thu Feb
21 17:47:33 2008
+++ php-src/ext/standard/tests/math/asinh_error.phpt Mon May 5 07:29:41 2008
@@ -1,10 +1,5 @@
--TEST--
Test wrong number of arguments for asinh()
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN" )
- die ("skip - function not supported on Windows");
-?>
--FILE--
<?php
/*
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/asinh_variation.phpt?r1=1.1.2.1.2.1&r2=1.1.2.1.2.2&diff_format=u
Index: php-src/ext/standard/tests/math/asinh_variation.phpt
diff -u php-src/ext/standard/tests/math/asinh_variation.phpt:1.1.2.1.2.1
php-src/ext/standard/tests/math/asinh_variation.phpt:1.1.2.1.2.2
--- php-src/ext/standard/tests/math/asinh_variation.phpt:1.1.2.1.2.1 Thu Feb
21 17:47:33 2008
+++ php-src/ext/standard/tests/math/asinh_variation.phpt Mon May 5
07:29:41 2008
@@ -1,10 +1,5 @@
--TEST--
Test variations in usage of asinh()
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN" )
- die ("skip - function not supported on Windows");
-?>
--INI--
precision = 10
--FILE--
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/atanh_basic.phpt?r1=1.1.2.1&r2=1.1.2.1.2.1&diff_format=u
Index: php-src/ext/standard/tests/math/atanh_basic.phpt
diff -u php-src/ext/standard/tests/math/atanh_basic.phpt:1.1.2.1
php-src/ext/standard/tests/math/atanh_basic.phpt:1.1.2.1.2.1
--- php-src/ext/standard/tests/math/atanh_basic.phpt:1.1.2.1 Tue Sep 4
09:01:02 2007
+++ php-src/ext/standard/tests/math/atanh_basic.phpt Mon May 5 07:29:41 2008
@@ -1,10 +1,5 @@
--TEST--
Test return type and value for expected input atanh()
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN" )
- die ("skip - function not supported on Windows");
-?>
--INI--
precision = 14
--FILE--
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/atanh_error.phpt?r1=1.1.2.1.2.2&r2=1.1.2.1.2.3&diff_format=u
Index: php-src/ext/standard/tests/math/atanh_error.phpt
diff -u php-src/ext/standard/tests/math/atanh_error.phpt:1.1.2.1.2.2
php-src/ext/standard/tests/math/atanh_error.phpt:1.1.2.1.2.3
--- php-src/ext/standard/tests/math/atanh_error.phpt:1.1.2.1.2.2 Thu Feb
21 17:47:33 2008
+++ php-src/ext/standard/tests/math/atanh_error.phpt Mon May 5 07:29:41 2008
@@ -1,10 +1,5 @@
--TEST--
Test wrong number of arguments for atanh()
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN" )
- die ("skip - function not supported on Windows");
-?>
--FILE--
<?php
/*
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/math/atanh_variation.phpt?r1=1.1.2.1.2.1&r2=1.1.2.1.2.2&diff_format=u
Index: php-src/ext/standard/tests/math/atanh_variation.phpt
diff -u php-src/ext/standard/tests/math/atanh_variation.phpt:1.1.2.1.2.1
php-src/ext/standard/tests/math/atanh_variation.phpt:1.1.2.1.2.2
--- php-src/ext/standard/tests/math/atanh_variation.phpt:1.1.2.1.2.1 Thu Feb
21 17:47:33 2008
+++ php-src/ext/standard/tests/math/atanh_variation.phpt Mon May 5
07:29:41 2008
@@ -1,10 +1,5 @@
--TEST--
Test variations in usage of atanh()
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) == "WIN" )
- die ("skip - function not supported on Windows");
-?>
--INI--
precision = 10
--FILE--
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php