1--TEST-- 2Test return type and value for expected input cos() 3--INI-- 4precision = 14 5--FILE-- 6<?php 7/* 8 * Function is implemented in ext/standard/math.c 9*/ 10 11$file_path = __DIR__; 12require($file_path."/allowed_rounding_error.inc"); 13 14 15// Use known values to test 16 17$sixty = M_PI / 3.0; 18$thirty = M_PI / 6.0; 19$ninety = M_PI /2.0; 20$oneeighty = M_PI; 21$twoseventy = M_PI * 1.5; 22$threesixty = M_PI * 2.0; 23 24 25echo "cos 30 = "; 26var_dump(cos($thirty)); 27if (allowed_rounding_error(cos($thirty),0.86602540378444)) { 28 echo "Pass\n"; 29} 30else { 31 echo "Fail\n"; 32} 33 34echo "cos 60 = "; 35var_dump(cos($sixty)); 36if (allowed_rounding_error(cos($sixty),0.5)) { 37 echo "Pass\n"; 38} 39else { 40 echo "Fail\n"; 41} 42 43echo "cos 90 = "; 44var_dump(cos($ninety)); 45if (allowed_rounding_error(cos($ninety),0.0)) { 46 echo "Pass\n"; 47} 48else { 49 echo "Fail\n"; 50} 51 52echo "cos 180 = "; 53var_dump(cos($oneeighty)); 54if (allowed_rounding_error(cos($oneeighty),-1.0)) { 55 echo "Pass\n"; 56} 57else { 58 echo "Fail\n"; 59} 60 61echo "cos 270 = "; 62var_dump(cos($twoseventy)); 63if (allowed_rounding_error(cos($twoseventy),0.0)) { 64 echo "Pass\n"; 65} 66else { 67 echo "Fail\n"; 68} 69 70echo "cos 360 = "; 71var_dump(cos($threesixty)); 72if (allowed_rounding_error(cos($threesixty),1.0)) { 73 echo "Pass\n"; 74} 75else { 76 echo "Fail\n"; 77} 78?> 79--EXPECTF-- 80cos 30 = float(%f) 81Pass 82cos 60 = float(%f) 83Pass 84cos 90 = float(%f) 85Pass 86cos 180 = float(%f) 87Pass 88cos 270 = float(%f) 89Pass 90cos 360 = float(%f) 91Pass 92