Thursday, July 30, 2009

What is the C++ function for ln ?

Hi, what is the function in C++ for the maths operator 'ln' ?

What is the C++ function for ln ?
double log ( double x );


This function calculate natural logarithm, returns the natural logarithm of parameter x.


Ex: ln(5.500000) = 1.704748
Reply:ya tell me what is C++++++++
Reply:to make the world a happier place to live in.
Reply:It should be the log function defined in math.h


In case of C++ you might want to use %26lt;cmath%26gt; instead of %26lt;math.h%26gt; as the include.





NAME


log, logf, logl - natural logarithmic function


SYNOPSIS


#include %26lt;math.h%26gt;





double log(double x);





float logf(float x);





long double logl(long double x);


Link with -lm.





DESCRIPTION


The log() function returns the natural logarithm of x.


ERRORS


The log() function can return the following errors:


EDOM


The argument x is negative.


ERANGE


The argument x is zero. The log of zero is not defined (minus infinity).


CONFORMING TO


SVID 3, POSIX, 4.3BSD, ISO 9899. The float and the long double variants are C99 requirements.
Reply:cin-can take the input by user in run time


cout-can display the output in the console in run time


cin must be used with the %26gt;%26gt; (exertion) symbol


cout must be used with the %26lt;%26lt;(insertion) symbol

sweet pea

No comments:

Post a Comment