undefined.praat 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #
  2. # Some normal numbers.
  3. #
  4. assert 1 / 2 <> undefined
  5. assert 0 / 2 <> undefined
  6. assert sqrt (10) <> undefined
  7. #
  8. # Some infinities.
  9. #
  10. assert 1 / 0 = undefined
  11. assert 1 div 0 = undefined
  12. assert 1 mod 0 = undefined
  13. assert 10 ^ 500 = undefined
  14. assert exp (1000) = undefined
  15. #
  16. # Some infinitesimals.
  17. #
  18. assert 10 ^ -500 = 0
  19. assert exp (-1000) = 0
  20. #
  21. # Some not-a-numbers.
  22. #
  23. assert sqrt (-10) = undefined
  24. assert 0 / 0 = undefined
  25. assert 0 div 0 = undefined
  26. assert 0 mod 0 = undefined
  27. #
  28. # Propagation.
  29. #
  30. assert - undefined = undefined
  31. assert undefined - undefined = undefined
  32. assert sqrt (undefined) = undefined
  33. assert sqrt (- undefined) = undefined
  34. assert undefined * 0 = undefined
  35. assert 0 * undefined = undefined
  36. assert 1 / undefined = undefined
  37. assert 0 ^ undefined = undefined
  38. assert undefined ^ undefined = undefined
  39. #
  40. # Propagation within larger expressions.
  41. #
  42. assert 1 / (1 / 0) = undefined
  43. assert 1 / (0 / 0) = undefined
  44. assert 1 / exp (1000) = undefined ; not the same as exp (-1000)!
  45. assert 0 ^ (1 / 0) = undefined
  46. assert 0 * (0 / 0) = undefined
  47. assert 0 * (1 / 0) = undefined
  48. #
  49. # Exception to propagation: anything to the power 0 always gives 1 (as in R).
  50. #
  51. assert 0 ^ 0 = 1
  52. ;assert undefined ^ 0 = 1
  53. assert undefined ^ 0 = undefined
  54. ;assert sqrt (-1) ^ 0 = 1
  55. assert sqrt (-1) ^ 0 = undefined