Skip to content
JervenBolleman edited this page Jun 6, 2019 · 2 revisions

sqroot

Signature

 xsd:double  sqrt (xsd:double)

The result is the mathematical non-negative square root of $arg as defined in the [IEEE 754-2008] specification of the squareRoot function applied to 64-bit binary floating point values.

This function is equivalent to as math:sqrt.

ASK {FILTER(SQRT("0.0e0"^^xsd:double) = "0.0e0"^^xsd:double)}
ASK {FILTER(SQRT("-0.0e0"^^xsd:double) = "-0.0e0"^^xsd:double)}
ASK {FILTER(SQRT("1.0e6"^^xsd:double) = "1.0e3"^^xsd:double)}
ASK {FILTER(SQRT("2.0e0"^^xsd:double) = "1.4142135623730951e0"^^xsd:double)}
ASK {FILTER(SQRT("-2.0e0"^^xsd:double) = "NaN"^^xsd:double)}
ASK {FILTER(SQRT("NaN"^^xsd:double) = "NaN"^^xsd:double)}
ASK {FILTER(SQRT("INF"^^xsd:double) = "INF"^^xsd:double)}
ASK {FILTER(SQRT("-INF"^^xsd:double) = "NaN"^^xsd:double)} 

Should return true

SQRT() called without a variable/value should be a parse error.

SQRT() called with a numeric as the first ($x parameter) should have that cast to xsd:double.

TODO

Error values