summaryrefslogtreecommitdiff
path: root/ext/standard/tests/math
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/tests/math')
-rw-r--r--ext/standard/tests/math/abs.phpt24
-rw-r--r--ext/standard/tests/math/abs_basic.phpt51
-rw-r--r--ext/standard/tests/math/abs_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/abs_error.phpt39
-rw-r--r--ext/standard/tests/math/abs_variation.phpt135
-rw-r--r--ext/standard/tests/math/acos_basic.phpt69
-rw-r--r--ext/standard/tests/math/acos_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/acos_error.phpt29
-rw-r--r--ext/standard/tests/math/acos_variation.phpt56
-rw-r--r--ext/standard/tests/math/acosh_basic.phpt41
-rw-r--r--ext/standard/tests/math/acosh_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/acosh_error.phpt29
-rw-r--r--ext/standard/tests/math/acosh_variation.phpt56
-rw-r--r--ext/standard/tests/math/allowed_rounding_error.inc18
-rw-r--r--ext/standard/tests/math/asin_basic.phpt68
-rw-r--r--ext/standard/tests/math/asin_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/asin_error.phpt29
-rw-r--r--ext/standard/tests/math/asin_variation.phpt56
-rw-r--r--ext/standard/tests/math/asinh_basic.phpt40
-rw-r--r--ext/standard/tests/math/asinh_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/asinh_error.phpt29
-rw-r--r--ext/standard/tests/math/asinh_variation.phpt56
-rw-r--r--ext/standard/tests/math/atan2_basic.phpt185
-rw-r--r--ext/standard/tests/math/atan2_basiclong_64bit.phpt364
-rw-r--r--ext/standard/tests/math/atan2_error.phpt14
-rw-r--r--ext/standard/tests/math/atan2_variation1.phpt187
-rw-r--r--ext/standard/tests/math/atan2_variation2.phpt186
-rw-r--r--ext/standard/tests/math/atan_basic.phpt40
-rw-r--r--ext/standard/tests/math/atan_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/atan_error.phpt29
-rw-r--r--ext/standard/tests/math/atan_variation.phpt56
-rw-r--r--ext/standard/tests/math/atanh_basic.phpt41
-rw-r--r--ext/standard/tests/math/atanh_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/atanh_error.phpt29
-rw-r--r--ext/standard/tests/math/atanh_variation.phpt56
-rw-r--r--ext/standard/tests/math/base_convert_basic.phpt316
-rw-r--r--ext/standard/tests/math/base_convert_error.phpt43
-rw-r--r--ext/standard/tests/math/base_convert_variation1.phpt159
-rw-r--r--ext/standard/tests/math/base_convert_variation2.phpt193
-rw-r--r--ext/standard/tests/math/base_convert_variation3.phpt193
-rw-r--r--ext/standard/tests/math/bindec_basic.phpt55
-rw-r--r--ext/standard/tests/math/bindec_basic_64bit.phpt55
-rw-r--r--ext/standard/tests/math/bindec_basiclong_64bit.phpt51
-rw-r--r--ext/standard/tests/math/bindec_error.phpt37
-rw-r--r--ext/standard/tests/math/bindec_variation1.phpt158
-rw-r--r--ext/standard/tests/math/bindec_variation1_64bit.phpt158
-rw-r--r--ext/standard/tests/math/bug21523.phpt12
-rw-r--r--ext/standard/tests/math/bug24142.phpt20
-rw-r--r--ext/standard/tests/math/bug25665.phpt16
-rw-r--r--ext/standard/tests/math/bug25694.phpt37
-rw-r--r--ext/standard/tests/math/bug27646.phpt48
-rw-r--r--ext/standard/tests/math/bug28228.phpt14
-rw-r--r--ext/standard/tests/math/bug30069.phpt12
-rw-r--r--ext/standard/tests/math/bug30695.phpt54
-rw-r--r--ext/standard/tests/math/bug45712.phpt75
-rw-r--r--ext/standard/tests/math/bug62112.phptbin0 -> 143 bytes
-rw-r--r--ext/standard/tests/math/ceil_basic.phpt70
-rw-r--r--ext/standard/tests/math/ceil_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/ceil_error.phpt33
-rw-r--r--ext/standard/tests/math/ceil_variation1.phpt128
-rw-r--r--ext/standard/tests/math/constants.phpt48
-rw-r--r--ext/standard/tests/math/constants_basic.phpt65
-rw-r--r--ext/standard/tests/math/cos_basic.phpt92
-rw-r--r--ext/standard/tests/math/cos_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/cos_error.phpt29
-rw-r--r--ext/standard/tests/math/cos_variation.phpt56
-rw-r--r--ext/standard/tests/math/cosh_basic.phpt61
-rw-r--r--ext/standard/tests/math/cosh_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/cosh_error.phpt29
-rw-r--r--ext/standard/tests/math/cosh_variation.phpt56
-rw-r--r--ext/standard/tests/math/decbin_basic.phpt39
-rw-r--r--ext/standard/tests/math/decbin_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/decbin_error.phpt37
-rw-r--r--ext/standard/tests/math/decbin_variation1.phpt179
-rw-r--r--ext/standard/tests/math/decbin_variation1_64bit.phpt179
-rw-r--r--ext/standard/tests/math/dechex_basic.phpt38
-rw-r--r--ext/standard/tests/math/dechex_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/dechex_error.phpt26
-rw-r--r--ext/standard/tests/math/dechex_variation1.phpt179
-rw-r--r--ext/standard/tests/math/dechex_variation1_64bit.phpt179
-rw-r--r--ext/standard/tests/math/decoct_basic.phpt38
-rw-r--r--ext/standard/tests/math/decoct_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/decoct_error.phpt25
-rw-r--r--ext/standard/tests/math/decoct_variation1.phpt180
-rw-r--r--ext/standard/tests/math/decoct_variation1_64bit.phpt180
-rw-r--r--ext/standard/tests/math/deg2rad_basic.phpt67
-rw-r--r--ext/standard/tests/math/deg2rad_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/deg2rad_error.phpt31
-rw-r--r--ext/standard/tests/math/deg2rad_variation.phpt56
-rw-r--r--ext/standard/tests/math/exp_basic.phpt71
-rw-r--r--ext/standard/tests/math/exp_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/exp_error.phpt14
-rw-r--r--ext/standard/tests/math/exp_variation1.phpt187
-rw-r--r--ext/standard/tests/math/expm1_basic.phpt79
-rw-r--r--ext/standard/tests/math/expm1_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/expm1_error.phpt30
-rw-r--r--ext/standard/tests/math/expm1_variation1.phpt199
-rw-r--r--ext/standard/tests/math/floor_basic.phpt108
-rw-r--r--ext/standard/tests/math/floor_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/floor_error.phpt33
-rw-r--r--ext/standard/tests/math/floor_variation1.phpt128
-rw-r--r--ext/standard/tests/math/floorceil.phpt44
-rw-r--r--ext/standard/tests/math/fmod_basic.phpt209
-rw-r--r--ext/standard/tests/math/fmod_basiclong_64bit.phpt364
-rw-r--r--ext/standard/tests/math/fmod_error.phpt17
-rw-r--r--ext/standard/tests/math/fmod_variation1.phpt184
-rw-r--r--ext/standard/tests/math/fmod_variation2.phpt184
-rw-r--r--ext/standard/tests/math/getrandmax_basic.phpt9
-rw-r--r--ext/standard/tests/math/getrandmax_error.phpt9
-rw-r--r--ext/standard/tests/math/hexdec.phpt24
-rw-r--r--ext/standard/tests/math/hexdec_basic.phpt50
-rw-r--r--ext/standard/tests/math/hexdec_basic_64bit.phpt93
-rw-r--r--ext/standard/tests/math/hexdec_basiclong_64bit.phpt51
-rw-r--r--ext/standard/tests/math/hexdec_error.phpt36
-rw-r--r--ext/standard/tests/math/hexdec_variation1.phpt168
-rw-r--r--ext/standard/tests/math/hexdec_variation1_64bit.phpt168
-rw-r--r--ext/standard/tests/math/hypot_basic.phpt444
-rw-r--r--ext/standard/tests/math/hypot_basiclong_64bit.phpt364
-rw-r--r--ext/standard/tests/math/hypot_error.phpt33
-rw-r--r--ext/standard/tests/math/hypot_variation1.phpt185
-rw-r--r--ext/standard/tests/math/hypot_variation2.phpt185
-rw-r--r--ext/standard/tests/math/is_finite_basic.phpt41
-rw-r--r--ext/standard/tests/math/is_finite_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/is_finite_error.phpt13
-rw-r--r--ext/standard/tests/math/is_finite_variation1.phpt184
-rw-r--r--ext/standard/tests/math/is_infinite_basic.phpt42
-rw-r--r--ext/standard/tests/math/is_infinite_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/is_infinite_error.phpt12
-rw-r--r--ext/standard/tests/math/is_infinite_variation1.phpt184
-rw-r--r--ext/standard/tests/math/is_nan_basic.phpt45
-rw-r--r--ext/standard/tests/math/is_nan_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/is_nan_error.phpt16
-rw-r--r--ext/standard/tests/math/is_nan_variation1.phpt184
-rw-r--r--ext/standard/tests/math/lcg_value_basic.phpt56
-rw-r--r--ext/standard/tests/math/log.phpt42
-rw-r--r--ext/standard/tests/math/log10_basic.phpt55
-rw-r--r--ext/standard/tests/math/log10_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/log10_error.phpt31
-rw-r--r--ext/standard/tests/math/log10_variation.phpt56
-rw-r--r--ext/standard/tests/math/log1p_basic.phpt78
-rw-r--r--ext/standard/tests/math/log1p_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/log1p_error.phpt29
-rw-r--r--ext/standard/tests/math/log1p_variation1.phpt191
-rw-r--r--ext/standard/tests/math/log_basic.phpt60
-rw-r--r--ext/standard/tests/math/log_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/log_error.phpt16
-rw-r--r--ext/standard/tests/math/log_variation1.phpt184
-rw-r--r--ext/standard/tests/math/log_variation2.phpt202
-rw-r--r--ext/standard/tests/math/mt_getrandmax_basic.phpt8
-rw-r--r--ext/standard/tests/math/mt_getrandmax_error.phpt9
-rw-r--r--ext/standard/tests/math/mt_rand_basic.phpt102
-rw-r--r--ext/standard/tests/math/mt_rand_error.phpt19
-rw-r--r--ext/standard/tests/math/mt_rand_variation1.phpt184
-rw-r--r--ext/standard/tests/math/mt_rand_variation2.phpt184
-rw-r--r--ext/standard/tests/math/mt_srand_basic.phpt24
-rw-r--r--ext/standard/tests/math/mt_srand_error.phpt20
-rw-r--r--ext/standard/tests/math/mt_srand_variation1.phpt184
-rw-r--r--ext/standard/tests/math/number_format_basic.phpt97
-rw-r--r--ext/standard/tests/math/number_format_multichar.phpt77
-rw-r--r--ext/standard/tests/math/octdec_basic.phpt49
-rw-r--r--ext/standard/tests/math/octdec_basic_64bit.phpt55
-rw-r--r--ext/standard/tests/math/octdec_basiclong_64bit.phpt51
-rw-r--r--ext/standard/tests/math/octdec_error.phpt37
-rw-r--r--ext/standard/tests/math/octdec_variation1.phpt164
-rw-r--r--ext/standard/tests/math/pi_basic.phpt14
-rw-r--r--ext/standard/tests/math/pow.phpt149
-rw-r--r--ext/standard/tests/math/pow_basic.phpt270
-rw-r--r--ext/standard/tests/math/pow_basic2.phpt52
-rw-r--r--ext/standard/tests/math/pow_basic_64bit.phpt270
-rw-r--r--ext/standard/tests/math/pow_basiclong_64bit.phpt364
-rw-r--r--ext/standard/tests/math/pow_error.phpt19
-rw-r--r--ext/standard/tests/math/pow_variation1.phpt176
-rw-r--r--ext/standard/tests/math/pow_variation1_64bit.phpt176
-rw-r--r--ext/standard/tests/math/pow_variation2.phpt172
-rw-r--r--ext/standard/tests/math/rad2deg_basic.phpt65
-rw-r--r--ext/standard/tests/math/rad2deg_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/rad2deg_error.phpt31
-rw-r--r--ext/standard/tests/math/rad2deg_variation.phpt56
-rw-r--r--ext/standard/tests/math/rand_basic.phpt103
-rw-r--r--ext/standard/tests/math/rand_error.phpt18
-rw-r--r--ext/standard/tests/math/rand_variation1.phpt184
-rw-r--r--ext/standard/tests/math/rand_variation2.phpt184
-rw-r--r--ext/standard/tests/math/round.phpt37
-rw-r--r--ext/standard/tests/math/round_basic.phpt192
-rw-r--r--ext/standard/tests/math/round_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/round_error.phpt31
-rw-r--r--ext/standard/tests/math/round_large_exp.phpt30
-rw-r--r--ext/standard/tests/math/round_modes.phpt38
-rw-r--r--ext/standard/tests/math/round_prerounding.phpt10
-rw-r--r--ext/standard/tests/math/round_variation1.phpt173
-rw-r--r--ext/standard/tests/math/round_variation2.phpt187
-rw-r--r--ext/standard/tests/math/sin_basic.phpt92
-rw-r--r--ext/standard/tests/math/sin_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/sin_error.phpt29
-rw-r--r--ext/standard/tests/math/sin_variation.phpt56
-rw-r--r--ext/standard/tests/math/sinh_basic.phpt60
-rw-r--r--ext/standard/tests/math/sinh_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/sinh_error.phpt29
-rw-r--r--ext/standard/tests/math/sinh_variation.phpt56
-rw-r--r--ext/standard/tests/math/sqrt_basic.phpt18
-rw-r--r--ext/standard/tests/math/sqrt_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/sqrt_error.phpt31
-rw-r--r--ext/standard/tests/math/sqrt_variation.phpt60
-rw-r--r--ext/standard/tests/math/srand_basic.phpt34
-rw-r--r--ext/standard/tests/math/srand_error.phpt32
-rw-r--r--ext/standard/tests/math/srand_variation1.phpt184
-rw-r--r--ext/standard/tests/math/tan_basic.phpt41
-rw-r--r--ext/standard/tests/math/tan_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/tan_error.phpt29
-rw-r--r--ext/standard/tests/math/tan_variation.phpt56
-rw-r--r--ext/standard/tests/math/tanh_basic.phpt60
-rw-r--r--ext/standard/tests/math/tanh_basiclong_64bit.phpt60
-rw-r--r--ext/standard/tests/math/tanh_error.phpt29
-rw-r--r--ext/standard/tests/math/tanh_variation.phpt56
214 files changed, 18226 insertions, 0 deletions
diff --git a/ext/standard/tests/math/abs.phpt b/ext/standard/tests/math/abs.phpt
new file mode 100644
index 0000000..f5c26c3
--- /dev/null
+++ b/ext/standard/tests/math/abs.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Simple math tests
+--FILE--
+<?php // $Id$
+
+define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
+define('LONG_MIN', -LONG_MAX - 1);
+printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
+ is_int(LONG_MIN-1),is_int(LONG_MAX+1));
+
+$tests = <<<TESTS
+ 1 === abs(-1)
+ 1.5 === abs(-1.5)
+ 1 === abs("-1")
+ 1.5 === abs("-1.5")
+-LONG_MIN+1 === abs(LONG_MIN-1)
+-LONG_MIN === abs(LONG_MIN)
+-(LONG_MIN+1) === abs(LONG_MIN+1)
+TESTS;
+
+include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
+--EXPECT--
+1,1,0,0
+OK
diff --git a/ext/standard/tests/math/abs_basic.phpt b/ext/standard/tests/math/abs_basic.phpt
new file mode 100644
index 0000000..0f6ecbc
--- /dev/null
+++ b/ext/standard/tests/math/abs_basic.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test abs() function : basic functionality
+--INI--
+precision = 14
+--FILE--
+<?php
+/* Prototype : number abs ( mixed $number )
+ * Description: Returns the absolute value of number.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing abs() : basic functionality ***\n";
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "-23",
+ "23.45",
+ "2.345e1",
+ "-2.345e1",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = abs($values[$i]);
+ var_dump($res);
+}
+?>
+===Done===
+--EXPECTF--
+*** Testing abs() : basic functionality ***
+int(23)
+int(23)
+float(23.45)
+float(23.45)
+int(23)
+int(23)
+int(23)
+int(23)
+float(23.45)
+float(23.45)
+float(23.45)
+int(0)
+int(1)
+int(0)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/abs_basiclong_64bit.phpt b/ext/standard/tests/math/abs_basiclong_64bit.phpt
new file mode 100644
index 0000000..ccb2556
--- /dev/null
+++ b/ext/standard/tests/math/abs_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test abs function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(abs($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+int(9223372036854775807)
+--- testing: -9223372036854775808 ---
+float(9.2233720368548E+18)
+--- testing: 2147483647 ---
+int(2147483647)
+--- testing: -2147483648 ---
+int(2147483648)
+--- testing: 9223372034707292160 ---
+int(9223372034707292160)
+--- testing: -9223372034707292160 ---
+int(9223372034707292160)
+--- testing: 2147483648 ---
+int(2147483648)
+--- testing: -2147483649 ---
+int(2147483649)
+--- testing: 4294967294 ---
+int(4294967294)
+--- testing: 4294967295 ---
+int(4294967295)
+--- testing: 4294967293 ---
+int(4294967293)
+--- testing: 9223372036854775806 ---
+int(9223372036854775806)
+--- testing: 9.2233720368548E+18 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807 ---
+int(9223372036854775807)
+--- testing: -9.2233720368548E+18 ---
+float(9.2233720368548E+18)
+===DONE===
diff --git a/ext/standard/tests/math/abs_error.phpt b/ext/standard/tests/math/abs_error.phpt
new file mode 100644
index 0000000..4d62259
--- /dev/null
+++ b/ext/standard/tests/math/abs_error.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test abs() function : error conditions - incorrect number of args
+--FILE--
+<?php
+/* Prototype : number abs ( mixed $number )
+ * Description: Returns the absolute value of number.
+ * Source code: ext/standard/math.c
+ */
+
+/*
+ * Pass incorrect number of arguments to abs() to test behaviour
+ */
+
+echo "*** Testing abs() : error conditions ***\n";
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(abs($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(abs());
+
+?>
+===Done===
+--EXPECTF--
+*** Testing abs() : error conditions ***
+
+Too many arguments
+
+Warning: abs() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: abs() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/abs_variation.phpt b/ext/standard/tests/math/abs_variation.phpt
new file mode 100644
index 0000000..6df1e6b
--- /dev/null
+++ b/ext/standard/tests/math/abs_variation.phpt
@@ -0,0 +1,135 @@
+--TEST--
+Test abs() function : usage variations - different data types as $number arg
+--FILE--
+<?php
+/* Prototype : number abs ( mixed $number )
+ * Description: Returns the absolute value of number.
+ * Source code: ext/standard/math.c
+ */
+
+/*
+ * Pass different data types as $number argument to abs() to test behaviour
+ */
+
+echo "*** Testing abs() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+ public function __toString() {
+ return "abs";
+ }
+}
+
+// heredoc string
+$heredoc = <<<EOT
+abs
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $number argument
+$inputs = array(
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "abs",
+ 'abs',
+ $heredoc,
+
+ // object data
+/*22*/ new classA(),
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behavior of abs()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(abs($input) );
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing abs() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(0)
+
+-- Iteration 3 --
+int(1)
+
+-- Iteration 4 --
+int(0)
+
+-- Iteration 5 --
+int(1)
+
+-- Iteration 6 --
+int(0)
+
+-- Iteration 7 --
+int(0)
+
+-- Iteration 8 --
+int(0)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+int(0)
+
+-- Iteration 11 --
+int(0)
+
+-- Iteration 12 --
+int(0)
+
+-- Iteration 13 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+int(1)
+
+-- Iteration 14 --
+int(0)
+
+-- Iteration 15 --
+int(0)
+
+-- Iteration 16 --
+int(%d)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/acos_basic.phpt b/ext/standard/tests/math/acos_basic.phpt
new file mode 100644
index 0000000..150eb97
--- /dev/null
+++ b/ext/standard/tests/math/acos_basic.phpt
@@ -0,0 +1,69 @@
+--TEST--
+Test return type and value for expected input acos()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float acos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+
+//output is in degrees
+
+echo "acos .5 = ";
+$acosv1 = 360.0 * acos(0.5) / (2.0 * M_PI );
+var_dump($acosv1);
+if (allowed_rounding_error($acosv1 ,60 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "acos 0.86602540378444 = ";
+$acosv2 = 360.0 * acos(0.86602540378444) / (2.0 * M_PI );
+var_dump($acosv2);
+if (allowed_rounding_error($acosv2 ,30 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+
+echo "acos 1.0 = ";
+$acosv3 = 360.0 * acos(1.0) / (2.0 * M_PI);
+var_dump($acosv3);
+if (allowed_rounding_error($acosv3 ,0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+
+echo "acos 0.0 = ";
+$acosv4 = 360.0 * acos(0.0) / (2.0 * M_PI );
+var_dump($acosv4);
+if (allowed_rounding_error($acosv3 ,0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+acos .5 = float(%f)
+Pass
+acos 0.86602540378444 = float(%f)
+Pass
+acos 1.0 = float(%f)
+Pass
+acos 0.0 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/acos_basiclong_64bit.phpt b/ext/standard/tests/math/acos_basiclong_64bit.phpt
new file mode 100644
index 0000000..3d811f5
--- /dev/null
+++ b/ext/standard/tests/math/acos_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test acos function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(acos($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(NAN)
+--- testing: -9223372036854775808 ---
+float(NAN)
+--- testing: 2147483647 ---
+float(NAN)
+--- testing: -2147483648 ---
+float(NAN)
+--- testing: 9223372034707292160 ---
+float(NAN)
+--- testing: -9223372034707292160 ---
+float(NAN)
+--- testing: 2147483648 ---
+float(NAN)
+--- testing: -2147483649 ---
+float(NAN)
+--- testing: 4294967294 ---
+float(NAN)
+--- testing: 4294967295 ---
+float(NAN)
+--- testing: 4294967293 ---
+float(NAN)
+--- testing: 9223372036854775806 ---
+float(NAN)
+--- testing: 9.2233720368548E+18 ---
+float(NAN)
+--- testing: -9223372036854775807 ---
+float(NAN)
+--- testing: -9.2233720368548E+18 ---
+float(NAN)
+===DONE===
diff --git a/ext/standard/tests/math/acos_error.phpt b/ext/standard/tests/math/acos_error.phpt
new file mode 100644
index 0000000..6cfdb8f
--- /dev/null
+++ b/ext/standard/tests/math/acos_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for acos()
+--FILE--
+<?php
+/*
+ * proto float acos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(acos($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(acos());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: acos() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: acos() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/acos_variation.phpt b/ext/standard/tests/math/acos_variation.phpt
new file mode 100644
index 0000000..006bcec
--- /dev/null
+++ b/ext/standard/tests/math/acos_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of acos()
+--INI--
+precision=10
+--FILE--
+<?php
+/*
+ * proto float acos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test acos with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = acos($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+
+Warning: acos() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(NAN)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(NAN)
+float(1.570796327)
+float(0)
+float(1.570796327)
diff --git a/ext/standard/tests/math/acosh_basic.phpt b/ext/standard/tests/math/acosh_basic.phpt
new file mode 100644
index 0000000..d94109d
--- /dev/null
+++ b/ext/standard/tests/math/acosh_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test return type and value for expected input acosh()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float acosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "acosh 1.1276259652064= ";
+var_dump(acosh(1.1276259652064));
+if (allowed_rounding_error(acosh(1.1276259652064), 0.5))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "acosh 10.067661995778= ";
+var_dump(acosh(10.067661995778));
+if (allowed_rounding_error(acosh(10.067661995778), 3.0))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+
+?>
+--EXPECTF--
+acosh 1.1276259652064= float(%f)
+Pass
+acosh 10.067661995778= float(%f)
+Pass
diff --git a/ext/standard/tests/math/acosh_basiclong_64bit.phpt b/ext/standard/tests/math/acosh_basiclong_64bit.phpt
new file mode 100644
index 0000000..80c33b2
--- /dev/null
+++ b/ext/standard/tests/math/acosh_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test acosh function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(acosh($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(44.361419555836)
+--- testing: -9223372036854775808 ---
+float(NAN)
+--- testing: 2147483647 ---
+float(22.180709777453)
+--- testing: -2147483648 ---
+float(NAN)
+--- testing: 9223372034707292160 ---
+float(44.361419555604)
+--- testing: -9223372034707292160 ---
+float(NAN)
+--- testing: 2147483648 ---
+float(22.180709777918)
+--- testing: -2147483649 ---
+float(NAN)
+--- testing: 4294967294 ---
+float(22.873856958013)
+--- testing: 4294967295 ---
+float(22.873856958245)
+--- testing: 4294967293 ---
+float(22.87385695778)
+--- testing: 9223372036854775806 ---
+float(44.361419555836)
+--- testing: 9.2233720368548E+18 ---
+float(44.361419555836)
+--- testing: -9223372036854775807 ---
+float(NAN)
+--- testing: -9.2233720368548E+18 ---
+float(NAN)
+===DONE===
diff --git a/ext/standard/tests/math/acosh_error.phpt b/ext/standard/tests/math/acosh_error.phpt
new file mode 100644
index 0000000..cb85bec
--- /dev/null
+++ b/ext/standard/tests/math/acosh_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for acosh()
+--FILE--
+<?php
+/*
+ * proto float acosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(acosh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(acosh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: acosh() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: acosh() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/acosh_variation.phpt b/ext/standard/tests/math/acosh_variation.phpt
new file mode 100644
index 0000000..fbcb62a
--- /dev/null
+++ b/ext/standard/tests/math/acosh_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of acosh()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float acosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test acosh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = acosh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(3.828168471)
+float(NAN)
+float(3.847562739)
+float(NAN)
+float(3.828168471)
+float(3.828168471)
+float(3.828168471)
+float(3.847562739)
+float(3.847562739)
+
+Warning: acosh() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(7.60090221)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(7.60090221)
+float(NAN)
+float(0)
+float(NAN)
diff --git a/ext/standard/tests/math/allowed_rounding_error.inc b/ext/standard/tests/math/allowed_rounding_error.inc
new file mode 100644
index 0000000..71dbf9a
--- /dev/null
+++ b/ext/standard/tests/math/allowed_rounding_error.inc
@@ -0,0 +1,18 @@
+<?php
+function allowed_rounding_error ($number, $expected) {
+
+ //different machines may give slightly different floating point numbers
+ //This assumes that the results will be the same to + or - 1.0E-10.
+
+ $small_number = 1.0e-10;
+ $min = $expected - $small_number;
+ $max = $expected + $small_number;
+
+ if ($number < $max && $number > $min ) {
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+?> \ No newline at end of file
diff --git a/ext/standard/tests/math/asin_basic.phpt b/ext/standard/tests/math/asin_basic.phpt
new file mode 100644
index 0000000..183f744
--- /dev/null
+++ b/ext/standard/tests/math/asin_basic.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test return type and value for expected input asin()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float asin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+
+//output is in degrees
+
+echo "asin .5 = ";
+$asinv1 = 360.0 * asin(0.5) / (2.0 * M_PI );
+var_dump($asinv1);
+if (allowed_rounding_error($asinv1 ,30 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "asin 0.86602540378444 = ";
+$asinv2 = 360.0 * asin(0.86602540378444) / (2.0 * M_PI );
+var_dump($asinv2);
+if (allowed_rounding_error($asinv2 ,60 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "asin 1.0 = ";
+$asinv3 = 360.0 * asin(1.0) / (2.0 * M_PI );
+var_dump($asinv3);
+if (allowed_rounding_error($asinv3 ,90 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+
+echo "asin 0.0 = ";
+$asinv4 = 360.0 * asin(0.0) / (2.0 * M_PI );
+var_dump($asinv4);
+if (allowed_rounding_error($asinv4 ,0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+asin .5 = float(%f)
+Pass
+asin 0.86602540378444 = float(%f)
+Pass
+asin 1.0 = float(%f)
+Pass
+asin 0.0 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/asin_basiclong_64bit.phpt b/ext/standard/tests/math/asin_basiclong_64bit.phpt
new file mode 100644
index 0000000..7e17f2d
--- /dev/null
+++ b/ext/standard/tests/math/asin_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test asin function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(asin($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(NAN)
+--- testing: -9223372036854775808 ---
+float(NAN)
+--- testing: 2147483647 ---
+float(NAN)
+--- testing: -2147483648 ---
+float(NAN)
+--- testing: 9223372034707292160 ---
+float(NAN)
+--- testing: -9223372034707292160 ---
+float(NAN)
+--- testing: 2147483648 ---
+float(NAN)
+--- testing: -2147483649 ---
+float(NAN)
+--- testing: 4294967294 ---
+float(NAN)
+--- testing: 4294967295 ---
+float(NAN)
+--- testing: 4294967293 ---
+float(NAN)
+--- testing: 9223372036854775806 ---
+float(NAN)
+--- testing: 9.2233720368548E+18 ---
+float(NAN)
+--- testing: -9223372036854775807 ---
+float(NAN)
+--- testing: -9.2233720368548E+18 ---
+float(NAN)
+===DONE===
diff --git a/ext/standard/tests/math/asin_error.phpt b/ext/standard/tests/math/asin_error.phpt
new file mode 100644
index 0000000..a51a077
--- /dev/null
+++ b/ext/standard/tests/math/asin_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for asin()
+--FILE--
+<?php
+/*
+ * proto float asin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(asin($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(asin());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: asin() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: asin() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/asin_variation.phpt b/ext/standard/tests/math/asin_variation.phpt
new file mode 100644
index 0000000..83a33ee
--- /dev/null
+++ b/ext/standard/tests/math/asin_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of asin()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float asin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test asin with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = asin($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+
+Warning: asin() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(NAN)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(NAN)
+float(0)
+float(1.570796327)
+float(0)
diff --git a/ext/standard/tests/math/asinh_basic.phpt b/ext/standard/tests/math/asinh_basic.phpt
new file mode 100644
index 0000000..ff8a2d1
--- /dev/null
+++ b/ext/standard/tests/math/asinh_basic.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test return type and value for expected input asinh()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float asinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "asinh 0.52109530549375= ";
+var_dump(asinh(0.52109530549375));
+if (allowed_rounding_error(asinh(0.52109530549375), 0.5))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "asinh 10.01787492741= ";
+var_dump(asinh(10.01787492741));
+if (allowed_rounding_error(asinh(10.01787492741), 3.0))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+asinh 0.52109530549375= float(%f)
+Pass
+asinh 10.01787492741= float(%f)
+Pass
diff --git a/ext/standard/tests/math/asinh_basiclong_64bit.phpt b/ext/standard/tests/math/asinh_basiclong_64bit.phpt
new file mode 100644
index 0000000..a501d75
--- /dev/null
+++ b/ext/standard/tests/math/asinh_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test asinh function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(asinh($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(44.361419555836)
+--- testing: -9223372036854775808 ---
+float(-44.361419555836)
+--- testing: 2147483647 ---
+float(22.180709777453)
+--- testing: -2147483648 ---
+float(-22.180709777918)
+--- testing: 9223372034707292160 ---
+float(44.361419555604)
+--- testing: -9223372034707292160 ---
+float(-44.361419555604)
+--- testing: 2147483648 ---
+float(22.180709777918)
+--- testing: -2147483649 ---
+float(-22.180709778384)
+--- testing: 4294967294 ---
+float(22.873856958013)
+--- testing: 4294967295 ---
+float(22.873856958245)
+--- testing: 4294967293 ---
+float(22.87385695778)
+--- testing: 9223372036854775806 ---
+float(44.361419555836)
+--- testing: 9.2233720368548E+18 ---
+float(44.361419555836)
+--- testing: -9223372036854775807 ---
+float(-44.361419555836)
+--- testing: -9.2233720368548E+18 ---
+float(-44.361419555836)
+===DONE===
diff --git a/ext/standard/tests/math/asinh_error.phpt b/ext/standard/tests/math/asinh_error.phpt
new file mode 100644
index 0000000..8a0d558
--- /dev/null
+++ b/ext/standard/tests/math/asinh_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for asinh()
+--FILE--
+<?php
+/*
+ * proto float asinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(asinh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(asinh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: asinh() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: asinh() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/asinh_variation.phpt b/ext/standard/tests/math/asinh_variation.phpt
new file mode 100644
index 0000000..96fbbcb
--- /dev/null
+++ b/ext/standard/tests/math/asinh_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of asinh()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float asinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test asinh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = asinh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(3.829113652)
+float(-3.829113652)
+float(3.848471992)
+float(-3.848471992)
+float(3.829113652)
+float(3.829113652)
+float(3.829113652)
+float(3.848471992)
+float(3.848471992)
+
+Warning: asinh() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(7.60090271)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(7.60090271)
+float(0)
+float(0.881373587)
+float(0)
diff --git a/ext/standard/tests/math/atan2_basic.phpt b/ext/standard/tests/math/atan2_basic.phpt
new file mode 100644
index 0000000..65a0622
--- /dev/null
+++ b/ext/standard/tests/math/atan2_basic.phpt
@@ -0,0 +1,185 @@
+--TEST--
+Test atan2() - basic function test of atan2()
+--INI--
+precision=14
+--FILE--
+<?php
+$valuesy = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ null,
+ true,
+ false);
+
+$valuesx = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($valuesy); $i++) {
+ for ($j = 0; $j < count($valuesx); $j++) {
+ $res = atan2($valuesy[$i], $valuesx[$j]);
+ echo "Y:$valuesy[$i] X:$valuesx[$j] ";
+ var_dump($res);
+ }
+}
+?>
+--EXPECTF--
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:-23 float(2.3561944901923)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:-23.45 float(2.3658820235113)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:2.345e1 float(0.77571063007847)
+Y:23 X: float(1.5707963267949)
+Y:23 X:1 float(1.5273454314034)
+Y:23 X: float(1.5707963267949)
+Y:-23 X:23 float(-0.78539816339745)
+Y:-23 X:-23 float(-2.3561944901923)
+Y:-23 X:23.45 float(-0.77571063007847)
+Y:-23 X:-23.45 float(-2.3658820235113)
+Y:-23 X:23 float(-0.78539816339745)
+Y:-23 X:23 float(-0.78539816339745)
+Y:-23 X:23 float(-0.78539816339745)
+Y:-23 X:23.45 float(-0.77571063007847)
+Y:-23 X:2.345e1 float(-0.77571063007847)
+Y:-23 X: float(-1.5707963267949)
+Y:-23 X:1 float(-1.5273454314034)
+Y:-23 X: float(-1.5707963267949)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:-23 float(2.3465069568734)
+Y:23.45 X:23.45 float(0.78539816339745)
+Y:23.45 X:-23.45 float(2.3561944901923)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23.45 float(0.78539816339745)
+Y:23.45 X:2.345e1 float(0.78539816339745)
+Y:23.45 X: float(1.5707963267949)
+Y:23.45 X:1 float(1.5281782247706)
+Y:23.45 X: float(1.5707963267949)
+Y:-23.45 X:23 float(-0.79508569671643)
+Y:-23.45 X:-23 float(-2.3465069568734)
+Y:-23.45 X:23.45 float(-0.78539816339745)
+Y:-23.45 X:-23.45 float(-2.3561944901923)
+Y:-23.45 X:23 float(-0.79508569671643)
+Y:-23.45 X:23 float(-0.79508569671643)
+Y:-23.45 X:23 float(-0.79508569671643)
+Y:-23.45 X:23.45 float(-0.78539816339745)
+Y:-23.45 X:2.345e1 float(-0.78539816339745)
+Y:-23.45 X: float(-1.5707963267949)
+Y:-23.45 X:1 float(-1.5281782247706)
+Y:-23.45 X: float(-1.5707963267949)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:-23 float(2.3561944901923)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:-23.45 float(2.3658820235113)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:2.345e1 float(0.77571063007847)
+Y:23 X: float(1.5707963267949)
+Y:23 X:1 float(1.5273454314034)
+Y:23 X: float(1.5707963267949)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:-23 float(2.3561944901923)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:-23.45 float(2.3658820235113)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:2.345e1 float(0.77571063007847)
+Y:23 X: float(1.5707963267949)
+Y:23 X:1 float(1.5273454314034)
+Y:23 X: float(1.5707963267949)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:-23 float(2.3561944901923)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:-23.45 float(2.3658820235113)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23 float(0.78539816339745)
+Y:23 X:23.45 float(0.77571063007847)
+Y:23 X:2.345e1 float(0.77571063007847)
+Y:23 X: float(1.5707963267949)
+Y:23 X:1 float(1.5273454314034)
+Y:23 X: float(1.5707963267949)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:-23 float(2.3465069568734)
+Y:23.45 X:23.45 float(0.78539816339745)
+Y:23.45 X:-23.45 float(2.3561944901923)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23 float(0.79508569671643)
+Y:23.45 X:23.45 float(0.78539816339745)
+Y:23.45 X:2.345e1 float(0.78539816339745)
+Y:23.45 X: float(1.5707963267949)
+Y:23.45 X:1 float(1.5281782247706)
+Y:23.45 X: float(1.5707963267949)
+Y:2.345e1 X:23 float(0.79508569671643)
+Y:2.345e1 X:-23 float(2.3465069568734)
+Y:2.345e1 X:23.45 float(0.78539816339745)
+Y:2.345e1 X:-23.45 float(2.3561944901923)
+Y:2.345e1 X:23 float(0.79508569671643)
+Y:2.345e1 X:23 float(0.79508569671643)
+Y:2.345e1 X:23 float(0.79508569671643)
+Y:2.345e1 X:23.45 float(0.78539816339745)
+Y:2.345e1 X:2.345e1 float(0.78539816339745)
+Y:2.345e1 X: float(1.5707963267949)
+Y:2.345e1 X:1 float(1.5281782247706)
+Y:2.345e1 X: float(1.5707963267949)
+Y: X:23 float(0)
+Y: X:-23 float(3.1415926535898)
+Y: X:23.45 float(0)
+Y: X:-23.45 float(3.1415926535898)
+Y: X:23 float(0)
+Y: X:23 float(0)
+Y: X:23 float(0)
+Y: X:23.45 float(0)
+Y: X:2.345e1 float(0)
+Y: X: float(0)
+Y: X:1 float(0)
+Y: X: float(0)
+Y:1 X:23 float(0.043450895391531)
+Y:1 X:-23 float(3.0981417581983)
+Y:1 X:23.45 float(0.042618102024328)
+Y:1 X:-23.45 float(3.0989745515655)
+Y:1 X:23 float(0.043450895391531)
+Y:1 X:23 float(0.043450895391531)
+Y:1 X:23 float(0.043450895391531)
+Y:1 X:23.45 float(0.042618102024328)
+Y:1 X:2.345e1 float(0.042618102024328)
+Y:1 X: float(1.5707963267949)
+Y:1 X:1 float(0.78539816339745)
+Y:1 X: float(1.5707963267949)
+Y: X:23 float(0)
+Y: X:-23 float(3.1415926535898)
+Y: X:23.45 float(0)
+Y: X:-23.45 float(3.1415926535898)
+Y: X:23 float(0)
+Y: X:23 float(0)
+Y: X:23 float(0)
+Y: X:23.45 float(0)
+Y: X:2.345e1 float(0)
+Y: X: float(0)
+Y: X:1 float(0)
+Y: X: float(0)
diff --git a/ext/standard/tests/math/atan2_basiclong_64bit.phpt b/ext/standard/tests/math/atan2_basiclong_64bit.phpt
new file mode 100644
index 0000000..e0548a0
--- /dev/null
+++ b/ext/standard/tests/math/atan2_basiclong_64bit.phpt
@@ -0,0 +1,364 @@
+--TEST--
+Test atan2 function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MIN_32Bit, MAX_64Bit, MIN_64Bit);
+
+
+foreach ($longVals as $longVal) {
+ foreach($otherVals as $otherVal) {
+ echo "--- testing: $longVal, $otherVal ---\n";
+ var_dump(atan2($longVal, $otherVal));
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807, 0 ---
+float(1.5707963267949)
+--- testing: 9223372036854775807, 1 ---
+float(1.5707963267949)
+--- testing: 9223372036854775807, -1 ---
+float(1.5707963267949)
+--- testing: 9223372036854775807, 7 ---
+float(1.5707963267949)
+--- testing: 9223372036854775807, 9 ---
+float(1.5707963267949)
+--- testing: 9223372036854775807, 65 ---
+float(1.5707963267949)
+--- testing: 9223372036854775807, -44 ---
+float(1.5707963267949)
+--- testing: 9223372036854775807, 2147483647 ---
+float(1.5707963265621)
+--- testing: 9223372036854775807, -2147483648 ---
+float(1.5707963270277)
+--- testing: 9223372036854775807, 9223372036854775807 ---
+float(0.78539816339745)
+--- testing: 9223372036854775807, -9223372036854775808 ---
+float(2.3561944901923)
+--- testing: -9223372036854775808, 0 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775808, 1 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775808, -1 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775808, 7 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775808, 9 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775808, 65 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775808, -44 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775808, 2147483647 ---
+float(-1.5707963265621)
+--- testing: -9223372036854775808, -2147483648 ---
+float(-1.5707963270277)
+--- testing: -9223372036854775808, 9223372036854775807 ---
+float(-0.78539816339745)
+--- testing: -9223372036854775808, -9223372036854775808 ---
+float(-2.3561944901923)
+--- testing: 2147483647, 0 ---
+float(1.5707963267949)
+--- testing: 2147483647, 1 ---
+float(1.5707963263292)
+--- testing: 2147483647, -1 ---
+float(1.5707963272606)
+--- testing: 2147483647, 7 ---
+float(1.5707963235353)
+--- testing: 2147483647, 9 ---
+float(1.5707963226039)
+--- testing: 2147483647, 65 ---
+float(1.5707962965269)
+--- testing: 2147483647, -44 ---
+float(1.570796347284)
+--- testing: 2147483647, 2147483647 ---
+float(0.78539816339745)
+--- testing: 2147483647, -2147483648 ---
+float(2.3561944904252)
+--- testing: 2147483647, 9223372036854775807 ---
+float(2.3283064354545E-10)
+--- testing: 2147483647, -9223372036854775808 ---
+float(3.141592653357)
+--- testing: -2147483648, 0 ---
+float(-1.5707963267949)
+--- testing: -2147483648, 1 ---
+float(-1.5707963263292)
+--- testing: -2147483648, -1 ---
+float(-1.5707963272606)
+--- testing: -2147483648, 7 ---
+float(-1.5707963235353)
+--- testing: -2147483648, 9 ---
+float(-1.5707963226039)
+--- testing: -2147483648, 65 ---
+float(-1.5707962965269)
+--- testing: -2147483648, -44 ---
+float(-1.570796347284)
+--- testing: -2147483648, 2147483647 ---
+float(-0.78539816363028)
+--- testing: -2147483648, -2147483648 ---
+float(-2.3561944901923)
+--- testing: -2147483648, 9223372036854775807 ---
+float(-2.3283064365387E-10)
+--- testing: -2147483648, -9223372036854775808 ---
+float(-3.141592653357)
+--- testing: 9223372034707292160, 0 ---
+float(1.5707963267949)
+--- testing: 9223372034707292160, 1 ---
+float(1.5707963267949)
+--- testing: 9223372034707292160, -1 ---
+float(1.5707963267949)
+--- testing: 9223372034707292160, 7 ---
+float(1.5707963267949)
+--- testing: 9223372034707292160, 9 ---
+float(1.5707963267949)
+--- testing: 9223372034707292160, 65 ---
+float(1.5707963267949)
+--- testing: 9223372034707292160, -44 ---
+float(1.5707963267949)
+--- testing: 9223372034707292160, 2147483647 ---
+float(1.5707963265621)
+--- testing: 9223372034707292160, -2147483648 ---
+float(1.5707963270277)
+--- testing: 9223372034707292160, 9223372036854775807 ---
+float(0.78539816328103)
+--- testing: 9223372034707292160, -9223372036854775808 ---
+float(2.3561944903088)
+--- testing: -9223372034707292160, 0 ---
+float(-1.5707963267949)
+--- testing: -9223372034707292160, 1 ---
+float(-1.5707963267949)
+--- testing: -9223372034707292160, -1 ---
+float(-1.5707963267949)
+--- testing: -9223372034707292160, 7 ---
+float(-1.5707963267949)
+--- testing: -9223372034707292160, 9 ---
+float(-1.5707963267949)
+--- testing: -9223372034707292160, 65 ---
+float(-1.5707963267949)
+--- testing: -9223372034707292160, -44 ---
+float(-1.5707963267949)
+--- testing: -9223372034707292160, 2147483647 ---
+float(-1.5707963265621)
+--- testing: -9223372034707292160, -2147483648 ---
+float(-1.5707963270277)
+--- testing: -9223372034707292160, 9223372036854775807 ---
+float(-0.78539816328103)
+--- testing: -9223372034707292160, -9223372036854775808 ---
+float(-2.3561944903088)
+--- testing: 2147483648, 0 ---
+float(1.5707963267949)
+--- testing: 2147483648, 1 ---
+float(1.5707963263292)
+--- testing: 2147483648, -1 ---
+float(1.5707963272606)
+--- testing: 2147483648, 7 ---
+float(1.5707963235353)
+--- testing: 2147483648, 9 ---
+float(1.5707963226039)
+--- testing: 2147483648, 65 ---
+float(1.5707962965269)
+--- testing: 2147483648, -44 ---
+float(1.570796347284)
+--- testing: 2147483648, 2147483647 ---
+float(0.78539816363028)
+--- testing: 2147483648, -2147483648 ---
+float(2.3561944901923)
+--- testing: 2147483648, 9223372036854775807 ---
+float(2.3283064365387E-10)
+--- testing: 2147483648, -9223372036854775808 ---
+float(3.141592653357)
+--- testing: -2147483649, 0 ---
+float(-1.5707963267949)
+--- testing: -2147483649, 1 ---
+float(-1.5707963263292)
+--- testing: -2147483649, -1 ---
+float(-1.5707963272606)
+--- testing: -2147483649, 7 ---
+float(-1.5707963235353)
+--- testing: -2147483649, 9 ---
+float(-1.5707963226039)
+--- testing: -2147483649, 65 ---
+float(-1.5707962965269)
+--- testing: -2147483649, -44 ---
+float(-1.570796347284)
+--- testing: -2147483649, 2147483647 ---
+float(-0.78539816386311)
+--- testing: -2147483649, -2147483648 ---
+float(-2.3561944899595)
+--- testing: -2147483649, 9223372036854775807 ---
+float(-2.3283064376229E-10)
+--- testing: -2147483649, -9223372036854775808 ---
+float(-3.141592653357)
+--- testing: 4294967294, 0 ---
+float(1.5707963267949)
+--- testing: 4294967294, 1 ---
+float(1.5707963265621)
+--- testing: 4294967294, -1 ---
+float(1.5707963270277)
+--- testing: 4294967294, 7 ---
+float(1.5707963251651)
+--- testing: 4294967294, 9 ---
+float(1.5707963246994)
+--- testing: 4294967294, 65 ---
+float(1.5707963116609)
+--- testing: 4294967294, -44 ---
+float(1.5707963370394)
+--- testing: 4294967294, 2147483647 ---
+float(1.1071487177941)
+--- testing: 4294967294, -2147483648 ---
+float(2.034443935982)
+--- testing: 4294967294, 9223372036854775807 ---
+float(4.656612870909E-10)
+--- testing: 4294967294, -9223372036854775808 ---
+float(3.1415926531241)
+--- testing: 4294967295, 0 ---
+float(1.5707963267949)
+--- testing: 4294967295, 1 ---
+float(1.5707963265621)
+--- testing: 4294967295, -1 ---
+float(1.5707963270277)
+--- testing: 4294967295, 7 ---
+float(1.5707963251651)
+--- testing: 4294967295, 9 ---
+float(1.5707963246994)
+--- testing: 4294967295, 65 ---
+float(1.5707963116609)
+--- testing: 4294967295, -44 ---
+float(1.5707963370394)
+--- testing: 4294967295, 2147483647 ---
+float(1.1071487178872)
+--- testing: 4294967295, -2147483648 ---
+float(2.0344439358888)
+--- testing: 4294967295, 9223372036854775807 ---
+float(4.6566128719932E-10)
+--- testing: 4294967295, -9223372036854775808 ---
+float(3.1415926531241)
+--- testing: 4294967293, 0 ---
+float(1.5707963267949)
+--- testing: 4294967293, 1 ---
+float(1.5707963265621)
+--- testing: 4294967293, -1 ---
+float(1.5707963270277)
+--- testing: 4294967293, 7 ---
+float(1.5707963251651)
+--- testing: 4294967293, 9 ---
+float(1.5707963246994)
+--- testing: 4294967293, 65 ---
+float(1.5707963116609)
+--- testing: 4294967293, -44 ---
+float(1.5707963370394)
+--- testing: 4294967293, 2147483647 ---
+float(1.107148717701)
+--- testing: 4294967293, -2147483648 ---
+float(2.0344439360751)
+--- testing: 4294967293, 9223372036854775807 ---
+float(4.6566128698248E-10)
+--- testing: 4294967293, -9223372036854775808 ---
+float(3.1415926531241)
+--- testing: 9223372036854775806, 0 ---
+float(1.5707963267949)
+--- testing: 9223372036854775806, 1 ---
+float(1.5707963267949)
+--- testing: 9223372036854775806, -1 ---
+float(1.5707963267949)
+--- testing: 9223372036854775806, 7 ---
+float(1.5707963267949)
+--- testing: 9223372036854775806, 9 ---
+float(1.5707963267949)
+--- testing: 9223372036854775806, 65 ---
+float(1.5707963267949)
+--- testing: 9223372036854775806, -44 ---
+float(1.5707963267949)
+--- testing: 9223372036854775806, 2147483647 ---
+float(1.5707963265621)
+--- testing: 9223372036854775806, -2147483648 ---
+float(1.5707963270277)
+--- testing: 9223372036854775806, 9223372036854775807 ---
+float(0.78539816339745)
+--- testing: 9223372036854775806, -9223372036854775808 ---
+float(2.3561944901923)
+--- testing: 9.2233720368548E+18, 0 ---
+float(1.5707963267949)
+--- testing: 9.2233720368548E+18, 1 ---
+float(1.5707963267949)
+--- testing: 9.2233720368548E+18, -1 ---
+float(1.5707963267949)
+--- testing: 9.2233720368548E+18, 7 ---
+float(1.5707963267949)
+--- testing: 9.2233720368548E+18, 9 ---
+float(1.5707963267949)
+--- testing: 9.2233720368548E+18, 65 ---
+float(1.5707963267949)
+--- testing: 9.2233720368548E+18, -44 ---
+float(1.5707963267949)
+--- testing: 9.2233720368548E+18, 2147483647 ---
+float(1.5707963265621)
+--- testing: 9.2233720368548E+18, -2147483648 ---
+float(1.5707963270277)
+--- testing: 9.2233720368548E+18, 9223372036854775807 ---
+float(0.78539816339745)
+--- testing: 9.2233720368548E+18, -9223372036854775808 ---
+float(2.3561944901923)
+--- testing: -9223372036854775807, 0 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775807, 1 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775807, -1 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775807, 7 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775807, 9 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775807, 65 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775807, -44 ---
+float(-1.5707963267949)
+--- testing: -9223372036854775807, 2147483647 ---
+float(-1.5707963265621)
+--- testing: -9223372036854775807, -2147483648 ---
+float(-1.5707963270277)
+--- testing: -9223372036854775807, 9223372036854775807 ---
+float(-0.78539816339745)
+--- testing: -9223372036854775807, -9223372036854775808 ---
+float(-2.3561944901923)
+--- testing: -9.2233720368548E+18, 0 ---
+float(-1.5707963267949)
+--- testing: -9.2233720368548E+18, 1 ---
+float(-1.5707963267949)
+--- testing: -9.2233720368548E+18, -1 ---
+float(-1.5707963267949)
+--- testing: -9.2233720368548E+18, 7 ---
+float(-1.5707963267949)
+--- testing: -9.2233720368548E+18, 9 ---
+float(-1.5707963267949)
+--- testing: -9.2233720368548E+18, 65 ---
+float(-1.5707963267949)
+--- testing: -9.2233720368548E+18, -44 ---
+float(-1.5707963267949)
+--- testing: -9.2233720368548E+18, 2147483647 ---
+float(-1.5707963265621)
+--- testing: -9.2233720368548E+18, -2147483648 ---
+float(-1.5707963270277)
+--- testing: -9.2233720368548E+18, 9223372036854775807 ---
+float(-0.78539816339745)
+--- testing: -9.2233720368548E+18, -9223372036854775808 ---
+float(-2.3561944901923)
+===DONE===
diff --git a/ext/standard/tests/math/atan2_error.phpt b/ext/standard/tests/math/atan2_error.phpt
new file mode 100644
index 0000000..ce9687c
--- /dev/null
+++ b/ext/standard/tests/math/atan2_error.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Test atan2() - wrong params atan2()
+--FILE--
+<?php
+atan2();
+atan2(36);
+atan2(36,25,0);
+?>
+--EXPECTF--
+Warning: atan2() expects exactly 2 parameters, 0 given in %s on line %d
+
+Warning: atan2() expects exactly 2 parameters, 1 given in %s on line %d
+
+Warning: atan2() expects exactly 2 parameters, 3 given in %s on line %d
diff --git a/ext/standard/tests/math/atan2_variation1.phpt b/ext/standard/tests/math/atan2_variation1.phpt
new file mode 100644
index 0000000..d606060
--- /dev/null
+++ b/ext/standard/tests/math/atan2_variation1.phpt
@@ -0,0 +1,187 @@
+--TEST--
+Test atan2() function : usage variations - different data types as $y arg
+--INI--
+precision = 10
+--FILE--
+<?php
+/* Prototype : float atan2 ( float $y , float $x )
+ * Description: Arc tangent of two variables.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing atan2() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12,
+ -12,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 1.234567e2,
+ 1.234567E-2,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of atan2()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(atan2($input, 23));
+ $iterator++;
+};
+
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing atan2() : usage variations ***
+
+-- Iteration 1 --
+float(0)
+
+-- Iteration 2 --
+float(0.04345089539)
+
+-- Iteration 3 --
+float(0.4808872802)
+
+-- Iteration 4 --
+float(-0.4808872802)
+
+-- Iteration 5 --
+float(1.570796316)
+
+-- Iteration 6 --
+float(0.4282641529)
+
+-- Iteration 7 --
+float(-0.4282641529)
+
+-- Iteration 8 --
+float(1.386607742)
+
+-- Iteration 9 --
+float(0.0005367682093)
+
+-- Iteration 10 --
+float(0.02173570684)
+
+-- Iteration 11 --
+float(0)
+
+-- Iteration 12 --
+float(0)
+
+-- Iteration 13 --
+float(0.04345089539)
+
+-- Iteration 14 --
+float(0)
+
+-- Iteration 15 --
+float(0.04345089539)
+
+-- Iteration 16 --
+float(0)
+
+-- Iteration 17 --
+
+Warning: atan2() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: atan2() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: atan2() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: atan2() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: atan2() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: atan2() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: atan2() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(0)
+
+-- Iteration 25 --
+float(0)
+
+-- Iteration 26 --
+
+Warning: atan2() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/atan2_variation2.phpt b/ext/standard/tests/math/atan2_variation2.phpt
new file mode 100644
index 0000000..fc0b9e6
--- /dev/null
+++ b/ext/standard/tests/math/atan2_variation2.phpt
@@ -0,0 +1,186 @@
+--TEST--
+Test atan2() function : usage variations - different data types as $x arg
+--INI--
+precision = 10
+--FILE--
+<?php
+/* Prototype : float atan2 ( float $y , float $x )
+ * Description: Arc tangent of two variables.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing atan2() : basic functionality ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12,
+ -12,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 1.234567e2,
+ 1.234567E-2,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of atan2()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(atan2(23, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing atan2() : basic functionality ***
+
+-- Iteration 1 --
+float(1.570796327)
+
+-- Iteration 2 --
+float(1.527345431)
+
+-- Iteration 3 --
+float(1.089909047)
+
+-- Iteration 4 --
+float(2.051683607)
+
+-- Iteration 5 --
+float(1.071020961E-8)
+
+-- Iteration 6 --
+float(1.142532174)
+
+-- Iteration 7 --
+float(1.99906048)
+
+-- Iteration 8 --
+float(0.1841885846)
+
+-- Iteration 9 --
+float(1.570259559)
+
+-- Iteration 10 --
+float(1.54906062)
+
+-- Iteration 11 --
+float(1.570796327)
+
+-- Iteration 12 --
+float(1.570796327)
+
+-- Iteration 13 --
+float(1.527345431)
+
+-- Iteration 14 --
+float(1.570796327)
+
+-- Iteration 15 --
+float(1.527345431)
+
+-- Iteration 16 --
+float(1.570796327)
+
+-- Iteration 17 --
+
+Warning: atan2() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: atan2() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: atan2() expects parameter 2 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: atan2() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: atan2() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: atan2() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: atan2() expects parameter 2 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(1.570796327)
+
+-- Iteration 25 --
+float(1.570796327)
+
+-- Iteration 26 --
+
+Warning: atan2() expects parameter 2 to be double, resource given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/atan_basic.phpt b/ext/standard/tests/math/atan_basic.phpt
new file mode 100644
index 0000000..f4a2bed
--- /dev/null
+++ b/ext/standard/tests/math/atan_basic.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test return type and value for expected input atan()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float atan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "atan 1.7320508075689 = ";
+$atan1 = 360 * atan(1.7320508075689) / (2.0 * M_PI);
+var_dump($atan1);
+if (allowed_rounding_error($atan1 ,60 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "atan 0.57735026918963 = ";
+$atan2 = 360 * atan(0.57735026918963) / (2.0 * M_PI);
+var_dump($atan2);
+if (allowed_rounding_error($atan2 ,30 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+atan 1.7320508075689 = float(%f)
+Pass
+atan 0.57735026918963 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/atan_basiclong_64bit.phpt b/ext/standard/tests/math/atan_basiclong_64bit.phpt
new file mode 100644
index 0000000..ffdfe24
--- /dev/null
+++ b/ext/standard/tests/math/atan_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test atan function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(atan($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(1.5707963267949)
+--- testing: -9223372036854775808 ---
+float(-1.5707963267949)
+--- testing: 2147483647 ---
+float(1.5707963263292)
+--- testing: -2147483648 ---
+float(-1.5707963263292)
+--- testing: 9223372034707292160 ---
+float(1.5707963267949)
+--- testing: -9223372034707292160 ---
+float(-1.5707963267949)
+--- testing: 2147483648 ---
+float(1.5707963263292)
+--- testing: -2147483649 ---
+float(-1.5707963263292)
+--- testing: 4294967294 ---
+float(1.5707963265621)
+--- testing: 4294967295 ---
+float(1.5707963265621)
+--- testing: 4294967293 ---
+float(1.5707963265621)
+--- testing: 9223372036854775806 ---
+float(1.5707963267949)
+--- testing: 9.2233720368548E+18 ---
+float(1.5707963267949)
+--- testing: -9223372036854775807 ---
+float(-1.5707963267949)
+--- testing: -9.2233720368548E+18 ---
+float(-1.5707963267949)
+===DONE===
diff --git a/ext/standard/tests/math/atan_error.phpt b/ext/standard/tests/math/atan_error.phpt
new file mode 100644
index 0000000..61b35b0
--- /dev/null
+++ b/ext/standard/tests/math/atan_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for atan()
+--FILE--
+<?php
+/*
+ * proto float atan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(atan($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(atan());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: atan() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: atan() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/atan_variation.phpt b/ext/standard/tests/math/atan_variation.phpt
new file mode 100644
index 0000000..c58514d
--- /dev/null
+++ b/ext/standard/tests/math/atan_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of atan()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float atan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test atan with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = atan($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(1.527345431)
+float(-1.527345431)
+float(1.528178225)
+float(-1.528178225)
+float(1.527345431)
+float(1.527345431)
+float(1.527345431)
+float(1.528178225)
+float(1.528178225)
+
+Warning: atan() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(1.569796327)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(1.569796327)
+float(0)
+float(0.7853981634)
+float(0)
diff --git a/ext/standard/tests/math/atanh_basic.phpt b/ext/standard/tests/math/atanh_basic.phpt
new file mode 100644
index 0000000..7e7144e
--- /dev/null
+++ b/ext/standard/tests/math/atanh_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test return type and value for expected input atanh()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float atanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "atanh 0.46211715726001 = ";
+var_dump(atanh(0.46211715726001));
+if (allowed_rounding_error(atanh(0.46211715726001), 0.5))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "atanh 0.99505475368673 = ";
+var_dump(atanh(0.99505475368673));
+if (allowed_rounding_error(atanh(0.99505475368673), 3.0))
+{
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+
+?>
+--EXPECTF--
+atanh 0.46211715726001 = float(%f)
+Pass
+atanh 0.99505475368673 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/atanh_basiclong_64bit.phpt b/ext/standard/tests/math/atanh_basiclong_64bit.phpt
new file mode 100644
index 0000000..d7608ca
--- /dev/null
+++ b/ext/standard/tests/math/atanh_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test atanh function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(atanh($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(NAN)
+--- testing: -9223372036854775808 ---
+float(NAN)
+--- testing: 2147483647 ---
+float(NAN)
+--- testing: -2147483648 ---
+float(NAN)
+--- testing: 9223372034707292160 ---
+float(NAN)
+--- testing: -9223372034707292160 ---
+float(NAN)
+--- testing: 2147483648 ---
+float(NAN)
+--- testing: -2147483649 ---
+float(NAN)
+--- testing: 4294967294 ---
+float(NAN)
+--- testing: 4294967295 ---
+float(NAN)
+--- testing: 4294967293 ---
+float(NAN)
+--- testing: 9223372036854775806 ---
+float(NAN)
+--- testing: 9.2233720368548E+18 ---
+float(NAN)
+--- testing: -9223372036854775807 ---
+float(NAN)
+--- testing: -9.2233720368548E+18 ---
+float(NAN)
+===DONE===
diff --git a/ext/standard/tests/math/atanh_error.phpt b/ext/standard/tests/math/atanh_error.phpt
new file mode 100644
index 0000000..e442825
--- /dev/null
+++ b/ext/standard/tests/math/atanh_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for atanh()
+--FILE--
+<?php
+/*
+ * proto float atanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(atanh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(atanh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: atanh() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: atanh() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/atanh_variation.phpt b/ext/standard/tests/math/atanh_variation.phpt
new file mode 100644
index 0000000..4ce9646
--- /dev/null
+++ b/ext/standard/tests/math/atanh_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of atanh()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float atanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test atanh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = atanh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+float(NAN)
+
+Warning: atanh() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(NAN)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(NAN)
+float(0)
+float(INF)
+float(0)
diff --git a/ext/standard/tests/math/base_convert_basic.phpt b/ext/standard/tests/math/base_convert_basic.phpt
new file mode 100644
index 0000000..327f47c
--- /dev/null
+++ b/ext/standard/tests/math/base_convert_basic.phpt
@@ -0,0 +1,316 @@
+--TEST--
+Test base_convert() - basic function tests base_convert()
+--FILE--
+<?php
+$frombase = array(2,8,10,16,36);
+$tobase = array(2,8,10,16,36);
+
+$values = array(10,
+ 27,
+ 39,
+ 039,
+ 0x5F,
+ "10",
+ "27",
+ "39",
+ "5F",
+ "3XYZ"
+ );
+
+for ($f= 0; $f < count($frombase); $f++) {
+ echo "\n...from base is ", $frombase[$f], "\n";
+ for ($t= 0; $t < count($tobase); $t++) {
+ echo "......to base is ", $tobase[$t], "\n";
+ for ($i =0; $i < count($values); $i++){
+ $res = base_convert($values[$i],$frombase[$f],$tobase[$t]);
+ echo ".........value= ", $values[$i], " res = ", $res, "\n";
+ }
+ }
+}
+?>
+
+--EXPECTF--
+...from base is 2
+......to base is 2
+.........value= 10 res = 10
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 3 res = 0
+.........value= 95 res = 0
+.........value= 10 res = 10
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 5F res = 0
+.........value= 3XYZ res = 0
+......to base is 8
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 3 res = 0
+.........value= 95 res = 0
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 5F res = 0
+.........value= 3XYZ res = 0
+......to base is 10
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 3 res = 0
+.........value= 95 res = 0
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 5F res = 0
+.........value= 3XYZ res = 0
+......to base is 16
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 3 res = 0
+.........value= 95 res = 0
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 5F res = 0
+.........value= 3XYZ res = 0
+......to base is 36
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 3 res = 0
+.........value= 95 res = 0
+.........value= 10 res = 2
+.........value= 27 res = 0
+.........value= 39 res = 0
+.........value= 5F res = 0
+.........value= 3XYZ res = 0
+
+...from base is 8
+......to base is 2
+.........value= 10 res = 1000
+.........value= 27 res = 10111
+.........value= 39 res = 11
+.........value= 3 res = 11
+.........value= 95 res = 101
+.........value= 10 res = 1000
+.........value= 27 res = 10111
+.........value= 39 res = 11
+.........value= 5F res = 101
+.........value= 3XYZ res = 11
+......to base is 8
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 3
+.........value= 3 res = 3
+.........value= 95 res = 5
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 3
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 10
+.........value= 10 res = 8
+.........value= 27 res = 23
+.........value= 39 res = 3
+.........value= 3 res = 3
+.........value= 95 res = 5
+.........value= 10 res = 8
+.........value= 27 res = 23
+.........value= 39 res = 3
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 16
+.........value= 10 res = 8
+.........value= 27 res = 17
+.........value= 39 res = 3
+.........value= 3 res = 3
+.........value= 95 res = 5
+.........value= 10 res = 8
+.........value= 27 res = 17
+.........value= 39 res = 3
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 36
+.........value= 10 res = 8
+.........value= 27 res = n
+.........value= 39 res = 3
+.........value= 3 res = 3
+.........value= 95 res = 5
+.........value= 10 res = 8
+.........value= 27 res = n
+.........value= 39 res = 3
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+
+...from base is 10
+......to base is 2
+.........value= 10 res = 1010
+.........value= 27 res = 11011
+.........value= 39 res = 100111
+.........value= 3 res = 11
+.........value= 95 res = 1011111
+.........value= 10 res = 1010
+.........value= 27 res = 11011
+.........value= 39 res = 100111
+.........value= 5F res = 101
+.........value= 3XYZ res = 11
+......to base is 8
+.........value= 10 res = 12
+.........value= 27 res = 33
+.........value= 39 res = 47
+.........value= 3 res = 3
+.........value= 95 res = 137
+.........value= 10 res = 12
+.........value= 27 res = 33
+.........value= 39 res = 47
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 10
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 3 res = 3
+.........value= 95 res = 95
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 16
+.........value= 10 res = a
+.........value= 27 res = 1b
+.........value= 39 res = 27
+.........value= 3 res = 3
+.........value= 95 res = 5f
+.........value= 10 res = a
+.........value= 27 res = 1b
+.........value= 39 res = 27
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+......to base is 36
+.........value= 10 res = a
+.........value= 27 res = r
+.........value= 39 res = 13
+.........value= 3 res = 3
+.........value= 95 res = 2n
+.........value= 10 res = a
+.........value= 27 res = r
+.........value= 39 res = 13
+.........value= 5F res = 5
+.........value= 3XYZ res = 3
+
+...from base is 16
+......to base is 2
+.........value= 10 res = 10000
+.........value= 27 res = 100111
+.........value= 39 res = 111001
+.........value= 3 res = 11
+.........value= 95 res = 10010101
+.........value= 10 res = 10000
+.........value= 27 res = 100111
+.........value= 39 res = 111001
+.........value= 5F res = 1011111
+.........value= 3XYZ res = 11
+......to base is 8
+.........value= 10 res = 20
+.........value= 27 res = 47
+.........value= 39 res = 71
+.........value= 3 res = 3
+.........value= 95 res = 225
+.........value= 10 res = 20
+.........value= 27 res = 47
+.........value= 39 res = 71
+.........value= 5F res = 137
+.........value= 3XYZ res = 3
+......to base is 10
+.........value= 10 res = 16
+.........value= 27 res = 39
+.........value= 39 res = 57
+.........value= 3 res = 3
+.........value= 95 res = 149
+.........value= 10 res = 16
+.........value= 27 res = 39
+.........value= 39 res = 57
+.........value= 5F res = 95
+.........value= 3XYZ res = 3
+......to base is 16
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 3 res = 3
+.........value= 95 res = 95
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 5F res = 5f
+.........value= 3XYZ res = 3
+......to base is 36
+.........value= 10 res = g
+.........value= 27 res = 13
+.........value= 39 res = 1l
+.........value= 3 res = 3
+.........value= 95 res = 45
+.........value= 10 res = g
+.........value= 27 res = 13
+.........value= 39 res = 1l
+.........value= 5F res = 2n
+.........value= 3XYZ res = 3
+
+...from base is 36
+......to base is 2
+.........value= 10 res = 100100
+.........value= 27 res = 1001111
+.........value= 39 res = 1110101
+.........value= 3 res = 11
+.........value= 95 res = 101001001
+.........value= 10 res = 100100
+.........value= 27 res = 1001111
+.........value= 39 res = 1110101
+.........value= 5F res = 11000011
+.........value= 3XYZ res = 101100111010111011
+......to base is 8
+.........value= 10 res = 44
+.........value= 27 res = 117
+.........value= 39 res = 165
+.........value= 3 res = 3
+.........value= 95 res = 511
+.........value= 10 res = 44
+.........value= 27 res = 117
+.........value= 39 res = 165
+.........value= 5F res = 303
+.........value= 3XYZ res = 547273
+......to base is 10
+.........value= 10 res = 36
+.........value= 27 res = 79
+.........value= 39 res = 117
+.........value= 3 res = 3
+.........value= 95 res = 329
+.........value= 10 res = 36
+.........value= 27 res = 79
+.........value= 39 res = 117
+.........value= 5F res = 195
+.........value= 3XYZ res = 183995
+......to base is 16
+.........value= 10 res = 24
+.........value= 27 res = 4f
+.........value= 39 res = 75
+.........value= 3 res = 3
+.........value= 95 res = 149
+.........value= 10 res = 24
+.........value= 27 res = 4f
+.........value= 39 res = 75
+.........value= 5F res = c3
+.........value= 3XYZ res = 2cebb
+......to base is 36
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 3 res = 3
+.........value= 95 res = 95
+.........value= 10 res = 10
+.........value= 27 res = 27
+.........value= 39 res = 39
+.........value= 5F res = 5f
+.........value= 3XYZ res = 3xyz \ No newline at end of file
diff --git a/ext/standard/tests/math/base_convert_error.phpt b/ext/standard/tests/math/base_convert_error.phpt
new file mode 100644
index 0000000..4e35a81
--- /dev/null
+++ b/ext/standard/tests/math/base_convert_error.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test base_convert() function : error conditions - incorrect input
+--FILE--
+<?php
+/* Prototype : string base_convert ( string $number , int $frombase , int $tobase )
+ * Description: Convert a number between arbitrary bases.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing base_convert() : error conditions ***\n";
+
+// get a class
+class classA
+{
+}
+
+echo "Incorrect number of arguments\n";
+base_convert();
+base_convert(35);
+base_convert(35,2);
+base_convert(1234, 1, 10);
+base_convert(1234, 10, 37);
+
+echo "Incorrect input\n";
+base_convert(new classA(), 8, 10);
+
+?>
+--EXPECTF--
+*** Testing base_convert() : error conditions ***
+Incorrect number of arguments
+
+Warning: base_convert() expects exactly 3 parameters, 0 given in %s on line %d
+
+Warning: base_convert() expects exactly 3 parameters, 1 given in %s on line %d
+
+Warning: base_convert() expects exactly 3 parameters, 2 given in %s on line %d
+
+Warning: base_convert(): Invalid `from base' (1) in %s on line %d
+
+Warning: base_convert(): Invalid `to base' (37) in %s on line %s
+Incorrect input
+
+Catchable fatal error: Object of class classA could not be converted to string in %s on line %d \ No newline at end of file
diff --git a/ext/standard/tests/math/base_convert_variation1.phpt b/ext/standard/tests/math/base_convert_variation1.phpt
new file mode 100644
index 0000000..afa0c5b
--- /dev/null
+++ b/ext/standard/tests/math/base_convert_variation1.phpt
@@ -0,0 +1,159 @@
+--TEST--
+Test base_convert() function : usage variations - different data types as $number argument
+--FILE--
+<?php
+/* Prototype : string base_convert ( string $number , int $frombase , int $tobase )
+ * Description: Convert a number between arbitrary bases.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing base_convert() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12,
+ -12,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 1.234567e2,
+ 1.234567E-2,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+
+ // resource variable
+/*25*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of base_convert()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(base_convert($input, 10, 8));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing base_convert() : usage variations ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+
+-- Iteration 3 --
+string(2) "14"
+
+-- Iteration 4 --
+string(2) "14"
+
+-- Iteration 5 --
+string(11) "17777777777"
+
+-- Iteration 6 --
+string(3) "151"
+
+-- Iteration 7 --
+string(3) "151"
+
+-- Iteration 8 --
+string(7) "4553207"
+
+-- Iteration 9 --
+string(7) "4553207"
+
+-- Iteration 10 --
+string(1) "5"
+
+-- Iteration 11 --
+string(1) "0"
+
+-- Iteration 12 --
+string(1) "0"
+
+-- Iteration 13 --
+string(1) "1"
+
+-- Iteration 14 --
+string(1) "0"
+
+-- Iteration 15 --
+string(1) "1"
+
+-- Iteration 16 --
+string(1) "0"
+
+-- Iteration 17 --
+string(1) "0"
+
+-- Iteration 18 --
+string(1) "0"
+
+-- Iteration 19 --
+
+Notice: Array to string conversion in %s on line %d
+string(1) "0"
+
+-- Iteration 20 --
+string(1) "0"
+
+-- Iteration 21 --
+string(1) "0"
+
+-- Iteration 22 --
+string(1) "0"
+
+-- Iteration 23 --
+string(1) "0"
+
+-- Iteration 24 --
+string(1) "0"
+
+-- Iteration 25 --
+string(%d) "%d"
+===Done===
diff --git a/ext/standard/tests/math/base_convert_variation2.phpt b/ext/standard/tests/math/base_convert_variation2.phpt
new file mode 100644
index 0000000..bc02584
--- /dev/null
+++ b/ext/standard/tests/math/base_convert_variation2.phpt
@@ -0,0 +1,193 @@
+--TEST--
+Test base_convert() function : usage variations - different data types as $frombase argument
+--FILE--
+<?php
+/* Prototype : string base_convert ( string $number , int $frombase , int $tobase )
+ * Description: Convert a number between arbitrary bases.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing base_convert() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ -1,
+ -12,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 1.234567e2,
+ 1.234567E-2,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behaviour of base_convert()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(base_convert(25, $input, 8));
+ $iterator++;
+};
+?>
+===Done===
+--EXPECTF--
+*** Testing base_convert() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: base_convert(): Invalid `from base' (1) in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: base_convert(): Invalid `from base' (-1) in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: base_convert(): Invalid `from base' (-12) in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: base_convert(): Invalid `from base' (2147483647) in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+string(2) "31"
+
+-- Iteration 7 --
+
+Warning: base_convert(): Invalid `from base' (-10) in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: base_convert(): Invalid `from base' (123) in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: base_convert(): Invalid `from base' (1) in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: base_convert(): Invalid `from base' (1) in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: base_convert() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: base_convert() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: base_convert() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: base_convert() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: base_convert() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: base_convert() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: base_convert(): Invalid `from base' (0) in %s on line %d
+bool(false)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/base_convert_variation3.phpt b/ext/standard/tests/math/base_convert_variation3.phpt
new file mode 100644
index 0000000..039d271
--- /dev/null
+++ b/ext/standard/tests/math/base_convert_variation3.phpt
@@ -0,0 +1,193 @@
+--TEST--
+Test base_convert() function : usage variations - different data types as $tobase argument
+--FILE--
+<?php
+/* Prototype : string base_convert ( string $number , int $frombase , int $tobase )
+ * Description: Convert a number between arbitrary bases.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing base_convert() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ -1,
+ -12,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 1.234567e2,
+ 1.234567E-2,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*23*/ @$undefined_var,
+
+ // unset data
+/*24*/ @$unset_var,
+);
+
+// loop through each element of $inputs to check the behaviour of base_convert()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(base_convert(25, 10, $input));
+ $iterator++;
+};
+?>
+===Done===
+--EXPECTF--
+*** Testing base_convert() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+
+Warning: base_convert(): Invalid `to base' (1) in %s on line %d
+bool(false)
+
+-- Iteration 3 --
+
+Warning: base_convert(): Invalid `to base' (-1) in %s on line %d
+bool(false)
+
+-- Iteration 4 --
+
+Warning: base_convert(): Invalid `to base' (-12) in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+
+Warning: base_convert(): Invalid `to base' (2147483647) in %s on line %d
+bool(false)
+
+-- Iteration 6 --
+string(2) "25"
+
+-- Iteration 7 --
+
+Warning: base_convert(): Invalid `to base' (-10) in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+
+Warning: base_convert(): Invalid `to base' (123) in %s on line %d
+bool(false)
+
+-- Iteration 9 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 10 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 11 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+
+Warning: base_convert(): Invalid `to base' (1) in %s on line %d
+bool(false)
+
+-- Iteration 14 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+
+Warning: base_convert(): Invalid `to base' (1) in %s on line %d
+bool(false)
+
+-- Iteration 16 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: base_convert() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: base_convert() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: base_convert() expects parameter 3 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: base_convert() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: base_convert() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: base_convert() expects parameter 3 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+
+-- Iteration 24 --
+
+Warning: base_convert(): Invalid `to base' (0) in %s on line %d
+bool(false)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/bindec_basic.phpt b/ext/standard/tests/math/bindec_basic.phpt
new file mode 100644
index 0000000..9fcca4a
--- /dev/null
+++ b/ext/standard/tests/math/bindec_basic.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test bindec() - basic function test bindec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+$values = array(111000111,
+ 011100000,
+ 1111111111111111111111111111111,
+ 10000000000000000000000000000000,
+ 100002001,
+ '111000111',
+ '011100000',
+ '1111111111111111111111111111111',
+ '10000000000000000000000000000000',
+ '100002001',
+ 'abcdefg',
+ 311015,
+ 31101.3,
+ 31.1013e5,
+ 0x111ABC,
+ 011237,
+ true,
+ false,
+ null);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = bindec($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+int(455)
+int(0)
+int(32766)
+int(5)
+int(129)
+int(455)
+int(224)
+int(2147483647)
+float(2147483648)
+int(129)
+int(0)
+int(13)
+int(13)
+int(26)
+int(6)
+int(0)
+int(1)
+int(0)
+int(0)
diff --git a/ext/standard/tests/math/bindec_basic_64bit.phpt b/ext/standard/tests/math/bindec_basic_64bit.phpt
new file mode 100644
index 0000000..949c19e
--- /dev/null
+++ b/ext/standard/tests/math/bindec_basic_64bit.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test bindec() - basic function test bindec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--INI--
+precision=14
+--FILE--
+<?php
+$values = array(111000111,
+ 011100000,
+ 1111111111111111111111111111111,
+ 10000000000000000000000000000000,
+ 100002001,
+ '111000111',
+ '011100000',
+ '1111111111111111111111111111111',
+ '10000000000000000000000000000000',
+ '100002001',
+ 'abcdefg',
+ 311015,
+ 31101.3,
+ 31.1013e5,
+ 0x111ABC,
+ 011237,
+ true,
+ false,
+ null);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = bindec($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+int(455)
+int(0)
+int(32766)
+int(5)
+int(129)
+int(455)
+int(224)
+int(2147483647)
+int(2147483648)
+int(129)
+int(0)
+int(13)
+int(13)
+int(26)
+int(6)
+int(0)
+int(1)
+int(0)
+int(0)
diff --git a/ext/standard/tests/math/bindec_basiclong_64bit.phpt b/ext/standard/tests/math/bindec_basiclong_64bit.phpt
new file mode 100644
index 0000000..3cc57d5
--- /dev/null
+++ b/ext/standard/tests/math/bindec_basiclong_64bit.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test bindec function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$binLongStrs = array(
+ '0'.str_repeat('1',63),
+ str_repeat('1',64),
+ '0'.str_repeat('1',31),
+ str_repeat('1',32),
+ '0'.str_repeat('1',64),
+ str_repeat('1',65),
+ '0'.str_repeat('1',32),
+ str_repeat('1',33)
+);
+
+
+foreach ($binLongStrs as $strVal) {
+ echo "--- testing: $strVal ---\n";
+ var_dump(bindec($strVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 0111111111111111111111111111111111111111111111111111111111111111 ---
+int(9223372036854775807)
+--- testing: 1111111111111111111111111111111111111111111111111111111111111111 ---
+float(1.844674407371E+19)
+--- testing: 01111111111111111111111111111111 ---
+int(2147483647)
+--- testing: 11111111111111111111111111111111 ---
+int(4294967295)
+--- testing: 01111111111111111111111111111111111111111111111111111111111111111 ---
+float(1.844674407371E+19)
+--- testing: 11111111111111111111111111111111111111111111111111111111111111111 ---
+float(3.6893488147419E+19)
+--- testing: 011111111111111111111111111111111 ---
+int(4294967295)
+--- testing: 111111111111111111111111111111111 ---
+int(8589934591)
+===DONE===
diff --git a/ext/standard/tests/math/bindec_error.phpt b/ext/standard/tests/math/bindec_error.phpt
new file mode 100644
index 0000000..8cf3cf7
--- /dev/null
+++ b/ext/standard/tests/math/bindec_error.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test bindec() function : error conditions - incorrect input
+--FILE--
+<?php
+/* Prototype : number bindec ( string $binary_string )
+ * Description: Returns the decimal equivalent of the binary number represented by the binary_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+/*
+ * Pass incorrect input to bindec() to test behaviour
+ */
+
+echo "*** Testing bindec() : error conditions ***\n";
+
+// get a class
+class classA
+{
+}
+
+echo "Incorrect number of arguments\n";
+bindec();
+bindec('01010101111',true);
+
+echo "Incorrect input\n";
+bindec(new classA());
+?>
+--EXPECTF--
+*** Testing bindec() : error conditions ***
+Incorrect number of arguments
+
+Warning: bindec() expects exactly 1 parameter, 0 given in %s on line %d
+
+Warning: bindec() expects exactly 1 parameter, 2 given in %s on line %d
+Incorrect input
+
+Catchable fatal error: Object of class classA could not be converted to string in %s on line %d \ No newline at end of file
diff --git a/ext/standard/tests/math/bindec_variation1.phpt b/ext/standard/tests/math/bindec_variation1.phpt
new file mode 100644
index 0000000..1e188ba
--- /dev/null
+++ b/ext/standard/tests/math/bindec_variation1.phpt
@@ -0,0 +1,158 @@
+--TEST--
+Test bindec() function : usage variations - different data types as $binary_string arg
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : number bindec ( string $binary_string )
+ * Description: Returns the decimal equivalent of the binary number represented by the binary_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing bindec() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of bindec()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(bindec($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing bindec() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+int(1)
+
+-- Iteration 4 --
+int(0)
+
+-- Iteration 5 --
+int(2)
+
+-- Iteration 6 --
+int(2)
+
+-- Iteration 7 --
+int(8)
+
+-- Iteration 8 --
+int(1)
+
+-- Iteration 9 --
+int(0)
+
+-- Iteration 10 --
+int(0)
+
+-- Iteration 11 --
+int(0)
+
+-- Iteration 12 --
+int(1)
+
+-- Iteration 13 --
+int(0)
+
+-- Iteration 14 --
+int(1)
+
+-- Iteration 15 --
+int(0)
+
+-- Iteration 16 --
+int(0)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+
+Notice: Array to string conversion in %s on line %d
+int(0)
+
+-- Iteration 19 --
+int(0)
+
+-- Iteration 20 --
+int(0)
+
+-- Iteration 21 --
+int(0)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+int(0)
+
+-- Iteration 24 --
+int(%d)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/bindec_variation1_64bit.phpt b/ext/standard/tests/math/bindec_variation1_64bit.phpt
new file mode 100644
index 0000000..0a37c4c
--- /dev/null
+++ b/ext/standard/tests/math/bindec_variation1_64bit.phpt
@@ -0,0 +1,158 @@
+--TEST--
+Test bindec() function : usage variations - different data types as $binary_string arg
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : number bindec ( string $binary_string )
+ * Description: Returns the decimal equivalent of the binary number represented by the binary_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing bindec() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*22*/ @$undefined_var,
+
+ // unset data
+/*23*/ @$unset_var,
+
+ // resource variable
+/*24*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of bindec()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(bindec($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing bindec() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+int(1)
+
+-- Iteration 4 --
+int(0)
+
+-- Iteration 5 --
+int(2)
+
+-- Iteration 6 --
+int(2)
+
+-- Iteration 7 --
+int(8)
+
+-- Iteration 8 --
+int(1)
+
+-- Iteration 9 --
+int(0)
+
+-- Iteration 10 --
+int(0)
+
+-- Iteration 11 --
+int(0)
+
+-- Iteration 12 --
+int(1)
+
+-- Iteration 13 --
+int(0)
+
+-- Iteration 14 --
+int(1)
+
+-- Iteration 15 --
+int(0)
+
+-- Iteration 16 --
+int(0)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+
+Notice: Array to string conversion in %s on line %d
+int(0)
+
+-- Iteration 19 --
+int(0)
+
+-- Iteration 20 --
+int(0)
+
+-- Iteration 21 --
+int(0)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+int(0)
+
+-- Iteration 24 --
+int(%d)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/bug21523.phpt b/ext/standard/tests/math/bug21523.phpt
new file mode 100644
index 0000000..9fc441f
--- /dev/null
+++ b/ext/standard/tests/math/bug21523.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #21523 (number_format tries to allocate negative amount of memory)
+--FILE--
+<?php // $Id$ vim600:syn=php
+set_time_limit(5);
+
+var_dump(number_format(-2000, 2768));
+echo "OK";
+?>
+--EXPECT--
+string(2775) "-2,000.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
+OK
diff --git a/ext/standard/tests/math/bug24142.phpt b/ext/standard/tests/math/bug24142.phpt
new file mode 100644
index 0000000..2449523
--- /dev/null
+++ b/ext/standard/tests/math/bug24142.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #24142 (round() problems)
+--FILE--
+<?php // $Id$ vim600:syn=php
+$v = 0.005;
+for ($i = 1; $i < 10; $i++) {
+ echo "round({$v}, 2) -> ".round($v, 2)."\n";
+ $v += 0.01;
+}
+?>
+--EXPECT--
+round(0.005, 2) -> 0.01
+round(0.015, 2) -> 0.02
+round(0.025, 2) -> 0.03
+round(0.035, 2) -> 0.04
+round(0.045, 2) -> 0.05
+round(0.055, 2) -> 0.06
+round(0.065, 2) -> 0.07
+round(0.075, 2) -> 0.08
+round(0.085, 2) -> 0.09
diff --git a/ext/standard/tests/math/bug25665.phpt b/ext/standard/tests/math/bug25665.phpt
new file mode 100644
index 0000000..469236c
--- /dev/null
+++ b/ext/standard/tests/math/bug25665.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Bug #25665 (var_dump () hangs on Nan and INF)
+--SKIPIF--
+<?php
+ $OS = strtoupper(PHP_OS);
+ if ($OS == 'SUNOS' || $OS == 'SOLARIS') die("SKIP Solaris acos() returns wrong value");
+?>
+--FILE--
+<?php
+set_time_limit(5);
+var_dump(acos(1.01));
+var_dump(log(0));
+?>
+--EXPECT--
+float(NAN)
+float(-INF)
diff --git a/ext/standard/tests/math/bug25694.phpt b/ext/standard/tests/math/bug25694.phpt
new file mode 100644
index 0000000..d40d2b8
--- /dev/null
+++ b/ext/standard/tests/math/bug25694.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Bug #25694 (round() and number_format() inconsistency)
+--INI--
+precision=14
+--FILE--
+<?php
+echo "round 0.045 = " . round(0.045, 2) . "\n";
+echo "number format 0.045 = " . number_format(0.045, 2) . "\n\n";
+echo "round 0.055 = " . round(0.055, 2) . "\n";
+echo "number format 0.055 = " . number_format(0.055, 2) . "\n\n";
+echo "round 5.045 = " . round(5.045, 2) . "\n";
+echo "number format 5.045 = " . number_format(5.045, 2) . "\n\n";
+echo "round 5.055 = " . round(5.055, 2) . "\n";
+echo "number format 5.055 = " . number_format(5.055, 2) . "\n\n";
+echo "round 3.025 = " . round(3.025, 2) . "\n";
+echo "number format 3.025 = " . number_format(3.025, 2) . "\n\n";
+echo "round 4.025 = " . round(4.025, 2) . "\n";
+echo "number format 4.025 = " . number_format(4.025, 2) . "\n\n";
+?>
+--EXPECT--
+round 0.045 = 0.05
+number format 0.045 = 0.05
+
+round 0.055 = 0.06
+number format 0.055 = 0.06
+
+round 5.045 = 5.05
+number format 5.045 = 5.05
+
+round 5.055 = 5.06
+number format 5.055 = 5.06
+
+round 3.025 = 3.03
+number format 3.025 = 3.03
+
+round 4.025 = 4.03
+number format 4.025 = 4.03
diff --git a/ext/standard/tests/math/bug27646.phpt b/ext/standard/tests/math/bug27646.phpt
new file mode 100644
index 0000000..7b4a923
--- /dev/null
+++ b/ext/standard/tests/math/bug27646.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Bug #27646 (Cannot serialize/unserialize non-finite numeric values)
+--FILE--
+<?php
+set_time_limit(5);
+
+$f=12.3;
+var_dump($f);
+var_dump(serialize($f));
+var_dump(unserialize(serialize($f)));
+
+$f=-12.3;
+var_dump($f);
+var_dump(serialize($f));
+var_dump(unserialize(serialize($f)));
+
+$f=-INF;
+var_dump($f);
+var_dump(serialize($f));
+var_dump(unserialize(serialize($f)));
+
+$f=INF;
+var_dump($f);
+var_dump(serialize($f));
+var_dump(unserialize(serialize($f)));
+
+$f=NAN;
+var_dump($f);
+var_dump(serialize($f));
+var_dump(unserialize(serialize($f)));
+
+?>
+--EXPECTF--
+float(1%f)
+string(%d) "d:1%s;"
+float(1%f)
+float(-1%f)
+string(%d) "d:-1%s;"
+float(-1%f)
+float(-INF)
+string(7) "d:-INF;"
+float(-INF)
+float(INF)
+string(6) "d:INF;"
+float(INF)
+float(NAN)
+string(6) "d:NAN;"
+float(NAN)
diff --git a/ext/standard/tests/math/bug28228.phpt b/ext/standard/tests/math/bug28228.phpt
new file mode 100644
index 0000000..4223f4b
--- /dev/null
+++ b/ext/standard/tests/math/bug28228.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #28228 (number_format() does not allow empty decimal separator)
+--FILE--
+<?php
+echo number_format(1234.5678, 4, '', '') . "\n";
+echo number_format(1234.5678, 4, NULL, ',') . "\n";
+echo number_format(1234.5678, 4, 0, ',') . "\n";
+echo number_format(1234.5678, 4);
+?>
+--EXPECT--
+12345678
+1,234.5678
+1,23405678
+1,234.5678
diff --git a/ext/standard/tests/math/bug30069.phpt b/ext/standard/tests/math/bug30069.phpt
new file mode 100644
index 0000000..5e3246c
--- /dev/null
+++ b/ext/standard/tests/math/bug30069.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #30069 (floats as strings used in calculations do not work)
+--FILE--
+<?php
+echo ".1" * "2";
+echo "\n";
+echo "-.1" * "2";
+echo "\n";
+?>
+--EXPECT--
+0.2
+-0.2
diff --git a/ext/standard/tests/math/bug30695.phpt b/ext/standard/tests/math/bug30695.phpt
new file mode 100644
index 0000000..c515784
--- /dev/null
+++ b/ext/standard/tests/math/bug30695.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Bug #30695 (32 bit issues)
+--FILE--
+<?php
+ function toUTF8( $char_code )
+ {
+ switch ( $char_code )
+ {
+ case 0:
+ $char = chr( 0 );
+ case !($char_code & 0xffffff80): // 7 bit
+ $char = chr( $char_code );
+ break;
+ case !($char_code & 0xfffff800): // 11 bit
+ $char = ( chr(0xc0 | (($char_code >> 6) & 0x1f)) .
+ chr(0x80 | ($char_code & 0x3f)) );
+ break;
+ case !($char_code & 0xffff0000): // 16 bit
+ $char = ( chr(0xe0 | (($char_code >> 12) & 0x0f)) .
+ chr(0x80 | (($char_code >> 6) & 0x3f)) .
+ chr(0x80 | ($char_code & 0x3f)) );
+ break;
+ case !($char_code & 0xffe00000): // 21 bit
+ $char = ( chr(0xf0 | (($char_code >> 18) & 0x07)) .
+ chr(0x80 | (($char_code >> 12) & 0x3f)) .
+ chr(0x80 | (($char_code >> 6) & 0x3f)) .
+ chr(0x80 | ($char_code & 0x3f)) );
+ break;
+ case !($char_code & 0xfc000000): // 26 bit
+ $char = ( chr(0xf8 | (($char_code >> 24) & 0x03)) .
+ chr(0x80 | (($char_code >> 18) & 0x3f)) .
+ chr(0x80 | (($char_code >> 12) & 0x3f)) .
+ chr(0x80 | (($char_code >> 6) & 0x3f)) .
+ chr(0x80 | ($char_code & 0x3f)) );
+ default: // 31 bit
+ $char = ( chr(0xfc | (($char_code >> 30) & 0x01)) .
+ chr(0x80 | (($char_code >> 24) & 0x3f)) .
+ chr(0x80 | (($char_code >> 18) & 0x3f)) .
+ chr(0x80 | (($char_code >> 12) & 0x3f)) .
+ chr(0x80 | (($char_code >> 6) & 0x3f)) .
+ chr(0x80 | ($char_code & 0x3f)) );
+ }
+ return $char;
+ }
+
+
+ echo "\n", toUTF8(65), "\n", toUTF8(233), "\n", toUTF8(1252), "\n", toUTF8(20095), "\n";
+?>
+--EXPECT--
+
+A
+é
+Ó¤
+乿
diff --git a/ext/standard/tests/math/bug45712.phpt b/ext/standard/tests/math/bug45712.phpt
new file mode 100644
index 0000000..e10d0e7
--- /dev/null
+++ b/ext/standard/tests/math/bug45712.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Bug #45712 (NaN/INF comparison)
+--XFAIL--
+Bug 45712 not fixed yet.
+--FILE--
+<?php
+
+// NaN
+$nan = acos(1.01);
+var_dump($nan);
+var_dump(is_nan($nan));
+//
+var_dump($nan=='');
+var_dump($nan==0.5);
+var_dump($nan==50);
+var_dump($nan=='500');
+var_dump($nan=='abc');
+var_dump($nan==$nan);
+//
+var_dump($nan==='');
+var_dump($nan===0.5);
+var_dump($nan===50);
+var_dump($nan==='500');
+var_dump($nan==='abc');
+var_dump($nan===$nan);
+
+// INF
+$inf = pow(0,-2);
+var_dump($inf);
+var_dump(is_infinite($inf));
+//
+var_dump($inf=='');
+var_dump($inf==0.5);
+var_dump($inf==50);
+var_dump($inf=='500');
+var_dump($inf=='abc');
+var_dump($inf==$inf);
+//
+var_dump($inf==='');
+var_dump($inf===0.5);
+var_dump($inf===50);
+var_dump($inf==='500');
+var_dump($inf==='abc');
+var_dump($inf===$inf);
+
+?>
+--EXPECT--
+float(NAN)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+float(INF)
+bool(true)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
diff --git a/ext/standard/tests/math/bug62112.phpt b/ext/standard/tests/math/bug62112.phpt
new file mode 100644
index 0000000..01de35a
--- /dev/null
+++ b/ext/standard/tests/math/bug62112.phpt
Binary files differ
diff --git a/ext/standard/tests/math/ceil_basic.phpt b/ext/standard/tests/math/ceil_basic.phpt
new file mode 100644
index 0000000..6794605
--- /dev/null
+++ b/ext/standard/tests/math/ceil_basic.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Test ceil() - basic function test for ceil()
+--INI--
+precision=14
+--SKIPIF--
+if (strtolower(PHP_OS) == 'darwin') {
+ die('SKIP OSX does weird things with -0 so this test doesn't work there');
+}
+--FILE--
+<?php
+/* Prototype : float ceil ( float $value )
+ * Description: Round fractions up.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing ceil() : basic functionality ***\n";
+$values = array(0,
+ -0,
+ 0.5,
+ -0.5,
+ 1,
+ -1,
+ 1.5,
+ -1.5,
+ 2.6,
+ -2.6,
+ 037,
+ 0x5F,
+ "10.5",
+ "-10.5",
+ "3.95E3",
+ "-3.95E3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = ceil($values[$i]);
+ var_dump($res);
+}
+
+?>
+===Done===
+--EXPECTF--
+*** Testing ceil() : basic functionality ***
+float(0)
+float(0)
+float(1)
+float(-0)
+float(1)
+float(-1)
+float(2)
+float(-1)
+float(3)
+float(-2)
+float(31)
+float(95)
+float(11)
+float(-10)
+float(3950)
+float(-3950)
+float(39)
+float(95)
+float(1)
+float(0)
+float(0)
+===Done===
diff --git a/ext/standard/tests/math/ceil_basiclong_64bit.phpt b/ext/standard/tests/math/ceil_basiclong_64bit.phpt
new file mode 100644
index 0000000..b4c23d8
--- /dev/null
+++ b/ext/standard/tests/math/ceil_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test ceil function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(ceil($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808 ---
+float(-9.2233720368548E+18)
+--- testing: 2147483647 ---
+float(2147483647)
+--- testing: -2147483648 ---
+float(-2147483648)
+--- testing: 9223372034707292160 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160 ---
+float(-9.2233720347073E+18)
+--- testing: 2147483648 ---
+float(2147483648)
+--- testing: -2147483649 ---
+float(-2147483649)
+--- testing: 4294967294 ---
+float(4294967294)
+--- testing: 4294967295 ---
+float(4294967295)
+--- testing: 4294967293 ---
+float(4294967293)
+--- testing: 9223372036854775806 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807 ---
+float(-9.2233720368548E+18)
+--- testing: -9.2233720368548E+18 ---
+float(-9.2233720368548E+18)
+===DONE===
diff --git a/ext/standard/tests/math/ceil_error.phpt b/ext/standard/tests/math/ceil_error.phpt
new file mode 100644
index 0000000..1cf7ce4
--- /dev/null
+++ b/ext/standard/tests/math/ceil_error.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test ceil() - error conditions - incorrect number of args
+--FILE--
+<?php
+/* Prototype : float ceil ( float $value )
+ * Description: Round fractions up.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing ceil() : error conditions ***\n";
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(ceil($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(ceil());
+?>
+===Done===
+--EXPECTF--
+*** Testing ceil() : error conditions ***
+
+Too many arguments
+
+Warning: ceil() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: ceil() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/ceil_variation1.phpt b/ext/standard/tests/math/ceil_variation1.phpt
new file mode 100644
index 0000000..7c1f859
--- /dev/null
+++ b/ext/standard/tests/math/ceil_variation1.phpt
@@ -0,0 +1,128 @@
+--TEST--
+Test ceil() function : usage variations - different data types as $value arg
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float ceil ( float $value )
+ * Description: Round fractions up.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing ceil() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $value argument
+$inputs = array(
+ // null data
+/* 1*/ NULL,
+ null,
+
+ // boolean data
+/* 3*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/* 7*/ "",
+ '',
+ array(),
+
+ // string data
+/*10*/ "abcxyz",
+ 'abcxyz}',
+ $heredoc,
+
+ // object data
+/*13*/ new classA(),
+
+ // undefined data
+/*14*/ @$undefined_var,
+
+ // unset data
+/*15*/ @$unset_var,
+
+ // resource variable
+/*16*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of ceil()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(ceil($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing ceil() : usage variations ***
+
+-- Iteration 1 --
+float(0)
+
+-- Iteration 2 --
+float(0)
+
+-- Iteration 3 --
+float(1)
+
+-- Iteration 4 --
+float(0)
+
+-- Iteration 5 --
+float(1)
+
+-- Iteration 6 --
+float(0)
+
+-- Iteration 7 --
+float(0)
+
+-- Iteration 8 --
+float(0)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+float(0)
+
+-- Iteration 11 --
+float(0)
+
+-- Iteration 12 --
+float(0)
+
+-- Iteration 13 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+float(1)
+
+-- Iteration 14 --
+float(0)
+
+-- Iteration 15 --
+float(0)
+
+-- Iteration 16 --
+float(%d)
+===Done===
diff --git a/ext/standard/tests/math/constants.phpt b/ext/standard/tests/math/constants.phpt
new file mode 100644
index 0000000..deeb785
--- /dev/null
+++ b/ext/standard/tests/math/constants.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Math constants
+--INI--
+precision=14
+--FILE--
+<?php
+$constants = array(
+ "M_E",
+ "M_LOG2E",
+ "M_LOG10E",
+ "M_LN2",
+ "M_LN10",
+ "M_PI",
+ "M_PI_2",
+ "M_PI_4",
+ "M_1_PI",
+ "M_2_PI",
+ "M_SQRTPI",
+ "M_2_SQRTPI",
+ "M_LNPI",
+ "M_EULER",
+ "M_SQRT2",
+ "M_SQRT1_2",
+ "M_SQRT3"
+);
+foreach($constants as $constant) {
+ printf("%-10s: %s\n", $constant, constant($constant));
+}
+?>
+--EXPECTREGEX--
+M_E : 2.718281[0-9]*
+M_LOG2E : 1.442695[0-9]*
+M_LOG10E : 0.434294[0-9]*
+M_LN2 : 0.693147[0-9]*
+M_LN10 : 2.302585[0-9]*
+M_PI : 3.141592[0-9]*
+M_PI_2 : 1.570796[0-9]*
+M_PI_4 : 0.785398[0-9]*
+M_1_PI : 0.318309[0-9]*
+M_2_PI : 0.636619[0-9]*
+M_SQRTPI : 1.772453[0-9]*
+M_2_SQRTPI: 1.128379[0-9]*
+M_LNPI : 1.144729[0-9]*
+M_EULER : 0.577215[0-9]*
+M_SQRT2 : 1.414213[0-9]*
+M_SQRT1_2 : 0.707106[0-9]*
+M_SQRT3 : 1.732050[0-9]*
+
diff --git a/ext/standard/tests/math/constants_basic.phpt b/ext/standard/tests/math/constants_basic.phpt
new file mode 100644
index 0000000..0220d93
--- /dev/null
+++ b/ext/standard/tests/math/constants_basic.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test for pre-defined math constants
+--INI--
+precision=14
+--FILE--
+<?php
+echo "M_E= ";
+var_dump(M_E);
+echo "M_LOG2E= ";
+var_dump(M_LOG2E);
+echo "M_LOG10E= ";
+var_dump(M_LOG10E);
+echo "M_LN2= ";
+var_dump(M_LN2);
+echo "M_LN10= ";
+var_dump(M_LN10);
+echo "M_PI= ";
+var_dump(M_PI);
+echo "M_PI_2= ";
+var_dump(M_PI_2);
+echo "M_PI_4= ";
+var_dump(M_PI_4);
+echo "M_1_PI= ";
+var_dump(M_1_PI);
+echo "M_2_PI= ";
+var_dump(M_2_PI);
+echo "M_SQRTPI= ";
+var_dump(M_SQRTPI);
+echo "M_2_SQRTPI= ";
+var_dump(M_2_SQRTPI);
+echo "M_LNPI= ";
+var_dump(M_LNPI);
+echo "M_EULER= ";
+var_dump(M_EULER);
+echo "M_SQRT2= ";
+var_dump(M_SQRT2);
+echo "M_SQRT1_2= ";
+var_dump(M_SQRT1_2);
+echo "M_SQRT3= ";
+var_dump(M_SQRT3);
+echo "INF= ";
+var_dump(INF);
+echo "NAN= ";
+var_dump(NAN);
+?>
+--EXPECT--
+M_E= float(2.718281828459)
+M_LOG2E= float(1.442695040889)
+M_LOG10E= float(0.43429448190325)
+M_LN2= float(0.69314718055995)
+M_LN10= float(2.302585092994)
+M_PI= float(3.1415926535898)
+M_PI_2= float(1.5707963267949)
+M_PI_4= float(0.78539816339745)
+M_1_PI= float(0.31830988618379)
+M_2_PI= float(0.63661977236758)
+M_SQRTPI= float(1.7724538509055)
+M_2_SQRTPI= float(1.1283791670955)
+M_LNPI= float(1.1447298858494)
+M_EULER= float(0.57721566490153)
+M_SQRT2= float(1.4142135623731)
+M_SQRT1_2= float(0.70710678118655)
+M_SQRT3= float(1.7320508075689)
+INF= float(INF)
+NAN= float(NAN)
diff --git a/ext/standard/tests/math/cos_basic.phpt b/ext/standard/tests/math/cos_basic.phpt
new file mode 100644
index 0000000..f0cfa66
--- /dev/null
+++ b/ext/standard/tests/math/cos_basic.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test return type and value for expected input cos()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float cos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+
+// Use known values to test
+
+$sixty = M_PI / 3.0;
+$thirty = M_PI / 6.0;
+$ninety = M_PI /2.0;
+$oneeighty = M_PI;
+$twoseventy = M_PI * 1.5;
+$threesixty = M_PI * 2.0;
+
+
+echo "cos 30 = ";
+var_dump(cos($thirty));
+if (allowed_rounding_error(cos($thirty),0.86602540378444)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cos 60 = ";
+var_dump(cos($sixty));
+if (allowed_rounding_error(cos($sixty),0.5)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cos 90 = ";
+var_dump(cos($ninety));
+if (allowed_rounding_error(cos($ninety),0.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cos 180 = ";
+var_dump(cos($oneeighty));
+if (allowed_rounding_error(cos($oneeighty),-1.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cos 270 = ";
+var_dump(cos($twoseventy));
+if (allowed_rounding_error(cos($twoseventy),0.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cos 360 = ";
+var_dump(cos($threesixty));
+if (allowed_rounding_error(cos($threesixty),1.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+?>
+--EXPECTF--
+cos 30 = float(%f)
+Pass
+cos 60 = float(%f)
+Pass
+cos 90 = float(%f)
+Pass
+cos 180 = float(%f)
+Pass
+cos 270 = float(%f)
+Pass
+cos 360 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/cos_basiclong_64bit.phpt b/ext/standard/tests/math/cos_basiclong_64bit.phpt
new file mode 100644
index 0000000..c9f0417
--- /dev/null
+++ b/ext/standard/tests/math/cos_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test cos function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(cos($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(0.0118000765128)
+--- testing: -9223372036854775808 ---
+float(0.0118000765128)
+--- testing: 2147483647 ---
+float(-0.68883669187794)
+--- testing: -2147483648 ---
+float(0.2378161945728)
+--- testing: 9223372034707292160 ---
+float(-0.96843630065544)
+--- testing: -9223372034707292160 ---
+float(-0.96843630065544)
+--- testing: 2147483648 ---
+float(0.2378161945728)
+--- testing: -2147483649 ---
+float(0.94582196847889)
+--- testing: 4294967294 ---
+float(-0.051008023845301)
+--- testing: 4294967295 ---
+float(-0.8679353473572)
+--- testing: 4294967293 ---
+float(0.81281584155442)
+--- testing: 9223372036854775806 ---
+float(0.0118000765128)
+--- testing: 9.2233720368548E+18 ---
+float(0.0118000765128)
+--- testing: -9223372036854775807 ---
+float(0.0118000765128)
+--- testing: -9.2233720368548E+18 ---
+float(0.0118000765128)
+===DONE===
diff --git a/ext/standard/tests/math/cos_error.phpt b/ext/standard/tests/math/cos_error.phpt
new file mode 100644
index 0000000..4090199
--- /dev/null
+++ b/ext/standard/tests/math/cos_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for cos()
+--FILE--
+<?php
+/*
+ * proto float cos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(cos($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(cos());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: cos() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: cos() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/cos_variation.phpt b/ext/standard/tests/math/cos_variation.phpt
new file mode 100644
index 0000000..cb45f3e
--- /dev/null
+++ b/ext/standard/tests/math/cos_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of cos()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float cos(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test cos with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = cos($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(-0.5328330203)
+float(-0.5328330203)
+float(-0.1117112391)
+float(-0.1117112391)
+float(-0.5328330203)
+float(-0.5328330203)
+float(-0.5328330203)
+float(-0.1117112391)
+float(-0.1117112391)
+
+Warning: cos() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(0.5623790763)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(0.5623790763)
+float(1)
+float(0.5403023059)
+float(1)
diff --git a/ext/standard/tests/math/cosh_basic.phpt b/ext/standard/tests/math/cosh_basic.phpt
new file mode 100644
index 0000000..0a637ca
--- /dev/null
+++ b/ext/standard/tests/math/cosh_basic.phpt
@@ -0,0 +1,61 @@
+--TEST--
+Test return type and value for expected input cosh()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float cosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "cosh .5 = ";
+var_dump(cosh(0.5));
+
+if (allowed_rounding_error(cosh(0.5),1.1276259652064)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cosh -0.5 = ";
+var_dump(cosh(-0.5));
+if (allowed_rounding_error(cosh(-0.5),1.1276259652064)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cosh 3 = ";
+var_dump(cosh(3.0));
+if (allowed_rounding_error(cosh(3.0), 10.067661995778)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "cosh -3 = ";
+var_dump(cosh(-3.0));
+if (allowed_rounding_error(cosh(-3.0), 10.067661995778)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+cosh .5 = float(%f)
+Pass
+cosh -0.5 = float(%f)
+Pass
+cosh 3 = float(%f)
+Pass
+cosh -3 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/cosh_basiclong_64bit.phpt b/ext/standard/tests/math/cosh_basiclong_64bit.phpt
new file mode 100644
index 0000000..0916839
--- /dev/null
+++ b/ext/standard/tests/math/cosh_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test cosh function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(cosh($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(INF)
+--- testing: -9223372036854775808 ---
+float(INF)
+--- testing: 2147483647 ---
+float(INF)
+--- testing: -2147483648 ---
+float(INF)
+--- testing: 9223372034707292160 ---
+float(INF)
+--- testing: -9223372034707292160 ---
+float(INF)
+--- testing: 2147483648 ---
+float(INF)
+--- testing: -2147483649 ---
+float(INF)
+--- testing: 4294967294 ---
+float(INF)
+--- testing: 4294967295 ---
+float(INF)
+--- testing: 4294967293 ---
+float(INF)
+--- testing: 9223372036854775806 ---
+float(INF)
+--- testing: 9.2233720368548E+18 ---
+float(INF)
+--- testing: -9223372036854775807 ---
+float(INF)
+--- testing: -9.2233720368548E+18 ---
+float(INF)
+===DONE===
diff --git a/ext/standard/tests/math/cosh_error.phpt b/ext/standard/tests/math/cosh_error.phpt
new file mode 100644
index 0000000..afed24f
--- /dev/null
+++ b/ext/standard/tests/math/cosh_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for cosh()
+--FILE--
+<?php
+/*
+ * proto float cosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(cosh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(cosh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: cosh() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: cosh() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/cosh_variation.phpt b/ext/standard/tests/math/cosh_variation.phpt
new file mode 100644
index 0000000..c702fa3
--- /dev/null
+++ b/ext/standard/tests/math/cosh_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of cosh()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float cosh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test cosh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = cosh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(4872401723)
+float(4872401723)
+float(7641446995)
+float(7641446995)
+float(4872401723)
+float(4872401723)
+float(4872401723)
+float(7641446995)
+float(7641446995)
+
+Warning: cosh() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(INF)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(INF)
+float(1)
+float(1.543080635)
+float(1)
diff --git a/ext/standard/tests/math/decbin_basic.phpt b/ext/standard/tests/math/decbin_basic.phpt
new file mode 100644
index 0000000..e6fc5dc
--- /dev/null
+++ b/ext/standard/tests/math/decbin_basic.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test decbin() - basic function test
+--FILE--
+<?php
+$values = array(10,
+ 3950.5,
+ 3.9505e3,
+ 039,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = decbin($values[$i]);
+ var_dump($res);
+}
+?>
+
+--EXPECTF--
+string(4) "1010"
+string(12) "111101101110"
+string(12) "111101101110"
+string(2) "11"
+string(7) "1011111"
+string(4) "1010"
+string(12) "111101101110"
+string(2) "11"
+string(6) "100111"
+string(1) "0"
+string(1) "1"
+string(1) "0"
+string(1) "0" \ No newline at end of file
diff --git a/ext/standard/tests/math/decbin_basiclong_64bit.phpt b/ext/standard/tests/math/decbin_basiclong_64bit.phpt
new file mode 100644
index 0000000..3dc61c4
--- /dev/null
+++ b/ext/standard/tests/math/decbin_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test decbin function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(decbin($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+string(63) "111111111111111111111111111111111111111111111111111111111111111"
+--- testing: -9223372036854775808 ---
+string(64) "1000000000000000000000000000000000000000000000000000000000000000"
+--- testing: 2147483647 ---
+string(31) "1111111111111111111111111111111"
+--- testing: -2147483648 ---
+string(64) "1111111111111111111111111111111110000000000000000000000000000000"
+--- testing: 9223372034707292160 ---
+string(63) "111111111111111111111111111111110000000000000000000000000000000"
+--- testing: -9223372034707292160 ---
+string(64) "1000000000000000000000000000000010000000000000000000000000000000"
+--- testing: 2147483648 ---
+string(32) "10000000000000000000000000000000"
+--- testing: -2147483649 ---
+string(64) "1111111111111111111111111111111101111111111111111111111111111111"
+--- testing: 4294967294 ---
+string(32) "11111111111111111111111111111110"
+--- testing: 4294967295 ---
+string(32) "11111111111111111111111111111111"
+--- testing: 4294967293 ---
+string(32) "11111111111111111111111111111101"
+--- testing: 9223372036854775806 ---
+string(63) "111111111111111111111111111111111111111111111111111111111111110"
+--- testing: 9.2233720368548E+18 ---
+string(64) "1000000000000000000000000000000000000000000000000000000000000000"
+--- testing: -9223372036854775807 ---
+string(64) "1000000000000000000000000000000000000000000000000000000000000001"
+--- testing: -9.2233720368548E+18 ---
+string(64) "1000000000000000000000000000000000000000000000000000000000000000"
+===DONE===
diff --git a/ext/standard/tests/math/decbin_error.phpt b/ext/standard/tests/math/decbin_error.phpt
new file mode 100644
index 0000000..fcfd187
--- /dev/null
+++ b/ext/standard/tests/math/decbin_error.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test expm1() - Error conditions
+--INI--
+precision=14
+--SKIPIF--
+<?php
+ function_exists('expm1') or die('skip expm1() is not supported in this build.');
+?>
+--FILE--
+<?php
+/* Prototype : float expm1 ( float $arg )
+ * Description: Returns exp(number) - 1, computed in a way that is accurate even
+ * when the value of number is close to zero.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing expm1() : error conditions ***\n";
+
+echo "\n-- Testing expm1() function with less than expected no. of arguments --\n";
+expm1();
+echo "\n-- Testing expm1() function with more than expected no. of arguments --\n";
+expm1(23,true);
+
+?>
+===Done===
+--EXPECTF--
+*** Testing expm1() : error conditions ***
+
+-- Testing expm1() function with less than expected no. of arguments --
+
+Warning: expm1() expects exactly 1 parameter, 0 given in %s on line %d
+
+-- Testing expm1() function with more than expected no. of arguments --
+
+Warning: expm1() expects exactly 1 parameter, 2 given in %s on line %d
+===Done===
+
diff --git a/ext/standard/tests/math/decbin_variation1.phpt b/ext/standard/tests/math/decbin_variation1.phpt
new file mode 100644
index 0000000..b357c27
--- /dev/null
+++ b/ext/standard/tests/math/decbin_variation1.phpt
@@ -0,0 +1,179 @@
+--TEST--
+Test decbin() function : usage variations - different data types as $number arg
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string decbin ( int $number )
+ * Description: Decimal to binary.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing decbin() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 4294967295, // largest decimal
+ 4294967296,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*24*/ new classA(),
+
+ // undefined data
+/*25*/ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+
+ // resource variable
+/*27*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of decbin()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(decbin($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing decbin() : usage variations ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+
+-- Iteration 3 --
+string(14) "11000000111001"
+
+-- Iteration 4 --
+string(32) "11111111111111111111011011010111"
+
+-- Iteration 5 --
+string(32) "11111111111111111111111111111111"
+
+-- Iteration 6 --
+string(1) "0"
+
+-- Iteration 7 --
+string(4) "1010"
+
+-- Iteration 8 --
+string(32) "11111111111111111111111111110110"
+
+-- Iteration 9 --
+string(32) "10111110100110010001101000001000"
+
+-- Iteration 10 --
+string(1) "0"
+
+-- Iteration 11 --
+string(1) "0"
+
+-- Iteration 12 --
+string(1) "0"
+
+-- Iteration 13 --
+string(1) "0"
+
+-- Iteration 14 --
+string(1) "1"
+
+-- Iteration 15 --
+string(1) "0"
+
+-- Iteration 16 --
+string(1) "1"
+
+-- Iteration 17 --
+string(1) "0"
+
+-- Iteration 18 --
+string(1) "0"
+
+-- Iteration 19 --
+string(1) "0"
+
+-- Iteration 20 --
+string(1) "0"
+
+-- Iteration 21 --
+string(1) "0"
+
+-- Iteration 22 --
+string(1) "0"
+
+-- Iteration 23 --
+string(1) "0"
+
+-- Iteration 24 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+string(1) "1"
+
+-- Iteration 25 --
+string(1) "0"
+
+-- Iteration 26 --
+string(1) "0"
+
+-- Iteration 27 --
+string(%d) "%d"
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/decbin_variation1_64bit.phpt b/ext/standard/tests/math/decbin_variation1_64bit.phpt
new file mode 100644
index 0000000..e82ee3e
--- /dev/null
+++ b/ext/standard/tests/math/decbin_variation1_64bit.phpt
@@ -0,0 +1,179 @@
+--TEST--
+Test decbin() function : usage variations - different data types as $number arg
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string decbin ( int $number )
+ * Description: Decimal to binary.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing decbin() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 18446744073709551615, // largest decimal
+ 18446744073709551616,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*24*/ new classA(),
+
+ // undefined data
+/*25*/ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+
+ // resource variable
+/*27*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of decbin()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(decbin($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing decbin() : usage variations ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+
+-- Iteration 3 --
+string(14) "11000000111001"
+
+-- Iteration 4 --
+string(64) "1111111111111111111111111111111111111111111111111111011011010111"
+
+-- Iteration 5 --
+string(1) "0"
+
+-- Iteration 6 --
+string(1) "0"
+
+-- Iteration 7 --
+string(4) "1010"
+
+-- Iteration 8 --
+string(64) "1111111111111111111111111111111111111111111111111111111111110110"
+
+-- Iteration 9 --
+string(37) "1110010111110100110010001101000001000"
+
+-- Iteration 10 --
+string(1) "0"
+
+-- Iteration 11 --
+string(1) "0"
+
+-- Iteration 12 --
+string(1) "0"
+
+-- Iteration 13 --
+string(1) "0"
+
+-- Iteration 14 --
+string(1) "1"
+
+-- Iteration 15 --
+string(1) "0"
+
+-- Iteration 16 --
+string(1) "1"
+
+-- Iteration 17 --
+string(1) "0"
+
+-- Iteration 18 --
+string(1) "0"
+
+-- Iteration 19 --
+string(1) "0"
+
+-- Iteration 20 --
+string(1) "0"
+
+-- Iteration 21 --
+string(1) "0"
+
+-- Iteration 22 --
+string(1) "0"
+
+-- Iteration 23 --
+string(1) "0"
+
+-- Iteration 24 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+string(1) "1"
+
+-- Iteration 25 --
+string(1) "0"
+
+-- Iteration 26 --
+string(1) "0"
+
+-- Iteration 27 --
+string(%d) "%d"
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/dechex_basic.phpt b/ext/standard/tests/math/dechex_basic.phpt
new file mode 100644
index 0000000..cba4aa6
--- /dev/null
+++ b/ext/standard/tests/math/dechex_basic.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test dechex() - basic function dechex()
+--FILE--
+<?php
+$values = array(10,
+ 3950.5,
+ 3.9505e3,
+ 039,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = dechex($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+string(1) "a"
+string(3) "f6e"
+string(3) "f6e"
+string(1) "3"
+string(2) "5f"
+string(1) "a"
+string(3) "f6e"
+string(1) "3"
+string(2) "27"
+string(1) "0"
+string(1) "1"
+string(1) "0"
+string(1) "0" \ No newline at end of file
diff --git a/ext/standard/tests/math/dechex_basiclong_64bit.phpt b/ext/standard/tests/math/dechex_basiclong_64bit.phpt
new file mode 100644
index 0000000..40b0879
--- /dev/null
+++ b/ext/standard/tests/math/dechex_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test dechex function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(dechex($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+string(16) "7fffffffffffffff"
+--- testing: -9223372036854775808 ---
+string(16) "8000000000000000"
+--- testing: 2147483647 ---
+string(8) "7fffffff"
+--- testing: -2147483648 ---
+string(16) "ffffffff80000000"
+--- testing: 9223372034707292160 ---
+string(16) "7fffffff80000000"
+--- testing: -9223372034707292160 ---
+string(16) "8000000080000000"
+--- testing: 2147483648 ---
+string(8) "80000000"
+--- testing: -2147483649 ---
+string(16) "ffffffff7fffffff"
+--- testing: 4294967294 ---
+string(8) "fffffffe"
+--- testing: 4294967295 ---
+string(8) "ffffffff"
+--- testing: 4294967293 ---
+string(8) "fffffffd"
+--- testing: 9223372036854775806 ---
+string(16) "7ffffffffffffffe"
+--- testing: 9.2233720368548E+18 ---
+string(16) "8000000000000000"
+--- testing: -9223372036854775807 ---
+string(16) "8000000000000001"
+--- testing: -9.2233720368548E+18 ---
+string(16) "8000000000000000"
+===DONE===
diff --git a/ext/standard/tests/math/dechex_error.phpt b/ext/standard/tests/math/dechex_error.phpt
new file mode 100644
index 0000000..7ed0c45
--- /dev/null
+++ b/ext/standard/tests/math/dechex_error.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test dechex() - wrong params dechex()
+--FILE--
+<?php
+/* Prototype : string dechex ( int $number )
+ * Description: Returns a string containing a hexadecimal representation of the given number argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing dechex() : error conditions ***\n";
+
+echo "\nIncorrect number of arguments\n";
+dechex();
+dechex(23,2,true);
+
+?>
+===Done===
+--EXPECTF--
+*** Testing dechex() : error conditions ***
+
+Incorrect number of arguments
+
+Warning: dechex() expects exactly 1 parameter, 0 given in %s on line %d
+
+Warning: dechex() expects exactly 1 parameter, 3 given in %s on line %d
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/dechex_variation1.phpt b/ext/standard/tests/math/dechex_variation1.phpt
new file mode 100644
index 0000000..5bcd2b5
--- /dev/null
+++ b/ext/standard/tests/math/dechex_variation1.phpt
@@ -0,0 +1,179 @@
+--TEST--
+Test dechex() function : usage variations - different data types as $number arg
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string dechex ( int $number )
+ * Description: Returns a string containing a hexadecimal representation of the given number argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing dechex() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 4294967295, // largest decimal
+ 4294967296,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*24*/ new classA(),
+
+ // undefined data
+/*25*/ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+
+ // resource variable
+/*27*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of dechex()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(dechex($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing dechex() : usage variations ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+
+-- Iteration 3 --
+string(4) "3039"
+
+-- Iteration 4 --
+string(8) "fffff6d7"
+
+-- Iteration 5 --
+string(8) "ffffffff"
+
+-- Iteration 6 --
+string(1) "0"
+
+-- Iteration 7 --
+string(1) "a"
+
+-- Iteration 8 --
+string(8) "fffffff6"
+
+-- Iteration 9 --
+string(8) "be991a08"
+
+-- Iteration 10 --
+string(1) "0"
+
+-- Iteration 11 --
+string(1) "0"
+
+-- Iteration 12 --
+string(1) "0"
+
+-- Iteration 13 --
+string(1) "0"
+
+-- Iteration 14 --
+string(1) "1"
+
+-- Iteration 15 --
+string(1) "0"
+
+-- Iteration 16 --
+string(1) "1"
+
+-- Iteration 17 --
+string(1) "0"
+
+-- Iteration 18 --
+string(1) "0"
+
+-- Iteration 19 --
+string(1) "0"
+
+-- Iteration 20 --
+string(1) "0"
+
+-- Iteration 21 --
+string(1) "0"
+
+-- Iteration 22 --
+string(1) "0"
+
+-- Iteration 23 --
+string(1) "0"
+
+-- Iteration 24 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+string(1) "1"
+
+-- Iteration 25 --
+string(1) "0"
+
+-- Iteration 26 --
+string(1) "0"
+
+-- Iteration 27 --
+string(%d) "%s"
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/dechex_variation1_64bit.phpt b/ext/standard/tests/math/dechex_variation1_64bit.phpt
new file mode 100644
index 0000000..a513264
--- /dev/null
+++ b/ext/standard/tests/math/dechex_variation1_64bit.phpt
@@ -0,0 +1,179 @@
+--TEST--
+Test dechex() function : usage variations - different data types as $number arg
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string dechex ( int $number )
+ * Description: Returns a string containing a hexadecimal representation of the given number argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing dechex() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 18446744073709551615, // largest decimal
+ 18446744073709551616,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*24*/ new classA(),
+
+ // undefined data
+/*25*/ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+
+ // resource variable
+/*27*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of dechex()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(dechex($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing dechex() : usage variations ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+
+-- Iteration 3 --
+string(4) "3039"
+
+-- Iteration 4 --
+string(16) "fffffffffffff6d7"
+
+-- Iteration 5 --
+string(1) "0"
+
+-- Iteration 6 --
+string(1) "0"
+
+-- Iteration 7 --
+string(1) "a"
+
+-- Iteration 8 --
+string(16) "fffffffffffffff6"
+
+-- Iteration 9 --
+string(10) "1cbe991a08"
+
+-- Iteration 10 --
+string(1) "0"
+
+-- Iteration 11 --
+string(1) "0"
+
+-- Iteration 12 --
+string(1) "0"
+
+-- Iteration 13 --
+string(1) "0"
+
+-- Iteration 14 --
+string(1) "1"
+
+-- Iteration 15 --
+string(1) "0"
+
+-- Iteration 16 --
+string(1) "1"
+
+-- Iteration 17 --
+string(1) "0"
+
+-- Iteration 18 --
+string(1) "0"
+
+-- Iteration 19 --
+string(1) "0"
+
+-- Iteration 20 --
+string(1) "0"
+
+-- Iteration 21 --
+string(1) "0"
+
+-- Iteration 22 --
+string(1) "0"
+
+-- Iteration 23 --
+string(1) "0"
+
+-- Iteration 24 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+string(1) "1"
+
+-- Iteration 25 --
+string(1) "0"
+
+-- Iteration 26 --
+string(1) "0"
+
+-- Iteration 27 --
+string(%d) "%s"
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/decoct_basic.phpt b/ext/standard/tests/math/decoct_basic.phpt
new file mode 100644
index 0000000..3021e6b
--- /dev/null
+++ b/ext/standard/tests/math/decoct_basic.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test decoct() - basic function test decoct()
+--FILE--
+<?php
+$values = array(10,
+ 3950.5,
+ 3.9505e3,
+ 039,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = decoct($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+string(2) "12"
+string(4) "7556"
+string(4) "7556"
+string(1) "3"
+string(3) "137"
+string(2) "12"
+string(4) "7556"
+string(1) "3"
+string(2) "47"
+string(1) "0"
+string(1) "1"
+string(1) "0"
+string(1) "0"
diff --git a/ext/standard/tests/math/decoct_basiclong_64bit.phpt b/ext/standard/tests/math/decoct_basiclong_64bit.phpt
new file mode 100644
index 0000000..d743417
--- /dev/null
+++ b/ext/standard/tests/math/decoct_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test decoct function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(decoct($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+string(21) "777777777777777777777"
+--- testing: -9223372036854775808 ---
+string(22) "1000000000000000000000"
+--- testing: 2147483647 ---
+string(11) "17777777777"
+--- testing: -2147483648 ---
+string(22) "1777777777760000000000"
+--- testing: 9223372034707292160 ---
+string(21) "777777777760000000000"
+--- testing: -9223372034707292160 ---
+string(22) "1000000000020000000000"
+--- testing: 2147483648 ---
+string(11) "20000000000"
+--- testing: -2147483649 ---
+string(22) "1777777777757777777777"
+--- testing: 4294967294 ---
+string(11) "37777777776"
+--- testing: 4294967295 ---
+string(11) "37777777777"
+--- testing: 4294967293 ---
+string(11) "37777777775"
+--- testing: 9223372036854775806 ---
+string(21) "777777777777777777776"
+--- testing: 9.2233720368548E+18 ---
+string(22) "1000000000000000000000"
+--- testing: -9223372036854775807 ---
+string(22) "1000000000000000000001"
+--- testing: -9.2233720368548E+18 ---
+string(22) "1000000000000000000000"
+===DONE===
diff --git a/ext/standard/tests/math/decoct_error.phpt b/ext/standard/tests/math/decoct_error.phpt
new file mode 100644
index 0000000..d3f6699
--- /dev/null
+++ b/ext/standard/tests/math/decoct_error.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test decoct() - error conditions
+--FILE--
+<?php
+/* Prototype : string decbin ( int $number )
+ * Description: Decimal to binary.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing decoct() : error conditions ***\n";
+
+echo "Incorrect number of arguments\n";
+decoct();
+decoct(23,2,true);
+
+?>
+===Done===
+--EXPECTF--
+*** Testing decoct() : error conditions ***
+Incorrect number of arguments
+
+Warning: decoct() expects exactly 1 parameter, 0 given in %s on line %d
+
+Warning: decoct() expects exactly 1 parameter, 3 given in %s on line %d
+===Done===
diff --git a/ext/standard/tests/math/decoct_variation1.phpt b/ext/standard/tests/math/decoct_variation1.phpt
new file mode 100644
index 0000000..49ba57f
--- /dev/null
+++ b/ext/standard/tests/math/decoct_variation1.phpt
@@ -0,0 +1,180 @@
+--TEST--
+Test decoct() function : usage variations - different data types as $number arg
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string decoct ( int $number )
+ * Description: Returns a string containing an octal representation of the given number argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing decoct() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 4294967295, // largest decimal
+ 4294967296,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*24*/ new classA(),
+
+ // undefined data
+/*25*/ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+
+ // resource variable
+/*27*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of decoct()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(decoct($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing decoct() : usage variations ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+
+-- Iteration 3 --
+string(5) "30071"
+
+-- Iteration 4 --
+string(11) "37777773327"
+
+-- Iteration 5 --
+string(11) "37777777777"
+
+-- Iteration 6 --
+string(1) "0"
+
+-- Iteration 7 --
+string(2) "12"
+
+-- Iteration 8 --
+string(11) "37777777766"
+
+-- Iteration 9 --
+string(11) "27646215010"
+
+-- Iteration 10 --
+string(1) "0"
+
+-- Iteration 11 --
+string(1) "0"
+
+-- Iteration 12 --
+string(1) "0"
+
+-- Iteration 13 --
+string(1) "0"
+
+-- Iteration 14 --
+string(1) "1"
+
+-- Iteration 15 --
+string(1) "0"
+
+-- Iteration 16 --
+string(1) "1"
+
+-- Iteration 17 --
+string(1) "0"
+
+-- Iteration 18 --
+string(1) "0"
+
+-- Iteration 19 --
+string(1) "0"
+
+-- Iteration 20 --
+string(1) "0"
+
+-- Iteration 21 --
+string(1) "0"
+
+-- Iteration 22 --
+string(1) "0"
+
+-- Iteration 23 --
+string(1) "0"
+
+-- Iteration 24 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+string(1) "1"
+
+-- Iteration 25 --
+string(1) "0"
+
+-- Iteration 26 --
+string(1) "0"
+
+-- Iteration 27 --
+string(%d) "%d"
+===Done===
diff --git a/ext/standard/tests/math/decoct_variation1_64bit.phpt b/ext/standard/tests/math/decoct_variation1_64bit.phpt
new file mode 100644
index 0000000..40afafa
--- /dev/null
+++ b/ext/standard/tests/math/decoct_variation1_64bit.phpt
@@ -0,0 +1,180 @@
+--TEST--
+Test decoct() function : usage variations - different data types as $number arg
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : string decoct ( int $number )
+ * Description: Returns a string containing an octal representation of the given number argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing decoct() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 18446744073709551615, // largest decimal
+ 18446744073709551616,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*24*/ new classA(),
+
+ // undefined data
+/*25*/ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+
+ // resource variable
+/*27*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of decoct()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(decoct($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing decoct() : usage variations ***
+
+-- Iteration 1 --
+string(1) "0"
+
+-- Iteration 2 --
+string(1) "1"
+
+-- Iteration 3 --
+string(5) "30071"
+
+-- Iteration 4 --
+string(22) "1777777777777777773327"
+
+-- Iteration 5 --
+string(1) "0"
+
+-- Iteration 6 --
+string(1) "0"
+
+-- Iteration 7 --
+string(2) "12"
+
+-- Iteration 8 --
+string(22) "1777777777777777777766"
+
+-- Iteration 9 --
+string(13) "1627646215010"
+
+-- Iteration 10 --
+string(1) "0"
+
+-- Iteration 11 --
+string(1) "0"
+
+-- Iteration 12 --
+string(1) "0"
+
+-- Iteration 13 --
+string(1) "0"
+
+-- Iteration 14 --
+string(1) "1"
+
+-- Iteration 15 --
+string(1) "0"
+
+-- Iteration 16 --
+string(1) "1"
+
+-- Iteration 17 --
+string(1) "0"
+
+-- Iteration 18 --
+string(1) "0"
+
+-- Iteration 19 --
+string(1) "0"
+
+-- Iteration 20 --
+string(1) "0"
+
+-- Iteration 21 --
+string(1) "0"
+
+-- Iteration 22 --
+string(1) "0"
+
+-- Iteration 23 --
+string(1) "0"
+
+-- Iteration 24 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+string(1) "1"
+
+-- Iteration 25 --
+string(1) "0"
+
+-- Iteration 26 --
+string(1) "0"
+
+-- Iteration 27 --
+string(%d) "%d"
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/deg2rad_basic.phpt b/ext/standard/tests/math/deg2rad_basic.phpt
new file mode 100644
index 0000000..64771b9
--- /dev/null
+++ b/ext/standard/tests/math/deg2rad_basic.phpt
@@ -0,0 +1,67 @@
+--TEST--
+Test return type and value for expected input deg2rad()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float deg2rad(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+$arg_0 = 0.0;
+$arg_1 = 90.0;
+$arg_2 = 180.0;
+$arg_3 = 360.0;
+
+
+echo "deg2rad $arg_0 = ";
+$r0 = deg2rad($arg_0);
+var_dump($r0);
+if (allowed_rounding_error($r0 ,0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "deg2rad $arg_1 = ";
+$r1 = deg2rad($arg_1);
+var_dump($r1);
+if (allowed_rounding_error($r1 ,1.5707963267949 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+echo "deg2rad $arg_2 = ";
+$r2 = deg2rad($arg_2);
+var_dump($r2);
+if (allowed_rounding_error($r2 ,3.1415926535898 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+echo "deg2rad $arg_3 = ";
+$r3 = deg2rad($arg_3);
+var_dump($r3);
+if (allowed_rounding_error($r3 ,6.2831853071796 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+?>
+--EXPECTF--
+deg2rad 0 = float(%f)
+Pass
+deg2rad 90 = float(%f)
+Pass
+deg2rad 180 = float(%f)
+Pass
+deg2rad 360 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/deg2rad_basiclong_64bit.phpt b/ext/standard/tests/math/deg2rad_basiclong_64bit.phpt
new file mode 100644
index 0000000..c646276
--- /dev/null
+++ b/ext/standard/tests/math/deg2rad_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test deg2rad function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(deg2rad($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(1.6097821017949E+17)
+--- testing: -9223372036854775808 ---
+float(-1.6097821017949E+17)
+--- testing: 2147483647 ---
+float(37480660.272886)
+--- testing: -2147483648 ---
+float(-37480660.290339)
+--- testing: 9223372034707292160 ---
+float(1.6097821014201E+17)
+--- testing: -9223372034707292160 ---
+float(-1.6097821014201E+17)
+--- testing: 2147483648 ---
+float(37480660.290339)
+--- testing: -2147483649 ---
+float(-37480660.307792)
+--- testing: 4294967294 ---
+float(74961320.545771)
+--- testing: 4294967295 ---
+float(74961320.563225)
+--- testing: 4294967293 ---
+float(74961320.528318)
+--- testing: 9223372036854775806 ---
+float(1.6097821017949E+17)
+--- testing: 9.2233720368548E+18 ---
+float(1.6097821017949E+17)
+--- testing: -9223372036854775807 ---
+float(-1.6097821017949E+17)
+--- testing: -9.2233720368548E+18 ---
+float(-1.6097821017949E+17)
+===DONE===
diff --git a/ext/standard/tests/math/deg2rad_error.phpt b/ext/standard/tests/math/deg2rad_error.phpt
new file mode 100644
index 0000000..517680a
--- /dev/null
+++ b/ext/standard/tests/math/deg2rad_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test wrong number of arguments for deg2rad()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float deg2rad(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(deg2rad($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(deg2rad());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: deg2rad() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: deg2rad() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/deg2rad_variation.phpt b/ext/standard/tests/math/deg2rad_variation.phpt
new file mode 100644
index 0000000..70bb759
--- /dev/null
+++ b/ext/standard/tests/math/deg2rad_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of deg2rad()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float deg2rad(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test deg2rad with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = deg2rad($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(0.401425728)
+float(-0.401425728)
+float(0.4092797096)
+float(-0.4092797096)
+float(0.401425728)
+float(0.401425728)
+float(0.401425728)
+float(0.4092797096)
+float(0.4092797096)
+
+Warning: deg2rad() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(17.45329252)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(17.45329252)
+float(0)
+float(0.01745329252)
+float(0)
diff --git a/ext/standard/tests/math/exp_basic.phpt b/ext/standard/tests/math/exp_basic.phpt
new file mode 100644
index 0000000..9526c66
--- /dev/null
+++ b/ext/standard/tests/math/exp_basic.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test exp() - basic function test for exp()
+--INI--
+precision=14
+--FILE--
+<?php
+$values = array(10,
+ 10.3,
+ 3.9505e3,
+ 037,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
+
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(exp($value));
+ $iterator++;
+};
+
+?>
+===Done===
+--EXPECTF--
+
+-- Iteration 1 --
+float(22026.465794807)
+
+-- Iteration 2 --
+float(29732.618852891)
+
+-- Iteration 3 --
+float(INF)
+
+-- Iteration 4 --
+float(29048849665247)
+
+-- Iteration 5 --
+float(1.811239082889E+41)
+
+-- Iteration 6 --
+float(22026.465794807)
+
+-- Iteration 7 --
+float(INF)
+
+-- Iteration 8 --
+float(INF)
+
+-- Iteration 9 --
+float(8.6593400423994E+16)
+
+-- Iteration 10 --
+float(1.811239082889E+41)
+
+-- Iteration 11 --
+float(2.718281828459)
+
+-- Iteration 12 --
+float(1)
+
+-- Iteration 13 --
+float(1)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/exp_basiclong_64bit.phpt b/ext/standard/tests/math/exp_basiclong_64bit.phpt
new file mode 100644
index 0000000..5156d05
--- /dev/null
+++ b/ext/standard/tests/math/exp_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test exp function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(exp($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(INF)
+--- testing: -9223372036854775808 ---
+float(0)
+--- testing: 2147483647 ---
+float(INF)
+--- testing: -2147483648 ---
+float(0)
+--- testing: 9223372034707292160 ---
+float(INF)
+--- testing: -9223372034707292160 ---
+float(0)
+--- testing: 2147483648 ---
+float(INF)
+--- testing: -2147483649 ---
+float(0)
+--- testing: 4294967294 ---
+float(INF)
+--- testing: 4294967295 ---
+float(INF)
+--- testing: 4294967293 ---
+float(INF)
+--- testing: 9223372036854775806 ---
+float(INF)
+--- testing: 9.2233720368548E+18 ---
+float(INF)
+--- testing: -9223372036854775807 ---
+float(0)
+--- testing: -9.2233720368548E+18 ---
+float(0)
+===DONE===
diff --git a/ext/standard/tests/math/exp_error.phpt b/ext/standard/tests/math/exp_error.phpt
new file mode 100644
index 0000000..21949f4
--- /dev/null
+++ b/ext/standard/tests/math/exp_error.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Test exp() - wrong params for exp()
+--INI--
+precision=14
+--FILE--
+<?php
+exp();
+exp(23,true);
+?>
+--EXPECTF--
+
+Warning: exp() expects exactly 1 parameter, 0 given in %s on line %d
+
+Warning: exp() expects exactly 1 parameter, 2 given in %s on line %d
diff --git a/ext/standard/tests/math/exp_variation1.phpt b/ext/standard/tests/math/exp_variation1.phpt
new file mode 100644
index 0000000..567f6b2
--- /dev/null
+++ b/ext/standard/tests/math/exp_variation1.phpt
@@ -0,0 +1,187 @@
+--TEST--
+Test exp() function : usage variations - different data types as $arg argument
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float exp ( float $arg )
+ * Description: Returns e raised to the power of arg.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing exp() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arg argument
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of exp()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(exp($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing exp() : usage variations ***
+
+-- Iteration 1 --
+float(1)
+
+-- Iteration 2 --
+float(2.718281828459)
+
+-- Iteration 3 --
+float(INF)
+
+-- Iteration 4 --
+float(0)
+
+-- Iteration 5 --
+float(INF)
+
+-- Iteration 6 --
+float(36315.502674247)
+
+-- Iteration 7 --
+float(2.7536449349747E-5)
+
+-- Iteration 8 --
+float(INF)
+
+-- Iteration 9 --
+float(1.0000000012346)
+
+-- Iteration 10 --
+float(1.6487212707001)
+
+-- Iteration 11 --
+float(1)
+
+-- Iteration 12 --
+float(1)
+
+-- Iteration 13 --
+float(2.718281828459)
+
+-- Iteration 14 --
+float(1)
+
+-- Iteration 15 --
+float(2.718281828459)
+
+-- Iteration 16 --
+float(1)
+
+-- Iteration 17 --
+
+Warning: exp() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: exp() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: exp() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: exp() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: exp() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: exp() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: exp() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(1)
+
+-- Iteration 25 --
+float(1)
+
+-- Iteration 26 --
+
+Warning: exp() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/expm1_basic.phpt b/ext/standard/tests/math/expm1_basic.phpt
new file mode 100644
index 0000000..fa1d571
--- /dev/null
+++ b/ext/standard/tests/math/expm1_basic.phpt
@@ -0,0 +1,79 @@
+--TEST--
+Test expm1() - basic function test for expm1()
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float expm1 ( float $arg )
+ * Description: Returns exp(number) - 1, computed in a way that is accurate even
+ * when the value of number is close to zero.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing expm1() : basic functionality ***\n";
+$values = array(10,
+ 10.3,
+ 3.9505e3,
+ 037,
+ 0x5F,
+ "10",
+ "3950.5",
+ "3.9505e3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
+
+// loop through each element of $values to check the behaviour of expm1()
+$iterator = 1;
+foreach($values as $value) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(expm1($value));
+ $iterator++;
+};
+?>
+===Done===
+--EXPECTF--
+*** Testing expm1() : basic functionality ***
+
+-- Iteration 1 --
+float(22025.465794807)
+
+-- Iteration 2 --
+float(29731.618852891)
+
+-- Iteration 3 --
+float(INF)
+
+-- Iteration 4 --
+float(29048849665246)
+
+-- Iteration 5 --
+float(1.811239082889E+41)
+
+-- Iteration 6 --
+float(22025.465794807)
+
+-- Iteration 7 --
+float(INF)
+
+-- Iteration 8 --
+float(INF)
+
+-- Iteration 9 --
+float(8.6593400423994E+16)
+
+-- Iteration 10 --
+float(1.811239082889E+41)
+
+-- Iteration 11 --
+float(1.718281828459)
+
+-- Iteration 12 --
+float(0)
+
+-- Iteration 13 --
+float(0)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/expm1_basiclong_64bit.phpt b/ext/standard/tests/math/expm1_basiclong_64bit.phpt
new file mode 100644
index 0000000..6963976
--- /dev/null
+++ b/ext/standard/tests/math/expm1_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test expm1 function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(expm1($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(INF)
+--- testing: -9223372036854775808 ---
+float(-1)
+--- testing: 2147483647 ---
+float(INF)
+--- testing: -2147483648 ---
+float(-1)
+--- testing: 9223372034707292160 ---
+float(INF)
+--- testing: -9223372034707292160 ---
+float(-1)
+--- testing: 2147483648 ---
+float(INF)
+--- testing: -2147483649 ---
+float(-1)
+--- testing: 4294967294 ---
+float(INF)
+--- testing: 4294967295 ---
+float(INF)
+--- testing: 4294967293 ---
+float(INF)
+--- testing: 9223372036854775806 ---
+float(INF)
+--- testing: 9.2233720368548E+18 ---
+float(INF)
+--- testing: -9223372036854775807 ---
+float(-1)
+--- testing: -9.2233720368548E+18 ---
+float(-1)
+===DONE===
diff --git a/ext/standard/tests/math/expm1_error.phpt b/ext/standard/tests/math/expm1_error.phpt
new file mode 100644
index 0000000..380633b
--- /dev/null
+++ b/ext/standard/tests/math/expm1_error.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test expm1() - Error conditions
+--FILE--
+<?php
+/* Prototype : float expm1 ( float $arg )
+ * Description: Returns exp(number) - 1, computed in a way that is accurate even
+ * when the value of number is close to zero.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing expm1() : error conditions ***\n";
+
+echo "\n-- Testing expm1() function with less than expected no. of arguments --\n";
+expm1();
+echo "\n-- Testing expm1() function with more than expected no. of arguments --\n";
+expm1(23,true);
+
+?>
+===Done===
+--EXPECTF--
+*** Testing expm1() : error conditions ***
+
+-- Testing expm1() function with less than expected no. of arguments --
+
+Warning: expm1() expects exactly 1 parameter, 0 given in %s on line %d
+
+-- Testing expm1() function with more than expected no. of arguments --
+
+Warning: expm1() expects exactly 1 parameter, 2 given in %s on line %d
+===Done===
diff --git a/ext/standard/tests/math/expm1_variation1.phpt b/ext/standard/tests/math/expm1_variation1.phpt
new file mode 100644
index 0000000..e976b5a
--- /dev/null
+++ b/ext/standard/tests/math/expm1_variation1.phpt
@@ -0,0 +1,199 @@
+--TEST--
+Test expm1() function : usage variations - different data types as $arg argument
+--INI--
+precision=14
+--FILE--
+<?php
+
+/* Prototype : float expm1 ( float $arg )
+ * Description: Returns exp(number) - 1, computed in a way that is accurate even
+ * when the value of number is close to zero.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing expm1() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arg argument
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+
+ // float data
+/*5*/ 10.5,
+ -10.5,
+ 12.3456789E4,
+ 12.3456789E-4,
+ .5,
+
+ // null data
+/*10*/ NULL,
+ null,
+
+ // boolean data
+/*12*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*16*/ "",
+ '',
+ array(),
+
+ // string data
+/*19*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // array data
+ array(),
+ array(1,2,4),
+
+ // object data
+/*24*/ new classA(),
+
+ // undefined data
+/*25*/ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+
+ // resource variable
+/*27*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of expm1()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(expm1($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing expm1() : usage variations ***
+
+-- Iteration 1 --
+float(0)
+
+-- Iteration 2 --
+float(1.718281828459)
+
+-- Iteration 3 --
+float(INF)
+
+-- Iteration 4 --
+float(-1)
+
+-- Iteration 5 --
+float(36314.502674247)
+
+-- Iteration 6 --
+float(-0.99997246355065)
+
+-- Iteration 7 --
+float(INF)
+
+-- Iteration 8 --
+float(0.0012353302826471)
+
+-- Iteration 9 --
+float(0.64872127070013)
+
+-- Iteration 10 --
+float(0)
+
+-- Iteration 11 --
+float(0)
+
+-- Iteration 12 --
+float(1.718281828459)
+
+-- Iteration 13 --
+float(0)
+
+-- Iteration 14 --
+float(1.718281828459)
+
+-- Iteration 15 --
+float(0)
+
+-- Iteration 16 --
+
+Warning: expm1() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 17 --
+
+Warning: expm1() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: expm1() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: expm1() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: expm1() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: expm1() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: expm1() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: expm1() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: expm1() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 25 --
+float(0)
+
+-- Iteration 26 --
+float(0)
+
+-- Iteration 27 --
+
+Warning: expm1() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/floor_basic.phpt b/ext/standard/tests/math/floor_basic.phpt
new file mode 100644
index 0000000..bbb8a2a
--- /dev/null
+++ b/ext/standard/tests/math/floor_basic.phpt
@@ -0,0 +1,108 @@
+--TEST--
+Test floor() - basic function test for floor()
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float floor ( float $value )
+ * Description: Round fractions down.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing floor() : basic functionality ***\n";
+$values = array(0,
+ -0,
+ 0.5,
+ -0.5,
+ 1,
+ -1,
+ 1.5,
+ -1.5,
+ 2.6,
+ -2.6,
+ 037,
+ 0x5F,
+ "10.5",
+ "-10.5",
+ "3.95E3",
+ "-3.95E3",
+ "039",
+ "0x5F",
+ true,
+ false,
+ null,
+ );
+
+foreach($values as $value) {
+ echo "\n-- floor $value --\n";
+ var_dump(floor($value));
+};
+
+?>
+===Done===
+--EXPECTF--
+*** Testing floor() : basic functionality ***
+
+-- floor 0 --
+float(0)
+
+-- floor 0 --
+float(0)
+
+-- floor 0.5 --
+float(0)
+
+-- floor -0.5 --
+float(-1)
+
+-- floor 1 --
+float(1)
+
+-- floor -1 --
+float(-1)
+
+-- floor 1.5 --
+float(1)
+
+-- floor -1.5 --
+float(-2)
+
+-- floor 2.6 --
+float(2)
+
+-- floor -2.6 --
+float(-3)
+
+-- floor 31 --
+float(31)
+
+-- floor 95 --
+float(95)
+
+-- floor 10.5 --
+float(10)
+
+-- floor -10.5 --
+float(-11)
+
+-- floor 3.95E3 --
+float(3950)
+
+-- floor -3.95E3 --
+float(-3950)
+
+-- floor 039 --
+float(39)
+
+-- floor 0x5F --
+float(95)
+
+-- floor 1 --
+float(1)
+
+-- floor --
+float(0)
+
+-- floor --
+float(0)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/floor_basiclong_64bit.phpt b/ext/standard/tests/math/floor_basiclong_64bit.phpt
new file mode 100644
index 0000000..65a50fc
--- /dev/null
+++ b/ext/standard/tests/math/floor_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test floor function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(floor($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808 ---
+float(-9.2233720368548E+18)
+--- testing: 2147483647 ---
+float(2147483647)
+--- testing: -2147483648 ---
+float(-2147483648)
+--- testing: 9223372034707292160 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160 ---
+float(-9.2233720347073E+18)
+--- testing: 2147483648 ---
+float(2147483648)
+--- testing: -2147483649 ---
+float(-2147483649)
+--- testing: 4294967294 ---
+float(4294967294)
+--- testing: 4294967295 ---
+float(4294967295)
+--- testing: 4294967293 ---
+float(4294967293)
+--- testing: 9223372036854775806 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807 ---
+float(-9.2233720368548E+18)
+--- testing: -9.2233720368548E+18 ---
+float(-9.2233720368548E+18)
+===DONE===
diff --git a/ext/standard/tests/math/floor_error.phpt b/ext/standard/tests/math/floor_error.phpt
new file mode 100644
index 0000000..f33902e
--- /dev/null
+++ b/ext/standard/tests/math/floor_error.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test floor() - error conditions - incorrect number of args
+--FILE--
+<?php
+/* Prototype : float floor ( float $value )
+ * Description: Round fractions down.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing floor() : error conditions ***\n";
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\n-- Too many arguments --\n";
+var_dump(floor($arg_0, $extra_arg));
+
+echo "\n-- Too few arguments --\n";
+var_dump(floor());
+?>
+===Done===
+--EXPECTF--
+*** Testing floor() : error conditions ***
+
+-- Too many arguments --
+
+Warning: floor() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+-- Too few arguments --
+
+Warning: floor() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/floor_variation1.phpt b/ext/standard/tests/math/floor_variation1.phpt
new file mode 100644
index 0000000..baba53a
--- /dev/null
+++ b/ext/standard/tests/math/floor_variation1.phpt
@@ -0,0 +1,128 @@
+--TEST--
+Test floor() function : usage variations - different data types as $value arg
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float floor ( float $value )
+ * Description: Round fractions down.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing floor() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// get a class
+class classA
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $value argument
+$inputs = array(
+ // null data
+/* 1*/ NULL,
+ null,
+
+ // boolean data
+/* 3*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/* 7*/ "",
+ '',
+ array(),
+
+ // string data
+/*10*/ "abcxyz",
+ 'abcxyz}',
+ $heredoc,
+
+ // object data
+/*13*/ new classA(),
+
+ // undefined data
+/*14*/ @$undefined_var,
+
+ // unset data
+/*15*/ @$unset_var,
+
+ // resource variable
+/*16*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of floor()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(floor($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing floor() : usage variations ***
+
+-- Iteration 1 --
+float(0)
+
+-- Iteration 2 --
+float(0)
+
+-- Iteration 3 --
+float(1)
+
+-- Iteration 4 --
+float(0)
+
+-- Iteration 5 --
+float(1)
+
+-- Iteration 6 --
+float(0)
+
+-- Iteration 7 --
+float(0)
+
+-- Iteration 8 --
+float(0)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+float(0)
+
+-- Iteration 11 --
+float(0)
+
+-- Iteration 12 --
+float(0)
+
+-- Iteration 13 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+float(1)
+
+-- Iteration 14 --
+float(0)
+
+-- Iteration 15 --
+float(0)
+
+-- Iteration 16 --
+float(%f)
+===Done===
diff --git a/ext/standard/tests/math/floorceil.phpt b/ext/standard/tests/math/floorceil.phpt
new file mode 100644
index 0000000..2f7d82c
--- /dev/null
+++ b/ext/standard/tests/math/floorceil.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Tests for floor en ceil
+--FILE--
+<?php
+ $a = ceil (-0); $b = ceil (-1); $c = ceil (-1.5);
+ $d = ceil (-1.8); $e = ceil (-2.7);
+ var_dump ($a, $b, $c, $d, $e);
+
+ $a = ceil (0); $b = ceil (0.5); $c = ceil (1);
+ $d = ceil (1.5); $e = ceil (1.8); $f = ceil (2.7);
+ var_dump ($a, $b, $c, $d, $e, $f);
+
+ $a = floor (-0); $b = floor (-0.5); $c = floor (-1);
+ $d = floor (-1.5); $e = floor (-1.8); $f = floor (-2.7);
+ var_dump ($a, $b, $c, $d, $e, $f);
+
+ $a = floor (0); $b = floor (0.5); $c = floor (1);
+ $d = floor (1.5); $e = floor (1.8); $f = floor (2.7);
+ var_dump ($a, $b, $c, $d, $e, $f);
+?>
+--EXPECT--
+float(0)
+float(-1)
+float(-1)
+float(-1)
+float(-2)
+float(0)
+float(1)
+float(1)
+float(2)
+float(2)
+float(3)
+float(0)
+float(-1)
+float(-1)
+float(-2)
+float(-2)
+float(-3)
+float(0)
+float(0)
+float(1)
+float(1)
+float(1)
+float(2)
diff --git a/ext/standard/tests/math/fmod_basic.phpt b/ext/standard/tests/math/fmod_basic.phpt
new file mode 100644
index 0000000..c29abca
--- /dev/null
+++ b/ext/standard/tests/math/fmod_basic.phpt
@@ -0,0 +1,209 @@
+--TEST--
+Test fmod() - basic function test fmod()
+--INI--
+precision=14
+--FILE--
+<?php
+$values1 = array(234,
+ -234,
+ 23.45e1,
+ -23.45e1,
+ 0xEA,
+ 0352,
+ "234",
+ "234.5",
+ "23.45e1",
+ null,
+ true,
+ false);
+
+$values2 = array(2,
+ -2,
+ 2.3e1,
+ -2.3e1,
+ 0x2,
+ 02,
+ "2",
+ "2.3",
+ "2.3e1",
+ null,
+ true,
+ false);
+for ($i = 0; $i < count($values1); $i++) {
+ echo "\niteration ", $i, "\n";
+
+ for ($j = 0; $j < count($values2); $j++) {
+ $res = fmod($values1[$i], $values2[$j]);
+ var_dump($res);
+ }
+}
+?>
+--EXPECTF--
+
+iteration 0
+float(0)
+float(0)
+float(4)
+float(4)
+float(0)
+float(0)
+float(0)
+float(1.7)
+float(4)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 1
+float(-0)
+float(-0)
+float(-4)
+float(-4)
+float(-0)
+float(-0)
+float(-0)
+float(-1.7)
+float(-4)
+float(NAN)
+float(-0)
+float(NAN)
+
+iteration 2
+float(0.5)
+float(0.5)
+float(4.5)
+float(4.5)
+float(0.5)
+float(0.5)
+float(0.5)
+float(2.2)
+float(4.5)
+float(NAN)
+float(0.5)
+float(NAN)
+
+iteration 3
+float(-0.5)
+float(-0.5)
+float(-4.5)
+float(-4.5)
+float(-0.5)
+float(-0.5)
+float(-0.5)
+float(-2.2)
+float(-4.5)
+float(NAN)
+float(-0.5)
+float(NAN)
+
+iteration 4
+float(0)
+float(0)
+float(4)
+float(4)
+float(0)
+float(0)
+float(0)
+float(1.7)
+float(4)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 5
+float(0)
+float(0)
+float(4)
+float(4)
+float(0)
+float(0)
+float(0)
+float(1.7)
+float(4)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 6
+float(0)
+float(0)
+float(4)
+float(4)
+float(0)
+float(0)
+float(0)
+float(1.7)
+float(4)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 7
+float(0.5)
+float(0.5)
+float(4.5)
+float(4.5)
+float(0.5)
+float(0.5)
+float(0.5)
+float(2.2)
+float(4.5)
+float(NAN)
+float(0.5)
+float(NAN)
+
+iteration 8
+float(0.5)
+float(0.5)
+float(4.5)
+float(4.5)
+float(0.5)
+float(0.5)
+float(0.5)
+float(2.2)
+float(4.5)
+float(NAN)
+float(0.5)
+float(NAN)
+
+iteration 9
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 10
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(NAN)
+float(0)
+float(NAN)
+
+iteration 11
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(0)
+float(NAN)
+float(0)
+float(NAN)
diff --git a/ext/standard/tests/math/fmod_basiclong_64bit.phpt b/ext/standard/tests/math/fmod_basiclong_64bit.phpt
new file mode 100644
index 0000000..1502b65
--- /dev/null
+++ b/ext/standard/tests/math/fmod_basiclong_64bit.phpt
@@ -0,0 +1,364 @@
+--TEST--
+Test fmod function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MIN_32Bit, MAX_64Bit, MIN_64Bit);
+
+
+foreach ($longVals as $longVal) {
+ foreach($otherVals as $otherVal) {
+ echo "--- testing: $longVal, $otherVal ---\n";
+ var_dump(fmod($longVal, $otherVal));
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807, 0 ---
+float(NAN)
+--- testing: 9223372036854775807, 1 ---
+float(0)
+--- testing: 9223372036854775807, -1 ---
+float(0)
+--- testing: 9223372036854775807, 7 ---
+float(1)
+--- testing: 9223372036854775807, 9 ---
+float(8)
+--- testing: 9223372036854775807, 65 ---
+float(8)
+--- testing: 9223372036854775807, -44 ---
+float(8)
+--- testing: 9223372036854775807, 2147483647 ---
+float(2)
+--- testing: 9223372036854775807, -2147483648 ---
+float(0)
+--- testing: 9223372036854775807, 9223372036854775807 ---
+float(0)
+--- testing: 9223372036854775807, -9223372036854775808 ---
+float(0)
+--- testing: -9223372036854775808, 0 ---
+float(NAN)
+--- testing: -9223372036854775808, 1 ---
+float(-0)
+--- testing: -9223372036854775808, -1 ---
+float(-0)
+--- testing: -9223372036854775808, 7 ---
+float(-1)
+--- testing: -9223372036854775808, 9 ---
+float(-8)
+--- testing: -9223372036854775808, 65 ---
+float(-8)
+--- testing: -9223372036854775808, -44 ---
+float(-8)
+--- testing: -9223372036854775808, 2147483647 ---
+float(-2)
+--- testing: -9223372036854775808, -2147483648 ---
+float(-0)
+--- testing: -9223372036854775808, 9223372036854775807 ---
+float(-0)
+--- testing: -9223372036854775808, -9223372036854775808 ---
+float(-0)
+--- testing: 2147483647, 0 ---
+float(NAN)
+--- testing: 2147483647, 1 ---
+float(0)
+--- testing: 2147483647, -1 ---
+float(0)
+--- testing: 2147483647, 7 ---
+float(1)
+--- testing: 2147483647, 9 ---
+float(1)
+--- testing: 2147483647, 65 ---
+float(62)
+--- testing: 2147483647, -44 ---
+float(23)
+--- testing: 2147483647, 2147483647 ---
+float(0)
+--- testing: 2147483647, -2147483648 ---
+float(2147483647)
+--- testing: 2147483647, 9223372036854775807 ---
+float(2147483647)
+--- testing: 2147483647, -9223372036854775808 ---
+float(2147483647)
+--- testing: -2147483648, 0 ---
+float(NAN)
+--- testing: -2147483648, 1 ---
+float(-0)
+--- testing: -2147483648, -1 ---
+float(-0)
+--- testing: -2147483648, 7 ---
+float(-2)
+--- testing: -2147483648, 9 ---
+float(-2)
+--- testing: -2147483648, 65 ---
+float(-63)
+--- testing: -2147483648, -44 ---
+float(-24)
+--- testing: -2147483648, 2147483647 ---
+float(-1)
+--- testing: -2147483648, -2147483648 ---
+float(-0)
+--- testing: -2147483648, 9223372036854775807 ---
+float(-2147483648)
+--- testing: -2147483648, -9223372036854775808 ---
+float(-2147483648)
+--- testing: 9223372034707292160, 0 ---
+float(NAN)
+--- testing: 9223372034707292160, 1 ---
+float(0)
+--- testing: 9223372034707292160, -1 ---
+float(0)
+--- testing: 9223372034707292160, 7 ---
+float(6)
+--- testing: 9223372034707292160, 9 ---
+float(6)
+--- testing: 9223372034707292160, 65 ---
+float(10)
+--- testing: 9223372034707292160, -44 ---
+float(28)
+--- testing: 9223372034707292160, 2147483647 ---
+float(1)
+--- testing: 9223372034707292160, -2147483648 ---
+float(0)
+--- testing: 9223372034707292160, 9223372036854775807 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, -9223372036854775808 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, 0 ---
+float(NAN)
+--- testing: -9223372034707292160, 1 ---
+float(-0)
+--- testing: -9223372034707292160, -1 ---
+float(-0)
+--- testing: -9223372034707292160, 7 ---
+float(-6)
+--- testing: -9223372034707292160, 9 ---
+float(-6)
+--- testing: -9223372034707292160, 65 ---
+float(-10)
+--- testing: -9223372034707292160, -44 ---
+float(-28)
+--- testing: -9223372034707292160, 2147483647 ---
+float(-1)
+--- testing: -9223372034707292160, -2147483648 ---
+float(-0)
+--- testing: -9223372034707292160, 9223372036854775807 ---
+float(-9.2233720347073E+18)
+--- testing: -9223372034707292160, -9223372036854775808 ---
+float(-9.2233720347073E+18)
+--- testing: 2147483648, 0 ---
+float(NAN)
+--- testing: 2147483648, 1 ---
+float(0)
+--- testing: 2147483648, -1 ---
+float(0)
+--- testing: 2147483648, 7 ---
+float(2)
+--- testing: 2147483648, 9 ---
+float(2)
+--- testing: 2147483648, 65 ---
+float(63)
+--- testing: 2147483648, -44 ---
+float(24)
+--- testing: 2147483648, 2147483647 ---
+float(1)
+--- testing: 2147483648, -2147483648 ---
+float(0)
+--- testing: 2147483648, 9223372036854775807 ---
+float(2147483648)
+--- testing: 2147483648, -9223372036854775808 ---
+float(2147483648)
+--- testing: -2147483649, 0 ---
+float(NAN)
+--- testing: -2147483649, 1 ---
+float(-0)
+--- testing: -2147483649, -1 ---
+float(-0)
+--- testing: -2147483649, 7 ---
+float(-3)
+--- testing: -2147483649, 9 ---
+float(-3)
+--- testing: -2147483649, 65 ---
+float(-64)
+--- testing: -2147483649, -44 ---
+float(-25)
+--- testing: -2147483649, 2147483647 ---
+float(-2)
+--- testing: -2147483649, -2147483648 ---
+float(-1)
+--- testing: -2147483649, 9223372036854775807 ---
+float(-2147483649)
+--- testing: -2147483649, -9223372036854775808 ---
+float(-2147483649)
+--- testing: 4294967294, 0 ---
+float(NAN)
+--- testing: 4294967294, 1 ---
+float(0)
+--- testing: 4294967294, -1 ---
+float(0)
+--- testing: 4294967294, 7 ---
+float(2)
+--- testing: 4294967294, 9 ---
+float(2)
+--- testing: 4294967294, 65 ---
+float(59)
+--- testing: 4294967294, -44 ---
+float(2)
+--- testing: 4294967294, 2147483647 ---
+float(0)
+--- testing: 4294967294, -2147483648 ---
+float(2147483646)
+--- testing: 4294967294, 9223372036854775807 ---
+float(4294967294)
+--- testing: 4294967294, -9223372036854775808 ---
+float(4294967294)
+--- testing: 4294967295, 0 ---
+float(NAN)
+--- testing: 4294967295, 1 ---
+float(0)
+--- testing: 4294967295, -1 ---
+float(0)
+--- testing: 4294967295, 7 ---
+float(3)
+--- testing: 4294967295, 9 ---
+float(3)
+--- testing: 4294967295, 65 ---
+float(60)
+--- testing: 4294967295, -44 ---
+float(3)
+--- testing: 4294967295, 2147483647 ---
+float(1)
+--- testing: 4294967295, -2147483648 ---
+float(2147483647)
+--- testing: 4294967295, 9223372036854775807 ---
+float(4294967295)
+--- testing: 4294967295, -9223372036854775808 ---
+float(4294967295)
+--- testing: 4294967293, 0 ---
+float(NAN)
+--- testing: 4294967293, 1 ---
+float(0)
+--- testing: 4294967293, -1 ---
+float(0)
+--- testing: 4294967293, 7 ---
+float(1)
+--- testing: 4294967293, 9 ---
+float(1)
+--- testing: 4294967293, 65 ---
+float(58)
+--- testing: 4294967293, -44 ---
+float(1)
+--- testing: 4294967293, 2147483647 ---
+float(2147483646)
+--- testing: 4294967293, -2147483648 ---
+float(2147483645)
+--- testing: 4294967293, 9223372036854775807 ---
+float(4294967293)
+--- testing: 4294967293, -9223372036854775808 ---
+float(4294967293)
+--- testing: 9223372036854775806, 0 ---
+float(NAN)
+--- testing: 9223372036854775806, 1 ---
+float(0)
+--- testing: 9223372036854775806, -1 ---
+float(0)
+--- testing: 9223372036854775806, 7 ---
+float(1)
+--- testing: 9223372036854775806, 9 ---
+float(8)
+--- testing: 9223372036854775806, 65 ---
+float(8)
+--- testing: 9223372036854775806, -44 ---
+float(8)
+--- testing: 9223372036854775806, 2147483647 ---
+float(2)
+--- testing: 9223372036854775806, -2147483648 ---
+float(0)
+--- testing: 9223372036854775806, 9223372036854775807 ---
+float(0)
+--- testing: 9223372036854775806, -9223372036854775808 ---
+float(0)
+--- testing: 9.2233720368548E+18, 0 ---
+float(NAN)
+--- testing: 9.2233720368548E+18, 1 ---
+float(0)
+--- testing: 9.2233720368548E+18, -1 ---
+float(0)
+--- testing: 9.2233720368548E+18, 7 ---
+float(1)
+--- testing: 9.2233720368548E+18, 9 ---
+float(8)
+--- testing: 9.2233720368548E+18, 65 ---
+float(8)
+--- testing: 9.2233720368548E+18, -44 ---
+float(8)
+--- testing: 9.2233720368548E+18, 2147483647 ---
+float(2)
+--- testing: 9.2233720368548E+18, -2147483648 ---
+float(0)
+--- testing: 9.2233720368548E+18, 9223372036854775807 ---
+float(0)
+--- testing: 9.2233720368548E+18, -9223372036854775808 ---
+float(0)
+--- testing: -9223372036854775807, 0 ---
+float(NAN)
+--- testing: -9223372036854775807, 1 ---
+float(-0)
+--- testing: -9223372036854775807, -1 ---
+float(-0)
+--- testing: -9223372036854775807, 7 ---
+float(-1)
+--- testing: -9223372036854775807, 9 ---
+float(-8)
+--- testing: -9223372036854775807, 65 ---
+float(-8)
+--- testing: -9223372036854775807, -44 ---
+float(-8)
+--- testing: -9223372036854775807, 2147483647 ---
+float(-2)
+--- testing: -9223372036854775807, -2147483648 ---
+float(-0)
+--- testing: -9223372036854775807, 9223372036854775807 ---
+float(-0)
+--- testing: -9223372036854775807, -9223372036854775808 ---
+float(-0)
+--- testing: -9.2233720368548E+18, 0 ---
+float(NAN)
+--- testing: -9.2233720368548E+18, 1 ---
+float(-0)
+--- testing: -9.2233720368548E+18, -1 ---
+float(-0)
+--- testing: -9.2233720368548E+18, 7 ---
+float(-1)
+--- testing: -9.2233720368548E+18, 9 ---
+float(-8)
+--- testing: -9.2233720368548E+18, 65 ---
+float(-8)
+--- testing: -9.2233720368548E+18, -44 ---
+float(-8)
+--- testing: -9.2233720368548E+18, 2147483647 ---
+float(-2)
+--- testing: -9.2233720368548E+18, -2147483648 ---
+float(-0)
+--- testing: -9.2233720368548E+18, 9223372036854775807 ---
+float(-0)
+--- testing: -9.2233720368548E+18, -9223372036854775808 ---
+float(-0)
+===DONE===
diff --git a/ext/standard/tests/math/fmod_error.phpt b/ext/standard/tests/math/fmod_error.phpt
new file mode 100644
index 0000000..42a6ad1
--- /dev/null
+++ b/ext/standard/tests/math/fmod_error.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Test fmod() - wrong params test fmod()
+--INI--
+precision=14
+--FILE--
+<?php
+fmod();
+fmod(23);
+fmod(23,2,true);
+?>
+--EXPECTF--
+
+Warning: fmod() expects exactly 2 parameters, 0 given in %s on line 2
+
+Warning: fmod() expects exactly 2 parameters, 1 given in %s on line 3
+
+Warning: fmod() expects exactly 2 parameters, 3 given in %s on line 4
diff --git a/ext/standard/tests/math/fmod_variation1.phpt b/ext/standard/tests/math/fmod_variation1.phpt
new file mode 100644
index 0000000..9c6ab13
--- /dev/null
+++ b/ext/standard/tests/math/fmod_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test fmod() function : usage variations - different data types as $x argument
+--FILE--
+<?php
+/* Prototype : float fmod ( float $x , float $y )
+ * Description: Returns the floating point remainder (modulo) of the division of the arguments.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing fmod() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of fmod()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(fmod($input, 2));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing fmod() : usage variations ***
+
+-- Iteration 1 --
+float(0)
+
+-- Iteration 2 --
+float(1)
+
+-- Iteration 3 --
+float(1)
+
+-- Iteration 4 --
+float(-1)
+
+-- Iteration 5 --
+float(1)
+
+-- Iteration 6 --
+float(0.5)
+
+-- Iteration 7 --
+float(-0.5)
+
+-- Iteration 8 --
+float(0)
+
+-- Iteration 9 --
+float(1.23456789E-9)
+
+-- Iteration 10 --
+float(0.5)
+
+-- Iteration 11 --
+float(0)
+
+-- Iteration 12 --
+float(0)
+
+-- Iteration 13 --
+float(1)
+
+-- Iteration 14 --
+float(0)
+
+-- Iteration 15 --
+float(1)
+
+-- Iteration 16 --
+float(0)
+
+-- Iteration 17 --
+
+Warning: fmod() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: fmod() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: fmod() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: fmod() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: fmod() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: fmod() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: fmod() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(0)
+
+-- Iteration 25 --
+float(0)
+
+-- Iteration 26 --
+
+Warning: fmod() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/fmod_variation2.phpt b/ext/standard/tests/math/fmod_variation2.phpt
new file mode 100644
index 0000000..bbeddb6
--- /dev/null
+++ b/ext/standard/tests/math/fmod_variation2.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test fmod() function : usage variations - different data types as $y argument
+--FILE--
+<?php
+/* Prototype : float fmod ( float $x , float $y )
+ * Description: Returns the floating point remainder (modulo) of the division of the arguments.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing fmod() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of fmod()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(fmod(123456, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing fmod() : usage variations ***
+
+-- Iteration 1 --
+float(NAN)
+
+-- Iteration 2 --
+float(0)
+
+-- Iteration 3 --
+float(6)
+
+-- Iteration 4 --
+float(1516)
+
+-- Iteration 5 --
+float(123456)
+
+-- Iteration 6 --
+float(7.5)
+
+-- Iteration 7 --
+float(7.5)
+
+-- Iteration 8 --
+float(123456)
+
+-- Iteration 9 --
+float(2.3605615109341E-10)
+
+-- Iteration 10 --
+float(0)
+
+-- Iteration 11 --
+float(NAN)
+
+-- Iteration 12 --
+float(NAN)
+
+-- Iteration 13 --
+float(0)
+
+-- Iteration 14 --
+float(NAN)
+
+-- Iteration 15 --
+float(0)
+
+-- Iteration 16 --
+float(NAN)
+
+-- Iteration 17 --
+
+Warning: fmod() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: fmod() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: fmod() expects parameter 2 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: fmod() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: fmod() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: fmod() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: fmod() expects parameter 2 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(NAN)
+
+-- Iteration 25 --
+float(NAN)
+
+-- Iteration 26 --
+
+Warning: fmod() expects parameter 2 to be double, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/getrandmax_basic.phpt b/ext/standard/tests/math/getrandmax_basic.phpt
new file mode 100644
index 0000000..4e52c19
--- /dev/null
+++ b/ext/standard/tests/math/getrandmax_basic.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Test getrandmax() - basic function test getrandmax()
+--FILE--
+<?php
+$biggest_int = getrandmax();
+var_dump($biggest_int);
+?>
+--EXPECTF--
+int(%d) \ No newline at end of file
diff --git a/ext/standard/tests/math/getrandmax_error.phpt b/ext/standard/tests/math/getrandmax_error.phpt
new file mode 100644
index 0000000..6cc87ff
--- /dev/null
+++ b/ext/standard/tests/math/getrandmax_error.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Test getrandmax() - wrong params test getrandmax()
+--FILE--
+<?php
+var_dump($biggest_int = getrandmax(true));
+?>
+--EXPECTF--
+Warning: getrandmax() expects exactly 0 parameters, 1 given in %s on line 2
+NULL
diff --git a/ext/standard/tests/math/hexdec.phpt b/ext/standard/tests/math/hexdec.phpt
new file mode 100644
index 0000000..d9e644a
--- /dev/null
+++ b/ext/standard/tests/math/hexdec.phpt
@@ -0,0 +1,24 @@
+--TEST--
+overflow check for _php_math_basetozval
+--INI--
+precision=14
+--FILE--
+<?php
+
+var_dump(hexdec("012345"));
+var_dump(hexdec("12345"));
+var_dump(hexdec("q12345"));
+var_dump(hexdec("12345+?!"));
+var_dump(hexdec("12345q"));
+var_dump((float)hexdec("1234500001"));
+var_dump((float)hexdec("17fffffff"));
+
+?>
+--EXPECT--
+int(74565)
+int(74565)
+int(74565)
+int(74565)
+int(74565)
+float(78187069441)
+float(6442450943)
diff --git a/ext/standard/tests/math/hexdec_basic.phpt b/ext/standard/tests/math/hexdec_basic.phpt
new file mode 100644
index 0000000..1c42ae7
--- /dev/null
+++ b/ext/standard/tests/math/hexdec_basic.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test hexdec() - basic function test hexdec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+$values = array(0x123abc,
+ 0x789DEF,
+ 0x7FFFFFFF,
+ 0x80000000,
+ '0x123abc',
+ '0x789DEF',
+ '0x7FFFFFFF',
+ '0x80000000',
+ '0x123XYZABC',
+ 311015,
+ '311015',
+ 31101.3,
+ 31.1013e5,
+ 011237,
+ '011237',
+ true,
+ false,
+ null);
+for ($i = 0; $i < count($values); $i++) {
+ $res = hexdec($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+int(18433668)
+int(126895953)
+float(142929835591)
+float(142929835592)
+int(1194684)
+int(7904751)
+int(2147483647)
+float(2147483648)
+int(1194684)
+int(3215381)
+int(3215381)
+int(3215379)
+int(51446064)
+int(18279)
+int(70199)
+int(1)
+int(0)
+int(0)
diff --git a/ext/standard/tests/math/hexdec_basic_64bit.phpt b/ext/standard/tests/math/hexdec_basic_64bit.phpt
new file mode 100644
index 0000000..f1a2028
--- /dev/null
+++ b/ext/standard/tests/math/hexdec_basic_64bit.phpt
@@ -0,0 +1,93 @@
+--TEST--
+Test hexdec() - basic function test hexdec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+echo "*** Testing hexdec() : basic functionality ***\n";
+
+$values = array(0x123abc,
+ 0x789DEF,
+ 0x7FFFFFFF,
+ 0x80000000,
+ '0x123abc',
+ '0x789DEF',
+ '0x7FFFFFFF',
+ '0x80000000',
+ '0x123XYZABC',
+ 311015,
+ '311015',
+ 31101.3,
+ 31.1013e5,
+ 011237,
+ '011237',
+ true,
+ false,
+ null);
+
+foreach($values as $value) {
+ echo "\n-- hexdec $value --\n";
+ var_dump(hexdec($value));
+};
+
+?>
+===Done===
+--EXPECTF--
+*** Testing hexdec() : basic functionality ***
+
+-- hexdec 1194684 --
+int(18433668)
+
+-- hexdec 7904751 --
+int(126895953)
+
+-- hexdec 2147483647 --
+int(142929835591)
+
+-- hexdec 2147483648 --
+int(142929835592)
+
+-- hexdec 0x123abc --
+int(1194684)
+
+-- hexdec 0x789DEF --
+int(7904751)
+
+-- hexdec 0x7FFFFFFF --
+int(2147483647)
+
+-- hexdec 0x80000000 --
+int(2147483648)
+
+-- hexdec 0x123XYZABC --
+int(1194684)
+
+-- hexdec 311015 --
+int(3215381)
+
+-- hexdec 311015 --
+int(3215381)
+
+-- hexdec 31101.3 --
+int(3215379)
+
+-- hexdec 3110130 --
+int(51446064)
+
+-- hexdec 4767 --
+int(18279)
+
+-- hexdec 011237 --
+int(70199)
+
+-- hexdec 1 --
+int(1)
+
+-- hexdec --
+int(0)
+
+-- hexdec --
+int(0)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/hexdec_basiclong_64bit.phpt b/ext/standard/tests/math/hexdec_basiclong_64bit.phpt
new file mode 100644
index 0000000..29c684a
--- /dev/null
+++ b/ext/standard/tests/math/hexdec_basiclong_64bit.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test hexdec function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$hexLongStrs = array(
+ '7'.str_repeat('f',15),
+ str_repeat('f',16),
+ '7'.str_repeat('f',7),
+ str_repeat('f',8),
+ '7'.str_repeat('f',16),
+ str_repeat('f',18),
+ '7'.str_repeat('f',8),
+ str_repeat('f',9)
+);
+
+
+foreach ($hexLongStrs as $strVal) {
+ echo "--- testing: $strVal ---\n";
+ var_dump(hexdec($strVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 7fffffffffffffff ---
+int(9223372036854775807)
+--- testing: ffffffffffffffff ---
+float(1.844674407371E+19)
+--- testing: 7fffffff ---
+int(2147483647)
+--- testing: ffffffff ---
+int(4294967295)
+--- testing: 7ffffffffffffffff ---
+float(1.4757395258968E+20)
+--- testing: ffffffffffffffffff ---
+float(4.7223664828696E+21)
+--- testing: 7ffffffff ---
+int(34359738367)
+--- testing: fffffffff ---
+int(68719476735)
+===DONE===
diff --git a/ext/standard/tests/math/hexdec_error.phpt b/ext/standard/tests/math/hexdec_error.phpt
new file mode 100644
index 0000000..e9ab9e5
--- /dev/null
+++ b/ext/standard/tests/math/hexdec_error.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test hexdec() - wrong params test hexdec()
+--FILE--
+<?php
+/* Prototype : number hexdec ( string $hex_string )
+ * Description: Returns the decimal equivalent of the hexadecimal number represented by the hex_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing hexdec() : error conditions ***\n";
+
+// get a class
+class classA
+{
+}
+
+echo "\n-- Incorrect number of arguments --\n";
+hexdec();
+hexdec('0x123abc',true);
+
+echo "\n-- Incorrect input --\n";
+hexdec(new classA());
+
+?>
+--EXPECTF--
+*** Testing hexdec() : error conditions ***
+
+-- Incorrect number of arguments --
+
+Warning: hexdec() expects exactly 1 parameter, 0 given in %s on line %d
+
+Warning: hexdec() expects exactly 1 parameter, 2 given in %s on line %d
+
+-- Incorrect input --
+
+Catchable fatal error: Object of class classA could not be converted to string in %s on line %d \ No newline at end of file
diff --git a/ext/standard/tests/math/hexdec_variation1.phpt b/ext/standard/tests/math/hexdec_variation1.phpt
new file mode 100644
index 0000000..2b3f1b6
--- /dev/null
+++ b/ext/standard/tests/math/hexdec_variation1.phpt
@@ -0,0 +1,168 @@
+--TEST--
+Test hexdec() function : usage variations - different data types as $number arg
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : number hexdec ( string $hex_string )
+ * Description: Returns the decimal equivalent of the hexadecimal number represented by the hex_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing hexdec() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 4294967295, // largest decimal
+ 4294967296,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of hexdec()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(hexdec($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing hexdec() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+int(74565)
+
+-- Iteration 4 --
+int(9029)
+
+-- Iteration 5 --
+float(285960729237)
+
+-- Iteration 6 --
+float(285960729238)
+
+-- Iteration 7 --
+int(261)
+
+-- Iteration 8 --
+int(261)
+
+-- Iteration 9 --
+float(20015998341120)
+
+-- Iteration 10 --
+float(1250999896553)
+
+-- Iteration 11 --
+int(5)
+
+-- Iteration 12 --
+int(0)
+
+-- Iteration 13 --
+int(0)
+
+-- Iteration 14 --
+int(1)
+
+-- Iteration 15 --
+int(0)
+
+-- Iteration 16 --
+int(1)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+int(0)
+
+-- Iteration 19 --
+int(0)
+
+-- Iteration 20 --
+
+Notice: Array to string conversion in %s on line %d
+int(170)
+
+-- Iteration 21 --
+int(2748)
+
+-- Iteration 22 --
+int(2748)
+
+-- Iteration 23 --
+int(2748)
+
+-- Iteration 24 --
+int(0)
+
+-- Iteration 25 --
+int(0)
+
+-- Iteration 26 --
+%s
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/hexdec_variation1_64bit.phpt b/ext/standard/tests/math/hexdec_variation1_64bit.phpt
new file mode 100644
index 0000000..65beb2d
--- /dev/null
+++ b/ext/standard/tests/math/hexdec_variation1_64bit.phpt
@@ -0,0 +1,168 @@
+--TEST--
+Test hexdec() function : usage variations - different data types as $number arg
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : number hexdec ( string $hex_string )
+ * Description: Returns the decimal equivalent of the hexadecimal number represented by the hex_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing hexdec() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 4294967295, // largest decimal
+ 4294967296,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of hexdec()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(hexdec($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing hexdec() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+int(74565)
+
+-- Iteration 4 --
+int(9029)
+
+-- Iteration 5 --
+int(285960729237)
+
+-- Iteration 6 --
+int(285960729238)
+
+-- Iteration 7 --
+int(261)
+
+-- Iteration 8 --
+int(261)
+
+-- Iteration 9 --
+int(20015998341120)
+
+-- Iteration 10 --
+int(1250999896553)
+
+-- Iteration 11 --
+int(5)
+
+-- Iteration 12 --
+int(0)
+
+-- Iteration 13 --
+int(0)
+
+-- Iteration 14 --
+int(1)
+
+-- Iteration 15 --
+int(0)
+
+-- Iteration 16 --
+int(1)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+int(0)
+
+-- Iteration 19 --
+int(0)
+
+-- Iteration 20 --
+
+Notice: Array to string conversion in %s on line %d
+int(170)
+
+-- Iteration 21 --
+int(2748)
+
+-- Iteration 22 --
+int(2748)
+
+-- Iteration 23 --
+int(2748)
+
+-- Iteration 24 --
+int(0)
+
+-- Iteration 25 --
+int(0)
+
+-- Iteration 26 --
+%s
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/hypot_basic.phpt b/ext/standard/tests/math/hypot_basic.phpt
new file mode 100644
index 0000000..c280a23
--- /dev/null
+++ b/ext/standard/tests/math/hypot_basic.phpt
@@ -0,0 +1,444 @@
+--TEST--
+Test hypot() - basic function test hypot()
+--INI--
+precision=14
+--FILE--
+<?php
+
+/* Prototype : float hypot ( float $x , float $y )
+ * Description: Calculate the length of the hypotenuse of a right-angle triangle.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing hypot() : basic functionality ***\n";
+
+$valuesy = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "23abc",
+ null,
+ true,
+ false);
+
+$valuesx = array(33,
+ -33,
+ 3.345e1,
+ -3.345e1,
+ 0x27,
+ 037,
+ "33",
+ "43.45",
+ "1.345e1",
+ "33abc",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($valuesy); $i++) {
+ for ($j = 0; $j < count($valuesx); $j++) {
+ echo "\nY:$valuesy[$i] X:$valuesx[$j] ";
+ $res = hypot($valuesy[$i], $valuesx[$j]);
+ var_dump($res);
+ }
+}
+?>
+===Done===
+--EXPECTF--
+*** Testing hypot() : basic functionality ***
+
+Y:23 X:33 float(40.224370722238)
+
+Y:23 X:-33 float(40.224370722238)
+
+Y:23 X:33.45 float(40.594365372549)
+
+Y:23 X:-33.45 float(40.594365372549)
+
+Y:23 X:39 float(45.276925690687)
+
+Y:23 X:31 float(38.600518131238)
+
+Y:23 X:33 float(40.224370722238)
+
+Y:23 X:43.45 float(49.162002603637)
+
+Y:23 X:1.345e1 float(26.643995571235)
+
+Y:23 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.224370722238)
+
+Y:23 X: float(23)
+
+Y:23 X:1 float(23.021728866443)
+
+Y:23 X: float(23)
+
+Y:-23 X:33 float(40.224370722238)
+
+Y:-23 X:-33 float(40.224370722238)
+
+Y:-23 X:33.45 float(40.594365372549)
+
+Y:-23 X:-33.45 float(40.594365372549)
+
+Y:-23 X:39 float(45.276925690687)
+
+Y:-23 X:31 float(38.600518131238)
+
+Y:-23 X:33 float(40.224370722238)
+
+Y:-23 X:43.45 float(49.162002603637)
+
+Y:-23 X:1.345e1 float(26.643995571235)
+
+Y:-23 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.224370722238)
+
+Y:-23 X: float(23)
+
+Y:-23 X:1 float(23.021728866443)
+
+Y:-23 X: float(23)
+
+Y:23.45 X:33 float(40.483360779461)
+
+Y:23.45 X:-33 float(40.483360779461)
+
+Y:23.45 X:33.45 float(40.851009779441)
+
+Y:23.45 X:-33.45 float(40.851009779441)
+
+Y:23.45 X:39 float(45.507169764774)
+
+Y:23.45 X:31 float(38.870329301409)
+
+Y:23.45 X:33 float(40.483360779461)
+
+Y:23.45 X:43.45 float(49.374132903779)
+
+Y:23.45 X:1.345e1 float(27.033405260899)
+
+Y:23.45 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.483360779461)
+
+Y:23.45 X: float(23.45)
+
+Y:23.45 X:1 float(23.471312276905)
+
+Y:23.45 X: float(23.45)
+
+Y:-23.45 X:33 float(40.483360779461)
+
+Y:-23.45 X:-33 float(40.483360779461)
+
+Y:-23.45 X:33.45 float(40.851009779441)
+
+Y:-23.45 X:-33.45 float(40.851009779441)
+
+Y:-23.45 X:39 float(45.507169764774)
+
+Y:-23.45 X:31 float(38.870329301409)
+
+Y:-23.45 X:33 float(40.483360779461)
+
+Y:-23.45 X:43.45 float(49.374132903779)
+
+Y:-23.45 X:1.345e1 float(27.033405260899)
+
+Y:-23.45 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.483360779461)
+
+Y:-23.45 X: float(23.45)
+
+Y:-23.45 X:1 float(23.471312276905)
+
+Y:-23.45 X: float(23.45)
+
+Y:23 X:33 float(40.224370722238)
+
+Y:23 X:-33 float(40.224370722238)
+
+Y:23 X:33.45 float(40.594365372549)
+
+Y:23 X:-33.45 float(40.594365372549)
+
+Y:23 X:39 float(45.276925690687)
+
+Y:23 X:31 float(38.600518131238)
+
+Y:23 X:33 float(40.224370722238)
+
+Y:23 X:43.45 float(49.162002603637)
+
+Y:23 X:1.345e1 float(26.643995571235)
+
+Y:23 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.224370722238)
+
+Y:23 X: float(23)
+
+Y:23 X:1 float(23.021728866443)
+
+Y:23 X: float(23)
+
+Y:23 X:33 float(40.224370722238)
+
+Y:23 X:-33 float(40.224370722238)
+
+Y:23 X:33.45 float(40.594365372549)
+
+Y:23 X:-33.45 float(40.594365372549)
+
+Y:23 X:39 float(45.276925690687)
+
+Y:23 X:31 float(38.600518131238)
+
+Y:23 X:33 float(40.224370722238)
+
+Y:23 X:43.45 float(49.162002603637)
+
+Y:23 X:1.345e1 float(26.643995571235)
+
+Y:23 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.224370722238)
+
+Y:23 X: float(23)
+
+Y:23 X:1 float(23.021728866443)
+
+Y:23 X: float(23)
+
+Y:23 X:33 float(40.224370722238)
+
+Y:23 X:-33 float(40.224370722238)
+
+Y:23 X:33.45 float(40.594365372549)
+
+Y:23 X:-33.45 float(40.594365372549)
+
+Y:23 X:39 float(45.276925690687)
+
+Y:23 X:31 float(38.600518131238)
+
+Y:23 X:33 float(40.224370722238)
+
+Y:23 X:43.45 float(49.162002603637)
+
+Y:23 X:1.345e1 float(26.643995571235)
+
+Y:23 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.224370722238)
+
+Y:23 X: float(23)
+
+Y:23 X:1 float(23.021728866443)
+
+Y:23 X: float(23)
+
+Y:23.45 X:33 float(40.483360779461)
+
+Y:23.45 X:-33 float(40.483360779461)
+
+Y:23.45 X:33.45 float(40.851009779441)
+
+Y:23.45 X:-33.45 float(40.851009779441)
+
+Y:23.45 X:39 float(45.507169764774)
+
+Y:23.45 X:31 float(38.870329301409)
+
+Y:23.45 X:33 float(40.483360779461)
+
+Y:23.45 X:43.45 float(49.374132903779)
+
+Y:23.45 X:1.345e1 float(27.033405260899)
+
+Y:23.45 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.483360779461)
+
+Y:23.45 X: float(23.45)
+
+Y:23.45 X:1 float(23.471312276905)
+
+Y:23.45 X: float(23.45)
+
+Y:2.345e1 X:33 float(40.483360779461)
+
+Y:2.345e1 X:-33 float(40.483360779461)
+
+Y:2.345e1 X:33.45 float(40.851009779441)
+
+Y:2.345e1 X:-33.45 float(40.851009779441)
+
+Y:2.345e1 X:39 float(45.507169764774)
+
+Y:2.345e1 X:31 float(38.870329301409)
+
+Y:2.345e1 X:33 float(40.483360779461)
+
+Y:2.345e1 X:43.45 float(49.374132903779)
+
+Y:2.345e1 X:1.345e1 float(27.033405260899)
+
+Y:2.345e1 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.483360779461)
+
+Y:2.345e1 X: float(23.45)
+
+Y:2.345e1 X:1 float(23.471312276905)
+
+Y:2.345e1 X: float(23.45)
+
+Y:23abc X:33
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.224370722238)
+
+Y:23abc X:-33
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.224370722238)
+
+Y:23abc X:33.45
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.594365372549)
+
+Y:23abc X:-33.45
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.594365372549)
+
+Y:23abc X:39
+Notice: A non well formed numeric value encountered in %s on line %d
+float(45.276925690687)
+
+Y:23abc X:31
+Notice: A non well formed numeric value encountered in %s on line %d
+float(38.600518131238)
+
+Y:23abc X:33
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.224370722238)
+
+Y:23abc X:43.45
+Notice: A non well formed numeric value encountered in %s on line %d
+float(49.162002603637)
+
+Y:23abc X:1.345e1
+Notice: A non well formed numeric value encountered in %s on line %d
+float(26.643995571235)
+
+Y:23abc X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(40.224370722238)
+
+Y:23abc X:
+Notice: A non well formed numeric value encountered in %s on line %d
+float(23)
+
+Y:23abc X:1
+Notice: A non well formed numeric value encountered in %s on line %d
+float(23.021728866443)
+
+Y:23abc X:
+Notice: A non well formed numeric value encountered in %s on line %d
+float(23)
+
+Y: X:33 float(33)
+
+Y: X:-33 float(33)
+
+Y: X:33.45 float(33.45)
+
+Y: X:-33.45 float(33.45)
+
+Y: X:39 float(39)
+
+Y: X:31 float(31)
+
+Y: X:33 float(33)
+
+Y: X:43.45 float(43.45)
+
+Y: X:1.345e1 float(13.45)
+
+Y: X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(33)
+
+Y: X: float(0)
+
+Y: X:1 float(1)
+
+Y: X: float(0)
+
+Y:1 X:33 float(33.015148038438)
+
+Y:1 X:-33 float(33.015148038438)
+
+Y:1 X:33.45 float(33.464944344792)
+
+Y:1 X:-33.45 float(33.464944344792)
+
+Y:1 X:39 float(39.012818406262)
+
+Y:1 X:31 float(31.016124838542)
+
+Y:1 X:33 float(33.015148038438)
+
+Y:1 X:43.45 float(43.461505956421)
+
+Y:1 X:1.345e1 float(13.487123488721)
+
+Y:1 X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(33.015148038438)
+
+Y:1 X: float(1)
+
+Y:1 X:1 float(1.4142135623731)
+
+Y:1 X: float(1)
+
+Y: X:33 float(33)
+
+Y: X:-33 float(33)
+
+Y: X:33.45 float(33.45)
+
+Y: X:-33.45 float(33.45)
+
+Y: X:39 float(39)
+
+Y: X:31 float(31)
+
+Y: X:33 float(33)
+
+Y: X:43.45 float(43.45)
+
+Y: X:1.345e1 float(13.45)
+
+Y: X:33abc
+Notice: A non well formed numeric value encountered in %s on line %d
+float(33)
+
+Y: X: float(0)
+
+Y: X:1 float(1)
+
+Y: X: float(0)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/hypot_basiclong_64bit.phpt b/ext/standard/tests/math/hypot_basiclong_64bit.phpt
new file mode 100644
index 0000000..241fa9c
--- /dev/null
+++ b/ext/standard/tests/math/hypot_basiclong_64bit.phpt
@@ -0,0 +1,364 @@
+--TEST--
+Test hypot function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MIN_32Bit, MAX_64Bit, MIN_64Bit);
+
+
+foreach ($longVals as $longVal) {
+ foreach($otherVals as $otherVal) {
+ echo "--- testing: $longVal, $otherVal ---\n";
+ var_dump(hypot($longVal, $otherVal));
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807, 0 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, 1 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, -1 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, 7 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, 9 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, 65 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, -44 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, 2147483647 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, -2147483648 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775807, 9223372036854775807 ---
+float(1.3043817825333E+19)
+--- testing: 9223372036854775807, -9223372036854775808 ---
+float(1.3043817825333E+19)
+--- testing: -9223372036854775808, 0 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, 1 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, -1 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, 7 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, 9 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, 65 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, -44 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, 2147483647 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, -2147483648 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808, 9223372036854775807 ---
+float(1.3043817825333E+19)
+--- testing: -9223372036854775808, -9223372036854775808 ---
+float(1.3043817825333E+19)
+--- testing: 2147483647, 0 ---
+float(2147483647)
+--- testing: 2147483647, 1 ---
+float(2147483647)
+--- testing: 2147483647, -1 ---
+float(2147483647)
+--- testing: 2147483647, 7 ---
+float(2147483647)
+--- testing: 2147483647, 9 ---
+float(2147483647)
+--- testing: 2147483647, 65 ---
+float(2147483647)
+--- testing: 2147483647, -44 ---
+float(2147483647)
+--- testing: 2147483647, 2147483647 ---
+float(3037000498.5618)
+--- testing: 2147483647, -2147483648 ---
+float(3037000499.2689)
+--- testing: 2147483647, 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: 2147483647, -9223372036854775808 ---
+float(9.2233720368548E+18)
+--- testing: -2147483648, 0 ---
+float(2147483648)
+--- testing: -2147483648, 1 ---
+float(2147483648)
+--- testing: -2147483648, -1 ---
+float(2147483648)
+--- testing: -2147483648, 7 ---
+float(2147483648)
+--- testing: -2147483648, 9 ---
+float(2147483648)
+--- testing: -2147483648, 65 ---
+float(2147483648)
+--- testing: -2147483648, -44 ---
+float(2147483648)
+--- testing: -2147483648, 2147483647 ---
+float(3037000499.2689)
+--- testing: -2147483648, -2147483648 ---
+float(3037000499.976)
+--- testing: -2147483648, 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: -2147483648, -9223372036854775808 ---
+float(9.2233720368548E+18)
+--- testing: 9223372034707292160, 0 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, 1 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, -1 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, 7 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, 9 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, 65 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, -44 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, 2147483647 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, -2147483648 ---
+float(9.2233720347073E+18)
+--- testing: 9223372034707292160, 9223372036854775807 ---
+float(1.3043817823814E+19)
+--- testing: 9223372034707292160, -9223372036854775808 ---
+float(1.3043817823814E+19)
+--- testing: -9223372034707292160, 0 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, 1 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, -1 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, 7 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, 9 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, 65 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, -44 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, 2147483647 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, -2147483648 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160, 9223372036854775807 ---
+float(1.3043817823814E+19)
+--- testing: -9223372034707292160, -9223372036854775808 ---
+float(1.3043817823814E+19)
+--- testing: 2147483648, 0 ---
+float(2147483648)
+--- testing: 2147483648, 1 ---
+float(2147483648)
+--- testing: 2147483648, -1 ---
+float(2147483648)
+--- testing: 2147483648, 7 ---
+float(2147483648)
+--- testing: 2147483648, 9 ---
+float(2147483648)
+--- testing: 2147483648, 65 ---
+float(2147483648)
+--- testing: 2147483648, -44 ---
+float(2147483648)
+--- testing: 2147483648, 2147483647 ---
+float(3037000499.2689)
+--- testing: 2147483648, -2147483648 ---
+float(3037000499.976)
+--- testing: 2147483648, 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: 2147483648, -9223372036854775808 ---
+float(9.2233720368548E+18)
+--- testing: -2147483649, 0 ---
+float(2147483649)
+--- testing: -2147483649, 1 ---
+float(2147483649)
+--- testing: -2147483649, -1 ---
+float(2147483649)
+--- testing: -2147483649, 7 ---
+float(2147483649)
+--- testing: -2147483649, 9 ---
+float(2147483649)
+--- testing: -2147483649, 65 ---
+float(2147483649)
+--- testing: -2147483649, -44 ---
+float(2147483649)
+--- testing: -2147483649, 2147483647 ---
+float(3037000499.976)
+--- testing: -2147483649, -2147483648 ---
+float(3037000500.6832)
+--- testing: -2147483649, 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: -2147483649, -9223372036854775808 ---
+float(9.2233720368548E+18)
+--- testing: 4294967294, 0 ---
+float(4294967294)
+--- testing: 4294967294, 1 ---
+float(4294967294)
+--- testing: 4294967294, -1 ---
+float(4294967294)
+--- testing: 4294967294, 7 ---
+float(4294967294)
+--- testing: 4294967294, 9 ---
+float(4294967294)
+--- testing: 4294967294, 65 ---
+float(4294967294)
+--- testing: 4294967294, -44 ---
+float(4294967294)
+--- testing: 4294967294, 2147483647 ---
+float(4801919415.2612)
+--- testing: 4294967294, -2147483648 ---
+float(4801919415.7084)
+--- testing: 4294967294, 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: 4294967294, -9223372036854775808 ---
+float(9.2233720368548E+18)
+--- testing: 4294967295, 0 ---
+float(4294967295)
+--- testing: 4294967295, 1 ---
+float(4294967295)
+--- testing: 4294967295, -1 ---
+float(4294967295)
+--- testing: 4294967295, 7 ---
+float(4294967295)
+--- testing: 4294967295, 9 ---
+float(4294967295)
+--- testing: 4294967295, 65 ---
+float(4294967295)
+--- testing: 4294967295, -44 ---
+float(4294967295)
+--- testing: 4294967295, 2147483647 ---
+float(4801919416.1556)
+--- testing: 4294967295, -2147483648 ---
+float(4801919416.6028)
+--- testing: 4294967295, 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: 4294967295, -9223372036854775808 ---
+float(9.2233720368548E+18)
+--- testing: 4294967293, 0 ---
+float(4294967293)
+--- testing: 4294967293, 1 ---
+float(4294967293)
+--- testing: 4294967293, -1 ---
+float(4294967293)
+--- testing: 4294967293, 7 ---
+float(4294967293)
+--- testing: 4294967293, 9 ---
+float(4294967293)
+--- testing: 4294967293, 65 ---
+float(4294967293)
+--- testing: 4294967293, -44 ---
+float(4294967293)
+--- testing: 4294967293, 2147483647 ---
+float(4801919414.3667)
+--- testing: 4294967293, -2147483648 ---
+float(4801919414.8139)
+--- testing: 4294967293, 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: 4294967293, -9223372036854775808 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, 0 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, 1 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, -1 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, 7 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, 9 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, 65 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, -44 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, 2147483647 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, -2147483648 ---
+float(9.2233720368548E+18)
+--- testing: 9223372036854775806, 9223372036854775807 ---
+float(1.3043817825333E+19)
+--- testing: 9223372036854775806, -9223372036854775808 ---
+float(1.3043817825333E+19)
+--- testing: 9.2233720368548E+18, 0 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, 1 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, -1 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, 7 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, 9 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, 65 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, -44 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, 2147483647 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, -2147483648 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, 9223372036854775807 ---
+float(1.3043817825333E+19)
+--- testing: 9.2233720368548E+18, -9223372036854775808 ---
+float(1.3043817825333E+19)
+--- testing: -9223372036854775807, 0 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, 1 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, -1 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, 7 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, 9 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, 65 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, -44 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, 2147483647 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, -2147483648 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807, 9223372036854775807 ---
+float(1.3043817825333E+19)
+--- testing: -9223372036854775807, -9223372036854775808 ---
+float(1.3043817825333E+19)
+--- testing: -9.2233720368548E+18, 0 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, 1 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, -1 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, 7 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, 9 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, 65 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, -44 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, 2147483647 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, -2147483648 ---
+float(9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, 9223372036854775807 ---
+float(1.3043817825333E+19)
+--- testing: -9.2233720368548E+18, -9223372036854775808 ---
+float(1.3043817825333E+19)
+===DONE===
diff --git a/ext/standard/tests/math/hypot_error.phpt b/ext/standard/tests/math/hypot_error.phpt
new file mode 100644
index 0000000..b357a3a
--- /dev/null
+++ b/ext/standard/tests/math/hypot_error.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test hypot() - wrong params test hypot()
+--FILE--
+<?php
+/* Prototype : float hypot ( float $x , float $y )
+ * Description: Calculate the length of the hypotenuse of a right-angle triangle.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing hypot() : error conditions ***\n";
+
+echo "\n-- Testing hypot() function with less than expected no. of arguments --\n";
+hypot();
+hypot(36);
+
+echo "\n-- Testing hypot() function with more than expected no. of arguments --\n";
+hypot(36,25,0);
+
+?>
+===Done===
+--EXPECTF--
+*** Testing hypot() : error conditions ***
+
+-- Testing hypot() function with less than expected no. of arguments --
+
+Warning: hypot() expects exactly 2 parameters, 0 given in %s on line %d
+
+Warning: hypot() expects exactly 2 parameters, 1 given in %s on line %d
+
+-- Testing hypot() function with more than expected no. of arguments --
+
+Warning: hypot() expects exactly 2 parameters, 3 given in %s on line %d
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/hypot_variation1.phpt b/ext/standard/tests/math/hypot_variation1.phpt
new file mode 100644
index 0000000..5ea8b3f
--- /dev/null
+++ b/ext/standard/tests/math/hypot_variation1.phpt
@@ -0,0 +1,185 @@
+--TEST--
+Test hypot() function : usage variations - different data types as $x argument
+--FILE--
+<?php
+/* Prototype : float hypot ( float $x , float $y )
+ * Description: Calculate the length of the hypotenuse of a right-angle triangle
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing hypot() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arg argument
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of hypot()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(hypot($input, 5));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing hypot() : usage variations ***
+
+-- Iteration 1 --
+float(5)
+
+-- Iteration 2 --
+float(5.0990195135928)
+
+-- Iteration 3 --
+float(12345.001012556)
+
+-- Iteration 4 --
+float(2345.0053304843)
+
+-- Iteration 5 --
+float(2147483647)
+
+-- Iteration 6 --
+float(11.629703349613)
+
+-- Iteration 7 --
+float(11.629703349613)
+
+-- Iteration 8 --
+float(123456789000)
+
+-- Iteration 9 --
+float(5)
+
+-- Iteration 10 --
+float(5.0249378105604)
+
+-- Iteration 11 --
+float(5)
+
+-- Iteration 12 --
+float(5)
+
+-- Iteration 13 --
+float(5.0990195135928)
+
+-- Iteration 14 --
+float(5)
+
+-- Iteration 15 --
+float(5.0990195135928)
+
+-- Iteration 16 --
+float(5)
+
+-- Iteration 17 --
+
+Warning: hypot() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: hypot() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: hypot() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: hypot() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: hypot() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: hypot() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: hypot() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(5)
+
+-- Iteration 25 --
+float(5)
+
+-- Iteration 26 --
+
+Warning: hypot() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/hypot_variation2.phpt b/ext/standard/tests/math/hypot_variation2.phpt
new file mode 100644
index 0000000..a629474
--- /dev/null
+++ b/ext/standard/tests/math/hypot_variation2.phpt
@@ -0,0 +1,185 @@
+--TEST--
+Test hypot() function : usage variations - different data types as $y argument
+--FILE--
+<?php
+/* Prototype : float hypot ( float $x , float $y )
+ * Description: Calculate the length of the hypotenuse of a right-angle triangle
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing hypot() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// unexpected values to be passed to $arg argument
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of hypot()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(hypot(3, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing hypot() : usage variations ***
+
+-- Iteration 1 --
+float(3)
+
+-- Iteration 2 --
+float(3.1622776601684)
+
+-- Iteration 3 --
+float(12345.00036452)
+
+-- Iteration 4 --
+float(2345.0019189758)
+
+-- Iteration 5 --
+float(2147483647)
+
+-- Iteration 6 --
+float(10.920164833921)
+
+-- Iteration 7 --
+float(10.920164833921)
+
+-- Iteration 8 --
+float(123456789000)
+
+-- Iteration 9 --
+float(3)
+
+-- Iteration 10 --
+float(3.0413812651491)
+
+-- Iteration 11 --
+float(3)
+
+-- Iteration 12 --
+float(3)
+
+-- Iteration 13 --
+float(3.1622776601684)
+
+-- Iteration 14 --
+float(3)
+
+-- Iteration 15 --
+float(3.1622776601684)
+
+-- Iteration 16 --
+float(3)
+
+-- Iteration 17 --
+
+Warning: hypot() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: hypot() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: hypot() expects parameter 2 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: hypot() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: hypot() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: hypot() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: hypot() expects parameter 2 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(3)
+
+-- Iteration 25 --
+float(3)
+
+-- Iteration 26 --
+
+Warning: hypot() expects parameter 2 to be double, resource given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/is_finite_basic.phpt b/ext/standard/tests/math/is_finite_basic.phpt
new file mode 100644
index 0000000..85d2685
--- /dev/null
+++ b/ext/standard/tests/math/is_finite_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test is_finite() - basic function test is_finite()
+--FILE--
+<?php
+$values = array(234,
+ -234,
+ 23.45e1,
+ -23.45e1,
+ 0xEA,
+ 0352,
+ "234",
+ "234.5",
+ "23.45e1",
+ null,
+ true,
+ false,
+ pow(0, -2),
+ acos(1.01));
+;
+for ($i = 0; $i < count($values); $i++) {
+ $res = is_finite($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(false)
+
+
diff --git a/ext/standard/tests/math/is_finite_basiclong_64bit.phpt b/ext/standard/tests/math/is_finite_basiclong_64bit.phpt
new file mode 100644
index 0000000..bbc43f7
--- /dev/null
+++ b/ext/standard/tests/math/is_finite_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test is_finite function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(is_finite($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+bool(true)
+--- testing: -9223372036854775808 ---
+bool(true)
+--- testing: 2147483647 ---
+bool(true)
+--- testing: -2147483648 ---
+bool(true)
+--- testing: 9223372034707292160 ---
+bool(true)
+--- testing: -9223372034707292160 ---
+bool(true)
+--- testing: 2147483648 ---
+bool(true)
+--- testing: -2147483649 ---
+bool(true)
+--- testing: 4294967294 ---
+bool(true)
+--- testing: 4294967295 ---
+bool(true)
+--- testing: 4294967293 ---
+bool(true)
+--- testing: 9223372036854775806 ---
+bool(true)
+--- testing: 9.2233720368548E+18 ---
+bool(true)
+--- testing: -9223372036854775807 ---
+bool(true)
+--- testing: -9.2233720368548E+18 ---
+bool(true)
+===DONE===
diff --git a/ext/standard/tests/math/is_finite_error.phpt b/ext/standard/tests/math/is_finite_error.phpt
new file mode 100644
index 0000000..e265630
--- /dev/null
+++ b/ext/standard/tests/math/is_finite_error.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Test is_finite() - wrong params test is_finite()
+--FILE--
+<?php
+is_finite();
+is_finite(23,2,true);
+?>
+--EXPECTF--
+
+Warning: is_finite() expects exactly 1 parameter, 0 given in %s on line 2
+
+Warning: is_finite() expects exactly 1 parameter, 3 given in %s on line 3
+
diff --git a/ext/standard/tests/math/is_finite_variation1.phpt b/ext/standard/tests/math/is_finite_variation1.phpt
new file mode 100644
index 0000000..83786ad
--- /dev/null
+++ b/ext/standard/tests/math/is_finite_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test is_finite() function : usage variations - different data types as $val argument
+--FILE--
+<?php
+/* Prototype : bool is_finite ( float $val )
+ * Description: Finds whether a value is a legal finite number.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing is_finite() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of is_finite()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(is_finite($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing is_finite() : usage variations ***
+
+-- Iteration 1 --
+bool(true)
+
+-- Iteration 2 --
+bool(true)
+
+-- Iteration 3 --
+bool(true)
+
+-- Iteration 4 --
+bool(true)
+
+-- Iteration 5 --
+bool(true)
+
+-- Iteration 6 --
+bool(true)
+
+-- Iteration 7 --
+bool(true)
+
+-- Iteration 8 --
+bool(true)
+
+-- Iteration 9 --
+bool(true)
+
+-- Iteration 10 --
+bool(true)
+
+-- Iteration 11 --
+bool(true)
+
+-- Iteration 12 --
+bool(true)
+
+-- Iteration 13 --
+bool(true)
+
+-- Iteration 14 --
+bool(true)
+
+-- Iteration 15 --
+bool(true)
+
+-- Iteration 16 --
+bool(true)
+
+-- Iteration 17 --
+
+Warning: is_finite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: is_finite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: is_finite() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: is_finite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: is_finite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: is_finite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: is_finite() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+bool(true)
+
+-- Iteration 25 --
+bool(true)
+
+-- Iteration 26 --
+
+Warning: is_finite() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/is_infinite_basic.phpt b/ext/standard/tests/math/is_infinite_basic.phpt
new file mode 100644
index 0000000..ca79922
--- /dev/null
+++ b/ext/standard/tests/math/is_infinite_basic.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test is_infinite() - basic function test is_infinite()
+--FILE--
+<?php
+$values = array(234,
+ -234,
+ 23.45e1,
+ -23.45e1,
+ 0xEA,
+ 0352,
+ "234",
+ "234.5",
+ "23.45e1",
+ null,
+ true,
+ false,
+ pow(0, -2),
+ acos(1.01));
+;
+for ($i = 0; $i < count($values); $i++) {
+ $res = is_infinite($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+bool(false)
+
+
+
diff --git a/ext/standard/tests/math/is_infinite_basiclong_64bit.phpt b/ext/standard/tests/math/is_infinite_basiclong_64bit.phpt
new file mode 100644
index 0000000..ab15ec7
--- /dev/null
+++ b/ext/standard/tests/math/is_infinite_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test is_infinite function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(is_infinite($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+bool(false)
+--- testing: -9223372036854775808 ---
+bool(false)
+--- testing: 2147483647 ---
+bool(false)
+--- testing: -2147483648 ---
+bool(false)
+--- testing: 9223372034707292160 ---
+bool(false)
+--- testing: -9223372034707292160 ---
+bool(false)
+--- testing: 2147483648 ---
+bool(false)
+--- testing: -2147483649 ---
+bool(false)
+--- testing: 4294967294 ---
+bool(false)
+--- testing: 4294967295 ---
+bool(false)
+--- testing: 4294967293 ---
+bool(false)
+--- testing: 9223372036854775806 ---
+bool(false)
+--- testing: 9.2233720368548E+18 ---
+bool(false)
+--- testing: -9223372036854775807 ---
+bool(false)
+--- testing: -9.2233720368548E+18 ---
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/math/is_infinite_error.phpt b/ext/standard/tests/math/is_infinite_error.phpt
new file mode 100644
index 0000000..5d6ad9d
--- /dev/null
+++ b/ext/standard/tests/math/is_infinite_error.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Test is_infinite() - wrong params test is_infinite()
+--FILE--
+<?php
+is_infinite();
+is_infinite(23,2,true);
+?>
+--EXPECTF--
+
+Warning: is_infinite() expects exactly 1 parameter, 0 given in %s on line 2
+
+Warning: is_infinite() expects exactly 1 parameter, 3 given in %s on line 3
diff --git a/ext/standard/tests/math/is_infinite_variation1.phpt b/ext/standard/tests/math/is_infinite_variation1.phpt
new file mode 100644
index 0000000..0d8573d
--- /dev/null
+++ b/ext/standard/tests/math/is_infinite_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test is_infinite() function : usage variations - different data types as $val argument
+--FILE--
+<?php
+/* Prototype : bool is_finite ( float $val )
+ * Description: Finds whether a value is infinite.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing is_infinite() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of is_infinite()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(is_infinite($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing is_infinite() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+
+Warning: is_infinite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: is_infinite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: is_infinite() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: is_infinite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: is_infinite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: is_infinite() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: is_infinite() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+
+-- Iteration 26 --
+
+Warning: is_infinite() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/is_nan_basic.phpt b/ext/standard/tests/math/is_nan_basic.phpt
new file mode 100644
index 0000000..fb10737
--- /dev/null
+++ b/ext/standard/tests/math/is_nan_basic.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Test is_nan() - basic function test is_nan()
+--FILE--
+<?php
+$values = array(234,
+ -234,
+ 23.45e1,
+ -23.45e1,
+ 0xEA,
+ 0352,
+ "234",
+ "234.5",
+ "23.45e1",
+ null,
+ true,
+ false,
+ pow(0, -2),
+ acos(1.01));
+
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = is_nan($values[$i]);
+ var_dump($res);
+}
+
+?>
+
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(true)
+
+
+
diff --git a/ext/standard/tests/math/is_nan_basiclong_64bit.phpt b/ext/standard/tests/math/is_nan_basiclong_64bit.phpt
new file mode 100644
index 0000000..6f66d6b
--- /dev/null
+++ b/ext/standard/tests/math/is_nan_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test is_nan function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(is_nan($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+bool(false)
+--- testing: -9223372036854775808 ---
+bool(false)
+--- testing: 2147483647 ---
+bool(false)
+--- testing: -2147483648 ---
+bool(false)
+--- testing: 9223372034707292160 ---
+bool(false)
+--- testing: -9223372034707292160 ---
+bool(false)
+--- testing: 2147483648 ---
+bool(false)
+--- testing: -2147483649 ---
+bool(false)
+--- testing: 4294967294 ---
+bool(false)
+--- testing: 4294967295 ---
+bool(false)
+--- testing: 4294967293 ---
+bool(false)
+--- testing: 9223372036854775806 ---
+bool(false)
+--- testing: 9.2233720368548E+18 ---
+bool(false)
+--- testing: -9223372036854775807 ---
+bool(false)
+--- testing: -9.2233720368548E+18 ---
+bool(false)
+===DONE===
diff --git a/ext/standard/tests/math/is_nan_error.phpt b/ext/standard/tests/math/is_nan_error.phpt
new file mode 100644
index 0000000..7749e4e
--- /dev/null
+++ b/ext/standard/tests/math/is_nan_error.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Test is_nan() - wrong params test is_nan()
+--FILE--
+<?php
+is_nan();
+is_nan(23,2,true);
+?>
+--EXPECTF--
+
+Warning: is_nan() expects exactly 1 parameter, 0 given in %s on line 2
+
+Warning: is_nan() expects exactly 1 parameter, 3 given in %s on line 3
+
+
+
+
diff --git a/ext/standard/tests/math/is_nan_variation1.phpt b/ext/standard/tests/math/is_nan_variation1.phpt
new file mode 100644
index 0000000..3eb6429
--- /dev/null
+++ b/ext/standard/tests/math/is_nan_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test is_nan() function : usage variations - different data types as $val argument
+--FILE--
+<?php
+/* Prototype : bool is_nan ( float $val )
+ * Description: Finds whether a value is not a number.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing is_nan() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of is_nan()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(is_nan($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing is_nan() : usage variations ***
+
+-- Iteration 1 --
+bool(false)
+
+-- Iteration 2 --
+bool(false)
+
+-- Iteration 3 --
+bool(false)
+
+-- Iteration 4 --
+bool(false)
+
+-- Iteration 5 --
+bool(false)
+
+-- Iteration 6 --
+bool(false)
+
+-- Iteration 7 --
+bool(false)
+
+-- Iteration 8 --
+bool(false)
+
+-- Iteration 9 --
+bool(false)
+
+-- Iteration 10 --
+bool(false)
+
+-- Iteration 11 --
+bool(false)
+
+-- Iteration 12 --
+bool(false)
+
+-- Iteration 13 --
+bool(false)
+
+-- Iteration 14 --
+bool(false)
+
+-- Iteration 15 --
+bool(false)
+
+-- Iteration 16 --
+bool(false)
+
+-- Iteration 17 --
+
+Warning: is_nan() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: is_nan() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: is_nan() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: is_nan() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: is_nan() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: is_nan() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: is_nan() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+bool(false)
+
+-- Iteration 25 --
+bool(false)
+
+-- Iteration 26 --
+
+Warning: is_nan() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/lcg_value_basic.phpt b/ext/standard/tests/math/lcg_value_basic.phpt
new file mode 100644
index 0000000..6d624d8
--- /dev/null
+++ b/ext/standard/tests/math/lcg_value_basic.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Maths test for xapic versions of lcg_value()
+--FILE--
+<?php
+
+echo "MATHS test script started\n";
+
+
+echo "\n lcg_value tests...\n";
+for ($i = 0; $i < 100; $i++) {
+ $res = lcg_value();
+
+ if (!is_float($res) || $res < 0 || $res > 1) {
+ break;
+ }
+}
+
+if ($i != 100) {
+ echo "FAILED\n";
+} else {
+ echo "PASSED\n";
+}
+
+echo "\n lcg_value error cases..spurious args get ignored\n";
+$res = lcg_value(23);
+
+if (!is_float($res) || $res < 0 || $res > 1) {
+ echo "FAILED\n";
+} else {
+ echo "PASSED\n";
+}
+
+$res = lcg_value(10,false);
+if (!is_float($res) || $res < 0 || $res > 1) {
+ echo "FAILED\n";
+} else {
+ echo "PASSED\n";
+}
+
+echo "MATHS test script completed\n";
+
+?>
+
+--EXPECT--
+MATHS test script started
+
+ lcg_value tests...
+PASSED
+
+ lcg_value error cases..spurious args get ignored
+PASSED
+PASSED
+MATHS test script completed
+
+
+
diff --git a/ext/standard/tests/math/log.phpt b/ext/standard/tests/math/log.phpt
new file mode 100644
index 0000000..4f8b47a
--- /dev/null
+++ b/ext/standard/tests/math/log.phpt
@@ -0,0 +1,42 @@
+--TEST--
+log() tests
+--FILE--
+<?php // $Id$
+echo "On failure, please mail result to php-dev@lists.php.net\n";
+for ($x = 0, $count= 0; $x < 200; $x++) {
+ $x2 = (int) exp(log($x));
+ // e ^ log(x) should be close in range to x
+ if (($x2 < ($x + 2)) && ($x2 > ($x - 2))) {
+ $count++;
+ } else {
+ print "$x : $x2\n";
+ }
+}
+print $count . "\n";
+
+// Now test the base form of log
+for ($base = 2; $base < 11; $base++) {
+ for ($x = 0, $count= 0; $x < 50; $x++) {
+ $x2 = (int) pow($base, log($x, $base));
+ // base ^ log(x) should be close in range to x
+ if (($x2 < ($x + 2)) && ($x2 > ($x - 2))) {
+ $count++;
+ } else {
+ print "base $base: $x : $x2\n";
+ }
+ }
+ print $count . "\n";
+}
+?>
+--EXPECT--
+On failure, please mail result to php-dev@lists.php.net
+200
+50
+50
+50
+50
+50
+50
+50
+50
+50
diff --git a/ext/standard/tests/math/log10_basic.phpt b/ext/standard/tests/math/log10_basic.phpt
new file mode 100644
index 0000000..0877df2
--- /dev/null
+++ b/ext/standard/tests/math/log10_basic.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test return type and value for expected input log10()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float log10(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+$arg_0 = 1.0;
+$arg_1 = 10.0;
+$arg_2 = 100.0;
+
+echo "log10 $arg_0 = ";
+$r0 = log10($arg_0);
+var_dump($r0);
+if (allowed_rounding_error($r0 ,0.0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "log10 $arg_1 = ";
+$r1 = log10($arg_1);
+var_dump($r1);
+if (allowed_rounding_error($r1 ,1.0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "log10 $arg_2 = ";
+$r2 = log10($arg_2);
+var_dump($r2);
+if (allowed_rounding_error($r2 ,2.0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+?>
+--EXPECTF--
+log10 1 = float(%f)
+Pass
+log10 10 = float(%f)
+Pass
+log10 100 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/log10_basiclong_64bit.phpt b/ext/standard/tests/math/log10_basiclong_64bit.phpt
new file mode 100644
index 0000000..be1b7ef
--- /dev/null
+++ b/ext/standard/tests/math/log10_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test log10 function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(log10($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(18.964889726831)
+--- testing: -9223372036854775808 ---
+float(NAN)
+--- testing: 2147483647 ---
+float(9.3319298653812)
+--- testing: -2147483648 ---
+float(NAN)
+--- testing: 9223372034707292160 ---
+float(18.96488972673)
+--- testing: -9223372034707292160 ---
+float(NAN)
+--- testing: 2147483648 ---
+float(9.3319298655834)
+--- testing: -2147483649 ---
+float(NAN)
+--- testing: 4294967294 ---
+float(9.6329598610452)
+--- testing: 4294967295 ---
+float(9.6329598611463)
+--- testing: 4294967293 ---
+float(9.632959860944)
+--- testing: 9223372036854775806 ---
+float(18.964889726831)
+--- testing: 9.2233720368548E+18 ---
+float(18.964889726831)
+--- testing: -9223372036854775807 ---
+float(NAN)
+--- testing: -9.2233720368548E+18 ---
+float(NAN)
+===DONE===
diff --git a/ext/standard/tests/math/log10_error.phpt b/ext/standard/tests/math/log10_error.phpt
new file mode 100644
index 0000000..e3bc604
--- /dev/null
+++ b/ext/standard/tests/math/log10_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test wrong number of arguments for log10()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float log10(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(log10($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(log10());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: log10() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: log10() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/log10_variation.phpt b/ext/standard/tests/math/log10_variation.phpt
new file mode 100644
index 0000000..2325705
--- /dev/null
+++ b/ext/standard/tests/math/log10_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of log10()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float log10(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test log10 with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = log10($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(1.361727836)
+float(NAN)
+float(1.370142847)
+float(NAN)
+float(1.361727836)
+float(1.361727836)
+float(1.361727836)
+float(1.370142847)
+float(1.370142847)
+
+Warning: log10() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(3)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(3)
+float(-INF)
+float(0)
+float(-INF)
diff --git a/ext/standard/tests/math/log1p_basic.phpt b/ext/standard/tests/math/log1p_basic.phpt
new file mode 100644
index 0000000..b289418
--- /dev/null
+++ b/ext/standard/tests/math/log1p_basic.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test log1p() - basic function test log1p()
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float log1p ( float $arg )
+ * Description: Returns log(1 + number), computed in a way that is accurate even
+ * when the value of number is close to zero
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing log1p() : basic functionality ***\n";
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ null,
+ true,
+ false);
+
+echo "\n LOG1p tests\n";
+
+foreach($values as $value) {
+ echo "\n-- log1p $value --\n";
+ var_dump(log1p($value));
+};
+
+
+?>
+===Done===
+--EXPECTF--
+*** Testing log1p() : basic functionality ***
+
+ LOG1p tests
+
+-- log1p 23 --
+float(3.1780538303479)
+
+-- log1p -23 --
+float(NAN)
+
+-- log1p 23.45 --
+float(3.1966302159209)
+
+-- log1p -23.45 --
+float(NAN)
+
+-- log1p 23 --
+float(3.1780538303479)
+
+-- log1p 23 --
+float(3.1780538303479)
+
+-- log1p 23 --
+float(3.1780538303479)
+
+-- log1p 23.45 --
+float(3.1966302159209)
+
+-- log1p 2.345e1 --
+float(3.1966302159209)
+
+-- log1p --
+float(0)
+
+-- log1p 1 --
+float(0.69314718055995)
+
+-- log1p --
+float(0)
+===Done===
diff --git a/ext/standard/tests/math/log1p_basiclong_64bit.phpt b/ext/standard/tests/math/log1p_basiclong_64bit.phpt
new file mode 100644
index 0000000..a0b32bd
--- /dev/null
+++ b/ext/standard/tests/math/log1p_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test log1p function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(log1p($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(43.668272375277)
+--- testing: -9223372036854775808 ---
+float(NAN)
+--- testing: 2147483647 ---
+float(21.487562597358)
+--- testing: -2147483648 ---
+float(NAN)
+--- testing: 9223372034707292160 ---
+float(43.668272375044)
+--- testing: -9223372034707292160 ---
+float(NAN)
+--- testing: 2147483648 ---
+float(21.487562597824)
+--- testing: -2147483649 ---
+float(NAN)
+--- testing: 4294967294 ---
+float(22.180709777685)
+--- testing: 4294967295 ---
+float(22.180709777918)
+--- testing: 4294967293 ---
+float(22.180709777453)
+--- testing: 9223372036854775806 ---
+float(43.668272375277)
+--- testing: 9.2233720368548E+18 ---
+float(43.668272375277)
+--- testing: -9223372036854775807 ---
+float(NAN)
+--- testing: -9.2233720368548E+18 ---
+float(NAN)
+===DONE===
diff --git a/ext/standard/tests/math/log1p_error.phpt b/ext/standard/tests/math/log1p_error.phpt
new file mode 100644
index 0000000..e0b01a1
--- /dev/null
+++ b/ext/standard/tests/math/log1p_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test log1p() - Error conditions
+--FILE--
+<?php
+/* Prototype : float log1p ( float $arg )
+ * Description: Returns log(1 + number), computed in a way that is accurate even
+ * when the value of number is close to zero
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing log1p() : error conditions ***\n";
+
+echo "\n-- Testing log1p() function with less than expected no. of arguments --\n";
+log1p();
+echo "\n-- Testing log1p() function with more than expected no. of arguments --\n";
+log1p(36, true);
+?>
+===Done===
+--EXPECTF--
+*** Testing log1p() : error conditions ***
+
+-- Testing log1p() function with less than expected no. of arguments --
+
+Warning: log1p() expects exactly 1 parameter, 0 given in %s on line %d
+
+-- Testing log1p() function with more than expected no. of arguments --
+
+Warning: log1p() expects exactly 1 parameter, 2 given in %s on line %d
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/log1p_variation1.phpt b/ext/standard/tests/math/log1p_variation1.phpt
new file mode 100644
index 0000000..d36b878
--- /dev/null
+++ b/ext/standard/tests/math/log1p_variation1.phpt
@@ -0,0 +1,191 @@
+--TEST--
+Test log1p() function : usage variations - different data types as $arg argument
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float log1p ( float $arg )
+ * Description: Returns log(1 + number), computed in a way that is accurate even
+ * when the value of number is close to zero
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing log1p() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+ -2147483648,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789E4,
+ 12.3456789E-4,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*24*/ new classA(),
+
+ // undefined data
+/*25*/ @$undefined_var,
+
+ // unset data
+/*26*/ @$unset_var,
+
+ // resource variable
+/*27*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of log1p()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(log1p($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing log1p() : usage variations ***
+
+-- Iteration 1 --
+float(0)
+
+-- Iteration 2 --
+float(0.69314718055995)
+
+-- Iteration 3 --
+float(9.4210874029538)
+
+-- Iteration 4 --
+float(NAN)
+
+-- Iteration 5 --
+float(21.487562597358)
+
+-- Iteration 6 --
+float(NAN)
+
+-- Iteration 7 --
+float(2.4423470353692)
+
+-- Iteration 8 --
+float(NAN)
+
+-- Iteration 9 --
+float(11.723654587153)
+
+-- Iteration 10 --
+float(0.0012338064377078)
+
+-- Iteration 11 --
+float(0.40546510810816)
+
+-- Iteration 12 --
+float(0)
+
+-- Iteration 13 --
+float(0)
+
+-- Iteration 14 --
+float(0.69314718055995)
+
+-- Iteration 15 --
+float(0)
+
+-- Iteration 16 --
+float(0.69314718055995)
+
+-- Iteration 17 --
+float(0)
+
+-- Iteration 18 --
+
+Warning: log1p() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: log1p() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: log1p() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: log1p() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: log1p() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: log1p() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: log1p() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 25 --
+float(0)
+
+-- Iteration 26 --
+float(0)
+
+-- Iteration 27 --
+
+Warning: log1p() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/log_basic.phpt b/ext/standard/tests/math/log_basic.phpt
new file mode 100644
index 0000000..e2f9c9f
--- /dev/null
+++ b/ext/standard/tests/math/log_basic.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test log() - basic function test log()
+--INI--
+precision=14
+--FILE--
+<?php
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ null,
+ true,
+ false);
+
+echo "\n LOG tests...no base\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = log($values[$i]);
+ var_dump($res);
+}
+
+echo "\n LOG tests...base\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = log($values[$i], 4);
+ var_dump($res);
+}
+?>
+
+--EXPECTF--
+ LOG tests...no base
+float(3.1354942159291)
+float(NAN)
+float(3.1548704948923)
+float(NAN)
+float(3.1354942159291)
+float(3.1354942159291)
+float(3.1354942159291)
+float(3.1548704948923)
+float(3.1548704948923)
+float(-INF)
+float(0)
+float(-INF)
+
+ LOG tests...base
+float(2.2617809780285)
+float(NAN)
+float(2.275758008814)
+float(NAN)
+float(2.2617809780285)
+float(2.2617809780285)
+float(2.2617809780285)
+float(2.275758008814)
+float(2.275758008814)
+float(-INF)
+float(0)
+float(-INF)
diff --git a/ext/standard/tests/math/log_basiclong_64bit.phpt b/ext/standard/tests/math/log_basiclong_64bit.phpt
new file mode 100644
index 0000000..9a8f8a6
--- /dev/null
+++ b/ext/standard/tests/math/log_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test log function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(log($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(43.668272375277)
+--- testing: -9223372036854775808 ---
+float(NAN)
+--- testing: 2147483647 ---
+float(21.487562596893)
+--- testing: -2147483648 ---
+float(NAN)
+--- testing: 9223372034707292160 ---
+float(43.668272375044)
+--- testing: -9223372034707292160 ---
+float(NAN)
+--- testing: 2147483648 ---
+float(21.487562597358)
+--- testing: -2147483649 ---
+float(NAN)
+--- testing: 4294967294 ---
+float(22.180709777453)
+--- testing: 4294967295 ---
+float(22.180709777685)
+--- testing: 4294967293 ---
+float(22.18070977722)
+--- testing: 9223372036854775806 ---
+float(43.668272375277)
+--- testing: 9.2233720368548E+18 ---
+float(43.668272375277)
+--- testing: -9223372036854775807 ---
+float(NAN)
+--- testing: -9.2233720368548E+18 ---
+float(NAN)
+===DONE===
diff --git a/ext/standard/tests/math/log_error.phpt b/ext/standard/tests/math/log_error.phpt
new file mode 100644
index 0000000..48a23df
--- /dev/null
+++ b/ext/standard/tests/math/log_error.phpt
@@ -0,0 +1,16 @@
+--TEST--
+Test log() - wrong params test log()
+--INI--
+precision=14
+--FILE--
+<?php
+log();
+log(36,4,true);
+log(36, -4);
+?>
+--EXPECTF--
+Warning: log() expects at least 1 parameter, 0 given in %s on line %d
+
+Warning: log() expects at most 2 parameters, 3 given in %s on line %d
+
+Warning: log(): base must be greater than 0 in %s on line %d
diff --git a/ext/standard/tests/math/log_variation1.phpt b/ext/standard/tests/math/log_variation1.phpt
new file mode 100644
index 0000000..8925047
--- /dev/null
+++ b/ext/standard/tests/math/log_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test log() function : usage variations - different data types as $arg argument
+--FILE--
+<?php
+/* Prototype : float log ( float $arg [, float $base ] )
+ * Description: Natural logarithm.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing log() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of log()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(log($input, 10));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing log() : usage variations ***
+
+-- Iteration 1 --
+float(-INF)
+
+-- Iteration 2 --
+float(0)
+
+-- Iteration 3 --
+float(4.091491094268)
+
+-- Iteration 4 --
+float(NAN)
+
+-- Iteration 5 --
+float(9.3319298653812)
+
+-- Iteration 6 --
+float(1.0211892990699)
+
+-- Iteration 7 --
+float(NAN)
+
+-- Iteration 8 --
+float(11.091514977169)
+
+-- Iteration 9 --
+float(-8.9084850228307)
+
+-- Iteration 10 --
+float(-0.30102999566398)
+
+-- Iteration 11 --
+float(-INF)
+
+-- Iteration 12 --
+float(-INF)
+
+-- Iteration 13 --
+float(0)
+
+-- Iteration 14 --
+float(-INF)
+
+-- Iteration 15 --
+float(0)
+
+-- Iteration 16 --
+float(-INF)
+
+-- Iteration 17 --
+
+Warning: log() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: log() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: log() expects parameter 1 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: log() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: log() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: log() expects parameter 1 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: log() expects parameter 1 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(-INF)
+
+-- Iteration 25 --
+float(-INF)
+
+-- Iteration 26 --
+
+Warning: log() expects parameter 1 to be double, resource given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/log_variation2.phpt b/ext/standard/tests/math/log_variation2.phpt
new file mode 100644
index 0000000..327e7c5
--- /dev/null
+++ b/ext/standard/tests/math/log_variation2.phpt
@@ -0,0 +1,202 @@
+--TEST--
+Test log() function : usage variations - different data types as $base argument
+--FILE--
+<?php
+/* Prototype : float log ( float $arg [, float $base ] )
+ * Description: Natural logarithm.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing log() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of log()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(log(3.14, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing log() : usage variations ***
+
+-- Iteration 1 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 2 --
+float(NAN)
+
+-- Iteration 3 --
+float(0.12145441273706)
+
+-- Iteration 4 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 5 --
+float(0.053250469650086)
+
+-- Iteration 6 --
+float(0.48661854224853)
+
+-- Iteration 7 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 8 --
+float(0.044802684673473)
+
+-- Iteration 9 --
+float(-0.055781611216686)
+
+-- Iteration 10 --
+float(-1.6507645591169)
+
+-- Iteration 11 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 12 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 13 --
+float(NAN)
+
+-- Iteration 14 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 15 --
+float(NAN)
+
+-- Iteration 16 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 17 --
+
+Warning: log() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: log() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: log() expects parameter 2 to be double, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: log() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: log() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: log() expects parameter 2 to be double, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: log() expects parameter 2 to be double, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 25 --
+
+Warning: log(): base must be greater than 0 in %s on line %d
+bool(false)
+
+-- Iteration 26 --
+
+Warning: log() expects parameter 2 to be double, resource given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/mt_getrandmax_basic.phpt b/ext/standard/tests/math/mt_getrandmax_basic.phpt
new file mode 100644
index 0000000..29a30d0
--- /dev/null
+++ b/ext/standard/tests/math/mt_getrandmax_basic.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Test mt_getrandmax() - basic function test mt_getrandmax()
+--FILE--
+<?php
+var_dump(mt_getrandmax());
+?>
+--EXPECTF--
+int(%d) \ No newline at end of file
diff --git a/ext/standard/tests/math/mt_getrandmax_error.phpt b/ext/standard/tests/math/mt_getrandmax_error.phpt
new file mode 100644
index 0000000..fc6adb8
--- /dev/null
+++ b/ext/standard/tests/math/mt_getrandmax_error.phpt
@@ -0,0 +1,9 @@
+--TEST--
+Test mt_getrandmax() - wrong paramas mt_getrandmax()
+--FILE--
+<?php
+var_dump(mt_getrandmax(true));
+?>
+--EXPECTF--
+Warning: mt_getrandmax() expects exactly 0 parameters, 1 given in %s on line 2
+NULL \ No newline at end of file
diff --git a/ext/standard/tests/math/mt_rand_basic.phpt b/ext/standard/tests/math/mt_rand_basic.phpt
new file mode 100644
index 0000000..8b6b3cb
--- /dev/null
+++ b/ext/standard/tests/math/mt_rand_basic.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test mt_rand() - basic function test mt_rand()
+--FILE--
+<?php
+$default_max = mt_getrandmax();
+
+echo "\nmt_rand() tests with default min and max value (i.e 0 thru ", $default_max, ")\n";
+for ($i = 0; $i < 100; $i++) {
+ $res = mt_rand();
+
+// By default RAND_MAX is 32768 although no constant is defined for it for user space apps
+ if (!is_int($res) || $res < 0 || $res > $default_max) {
+ break;
+ }
+}
+
+if ($i != 100) {
+ echo "FAILED: res = ", $res, " min = 0 max = ", $default_max, "\n";
+} else {
+ echo "PASSED: range min = 0 max = ", $default_max, "\n";
+}
+
+echo "\nmt_rand() tests with defined min and max value\n";
+
+$min = array(10,
+ 100,
+ 10.5,
+ 10.5e3,
+ 0x10,
+ 0400);
+
+$max = array(100,
+ 1000,
+ 19.5,
+ 10.5e5,
+ 0x10000,
+ 0700);
+
+for ($x = 0; $x < count($min); $x++) {
+ for ($i = 0; $i < 100; $i++) {
+ $res = mt_rand($min[$x], $max[$x]);
+
+ if (!is_int($res) || $res < intval($min[$x]) || $res > intval($max[$x])) {
+ echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ break;
+ }
+ }
+
+ if ($i == 100) {
+ echo "PASSED: range min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ }
+}
+
+echo "\nNon-numeric cases\n";
+$min = array(true,
+ false,
+ null,
+ "10",
+ "0x10",
+ "10.5");
+
+// Eexepcted numerical equivalent of above non-numerics
+$minval = array(1,
+ 0,
+ 0,
+ 10,
+ 0,
+ 10);
+for ($x = 0; $x < count($min); $x++) {
+ for ($i = 0; $i < 100; $i++) {
+ $res = mt_rand($min[$x], 100);
+
+ if (!is_int($res) || $res < intval($minval[$x]) || $res > 100) {
+ echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ break;
+ }
+ }
+
+ if ($i == 100) {
+ echo "PASSED range min = ", intval($min[$x]), " max = 100\n";
+ }
+}
+?>
+--EXPECTF--
+mt_rand() tests with default min and max value (i.e 0 thru 2147483647)
+PASSED: range min = 0 max = 2147483647
+
+mt_rand() tests with defined min and max value
+PASSED: range min = 10 max = 100
+PASSED: range min = 100 max = 1000
+PASSED: range min = 10 max = 19
+PASSED: range min = 10500 max = 1050000
+PASSED: range min = 16 max = 65536
+PASSED: range min = 256 max = 448
+
+Non-numeric cases
+PASSED range min = 1 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 10 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 10 max = 100
diff --git a/ext/standard/tests/math/mt_rand_error.phpt b/ext/standard/tests/math/mt_rand_error.phpt
new file mode 100644
index 0000000..e0a8058
--- /dev/null
+++ b/ext/standard/tests/math/mt_rand_error.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test mt_rand() - wrong params test mt_rand()
+--FILE--
+<?php
+mt_rand(25);
+mt_rand(10,100,false);
+mt_rand("one", 100);
+mt_rand(1, "hundered");
+?>
+
+--EXPECTF--
+
+Warning: mt_rand() expects exactly 2 parameters, 1 given in %s on line 2
+
+Warning: mt_rand() expects exactly 2 parameters, 3 given in %s on line 3
+
+Warning: mt_rand() expects parameter 1 to be long, string given in %s on line 4
+
+Warning: mt_rand() expects parameter 2 to be long, string given in %s on line 5
diff --git a/ext/standard/tests/math/mt_rand_variation1.phpt b/ext/standard/tests/math/mt_rand_variation1.phpt
new file mode 100644
index 0000000..aa43716
--- /dev/null
+++ b/ext/standard/tests/math/mt_rand_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test rand() function : usage variations - different data types as $min argument
+--FILE--
+<?php
+/* Prototype : int mt_rand ([ int $min , int $max ] )
+ * Description: Generate a better random value.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing mt_rand() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000E8,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of mt_rand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mt_rand($input, mt_getrandmax()));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing mt_rand() : usage variations ***
+
+-- Iteration 1 --
+int(%i)
+
+-- Iteration 2 --
+int(%i)
+
+-- Iteration 3 --
+int(%i)
+
+-- Iteration 4 --
+int(%i)
+
+-- Iteration 5 --
+int(%i)
+
+-- Iteration 6 --
+int(%i)
+
+-- Iteration 7 --
+int(%i)
+
+-- Iteration 8 --
+int(%i)
+
+-- Iteration 9 --
+int(%i)
+
+-- Iteration 10 --
+int(%i)
+
+-- Iteration 11 --
+int(%i)
+
+-- Iteration 12 --
+int(%i)
+
+-- Iteration 13 --
+int(%i)
+
+-- Iteration 14 --
+int(%i)
+
+-- Iteration 15 --
+int(%i)
+
+-- Iteration 16 --
+int(%i)
+
+-- Iteration 17 --
+
+Warning: mt_rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: mt_rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: mt_rand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: mt_rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: mt_rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: mt_rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: mt_rand() expects parameter 1 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+int(%i)
+
+-- Iteration 25 --
+int(%i)
+
+-- Iteration 26 --
+
+Warning: mt_rand() expects parameter 1 to be long, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/mt_rand_variation2.phpt b/ext/standard/tests/math/mt_rand_variation2.phpt
new file mode 100644
index 0000000..2174a34
--- /dev/null
+++ b/ext/standard/tests/math/mt_rand_variation2.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test mt_rand() function : usage variations - different data types as $max argument
+--FILE--
+<?php
+/* Prototype : int mt_rand ([ int $min , int $max ] )
+ * Description: Generate a better random value.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing mt_rand) : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of mt_rand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mt_rand(-1 * mt_getrandmax(), $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing mt_rand) : usage variations ***
+
+-- Iteration 1 --
+int(%i)
+
+-- Iteration 2 --
+int(%i)
+
+-- Iteration 3 --
+int(%i)
+
+-- Iteration 4 --
+int(%i)
+
+-- Iteration 5 --
+int(%i)
+
+-- Iteration 6 --
+int(%i)
+
+-- Iteration 7 --
+int(%i)
+
+-- Iteration 8 --
+int(%i)
+
+-- Iteration 9 --
+int(%i)
+
+-- Iteration 10 --
+int(%i)
+
+-- Iteration 11 --
+int(%i)
+
+-- Iteration 12 --
+int(%i)
+
+-- Iteration 13 --
+int(%i)
+
+-- Iteration 14 --
+int(%i)
+
+-- Iteration 15 --
+int(%i)
+
+-- Iteration 16 --
+int(%i)
+
+-- Iteration 17 --
+
+Warning: mt_rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: mt_rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: mt_rand() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: mt_rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: mt_rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: mt_rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: mt_rand() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+int(%i)
+
+-- Iteration 25 --
+int(%i)
+
+-- Iteration 26 --
+
+Warning: mt_rand() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/mt_srand_basic.phpt b/ext/standard/tests/math/mt_srand_basic.phpt
new file mode 100644
index 0000000..e28b1b9
--- /dev/null
+++ b/ext/standard/tests/math/mt_srand_basic.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test mt_srand() - basic function (return values) mt_srand()
+--FILE--
+<?php
+// Should return NULL if given anything that it can convert to long
+// This doesn't actually test what it does with the input :-\
+var_dump(mt_srand());
+var_dump(mt_srand(500));
+var_dump(mt_srand(500.1));
+var_dump(mt_srand("500"));
+var_dump(mt_srand("500E3"));
+var_dump(mt_srand(true));
+var_dump(mt_srand(false));
+var_dump(mt_srand(NULL));
+?>
+--EXPECTF--
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL \ No newline at end of file
diff --git a/ext/standard/tests/math/mt_srand_error.phpt b/ext/standard/tests/math/mt_srand_error.phpt
new file mode 100644
index 0000000..5543d78
--- /dev/null
+++ b/ext/standard/tests/math/mt_srand_error.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Test mt_srand() - wrong params test mt_srand()
+--FILE--
+<?php
+var_dump(mt_srand(500, true));
+var_dump(mt_srand("fivehundred"));
+var_dump(mt_srand("500ABC"));
+?>
+--EXPECTF--
+Warning: mt_srand() expects at most 1 parameter, 2 given in %s on line 2
+NULL
+
+Warning: mt_srand() expects parameter 1 to be long, string given in %s on line 3
+NULL
+
+Notice: A non well formed numeric value encountered in %s on line 4
+NULL
+
+
+
diff --git a/ext/standard/tests/math/mt_srand_variation1.phpt b/ext/standard/tests/math/mt_srand_variation1.phpt
new file mode 100644
index 0000000..feb0b37
--- /dev/null
+++ b/ext/standard/tests/math/mt_srand_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test mt_srand() function : usage variations - different data types as $seed argument
+--FILE--
+<?php
+/* Prototype : void mt_srand ([ int $seed ] )
+ * Description: Seed the better random number generator.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing mt_srand() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of mt_srand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(mt_srand($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing mt_srand() : usage variations ***
+
+-- Iteration 1 --
+NULL
+
+-- Iteration 2 --
+NULL
+
+-- Iteration 3 --
+NULL
+
+-- Iteration 4 --
+NULL
+
+-- Iteration 5 --
+NULL
+
+-- Iteration 6 --
+NULL
+
+-- Iteration 7 --
+NULL
+
+-- Iteration 8 --
+NULL
+
+-- Iteration 9 --
+NULL
+
+-- Iteration 10 --
+NULL
+
+-- Iteration 11 --
+NULL
+
+-- Iteration 12 --
+NULL
+
+-- Iteration 13 --
+NULL
+
+-- Iteration 14 --
+NULL
+
+-- Iteration 15 --
+NULL
+
+-- Iteration 16 --
+NULL
+
+-- Iteration 17 --
+
+Warning: mt_srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: mt_srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: mt_srand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: mt_srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: mt_srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: mt_srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: mt_srand() expects parameter 1 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+NULL
+
+-- Iteration 25 --
+NULL
+
+-- Iteration 26 --
+
+Warning: mt_srand() expects parameter 1 to be long, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/number_format_basic.phpt b/ext/standard/tests/math/number_format_basic.phpt
new file mode 100644
index 0000000..7f5f4be
--- /dev/null
+++ b/ext/standard/tests/math/number_format_basic.phpt
@@ -0,0 +1,97 @@
+--TEST--
+Test number_format() - basic function test number_format()
+--FILE--
+<?php
+$values = array(1234.5678,
+ -1234.5678,
+ 1234.6578e4,
+ -1234.56789e4,
+ 0x1234CDEF,
+ 02777777777,
+ "123456789",
+ "123.456789",
+ "12.3456789e1",
+ null,
+ true,
+ false);
+
+echo "\n number_format tests.....default\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i]);
+ var_dump($res);
+}
+
+echo "\n number_format tests.....with two dp\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i], 2);
+ var_dump($res);
+}
+
+echo "\n number_format tests.....English format\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i], 2, '.', ' ');
+ var_dump($res);
+}
+
+echo "\n number_format tests.....French format\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i], 2, ',' , ' ');
+ var_dump($res);
+}
+?>
+--EXPECTF--
+ number_format tests.....default
+string(5) "1,235"
+string(6) "-1,235"
+string(10) "12,346,578"
+string(11) "-12,345,679"
+string(11) "305,450,479"
+string(11) "402,653,183"
+string(11) "123,456,789"
+string(3) "123"
+string(3) "123"
+string(1) "0"
+string(1) "1"
+string(1) "0"
+
+ number_format tests.....with two dp
+string(8) "1,234.57"
+string(9) "-1,234.57"
+string(13) "12,346,578.00"
+string(14) "-12,345,678.90"
+string(14) "305,450,479.00"
+string(14) "402,653,183.00"
+string(14) "123,456,789.00"
+string(6) "123.46"
+string(6) "123.46"
+string(4) "0.00"
+string(4) "1.00"
+string(4) "0.00"
+
+ number_format tests.....English format
+string(8) "1 234.57"
+string(9) "-1 234.57"
+string(13) "12 346 578.00"
+string(14) "-12 345 678.90"
+string(14) "305 450 479.00"
+string(14) "402 653 183.00"
+string(14) "123 456 789.00"
+string(6) "123.46"
+string(6) "123.46"
+string(4) "0.00"
+string(4) "1.00"
+string(4) "0.00"
+
+ number_format tests.....French format
+string(8) "1 234,57"
+string(9) "-1 234,57"
+string(13) "12 346 578,00"
+string(14) "-12 345 678,90"
+string(14) "305 450 479,00"
+string(14) "402 653 183,00"
+string(14) "123 456 789,00"
+string(6) "123,46"
+string(6) "123,46"
+string(4) "0,00"
+string(4) "1,00"
+string(4) "0,00"
diff --git a/ext/standard/tests/math/number_format_multichar.phpt b/ext/standard/tests/math/number_format_multichar.phpt
new file mode 100644
index 0000000..ae36d12
--- /dev/null
+++ b/ext/standard/tests/math/number_format_multichar.phpt
@@ -0,0 +1,77 @@
+--TEST--
+Test number_format() - multiple character separator support
+--FILE--
+<?php
+$values = array(1234.5678,
+ -1234.5678,
+ 1234.6578e4,
+ -1234.56789e4,
+ 0x1234CDEF,
+ 02777777777,
+ "123456789",
+ "123.456789",
+ "12.3456789e1",
+ null,
+ true,
+ false);
+
+echo " number_format tests.....multiple character decimal point\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i], 2, '&#183;', ' ');
+ var_dump($res);
+}
+
+echo "\n number_format tests.....multiple character thousand separator\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i], 2, '.' , '&thinsp;');
+ var_dump($res);
+}
+
+echo "\n number_format tests.....multiple character decimal and thousep\n";
+for ($i = 0; $i < count($values); $i++) {
+ $res = number_format($values[$i], 2, '&#183;' , '&thinsp;');
+ var_dump($res);
+}
+?>
+--EXPECTF--
+ number_format tests.....multiple character decimal point
+string(13) "1 234&#183;57"
+string(14) "-1 234&#183;57"
+string(18) "12 346 578&#183;00"
+string(19) "-12 345 678&#183;90"
+string(19) "305 450 479&#183;00"
+string(19) "402 653 183&#183;00"
+string(19) "123 456 789&#183;00"
+string(11) "123&#183;46"
+string(11) "123&#183;46"
+string(9) "0&#183;00"
+string(9) "1&#183;00"
+string(9) "0&#183;00"
+
+ number_format tests.....multiple character thousand separator
+string(15) "1&thinsp;234.57"
+string(16) "-1&thinsp;234.57"
+string(27) "12&thinsp;346&thinsp;578.00"
+string(28) "-12&thinsp;345&thinsp;678.90"
+string(28) "305&thinsp;450&thinsp;479.00"
+string(28) "402&thinsp;653&thinsp;183.00"
+string(28) "123&thinsp;456&thinsp;789.00"
+string(6) "123.46"
+string(6) "123.46"
+string(4) "0.00"
+string(4) "1.00"
+string(4) "0.00"
+
+ number_format tests.....multiple character decimal and thousep
+string(20) "1&thinsp;234&#183;57"
+string(21) "-1&thinsp;234&#183;57"
+string(32) "12&thinsp;346&thinsp;578&#183;00"
+string(33) "-12&thinsp;345&thinsp;678&#183;90"
+string(33) "305&thinsp;450&thinsp;479&#183;00"
+string(33) "402&thinsp;653&thinsp;183&#183;00"
+string(33) "123&thinsp;456&thinsp;789&#183;00"
+string(11) "123&#183;46"
+string(11) "123&#183;46"
+string(9) "0&#183;00"
+string(9) "1&#183;00"
+string(9) "0&#183;00"
diff --git a/ext/standard/tests/math/octdec_basic.phpt b/ext/standard/tests/math/octdec_basic.phpt
new file mode 100644
index 0000000..8fd57ec
--- /dev/null
+++ b/ext/standard/tests/math/octdec_basic.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test octdec() - basic function test octdec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+$values = array(01234567,
+ 0567,
+ 017777777777,
+ 020000000000,
+ 0x1234ABC,
+ 12345,
+ '01234567',
+ '0567',
+ '017777777777',
+ '020000000000',
+ '0x1234ABC',
+ '12345',
+ 31101.3,
+ 31.1013e5,
+ true,
+ false,
+ null);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = octdec($values[$i]);
+ var_dump($res);
+}
+?>
+--EXPECTF--
+int(14489)
+int(253)
+int(36947879)
+int(4618484)
+int(4104)
+int(5349)
+int(342391)
+int(375)
+int(2147483647)
+float(2147483648)
+int(668)
+int(5349)
+int(102923)
+int(823384)
+int(1)
+int(0)
+int(0) \ No newline at end of file
diff --git a/ext/standard/tests/math/octdec_basic_64bit.phpt b/ext/standard/tests/math/octdec_basic_64bit.phpt
new file mode 100644
index 0000000..98996dc
--- /dev/null
+++ b/ext/standard/tests/math/octdec_basic_64bit.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test octdec() - basic function test octdec()
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+echo "*** Testing octdec() : basic functionality ***\n";
+
+$values = array(01234567,
+ 0567,
+ 017777777777,
+ 020000000000,
+ 0x1234ABC,
+ 12345,
+ '01234567',
+ '0567',
+ '017777777777',
+ '020000000000',
+ '0x1234ABC',
+ '12345',
+ 31101.3,
+ 31.1013e5,
+ true,
+ false,
+ null);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = octdec($values[$i]);
+ var_dump($res);
+}
+?>
+===Done===
+--EXPECTF--
+*** Testing octdec() : basic functionality ***
+int(14489)
+int(253)
+int(36947879)
+int(4618484)
+int(4104)
+int(5349)
+int(342391)
+int(375)
+int(2147483647)
+int(2147483648)
+int(668)
+int(5349)
+int(102923)
+int(823384)
+int(1)
+int(0)
+int(0)
+===Done===
diff --git a/ext/standard/tests/math/octdec_basiclong_64bit.phpt b/ext/standard/tests/math/octdec_basiclong_64bit.phpt
new file mode 100644
index 0000000..651b09d
--- /dev/null
+++ b/ext/standard/tests/math/octdec_basiclong_64bit.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test octdec function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$octLongStrs = array(
+ '777777777777777777777',
+ '1777777777777777777777',
+ '17777777777',
+ '37777777777',
+ '377777777777777777777777',
+ '17777777777777777777777777',
+ '377777777777',
+ '777777777777',
+);
+
+
+foreach ($octLongStrs as $strVal) {
+ echo "--- testing: $strVal ---\n";
+ var_dump(octdec($strVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 777777777777777777777 ---
+int(9223372036854775807)
+--- testing: 1777777777777777777777 ---
+float(1.844674407371E+19)
+--- testing: 17777777777 ---
+int(2147483647)
+--- testing: 37777777777 ---
+int(4294967295)
+--- testing: 377777777777777777777777 ---
+float(2.3611832414348E+21)
+--- testing: 17777777777777777777777777 ---
+float(7.5557863725914E+22)
+--- testing: 377777777777 ---
+int(34359738367)
+--- testing: 777777777777 ---
+int(68719476735)
+===DONE===
diff --git a/ext/standard/tests/math/octdec_error.phpt b/ext/standard/tests/math/octdec_error.phpt
new file mode 100644
index 0000000..5d21383
--- /dev/null
+++ b/ext/standard/tests/math/octdec_error.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test octdec() - wrong params test octdec()
+--FILE--
+<?php
+/* Prototype : number octdec ( string $octal_string )
+ * Description: Returns the decimal equivalent of the octal number represented by the octal_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing octdec() : error conditions ***\n";
+
+// get a class
+class classA
+{
+}
+
+echo "\n-- Incorrect number of arguments --\n";
+octdec();
+octdec('0123567',true);
+
+echo "\n-- Incorrect input --\n";
+octdec(new classA());
+
+
+?>
+--EXPECTF--
+*** Testing octdec() : error conditions ***
+
+-- Incorrect number of arguments --
+
+Warning: octdec() expects exactly 1 parameter, 0 given in %s on line %d
+
+Warning: octdec() expects exactly 1 parameter, 2 given in %s on line %d
+
+-- Incorrect input --
+
+Catchable fatal error: Object of class classA could not be converted to string in %s on line %d \ No newline at end of file
diff --git a/ext/standard/tests/math/octdec_variation1.phpt b/ext/standard/tests/math/octdec_variation1.phpt
new file mode 100644
index 0000000..1171196
--- /dev/null
+++ b/ext/standard/tests/math/octdec_variation1.phpt
@@ -0,0 +1,164 @@
+--TEST--
+Test octdec() function : usage variations - different data types as $octal_string arg
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : number octdec ( string $octal_string )
+ * Description: Returns the decimal equivalent of the octal number represented by the octal_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing octdec() : usage variations ***\n";
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 4294967295, // largest decimal
+ 4294967296,
+
+ // float data
+/*7*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*12*/ NULL,
+ null,
+
+ // boolean data
+/*14*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*18*/ "",
+ '',
+ array(),
+
+ // string data
+/*21*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of octdec()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(octdec($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+---Done---
+--EXPECTF--
+*** Testing octdec() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+int(5349)
+
+-- Iteration 4 --
+int(1253)
+
+-- Iteration 5 --
+int(1134037)
+
+-- Iteration 6 --
+int(1134038)
+
+-- Iteration 7 --
+int(69)
+
+-- Iteration 8 --
+int(69)
+
+-- Iteration 9 --
+int(175304192)
+
+-- Iteration 10 --
+int(342391)
+
+-- Iteration 11 --
+int(5)
+
+-- Iteration 12 --
+int(0)
+
+-- Iteration 13 --
+int(0)
+
+-- Iteration 14 --
+int(1)
+
+-- Iteration 15 --
+int(0)
+
+-- Iteration 16 --
+int(1)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+int(0)
+
+-- Iteration 19 --
+int(0)
+
+-- Iteration 20 --
+
+Notice: Array to string conversion in %s on line %d
+int(0)
+
+-- Iteration 21 --
+int(0)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+int(0)
+
+-- Iteration 24 --
+int(0)
+
+-- Iteration 25 --
+int(0)
+
+-- Iteration 26 --
+int(%d)
+---Done---
diff --git a/ext/standard/tests/math/pi_basic.phpt b/ext/standard/tests/math/pi_basic.phpt
new file mode 100644
index 0000000..fec5691
--- /dev/null
+++ b/ext/standard/tests/math/pi_basic.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Test pi() - basic function test pi()
+--INI--
+precision=14
+--FILE--
+<?php
+echo pi(), "\n";
+echo M_PI, "\n";
+// N.B pi() ignores all specified arguments no error
+// messages are produced if arguments are spcified.
+?>
+--EXPECTF--
+3.1415926535898
+3.1415926535898
diff --git a/ext/standard/tests/math/pow.phpt b/ext/standard/tests/math/pow.phpt
new file mode 100644
index 0000000..a1e8944
--- /dev/null
+++ b/ext/standard/tests/math/pow.phpt
@@ -0,0 +1,149 @@
+--TEST--
+Various pow() tests
+--FILE--
+<?php // $Id$
+
+define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
+define('LONG_MIN', -LONG_MAX - 1);
+printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
+ is_int(LONG_MIN-1),is_int(LONG_MAX+1));
+
+$tests = <<<TESTS
+ 0.25 === pow(-2,-2)
+-0.5 === pow(-2,-1)
+ 1 === pow(-2, 0)
+-2 === pow(-2, 1)
+ 4 === pow(-2, 2)
+ 1.0 === pow(-1,-2)
+-1.0 === pow(-1,-1)
+ 1 === pow(-1, 0)
+-1 === pow(-1, 1)
+ 1 === pow(-1, 2)
+ TRUE === is_infinite(pow(0,-2))
+ TRUE === is_infinite(pow(0,-1))
+ 1 === pow( 0, 0)
+ 0 === pow( 0, 1)
+ 0 === pow( 0, 2)
+ 1.0 === pow( 1,-2)
+ 1.0 === pow( 1,-1)
+ 1 === pow( 1, 0)
+ 1 === pow( 1, 1)
+ 1 === pow( 1, 2)
+ 0.25 === pow( 2,-2)
+ 0.5 === pow( 2,-1)
+ 1 === pow( 2, 0)
+ 2 === pow( 2, 1)
+ 4 === pow( 2, 2)
+ 0.25 === pow(-2,-2.0)
+-0.5 === pow(-2,-1.0)
+ 1.0 === pow(-2, 0.0)
+-2.0 === pow(-2, 1.0)
+ 4.0 === pow(-2, 2.0)
+ 1.0 === pow(-1,-2.0)
+-1.0 === pow(-1,-1.0)
+ 1.0 === pow(-1, 0.0)
+-1.0 === pow(-1, 1.0)
+ 1.0 === pow(-1, 2.0)
+ TRUE === is_infinite(pow(0,-2.0))
+ TRUE === is_infinite(pow(0,-1.0))
+ 1.0 === pow( 0, 0.0)
+ 0.0 === pow( 0, 1.0)
+ 0.0 === pow( 0, 2.0)
+ 1.0 === pow( 1,-2.0)
+ 1.0 === pow( 1,-1.0)
+ 1.0 === pow( 1, 0.0)
+ 1.0 === pow( 1, 1.0)
+ 1.0 === pow( 1, 2.0)
+ 0.25 === pow( 2,-2.0)
+ 0.5 === pow( 2,-1.0)
+ 1.0 === pow( 2, 0.0)
+ 2.0 === pow( 2, 1.0)
+ 4.0 === pow( 2, 2.0)
+ 2147483648 === pow(2,31)
+-2147483648 ~== pow(-2,31)
+ 1000000000 === pow(10,9)
+ 100000000 === pow(-10,8)
+ 1 === pow(-1,1443279822)
+-1 === pow(-1,1443279821)
+sqrt(2) ~== pow(2,1/2)
+ 0.25 === pow(-2.0,-2.0)
+-0.5 === pow(-2.0,-1.0)
+ 1.0 === pow(-2.0, 0.0)
+-2.0 === pow(-2.0, 1.0)
+ 4.0 === pow(-2.0, 2.0)
+ 1.0 === pow(-1.0,-2.0)
+-1.0 === pow(-1.0,-1.0)
+ 1.0 === pow(-1.0, 0.0)
+-1.0 === pow(-1.0, 1.0)
+ 1.0 === pow(-1.0, 2.0)
+ TRUE === is_infinite(pow(0.0,-2.0))
+ TRUE === is_infinite(pow(0.0,-1.0))
+ 1.0 === pow( 0.0, 0.0)
+ 0.0 === pow( 0.0, 1.0)
+ 0.0 === pow( 0.0, 2.0)
+ 1.0 === pow( 1.0,-2.0)
+ 1.0 === pow( 1.0,-1.0)
+ 1.0 === pow( 1.0, 0.0)
+ 1.0 === pow( 1.0, 1.0)
+ 1.0 === pow( 1.0, 2.0)
+ 0.25 === pow( 2.0,-2.0)
+ 0.5 === pow( 2.0,-1.0)
+ 1.0 === pow( 2.0, 0.0)
+ 2.0 === pow( 2.0, 1.0)
+ 4.0 === pow( 2.0, 2.0)
+ 0.25 === pow(-2.0,-2)
+-0.5 === pow(-2.0,-1)
+ 1.0 === pow(-2.0, 0)
+-2.0 === pow(-2.0, 1)
+ 4.0 === pow(-2.0, 2)
+ 1.0 === pow(-1.0,-2)
+-1.0 === pow(-1.0,-1)
+ 1.0 === pow(-1.0, 0)
+-1.0 === pow(-1.0, 1)
+ 1.0 === pow(-1.0, 2)
+ TRUE === is_infinite(pow( 0.0,-2))
+ TRUE === is_infinite(pow( 0.0,-1))
+ 1.0 === pow( 0.0, 0)
+ 0.0 === pow( 0.0, 1)
+ 0.0 === pow( 0.0, 2)
+ 1.0 === pow( 1.0,-2)
+ 1.0 === pow( 1.0,-1)
+ 1.0 === pow( 1.0, 0)
+ 1.0 === pow( 1.0, 1)
+ 1.0 === pow( 1.0, 2)
+ 0.25 === pow( 2.0,-2)
+ 0.5 === pow( 2.0,-1)
+ 1.0 === pow( 2.0, 0)
+ 2.0 === pow( 2.0, 1)
+ 4.0 === pow( 2.0, 2)
+ 2.0 === pow( 4, 0.5)
+ 2.0 === pow( 4.0, 0.5)
+ 3.0 === pow( 27, 1/3)
+ 3.0 === pow(27.0, 1/3)
+ 0.5 === pow( 4, -0.5)
+ 0.5 === pow( 4.0, -0.5)
+LONG_MAX-1 === pow(LONG_MAX-1,1)
+LONG_MIN+1 === pow(LONG_MIN+1,1)
+(LONG_MAX-1)*(LONG_MAX-1) ~== pow(LONG_MAX-1,2)
+(LONG_MIN+1)*(LONG_MIN+1) ~== pow(LONG_MIN+1,2)
+(float)(LONG_MAX-1) === pow(LONG_MAX-1,1.0)
+(float)(LONG_MIN+1) === pow(LONG_MIN+1,1.0)
+(LONG_MAX-1)*(LONG_MAX-1) ~== pow(LONG_MAX-1,2.0)
+(LONG_MIN+1)*(LONG_MIN+1) ~== pow(LONG_MIN+1,2.0)
+LONG_MAX === pow(LONG_MAX,1)
+LONG_MIN === pow(LONG_MIN,1)
+LONG_MAX*LONG_MAX ~== pow(LONG_MAX,2)
+LONG_MIN*LONG_MIN ~== pow(LONG_MIN,2)
+(float)LONG_MAX === pow(LONG_MAX,1.0)
+(float)LONG_MIN === pow(LONG_MIN,1.0)
+LONG_MAX*LONG_MAX ~== pow(LONG_MAX,2.0)
+LONG_MIN*LONG_MIN ~== pow(LONG_MIN,2.0)
+TESTS;
+
+ echo "On failure, please mail result to php-dev@lists.php.net\n";
+ include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
+
+--EXPECT--
+1,1,0,0
+On failure, please mail result to php-dev@lists.php.net
+OK
diff --git a/ext/standard/tests/math/pow_basic.phpt b/ext/standard/tests/math/pow_basic.phpt
new file mode 100644
index 0000000..b7d96ca
--- /dev/null
+++ b/ext/standard/tests/math/pow_basic.phpt
@@ -0,0 +1,270 @@
+--TEST--
+Test pow() - basic function test pow()
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+$bases = array(23,
+ -23,
+ 23.1,
+ -23.1,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ PHP_INT_MAX,
+ -PHP_INT_MAX - 1);
+
+$exponents = array(0,
+ 1,
+ -1,
+ 2,
+ -2,
+ 3,
+ -3,
+ 2.5,
+ -2.5,
+ 500,
+ -500,
+ 2147483647,
+ -2147483648);
+
+foreach($bases as $base) {
+ echo "\n\nBase = $base";
+ foreach($exponents as $exponent) {
+ echo "\n..... Exponent = $exponent Result = ";
+ $res = pow($base, $exponent);
+ echo $res;
+ }
+ echo "\n\n";
+}
+?>
+===Done===
+--EXPECT--
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23
+..... Exponent = -1 Result = -0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = -12167
+..... Exponent = -3 Result = -8.2189529053999E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23.1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.1
+..... Exponent = -1 Result = 0.043290043290043
+..... Exponent = 2 Result = 533.61
+..... Exponent = -2 Result = 0.0018740278480538
+..... Exponent = 3 Result = 12326.391
+..... Exponent = -3 Result = 8.1126746668997E-5
+..... Exponent = 2.5 Result = 2564.6608940579
+..... Exponent = -2.5 Result = 0.00038991509650141
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23.1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23.1
+..... Exponent = -1 Result = -0.043290043290043
+..... Exponent = 2 Result = 533.61
+..... Exponent = -2 Result = 0.0018740278480538
+..... Exponent = 3 Result = -12326.391
+..... Exponent = -3 Result = -8.1126746668997E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23.45
+..... Exponent = -1 Result = -0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = -12895.213625
+..... Exponent = -3 Result = -7.7548153065204E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 2.345e1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 2147483647
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 2147483647
+..... Exponent = -1 Result = 4.6566128752458E-10
+..... Exponent = 2 Result = 4.6116860141324E+18
+..... Exponent = -2 Result = 2.1684043469905E-19
+..... Exponent = 3 Result = 9.903520300448E+27
+..... Exponent = -3 Result = 1.0097419600935E-28
+..... Exponent = 2.5 Result = 2.1370991100146E+23
+..... Exponent = -2.5 Result = 4.6792401686657E-24
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -2147483648
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -2147483648
+..... Exponent = -1 Result = -4.6566128730774E-10
+..... Exponent = 2 Result = 4.6116860184274E+18
+..... Exponent = -2 Result = 2.168404344971E-19
+..... Exponent = 3 Result = -9.903520314283E+27
+..... Exponent = -3 Result = -1.0097419586829E-28
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/pow_basic2.phpt b/ext/standard/tests/math/pow_basic2.phpt
new file mode 100644
index 0000000..fc55cac
--- /dev/null
+++ b/ext/standard/tests/math/pow_basic2.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test pow() - basic function test pow() - with large exponents
+--INI--
+precision=14
+--FILE--
+<?php
+
+$large_exp = 20000;
+
+echo "\n-- The following all result in INF --\n";
+var_dump(pow(24, $large_exp));
+var_dump(pow(0.24, -$large_exp));
+var_dump(pow(-0.24, -$large_exp));
+
+echo "\n\n-- The following all result in 0 --\n";
+var_dump(pow(0.24, $large_exp));
+var_dump(pow(-0.24, $large_exp));
+var_dump(pow(24, -$large_exp));
+var_dump(pow(-24, -$large_exp));
+
+echo "\n\n-- The following all result in -0 --\n";
+var_dump(pow(-0.24, $large_exp+1));
+
+echo "\n\n-- The following all result in -INF --\n";
+var_dump(pow(-24, $large_exp+1));
+var_dump(pow(-0.24, -$large_exp+1));
+
+?>
+===Done===
+--EXPECTF--
+
+-- The following all result in INF --
+float(INF)
+float(INF)
+float(INF)
+
+
+-- The following all result in 0 --
+float(0)
+float(0)
+float(0)
+float(0)
+
+
+-- The following all result in -0 --
+float(%s)
+
+
+-- The following all result in -INF --
+float(-INF)
+float(-INF)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/pow_basic_64bit.phpt b/ext/standard/tests/math/pow_basic_64bit.phpt
new file mode 100644
index 0000000..898f6ef
--- /dev/null
+++ b/ext/standard/tests/math/pow_basic_64bit.phpt
@@ -0,0 +1,270 @@
+--TEST--
+Test pow() - basic function test pow()
+--INI--
+precision=14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+$bases = array(23,
+ -23,
+ 23.1,
+ -23.1,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ PHP_INT_MAX,
+ -PHP_INT_MAX - 1);
+
+$exponents = array(0,
+ 1,
+ -1,
+ 2,
+ -2,
+ 3,
+ -3,
+ 2.5,
+ -2.5,
+ 500,
+ -500,
+ 2147483647,
+ -2147483648);
+
+foreach($bases as $base) {
+ echo "\n\nBase = $base";
+ foreach($exponents as $exponent) {
+ echo "\n..... Exponent = $exponent Result = ";
+ $res = pow($base, $exponent);
+ echo $res;
+ }
+ echo "\n\n";
+}
+?>
+===Done===
+--EXPECTF--
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23
+..... Exponent = -1 Result = -0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = -12167
+..... Exponent = -3 Result = -8.2189529053999E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23.1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.1
+..... Exponent = -1 Result = 0.043290043290043
+..... Exponent = 2 Result = 533.61
+..... Exponent = -2 Result = 0.0018740278480538
+..... Exponent = 3 Result = 12326.391
+..... Exponent = -3 Result = 8.1126746668997E-5
+..... Exponent = 2.5 Result = 2564.6608940579
+..... Exponent = -2.5 Result = 0.00038991509650141
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23.1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23.1
+..... Exponent = -1 Result = -0.043290043290043
+..... Exponent = 2 Result = 533.61
+..... Exponent = -2 Result = 0.0018740278480538
+..... Exponent = 3 Result = -12326.391
+..... Exponent = -3 Result = -8.1126746668997E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -23.45
+..... Exponent = -1 Result = -0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = -12895.213625
+..... Exponent = -3 Result = -7.7548153065204E-5
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23
+..... Exponent = -1 Result = 0.043478260869565
+..... Exponent = 2 Result = 529
+..... Exponent = -2 Result = 0.001890359168242
+..... Exponent = 3 Result = 12167
+..... Exponent = -3 Result = 8.2189529053999E-5
+..... Exponent = 2.5 Result = 2536.9948758324
+..... Exponent = -2.5 Result = 0.00039416713432339
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 23.45
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 2.345e1
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 23.45
+..... Exponent = -1 Result = 0.042643923240938
+..... Exponent = 2 Result = 549.9025
+..... Exponent = -2 Result = 0.001818504189379
+..... Exponent = 3 Result = 12895.213625
+..... Exponent = -3 Result = 7.7548153065204E-5
+..... Exponent = 2.5 Result = 2662.9138571162
+..... Exponent = -2.5 Result = 0.00037552848257846
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = 9223372036854775807
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = 9223372036854775807
+..... Exponent = -1 Result = 1.0842021724855E-19
+..... Exponent = 2 Result = 8.5070591730235E+37
+..... Exponent = -2 Result = 1.1754943508223E-38
+..... Exponent = 3 Result = 7.8463771692334E+56
+..... Exponent = -3 Result = 1.274473528906E-57
+..... Exponent = 2.5 Result = 2.5835942961798E+47
+..... Exponent = -2.5 Result = 3.8705767444936E-48
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = INF
+..... Exponent = -2147483648 Result = 0
+
+
+
+Base = -9223372036854775808
+..... Exponent = 0 Result = 1
+..... Exponent = 1 Result = -9223372036854775808
+..... Exponent = -1 Result = -1.0842021724855E-19
+..... Exponent = 2 Result = 8.5070591730235E+37
+..... Exponent = -2 Result = 1.1754943508223E-38
+..... Exponent = 3 Result = -7.8463771692334E+56
+..... Exponent = -3 Result = -1.274473528906E-57
+..... Exponent = 2.5 Result = NAN
+..... Exponent = -2.5 Result = NAN
+..... Exponent = 500 Result = INF
+..... Exponent = -500 Result = 0
+..... Exponent = 2147483647 Result = -INF
+..... Exponent = -2147483648 Result = 0
+
+===Done===
diff --git a/ext/standard/tests/math/pow_basiclong_64bit.phpt b/ext/standard/tests/math/pow_basiclong_64bit.phpt
new file mode 100644
index 0000000..dfff0f6
--- /dev/null
+++ b/ext/standard/tests/math/pow_basiclong_64bit.phpt
@@ -0,0 +1,364 @@
+--TEST--
+Test pow function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MIN_32Bit, MAX_64Bit, MIN_64Bit);
+
+
+foreach ($longVals as $longVal) {
+ foreach($otherVals as $otherVal) {
+ echo "--- testing: $longVal, $otherVal ---\n";
+ var_dump(pow($longVal, $otherVal));
+ }
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807, 0 ---
+int(1)
+--- testing: 9223372036854775807, 1 ---
+int(9223372036854775807)
+--- testing: 9223372036854775807, -1 ---
+float(1.0842021724855E-19)
+--- testing: 9223372036854775807, 7 ---
+float(5.6784275335594E+132)
+--- testing: 9223372036854775807, 9 ---
+float(4.8306719037716E+170)
+--- testing: 9223372036854775807, 65 ---
+float(INF)
+--- testing: 9223372036854775807, -44 ---
+float(0)
+--- testing: 9223372036854775807, 2147483647 ---
+float(INF)
+--- testing: 9223372036854775807, -2147483648 ---
+float(0)
+--- testing: 9223372036854775807, 9223372036854775807 ---
+float(INF)
+--- testing: 9223372036854775807, -9223372036854775808 ---
+float(0)
+--- testing: -9223372036854775808, 0 ---
+int(1)
+--- testing: -9223372036854775808, 1 ---
+int(-9223372036854775808)
+--- testing: -9223372036854775808, -1 ---
+float(-1.0842021724855E-19)
+--- testing: -9223372036854775808, 7 ---
+float(-5.6784275335594E+132)
+--- testing: -9223372036854775808, 9 ---
+float(-4.8306719037716E+170)
+--- testing: -9223372036854775808, 65 ---
+float(-INF)
+--- testing: -9223372036854775808, -44 ---
+float(0)
+--- testing: -9223372036854775808, 2147483647 ---
+float(-INF)
+--- testing: -9223372036854775808, -2147483648 ---
+float(0)
+--- testing: -9223372036854775808, 9223372036854775807 ---
+float(-INF)
+--- testing: -9223372036854775808, -9223372036854775808 ---
+float(0)
+--- testing: 2147483647, 0 ---
+int(1)
+--- testing: 2147483647, 1 ---
+int(2147483647)
+--- testing: 2147483647, -1 ---
+float(4.6566128752458E-10)
+--- testing: 2147483647, 7 ---
+float(2.1062458265056E+65)
+--- testing: 2147483647, 9 ---
+float(9.7133444204205E+83)
+--- testing: 2147483647, 65 ---
+float(INF)
+--- testing: 2147483647, -44 ---
+float(0)
+--- testing: 2147483647, 2147483647 ---
+float(INF)
+--- testing: 2147483647, -2147483648 ---
+float(0)
+--- testing: 2147483647, 9223372036854775807 ---
+float(INF)
+--- testing: 2147483647, -9223372036854775808 ---
+float(0)
+--- testing: -2147483648, 0 ---
+int(1)
+--- testing: -2147483648, 1 ---
+int(-2147483648)
+--- testing: -2147483648, -1 ---
+float(-4.6566128730774E-10)
+--- testing: -2147483648, 7 ---
+float(-2.1062458333711E+65)
+--- testing: -2147483648, 9 ---
+float(-9.7133444611286E+83)
+--- testing: -2147483648, 65 ---
+float(-INF)
+--- testing: -2147483648, -44 ---
+float(0)
+--- testing: -2147483648, 2147483647 ---
+float(-INF)
+--- testing: -2147483648, -2147483648 ---
+float(0)
+--- testing: -2147483648, 9223372036854775807 ---
+float(-INF)
+--- testing: -2147483648, -9223372036854775808 ---
+float(0)
+--- testing: 9223372034707292160, 0 ---
+int(1)
+--- testing: 9223372034707292160, 1 ---
+int(9223372034707292160)
+--- testing: 9223372034707292160, -1 ---
+float(1.0842021727379E-19)
+--- testing: 9223372034707292160, 7 ---
+float(5.6784275243046E+132)
+--- testing: 9223372034707292160, 9 ---
+float(4.830671893649E+170)
+--- testing: 9223372034707292160, 65 ---
+float(INF)
+--- testing: 9223372034707292160, -44 ---
+float(0)
+--- testing: 9223372034707292160, 2147483647 ---
+float(INF)
+--- testing: 9223372034707292160, -2147483648 ---
+float(0)
+--- testing: 9223372034707292160, 9223372036854775807 ---
+float(INF)
+--- testing: 9223372034707292160, -9223372036854775808 ---
+float(0)
+--- testing: -9223372034707292160, 0 ---
+int(1)
+--- testing: -9223372034707292160, 1 ---
+int(-9223372034707292160)
+--- testing: -9223372034707292160, -1 ---
+float(-1.0842021727379E-19)
+--- testing: -9223372034707292160, 7 ---
+float(-5.6784275243046E+132)
+--- testing: -9223372034707292160, 9 ---
+float(-4.830671893649E+170)
+--- testing: -9223372034707292160, 65 ---
+float(-INF)
+--- testing: -9223372034707292160, -44 ---
+float(0)
+--- testing: -9223372034707292160, 2147483647 ---
+float(-INF)
+--- testing: -9223372034707292160, -2147483648 ---
+float(0)
+--- testing: -9223372034707292160, 9223372036854775807 ---
+float(-INF)
+--- testing: -9223372034707292160, -9223372036854775808 ---
+float(0)
+--- testing: 2147483648, 0 ---
+int(1)
+--- testing: 2147483648, 1 ---
+int(2147483648)
+--- testing: 2147483648, -1 ---
+float(4.6566128730774E-10)
+--- testing: 2147483648, 7 ---
+float(2.1062458333711E+65)
+--- testing: 2147483648, 9 ---
+float(9.7133444611286E+83)
+--- testing: 2147483648, 65 ---
+float(INF)
+--- testing: 2147483648, -44 ---
+float(0)
+--- testing: 2147483648, 2147483647 ---
+float(INF)
+--- testing: 2147483648, -2147483648 ---
+float(0)
+--- testing: 2147483648, 9223372036854775807 ---
+float(INF)
+--- testing: 2147483648, -9223372036854775808 ---
+float(0)
+--- testing: -2147483649, 0 ---
+int(1)
+--- testing: -2147483649, 1 ---
+int(-2147483649)
+--- testing: -2147483649, -1 ---
+float(-4.656612870909E-10)
+--- testing: -2147483649, 7 ---
+float(-2.1062458402367E+65)
+--- testing: -2147483649, 9 ---
+float(-9.7133445018368E+83)
+--- testing: -2147483649, 65 ---
+float(-INF)
+--- testing: -2147483649, -44 ---
+float(0)
+--- testing: -2147483649, 2147483647 ---
+float(-INF)
+--- testing: -2147483649, -2147483648 ---
+float(0)
+--- testing: -2147483649, 9223372036854775807 ---
+float(-INF)
+--- testing: -2147483649, -9223372036854775808 ---
+float(0)
+--- testing: 4294967294, 0 ---
+int(1)
+--- testing: 4294967294, 1 ---
+int(4294967294)
+--- testing: 4294967294, -1 ---
+float(2.3283064376229E-10)
+--- testing: 4294967294, 7 ---
+float(2.6959946579271E+67)
+--- testing: 4294967294, 9 ---
+float(4.9732323432553E+86)
+--- testing: 4294967294, 65 ---
+float(INF)
+--- testing: 4294967294, -44 ---
+float(0)
+--- testing: 4294967294, 2147483647 ---
+float(INF)
+--- testing: 4294967294, -2147483648 ---
+float(0)
+--- testing: 4294967294, 9223372036854775807 ---
+float(INF)
+--- testing: 4294967294, -9223372036854775808 ---
+float(0)
+--- testing: 4294967295, 0 ---
+int(1)
+--- testing: 4294967295, 1 ---
+int(4294967295)
+--- testing: 4294967295, -1 ---
+float(2.3283064370808E-10)
+--- testing: 4294967295, 7 ---
+float(2.6959946623211E+67)
+--- testing: 4294967295, 9 ---
+float(4.9732323536766E+86)
+--- testing: 4294967295, 65 ---
+float(INF)
+--- testing: 4294967295, -44 ---
+float(0)
+--- testing: 4294967295, 2147483647 ---
+float(INF)
+--- testing: 4294967295, -2147483648 ---
+float(0)
+--- testing: 4294967295, 9223372036854775807 ---
+float(INF)
+--- testing: 4294967295, -9223372036854775808 ---
+float(0)
+--- testing: 4294967293, 0 ---
+int(1)
+--- testing: 4294967293, 1 ---
+int(4294967293)
+--- testing: 4294967293, -1 ---
+float(2.328306438165E-10)
+--- testing: 4294967293, 7 ---
+float(2.6959946535332E+67)
+--- testing: 4294967293, 9 ---
+float(4.973232332834E+86)
+--- testing: 4294967293, 65 ---
+float(INF)
+--- testing: 4294967293, -44 ---
+float(0)
+--- testing: 4294967293, 2147483647 ---
+float(INF)
+--- testing: 4294967293, -2147483648 ---
+float(0)
+--- testing: 4294967293, 9223372036854775807 ---
+float(INF)
+--- testing: 4294967293, -9223372036854775808 ---
+float(0)
+--- testing: 9223372036854775806, 0 ---
+int(1)
+--- testing: 9223372036854775806, 1 ---
+int(9223372036854775806)
+--- testing: 9223372036854775806, -1 ---
+float(1.0842021724855E-19)
+--- testing: 9223372036854775806, 7 ---
+float(5.6784275335594E+132)
+--- testing: 9223372036854775806, 9 ---
+float(4.8306719037716E+170)
+--- testing: 9223372036854775806, 65 ---
+float(INF)
+--- testing: 9223372036854775806, -44 ---
+float(0)
+--- testing: 9223372036854775806, 2147483647 ---
+float(INF)
+--- testing: 9223372036854775806, -2147483648 ---
+float(0)
+--- testing: 9223372036854775806, 9223372036854775807 ---
+float(INF)
+--- testing: 9223372036854775806, -9223372036854775808 ---
+float(0)
+--- testing: 9.2233720368548E+18, 0 ---
+float(1)
+--- testing: 9.2233720368548E+18, 1 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18, -1 ---
+float(1.0842021724855E-19)
+--- testing: 9.2233720368548E+18, 7 ---
+float(5.6784275335594E+132)
+--- testing: 9.2233720368548E+18, 9 ---
+float(4.8306719037716E+170)
+--- testing: 9.2233720368548E+18, 65 ---
+float(INF)
+--- testing: 9.2233720368548E+18, -44 ---
+float(0)
+--- testing: 9.2233720368548E+18, 2147483647 ---
+float(INF)
+--- testing: 9.2233720368548E+18, -2147483648 ---
+float(0)
+--- testing: 9.2233720368548E+18, 9223372036854775807 ---
+float(INF)
+--- testing: 9.2233720368548E+18, -9223372036854775808 ---
+float(0)
+--- testing: -9223372036854775807, 0 ---
+int(1)
+--- testing: -9223372036854775807, 1 ---
+int(-9223372036854775807)
+--- testing: -9223372036854775807, -1 ---
+float(-1.0842021724855E-19)
+--- testing: -9223372036854775807, 7 ---
+float(-5.6784275335594E+132)
+--- testing: -9223372036854775807, 9 ---
+float(-4.8306719037716E+170)
+--- testing: -9223372036854775807, 65 ---
+float(-INF)
+--- testing: -9223372036854775807, -44 ---
+float(0)
+--- testing: -9223372036854775807, 2147483647 ---
+float(-INF)
+--- testing: -9223372036854775807, -2147483648 ---
+float(0)
+--- testing: -9223372036854775807, 9223372036854775807 ---
+float(-INF)
+--- testing: -9223372036854775807, -9223372036854775808 ---
+float(0)
+--- testing: -9.2233720368548E+18, 0 ---
+float(1)
+--- testing: -9.2233720368548E+18, 1 ---
+float(-9.2233720368548E+18)
+--- testing: -9.2233720368548E+18, -1 ---
+float(-1.0842021724855E-19)
+--- testing: -9.2233720368548E+18, 7 ---
+float(-5.6784275335594E+132)
+--- testing: -9.2233720368548E+18, 9 ---
+float(-4.8306719037716E+170)
+--- testing: -9.2233720368548E+18, 65 ---
+float(-INF)
+--- testing: -9.2233720368548E+18, -44 ---
+float(0)
+--- testing: -9.2233720368548E+18, 2147483647 ---
+float(-INF)
+--- testing: -9.2233720368548E+18, -2147483648 ---
+float(0)
+--- testing: -9.2233720368548E+18, 9223372036854775807 ---
+float(INF)
+--- testing: -9.2233720368548E+18, -9223372036854775808 ---
+float(0)
+===DONE===
diff --git a/ext/standard/tests/math/pow_error.phpt b/ext/standard/tests/math/pow_error.phpt
new file mode 100644
index 0000000..d00173e
--- /dev/null
+++ b/ext/standard/tests/math/pow_error.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test pow() - wrong params test pow()
+--INI--
+precision=14
+--FILE--
+<?php
+pow();
+pow(36);
+pow(36,4,true);
+?>
+--EXPECTF--
+
+Warning: pow() expects exactly 2 parameters, 0 given in %s line 2
+
+Warning: pow() expects exactly 2 parameters, 1 given in %s line 3
+
+Warning: pow() expects exactly 2 parameters, 3 given in %s line 4
+
+
diff --git a/ext/standard/tests/math/pow_variation1.phpt b/ext/standard/tests/math/pow_variation1.phpt
new file mode 100644
index 0000000..df51190
--- /dev/null
+++ b/ext/standard/tests/math/pow_variation1.phpt
@@ -0,0 +1,176 @@
+--TEST--
+Test pow() function : usage variations - different data types as $base argument
+--INI--
+precision = 14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : number pow ( number $base , number $exp )
+ * Description: Exponential expression.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing pow() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ PHP_INT_MAX,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of pow()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(pow($input, 3));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing pow() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+float(1881365963625)
+
+-- Iteration 4 --
+float(-12895213625)
+
+-- Iteration 5 --
+float(9.903520300448E+27)
+
+-- Iteration 6 --
+float(1157.625)
+
+-- Iteration 7 --
+float(-1157.625)
+
+-- Iteration 8 --
+float(1.881676371789%dE+33)
+
+-- Iteration 9 --
+float(1.881676371789%dE-27)
+
+-- Iteration 10 --
+float(0.125)
+
+-- Iteration 11 --
+int(0)
+
+-- Iteration 12 --
+int(0)
+
+-- Iteration 13 --
+int(1)
+
+-- Iteration 14 --
+int(0)
+
+-- Iteration 15 --
+int(1)
+
+-- Iteration 16 --
+int(0)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+int(0)
+
+-- Iteration 19 --
+float(0)
+
+-- Iteration 20 --
+int(0)
+
+-- Iteration 21 --
+int(0)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+int(1)
+
+-- Iteration 24 --
+int(0)
+
+-- Iteration 25 --
+int(0)
+
+-- Iteration 26 --
+%s
+===Done===
diff --git a/ext/standard/tests/math/pow_variation1_64bit.phpt b/ext/standard/tests/math/pow_variation1_64bit.phpt
new file mode 100644
index 0000000..24b4826
--- /dev/null
+++ b/ext/standard/tests/math/pow_variation1_64bit.phpt
@@ -0,0 +1,176 @@
+--TEST--
+Test pow() function : usage variations - different data types as $base argument
+--INI--
+precision = 14
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+/* Prototype : number pow ( number $base , number $exp )
+ * Description: Exponential expression.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing pow() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ PHP_INT_MAX,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of pow()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(pow($input, 3));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing pow() : usage variations ***
+
+-- Iteration 1 --
+int(0)
+
+-- Iteration 2 --
+int(1)
+
+-- Iteration 3 --
+int(1881365963625)
+
+-- Iteration 4 --
+int(-12895213625)
+
+-- Iteration 5 --
+float(7.8463771692334E+56)
+
+-- Iteration 6 --
+float(1157.625)
+
+-- Iteration 7 --
+float(-1157.625)
+
+-- Iteration 8 --
+float(1.8816763717892E+33)
+
+-- Iteration 9 --
+float(1.8816763717892E-27)
+
+-- Iteration 10 --
+float(0.125)
+
+-- Iteration 11 --
+int(0)
+
+-- Iteration 12 --
+int(0)
+
+-- Iteration 13 --
+int(1)
+
+-- Iteration 14 --
+int(0)
+
+-- Iteration 15 --
+int(1)
+
+-- Iteration 16 --
+int(0)
+
+-- Iteration 17 --
+int(0)
+
+-- Iteration 18 --
+int(0)
+
+-- Iteration 19 --
+float(0)
+
+-- Iteration 20 --
+int(0)
+
+-- Iteration 21 --
+int(0)
+
+-- Iteration 22 --
+int(0)
+
+-- Iteration 23 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+int(1)
+
+-- Iteration 24 --
+int(0)
+
+-- Iteration 25 --
+int(0)
+
+-- Iteration 26 --
+%s
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/pow_variation2.phpt b/ext/standard/tests/math/pow_variation2.phpt
new file mode 100644
index 0000000..b1800bb
--- /dev/null
+++ b/ext/standard/tests/math/pow_variation2.phpt
@@ -0,0 +1,172 @@
+--TEST--
+Test pow() function : usage variations - different data types as $exp argument
+--INI--
+precision = 14
+--FILE--
+<?php
+/* Prototype : number pow ( number $base , number $exp )
+ * Description: Exponential expression.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing pow() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 2.5,
+ -2.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of pow()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(pow(20.3, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing pow() : usage variations ***
+
+-- Iteration 1 --
+float(1)
+
+-- Iteration 2 --
+float(20.3)
+
+-- Iteration 3 --
+float(INF)
+
+-- Iteration 4 --
+float(0)
+
+-- Iteration 5 --
+float(INF)
+
+-- Iteration 6 --
+float(1856.6929774279)
+
+-- Iteration 7 --
+float(0.00053859200856424)
+
+-- Iteration 8 --
+float(INF)
+
+-- Iteration 9 --
+float(1.0000000037168)
+
+-- Iteration 10 --
+float(4.5055521304275)
+
+-- Iteration 11 --
+float(1)
+
+-- Iteration 12 --
+float(1)
+
+-- Iteration 13 --
+float(20.3)
+
+-- Iteration 14 --
+float(1)
+
+-- Iteration 15 --
+float(20.3)
+
+-- Iteration 16 --
+float(1)
+
+-- Iteration 17 --
+float(1)
+
+-- Iteration 18 --
+float(1)
+
+-- Iteration 19 --
+float(1)
+
+-- Iteration 20 --
+float(1)
+
+-- Iteration 21 --
+float(1)
+
+-- Iteration 22 --
+float(1)
+
+-- Iteration 23 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+float(20.3)
+
+-- Iteration 24 --
+float(1)
+
+-- Iteration 25 --
+float(1)
+
+-- Iteration 26 --
+%s
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/rad2deg_basic.phpt b/ext/standard/tests/math/rad2deg_basic.phpt
new file mode 100644
index 0000000..0256ffb
--- /dev/null
+++ b/ext/standard/tests/math/rad2deg_basic.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test return type and value for expected input rad2deg()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float rad2deg(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+$arg_0 = 0.0;
+$arg_1 = 1.570796327;
+$arg_2 = 3.141592654;
+$arg_3 = 6.283185307;
+
+echo "rad2deg $arg_0= ";
+$r0 = rad2deg($arg_0);
+var_dump($r0);
+if (allowed_rounding_error($r0 ,0 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+echo "rad2deg $arg_1 = ";
+$r1 = rad2deg($arg_1);
+var_dump($r1);
+if (allowed_rounding_error($r1 ,90.000000011752)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+echo "rad2deg $arg_2 = ";
+$r2 = rad2deg($arg_2);
+var_dump($r2);
+if (allowed_rounding_error($r2 ,180.0000000235 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+echo "rad2deg $arg_3 = ";
+$r3 = rad2deg($arg_3);
+var_dump($r3);
+if (allowed_rounding_error($r3 ,359.99999998971 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+?>
+--EXPECTF--
+rad2deg 0= float(%f)
+Pass
+rad2deg 1.570796327 = float(%f)
+Pass
+rad2deg 3.141592654 = float(%f)
+Pass
+rad2deg 6.283185307 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/rad2deg_basiclong_64bit.phpt b/ext/standard/tests/math/rad2deg_basiclong_64bit.phpt
new file mode 100644
index 0000000..4f43ef1
--- /dev/null
+++ b/ext/standard/tests/math/rad2deg_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test rad2deg function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(rad2deg($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(5.2846029059076E+20)
+--- testing: -9223372036854775808 ---
+float(-5.2846029059076E+20)
+--- testing: 2147483647 ---
+float(123041749546.46)
+--- testing: -2147483648 ---
+float(-123041749603.76)
+--- testing: 9223372034707292160 ---
+float(5.2846029046772E+20)
+--- testing: -9223372034707292160 ---
+float(-5.2846029046772E+20)
+--- testing: 2147483648 ---
+float(123041749603.76)
+--- testing: -2147483649 ---
+float(-123041749661.05)
+--- testing: 4294967294 ---
+float(246083499092.92)
+--- testing: 4294967295 ---
+float(246083499150.22)
+--- testing: 4294967293 ---
+float(246083499035.63)
+--- testing: 9223372036854775806 ---
+float(5.2846029059076E+20)
+--- testing: 9.2233720368548E+18 ---
+float(5.2846029059076E+20)
+--- testing: -9223372036854775807 ---
+float(-5.2846029059076E+20)
+--- testing: -9.2233720368548E+18 ---
+float(-5.2846029059076E+20)
+===DONE===
diff --git a/ext/standard/tests/math/rad2deg_error.phpt b/ext/standard/tests/math/rad2deg_error.phpt
new file mode 100644
index 0000000..32b2f4d
--- /dev/null
+++ b/ext/standard/tests/math/rad2deg_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test wrong number of arguments for rad2deg()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float rad2deg(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(rad2deg($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(rad2deg());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: rad2deg() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: rad2deg() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/rad2deg_variation.phpt b/ext/standard/tests/math/rad2deg_variation.phpt
new file mode 100644
index 0000000..173cbc4
--- /dev/null
+++ b/ext/standard/tests/math/rad2deg_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of rad2deg()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float rad2deg(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test rad2deg with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = rad2deg($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(1317.802929)
+float(-1317.802929)
+float(1343.58603)
+float(-1343.58603)
+float(1317.802929)
+float(1317.802929)
+float(1317.802929)
+float(1343.58603)
+float(1343.58603)
+
+Warning: rad2deg() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(57295.77951)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(57295.77951)
+float(0)
+float(57.29577951)
+float(0)
diff --git a/ext/standard/tests/math/rand_basic.phpt b/ext/standard/tests/math/rand_basic.phpt
new file mode 100644
index 0000000..5259560
--- /dev/null
+++ b/ext/standard/tests/math/rand_basic.phpt
@@ -0,0 +1,103 @@
+--TEST--
+Test rand() - basic function test rand()
+--FILE--
+<?php
+$default_max = getrandmax();
+
+echo "\nrand() tests with default min and max value (i.e 0 thru ", $default_max, ")\n";
+for ($i = 0; $i < 100; $i++) {
+ $res = rand();
+
+// By default RAND_MAX is 32768 although no constant is defined for it for user space apps
+ if (!is_int($res) || $res < 0 || $res > $default_max) {
+ break;
+ }
+}
+
+if ($i != 100) {
+ echo "FAILED: res = ", $res, " min = 0 max = ", $default_max, "\n";
+} else {
+ echo "PASSED: range min = 0 max = ", $default_max, "\n";
+}
+
+echo "\nrand() tests with defined min and max value\n";
+
+$min = array(10,
+ 100,
+ 10.5,
+ 10.5e3,
+ 0x10,
+ 0400);
+
+$max = array(100,
+ 1000,
+ 19.5,
+ 10.5e5,
+ 0x10000,
+ 0700);
+
+for ($x = 0; $x < count($min); $x++) {
+ for ($i = 0; $i < 100; $i++) {
+ $res = rand($min[$x], $max[$x]);
+
+ if (!is_int($res) || $res < intval($min[$x]) || $res > intval($max[$x])) {
+ echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ break;
+ }
+ }
+
+ if ($i == 100) {
+ echo "PASSED: range min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ }
+}
+
+echo "\nNon-numeric cases\n";
+$min = array(true,
+ false,
+ null,
+ "10",
+ "0x10",
+ "10.5");
+
+// Eexepcted numerical equivalent of above non-numerics
+$minval = array(1,
+ 0,
+ 0,
+ 10,
+ 0,
+ 10);
+for ($x = 0; $x < count($min); $x++) {
+ for ($i = 0; $i < 100; $i++) {
+ $res = rand($min[$x], 100);
+
+ if (!is_int($res) || $res < intval($minval[$x]) || $res > 100) {
+ echo "FAILED: res = ", $res, " min = ", intval($min[$x]), " max = ", intval($max[$x]), "\n";
+ break;
+ }
+ }
+
+ if ($i == 100) {
+ echo "PASSED range min = ", intval($min[$x]), " max = 100\n";
+ }
+}
+?>
+--EXPECTF--
+
+rand() tests with default min and max value (i.e 0 thru %i)
+PASSED: range min = 0 max = %i
+
+rand() tests with defined min and max value
+PASSED: range min = 10 max = 100
+PASSED: range min = 100 max = 1000
+PASSED: range min = 10 max = 19
+PASSED: range min = 10500 max = 1050000
+PASSED: range min = 16 max = 65536
+PASSED: range min = 256 max = 448
+
+Non-numeric cases
+PASSED range min = 1 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 10 max = 100
+PASSED range min = 0 max = 100
+PASSED range min = 10 max = 100
diff --git a/ext/standard/tests/math/rand_error.phpt b/ext/standard/tests/math/rand_error.phpt
new file mode 100644
index 0000000..79aa011
--- /dev/null
+++ b/ext/standard/tests/math/rand_error.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test rand() - wrong params test rand()
+--FILE--
+<?php
+rand(25);
+rand(10,100,false);
+rand("one", 100);
+rand(1, "hundered");
+?>
+--EXPECTF--
+
+Warning: rand() expects exactly 2 parameters, 1 given in %s on line 2
+
+Warning: rand() expects exactly 2 parameters, 3 given in %s on line 3
+
+Warning: rand() expects parameter 1 to be long, string given in %s on line 4
+
+Warning: rand() expects parameter 2 to be long, string given in %s on line 5
diff --git a/ext/standard/tests/math/rand_variation1.phpt b/ext/standard/tests/math/rand_variation1.phpt
new file mode 100644
index 0000000..02e552b
--- /dev/null
+++ b/ext/standard/tests/math/rand_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test rand() function : usage variations - different data types as $min argument
+--FILE--
+<?php
+/* Prototype : int rand ([ int $min , int $max ] )
+ * Description: Generate a random integer.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing rand() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of rand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(rand($input, 100));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing rand() : usage variations ***
+
+-- Iteration 1 --
+int(%i)
+
+-- Iteration 2 --
+int(%i)
+
+-- Iteration 3 --
+int(%i)
+
+-- Iteration 4 --
+int(%i)
+
+-- Iteration 5 --
+int(%i)
+
+-- Iteration 6 --
+int(%i)
+
+-- Iteration 7 --
+int(%i)
+
+-- Iteration 8 --
+int(%i)
+
+-- Iteration 9 --
+int(%i)
+
+-- Iteration 10 --
+int(%i)
+
+-- Iteration 11 --
+int(%i)
+
+-- Iteration 12 --
+int(%i)
+
+-- Iteration 13 --
+int(%i)
+
+-- Iteration 14 --
+int(%i)
+
+-- Iteration 15 --
+int(%i)
+
+-- Iteration 16 --
+int(%i)
+
+-- Iteration 17 --
+
+Warning: rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: rand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: rand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: rand() expects parameter 1 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+int(%i)
+
+-- Iteration 25 --
+int(%i)
+
+-- Iteration 26 --
+
+Warning: rand() expects parameter 1 to be long, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/rand_variation2.phpt b/ext/standard/tests/math/rand_variation2.phpt
new file mode 100644
index 0000000..c0e1fc6
--- /dev/null
+++ b/ext/standard/tests/math/rand_variation2.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test rand() function : usage variations - different data types as $max argument
+--FILE--
+<?php
+/* Prototype : int rand ([ int $min , int $max ] )
+ * Description: Generate a random integer.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing rand) : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of rand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(rand(100, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing rand) : usage variations ***
+
+-- Iteration 1 --
+int(%i)
+
+-- Iteration 2 --
+int(%i)
+
+-- Iteration 3 --
+int(%i)
+
+-- Iteration 4 --
+int(%i)
+
+-- Iteration 5 --
+int(%i)
+
+-- Iteration 6 --
+int(%i)
+
+-- Iteration 7 --
+int(%i)
+
+-- Iteration 8 --
+int(%i)
+
+-- Iteration 9 --
+int(%i)
+
+-- Iteration 10 --
+int(%i)
+
+-- Iteration 11 --
+int(%i)
+
+-- Iteration 12 --
+int(%i)
+
+-- Iteration 13 --
+int(%i)
+
+-- Iteration 14 --
+int(%i)
+
+-- Iteration 15 --
+int(%i)
+
+-- Iteration 16 --
+int(%i)
+
+-- Iteration 17 --
+
+Warning: rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: rand() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: rand() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: rand() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+int(%i)
+
+-- Iteration 25 --
+int(%i)
+
+-- Iteration 26 --
+
+Warning: rand() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/round.phpt b/ext/standard/tests/math/round.phpt
new file mode 100644
index 0000000..47f57da
--- /dev/null
+++ b/ext/standard/tests/math/round.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Simple math tests
+--FILE--
+<?php // $Id$
+
+define('LONG_MAX', is_int(5000000000)? 9223372036854775807 : 0x7FFFFFFF);
+define('LONG_MIN', -LONG_MAX - 1);
+printf("%d,%d,%d,%d\n",is_int(LONG_MIN ),is_int(LONG_MAX ),
+ is_int(LONG_MIN-1),is_int(LONG_MAX+1));
+
+$tests = <<<TESTS
+-1 ~== ceil(-1.5)
+ 2 ~== ceil( 1.5)
+-2 ~== floor(-1.5)
+ 1 ~== floor(1.5)
+ LONG_MIN ~== ceil(LONG_MIN - 0.5)
+ LONG_MIN+1 ~== ceil(LONG_MIN + 0.5)
+ LONG_MIN-1 ~== round(LONG_MIN - 0.6)
+ LONG_MIN ~== round(LONG_MIN - 0.4)
+ LONG_MIN ~== round(LONG_MIN + 0.4)
+ LONG_MIN+1 ~== round(LONG_MIN + 0.6)
+ LONG_MIN-1 ~== floor(LONG_MIN - 0.5)
+ LONG_MIN ~== floor(LONG_MIN + 0.5)
+ LONG_MAX ~== ceil(LONG_MAX - 0.5)
+ LONG_MAX+1 ~== ceil(LONG_MAX + 0.5)
+ LONG_MAX-1 ~== round(LONG_MAX - 0.6)
+ LONG_MAX ~== round(LONG_MAX - 0.4)
+ LONG_MAX ~== round(LONG_MAX + 0.4)
+ LONG_MAX+1 ~== round(LONG_MAX + 0.6)
+ LONG_MAX-1 ~== floor(LONG_MAX - 0.5)
+ LONG_MAX ~== floor(LONG_MAX + 0.5)
+TESTS;
+
+include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
+--EXPECT--
+1,1,0,0
+OK
diff --git a/ext/standard/tests/math/round_basic.phpt b/ext/standard/tests/math/round_basic.phpt
new file mode 100644
index 0000000..dd4725f
--- /dev/null
+++ b/ext/standard/tests/math/round_basic.phpt
@@ -0,0 +1,192 @@
+--TEST--
+Test round() - basic function test for round()
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float round ( float $val [, int $precision ] )
+ * Description: Returns the rounded value of val to specified precision (number of digits
+ * after the decimal point)
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing round() : basic functionality ***\n";
+
+$values = array(123456789,
+ 123.456789,
+ -4.5679123,
+ 1.23E4,
+ -4.567E3,
+ 0x234567,
+ 067777777,
+ "1.234567",
+ "2.3456789e8",
+ "0x1234CDEF");
+
+$precision = array(2,
+ 8,
+ 0x3,
+ 04,
+ 3.6,
+ "2",
+ "0x03",
+ "04",
+ "3.6",
+ "2.1e1",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ echo "round: $values[$i]\n";
+ for ($j = 0; $j < count($precision); $j++) {
+ $res = round($values[$i], $precision[$j]);
+ echo "...with precision $precision[$j]-> ";
+ var_dump($res);
+ }
+}
+?>
+===Done===
+--EXPECTF--
+*** Testing round() : basic functionality ***
+round: 123456789
+...with precision 2-> float(123456789)
+...with precision 8-> float(123456789)
+...with precision 3-> float(123456789)
+...with precision 4-> float(123456789)
+...with precision 3.6-> float(123456789)
+...with precision 2-> float(123456789)
+...with precision 0x03-> float(123456789)
+...with precision 04-> float(123456789)
+...with precision 3.6-> float(123456789)
+...with precision 2.1e1-> float(123456789)
+...with precision -> float(123456789)
+...with precision 1-> float(123456789)
+...with precision -> float(123456789)
+round: 123.456789
+...with precision 2-> float(123.46)
+...with precision 8-> float(123.456789)
+...with precision 3-> float(123.457)
+...with precision 4-> float(123.4568)
+...with precision 3.6-> float(123.457)
+...with precision 2-> float(123.46)
+...with precision 0x03-> float(123.457)
+...with precision 04-> float(123.4568)
+...with precision 3.6-> float(123.457)
+...with precision 2.1e1-> float(123.456789)
+...with precision -> float(123)
+...with precision 1-> float(123.5)
+...with precision -> float(123)
+round: -4.5679123
+...with precision 2-> float(-4.57)
+...with precision 8-> float(-4.5679123)
+...with precision 3-> float(-4.568)
+...with precision 4-> float(-4.5679)
+...with precision 3.6-> float(-4.568)
+...with precision 2-> float(-4.57)
+...with precision 0x03-> float(-4.568)
+...with precision 04-> float(-4.5679)
+...with precision 3.6-> float(-4.568)
+...with precision 2.1e1-> float(-4.5679123)
+...with precision -> float(-5)
+...with precision 1-> float(-4.6)
+...with precision -> float(-5)
+round: 12300
+...with precision 2-> float(12300)
+...with precision 8-> float(12300)
+...with precision 3-> float(12300)
+...with precision 4-> float(12300)
+...with precision 3.6-> float(12300)
+...with precision 2-> float(12300)
+...with precision 0x03-> float(12300)
+...with precision 04-> float(12300)
+...with precision 3.6-> float(12300)
+...with precision 2.1e1-> float(12300)
+...with precision -> float(12300)
+...with precision 1-> float(12300)
+...with precision -> float(12300)
+round: -4567
+...with precision 2-> float(-4567)
+...with precision 8-> float(-4567)
+...with precision 3-> float(-4567)
+...with precision 4-> float(-4567)
+...with precision 3.6-> float(-4567)
+...with precision 2-> float(-4567)
+...with precision 0x03-> float(-4567)
+...with precision 04-> float(-4567)
+...with precision 3.6-> float(-4567)
+...with precision 2.1e1-> float(-4567)
+...with precision -> float(-4567)
+...with precision 1-> float(-4567)
+...with precision -> float(-4567)
+round: 2311527
+...with precision 2-> float(2311527)
+...with precision 8-> float(2311527)
+...with precision 3-> float(2311527)
+...with precision 4-> float(2311527)
+...with precision 3.6-> float(2311527)
+...with precision 2-> float(2311527)
+...with precision 0x03-> float(2311527)
+...with precision 04-> float(2311527)
+...with precision 3.6-> float(2311527)
+...with precision 2.1e1-> float(2311527)
+...with precision -> float(2311527)
+...with precision 1-> float(2311527)
+...with precision -> float(2311527)
+round: 14680063
+...with precision 2-> float(14680063)
+...with precision 8-> float(14680063)
+...with precision 3-> float(14680063)
+...with precision 4-> float(14680063)
+...with precision 3.6-> float(14680063)
+...with precision 2-> float(14680063)
+...with precision 0x03-> float(14680063)
+...with precision 04-> float(14680063)
+...with precision 3.6-> float(14680063)
+...with precision 2.1e1-> float(14680063)
+...with precision -> float(14680063)
+...with precision 1-> float(14680063)
+...with precision -> float(14680063)
+round: 1.234567
+...with precision 2-> float(1.23)
+...with precision 8-> float(1.234567)
+...with precision 3-> float(1.235)
+...with precision 4-> float(1.2346)
+...with precision 3.6-> float(1.235)
+...with precision 2-> float(1.23)
+...with precision 0x03-> float(1.235)
+...with precision 04-> float(1.2346)
+...with precision 3.6-> float(1.235)
+...with precision 2.1e1-> float(1.234567)
+...with precision -> float(1)
+...with precision 1-> float(1.2)
+...with precision -> float(1)
+round: 2.3456789e8
+...with precision 2-> float(234567890)
+...with precision 8-> float(234567890)
+...with precision 3-> float(234567890)
+...with precision 4-> float(234567890)
+...with precision 3.6-> float(234567890)
+...with precision 2-> float(234567890)
+...with precision 0x03-> float(234567890)
+...with precision 04-> float(234567890)
+...with precision 3.6-> float(234567890)
+...with precision 2.1e1-> float(234567890)
+...with precision -> float(234567890)
+...with precision 1-> float(234567890)
+...with precision -> float(234567890)
+round: 0x1234CDEF
+...with precision 2-> float(305450479)
+...with precision 8-> float(305450479)
+...with precision 3-> float(305450479)
+...with precision 4-> float(305450479)
+...with precision 3.6-> float(305450479)
+...with precision 2-> float(305450479)
+...with precision 0x03-> float(305450479)
+...with precision 04-> float(305450479)
+...with precision 3.6-> float(305450479)
+...with precision 2.1e1-> float(305450479)
+...with precision -> float(305450479)
+...with precision 1-> float(305450479)
+...with precision -> float(305450479)
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/round_basiclong_64bit.phpt b/ext/standard/tests/math/round_basiclong_64bit.phpt
new file mode 100644
index 0000000..19db12e
--- /dev/null
+++ b/ext/standard/tests/math/round_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test round function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(round($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775808 ---
+float(-9.2233720368548E+18)
+--- testing: 2147483647 ---
+float(2147483647)
+--- testing: -2147483648 ---
+float(-2147483648)
+--- testing: 9223372034707292160 ---
+float(9.2233720347073E+18)
+--- testing: -9223372034707292160 ---
+float(-9.2233720347073E+18)
+--- testing: 2147483648 ---
+float(2147483648)
+--- testing: -2147483649 ---
+float(-2147483649)
+--- testing: 4294967294 ---
+float(4294967294)
+--- testing: 4294967295 ---
+float(4294967295)
+--- testing: 4294967293 ---
+float(4294967293)
+--- testing: 9223372036854775806 ---
+float(9.2233720368548E+18)
+--- testing: 9.2233720368548E+18 ---
+float(9.2233720368548E+18)
+--- testing: -9223372036854775807 ---
+float(-9.2233720368548E+18)
+--- testing: -9.2233720368548E+18 ---
+float(-9.2233720368548E+18)
+===DONE===
diff --git a/ext/standard/tests/math/round_error.phpt b/ext/standard/tests/math/round_error.phpt
new file mode 100644
index 0000000..28a6d5c
--- /dev/null
+++ b/ext/standard/tests/math/round_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test round() function : error conditions - incorrect number of args
+--FILE--
+<?php
+/* Prototype : float round ( float $val [, int $precision ] )
+ * Description: Returns the rounded value of val to specified precision (number of digits
+ * after the decimal point)
+ * Source code: ext/standard/math.c
+ */
+
+/*
+ * Pass incorrect number of arguments to round() to test behaviour
+ */
+
+echo "*** Testing round() : error conditions ***\n";
+
+echo "\n-- Wrong nmumber of arguments --\n";
+var_dump(round());
+var_dump(round(500, 10, true));
+
+?>
+===Done===
+--EXPECTF--
+*** Testing round() : error conditions ***
+
+-- Wrong nmumber of arguments --
+
+Warning: round() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+float(500)
+===Done===
diff --git a/ext/standard/tests/math/round_large_exp.phpt b/ext/standard/tests/math/round_large_exp.phpt
new file mode 100644
index 0000000..36db605
--- /dev/null
+++ b/ext/standard/tests/math/round_large_exp.phpt
@@ -0,0 +1,30 @@
+--TEST--
+round() works correctly for large exponents
+--FILE--
+<?php
+var_dump (2e-22 == round (2e-22, 22, PHP_ROUND_HALF_UP));
+var_dump (1e-22 == round (1e-22, 22, PHP_ROUND_HALF_UP));
+var_dump (2e-23 == round (2e-23, 23, PHP_ROUND_HALF_UP));
+var_dump (1e-23 == round (1e-23, 23, PHP_ROUND_HALF_UP));
+var_dump (2e-24 == round (2e-24, 24, PHP_ROUND_HALF_UP));
+var_dump (1e-24 == round (1e-24, 24, PHP_ROUND_HALF_UP));
+var_dump (2e22 == round (2e22, -22, PHP_ROUND_HALF_UP));
+var_dump (1e22 == round (1e22, -22, PHP_ROUND_HALF_UP));
+var_dump (2e23 == round (2e23, -23, PHP_ROUND_HALF_UP));
+var_dump (1e23 == round (1e23, -23, PHP_ROUND_HALF_UP));
+var_dump (2e24 == round (2e24, -24, PHP_ROUND_HALF_UP));
+var_dump (1e24 == round (1e24, -24, PHP_ROUND_HALF_UP));
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
diff --git a/ext/standard/tests/math/round_modes.phpt b/ext/standard/tests/math/round_modes.phpt
new file mode 100644
index 0000000..03479c4
--- /dev/null
+++ b/ext/standard/tests/math/round_modes.phpt
@@ -0,0 +1,38 @@
+--TEST--
+round() with different rounding modes
+--FILE--
+<?php
+var_dump (round (2.5, 0, PHP_ROUND_HALF_UP));
+var_dump (round (2.5, 0, PHP_ROUND_HALF_DOWN));
+var_dump (round (2.5, 0, PHP_ROUND_HALF_EVEN));
+var_dump (round (2.5, 0, PHP_ROUND_HALF_ODD));
+var_dump (round (-2.5, 0, PHP_ROUND_HALF_UP));
+var_dump (round (-2.5, 0, PHP_ROUND_HALF_DOWN));
+var_dump (round (-2.5, 0, PHP_ROUND_HALF_EVEN));
+var_dump (round (-2.5, 0, PHP_ROUND_HALF_ODD));
+var_dump (round (3.5, 0, PHP_ROUND_HALF_UP));
+var_dump (round (3.5, 0, PHP_ROUND_HALF_DOWN));
+var_dump (round (3.5, 0, PHP_ROUND_HALF_EVEN));
+var_dump (round (3.5, 0, PHP_ROUND_HALF_ODD));
+var_dump (round (-3.5, 0, PHP_ROUND_HALF_UP));
+var_dump (round (-3.5, 0, PHP_ROUND_HALF_DOWN));
+var_dump (round (-3.5, 0, PHP_ROUND_HALF_EVEN));
+var_dump (round (-3.5, 0, PHP_ROUND_HALF_ODD));
+?>
+--EXPECT--
+float(3)
+float(2)
+float(2)
+float(3)
+float(-3)
+float(-2)
+float(-2)
+float(-3)
+float(4)
+float(3)
+float(4)
+float(3)
+float(-4)
+float(-3)
+float(-4)
+float(-3)
diff --git a/ext/standard/tests/math/round_prerounding.phpt b/ext/standard/tests/math/round_prerounding.phpt
new file mode 100644
index 0000000..0419d6c
--- /dev/null
+++ b/ext/standard/tests/math/round_prerounding.phpt
@@ -0,0 +1,10 @@
+--TEST--
+round() prerounds results to precision
+--INI--
+precision=14
+--FILE--
+<?php
+var_dump (round (0.285, 2, PHP_ROUND_HALF_UP));
+?>
+--EXPECT--
+float(0.29)
diff --git a/ext/standard/tests/math/round_variation1.phpt b/ext/standard/tests/math/round_variation1.phpt
new file mode 100644
index 0000000..c89dd68
--- /dev/null
+++ b/ext/standard/tests/math/round_variation1.phpt
@@ -0,0 +1,173 @@
+--TEST--
+Test round() function : usage variations - different data types as $val argument
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float round ( float $val [, int $precision ] )
+ * Description: Returns the rounded value of val to specified precision (number of digits
+ * after the decimal point)
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing round() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of round()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(round($input, 14));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing round() : usage variations ***
+
+-- Iteration 1 --
+float(0)
+
+-- Iteration 2 --
+float(1)
+
+-- Iteration 3 --
+float(12345)
+
+-- Iteration 4 --
+float(-2345)
+
+-- Iteration 5 --
+float(2147483647)
+
+-- Iteration 6 --
+float(10.5)
+
+-- Iteration 7 --
+float(-10.5)
+
+-- Iteration 8 --
+float(123456789000)
+
+-- Iteration 9 --
+float(1.23457E-9)
+
+-- Iteration 10 --
+float(0.5)
+
+-- Iteration 11 --
+float(0)
+
+-- Iteration 12 --
+float(0)
+
+-- Iteration 13 --
+float(1)
+
+-- Iteration 14 --
+float(0)
+
+-- Iteration 15 --
+float(1)
+
+-- Iteration 16 --
+float(0)
+
+-- Iteration 17 --
+float(0)
+
+-- Iteration 18 --
+float(0)
+
+-- Iteration 19 --
+bool(false)
+
+-- Iteration 20 --
+float(0)
+
+-- Iteration 21 --
+float(0)
+
+-- Iteration 22 --
+float(0)
+
+-- Iteration 23 --
+
+Notice: Object of class classA could not be converted to int in %s on line %d
+float(1)
+
+-- Iteration 24 --
+float(0)
+
+-- Iteration 25 --
+float(0)
+
+-- Iteration 26 --
+float(%f)
+===Done===
diff --git a/ext/standard/tests/math/round_variation2.phpt b/ext/standard/tests/math/round_variation2.phpt
new file mode 100644
index 0000000..2fd9061
--- /dev/null
+++ b/ext/standard/tests/math/round_variation2.phpt
@@ -0,0 +1,187 @@
+--TEST--
+Test round() function : usage variations - different data types as $precision argument
+--INI--
+precision=14
+--FILE--
+<?php
+/* Prototype : float round ( float $val [, int $precision ] )
+ * Description: Returns the rounded value of val to specified precision (number of digits
+ * after the decimal point)
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing round() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e5,
+ 12.3456789000E-5,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of round()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(round(123.4456789, $input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing round() : usage variations ***
+
+-- Iteration 1 --
+float(123)
+
+-- Iteration 2 --
+float(123.4)
+
+-- Iteration 3 --
+float(123.4456789)
+
+-- Iteration 4 --
+float(0)
+
+-- Iteration 5 --
+float(123.4456789)
+
+-- Iteration 6 --
+float(123.4456789)
+
+-- Iteration 7 --
+float(0)
+
+-- Iteration 8 --
+float(123.4456789)
+
+-- Iteration 9 --
+float(123)
+
+-- Iteration 10 --
+float(123)
+
+-- Iteration 11 --
+float(123)
+
+-- Iteration 12 --
+float(123)
+
+-- Iteration 13 --
+float(123.4)
+
+-- Iteration 14 --
+float(123)
+
+-- Iteration 15 --
+float(123.4)
+
+-- Iteration 16 --
+float(123)
+
+-- Iteration 17 --
+
+Warning: round() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: round() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: round() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: round() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: round() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: round() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: round() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+float(123)
+
+-- Iteration 25 --
+float(123)
+
+-- Iteration 26 --
+
+Warning: round() expects parameter 2 to be long, resource given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/standard/tests/math/sin_basic.phpt b/ext/standard/tests/math/sin_basic.phpt
new file mode 100644
index 0000000..2b55ad7
--- /dev/null
+++ b/ext/standard/tests/math/sin_basic.phpt
@@ -0,0 +1,92 @@
+--TEST--
+Test return type and value for expected input sin()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float sin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+
+// Use known values to test
+
+$sixty = M_PI / 3.0;
+$thirty = M_PI / 6.0;
+$ninety = M_PI /2.0;
+$oneeighty = M_PI;
+$twoseventy = M_PI * 1.5;
+$threesixty = M_PI * 2.0;
+
+
+echo "sin 30 = ";
+var_dump(sin($thirty));
+if (allowed_rounding_error(sin($thirty),0.5)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sin 60 = ";
+var_dump(sin($sixty));
+if (allowed_rounding_error(sin($sixty),0.86602540378444)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sin 90 = ";
+var_dump(sin($ninety));
+if (allowed_rounding_error(sin($ninety),1.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sin 180 = ";
+var_dump(sin($oneeighty));
+if (allowed_rounding_error(sin($oneeighty),0.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sin 270 = ";
+var_dump(sin($twoseventy));
+if (allowed_rounding_error(sin($twoseventy),-1.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sin 360 = ";
+var_dump(sin($threesixty));
+if (allowed_rounding_error(sin($threesixty),0.0)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+?>
+--EXPECTF--
+sin 30 = float(%f)
+Pass
+sin 60 = float(%f)
+Pass
+sin 90 = float(%f)
+Pass
+sin 180 = float(%f)
+Pass
+sin 270 = float(%f)
+Pass
+sin 360 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/sin_basiclong_64bit.phpt b/ext/standard/tests/math/sin_basiclong_64bit.phpt
new file mode 100644
index 0000000..55b859a
--- /dev/null
+++ b/ext/standard/tests/math/sin_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test sin function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(sin($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(0.99993037667344)
+--- testing: -9223372036854775808 ---
+float(-0.99993037667344)
+--- testing: 2147483647 ---
+float(-0.72491655514456)
+--- testing: -2147483648 ---
+float(0.97131017579294)
+--- testing: 9223372034707292160 ---
+float(0.24926117141025)
+--- testing: -9223372034707292160 ---
+float(-0.24926117141025)
+--- testing: 2147483648 ---
+float(-0.97131017579294)
+--- testing: -2147483649 ---
+float(0.32468570024367)
+--- testing: 4294967294 ---
+float(0.99869824346666)
+--- testing: 4294967295 ---
+float(0.49667719175329)
+--- testing: 4294967293 ---
+float(0.58252073586971)
+--- testing: 9223372036854775806 ---
+float(0.99993037667344)
+--- testing: 9.2233720368548E+18 ---
+float(0.99993037667344)
+--- testing: -9223372036854775807 ---
+float(-0.99993037667344)
+--- testing: -9.2233720368548E+18 ---
+float(-0.99993037667344)
+===DONE===
diff --git a/ext/standard/tests/math/sin_error.phpt b/ext/standard/tests/math/sin_error.phpt
new file mode 100644
index 0000000..41a4b2e
--- /dev/null
+++ b/ext/standard/tests/math/sin_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for sin()
+--FILE--
+<?php
+/*
+ * proto float sin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(sin($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(sin());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: sin() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: sin() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/sin_variation.phpt b/ext/standard/tests/math/sin_variation.phpt
new file mode 100644
index 0000000..ff95e99
--- /dev/null
+++ b/ext/standard/tests/math/sin_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of sin()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float sin(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test sin with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = sin($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(-0.8462204042)
+float(0.8462204042)
+float(-0.9937407102)
+float(0.9937407102)
+float(-0.8462204042)
+float(-0.8462204042)
+float(-0.8462204042)
+float(-0.9937407102)
+float(-0.9937407102)
+
+Warning: sin() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(0.8268795405)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(0.8268795405)
+float(0)
+float(0.8414709848)
+float(0)
diff --git a/ext/standard/tests/math/sinh_basic.phpt b/ext/standard/tests/math/sinh_basic.phpt
new file mode 100644
index 0000000..79bef63
--- /dev/null
+++ b/ext/standard/tests/math/sinh_basic.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test return type and value for expected input sinh()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float sinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+echo "sinh .5 = ";
+var_dump(sinh(0.5));
+if (allowed_rounding_error(sinh(0.5),0.52109530549375)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sinh -0.5 = ";
+var_dump(sinh(-0.5));
+if (allowed_rounding_error(sinh(-0.5), -0.52109530549375)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sinh 3 = ";
+var_dump(sinh(3.0));
+if (allowed_rounding_error(sinh(3.0), 10.01787492741)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "sinh -3 = ";
+var_dump(sinh(-3.0));
+if (allowed_rounding_error(sinh(-3.0), -10.01787492741)){
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+sinh .5 = float(%f)
+Pass
+sinh -0.5 = float(%f)
+Pass
+sinh 3 = float(%f)
+Pass
+sinh -3 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/sinh_basiclong_64bit.phpt b/ext/standard/tests/math/sinh_basiclong_64bit.phpt
new file mode 100644
index 0000000..5206814
--- /dev/null
+++ b/ext/standard/tests/math/sinh_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test sinh function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(sinh($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(INF)
+--- testing: -9223372036854775808 ---
+float(-INF)
+--- testing: 2147483647 ---
+float(INF)
+--- testing: -2147483648 ---
+float(-INF)
+--- testing: 9223372034707292160 ---
+float(INF)
+--- testing: -9223372034707292160 ---
+float(-INF)
+--- testing: 2147483648 ---
+float(INF)
+--- testing: -2147483649 ---
+float(-INF)
+--- testing: 4294967294 ---
+float(INF)
+--- testing: 4294967295 ---
+float(INF)
+--- testing: 4294967293 ---
+float(INF)
+--- testing: 9223372036854775806 ---
+float(INF)
+--- testing: 9.2233720368548E+18 ---
+float(INF)
+--- testing: -9223372036854775807 ---
+float(-INF)
+--- testing: -9.2233720368548E+18 ---
+float(-INF)
+===DONE===
diff --git a/ext/standard/tests/math/sinh_error.phpt b/ext/standard/tests/math/sinh_error.phpt
new file mode 100644
index 0000000..70decf2
--- /dev/null
+++ b/ext/standard/tests/math/sinh_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for sinh()
+--FILE--
+<?php
+/*
+ * proto float sinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(sinh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(sinh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: sinh() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: sinh() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/sinh_variation.phpt b/ext/standard/tests/math/sinh_variation.phpt
new file mode 100644
index 0000000..3704e0f
--- /dev/null
+++ b/ext/standard/tests/math/sinh_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of sinh()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float sinh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test sinh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = sinh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(4872401723)
+float(-4872401723)
+float(7641446995)
+float(-7641446995)
+float(4872401723)
+float(4872401723)
+float(4872401723)
+float(7641446995)
+float(7641446995)
+
+Warning: sinh() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(INF)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(INF)
+float(0)
+float(1.175201194)
+float(0)
diff --git a/ext/standard/tests/math/sqrt_basic.phpt b/ext/standard/tests/math/sqrt_basic.phpt
new file mode 100644
index 0000000..076a113
--- /dev/null
+++ b/ext/standard/tests/math/sqrt_basic.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Test return type and value for expected input sqrt()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float sqrt(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 9.0;
+
+var_dump(sqrt($arg_0));
+
+?>
+--EXPECT--
+float(3)
diff --git a/ext/standard/tests/math/sqrt_basiclong_64bit.phpt b/ext/standard/tests/math/sqrt_basiclong_64bit.phpt
new file mode 100644
index 0000000..99091e2
--- /dev/null
+++ b/ext/standard/tests/math/sqrt_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test sqrt function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(sqrt($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(3037000499.976)
+--- testing: -9223372036854775808 ---
+float(NAN)
+--- testing: 2147483647 ---
+float(46340.950001052)
+--- testing: -2147483648 ---
+float(NAN)
+--- testing: 9223372034707292160 ---
+float(3037000499.6225)
+--- testing: -9223372034707292160 ---
+float(NAN)
+--- testing: 2147483648 ---
+float(46340.950011842)
+--- testing: -2147483649 ---
+float(NAN)
+--- testing: 4294967294 ---
+float(65535.999984741)
+--- testing: 4294967295 ---
+float(65535.999992371)
+--- testing: 4294967293 ---
+float(65535.999977112)
+--- testing: 9223372036854775806 ---
+float(3037000499.976)
+--- testing: 9.2233720368548E+18 ---
+float(3037000499.976)
+--- testing: -9223372036854775807 ---
+float(NAN)
+--- testing: -9.2233720368548E+18 ---
+float(NAN)
+===DONE===
diff --git a/ext/standard/tests/math/sqrt_error.phpt b/ext/standard/tests/math/sqrt_error.phpt
new file mode 100644
index 0000000..66d6d27
--- /dev/null
+++ b/ext/standard/tests/math/sqrt_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test wrong number of arguments for sqrt()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float sqrt(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(sqrt($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(sqrt());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: sqrt() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: sqrt() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/sqrt_variation.phpt b/ext/standard/tests/math/sqrt_variation.phpt
new file mode 100644
index 0000000..bb1806b
--- /dev/null
+++ b/ext/standard/tests/math/sqrt_variation.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test variations in usage of sqrt()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float sqrt(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test sqrt with a different input values
+echo "*** Testing sqrt() : usage variations ***\n";
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = sqrt($values[$i]);
+ var_dump($res);
+}
+
+?>
+===Done===
+--EXPECTF--
+*** Testing sqrt() : usage variations ***
+float(4.7958315233127)
+float(NAN)
+float(4.8425200051213)
+float(NAN)
+float(4.7958315233127)
+float(4.7958315233127)
+float(4.7958315233127)
+float(4.8425200051213)
+float(4.8425200051213)
+
+Warning: sqrt() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(31.622776601684)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(31.622776601684)
+float(0)
+float(1)
+float(0)
+===Done===
diff --git a/ext/standard/tests/math/srand_basic.phpt b/ext/standard/tests/math/srand_basic.phpt
new file mode 100644
index 0000000..b56ad10
--- /dev/null
+++ b/ext/standard/tests/math/srand_basic.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test srand() - basic function test for srand()
+--FILE--
+<?php
+/* Prototype : void srand ([ int $seed ] )
+ * Description: Seed the random number generator.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing srand() : basic functionality ***\n";
+
+// Should return NULL if given anything that it can convert to long
+// This doesn't actually test what it does with the input :-\
+var_dump(srand());
+var_dump(srand(500));
+var_dump(srand(500.1));
+var_dump(srand("500"));
+var_dump(srand("500E3"));
+var_dump(srand(true));
+var_dump(srand(false));
+var_dump(srand(NULL));
+?>
+===Done===
+--EXPECTF--
+*** Testing srand() : basic functionality ***
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+NULL
+===Done===
diff --git a/ext/standard/tests/math/srand_error.phpt b/ext/standard/tests/math/srand_error.phpt
new file mode 100644
index 0000000..4c21e55
--- /dev/null
+++ b/ext/standard/tests/math/srand_error.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test srand() function : error conditions - incorrect number of args
+--FILE--
+<?php
+/* Prototype : void srand ([ int $seed ] )
+ * Description: Seed the random number generator.
+ * Source code: ext/standard/rand.c
+ */
+
+/*
+ * Pass incorrect number of arguments to srand() to test behaviour
+ */
+
+echo "*** Testing srand() : error conditions ***\n";
+
+var_dump(srand(500, true));
+var_dump(srand("fivehundred"));
+var_dump(srand("500ABC"));
+?>
+===Done===
+--EXPECTF--
+*** Testing srand() : error conditions ***
+
+Warning: srand() expects at most 1 parameter, 2 given in %s on line %d
+NULL
+
+Warning: srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+Notice: A non well formed numeric value encountered in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/srand_variation1.phpt b/ext/standard/tests/math/srand_variation1.phpt
new file mode 100644
index 0000000..16da80f
--- /dev/null
+++ b/ext/standard/tests/math/srand_variation1.phpt
@@ -0,0 +1,184 @@
+--TEST--
+Test srand() function : usage variations - different data types as $seed argument
+--FILE--
+<?php
+/* Prototype : void srand ([ int $seed ] )
+ * Description: Seed the random number generator.
+ * Source code: ext/standard/rand.c
+ */
+
+echo "*** Testing srand() : usage variations ***\n";
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// heredoc string
+$heredoc = <<<EOT
+abc
+xyz
+EOT;
+
+// get a class
+class classA
+{
+}
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+$inputs = array(
+ // int data
+/*1*/ 0,
+ 1,
+ 12345,
+ -2345,
+ 2147483647,
+
+ // float data
+/*6*/ 10.5,
+ -10.5,
+ 12.3456789000e10,
+ 12.3456789000E-10,
+ .5,
+
+ // null data
+/*11*/ NULL,
+ null,
+
+ // boolean data
+/*13*/ true,
+ false,
+ TRUE,
+ FALSE,
+
+ // empty data
+/*17*/ "",
+ '',
+ array(),
+
+ // string data
+/*20*/ "abcxyz",
+ 'abcxyz',
+ $heredoc,
+
+ // object data
+/*23*/ new classA(),
+
+ // undefined data
+/*24*/ @$undefined_var,
+
+ // unset data
+/*25*/ @$unset_var,
+
+ // resource variable
+/*26*/ $fp
+);
+
+// loop through each element of $inputs to check the behaviour of srand()
+$iterator = 1;
+foreach($inputs as $input) {
+ echo "\n-- Iteration $iterator --\n";
+ var_dump(srand($input));
+ $iterator++;
+};
+fclose($fp);
+?>
+===Done===
+--EXPECTF--
+*** Testing srand() : usage variations ***
+
+-- Iteration 1 --
+NULL
+
+-- Iteration 2 --
+NULL
+
+-- Iteration 3 --
+NULL
+
+-- Iteration 4 --
+NULL
+
+-- Iteration 5 --
+NULL
+
+-- Iteration 6 --
+NULL
+
+-- Iteration 7 --
+NULL
+
+-- Iteration 8 --
+NULL
+
+-- Iteration 9 --
+NULL
+
+-- Iteration 10 --
+NULL
+
+-- Iteration 11 --
+NULL
+
+-- Iteration 12 --
+NULL
+
+-- Iteration 13 --
+NULL
+
+-- Iteration 14 --
+NULL
+
+-- Iteration 15 --
+NULL
+
+-- Iteration 16 --
+NULL
+
+-- Iteration 17 --
+
+Warning: srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 18 --
+
+Warning: srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 19 --
+
+Warning: srand() expects parameter 1 to be long, array given in %s on line %d
+NULL
+
+-- Iteration 20 --
+
+Warning: srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 21 --
+
+Warning: srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 22 --
+
+Warning: srand() expects parameter 1 to be long, string given in %s on line %d
+NULL
+
+-- Iteration 23 --
+
+Warning: srand() expects parameter 1 to be long, object given in %s on line %d
+NULL
+
+-- Iteration 24 --
+NULL
+
+-- Iteration 25 --
+NULL
+
+-- Iteration 26 --
+
+Warning: srand() expects parameter 1 to be long, resource given in %s on line %d
+NULL
+===Done===
diff --git a/ext/standard/tests/math/tan_basic.phpt b/ext/standard/tests/math/tan_basic.phpt
new file mode 100644
index 0000000..e2934fb
--- /dev/null
+++ b/ext/standard/tests/math/tan_basic.phpt
@@ -0,0 +1,41 @@
+--TEST--
+Test return type and value for expected input tan()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float tan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+$sixty = M_PI / 3.0;
+$thirty = M_PI / 6.0;
+
+echo "tan 60 = ";
+var_dump(tan($sixty));
+if (allowed_rounding_error(tan($sixty),1.7320508075689)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "tan 30 = ";
+var_dump(tan($thirty));
+if (allowed_rounding_error(tan($thirty),0.57735026918963)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+tan 60 = float(%f)
+Pass
+tan 30 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/tan_basiclong_64bit.phpt b/ext/standard/tests/math/tan_basiclong_64bit.phpt
new file mode 100644
index 0000000..8ab083d
--- /dev/null
+++ b/ext/standard/tests/math/tan_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test tan function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(tan($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(84.739312968756)
+--- testing: -9223372036854775808 ---
+float(-84.739312968756)
+--- testing: 2147483647 ---
+float(1.0523779637351)
+--- testing: -2147483648 ---
+float(4.0842894552986)
+--- testing: 9223372034707292160 ---
+float(-0.25738520049439)
+--- testing: -9223372034707292160 ---
+float(0.25738520049439)
+--- testing: 2147483648 ---
+float(-4.0842894552986)
+--- testing: -2147483649 ---
+float(0.34328416030117)
+--- testing: 4294967294 ---
+float(-19.579238091943)
+--- testing: 4294967295 ---
+float(-0.57225137018055)
+--- testing: 4294967293 ---
+float(0.71667000824652)
+--- testing: 9223372036854775806 ---
+float(84.739312968756)
+--- testing: 9.2233720368548E+18 ---
+float(84.739312968756)
+--- testing: -9223372036854775807 ---
+float(-84.739312968756)
+--- testing: -9.2233720368548E+18 ---
+float(-84.739312968756)
+===DONE===
diff --git a/ext/standard/tests/math/tan_error.phpt b/ext/standard/tests/math/tan_error.phpt
new file mode 100644
index 0000000..b3d4cf8
--- /dev/null
+++ b/ext/standard/tests/math/tan_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for tan()
+--FILE--
+<?php
+/*
+ * proto float tan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(tan($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(tan());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: tan() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: tan() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/tan_variation.phpt b/ext/standard/tests/math/tan_variation.phpt
new file mode 100644
index 0000000..59aa5be
--- /dev/null
+++ b/ext/standard/tests/math/tan_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of tan()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float tan(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test tan with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = tan($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(1.588153083)
+float(-1.588153083)
+float(8.895619796)
+float(-8.895619796)
+float(1.588153083)
+float(1.588153083)
+float(1.588153083)
+float(8.895619796)
+float(8.895619796)
+
+Warning: tan() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(1.470324156)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(1.470324156)
+float(0)
+float(1.557407725)
+float(0)
diff --git a/ext/standard/tests/math/tanh_basic.phpt b/ext/standard/tests/math/tanh_basic.phpt
new file mode 100644
index 0000000..6b6a9df
--- /dev/null
+++ b/ext/standard/tests/math/tanh_basic.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test return type and value for expected input tanh()
+--INI--
+precision = 14
+--FILE--
+<?php
+/*
+ * proto float tanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+$file_path = dirname(__FILE__);
+require($file_path."/allowed_rounding_error.inc");
+
+
+echo "tanh .5 = ";
+var_dump(tanh(0.5));
+if (allowed_rounding_error(tanh(0.5), 0.46211715726001)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "tanh -0.5 = ";
+var_dump(tanh(-0.5));
+if (allowed_rounding_error(tanh(-0.5), -0.46211715726001)) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "tanh 3 = ";
+var_dump(tanh(3.0));
+if (allowed_rounding_error(tanh(3.0),0.99505475368673 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+echo "tanh -3 = ";
+var_dump(tanh(-3.0));
+if (allowed_rounding_error(tanh(-3.0),-0.99505475368673 )) {
+ echo "Pass\n";
+}
+else {
+ echo "Fail\n";
+}
+
+?>
+--EXPECTF--
+tanh .5 = float(%f)
+Pass
+tanh -0.5 = float(%f)
+Pass
+tanh 3 = float(%f)
+Pass
+tanh -3 = float(%f)
+Pass
diff --git a/ext/standard/tests/math/tanh_basiclong_64bit.phpt b/ext/standard/tests/math/tanh_basiclong_64bit.phpt
new file mode 100644
index 0000000..02e6c10
--- /dev/null
+++ b/ext/standard/tests/math/tanh_basiclong_64bit.phpt
@@ -0,0 +1,60 @@
+--TEST--
+Test tanh function : 64bit long tests
+--SKIPIF--
+<?php
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+?>
+--FILE--
+<?php
+
+define("MAX_64Bit", 9223372036854775807);
+define("MAX_32Bit", 2147483647);
+define("MIN_64Bit", -9223372036854775807 - 1);
+define("MIN_32Bit", -2147483647 - 1);
+
+$longVals = array(
+ MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
+ MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
+ MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
+);
+
+
+foreach ($longVals as $longVal) {
+ echo "--- testing: $longVal ---\n";
+ var_dump(tanh($longVal));
+}
+
+?>
+===DONE===
+--EXPECT--
+--- testing: 9223372036854775807 ---
+float(1)
+--- testing: -9223372036854775808 ---
+float(-1)
+--- testing: 2147483647 ---
+float(1)
+--- testing: -2147483648 ---
+float(-1)
+--- testing: 9223372034707292160 ---
+float(1)
+--- testing: -9223372034707292160 ---
+float(-1)
+--- testing: 2147483648 ---
+float(1)
+--- testing: -2147483649 ---
+float(-1)
+--- testing: 4294967294 ---
+float(1)
+--- testing: 4294967295 ---
+float(1)
+--- testing: 4294967293 ---
+float(1)
+--- testing: 9223372036854775806 ---
+float(1)
+--- testing: 9.2233720368548E+18 ---
+float(1)
+--- testing: -9223372036854775807 ---
+float(-1)
+--- testing: -9.2233720368548E+18 ---
+float(-1)
+===DONE===
diff --git a/ext/standard/tests/math/tanh_error.phpt b/ext/standard/tests/math/tanh_error.phpt
new file mode 100644
index 0000000..cc92cb4
--- /dev/null
+++ b/ext/standard/tests/math/tanh_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test wrong number of arguments for tanh()
+--FILE--
+<?php
+/*
+ * proto float tanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+$arg_0 = 1.0;
+$extra_arg = 1;
+
+echo "\nToo many arguments\n";
+var_dump(tanh($arg_0, $extra_arg));
+
+echo "\nToo few arguments\n";
+var_dump(tanh());
+
+?>
+--EXPECTF--
+Too many arguments
+
+Warning: tanh() expects exactly 1 parameter, 2 given in %s on line %d
+NULL
+
+Too few arguments
+
+Warning: tanh() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
diff --git a/ext/standard/tests/math/tanh_variation.phpt b/ext/standard/tests/math/tanh_variation.phpt
new file mode 100644
index 0000000..e5e65a3
--- /dev/null
+++ b/ext/standard/tests/math/tanh_variation.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test variations in usage of tanh()
+--INI--
+precision = 10
+--FILE--
+<?php
+/*
+ * proto float tanh(float number)
+ * Function is implemented in ext/standard/math.c
+*/
+
+
+//Test tanh with a different input values
+
+$values = array(23,
+ -23,
+ 2.345e1,
+ -2.345e1,
+ 0x17,
+ 027,
+ "23",
+ "23.45",
+ "2.345e1",
+ "nonsense",
+ "1000",
+ "1000ABC",
+ null,
+ true,
+ false);
+
+for ($i = 0; $i < count($values); $i++) {
+ $res = tanh($values[$i]);
+ var_dump($res);
+}
+
+?>
+--EXPECTF--
+float(1)
+float(-1)
+float(1)
+float(-1)
+float(1)
+float(1)
+float(1)
+float(1)
+float(1)
+
+Warning: tanh() expects parameter 1 to be double, string given in %s on line %d
+NULL
+float(1)
+
+Notice: A non well formed numeric value encountered in %s on line %d
+float(1)
+float(0)
+float(0.761594156)
+float(0)