Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!uakari.primate.wisc.edu!indri!xanth!mcnc!decvax!shlump.nac.dec.com!shodha.dec.com!devine From: devine@shodha.dec.com (Bob Devine) Newsgroups: comp.lang.c Subject: Re: Nude Vicar in Sex Romp! Summary: double, double, toil and trouble Message-ID: <387@shodha.dec.com> Date: 21 Aug 89 17:14:38 GMT References: <960@prlhp1.prl.philips.co.uk> Organization: Digital Equipment Corp. - Colorado Springs, CO. Lines: 18 In article <960@prlhp1.prl.philips.co.uk>, yuleat@prlhp1.prl.philips.co.uk (yuleat) writes: > fn2(x, y) > float *x, *y; > { > printf("In fn2 values are x= %f & y= %f\n", *x, *y); > } > > What I would like to know is whether this is what the compiler > should do (I've looked in K&R and I couldn't find anything > that addressed this problem specifically). Check out the sections on parameter widening. The floats (likely these are 4 bytes) are being widened to doubles (8 bytes) so when you use a `float *' you are only getting 1/2 the number. On some machines a hardware check for a valid floating point number is made so if you had bad luck to select the wrong bit pattern the program would have dumped with a very misleading error! Bob Devine