[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


log

Compute the natural logarithms.

Compatibility:

This function is compatible with the following targets:

ANSI

BeOS

EMB/RTOS

Mac OS

Palm OS

Win32


Prototype:
#include <math.h>

double log(double x);
float logf(float);
long double logl(long double);
Parameters:

Parameters for this function are:

x  
float, double or long double  
value to be computed  

Return:

log() returns logex. If x < 0 the log() may assign EDOM to errno See "Floating point error testing.," for information on newer error testing procedures.

See Also:

"Inlined Intrinsics Option"

"exp"

"errno"

log(), log10() example:
#include <math.h>
#include <stdio.h>

int main(void)
{
	double x = 100.0;
	
	printf("The natural logarithm of %f is %f\n",x, log(x));
	printf("The base 10 logarithm of %f is %f\n",x, log10(x));

	return 0;
}

Output:
The natural logarithm of 100.000000 is 4.605170
The base 10 logarithm of 100.000000 is 2.000000


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 16, 2000