HotkeyNet: the next generation
REFERENCE
SqRt

Calculates the square root of a number.

Syntax

SqRt ( number )

Parameters

Number is the number whose square root gets calculated.


Return value

Float.


Remarks

The argument gets converted to a double precision float.


Examples

A simple example:


function f1()
{
   var sr = sqrt ( 2 );
}


An example that calculates pi to 7 significant digits using Viète's formula:


function pi ()
{
     var t = 0;
     var p = 1;

     for ( var i = 0; i < 20; i = i + 1 )
     {
         t = sqrt ( 2 + t );
         p = p * (t/2);
     }

     return 2/p;
}

function AutoExec ()
{
     print ( pi() );
}


This page was last revised on June 14, 2009
Copyright © 2009 HotkeyNet Software