DSPRelated.com
Forums

RE: float powf wrong result

Started by marc...@hotmail.com March 23, 2006
Hi Mike Dunn,
thank you very much that you concerned about my problems!!!!
Here are the test-version from my programm:

COMPILER COMMANDS:
-g -k -q -al -o2 -fr"C:\ti\myprojects\komperzeug\Debug"
-i"C:\ti\c6000\cgtools\include" -d"_DEBUG" -ml3 -mv6700

LINKER COMMANDS:
-g -k -q -al -o2 -fr"C:\ti\myprojects\komperzeug\Debug"
-i"C:\ti\c6000\cgtools\include" -d"_DEBUG" -ml3 -mv6700
___________________________________________________________
APPLICATION (RAM)

void main ()
{
//"Initialize all parameters"
float y;
......
......
float a=0;
while (a<)
{
*eingabe=a;
y=powf(a,a);
komp_aufruf(eingabe,rueckgabe); //"component-call"

printf("rueckgabeCOMP:%f %f\n",a,*rueckgabe); //"result from flash"
printf("rueckgabeMAIN:%f %f\n",a,y); //"result from application"

a=a+1;
}
free(rueckgabe);
free(eingabe);
return ;
}
__________________________________________________________

________________________________________________________
COMPONENT(FLASH)

#include
#include

float komp_onente(float *eingabe_k, float *rueckgabe_k)
{
float i;
i=*eingabe_k;
*rueckgabe_k=powf(i,i);
return 0;
}
_________________________________________________________
THE RESULT
rueckgabeCOMP 0.0 1.0
rueckgabeMAIN 0.0 1.0

rueckgabeCOMP 1.0 1.0
rueckgabeMAIN 1.0 1.0

rueckgabeCOMP 2.0 4.0
rueckgabeMAIN 2.0 4.0

rueckgabeCOMP 3.0 0.0
rueckgabeMAIN 3.0 27.0

rueckgabeCOMP 4.0 256.0
rueckgabeMAIN 4.0 256.0

rueckgabeCOMP 5.0 0.0
rueckgabeMAIN 5.0 3125.0

rueckgabeCOMP 6.0 0.0
rueckgabeMAIN 6.0 46656.0

rueckgabeCOMP 7.0 0.0
rueckgabeMAIN 7.0 823543.0

rueckgabeCOMP 8.0 16777216.0
rueckgabeMAIN 8.0 16777216.0

............
Thank you very much
marco