{ "ns" : "http://zorba.io/modules/excel/math", "description" : " This is a library module offering a part of the set of functions\n defined by Microsoft Excel 2003.\n", "sees" : [ "Excel 2003 Documentation: Math Functions" ], "authors" : [ "Daniel Turcanu" ], "version" : null, "encoding" : "utf-8", "namespaces" : [ { "uri" : "http://zorba.io/modules/excel/math", "prefix" : "excel" }, { "uri" : "http://zorba.io/modules/excel/errors", "prefix" : "excel-err" }, { "uri" : "http://zorba.io/options/versioning", "prefix" : "ver" } ], "functions" : [ { "arity" : 1, "name" : "abs", "qname" : "excel:abs", "signature" : "($arg as xs:anyAtomicType) as xs:anyAtomicType", "description" : " Compute the abs of a numeric value.\n The value can also be a string and it will be casted to the appropriate numeric first.\n", "summary" : "

Compute the abs of a numeric value.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "arg", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The parameter can be a number, string, boolean value.
" } ], "returns" : { "type" : "xs:anyAtomicType", "description" : "The abs value as a numeric type." }, "errors" : [ "excel-err:Value if arg cannot be casted to numeric type." ] }, { "arity" : 1, "name" : "cast-as-numeric", "qname" : "excel:cast-as-numeric", "signature" : "($number as xs:anyAtomicType) as xs:anyAtomicType", "description" : " Cast the xs:anyAtomicType to a numeric type.\n If the value is already of a numeric type then nothing is changed.\n Otherwise the value is casted to the numeric type that is most appropriate.\n", "summary" : "

Cast the xs:anyAtomicType to a numeric type.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The parameter can be a number, string, boolean value.
" } ], "returns" : { "type" : "xs:anyAtomicType", "description" : "The casted value." }, "errors" : [ "excel-err:Value if the value cannot be casted to numeric type." ] }, { "arity" : 2, "name" : "ceiling", "qname" : "excel:ceiling", "signature" : "($number as xs:anyAtomicType, $significance as xs:anyAtomicType) as xs:anyAtomicType", "description" : " Returns number rounded up, away from zero, to the nearest multiple of significance.\n Significance must have the same sign as number.\n Number and significance must be of a numeric type or castable to numeric.\n Significance must not be zero.\n", "summary" : "

Returns number rounded up, away from zero, to the nearest multiple of significance.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The value you want to round.
" }, { "name" : "significance", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The multiple to which you want to round.
" } ], "returns" : { "type" : "xs:anyAtomicType", "description" : "The rounded value." }, "errors" : [ "excel-err:Value if parameters cannot be casted to numeric type.", "excel-err:Num if significance is zero or it doesn't have the same sign as number." ] }, { "arity" : 1, "name" : "degrees", "qname" : "excel:degrees", "signature" : "($radian as xs:double) as xs:integer", "description" : " Converts radians into degrees.\n", "summary" : "

Converts radians into degrees.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "radian", "type" : "xs:double", "occurence" : null, "description" : "
The value in radians.
" } ], "returns" : { "type" : "xs:integer", "description" : "The value in degrees 0 .. 360 or 0 .. -360." }, "errors" : [ ] }, { "arity" : 1, "name" : "even", "qname" : "excel:even", "signature" : "($number as xs:anyAtomicType) as xs:anyAtomicType", "description" : " Returns number rounded up to the nearest even integer.\n Regardless of the sign of number, a value is rounded up when adjusted away from zero.\n", "summary" : "

Returns number rounded up to the nearest even integer.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The value to round.
" } ], "returns" : { "type" : "xs:anyAtomicType", "description" : "The rounded value casted as numeric type." }, "errors" : [ "excel-err:Value if parameters cannot be casted to numeric type." ] }, { "arity" : 1, "name" : "fact", "qname" : "excel:fact", "signature" : "($number as xs:anyAtomicType) as xs:integer", "description" : " Returns the factorial of a number.\n", "summary" : "

Returns the factorial of a number.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The nonnegative number you want the factorial of. If number is not an integer, it is truncated.
" } ], "returns" : { "type" : "xs:integer", "description" : "Returns the factorial of a number. The factorial of a number is equal to 1*2*3*...* number." }, "errors" : [ "excel-err:Num if the number is smaller than zero" ] }, { "arity" : 1, "name" : "factdouble", "qname" : "excel:factdouble", "signature" : "($number as xs:integer) as xs:integer", "description" : " Returns the double factorial of a number.\n Computes the double factorial of n as n(n-2)(n-4)...\n", "summary" : "

Returns the double factorial of a number.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:integer", "occurence" : null, "description" : "
The positive integer value.
" } ], "returns" : { "type" : "xs:integer", "description" : "The result as integer." }, "errors" : [ "excel-err:Num if the number is negative." ] }, { "arity" : 2, "name" : "floor", "qname" : "excel:floor", "signature" : "($number as xs:anyAtomicType, $significance as xs:anyAtomicType) as xs:anyAtomicType", "description" : " Rounds number down, toward zero, to the nearest multiple of significance.\n Significance must have the same sign as number.\n", "summary" : "

Rounds number down, toward zero, to the nearest multiple of significance.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The value you want to round. The value is casted to numeric.
" }, { "name" : "significance", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The multiple to which you want to round.
" } ], "returns" : { "type" : "xs:anyAtomicType", "description" : "The rounded value as numeric type." }, "errors" : [ "excel-err:Value if parameters cannot be casted to numeric type.", "excel-err:Num if significance is zero or it doesn't have the same sign as number." ] }, { "arity" : 1, "name" : "gcd", "qname" : "excel:gcd", "signature" : "($numbers as xs:integer+) as xs:integer", "description" : " Returns the greatest common divisor GCD of a sequence of integers.\n The sequence can have one or more positive integers.\n", "summary" : "

Returns the greatest common divisor GCD of a sequence of integers.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "numbers", "type" : "xs:integer", "occurence" : null, "description" : "
The sequence of positive integers.
" } ], "returns" : { "type" : "xs:integer", "description" : "The GCD as integer." }, "errors" : [ "excel-err:Num if any number is smaller than zero." ] }, { "arity" : 1, "name" : "int", "qname" : "excel:int", "signature" : "($number as xs:anyAtomicType) as xs:integer", "description" : " Rounds a number down to the nearest integer.\n Positive numbers are rounded toward zero, negative numbers are rounded away from zero.\n", "summary" : "

Rounds a number down to the nearest integer.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The value to be rounded.
" } ], "returns" : { "type" : "xs:integer", "description" : "The rounded integer." }, "errors" : [ "excel-err:Value if parameter cannot be casted to numeric type" ] }, { "arity" : 1, "name" : "is-a-number", "qname" : "excel:is-a-number", "signature" : "($value as xs:anyAtomicType) as xs:boolean", "description" : " Checks if the xs:anyAtomicType argument is actually a numeric type\n or can be converted to numeric.\n", "summary" : "

Checks if the xs:anyAtomicType argument is actually a numeric type\n or can be converted to numeric.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "value", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
Parameter to be checked.
" } ], "returns" : { "type" : "xs:boolean", "description" : "true if the value can be casted to numeric." }, "errors" : [ ] }, { "arity" : 1, "name" : "lcm", "qname" : "excel:lcm", "signature" : "($numbers as xs:integer+) as xs:integer", "description" : " Returns the least common multiple of integers.

\n LCM for two numbers is computed by multiplying them and dividing with GCD.

\n The function is applied recursively replacing the first two numbers in the sequence with their LCM.\n", "summary" : "

Returns the least common multiple of integers.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "numbers", "type" : "xs:integer", "occurence" : null, "description" : "
The sequence of one or more positive integers.
" } ], "returns" : { "type" : "xs:integer", "description" : "The LCM as integer." }, "errors" : [ "excel-err:Num if any number is smaller than zero." ] }, { "arity" : 2, "name" : "mod", "qname" : "excel:mod", "signature" : "($number as xs:anyAtomicType, $divisor as xs:anyAtomicType) as xs:anyAtomicType", "description" : " Returns the remainder after number is divided by divisor.\n The result has the same sign as divisor.\n", "summary" : "

Returns the remainder after number is divided by divisor.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The number for which you want to find the remainder.
" }, { "name" : "divisor", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The number by which you want to divide number. This cannot be zero.
" } ], "returns" : { "type" : "xs:anyAtomicType", "description" : "The remainder from division as numeric type." }, "errors" : [ "excel-err:Value if parameters cannot be casted to numeric type.", "excel-err:Div0 if divisor is zero after casting to numeric." ] }, { "arity" : 2, "name" : "mround", "qname" : "excel:mround", "signature" : "($number as xs:anyAtomicType, $multiple as xs:anyAtomicType) as xs:anyAtomicType", "description" : " Returns a number rounded to the desired multiple.\n MROUND rounds up, away from zero, if the remainder of dividing number by multiple\n is greater than or equal to half the value of multiple.\n MROUND is computed through floor function.\n", "summary" : "

Returns a number rounded to the desired multiple.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The value to round, castable to numeric type.
" }, { "name" : "multiple", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The multiple to which you want to round number.
" } ], "returns" : { "type" : "xs:anyAtomicType", "description" : "The rounded number up to the desired multiple." }, "errors" : [ "excel-err:Value if parameters cannot be casted to numeric type." ] }, { "arity" : 1, "name" : "odd", "qname" : "excel:odd", "signature" : "($number as xs:anyAtomicType) as xs:integer", "description" : " Returns number rounded up to the nearest odd integer, away from zero.\n", "summary" : "

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

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The value to round.
" } ], "returns" : { "type" : "xs:integer", "description" : "The odd integer." }, "errors" : [ "excel-err:Value if parameter cannot be casted to numeric type." ] }, { "arity" : 0, "name" : "pi", "qname" : "excel:pi", "signature" : "() as xs:decimal", "description" : " Return the value of PI as decimal with 15 digits.\n", "summary" : "

Return the value of PI as decimal with 15 digits.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ ], "returns" : { "type" : "xs:decimal", "description" : "The value of PI with 15 digits." }, "errors" : [ ] }, { "arity" : 2, "name" : "power", "qname" : "excel:power", "signature" : "($number as xs:anyAtomicType, $power as xs:integer) as xs:anyAtomicType", "description" : " Returns the result of a number raised to a power.\n The result is computed through successive multiplications.\n", "summary" : "

Returns the result of a number raised to a power.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The base number.
" }, { "name" : "power", "type" : "xs:integer", "occurence" : null, "description" : "
The exponent as integer (cannot be floating point like in Excel).
" } ], "returns" : { "type" : "xs:anyAtomicType", "description" : "The result as numeric type." }, "errors" : [ "excel-err:Value if parameter cannot be casted to numeric type.", "excel-err:Value if power is smaller than zero." ] }, { "arity" : 1, "name" : "product", "qname" : "excel:product", "signature" : "($numbers as xs:anyAtomicType*) as xs:anyAtomicType", "description" : " Multiplies all the numbers given as arguments and returns the product.\n", "summary" : "

Multiplies all the numbers given as arguments and returns the product.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "numbers", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The sequence of arguments convertable to numeric types. The sequence can be of any length.
" } ], "returns" : { "type" : "xs:anyAtomicType", "description" : "The multiplication result as numeric type." }, "errors" : [ "excel-err:Value if parameters cannot be casted to numeric type." ] }, { "arity" : 2, "name" : "quotient", "qname" : "excel:quotient", "signature" : "($numerator as xs:anyAtomicType, $denominator as xs:anyAtomicType) as xs:integer", "description" : " Returns the integer portion of a division.\n", "summary" : "

Returns the integer portion of a division.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "numerator", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The divident.
" }, { "name" : "denominator", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The divisor. It cannot be zero.
" } ], "returns" : { "type" : "xs:integer", "description" : "The result value as numeric type." }, "errors" : [ "excel-err:Value if parameters cannot be casted to numeric type.", "excel-err:Div0 if denominator casted as numeric type has value zero." ] }, { "arity" : 1, "name" : "radians", "qname" : "excel:radians", "signature" : "($degree as xs:integer) as xs:decimal", "description" : " Converts degrees to radians.\n", "summary" : "

Converts degrees to radians.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "degree", "type" : "xs:integer", "occurence" : null, "description" : "
An angle in degrees that you want to convert.
" } ], "returns" : { "type" : "xs:decimal", "description" : "The value in radians." }, "errors" : [ ] }, { "arity" : 1, "name" : "roman", "qname" : "excel:roman", "signature" : "($number as xs:integer) as xs:string", "description" : " Converts an arabic numeral to roman, as text.\n Only the clasic format is supported (out of all formats Excel requires).

\n M is the largest digit, it represents 1000.\n Numbers bigger than 2000 will be represented by a sequence of \"M\".

\n D = 500, C = 100, L = 50, X = 10, V = 5, I = 1.\n", "summary" : "

Converts an arabic numeral to roman, as text.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:integer", "occurence" : null, "description" : "
A positive integer.
" } ], "returns" : { "type" : "xs:string", "description" : "The roman string representation." }, "errors" : [ "excel-err:Num if the input integer is negative" ] }, { "arity" : 2, "name" : "round", "qname" : "excel:round", "signature" : "($number as xs:anyAtomicType, $precision as xs:integer) as xs:anyAtomicType", "description" : " Rounds a number to a specified number of digits.\n If precision is greater than 0 (zero), then number is rounded\n to the specified number of decimal places.\n If num_digits is 0, then number is rounded to the nearest integer.\n If num_digits is less than 0, then number is rounded to the left of the decimal point.\n The 0.5 is rounded away from zero.\n", "summary" : "

Rounds a number to a specified number of digits.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The number to round, castable to a numeric type.
" }, { "name" : "precision", "type" : "xs:integer", "occurence" : null, "description" : "
The number of decimal places to keep.
" } ], "returns" : { "type" : "xs:anyAtomicType", "description" : "The rounded number as numeric type." }, "errors" : [ "excel-err:Value if parameters cannot be casted to numeric type." ] }, { "arity" : 2, "name" : "rounddown", "qname" : "excel:rounddown", "signature" : "($number as xs:anyAtomicType, $precision as xs:integer) as xs:anyAtomicType", "description" : " Rounds a number down, toward zero.\n If num_digits is greater than 0 (zero), then number is rounded down\n to the specified number of decimal places.\n If num_digits is 0, then number is rounded down to the nearest integer.\n If num_digits is less than 0, then number is rounded down to the left of the decimal point.\n", "summary" : "

Rounds a number down, toward zero.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The number to round, castable to numeric type.
" }, { "name" : "precision", "type" : "xs:integer", "occurence" : null, "description" : "
The number of decimal places to keep.
" } ], "returns" : { "type" : "xs:anyAtomicType", "description" : "the truncated number toward zero, as numeric type." }, "errors" : [ "excel-err:Value if parameters cannot be casted to numeric type." ] }, { "arity" : 2, "name" : "roundup", "qname" : "excel:roundup", "signature" : "($number as xs:anyAtomicType, $precision as xs:integer) as xs:anyAtomicType", "description" : " Rounds a number up, away from 0 (zero).\n If num_digits is greater than 0 (zero), then number is rounded down\n to the specified number of decimal places.\n If num_digits is 0, then number is rounded down to the nearest integer.\n If num_digits is less than 0, then number is rounded down to the left of the decimal point.\n", "summary" : "

Rounds a number up, away from 0 (zero).

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The number to round, castable to numeric type.
" }, { "name" : "precision", "type" : "xs:integer", "occurence" : null, "description" : "
The number of decimal places to keep.
" } ], "returns" : { "type" : "xs:anyAtomicType", "description" : "The truncated number away from zero, as numeric type." }, "errors" : [ "excel-err:Value if parameters cannot be casted to numeric type." ] }, { "arity" : 1, "name" : "sign", "qname" : "excel:sign", "signature" : "($number as xs:anyAtomicType) as xs:integer", "description" : " Determines the sign of a number.\n Returns 1 if the number is positive, zero (0) if the number is 0,\n and -1 if the number is negative.\n", "summary" : "

Determines the sign of a number.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The argument castable to numeric type.
" } ], "returns" : { "type" : "xs:integer", "description" : "The sign as (-1, 0, 1)." }, "errors" : [ "excel-err:Value if parameters cannot be casted to numeric type." ] }, { "arity" : 1, "name" : "sort-numbers", "qname" : "excel:sort-numbers", "signature" : "($numbers as xs:anyAtomicType*) as xs:anyAtomicType*", "description" : " Helper function.

\n Sorts a sequence of numbers or arguments castable to numeric.\n It first casts all arguments to numeric and then sorts ascending.\n", "summary" : "

Helper function.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "numbers", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The sequence of arguments castable to numeric.
" } ], "returns" : { "type" : "xs:anyAtomicType*", "description" : "The sorted sequence as numeric types." }, "errors" : [ "excel-err:Value if parameters cannot be casted to numeric type." ] }, { "arity" : 1, "name" : "sum", "qname" : "excel:sum", "signature" : "($numbers as xs:anyAtomicType*) as xs:anyAtomicType", "description" : " Adds all the numbers in the sequence.\n", "summary" : "

Adds all the numbers in the sequence.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "numbers", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The sequence of arguments castable to numeric types. The sequence can be of any length.
" } ], "returns" : { "type" : "xs:anyAtomicType", "description" : "The sum as numeric type." }, "errors" : [ "excel-err:Value if parameters cannot be casted to numeric type." ] }, { "arity" : 1, "name" : "trunc", "qname" : "excel:trunc", "signature" : "($number as xs:anyAtomicType) as xs:integer", "description" : " Truncates a number to an integer by removing the fractional part of the number.\n", "summary" : "

Truncates a number to an integer by removing the fractional part of the number.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The argument castable to numeric type.
" } ], "returns" : { "type" : "xs:integer", "description" : "The integer value." }, "errors" : [ "excel-err:Value if parameter cannot be casted to numeric type." ] }, { "arity" : 2, "name" : "trunc", "qname" : "excel:trunc", "signature" : "($number as xs:anyAtomicType, $precision as xs:integer) as xs:anyAtomicType", "description" : " Truncates a number down to precision.\n This behaves exactly like rounddown.\n", "summary" : "

Truncates a number down to precision.

", "annotation_str" : "", "annotations" : [ ], "updating" : false, "parameters" : [ { "name" : "number", "type" : "xs:anyAtomicType", "occurence" : null, "description" : "
The argument castable to numeric type.
" }, { "name" : "precision", "type" : "xs:integer", "occurence" : null, "description" : "
The number of decimal places to keep .
" } ], "returns" : { "type" : "xs:anyAtomicType", "description" : "The integer value." }, "errors" : [ "excel-err:Value if parameter cannot be casted to numeric type." ] } ], "variables" : [ ] }