*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> ftn/log (3)              
Title
Content
Arch
Section
 

Contents


EXP(3M)								       EXP(3M)


NAME    [Toc]    [Back]

     exp, expm1, log, log10, log1p, pow, fexp, expf, fexpm1, expm1f, flog,
     logf, flog10, log10f, flog1p, log1pf, fpow, powf, expl, expm1l, logl,
     log10l, log1pl, powl - exponential, logarithm, power

SYNOPSIS    [Toc]    [Back]

     #include <math.h>

     double exp(double x);
     float fexp(float x);
     float expf(float x);
     long double expl(long double x);
     long double expm1l(long double x);

     double expm1(double x);
     float fexpm1(float	x);
     float expm1f(float	x);

     double log(double x);
     float flog(float x);
     float logf(float x);
     long double logl(long double x);

     double log10(double x);
     float flog10(float	x);
     float log10f(float	x);
     long double log10l(long double x);

     double log1p(double x);
     float flog1p(float	x);
     float log1pf(float	x);
     long double log1pl(long double x);

     double pow(double x, double y);
     float powf(float x, float y);
     long double powl(long double x, \
	   long	double y);

DESCRIPTION    [Toc]    [Back]

     The long double and single-precision routines listed above	are only
     available in the standard math library, -lm, and in -lmx.

     The exp family return the exponential function of x, e**x.

     The expm1 family return exp(x)-1 accurately even for tiny x.

     The log functions return the natural logarithm of x.

     The log10 functions return	the base 10 logarithm of x.






									Page 1






EXP(3M)								       EXP(3M)



     The log1p family return log(1+x) accurately even for tiny x.

     pow(x,y), its single-precision counterpart	powf(x,y), and its long	double
     counterpart powl(x,y), return x**y.

ERROR (due to Roundoff etc.)    [Toc]    [Back]

     exp(x), log(x), expm1(x) and log1p(x) are accurate	to within an ulp, and
     log10(x) and pow(x,y) to within about 2 ulps; an ulp is one Unit in the
     Last Place.  Moderate values of pow are accurate enough that
     pow(integer,integer) is exact until it is bigger than 2**53 for double.

DIAGNOSTICS    [Toc]    [Back]

     In	the diagnostics	below, functions in the	standard math library libm.a,
     are referred to as	-lm versions, those in math library libmx.a are
     referred to as -lmx versions, and those in	the the	BSD math library
     libm43.a are referred to as -lm43 versions.
     When NaN is used as an argument, a	NaN is returned.  The -lm and -lmx
     versions always return the	default	Quiet NaN and set errno	to EDOM.  The
     -lm43 versions never set errno.
     The value of HUGE_VAL is IEEE Infinity.

     The exp functions return HUGE_VAL when the	correct	value would overflow,
     and return	zero if	the correct value would	underflow. The -lm and -lmx
     versions set the value of errno to	ERANGE for both	underflow and
     overflow.

     The log functions return NaN when x is less than zero, indicating an
     invalid operation.	The -lm	and -lmx versions also set errno to EDOM.
     When x is zero, the log functions return -HUGE_VAL.  The -lm and -lmx
     versions set errno	to ERANGE.

     The pow functions return NaN indicating an	invalid	operation, if x	is
     negative and y is not an integer. The -lm and -lmx	versions also set
     errno to EDOM.
     When x is zero and	y is negative, the -lm and -lmx	versions return
     HUGE_VAL and set errno to EDOM.  The -lm43	versions return	HUGE_VAL.
     When both arguments are zero, the pow functions return one.
     When the correct value for	pow would overflow or underflow	the pow
     functions return +/-HUGE_VAL or zero, respectively.  The -lm and -lmx
     versions set errno	to ERANGE.

     See matherr(3M) for a description of error	handling for -lmx functions.

NOTES    [Toc]    [Back]

     Long double operations on this system are only supported in round to
     nearest rounding mode (the	default).  The system must be in round to
     nearest rounding mode when	calling	any of the long	double functions, or
     incorrect answers will result.

     Users concerned with portability to other computer	systems	should note
     that the long double and float versions of	these functions	are optional
     according to the ANSI C Programming Language Specification	ISO/IEC	9899 :



									Page 2






