double log( double x ); float log( float x ); // C++ only long double log( long double x ); // C++ only float logf( float x ); double log10( double x ); float log10( float x ); // C++ only long double log10( long double x ); // C++ only float log10f ( float x );
// crt_log.c /* This program uses log and log10 * to calculate the natural logarithm and * the base-10 logarithm of 9,000. */#include <math.h> #include <stdio.h>int main( void ) { double x = 9000.0; double y; y = log( x ); printf( "log( %.2f ) = %f\n", x, y ); y = log10( x ); printf( "log10( %.2f ) = %f\n", x, y ); }
double log(
double x
);
float log(
float x
); // C++ only
long double log(
long double x
); // C++ only
float logf(
float x
);
double log10(
double x
);
float log10(
float x
); // C++ only
long double log10(
long double x
); // C++ only
float log10f (
float x
);
// crt_log.c
/* This program uses log and log10
* to calculate the natural logarithm and
* the base-10 logarithm of 9,000.
*/#include <math.h>
#include <stdio.h>int main( void )
{
double x = 9000.0;
double y; y = log( x );
printf( "log( %.2f ) = %f\n", x, y );
y = log10( x );
printf( "log10( %.2f ) = %f\n", x, y );
}