http://www.zorba-xquery.com/modules/math ZC

Module Description
Before using any of the functions below please remember to import the module namespace:
import module namespace math = "http://www.zorba-xquery.com/modules/math";

Extensive math library.

Author:

Daniel Turcanu, Dan Muresan

XQuery version and encoding for this module:

xquery version "3.0" encoding "utf-8";

Zorba version for this module:

The latest version of this module is 2.0. For more information about module versioning in Zorba please check out this resource.

Module Resources
Namespaces
W3Cmath http://www.w3.org/2005/xpath-functions/math
math http://www.zorba-xquery.com/modules/math
ver http://www.zorba-xquery.com/options/versioning
Variables
$math:errDiv0 as xs:QName
xs:QName with namespace URI="http://www.zorba-xquery.com/modules/math" and local name "math:Div0"
$math:errNA as xs:QName
xs:QName with namespace URI="http://www.zorba-xquery.com/modules/math" and local name "math:NA"
$math:errNS as xs:string
Errors namespace URI.
$math:errNum as xs:QName
xs:QName with namespace URI="http://www.zorba-xquery.com/modules/math" and local name "math:Num"
$math:errValue as xs:QName
xs:QName with namespace URI="http://www.zorba-xquery.com/modules/math" and local name "math:Value"
Function Summary
External acosh ( $arg as xs:double ) as xs:double external
Inverse hyperbolic cosine.
External asinh ( $arg as xs:double ) as xs:double external
Inverse hyperbolic sine of the number.
External atanh ( $arg as xs:double ) as xs:double external
Calculate the hyperbolic tangent.
avedev ( $numbers as xs:double+ ) as xs:double
Borrowed from excel module.
cast-as-numeric ( $number as xs:anyAtomicType ) as xs:anyAtomicType
Borrowed from excel module.
ceiling ( $number as xs:double, $significance as xs:double ) as xs:double
Borrowed from excel module.
External cosh ( $arg as xs:double ) as xs:double external
Returns the hyperbolic cosine of x.
deg-to-rad ( $deg as xs:double ) as xs:double
Convert angle from degrees to radians.
even ( $number as xs:double ) as xs:integer
Borrowed from excel module.
fact ( $number as xs:integer ) as xs:integer
Borrowed from excel module.
factdouble ( $number as xs:integer ) as xs:integer
Borrowed from excel module.
floor ( $number as xs:double, $significance as xs:double ) as xs:double
Borrowed from excel module.
External fmod ( $x as xs:double, $y as xs:double ) as xs:double external
Function performing the modulo operation between the two arguments.
External frexp ( $arg as xs:double ) as xs:double+ external
Returns the argument split as mantissa and exponent.
gcd ( $numbers as xs:integer+ ) as xs:integer
Borrowed from excel module.
int ( $number as xs:double ) as xs:integer
Borrowed from excel module.
is-a-number ( $value as xs:anyAtomicType ) as xs:boolean
Borrowed from excel module.
External is_inf ( $arg as xs:double ) as xs:boolean external
Checks if the double value is positive or negative infinite.
External is_nan ( $arg as xs:double ) as xs:boolean external
Checks if the double value is Not a Number (NaN).
large ( $numbers as xs:double+, $k as xs:integer ) as xs:double
Borrowed from excel module.
lcm ( $numbers as xs:integer+ ) as xs:integer
Borrowed from excel module.
External ldexp ( $x as xs:double, $i as xs:integer ) as xs:double external
Computes a real number from the mantissa and exponent.
median ( $numbers as xs:double* ) as xs:double
Borrowed from excel module.
mod ( $number as xs:double, $divisor as xs:double ) as xs:double
Borrowed from excel module.
mode ( $numbers as xs:double* ) as xs:double
Borrowed from excel module.
External modf ( $arg as xs:double ) as xs:double+ external
Splits a floating-point value into fractional and integer parts.
mround ( $number as xs:decimal, $multiple as xs:double ) as xs:double
Borrowed from excel module.
odd ( $number as xs:double ) as xs:integer
Borrowed from excel module.
percentile ( $numbers as xs:double*, $k_at as xs:double ) as xs:double
Borrowed from excel module.
percentrank ( $numbers as xs:double*, $x as xs:double ) as xs:double
Borrowed from excel module.
prob ( $x_range as xs:double+, $prob_range as xs:double+, $range_lower_limit as xs:double ) as xs:double
Borrowed from excel module.
prob ( $x_range as xs:double+, $prob_range as xs:double+, $range_lower_limit as xs:double, $upper_limit as xs:double ) as xs:double
Borrowed from excel module.
product ( $numbers as xs:double* ) as xs:double
Borrowed from excel module.
quartile ( $numbers as xs:double*, $quart as xs:integer ) as xs:double
Borrowed from excel module.
quotient ( $numerator as xs:double, $denominator as xs:double ) as xs:integer
Borrowed from excel module.
rad-to-deg ( $rad as xs:double ) as xs:double
Convert angle from radians to degrees.
rank ( $x as xs:double, $numbers as xs:double* ) as xs:double
Borrowed from excel module.
rank ( $x as xs:double, $numbers as xs:double*, $order_ascending as xs:boolean ) as xs:double
Borrowed from excel module.
roman ( $number as xs:integer ) as xs:string
Borrowed from excel module.
round ( $number as xs:double, $precision as xs:integer ) as xs:double
Borrowed from excel module.
rounddown ( $number as xs:double, $precision as xs:integer ) as xs:double
Borrowed from excel module.
roundup ( $number as xs:double, $precision as xs:integer ) as xs:double
Borrowed from excel module.
sign ( $number as xs:double ) as xs:integer
Borrowed from excel module.
External sinh ( $arg as xs:double ) as xs:double external
Calculate hyperbolic sine.
slope ( $known_y as xs:double+, $known_x as xs:double+ ) as xs:double
Borrowed from excel module.
small ( $numbers as xs:double*, $k as xs:integer ) as xs:double
Borrowed from excel module.
sort-numbers ( $numbers as xs:double* ) as xs:double*
Borrowed from excel module.
standardize ( $x as xs:double, $mean as xs:double, $standard_dev as xs:double ) as xs:double
Borrowed from excel module.
stdev ( $numbers as xs:double+ ) as xs:double
Borrowed from excel module.
stdeva ( $numbers as xs:double+ ) as xs:double
Borrowed from excel module.
stdevp ( $numbers as xs:double+ ) as xs:double
Borrowed from excel module.
stdevpa ( $numbers as xs:double+ ) as xs:double
Borrowed from excel module.
subtotal ( $function_num as xs:integer, $numbers as xs:double* ) as xs:double
Borrowed from excel module.
sumproduct ( $array1 as xs:double*, $array2 as xs:double* ) as xs:double
Borrowed from excel module.
sumsq ( $numbers as xs:double+ ) as xs:double
Borrowed from excel module.
External tanh ( $arg as xs:double ) as xs:double external
Calculate the hyperbolic tangent.
trunc ( $number as xs:double ) as xs:integer
Borrowed from excel module.
trunc ( $number as xs:double, $precision as xs:integer ) as xs:double
Borrowed from excel module.
var ( $numbers as xs:double+ ) as xs:double
Borrowed from excel module.
vara ( $numbers as xs:double+ ) as xs:double
Borrowed from excel module.
varp ( $numbers as xs:double+ ) as xs:double
Borrowed from excel module.
varpa ( $numbers as xs:double+ ) as xs:double
Borrowed from excel module.
Functions
External acosh back to 'Function Summary'
declare function math:acosh (
            $arg as xs:double 
 ) as xs:double external

