Path: utzoo!attcan!uunet!cs.utexas.edu!usc!snorkelwacker!paperboy!meissner From: meissner@osf.org (Michael Meissner) Newsgroups: comp.lang.c Subject: Re: log10(8) Message-ID: Date: 27 Feb 90 15:45:52 GMT References: <3244@servax0.essex.ac.uk> <1460@amethyst.math.arizona.edu> Sender: news@OSF.ORG Organization: Open Software Foundation Lines: 28 In-reply-to: raw@math.arizona.edu's message of 27 Feb 90 02:58:48 GMT In article <1460@amethyst.math.arizona.edu> raw@math.arizona.edu (Rich Walters) writes: | In article <3244@servax0.essex.ac.uk> elzea@sersun0.essex.ac.uk (El-Zein A A) writes: | > | > My calculator gives me 0.9030899 for log(8), | > While the following code (which I thought would | > give me the above value of 0.9030899) prints | > -312.770165. | > | > double l; | > . | > l = log10(8); | > printf("%f", l); | > . | > | > Can anybody tell me why. | > | | Try printf"%lf",l); after all l is declared to be a double!!!!!!!! Sigh. Printf is a varargs function. This means that there is no way a 'float' can be passed to it. Thus %f and %lf are synomous..... -- Michael Meissner email: meissner@osf.org phone: 617-621-8861 Open Software Foundation, 11 Cambridge Center, Cambridge, MA Catproof is an oxymoron, Childproof is nearly so