Unofficial LSL Reference

[[functions:lllog]]


Unofficial LSL reference

User Tools

Login

You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.

Login

Forgotten your password? Get a new one: Set new password

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

functions:lllog [2014-05-21 15:06 SLT]
sei Add a definition of natural logarithm
functions:lllog [2015-02-04 08:18 SLT] (current)
sei pinf minf nan econst
Line 1: Line 1:
 +$nav
 ===== Function: llLog ===== ===== Function: llLog =====
  
Line 5: Line 6:
 </​code>​ </​code>​
  
-Returns the natural logarithm of the argument. The natural logarithm is a logarithm in base **e** (the Euler constant, which is approximately 2.7182818).+Returns the natural logarithm of the argument. The natural logarithm is a logarithm in base $econst ​(the Euler constant, which is approximately 2.7182818).
  
 ===== Parameters ===== ===== Parameters =====
Line 14: Line 15:
 ===== Return value ===== ===== Return value =====
  
-Returns a [[types/float]] which is the natural logarithm of the argument.+Returns a $lty[float] which is the natural logarithm of the argument.
  
 ===== Notes ===== ===== Notes =====
  
   * In order to make sense, the argument must be greater than 0.0; a value of 0.0 or less yields 0.0.   * In order to make sense, the argument must be greater than 0.0; a value of 0.0 or less yields 0.0.
-  * The function returns ​**Infinity** ​if the input is **Infinity**, and 0.0 if the input is **-Infinity** ​or **NaN**+  * The function returns ​$pinf if the input is $pinf, and 0.0 if the input is $minf or $nan
-  * To calculate the logarithm in base 10, [[llLog10]] can be used.+  * To calculate the logarithm in base 10, $lfn[llLog10] can be used.
     * To calculate the logarithm in any other base, divide the result of this function by the logarithm of that base.     * To calculate the logarithm in any other base, divide the result of this function by the logarithm of that base.
     * For example, to calculate the logarithm in base 2 of a number, use ''​llLog(number)/​llLog(2)''​. Since the latter is constant, to save calculations and memory you can instead pre-calculate the reciprocal and multiply by it, like this: ''​llLog(number)*1.44269504''​ will give you the logarithm in base 2, because ''​1/​llLog(2)''​ equals approx. 1.44269504.     * For example, to calculate the logarithm in base 2 of a number, use ''​llLog(number)/​llLog(2)''​. Since the latter is constant, to save calculations and memory you can instead pre-calculate the reciprocal and multiply by it, like this: ''​llLog(number)*1.44269504''​ will give you the logarithm in base 2, because ''​1/​llLog(2)''​ equals approx. 1.44269504.
-  * There is no built-in inverse of this function. To raise the Euler constant to a power, use [[llPow]]. But there is also no built-in Euler constant either, so you will need to use its value, which is approx. 2.7182818.+  * There is no built-in inverse of this function. To raise the Euler constant to a power, use $lfn[llPow]. But there is also no built-in ​definition for the Euler constant either, so you will need to use its value, which is approx. 2.7182818.
  
 ===== Short examples ===== ===== Short examples =====
Line 39: Line 40:
 ===== See also ===== ===== See also =====
  
-  * [[llLog10]] to calculate the logarithm in base 10. +  * $lfn[llLog10] to calculate the logarithm in base 10. 
-  * [[llPow]] to raise a number to a power (also called antilogarithm). +  * $lfn[llPow] to raise a number to a power (also called antilogarithm). 
-  * [[types/float]] type and associated caveats and limitations.+  * $lty[float] type and associated caveats and limitations.