log(float)

This function calculates the logarithmic value of fValue

float log(
    float fValue
);

Parameters

fValue

Float value to retrieve the logarithm of.


Description

Returns the 10 logarithm of fValue, not the natural logerithm. To get the natural e^x log of fValue, use the code provided below (thanks to Tim).

A logarithm is an exponent used in mathematical calculations to depict the perceived levels of variable quantities such as visible light energy, electromagnetic field strength, and sound intensity.



Remarks

If you need to ask what a logarithm is you don’t need to use this function. Logarithms are used to calculate the flight of an arrow and how far away a sound can be heard.

The only concieveable reason you might need it is to, from Bioware's own scripts, work out how long it takes a magic missile visual, or an acid arrow visual, to hit the target. Look in the appropriate spell script for the little snippits of code.


Version

1.26

Example

// Work out 10 log of 25
void main()
{
    fNew = log(25);
}


// Function for getting e^x, the natural log of fValue
float ln(float fValue)
{
    return log(fValue)/log(2.71828);
}

See Also

functions: pow | sqrt
categories: Math Functions


 author: Charles Feduke, editor: Jasperre, additional contributor(s): Honour Mai, Tim Stokman
 Send comments on this topic.