Mickmicking the pow() function of math.h

This commit is contained in:
Calson Noah 2017-04-30 23:44:01 +01:00
parent 7aa9d0755f
commit 91414eecf0

View File

@ -150,6 +150,23 @@ void get_only_char(char *n)
} }
float my_pow(float base, int exp)//mickmicking the pow function
{
float temp;
if( exp == 0)
return 1;
temp = my_pow(base, exp/2);
if (exp%2 == 0)
return temp*temp;
else
{
if(exp > 0)
return base*temp*temp;
else
return (temp*temp)/base;
}
}
//micking atoi function (returns integer from string) //micking atoi function (returns integer from string)
int my_atoi(const char* snum) int my_atoi(const char* snum)
{ {