cos_variation.phpt 907 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. --TEST--
  2. Test variations in usage of cos()
  3. --INI--
  4. precision = 10
  5. --FILE--
  6. <?php
  7. /*
  8. * proto float cos(float number)
  9. * Function is implemented in ext/standard/math.c
  10. */
  11. //Test cos 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 = cos($values[$i]);
  29. var_dump($res);
  30. }
  31. ?>
  32. --EXPECTF--
  33. float(-0.5328330203)
  34. float(-0.5328330203)
  35. float(-0.1117112391)
  36. float(-0.1117112391)
  37. float(-0.5328330203)
  38. float(-0.5328330203)
  39. float(-0.5328330203)
  40. float(-0.1117112391)
  41. float(-0.1117112391)
  42. Warning: cos() expects parameter 1 to be double, string given in %s on line %d
  43. NULL
  44. float(0.5623790763)
  45. Notice: A non well formed numeric value encountered in %s on line %d
  46. float(0.5623790763)
  47. float(1)
  48. float(0.5403023059)
  49. float(1)