5
Erreur d'arrondi
- #include <stdio.h>
- main() {
- double x = 1000/3.0;
- double y = x - 333.0;
- double z = 3*y - 1.0;
- printf("x=%f\n", x);
- printf("y=%f\n", y);
- if ( z == 0 )
- printf("z=0\n");
- else
- printf("z=%.15lf\n", z);
- }
$ gcc -o round round.c
$ ./round
x=333.333333
y=0.333333
z=-0.000000000000057
Commentaires