project_files/hwc/rtl/pmath.c
changeset 14197 3e551b0535fb
parent 14185 801dc57371c3
equal deleted inserted replaced
14196:ab5e710d353d 14197:3e551b0535fb
     1 #include "pmath.h"
     1 #include "pmath.h"
     2 #include <stdlib.h>
     2 #include <stdlib.h>
     3 #include <math.h>
     3 #include <math.h>
     4 
       
     5 /*
       
     6  * power raises base to the power power.
       
     7  * This is equivalent to exp(power*ln(base)). Therefore base should be non-negative.
       
     8  */
       
     9 float fpcrtl_power(float base, float exponent)
       
    10 {
       
    11     return exp(exponent * log(base));
       
    12 }
       
    13 
     4 
    14 /* Currently the games only uses sign of an integer */
     5 /* Currently the games only uses sign of an integer */
    15 int fpcrtl_signi(int x)
     6 int fpcrtl_signi(int x)
    16 {
     7 {
    17     if(x > 0){
     8     if(x > 0){