| XQUERY/XSLT API DOCUMENTATION 4.2 |
All XQuery & XSLT Functions MarkLogic Built-In Functions Admin (xdmp:) AppServer (xdmp:) Classifier (cts:) Debug (dbg:) Document Conversion (xdmp:) Extension (xdmp:) Documents, Directories, Properties, and Locks Functions Extension Functions Function Values Functions HTTP Functions JSON Functions MarkLogic Server Functions Search Functions XML Functions XQuery Context Functions XSLT Functions map (map:) Math (math:) Profile (prof:) Search (cts:) cts:query Constructors Functions Geospatial Functions Geospatial Lexicon Functions Lexicon Functions Search Functions Search Clustering Functions Security (xdmp:) Server Monitoring (xdmp:) Spell (spell:) Update (xdmp:) XQuery Library Modules Admin Library (admin:) Actions Functions Appserver Functions Database Functions Forest Functions Group Functions Host Functions Mimetypes Functions Scheduler Functions Alerting (alert:) Elastic Compute Cloud (ec2:) Entity Enrichment (entity:) Flexible Replication (flexrep:) Geospatial Supporting Functions GEO Functions GeoRSS Functions GML Functions KML Functions MCGM Functions Information Studio (info:) Information Studio Developer (infodev:) Library Services (dls:) cts:query Constructor Functions Document Management Functions Document Update Functions Retention Policy Functions XInclude Functions Modular Documents XInclude Functions XPointer Functions PKI (pki:) Plugin (plugin:) Search (search:) Security-sec (sec:) Spelling Dictionary Management (spell:) Thesaurus (thsr:) Triggers (trgr:) Triggers Library (trgr:) WordProcessingML (ooxml:) ZIP Package (ooxml:) CPF Functions Content Processing Framework (cpf:) CSS Conversion (css:) DocBook Conversion (dbk:) Domains (dom:) Excel Conversion (excel:) Generic Conversion (cvt:) Links (lnk:) MSWord Conversion (msword:) PDF Conversion (pdf:) Pipelines (p:) Powerpoint Conversion (ppt:) XHTML Conversion (xhtml:) W3C-Standard Functions Accessor (fn:) AnyURI (fn:) Boolean (fn:) Context (fn:) DurationDateTime (fn:) Error and Trace (fn:) Node (fn:) Numeric (fn:) QName (fn:) Sequence (fn:) String (fn:) XSLT (fn:) W3C XQuery/XSLT Reference W3C XQuery Functions W3C XQuery Language W3C XSLT Language
This page was generated September 12, 2012 6:00 AM | XQuery & XSLT Built-In & Modules Function Reference
Built-In: Math
The math built-in functions.
Function Summary
math:acos | Returns the arc cosine of x, in radians, in the range from 0 to pi (inclusive).
math:asin | Returns the arc sine of x, in radians, in the range from -pi/2 to +pi/2 (inclusive).
math:atan | Returns the arc tangent of x, in radians.
math:atan2 | Returns the arc tangent of y/x, in radians, in the range from -pi/2 to +pi/2 (inclusive), using the signs of y and x to determine the apropriate quadrant.
math:ceil | Returns the smallest integer greater than or equal to x.
math:cos | Returns the cosine of x, in the range from -1 to +1 (inclusive).
math:cosh | Returns the hyperbolic cosine of x.
math:exp | Returns e (approximately 2.71828182845905) to the xth power.
math:fabs | Returns the absolute value of x.
math:floor | Returns the largest integer less than or equal to x.
math:fmod | Returns the remainder of x/y.
math:frexp | Returns x broken up into mantissa and exponent, where x = mantissa*2^exponent.
math:ldexp | Returns x*2^i.
math:log | Returns the base-e logarithm of x.
math:log10 | Returns the base-10 logarithm of x.
math:modf | Returns x broken up into fraction and integer.
math:pow | Returns x^y.
math:sin | Returns the sine of x, in the range from -1 to +1 (inclusive).
math:sinh | Returns the hyperbolic sine of x.
math:sqrt | Returns the square root of x.
math:tan | Returns the tangent of x.
math:tanh | Returns the hyperbolic tangent of x, in the range from -1 to +1 (inclusive).
Function Detail
math:acos(
| $x as xs:double
) as xs:double
Summary: Returns the arc cosine of x, in radians, in the range from 0 to pi (inclusive).
Parameters:
$x : The fraction to be evaluated. Must be in the range of -1 to +1 (inclusive).
Example:
      math:acos(.5)

      => 1.0471975511966
math:asin(
| $x as xs:double
) as xs:double
Summary: Returns the arc sine of x, in radians, in the range from -pi/2 to +pi/2 (inclusive).
Parameters:
$x : The fraction to be evaluated. Must be in the range of -1 to +1 (inclusive).
Example:
      math:asin(.5)

      => 0.523598775598299
