Does that code guarantee that the value 3.0 (exactly) will be stored
in variable a and b ?
void test(void)
{
int i=3;
float f;
double d;
a=i;
b=i;
}
*** God only knows if God exists... ***
Making that assumption, I do not think that the standard has any
requirements on the precision of the conversion. So even if 3.0
would fit in a float or a double, there is no guarantee that the
result will be that value. (And you may be in for some surprises,
there have been machines were 0.0 was not a valid floating point
number, *all* floating point numbers were non-zero.)
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924098
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/