xref: /PHP-7.1/ext/standard/tests/math/tan_basic.phpt (revision 7af945e2)
1--TEST--
2Test return type and value for expected input tan()
3--INI--
4precision = 14
5--FILE--
6<?php
7/*
8 * proto float tan(float number)
9 * Function is implemented in ext/standard/math.c
10*/
11
12$file_path = dirname(__FILE__);
13require($file_path."/allowed_rounding_error.inc");
14
15$sixty = M_PI / 3.0;
16$thirty = M_PI / 6.0;
17
18echo "tan 60 = ";
19var_dump(tan($sixty));
20if (allowed_rounding_error(tan($sixty),1.7320508075689)) {
21	echo "Pass\n";
22}
23else {
24	echo "Fail\n";
25}
26
27echo "tan 30 = ";
28var_dump(tan($thirty));
29if (allowed_rounding_error(tan($thirty),0.57735026918963)) {
30	echo "Pass\n";
31}
32else {
33	echo "Fail\n";
34}
35
36?>
37--EXPECTF--
38tan 60 = float(%f)
39Pass
40tan 30 = float(%f)
41Pass
42