From 91414eecf0db6691552775422882f0026a4bce55 Mon Sep 17 00:00:00 2001 From: Calson Noah Date: Sun, 30 Apr 2017 23:44:01 +0100 Subject: [PATCH] Mickmicking the pow() function of math.h --- functions_for_cmd_typist.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/functions_for_cmd_typist.h b/functions_for_cmd_typist.h index 0dcc1ae..46bb170 100755 --- a/functions_for_cmd_typist.h +++ b/functions_for_cmd_typist.h @@ -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) int my_atoi(const char* snum) {