Gast
#968365
Hallo Leute,
ich möchte mit meinen ATmega mit Floatingvariablen arbeiten, stosse aber
auf ein Problem, welches ich mittels eines kleinen Programms zeigen
kann:
#include <math.h>
#include <stdio.h>
int main( void )
{
double PI, x;
char s[16];
PI = 4*atan(1);
x = 180/PI * atan2(2,1);
sprintf(s,"x=%f",x);
while( 1 );
return 0;
}
Der Simulator sagt, PI und x seien richtig berechnet. Im String s steht
aber x=?.
Im Manual vom GCC ließt man in der Beschreibung der stdio.h man solle
"-Wl,-u,vfprintf -lprintf_flt -lm"
den Compiler Options hinzufügen.
Ich nehme an, ich finde das unter Project -> Configuration Options ->
Custom Options -> All files.
Aber das bringt keine Änderung. Was mache ich falsch?
Viele Grüße
Stefan