Progress
Language Reference


SQRT Function

Interfaces
OS
SpeedScript
All
All
Yes

Returns the square root (as a decimal value) of an expression you specify.

SYNTAX

SQRT ( expression ) 

expression

A numeric expression. If the value of the expression is negative, SQRT returns the unknown value (?).

EXAMPLE

This procedure prompts for a number and then displays the square root of that number.

r-sqrt.p
DEFINE VARIABLE num AS INTEGER FORMAT ">,>>9"
  LABEL "Enter a number between 1 and 9,999".

REPEAT WITH SIDE-LABELS CENTERED
  TITLE "SQUARE ROOT GENERATOR" COLUMN 20 1 DOWN.
  DISPLAY SKIP(2).
  SET num SKIP(2).
  DISPLAY "The square root of " + string(num) + " is" 
    FORMAT "x(27)"
    SQRT(num) FORMAT ">>>.9999".
END. 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095