Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!bonnie!akgua!gatech!ut-sally!seismo!brl-tgr!gwyn From: gwyn@brl-tgr.ARPA (Doug Gwyn ) Newsgroups: net.lang.c Subject: Re: C Floating point arithmetic Message-ID: <388@brl-tgr.ARPA> Date: Fri, 6-Dec-85 10:43:54 EST Article-I.D.: brl-tgr.388 Posted: Fri Dec 6 10:43:54 1985 Date-Received: Sat, 7-Dec-85 21:21:18 EST References: <1087@lll-crg.ARpA>, <4647@alice.UUCP> <423@stcvax.UUCP> Organization: Ballistic Research Lab Lines: 15 > >> 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. > > Sorry, it get's done in double. ALL floats are converted to double prior > to any operation. (Refer to K&R p. 41 on implicit type conversions.) I really wish people would NOT POST if they don't know what they're talking about. Andy Koenig, as usual, gave a correct answer and some turkey, as usual, contradicts him. Sheesh.