Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ames!dftsrv!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Question: Floating point and printf() Message-ID: <21258@mimsy.umd.edu> Date: 13 Dec 89 06:10:20 GMT References: <2777@cbnewsj.ATT.COM> Distribution: na Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 24 In article <2777@cbnewsj.ATT.COM> asd@cbnewsj.ATT.COM (adam.denton) writes: >I would like to know what the CORRECT format specifier is in printf() >to print out values of type `float' and values of type `double'. `%e', `%f', and `%g'. >According to K&R2, page 244, the format specifiers e, f, and g all default >to type `double'. K&R2 does not mention the use of the `l' (lower case ell) >in regard to floating point. K&R2 does, however, mention (possibly elsewhere) that it is NOT POSSIBLE to pass a `float' to a variadic function. All such values are converted to double precision in the absence of a prototype, or in the presence of a variadic prototype. >Now in the Turbo C 2.0 reference manual under ...printf(), it is mentioned >that the letter ell can be prefixed to e, f, or g to indicate that the >argument is type `double.' ... which is incredibly misleading, since the letter ell can be omitted to indicate that the argument is type double as well. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris