float llLog(float arg)
Returns the natural logarithm of the argument. The natural logarithm is a logarithm in base e (the Euler constant, which is approximately 2.7182818).
The float value whose natural logarithm is to be calculated.
Returns a float which is the natural logarithm of the argument.
llLog10
can be used.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.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.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.