sin_variation.phpt 905 B

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