This page was generated
August  8,  2011
2:24  AM
XQuery Built-In and 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