try this:
#define EXP_ITERATIONS 32
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;
}
increase "EXP_ITERATIONS" for more precision, decrease for more speed
On 5/20/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hello everyone,
I have a problem with math functions. I have the MathLib.c, MathLib.h and
MathLib.prc files in my project from the zip download. Below here is part of my
code.
It crashes in the exp() function.
Any help is appreciated.
Carlos
#include <PalmOS.h>
#include "AppResources.h"
#include "MathLib.h"
....
Boolean CalculateRisk()
{
double PI;
....
PI += -1.236215274 - 2.598564382 - 2.119863737;
PI = exp(PI);
....
return handled;
}
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
--
Best Regards,
Dmitry Grinberg
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/