Inverse hyperbolic cosine.

Parameters:
Returns:

External asinh back to 'Function Summary'
declare function math:asinh (
            $arg as xs:double 
 ) as xs:double external

Inverse hyperbolic sine of the number.

Parameters:
Returns:

External atanh back to 'Function Summary'
declare function math:atanh (
            $arg as xs:double 
 ) as xs:double external

Calculate the hyperbolic tangent.

Parameters:
Returns:

avedev back to 'Function Summary'
declare function math:avedev (
            $numbers as xs:double+ 
 ) as xs:double

Borrowed from excel module.
Returns the average of the absolute deviations of data points from their mean. The formula is sum(abs(x - average_x))/n, where n is the count of x in the sequence.

Parameters:
Returns:
See:
Examples:

cast-as-numeric back to 'Function Summary'
declare function math:cast-as-numeric (
            $number as xs:anyAtomicType 
 ) as xs:anyAtomicType

Borrowed from excel module.
Cast the xs:anyAtomicType to a numeric type. If the value is already of a numeric type then nothing is changed. Otherwise the value is casted to the numeric type that is most appropriate.

Parameters:
Returns:
Errors:

ceiling back to 'Function Summary'
declare function math:ceiling (
            $number as xs:double, 
            $significance as xs:double 
 ) as xs:double

