Annotation of embedaddon/php/ext/standard/tests/math/tanh_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test return type and value for expected input tanh()
3: --INI--
4: precision = 14
5: --FILE--
6: <?php
7: /*
8: * proto float tanh(float number)
9: * Function is implemented in ext/standard/math.c
10: */
11: $file_path = dirname(__FILE__);
12: require($file_path."/allowed_rounding_error.inc");
13:
14:
15: echo "tanh .5 = ";
16: var_dump(tanh(0.5));
17: if (allowed_rounding_error(tanh(0.5), 0.46211715726001)) {
18: echo "Pass\n";
19: }
20: else {
21: echo "Fail\n";
22: }
23:
24: echo "tanh -0.5 = ";
25: var_dump(tanh(-0.5));
26: if (allowed_rounding_error(tanh(-0.5), -0.46211715726001)) {
27: echo "Pass\n";
28: }
29: else {
30: echo "Fail\n";
31: }
32:
33: echo "tanh 3 = ";
34: var_dump(tanh(3.0));
35: if (allowed_rounding_error(tanh(3.0),0.99505475368673 )) {
36: echo "Pass\n";
37: }
38: else {
39: echo "Fail\n";
40: }
41:
42: echo "tanh -3 = ";
43: var_dump(tanh(-3.0));
44: if (allowed_rounding_error(tanh(-3.0),-0.99505475368673 )) {
45: echo "Pass\n";
46: }
47: else {
48: echo "Fail\n";
49: }
50:
51: ?>
52: --EXPECTF--
53: tanh .5 = float(%f)
54: Pass
55: tanh -0.5 = float(%f)
56: Pass
57: tanh 3 = float(%f)
58: Pass
59: tanh -3 = float(%f)
60: Pass
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>