rad2deg_basic.phpt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. --TEST--
  2. Test return type and value for expected input rad2deg()
  3. --INI--
  4. precision = 14
  5. --FILE--
  6. <?php
  7. /*
  8. * proto float rad2deg(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. $arg_0 = 0.0;
  14. $arg_1 = 1.570796327;
  15. $arg_2 = 3.141592654;
  16. $arg_3 = 6.283185307;
  17. echo "rad2deg $arg_0= ";
  18. $r0 = rad2deg($arg_0);
  19. var_dump($r0);
  20. if (allowed_rounding_error($r0 ,0 )) {
  21. echo "Pass\n";
  22. }
  23. else {
  24. echo "Fail\n";
  25. }
  26. echo "rad2deg $arg_1 = ";
  27. $r1 = rad2deg($arg_1);
  28. var_dump($r1);
  29. if (allowed_rounding_error($r1 ,90.000000011752)) {
  30. echo "Pass\n";
  31. }
  32. else {
  33. echo "Fail\n";
  34. }
  35. echo "rad2deg $arg_2 = ";
  36. $r2 = rad2deg($arg_2);
  37. var_dump($r2);
  38. if (allowed_rounding_error($r2 ,180.0000000235 )) {
  39. echo "Pass\n";
  40. }
  41. else {
  42. echo "Fail\n";
  43. }
  44. echo "rad2deg $arg_3 = ";
  45. $r3 = rad2deg($arg_3);
  46. var_dump($r3);
  47. if (allowed_rounding_error($r3 ,359.99999998971 )) {
  48. echo "Pass\n";
  49. }
  50. else {
  51. echo "Fail\n";
  52. }
  53. ?>
  54. --EXPECTF--
  55. rad2deg 0= float(%f)
  56. Pass
  57. rad2deg 1.570796327 = float(%f)
  58. Pass
  59. rad2deg 3.141592654 = float(%f)
  60. Pass
  61. rad2deg 6.283185307 = float(%f)
  62. Pass