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