xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

Sqrt()

Calculates the square root of a positive number

Syntax

SQrt( <nNumber> ) --> nSquareRoot

Arguments

<nNumber>
This is a positive numeric value to compute the square root for.

Return

The function returns the square root of <nNumber> as a numeric value.

Description

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.

Info

See also:Exp(), Log(), SET DECIMALS, SET FIXED
Category: Mathematical functions , Numeric functions
Source:rtl\math.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe