rad2deg_variation.phpt 904 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --TEST--
  2. Test variations in usage of rad2deg()
  3. --INI--
  4. precision = 10
  5. --FILE--
  6. <?php
  7. /*
  8. * proto float rad2deg(float number)
  9. * Function is implemented in ext/standard/math.c
  10. */
  11. //Test rad2deg with a different input values
  12. $values = array(23,
  13. -23,
  14. 2.345e1,
  15. -2.345e1,
  16. 0x17,
  17. 027,
  18. "23",
  19. "23.45",
  20. "2.345e1",
  21. "nonsense",
  22. "1000",
  23. "1000ABC",
  24. null,
  25. true,
  26. false);
  27. for ($i = 0; $i < count($values); $i++) {
  28. $res = rad2deg($values[$i]);
  29. var_dump($res);
  30. }
  31. ?>
  32. --EXPECTF--
  33. float(1317.802929)
  34. float(-1317.802929)
  35. float(1343.58603)
  36. float(-1343.58603)
  37. float(1317.802929)
  38. float(1317.802929)
  39. float(1317.802929)
  40. float(1343.58603)
  41. float(1343.58603)
  42. Warning: rad2deg() expects parameter 1 to be double, string given in %s on line %d
  43. NULL
  44. float(57295.77951)
  45. Notice: A non well formed numeric value encountered in %s on line %d
  46. float(57295.77951)
  47. float(0)
  48. float(57.29577951)
  49. float(0)