Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!ogicse!plains!harlow From: harlow@plains.UUCP (Jay B. Harlow) Newsgroups: comp.lang.c Subject: Re: log10(8) Message-ID: <3636@plains.UUCP> Date: 26 Feb 90 16:51:53 GMT References: <3244@servax0.essex.ac.uk> Reply-To: harlow@plains.UUCP (Jay B. Harlow) Organization: North Dakota State University, Fargo Lines: 26 In article <3244@servax0.essex.ac.uk> elzea@sersun0.essex.ac.uk (El-Zein A A) writes: > > double l; > . > l = log10(8); ^ this is a integer! > printf("%f", l); > simple, (is this a trick question? ;-)) because the 8 you sent as an argument to log10 is a integer, if you did not include math.h (where log10 is declared) log10 would return a '0.00000' (mine does ;-) Any way because your compiler does not have a PROTOTYPE (YEA ANSI C) it is not smart enough to convert the integer 8 to a double (8.0) which is what log10 expects. You do realize that a integer 8 is almost never the same binary format (as an argument to a function) as a double is? so log10 was reading extra stack stuff as a floating point number. Jay -- Jay B. Harlow uunet!plains!harlow (UUCP) harlow@plains (Bitnet) Of course the above is personal opinion, And has no bearing on reality...