Export (0) Print
Expand All
1 out of 4 rated this helpful - Rate this topic

log, log10

Visual Studio 6.0

Calculates logarithms.

double log( double x );

double log10( double x );

Routine Required Header Compatibility
log <math.h> ANSI, Win 95, Win NT
log10 <math.h> ANSI, Win 95, Win NT

For additional compatibility information, see Compatibility in the Introduction.

Libraries

LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version

Return Value

The log functions return the logarithm of x if successful. If x is negative, these functions return an indefinite (same as a quiet NaN). If x is 0, they return INF (infinite). You can modify error handling by using the _matherr routine.

Parameter

x

Value whose logarithm is to be found

Example

/* 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>

void 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 );
}

Output

log( 9000.00 ) = 9.104980
log10( 9000.00 ) = 3.954243

Floating-Point Support Routines

See Also   exp, _matherr, pow

Show:
© 2014 Microsoft. All rights reserved.