blob: 4f7962ce5eb0a544719a1f69e4d3de9ccfac3715 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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 = __DIR__;
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
|