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