|
|
@ -2,36 +2,22 @@ |
|
|
|
|
|
|
|
#include "exponent.h" |
|
|
|
|
|
|
|
int expI(unsigned int e, int num){ |
|
|
|
int prod = 1; |
|
|
|
if(e==0){ |
|
|
|
double expI(double e, double num){ |
|
|
|
double prod = 1.0; |
|
|
|
if(e==0.0){ |
|
|
|
return 1; |
|
|
|
}else{ |
|
|
|
for(int i = 1; i <=e; i++){ |
|
|
|
for(int i = 1; i <= (int) e; i++){ |
|
|
|
prod *= num; |
|
|
|
} |
|
|
|
return prod; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
float expIN(int e, int num){ |
|
|
|
double expIN(double e, double num){ |
|
|
|
if(e>0){ |
|
|
|
return (float) expI(e, num); |
|
|
|
return expI(e, num); |
|
|
|
}else{ |
|
|
|
printf("%d, %d\n", e, num); |
|
|
|
printf("%f\n", 1.0 / (float) expI((e*-1), num)); |
|
|
|
return (1.0 / (float) expI((e*-1), num)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
float expF(int e, float num){ |
|
|
|
float prod = 1; |
|
|
|
if(e==0){ |
|
|
|
return 1; |
|
|
|
}else{ |
|
|
|
for(int i = 1; i <=e; i++){ |
|
|
|
prod *= num; |
|
|
|
} |
|
|
|
return prod; |
|
|
|
return (1.0 / expI((e*-1), num)); |
|
|
|
} |
|
|
|
} |