Borrowed from excel module.
Returns number rounded up, away from zero, to the nearest multiple of significance. Significance must have the same sign as number. Number and significance must be of a numeric type or castable to numeric. Significance must not be zero.

Parameters:
Returns:
Errors:
See:
Examples:

External cosh back to 'Function Summary'
declare function math:cosh (
            $arg as xs:double 
 ) as xs:double external

Returns the hyperbolic cosine of x. If the result it too large, INF is returned.

Parameters:
Returns:

deg-to-rad back to 'Function Summary'
declare function math:deg-to-rad (
            $deg as xs:double 
 ) as xs:double

Convert angle from degrees to radians.
The parameter is first converted to value range of (-360, 360).

Parameters:
Returns:

even back to 'Function Summary'
declare function math:even (
            $number as xs:double 
 ) as xs:integer

Borrowed from excel module.
Returns number rounded up to the nearest even integer. Regardless of the sign of number, a value is rounded up when adjusted away from zero.

Parameters:
Returns:
See:
Examples:

fact back to 'Function Summary'
declare function math:fact (
            $number as xs:integer 
 ) as xs:integer

Borrowed from excel module.
Returns the factorial of a number.

Parameters:
Returns:
Errors:
See:
Examples:

factdouble back to 'Function Summary'
declare function math:factdouble (
            $number as xs:integer 
 ) as xs:integer

Borrowed from excel module.
Returns the double factorial of a number. Computes the double factorial of n as n(n-2)(n-4)...

Parameters:
Returns:
Errors:
See:
Examples:

floor back to 'Function Summary'
declare function math:floor (
            $number as xs:double, 
            $significance as xs:double 
 ) as xs:double

Borrowed from excel module.
Rounds number down, toward zero, to the nearest multiple of significance. Significance must have the same sign as number.

Parameters:
Returns:
Errors:
See:
Examples:

External fmod back to 'Function Summary'
declare function math:fmod (
            $x as xs:double, 
            $y as xs:double 
 ) as xs:double external

Function performing the modulo operation between the two arguments.

Parameters:
Returns:

External frexp back to 'Function Summary'
declare function math:frexp (
            $arg as xs:double 
 ) as xs:double+ external

Returns the argument split as mantissa and exponent. The recombining formula is (mantissa * 2^exponent).

Parameters:
Returns:

gcd back to 'Function Summary'
declare function math:gcd (
            $numbers as xs:integer+ 
 ) as xs:integer

Borrowed from excel module.
Returns the greatest common divisor GCD of a sequence of integers. The sequence can have one or more positive integers.

Parameters:
Returns:
Errors:
See:
Examples:

int back to 'Function Summary'
declare function math:int (
            $number as xs:double 
 ) as xs:integer

Borrowed from excel module.
Rounds a number down to the nearest integer. Positive numbers are rounded toward zero, negative numbers are rounded away from zero.

