Name

sqrt — calculate square root

Synopsis

sqrt ( in x double precision );

Description

sqrt calculates the square root of its argument and returns it as a IEEE 64-bit float.

Parameters

x

double precision

Return Values

sqrt returns a IEEE 64-bit float.

Examples

Example24.402.Stored Procedure Example

Calculate square roots of integers between 2 numbers.

SQL> create procedure
calc_sqrts (in _from integer, in _to integer)
{
  declare i integer;
  declare result double precision;

  result_names (i, result);

  i := _from;
  while (i < _to)
   {
     result (i, sqrt (i));
     i := i + 1;
   }
}
;
(0) (0) (1) (1) (1) (1) (1) (1) (1) (1) (2) (2) (2) (1)
Done. -- 7 msec.
SQL> calc_sqrts(1, 10);
i                 result
INTEGER NOT NULL  DOUBLE PRECISION NOT NULL
_______________________________________________________________________________

1                                  1.000000
2                                  1.414214
3                                  1.732051
4                                  2.000000
5                                  2.236068
6                                  2.449490
7                                  2.645751
8                                  2.828427
9                                  3.000000

9 Rows. -- 3 msec.


See Also

exp , sqrt , log10 , power