Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!think!ima!haddock!karl From: karl@haddock Newsgroups: net.lang.c Subject: Re: Using SCANF with DOUBLE precisi Message-ID: <86900069@haddock> Date: Tue, 30-Sep-86 11:31:00 EDT Article-I.D.: haddock.86900069 Posted: Tue Sep 30 11:31:00 1986 Date-Received: Wed, 1-Oct-86 06:19:06 EDT References: <9939@cgl.ucsf.edu.ucsfcgl.UUCP> Lines: 19 Nf-ID: #R:cgl.ucsf.edu.ucsfcgl.UUCP:9939:haddock:86900069:000:945 Nf-From: haddock!karl Sep 30 11:31:00 1986 ucsfcgl!kneller (Don Kneller) writes: >In article <22@orion.UUCP> vaughan@orion.UUCP (Robert Vaughan) writes: >>scanf("%lf",&foo); >Except, of course, in the infinite wisdom of Silicon Graphics whose >floats and doubles are the same size so one must use %f for both. The >"justification" is that they have yet another floating point type called >long float with gets the %lf format. It's painfully nonportable. Sigh. Then it isn't a C compiler and/or library. Do you really mean "long float"? In K&R that's a synonym for "double"; ANSI removed this and added "long double" for which the format is "%Lf" (note uppercase L). The elegant solution would've been "short float" (formerly "float"), format "%hf"; "float" (formerly double), format "%f"; and "long float" (what ANSI calls "long double"), format "%lf", but elegance must defer to compatibility. Sigh. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint