From WikiChip
Editing mirc/identifiers/$log

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.

Latest revision Your text
Line 1: Line 1:
 
{{mirc title|$log identifier}}'''$log''' returns the natural logarithm (base e) of a number.
 
{{mirc title|$log identifier}}'''$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 ==
 
== Synopsis ==
Line 19: Line 14:
 
<source lang="mIRC">
 
<source lang="mIRC">
 
//echo -a $log(50)
 
//echo -a $log(50)
result: 3.912023
 
//echo -a $calc(2.718281^3.912023)
 
result: 49.99994
 
 
</source>
 
</source>
  
<source lang="mIRC">
 
//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) )
 
</source>
 
  
 
== Compatibility ==
 
== Compatibility ==

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)