Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site watmath.UUCP Path: utzoo!watmath!atbowler From: atbowler@watmath.UUCP (Alan T. Bowler [SDG]) Newsgroups: net.lang.c Subject: Re: re: how has C bitten you? Message-ID: <16150@watmath.UUCP> Date: Sun, 11-Aug-85 14:57:22 EDT Article-I.D.: watmath.16150 Posted: Sun Aug 11 14:57:22 1985 Date-Received: Wed, 14-Aug-85 02:28:35 EDT References: <505@brl-tgr.ARPA> Reply-To: atbowler@watmath.UUCP (Alan T. Bowler [SDG]) Organization: U of Waterloo, Ontario Lines: 19 Summary: In article <505@brl-tgr.ARPA> mbarker@BBNZ.ARPA (Michael Barker) writes: >>So, printf can never get a float as an argument, it always gets a double. >>Therefore, %lf or %F are meaningless to printf. >> >>Brian Jones aka {ihnp4,}!drutx!qwerty @ AT&T-IS > >Brian (et al) - the reasoning is correct, but printf could easily be changed to >accept %lf or %F (or any useful convention) as formatting directions for a >value with the knowledge that the value will *actually* be a double. Let's try I thought that the implicit promotion of float to double on passing an argument was one of the things that was going away with the new C standard. It certainly has been high on my personal hit list. I grant that there was a reasonable case for it when C was just for PDP-11's. But these days when there is a good possibility that floating point is being handled by a software implementation of the IEEE standard, it is a loser. In this situation the conversion between float and double is a reasonably expensive operation, and really should only be done when the programmer explicitly asks for it.