log10(8)
Jay B. Harlow
harlow at plains.UUCP
Tue Feb 27 03:51:53 AEST 1990
In article <3244 at servax0.essex.ac.uk> elzea at 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 <harlow at plains.nodak.edu>
uunet!plains!harlow (UUCP) harlow at plains (Bitnet)
Of course the above is personal opinion, And has no bearing on reality...
More information about the Comp.lang.c
mailing list