The following code produces logarithms apparently using base 2.71826 instead of base 10. What could I be doing wrong in a function so simple?
Input to scanf:Code:#include <stdio.h>
#include <math.h>
int main()
{ double d = 100.0;
double num;
printf("Ready\n");
scanf("%g", &num);
printf("log (%g) = %g\n", num, log(num));
printf("log (%g) = %g\n", d, log(d));
return (0);
}
4
Output
Code:Ready
4
log (1.21742e-306) = -704.394
log (100) = 4.60517