Parameters:
Returns:
See:
Examples:

is-a-number back to 'Function Summary'
declare function math:is-a-number (
            $value as xs:anyAtomicType 
 ) as xs:boolean

Borrowed from excel module.
Checks if the xs:anyAtomicType argument is actually a numeric type or can be converted to numeric.

Parameters:
Returns:

External is_inf back to 'Function Summary'
declare function math:is_inf (
            $arg as xs:double 
 ) as xs:boolean external

Checks if the double value is positive or negative infinite.

Parameters:
Returns:

External is_nan back to 'Function Summary'
declare function math:is_nan (
            $arg as xs:double 
 ) as xs:boolean external

Checks if the double value is Not a Number (NaN).

Parameters:
Returns:

large back to 'Function Summary'
declare function math:large (
            $numbers as xs:double+, 
            $k as xs:integer 
 ) as xs:double

Borrowed from excel module.
Returns the k-th largest value in a data set. If n is the number of data points in a range, then LARGE(array,1) returns the largest value, and LARGE(array,n) returns the smallest value.

Parameters:
Returns:
Errors:
See:
Examples:

lcm back to 'Function Summary'
declare function math:lcm (
            $numbers as xs:integer+ 
 ) as xs:integer

Borrowed from excel module.
Returns the least common multiple of integers.
LCM for two numbers is computed by multiplying them and dividing with GCD.
The function is applied recursively replacing the first two numbers in the sequence with their LCM.

Parameters:
Returns:
Errors:
See:
Examples:

External ldexp back to 'Function Summary'
declare function math:ldexp (
            $x as xs:double, 
            $i as xs:integer 
 ) as xs:double external

Computes a real number from the mantissa and exponent. The formula is (x * 2^i).

Parameters:
Returns:

median back to 'Function Summary'
declare function math:median (
            $numbers as xs:double* 
 ) as xs:double

Borrowed from excel module.
Returns the median of the given numbers. The median is the number in the middle of a set of numbers. Half the numbers have values that are greater than the median, and half the numbers have values that are less than the median.

Parameters:
Returns:
See:
Examples:

mod back to 'Function Summary'
declare function math:mod (
            $number as xs:double, 
            $divisor as xs:double 
 ) as xs:double

Borrowed from excel module.
Returns the remainder after number is divided by divisor. The result has the same sign as divisor.

Parameters:
Returns:
Errors:
See:
Examples:

mode back to 'Function Summary'
declare function math:mode (
            $numbers as xs:double* 
 ) as xs:double

Borrowed from excel module.
Returns the most frequently occurring, or repetitive, value in a sequence.

Parameters:
Returns:
Errors:
See:
Examples:

External modf back to 'Function Summary'
declare function math:modf (
            $arg as xs:double 
 ) as xs:double+ external

Splits a floating-point value into fractional and integer parts. Both the fraction and integer keep the original sign of the value.

Parameters:
Returns:

mround back to 'Function Summary'
declare function math:mround (
            $number as xs:decimal, 
            $multiple as xs:double 
 ) as xs:double

Borrowed from excel module.
Returns a number rounded to the desired multiple. MROUND rounds up, away from zero, if the remainder of dividing number by multiple is greater than or equal to half the value of multiple. MROUND is computed through math:floor function.

Parameters:
Returns:
See:
Examples:

odd back to 'Function Summary'
declare function math:odd (
            $number as xs:double 
 ) as xs:integer

Borrowed from excel module.
Returns number rounded up to the nearest odd integer, away from zero.

Parameters:
Returns:
See:
Examples:

percentile back to 'Function Summary'
declare function math:percentile (
            $numbers as xs:double*, 
            $k_at as xs:double 
 ) as xs:double

Borrowed from excel module.
Returns the k-th percentile of values in a sequence. If k is not a multiple of 1/(n - 1), PERCENTILE interpolates to determine the value at the k-th percentile. The function is computed by (max-min)*k + min

