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
28 lines
486 B
#include <stdio.h>
|
|
#include <limits.h>
|
|
|
|
#include "util.h"
|
|
|
|
double absD(double x){
|
|
if(x<0){
|
|
return -1 * x;
|
|
}
|
|
return x;
|
|
}
|
|
|
|
double squashDegreesTo360(double degrees){
|
|
int multiple = degrees / 360;
|
|
return degrees - (360*multiple);
|
|
}
|
|
|
|
unsigned long long fac(int x){
|
|
unsigned long long prod = 1;
|
|
if(x==0) return 1;
|
|
for (int i = 1; i <= x; i++){
|
|
if (prod > ULLONG_MAX / i){
|
|
break;
|
|
}
|
|
prod*=i;
|
|
}
|
|
return prod;
|
|
}
|