math 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. const float PI = 3.14159265358979323846;
  2. float abs(float f) {
  3. if(f < 0.0) {
  4. return -f;
  5. }
  6. return f;
  7. }
  8. void main() {
  9. test(abs(sin(0.0 * PI)));
  10. test(sin(0.5 * PI));
  11. test(abs(sin(1.0 * PI)));
  12. test(sin(1.5 * PI));
  13. test(abs(sin(2.0 * PI)));
  14. test(cos(0.0 * PI));
  15. test(abs(cos(0.5 * PI)));
  16. test(cos(1.0 * PI));
  17. test(abs(cos(1.5 * PI)));
  18. test(cos(2.0 * PI));
  19. test(abs(tan(0.0 * PI)));
  20. test(abs(tan(1.0 * PI)));
  21. test(abs(tan(2.0 * PI)));
  22. test(abs(asin(sin(0.0))));
  23. test(abs(asin(sin(0.5))));
  24. test(abs(asin(sin(1.0))));
  25. test(abs(asin(sin(1.5))));
  26. test(abs(acos(cos(0.0))));
  27. test(abs(acos(cos(0.5))));
  28. test(abs(acos(cos(1.0))));
  29. test(abs(acos(cos(1.5))));
  30. test(abs(atan(tan(0.0))));
  31. test(abs(atan(tan(0.5))));
  32. test(abs(atan(tan(1.0))));
  33. test(abs(atan(tan(1.5))));
  34. test(ln(256.0) / ln(2.0));
  35. test(log(256.0) / log(2.0));
  36. test(log(1000.0));
  37. test(sqrt(2.0));
  38. test(sqrt(10000.0));
  39. test(pow(2.0, 3.0));
  40. test(pow(2.0, 0.5));
  41. }