Problem with printf()
Mark Galassi
rosalia at mozart.UUCP
Tue Oct 11 12:16:50 AEST 1988
In article <504 at imec.UUCP> croes at imec.UUCP (Kris Croes) writes:
>A little program containing a big problem.
> int i = 17;
> float f = 17.0;
> printf("%d %f\n",i,i); /*1*/
> printf("%d %f\n",f,f); /*2*/
> }
Isn't it the case that the compiler promotes a float to a double
(64bits on a VAX probably), thus making the stack different from what
you thought it would be.
I believe that that must be the case, because when you call sin(x) and
x is just a float, it must be coerced to a double since the sin() func
is written to take a double.
--
Mark Galassi
rosalia at mozart.UUCP
These opinions are mine and should be everybody else's :-)
More information about the Comp.lang.c
mailing list