Parameters:
Returns:
Errors:
See:
Examples:

percentrank back to 'Function Summary'
declare function math:percentrank (
            $numbers as xs:double*, 
            $x as xs:double 
 ) as xs:double

Borrowed from excel module.
Returns the rank of a value in a data set as a percentage of the data set. If x does not match one of the values in array, PERCENTRANK interpolates to return the correct percentage rank.
The formula is uses: (RANK - 1) / (size - 1) .

Parameters:
Returns:
Errors:
See:
Examples:

prob back to 'Function Summary'
declare function math:prob (
            $x_range as xs:double+, 
            $prob_range as xs:double+, 
            $range_lower_limit as xs:double 
 ) as xs:double

Borrowed from excel module.
This is the same as above, only that upper_limit is not specified. The probability is computed only for range_lower_limit.

Parameters:
Returns:
Errors:
See:
Examples:

prob back to 'Function Summary'
declare function math:prob (
            $x_range as xs:double+, 
            $prob_range as xs:double+, 
            $range_lower_limit as xs:double, 
            $upper_limit as xs:double 
 ) as xs:double

Borrowed from excel module.
Returns the probability that values in a range are between two limits.

Parameters:
Returns:
Errors:
See:
Examples:

product back to 'Function Summary'
declare function math:product (
            $numbers as xs:double* 
 ) as xs:double

Borrowed from excel module.
Multiplies all the numbers given as arguments and returns the product.

Parameters:
Returns:
See:
Examples:

quartile back to 'Function Summary'
declare function math:quartile (
            $numbers as xs:double*, 
            $quart as xs:integer 
 ) as xs:double

Borrowed from excel module.
Returns the quartile of a data set.

Parameters:
Returns:
Errors:
See:
Examples:

quotient back to 'Function Summary'
declare function math:quotient (
            $numerator as xs:double, 
            $denominator as xs:double 
 ) as xs:integer

Borrowed from excel module.
Returns the integer portion of a division.

Parameters:
Returns:
Errors:
See:
Examples:

rad-to-deg back to 'Function Summary'
declare function math:rad-to-deg (
            $rad as xs:double 
 ) as xs:double

Convert angle from radians to degrees.

Parameters:
Returns:

rank back to 'Function Summary'
declare function math:rank (
            $x as xs:double, 
            $numbers as xs:double* 
 ) as xs:double

Borrowed from excel module.
This RANK function is same as the above, only that $order_ascending is set by default to false.

Parameters:
Returns:
See:
Examples:

rank back to 'Function Summary'
declare function math:rank (
            $x as xs:double, 
            $numbers as xs:double*, 
            $order_ascending as xs:boolean 
 ) as xs:double

Borrowed from excel module.
Returns the rank of a number in a list of numbers. The rank of a number is its size relative to other values in a list. (If you were to sort the list, the rank of the number would be its position.) RANK gives duplicate numbers the same rank.

Parameters:
Returns:
See:
Examples:

roman back to 'Function Summary'
declare function math:roman (
            $number as xs:integer 
 ) as xs:string

Borrowed from excel module.
Converts an Arabic numeral to roman, as text. Only the classic format is supported (out of all formats Excel requires).
M is the largest digit, it represents 1000. Numbers bigger than 2000 will be represented by a sequence of "M".
D = 500, C = 100, L = 50, X = 10, V = 5, I = 1.

Parameters:
Returns:
Errors:
See:
Examples:

round back to 'Function Summary'
declare function math:round (
            $number as xs:double, 
            $precision as xs:integer 
 ) as xs:double

Borrowed from excel module.
Rounds a number to a specified number of digits. If precision is greater than 0 (zero), then number is rounded to the specified number of decimal places. If num_digits is 0, then number is rounded to the nearest integer. If num_digits is less than 0, then number is rounded to the left of the decimal point. The 0.5 is rounded away from zero.

Parameters:
Returns:
See:
Examples:

