Log10: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
(Add javascript snippent and add Basic function since it wasn't there and fix Log10(100) display)
Line 5: Line 5:
Log10 returns the base-10 logarithm of a number. The required parameter, ''number'', is any numeric expression.  
Log10 returns the base-10 logarithm of a number. The required parameter, ''number'', is any numeric expression.  


== Example ==
== Example (Basic) ==


<pre>
<pre>
Line 14: Line 14:
Print "Log10(20) = " & Log10(20)
Print "Log10(20) = " & Log10(20)
Print "Log10(25) = " & Log10(25)
Print "Log10(25) = " & Log10(25)
Print "Log10(100) = " & LogN(10, 2)
Print "Log10(100) = " & LogN(10, 100)
 
Function LogN(Base, Number)
  LogN = LOG(Number) / LOG(Base)
End Function
</pre>
 
== Example (JavaScript) ==
<pre>
// Log10 Example
/* Log10 calculates natural logarithms */
 
var  e;
e = 2.718282;
NSB.Print("Log10(20) = " + Math.log(20)/Math.log(10));
NSB.Print("Log10(25) = " + Math.log(25)/Math.log(10));
NSB.Print("Log10(100) =  +  Math.log(100)/Math.log(10));
</pre>
</pre>



Revision as of 01:43, 28 May 2013

Log10(number)

Description

Log10 returns the base-10 logarithm of a number. The required parameter, number, is any numeric expression.

Example (Basic)

Rem Log10 Example
'Log10 calculates natural logarithms
Dim e
e = 2.718282
Print "Log10(20) = " & Log10(20)
Print "Log10(25) = " & Log10(25)
Print "Log10(100) = " & LogN(10, 100)

Function LogN(Base, Number)
  LogN = LOG(Number) / LOG(Base)
End Function

Example (JavaScript)

// Log10 Example
/* Log10 calculates natural logarithms */

var  e;
e = 2.718282;
NSB.Print("Log10(20) = " + Math.log(20)/Math.log(10));
NSB.Print("Log10(25) = " + Math.log(25)/Math.log(10));
NSB.Print("Log10(100) =   +  Math.log(100)/Math.log(10));

Output

Log10(20) = 1.301029996
Log10(25) = 1.397940009
Log10(100) = 2

Related Items

Exp, Log