mirror of
https://github.com/n05la3/cmdtypist
synced 2024-11-15 12:13:09 +00:00
Mickmicking the pow() function of math.h
This commit is contained in:
parent
7aa9d0755f
commit
91414eecf0
@ -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)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user