summaryrefslogtreecommitdiff
path: root/ext/standard/tests/math/tanh_basic.phpt
diff options
context:
space:
mode:
authorZoe Slattery <zoe@php.net>2007-09-04 11:18:35 +0000
committerZoe Slattery <zoe@php.net>2007-09-04 11:18:35 +0000
commit8e59bf05cb0095f19a36799126729f623ce53ee0 (patch)
tree17c00b5e4e659bbb5154c7fed357cb290bf18f12 /ext/standard/tests/math/tanh_basic.phpt
parent81313aed39ed3af2bbde2addae79d0990fea14dd (diff)
downloadphp-git-8e59bf05cb0095f19a36799126729f623ce53ee0.tar.gz
Test cases for sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh.
Diffstat (limited to 'ext/standard/tests/math/tanh_basic.phpt')
-rw-r--r--ext/standard/tests/math/tanh_basic.phpt60
1 files changed, 60 insertions, 0 deletions
diff --git a/ext/standard/tests/math/tanh_basic.phpt b/ext/standard/tests/math/tanh_basic.phpt
new file mode 100644
index 0000000000..6b6a9dff7d
--- /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