Cray Graph Engine (CGE) Square Root Function

Information about using CGE's square root function.

The square root function, sqrt() is used to retrieve the square root of the specified number

Syntax

The syntax of the square root function is:

sqrt(argument)

Note: The name of the sqrt()function is case sensitive.

Function Prefix

The prefix to use when using the sqrt()function in queries is:

PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#>

Table 1. CGE Square Root Function's Examples
Argument Type Example
Integer
PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> 
SELECT ?a { BIND (afn:sqrt("9223372036854775807"^^ <http://www.w3.org/2001/XMLSchema#integer) AS ?a) }
Decimal
PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#>  
SELECT ?a  { BIND (afn:sqrt(4294967296.0) AS ?a) } 
Float
PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#>  
SELECT ?a  { BIND (afn:sqrt ("3.4E38"^^xsd:float) AS ?a) }
Double
PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#>
SELECT ?a  { BIND (afn:sqrt("1.797E308"^^xsd:double) AS ?a) }
Boolean
PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#>  
SELECT ?a  { BIND (afn:sqrt(true) AS ?a) } 
Note: Passing “true” as the Boolean argument returns 1, whereas passing “false” as the Boolean argument returns 0.
Note: The sqrt() function will return an empty value if a negative number is provided as an argument. Furthermore, the sqrt() function will return an empty value if arguments of certain types are used. These argument types include:
  • xsd:dateTime
  • String
  • IRI
  • Arbitrary data type  
You can also use derived data types as arguments to the sqrt()function, as shown in the following query:
PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> 
SELECT ?a{ BIND (afn:sqrt  ("18446744073709551615"^^<http://www.w3.org/2001/XMLSchema#positiveInteger>) AS ?a) }
Note: Executing the sqrt() function when a negative derived type is used as an argument will result in an empty value.