Problem Gleitkommatypen Assoziativgesetz

Ok ich habe das Problem für die Addition gelöst
C++:
void BeweisFloat(){
double a = 1E-100;
double b = 1E+100;
double c = 1E+10;
double res;
printf("%.20f\n", a);
printf("%.20f\n", b);
printf("%.20f\n", c);
cout<<"a "<<a<<endl; cout<<"b "<<b<<endl; cout<<"c "<<c<<endl;
//a+(b+c)
res = a*(b*b); cout <<"res1 "<<res<<endl;
printf("%.20f\n", res);
res = (a*b)*b; cout <<"res2 "<<res<<endl;
printf("%.20f\n", res);
}

damit bekomme ich unterschiedliche Ergebnisse...
@deepthroat danke für deine Hilfe, also ich benutze den MingCompiler, werde deins mal testen...für die Multiplikation habe ich noch keine passenden zahlen gefunden, naja...
 
Zuletzt bearbeitet von einem Moderator:
Zurück