rounddown back to 'Function Summary'
declare function math:rounddown (
            $number as xs:double, 
            $precision as xs:integer 
 ) as xs:double

Borrowed from excel module.
Rounds a number down, toward zero. If num_digits is greater than 0 (zero), then number is rounded down to the specified number of decimal places. If num_digits is 0, then number is rounded down to the nearest integer. If num_digits is less than 0, then number is rounded down to the left of the decimal point.

Parameters:
Returns:
See:
Examples:

roundup back to 'Function Summary'
declare function math:roundup (
            $number as xs:double, 
            $precision as xs:integer 
 ) as xs:double

Borrowed from excel module.
Rounds a number up, away from 0 (zero). If num_digits is greater than 0 (zero), then number is rounded down to the specified number of decimal places. If num_digits is 0, then number is rounded down to the nearest integer. If num_digits is less than 0, then number is rounded down to the left of the decimal point.

Parameters:
Returns:
See:
Examples:

sign back to 'Function Summary'
declare function math:sign (
            $number as xs:double 
 ) as xs:integer

Borrowed from excel module.
Determines the sign of a number. Returns 1 if the number is positive, zero (0) if the number is 0, and -1 if the number is negative.

Parameters:
Returns:
See:
Examples:

External sinh back to 'Function Summary'
declare function math:sinh (
            $arg as xs:double 
 ) as xs:double external

Calculate hyperbolic sine.

Parameters:
Returns:

slope back to 'Function Summary'
declare function math:slope (
            $known_y as xs:double+, 
            $known_x as xs:double+ 
 ) as xs:double

Borrowed from excel module.
Returns the slope of the linear regression line through data points in known_y's and known_x's. The slope is the vertical distance divided by the horizontal distance between any two points on the line, which is the rate of change along the regression line. It computes the formula:
sum((x - average_x)(y - average_y)) / sum((x - average_x)^2)
where average_x and average_y are computed with AVERAGE function.

Parameters:
Returns:
Errors:
See:
Examples:

small back to 'Function Summary'
declare function math:small (
            $numbers as xs:double*, 
            $k as xs:integer 
 ) as xs:double

Borrowed from excel module.
This function computes the k-th smallest value in a data set. Use this function to return values with a particular relative standing in a data set. If n is the number of data points in array, SMALL(array,1) equals the smallest value, and SMALL(array,n) equals the largest value.

Parameters:
Returns:
Errors:
See:
Examples:

sort-numbers back to 'Function Summary'
declare function math:sort-numbers (
            $numbers as xs:double* 
 ) as xs:double*

Borrowed from excel module.
Helper function.
Sorts a sequence of numbers or arguments castable to numeric. It first casts all arguments to numeric and then sorts ascending.

Parameters:
Returns:

standardize back to 'Function Summary'
declare function math:standardize (
            $x as xs:double, 
            $mean as xs:double, 
            $standard_dev as xs:double 
 ) as xs:double

Borrowed from excel module.
Returns a normalized value from a distribution characterized by mean and standard_dev.
The formula is (x - mean) / standard_dev .

Parameters:
Returns:
Errors:
See:
Examples:

stdev back to 'Function Summary'
declare function math:stdev (
            $numbers as xs:double+ 
 ) as xs:double

Borrowed from excel module.
Estimates standard deviation based on a sample. The standard deviation is a measure of how widely values are dispersed from the average value (the mean). It is computed with formula: sqrt( sum((x-average_x)^2) / (n-1) ) = sqrt ( VAR(numbers) )

Parameters:
Returns:
See:
Examples:

stdeva back to 'Function Summary'
declare function math:stdeva (
            $numbers as xs:double+ 
 ) as xs:double

Borrowed from excel module.
Estimates standard deviation based on a sample. The standard deviation is a measure of how widely values are dispersed from the average value (the mean). It is computed with formula: sqrt( sum((x-average_x)^2) / (n-1) ) = sqrt ( VARA(numbers) )

Parameters:
Returns:
See:
Examples:

