Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 alpha 4/15/85; site vger.UUCP Path: utzoo!linus!decvax!ittatc!dcdwest!sdcsvax!ucbvax!vger!ray From: ray@vger.UUCP (Ray Swartz) Newsgroups: net.lang.c Subject: Re: Float Double Parameters Message-ID: <384@vger.UUCP> Date: Mon, 31-Mar-86 12:20:31 EST Article-I.D.: vger.384 Posted: Mon Mar 31 12:20:31 1986 Date-Received: Wed, 2-Apr-86 08:08:20 EST References: <2600042@ccvaxa> <676@bentley.UUCP> Organization: UC Santa Cruz, CIS Dept. Lines: 35 Summary: float parameters and prototypes > >X3J11 says "arguments that have type float are promoted to double". > > Karl W. Z. Heuer (ihnp4!bentley!kwh) X3J11 is the name of the committee standardizing the C language -- what you called ANSI C. While it is true that floats are promoted to type double in many cases, there are some where it isn't. For example, the compiler is free to use floats in expressions where such an answer doesn't deviate from the result if doubles were used: junk = 1.0 + 2.0; can be done in float. In addition, with the introduction of function prototypes, a float can be passed to a function. A function prototype declares (which is different than defines -- the function definition is where the code goes) what type the function's arguments are: int foo(float x, int y); now foo will see the first parameter passed as a float. The committee has also authorized a new data type called long double which has twice the precision of double (for all those 64 bit computers out there). There may be other places where float does get promoted... Ray Swartz (ucbvax!ucscc!v!ray) CSnet (ray@ucsc.CSnet) ARPA ray%vger%ucscc%uucp@ucbvax.EDU