$nav ===== Function: llLog ===== float llLog(float arg) 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 ===== === arg === The float value whose natural logarithm is to be calculated. ===== Return value ===== Returns a $lty[float] which is the natural logarithm of the argument. ===== Notes ===== * 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 $pinf if the input is $pinf, and 0.0 if the input is $minf or $nan. * 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. * 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 $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 ===== float f; f = llLog(2.7182818); // sets f to 1 approx. f = llLog(1); // sets f to 0 f = llLog(2); // sets f to 0.693147 approx. f = llLog(0.5); // sets f to -0.693147 approx. f = llLog(-1); // sets f to 0 f = llLog(8)*1.44269504; // sets f to 3 approx. ===== See also ===== * $lfn[llLog10] to calculate the logarithm in base 10. * $lfn[llPow] to raise a number to a power (also called antilogarithm). * $lty[float] type and associated caveats and limitations.