Log: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
Created page with "LOG(''number'') '''Description''' LOG returns a double-precision value equal to the natural logarithm of a number. The required parameter, ''number'', is any numeric express..."
 
Brendon (talk | contribs)
No edit summary
Line 1: Line 1:
LOG(''number'')
Log(''number'')


'''Description'''
== Description ==


LOG returns a double-precision value equal to the natural logarithm of a number. The required parameter, ''number'', is any numeric expression. The natural logarithm is the base e logarithm; e is approximately equal to 2.718282.
Log returns a double-precision value equal to the natural logarithm of a number. The required parameter, ''number'', is any numeric expression. The natural logarithm is the base e logarithm; e is approximately equal to 2.718282.


Calculating base-n logarithm of x is achieved by dividing the natural logarithm of x by the natural logarithm of n.
Calculating base-n logarithm of x is achieved by dividing the natural logarithm of x by the natural logarithm of n.


'''Example'''
== Example ==


<pre>
<pre>
REM LOG Example
Rem Log Example
'LOG calculates natural logarithms
'Log calculates natural logarithms
DIM e
Dim e
e = 2.718282
e = 2.718282
PRINT "LOG(1) = " & LOG(1)
Print "Log(1) = " & Log(1)
PRINT "LOG(e) = " & LOG(e)
Print "Log(e) = " & Log(e)
PRINT "LOG10(2) = " & LogN(10, 2)
Print "Log10(2) = " & LogN(10, 2)
FUNCTION LogN(Base, Number)
Function LogN(Base, Number)
   LogN = LOG(Number) / LOG(Base)
   LogN = LOG(Number) / LOG(Base)
END FUNCTION
End Function
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
Line 30: Line 30:
</pre>
</pre>


'''Related Items'''
== Related Items ==


[[exp|EXP]]
[[exp|EXP]]
[[Category:Language Reference]]

Revision as of 02:09, 17 August 2012

Log(number)

Description

Log returns a double-precision value equal to the natural logarithm of a number. The required parameter, number, is any numeric expression. The natural logarithm is the base e logarithm; e is approximately equal to 2.718282.

Calculating base-n logarithm of x is achieved by dividing the natural logarithm of x by the natural logarithm of n.

Example

Rem Log Example
'Log calculates natural logarithms
Dim e
e = 2.718282
Print "Log(1) = " & Log(1)
Print "Log(e) = " & Log(e)
Print "Log10(2) = " & LogN(10, 2)
Function LogN(Base, Number)
  LogN = LOG(Number) / LOG(Base)
End Function

Output

LOG(1) = 0
LOG(e) = 1
LOG10(2) = 0.30103

Related Items

EXP