From WikiChip
Difference between revisions of "mirc/identifiers/$sqrt"
< mirc‎ | identifiers

(Create content for empty page)
 
m
Line 1: Line 1:
{{mirc title|$sqrt Identifier}}
+
{{mirc title|$sqrt identifier}}'''$sqrt''' returns the square root.
The '''$sqrt''' identifier returns the square root.
 
  
 
== Synopsis ==
 
== Synopsis ==
<pre>$sqrt( <N> )</pre>
+
<pre>$sqrt(<N>)</pre>
  
 
== Parameters ==
 
== Parameters ==
<span style="display: inline-block; width: 50px;">'''N'''</span>Number for which the square root is returned<br />
+
'''N''' Number for which the square root is returned
  
 
If N is negative, returns $null.
 
If N is negative, returns $null.
 +
 
Square Root is limited to 6 decimal places. When squared, it often has a rounding error difference from the original N.
 
Square Root is limited to 6 decimal places. When squared, it often has a rounding error difference from the original N.
  
 
== Example ==
 
== Example ==
 
 
<source lang="mIRC">
 
<source lang="mIRC">
 
//echo -a $sqrt(3) is the same as $calc(3^.5)
 
//echo -a $sqrt(3) is the same as $calc(3^.5)
Line 29: Line 28:
 
* {{mIRC|$calc}}
 
* {{mIRC|$calc}}
  
[[Category:MIRC identifiers]]
+
[[Category:mIRC identifiers|sqrt]]

Revision as of 15:39, 22 September 2017

$sqrt returns the square root.

Synopsis

$sqrt(<N>)

Parameters

N Number for which the square root is returned

If N is negative, returns $null.

Square Root is limited to 6 decimal places. When squared, it often has a rounding error difference from the original N.

Example

//echo -a $sqrt(3) is the same as $calc(3^.5)
; returns: 1.732051 is the same as 1.732051
//var %i 7 | echo -a $calc( $sqrt(%i) * $sqrt(%i) )
; slight rounding error due to decimal limited to 6 places: 6.999998

Compatibility

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