sqrt()


Return the square root of the argument.

Syntax

sqrt(argument)

Parameter

Parameter

Definition

argument

numeric value whose mathematical square root is returned

*Valid Values* 
0 ≤ argument < ∞

Description

The sqrt() function returns the square root of the positive integer or real value argument.

Example

The following PSL script compares the output of the sqrt() function with that derived from the trigonometric identity ln(xa) = a ln(x) for the integers 1 through 10:

 

function main() {
printf("SQUARE ROOT AND EXP(0.5 * LOGE) COMPARISON\n\n");
printf(" n sqrt(n) exp(0.5 * loge(n))\n");
printf(" -- ------- -----------------\n");
local i;
i = 0;
while (i++ <= 10) {
printf(" %2d %7.5f %7.5f\n",i,sqrt(i),exp(0.5 * loge(i)));
}
}

 

The example produces the following output:

SQUARE ROOT AND EXP(0.5 * LOGE) COMPARISON
n sqrt(n) exp(0.5 * loge(n))
-- ------- -----------------
1 1.00000 1.00000
2 1.41421 1.41421
3 1.73205 1.73205
4 2.00000 2.00000
5 2.23607 2.23607
6 2.44949 2.44949
7 2.64575 2.64575
8 2.82843 2.82843
9 3.00000 3.00000
10 3.16228 3.16228

 

 

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*