From WikiChip
$log identifier - mIRC
< mirc‎ | identifiers
Revision as of 15:20, 14 January 2018 by Maroonbells (talk | contribs) (Add'l info)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

$log returns the natural logarithm (base e) of a number.

'e' is an irrational number whose digits begins with 2.718281828 'e' is the value where graphing the curve y=e^x has slope of X at every location along the curve. The natural logarithm of the value N is the exponent X where e^X is the value N. $log(e) is 1, $log(1) is 0, $log of values between 0 and 1 are negative. Returns error for N=0 or N=negative.

There may be a rounding error due to mIRC preserving fractional digits to only 6 places.

Synopsis[edit]

$log(N)

Paramters[edit]

NThe number you want the natural logarithm of

Properties[edit]

None

Example[edit]

//echo -a $log(50)
result: 3.912023
//echo -a $calc(2.718281^3.912023)
result: 49.99994
//var %e = 2.718281828 , %begin_balance = 10 , %interest_rate = .07 , %years = 20 | echo -a As compounding interval becomes shorter, ending balance approaches $ $+ $calc(%begin_balance * (%e ^(%interest_rate * %years)))
 
You can use $log to find the base-X logarithm for any value N with $calc( $log(N) / $log(X) )
//echo -a base-3 logrithm of 50 is $calc( $log(50) / $log(3) )
result: base-3 logrithm of 50 is 3.560878
//echo -a $calc( 3 ^ 3.560878 )
result: 50.000066
 
It's due to the rounding error that this does not return 8:
//echo -a $calc( $log(256) / $log(2) )

Compatibility[edit]

Added: mIRC v5.3
Added on: 13 Dec 1997
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See also[edit]

[Expand]
v · d · e mIRC identifier list