You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
486 B

  1. #include <stdio.h>
  2. #include <limits.h>
  3. #include "util.h"
  4. double absD(double x){
  5. if(x<0){
  6. return -1 * x;
  7. }
  8. return x;
  9. }
  10. double squashDegreesTo360(double degrees){
  11. int multiple = degrees / 360;
  12. return degrees - (360*multiple);
  13. }
  14. unsigned long long fac(int x){
  15. unsigned long long prod = 1;
  16. if(x==0) return 1;
  17. for (int i = 1; i <= x; i++){
  18. if (prod > ULLONG_MAX / i){
  19. break;
  20. }
  21. prod*=i;
  22. }
  23. return prod;
  24. }