Browse Source

add support for negative exponents

master
fdai7848 11 months ago
parent
commit
f157389255
  1. 8
      src/exponent.c
  2. 1
      src/exponent.h

8
src/exponent.c

@ -10,4 +10,12 @@ int expI(unsigned int e, int num){
} }
return prod; return prod;
} }
}
float expIN(int e, int num){
if(e>0){
return (float) expI(e, num);
}else{
return 1.0 / (float) expI(e, num);
}
} }

1
src/exponent.h

@ -2,5 +2,6 @@
#define EXPONENT_H #define EXPONENT_H
int expI(unsigned int e, int num); int expI(unsigned int e, int num);
float expIN(int e, int num);
#endif // exponent.h #endif // exponent.h
Loading…
Cancel
Save