EXP(3M)								       EXP(3M)



     1990 (E).

     Long double functions have	been renamed to	be compliant with the ANSI-C
     standard, however to be backward compatible, they may still be called
     with the double precision function	name prefixed with a q.

     Pow(x,0) returns x**0 = 1 for all x including x = 0 and Infinity.
     Previous implementations of pow defined NaN**0 to be 1 as well, but this
     behavior has been changed to conform to the IEEE standard.	 Here are
     reasons for returning x**0	= 1 in all other cases:

     (1) Any program that already tests	whether	x is zero (or infinite)	before
	 computing x**0	cannot care whether 0**0 = 1 or	not. Any program that
	 depends upon 0**0 to be invalid is dubious anyway since that
	 expression's meaning and, if invalid, its consequences	vary from one
	 computer system to another.

     (2) Some Algebra texts (e.g. Sigler's) define x**0	= 1 for	all x,
	 including x = 0.  This	is compatible with the convention that accepts
	 a[0] as the value of polynomial
	       p(x) = a[0]*x**0	+ a[1]*x**1 + a[2]*x**2	+...+ a[n]*x**n

	 at x =	0 rather than reject a[0]*0**0 as invalid.

     (3) Analysts will accept 0**0 = 1 despite that x**y can approach anything
	 or nothing as x and y approach	0 independently.  The reason for
	 setting 0**0 =	1 anyway is this:

	 If x(z) and y(z) are any functions analytic (expandable in power
	 series) in z around z = 0, and	if there x(0) =	y(0) = 0, then
	 x(z)**y(z) -> 1 as z -> 0.

     (4) If 0**0 = 1, then infinity**0 = 1/0**0	= 1 too; and because x**0 = 1
	 for all finite	and infinite non-NaN x.

SEE ALSO    [Toc]    [Back]

      
      
     math(3M), matherr(3M)


















									Page 3






CPLXEXP(3C++)							 CPLXEXP(3C++)


NAME    [Toc]    [Back]

     exp, log, pow, sqrt - exponential,	logarithm, power, square root
     functions for the C++ complex library

SYNOPSIS    [Toc]    [Back]

     #include <complex.h>

     class complex {

     public:
	       friend complex exp(complex);
	       friend complex log(complex);
	       friend complex pow(double, complex);
	       friend complex pow(complex, int);
	       friend complex pow(complex, double);
	       friend complex pow(complex, complex);
	       friend complex sqrt(complex);
     };

DESCRIPTION    [Toc]    [Back]

     The following math	functions are overloaded by the	complex	library,
     where:
      -	x, y, and z are	of type	complex.

     z <b>= exp(x<b>)	    Returns ex.

     z <b>= log(x<b>)	    Returns the	natural	logarithm of x.

     z <b>= pow(x<b>,	y<b>)  Returns xy.

     z <b>= sqrt(x<b>)    Returns the	square root of x, contained in the first or
		    fourth quadrants of	the complex plane.

SEE ALSO    [Toc]    [Back]

      
      
     complex(3C++), cartpol(3C++), cplxerr(3C++), cplxops(3C++), and
     cplxtrig(3C++).

DIAGNOSTICS    [Toc]    [Back]

     exp returns (0, 0)	when the real part of x	is so small, or	the imaginary
     part is so	large, as to cause overflow.  When the real part is large
     enough to cause overflow, exp returns (HUGE, HUGE)	if the cosine and sine
     of	the imaginary part of x	are positive, (HUGE, -HUGE) if the cosine is
     positive and the sine is not, (-HUGE, HUGE) if the	sine is	positive and
     the cosine	is not,	and (-HUGE, -HUGE) if neither sine nor cosine is
     positive.	In all these cases, errno is set to ERANGE.

     log returns (-HUGE, 0) and	sets errno to EDOM when	x is (0, 0).  A
     message indicating	SING error is printed on the standard error output.

     These error-handling procedures may be changed with the function
     complex_error (cplxerr(3C++)).




									Page 1






LOG(3F)								       LOG(3F)


NAME    [Toc]    [Back]

     log, alog,	dlog, qlog, clog, zlog - FORTRAN natural logarithm intrinsic
     function

SYNOPSIS    [Toc]    [Back]

     real r1, r2
     double precision dp1, dp2
     real*16 qp1, qp2
     complex cx1, cx2
     complex*16	cd1, cd2

     r2	= alog(r1)
     r2	= log(r1)

     dp2 = dlog(dp1)
     dp2 = log(dp1)

     qp2 = qlog(qp1)
     qp2 = log(qp1)

     cx2 = clog(cx1)
     cx2 = log(cx1)

     cd2 = zlog(cd1)
     cd2 = log(cd1)

DESCRIPTION    [Toc]    [Back]

     alog returns the real natural logarithm of	its real argument.  dlog
     returns the double-precision natural logarithm of its double-precision
     argument.	qlog returns the real*16 natural logarithm of its real*16
     argument.	The argument of	alog, dlog, and	qlog must be greater than
     zero.  clog returns the complex logarithm of its complex argument.	 The
     argument of clog must not be (0.,0.).  The	range of the imaginary part of
     clog is: -pi < imaginary part <= pi.  zlog	returns	the complex*16
     logarithm of its complex*16 argument.  The	generic	function log becomes a
     call to alog, dlog, qlog, clog, or	zlog depending on the type of its
     argument.

SEE ALSO    [Toc]    [Back]

      
      
     exp(3M).















									Page 1



ALOG(3M)					       Last changed: 1-6-98

NAME    [Toc]    [Back]

     ALOG, DLOG, CLOG, CDLOG - Computes	natural	logarithm

SYNOPSIS    [Toc]    [Back]

     UNICOS and	UNICOS/mk systems:

     ALOG ([X=]x)
     DLOG ([X=]x)
     CLOG ([X=]x)

     UNICOS and	IRIX systems:
     CDLOG ([X=]x)

IMPLEMENTATION    [Toc]    [Back]

     UNICOS, UNICOS/mk,	and IRIX systems

STANDARDS    [Toc]    [Back]

     Fortran 90
     CDLOG is a	compiler extension to Fortran 90.

DESCRIPTION    [Toc]    [Back]

     LOG is the	generic	function name.	ALOG, DLOG, and	CLOG are intrinsic
     and elemental functions for CF90.

     A vector version of this intrinsic	exists on UNICOS and UNICOS/mk
     systems.  On UNICOS/mk systems, the vector	version	of this	intrinsic
     is	used when -h vector3 (C	compiler) or -O	vector3	or -O3 (Fortran
     compiler) has been	specified on the compiler command line.

     The entry point CDLOG is provided for support in other languages.	It
     is	not recognized as an intrinsic function; therefore, you	must use
     the CDIR$ VFUNCTION directive to allow vectorization.

     These functions evaluate y	= ln(x).

   CF90    [Toc]    [Back]
     CDLOG is called implicitly	by the Fortran 90 compiler as a	result of a
     generic ALOG call with a complex double-precision argument.

   CAL Register	Usage (Cray Research Systems Only)
     Scalar ALOG:  ALOG% (call-by-register)
	  on entry   (S1) = argument
	  on exit    (S1) = result

     Vector ALOG:  %ALOG% (call-by-register)
	  on entry   (V1) = argument vector
	  on exit    (V1) = result vector

     Scalar DLOG:  DLOG% (call-by-register)
	  on entry   (S1) and (S2) = argument
	  on exit    (S1) and (S2) = result

     Vector DLOG:  %DLOG% (call-by-register)
	  on entry   (V1) and (V2) = argument vector
	  on exit    (V1) and (V2) = result vector

     Scalar CLOG:  CLOG% (call-by-register)
	  on entry   (S1) and (S2) = argument
	  on exit    (S1) and (S2) = result

     Vector CLOG:  %CLOG% (call-by-register)
	  on entry   (V1) and (V2) = argument vector
	  on exit    (V1) and (V2) = result vector

     Scalar CDLOG:  CDLOG% (call-by-register)
	  on entry   (S1), (S2), (S3), (S4) = argument
	  on exit    (S1), (S2), (S3), (S4) = result

     Vector CDLOG:  %CDLOG% (call-by-register)
	  on entry   (V1), (V2), (V3), (V4) = argument vector
	  on exit    (V1), (V2), (V3), (V4) = result vector

   Argument Range		 2450
     infinity is approximately 10
						       308
     On	UNICOS/mk systems, infinity is approximately 10

     ALOG, DLOG:  0 < x	< infinity

     CLOG:  x must not be (0,0).

     CDLOG (all	systems	except UNICOS/mk systems):  x must not be (0,0).

NOTES    [Toc]    [Back]

     CDLOG is an outmoded routine for CF90.  Refer to the Fortran Language
     Reference Manual, Volume 3, publication SR-3905, for information about
     outmoded features and their preferred standard alternatives.

     The name of the ALOG, DLOG, and CLOG intrinsic can	be passed as an
     argument.	The name of the	CDLOG intrinsic	cannot be passed as an
     argument.

RETURN VALUES    [Toc]    [Back]

     ALOG returns the real natural logarithm of	its real argument.

     DLOG returns the double-precision natural logarithm of its
     double-precision argument.

     CLOG returns the complex natural logarithm	of its complex argument.

     CDLOG returns the complex double-precision	natural	logorithm of its
     complex double-precision argument.

     On	CRAY T90 systems that support IEEE arithmetic, the following return
     values occur:

	  ALOG(0) = - infinity

	  ALOG(-0) = NaN

	  ALOG(x) = NaN	if - infinity <= x < 0

	  ALOG(	infinity ) = infinity

SEE ALSO    [Toc]    [Back]

      
      
     Intrinsic Procedures Reference Manual, publication	SR-2138, for the
     printed version of	this man page.

[ Back ]
 Similar pages
Name OS Title
pow NetBSD exponential, logarithm, power functions
log1pf NetBSD exponential, logarithm, power functions
exp OpenBSD exponential, logarithm, power functions
log1p NetBSD exponential, logarithm, power functions
log10f NetBSD exponential, logarithm, power functions
log10 NetBSD exponential, logarithm, power functions
logf NetBSD exponential, logarithm, power functions
log NetBSD exponential, logarithm, power functions
powf NetBSD exponential, logarithm, power functions
log1p OpenBSD exponential, logarithm, power functions
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service