C Floating point arithmetic

Andrew Koenig ark at alice.UucP
Wed Dec 4 02:53:42 AEST 1985


>	float a,b;
>
>	a = b + 1.0;	/* Gets done in double because 1.0 is a double.
>			Gag me with a spoon. */

Nah, gets done in single because the compiler realizes that 1.0 has
the same representation in single and double, and therefore that
the result of the addition will be the same.



More information about the Comp.lang.c mailing list