atan_basic.phpt 751 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --TEST--
  2. Test return type and value for expected input atan()
  3. --INI--
  4. precision = 14
  5. --FILE--
  6. <?php
  7. /*
  8. * proto float atan(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 "atan 1.7320508075689 = ";
  14. $atan1 = 360 * atan(1.7320508075689) / (2.0 * M_PI);
  15. var_dump($atan1);
  16. if (allowed_rounding_error($atan1 ,60 )) {
  17. echo "Pass\n";
  18. }
  19. else {
  20. echo "Fail\n";
  21. }
  22. echo "atan 0.57735026918963 = ";
  23. $atan2 = 360 * atan(0.57735026918963) / (2.0 * M_PI);
  24. var_dump($atan2);
  25. if (allowed_rounding_error($atan2 ,30 )) {
  26. echo "Pass\n";
  27. }
  28. else {
  29. echo "Fail\n";
  30. }
  31. ?>
  32. --EXPECTF--
  33. atan 1.7320508075689 = float(%f)
  34. Pass
  35. atan 0.57735026918963 = float(%f)
  36. Pass