Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!psuvax1!psuvm!cmh117 From: CMH117@psuvm.psu.edu (Charles Hannum) Newsgroups: comp.lang.c Subject: Re: log10(8) Message-ID: <90057.130433CMH117@psuvm.psu.edu> Date: 26 Feb 90 18:04:33 GMT References: <3244@servax0.essex.ac.uk> <1990Feb26.031254.11354@cubmol.bio.columbia.edu> Organization: Penn State University Lines: 31 In article <1990Feb26.031254.11354@cubmol.bio.columbia.edu>, ping@cubmol.bio.columbia.edu (Shiping Zhang) says: > >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. >log10() expects a double as its argument. So use 8.0 instead of 8. > You may also have to change the printf() to: printf("%lf", l); Virtually, - Charles Martin Hannum II "Klein bottle for sale ... inquire within." (That's Charles to you!) "To life immortal!" cmh117@psuvm.{bitnet,psu.edu} "No noozzzz izzz netzzzsnoozzzzz..." c9h@psuecl.{bitnet,psu.edu} "Mem'ry, all alone in the moonlight ..."