lpcware

Problem with FPU and double calculation

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by h.lotfi on Wed Oct 15 01:22:12 MST 2014
Hi,
i have problem with hardware fpu and double calculation!

when i use float variables and enable FPU and initialize it, i can calculate any things, but when i change variables to double the micro  
get stick in the line which I calculate double variables and micro could not pass that line!!!
this is my code:

double f=, ff=;
//float f, ff;
        count = 0; // init counter
f = 1.000001;// pick initial values that will prevent over/under-runs
ff = 0.999999;
msec = 10000;// run the test for ten seconds
do {
//ff *= f;// test of multiplication
ff =ff/ f;// test of division
count++;
count /= 10;
} while(msec);


but when i add an function micro work correctly!!!
this code Work:

double f=, ff=;
//float f, ff;
        count = 0; // init counter
f = 1.000001;// pick initial values that will prevent over/under-runs
ff = 0.999999;
msec = 10000;// run the test for ten seconds
do {
               sprintf(str,"Num:%d\r\n",count);
//ff *= f;// test of multiplication
ff =ff/ f;// test of division
count++;
count /= 10;
} while(msec);



any body know what its for?

i use LPC4357 and Keil

Outcomes