R
R.Biloti
Hi folks
I wrote the naive program to show up the unit roundoff (machine
precision) for single and double precision:
#include <stdio.h>
int main (void)
{
double x;
float y ;
x=1;
while ( (1+x) > 1 ) x = x/2;
x = 2*x;
printf("double precision epsilon: %e\n", x);
y=1;
while ( (1+y) > 1 ) y = y/2;
y = 2*y;
printf("single precision epsilon: %e\n", y);
return 0;
}
It was compiled with:
gcc -O0 epsilon.c -o epsilon
Take a look at the output on AMD64:
double precision epsilon: 2.220446e-16
single precision epsilon: 1.192093e-07
However on an Petium IV (32bit):
double precision epsilon: 1.084202e-19
single precision epsilon: 1.084202e-19
Other 32bit processors behave as pentium IV,
Am I missing something? Can anyone explain me what is going on?
Thanks.
Regards,
R. Biloti.
I wrote the naive program to show up the unit roundoff (machine
precision) for single and double precision:
#include <stdio.h>
int main (void)
{
double x;
float y ;
x=1;
while ( (1+x) > 1 ) x = x/2;
x = 2*x;
printf("double precision epsilon: %e\n", x);
y=1;
while ( (1+y) > 1 ) y = y/2;
y = 2*y;
printf("single precision epsilon: %e\n", y);
return 0;
}
It was compiled with:
gcc -O0 epsilon.c -o epsilon
Take a look at the output on AMD64:
double precision epsilon: 2.220446e-16
single precision epsilon: 1.192093e-07
However on an Petium IV (32bit):
double precision epsilon: 1.084202e-19
single precision epsilon: 1.084202e-19
Other 32bit processors behave as pentium IV,
Am I missing something? Can anyone explain me what is going on?
Thanks.
Regards,
R. Biloti.