cosh_basic.phpt 969 B

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