stdevp back to 'Function Summary'
declare function math:stdevp (
            $numbers as xs:double+ 
 ) as xs:double

Borrowed from excel module.
Calculates standard deviation based on the entire population given as arguments. The standard deviation is a measure of how widely values are dispersed from the average value (the mean). It is computed with formula: sqrt( sum((x-average_x)^2) / n ) = sqrt ( VARP(numbers) )

Parameters:
Returns:
See:
Examples:

stdevpa back to 'Function Summary'
declare function math:stdevpa (
            $numbers as xs:double+ 
 ) as xs:double

Borrowed from excel module.
Calculates standard deviation based on the entire population given as arguments. The standard deviation is a measure of how widely values are dispersed from the average value (the mean). It is computed with formula: sqrt( sum((x-average_x)^2) / n ) = sqrt ( VARPA(numbers) )

Parameters:
Returns:
See:
Examples:

subtotal back to 'Function Summary'
declare function math:subtotal (
            $function_num as xs:integer, 
            $numbers as xs:double* 
 ) as xs:double

Borrowed from excel module.
Returns a subtotal in a sequence of numbers. The function applied is given by $function_num.

Parameters:
Returns:
Errors:
See:
Examples:

sumproduct back to 'Function Summary'
declare function math:sumproduct (
            $array1 as xs:double*, 
            $array2 as xs:double* 
 ) as xs:double

Borrowed from excel module.
Multiplies the elements on the same position in each sequence and sums up the results.

Parameters:
Returns:
See:
Examples:

sumsq back to 'Function Summary'
declare function math:sumsq (
            $numbers as xs:double+ 
 ) as xs:double

Borrowed from excel module.
Returns the sum of the squares of the arguments. It uses the sumproduct function.

Parameters:
Returns:
See:
Examples:

External tanh back to 'Function Summary'
declare function math:tanh (
            $arg as xs:double 
 ) as xs:double external

Calculate the hyperbolic tangent.

Parameters:
Returns:

trunc back to 'Function Summary'
declare function math:trunc (
            $number as xs:double 
 ) as xs:integer

Borrowed from excel module.
Truncates a number to an integer by removing the fractional part of the number.

Parameters:
Returns:
See:
Examples:

trunc back to 'Function Summary'
declare function math:trunc (
            $number as xs:double, 
            $precision as xs:integer 
 ) as xs:double

Borrowed from excel module.
Truncates a number down to precision. This behaves exactly like rounddown.

Parameters:
Returns:
See:
Examples:

var back to 'Function Summary'
declare function math:var (
            $numbers as xs:double+ 
 ) as xs:double

Borrowed from excel module.
Estimates variance based on a sample.
The formula is sum(x - average_x)^2 / (n - 1).
average_x is computed with AVERAGE function.
n is the count of numbers from the sequence, excluding empty values.

Parameters:
Returns:
See:
Examples:

vara back to 'Function Summary'
declare function math:vara (
            $numbers as xs:double+ 
 ) as xs:double

Borrowed from excel module.
Estimates variance based on a sample.
The formula is sum(x - average_x)^2 / (n - 1).
average_x is computed with AVERAGE function.
n is the size of sequence, including empty values.

Parameters:
Returns:
See:
Examples:

varp back to 'Function Summary'
declare function math:varp (
            $numbers as xs:double+ 
 ) as xs:double

Borrowed from excel module.
Calculates variance based on the entire population.
The formula is sum(x - average_x)^2 / n.
average_x is computed with AVERAGE function.
n is the count of numbers from the sequence, excluding empty values.

Parameters:
Returns:
See:
Examples:

varpa back to 'Function Summary'
declare function math:varpa (
            $numbers as xs:double+ 
 ) as xs:double

Borrowed from excel module.
Calculates variance based on the entire population.
The formula is sum(x - average_x)^2 / n.
average_x is computed with AVERAGE function.
n is the size of sequence, including empty values.

Parameters:
Returns:
See:
Examples:

blog comments powered by Disqus