{{fbdoc item="title" value="LOG"}}----
Returns the natural logarithm of a given number

{{fbdoc item="syntax"}}##
	[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Log** [[KeyPgCdecl cdecl]] ( [[KeyPgByval byval]] //number// [[KeyPgAs as]] [[KeyPgDouble double]] ) [[KeyPgAs as]] [[KeyPgDouble double]]
##
{{fbdoc item="usage"}}##
	//result// = **Log**( //number// )
##
{{fbdoc item="param"}}
	##//number//##
		The number to calculate the natural log.

{{fbdoc item="ret"}}
	Returns the logarithm with the base //e// (also know as the natural logarithm) of ##//number//##.

{{fbdoc item="desc"}}
	There can be some confusion with this notation given that in mathematics the natural logarithm function is usually denoted **LN**, while the logarithm of base 10 is often denoted as LOG. FreeBASIC, like most computer programming languages, uses LOG to denote the natural logarithm. The required //number// argument can be any valid numeric expression greater than zero. If ##//number//## is zero, FreeBASIC returns a special value representing "-infinity", printing like "-Inf". If ##//number//## is less than zero, **Log** returns a special value representing "not defined", printing like """NaN""" or "IND", exact text is platform dependent. If ##//number//## is an uninitialized variable, -infinity is returned.

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/math/log.bas"}}%%(freebasic)
'Find the logarithm of any base
FUNCTION LogBaseX (BYVAL Number AS DOUBLE, BYVAL BaseX AS DOUBLE) AS DOUBLE
	LogBaseX = LOG( Number ) / LOG( BaseX )
	'For reference:   1/log(10)=0.43429448
END FUNCTION

PRINT "The log base 10 of 20 is:"; LogBaseX ( 20 , 10 )
PRINT "The log base 2 of 16 is:"; LogBaseX ( 16 , 2 )

SLEEP
%%

The output would look like:
%%
The log base 10 of 20 is: 1.301029995663981
The log base 2 of 16 is: 4
%%

{{fbdoc item="diff"}}
	- None

{{fbdoc item="see"}}
	- ##[[KeyPgExp Exp]]##

{{fbdoc item="back" value="CatPgMath|Math"}}