www.openlinksw.com
docs.openlinksw.com

Book Home

Contents
Preface

Virtuoso Functions Guide

Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
abs
atof
atoi
bit_and
bit_not
bit_or
bit_shift
bit_xor
ceiling
either
equ
exp
floor
isdouble
isfloat
isinteger
isnumeric
iszero
log
log10
lower
mod
power
randomize
rnd
sign
sqrt
trigonometric
Phrases
RDF data
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
VAD
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web & Internet
XML
XPATH & XQUERY

Functions Index

sqrt

calculate square root
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
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