#define EXP_ITERATIONS                          32
#define LN_ITERATIONS                           64
#define E_POW_FOR_LN_T                          .25
#define E_POW_FOR_LN_T_V                        1.284025416688
#define E_POW_FOR_LN_B                          .125
#define E_POW_FOR_LN_B_V                        1.133148453067



#define COLORTABLE_FAKE_RES_ID          39087



inline double exp(double x){
        
        double cx=x,res=1,fact=1;
        UInt32 i;
        
        
        for(i=1;i<=EXP_ITERATIONS;i++){
                
                fact*=i;
                res+=cx/fact;
                cx*=x;
                
        }
        
        return res;
}


inline double ln(double x){
        
        double cx,res=0;
        UInt32 i;
        
        while(x>E_POW_FOR_LN_T_V){
                
                res+=E_POW_FOR_LN_T;
                x/=E_POW_FOR_LN_T_V;
                
        }
                
        while(x<E_POW_FOR_LN_B_V){
                
                res-=E_POW_FOR_LN_B;
                x*=E_POW_FOR_LN_B_V;
                
        }
                
        x-=1.0;
        cx=x;
        
        for(i=1;i<=LN_ITERATIONS;i++){
                
                if(i&1){
                        
                        res+=cx/i;
                        
                }
                else{
                        
                        res-=cx/i;
                        
                }
                
                cx*=x;
        }
        
        return res;
}

inline double pow(double number,double power){
        
        if(number<.0001)
                return number;
        
        
        return exp(power*ln(number));
        
}

On 5/20/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Thank you very much... it works, thanks a lot... the problem is that I need 
also pow() to complete my project. Do you have the code for pow() as well.

Really appreciated

Carlos
--
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/



--
Best Regards, Dmitry Grinberg
Software Engineer, http://PalmPowerups.com
(847) 226 9295
AIM: hacker19180
MSN: [EMAIL PROTECTED]
ICQ: 165589894
Y! IM: dmitrygr2003

--
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to