(→See Also: moar math) |
(m) |
||
Line 54: | Line 54: | ||
== See Also == | == See Also == | ||
− | * {{mIRC|$ | + | * {{mIRC|$sqrt}} |
− | * {{mIRC|$ | + | * {{mIRC|$pi}} |
− | * {{mIRC|$ | + | * {{mIRC|$rand}} |
− | |||
− | |||
− | |||
* {{mIRC|$base}} | * {{mIRC|$base}} | ||
− | * {{mIRC|$ | + | * {{mIRC|$abs}}, {{mIRC|$int}}, {{mIRC|$ceil}}, {{mIRC|$floor}}, {{mIRC|$round}} |
− | + | * {{mIRC|$and}}, {{mIRC|$not}}, {{mIRC|$or}}, {{mIRC|$xor}} | |
− | + | * {{mIRC|$log}}, {{mIRC|$log10}} | |
− | * {{mIRC|$ | + | * {{mIRC|$sin}}, {{mIRC|$asin}}, {{mIRC|$sinh}} |
− | * {{mIRC|$ | + | * {{mIRC|$cos}}, {{mIRC|$acos}}, {{mIRC|$cosh}} |
− | * {{mIRC|$ | + | * {{mIRC|$tan}}, {{mIRC|$atan}}, {{mIRC|$atan2}}, {{mIRC|$tanh}} |
− | * {{mIRC|$ | + | * {{mIRC|$biton}}, {{mIRC|$bitoff}}, {{mIRC|$isbit}} |
− | + | * {{mIRC|$hypot}}, {{mIRC|$intersect}} | |
− | * {{mIRC|$ | + | * {{mIRC|$inrect}}, {{mIRC|$inroundrect}}, {{mIRC|$inellipse}}, {{mIRC|$inpoly}}, {{mIRC|$onpoly}}, |
− | |||
− | |||
− | |||
− | * {{mIRC|$ | ||
− | |||
− | |||
− | * {{mIRC|$ | ||
− | |||
− | * {{mIRC|$ | ||
− | |||
− | |||
− | |||
− | |||
{{mIRC identifier list}} | {{mIRC identifier list}} | ||
[[Category:mIRC identifiers|calc]] | [[Category:mIRC identifiers|calc]] |
Revision as of 16:24, 27 September 2017
$calc can be used to perform mathematical calculations from the mIRC command line, or from inside of a custom script.
Synopsis
$calc(operations)
The $calc adheres to mathematical standards set forth by the order of operations. Therefore, a combination of brackets and parentheses can be used in order to manipulate the order of operations. $calc can also be used to calculate variables in mIRC, as well as other customer identifiers that return numerical values.
Parameters
operationsThese are a specific set of mathematical operations for $calc to perform.
Operators
+Addition
-Subtraction
*Multiplication
/Division
//Floor division, same as $floor($calc(X / Y))
^Exponent
Examples
Echo a simple addition calculation to the active window
//echo -a $calc(3 + 5)
Echo a manipulated order of operations calculation to the active window
//echo -a $calc(3 * 4 * (3 + 5)))
Echo the remainder of the calculation, by invoking the modulus operator, to the active window
//echo -a $calc(10 % 3)
Create a simple alias to take in two parameters, then raise the first to the power of the second, and return the value
alias power { ; Make sure both inputs are numbers if (($1 isnum) && ($2 isnum)) { return $calc($1 ^ $2) } }
The above $power alias can now be used like so:
//echo -a $power(2,2)
The result of the above command would be:
4
Compatability
Added: mIRC v5.1
Added on: 28 Aug 1997
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.
See Also
- $sqrt
- $pi
- $rand
- $base
- $abs, $int, $ceil, $floor, $round
- $and, $not, $or, $xor
- $log, $log10
- $sin, $asin, $sinh
- $cos, $acos, $cosh
- $tan, $atan, $atan2, $tanh
- $biton, $bitoff, $isbit
- $hypot, $intersect
- $inrect, $inroundrect, $inellipse, $inpoly, $onpoly,