math:atan(
| $x as xs:double
) as xs:double
Summary: Returns the arc tangent of x, in radians. in the range from -pi/2 to +pi/2 (inclusive).
Parameters:
$x : The floating point number to be evaluated.
Example:
      math:atan(3.14159)

      => 1.26262701154934
math:atan2(
| $y as xs:double,
| $x as xs:double
) as xs:double
Summary: Returns the arc tangent of y/x, in radians, in the range from -pi/2 to +pi/2 (inclusive), using the signs of y and x to determine the apropriate quadrant.
Parameters:
$y : The floating point dividend.
$x : The floating point divisor.
Example:
      math:atan2(36.23, 5.234)

      => 1.42732303452594
math:ceil(
| $x as xs:double
) as xs:double
Summary: Returns the smallest integer greater than or equal to x.
Parameters:
$x : The floating point number to be evaluated.
Example:
      math:ceil(36.00001)

      => 37
math:cos(
| $x as xs:double
) as xs:double
Summary: Returns the cosine of x, in the range from -1 to +1 (inclusive).
Parameters:
$x : The floating point number to be evaluated.
Example:
      math:cos(11)

      => 0.00442569798805079
math:cosh(
| $x as xs:double
) as xs:double
Summary: Returns the hyperbolic cosine of x.
Parameters:
$x : The floating point number to be evaluated.
Example:
      math:cosh(11)

      => 29937.0708659498
math:exp(
| $x as xs:double
) as xs:double
Summary: Returns e (approximately 2.71828182845905) to the xth power.
Parameters:
$x : The exponent to be evaluated.
Example:
      math:exp(.01)

      => 1.01005016708417
math:fabs(
| $x as xs:double
) as xs:double
Summary: Returns the absolute value of x.
Parameters:
$x : The floating point number to be evaluated.
Example:
      math:fabs(4.013)

      => 4.013
math:floor(
| $x as xs:double
) as xs:double
Summary: Returns the largest integer less than or equal to x.
Parameters:
$x : The floating point number to be evaluated.
Example:
      math:floor(4.013)

      => 4
math:fmod(
| $x as xs:double,
| $x as xs:double
) as xs:double
Summary: Returns the remainder of x/y.
Parameters:
$x : The floating point dividend.
$x : The floating point divisor.
Example:
      math:fmod(10, 3)

      => 1
math:frexp(
| $x as xs:double
) as (xs:double,xs:integer)
Summary: Returns x broken up into mantissa and exponent, where x = mantissa*2^exponent.
Parameters:
$x : The exponent to be evaluated.
Example:
      math:frexp(10)

      => 0.625
         4
math:ldexp(
| $y as xs:double,
| $i as xs:integer
) as xs:double
Summary: Returns x*2^i.
Parameters:
$y : The floating-point number to be multiplied.
$i : The exponent integer.
Example:
      math:ldexp(1.333, 10)

      => 1364.992
math:log(
| $x as xs:double
) as xs:double
Summary: Returns the base-e logarithm of x.
Parameters:
$x : The floating point number to be evaluated.
Example:
      math:log(1000))

      => 6.90775527898214
math:log10(
| $x as xs:double
) as xs:double
Summary: Returns the base-10 logarithm of x.
Parameters:
$x : The floating point number to be evaluated.
Example:
      math:log10(1000))

      => 3
math:modf(
| $x as xs:double
) as (xs:double,xs:double)
Summary: Returns x broken up into fraction and integer. x = fraction+integer.
Parameters:
$x : The floating point number to be evaluated.
Example:
      math:modf(1.333)

      => 0.333
         1
math:pow(
| $x as xs:double,
| $y as xs:double
) as xs:double
Summary: Returns x^y.
Parameters:
$x : The floating-point base number.
$y : The exponent to be applied to x.
Example:
      math:pow(2, 10)

      => 1024
math:sin(
| $x as xs:double
) as xs:double
Summary: Returns the sine of x, in the range from -1 to +1 (inclusive).
Parameters:
$x : The floating point number to be evaluated.
Example:
      math:sin(1.95)

      => 0.928959715003869
math:sinh(
| $x as xs:double
) as xs:double
Summary: Returns the hyperbolic sine of x.
Parameters:
$x : The floating point number to be evaluated.
Example:
      math:sinh(1.95)

      => 3.44320675450139
math:sqrt(
| $x as xs:double
) as xs:double
Summary: Returns the square root of x.
Parameters:
$x : The floating point number to be evaluated.
Example:
      math:sqrt(4)

      => 2
math:tan(
| $x as xs:double
) as xs:double
Summary: Returns the tangent of x.
Parameters:
$x : The floating point number to be evaluated.
Example:
      math:tan(19.5)

      => 0.760905351982977
math:tanh(
| $x as xs:double
) as xs:double
Summary: Returns the hyperbolic tangent of x, in the range from -1 to +1 (inclusive).
Parameters:
$x : The floating point number to be evaluated.
Example:
      math:tanh(.95)

      => 0.739783051274004

© Copyright 2002-2012 MarkLogic Corporation. All rights reserved.