void summe_float() {
float x1=10000.0;
float x2=-1.0e-3/9;
float x3=25.0e2;
float x4=1.0e-3/7;
float x5=-12.5e3;
float y=x1;
printf("Test A1: (Addition schrittweise):%.21f \n",y);
y=y+x2;
printf("Test A2: (Addition schrittweise):%.21f \n",y);
y=y+x3;
printf("Test A3: (Addition schrittweise):%.21f \n",y);
y=y+x4;
printf("Test A4: (Addition schrittweise):%.21f \n",y);
y=y+x5;
printf("Test A5: (Addition schrittweise):%.21f \n",y);
float z;
z=x1+x2+x3+x4+x5;
printf("Test B: (Addition direkt):%.21f \n",z);
return;
}
Denksport:
Test A1: (Addition schrittweise):10000.000000000000000000000
Test A2: (Addition schrittweise):10000.000000000000000000000
Test A3: (Addition schrittweise):12500.000000000000000000000
Test A4: (Addition schrittweise):12500.000000000000000000000
Zahl X5: -12500.000000000000000000000
Test A5: (Addition schrittweise):0.000000000000000000000
Test B: (Addition direkt):0.000000000000000000000
Netter Versuch.