sqrt

Purpose: Usage help for the sqrt math function.


The call,

    [expr { sqrt($x) }]

returns the square root of $x.


If you're using sqrt in connection with the Pythagorean Theorem:

    [expr { sqrt( $x * $x + $y * $y ) }]

note that Tcl provides a hypot function, which gives a more concise formula:

    [expr { hypot( $x, $y ) }]

The hypot function is also more robust in that it will get overflow and underflow less often when dealing with very large or very small numbers.


See also: isqrt