xHarbour Reference Documentation > Function Reference |
Calculates the square root of a positive number
SQrt( <nNumber> ) --> nSquareRoot
The function returns the square root of <nNumber> as a numeric value.
The function calculates the square root of a positive number to double precision. When the result is output, the number of decimal places displayed depends on SET DECIMALS and SET FIXED. Note that the displayed decimals may be rounded for display which does not affect numeric precision in calculations.
See also: | Exp(), Log(), SET DECIMALS, SET FIXED |
Category: | Mathematical functions , Numeric functions |
Source: | rtl\math.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example displays various results of SQrt() PROCEDURE Main SET DECIMALS TO 6 ? SQrt(0.2) // Result: 0.447214 ? SQrt(2.0) // Result: 1.414214 ? SQrt(200) // Result: 14.142136 ? SQrt(9) // Result: 3.000000 ? SQrt(9) ˆ 2 // Result: 9.000000 RETURN
http://www.xHarbour.com