Changes

Jump to navigation Jump to search
246 bytes removed ,  12:32, 2 July 2020
m
Text replacement - "[http://www.w3.org/TR/xpath-functions-30" to "[https://www.w3.org/TR/xpath-functions-31"
The math module defines [[Querying#FunctionsModule Library|XQuery functionsModule]] defines functions to perform mathematical operations, such as <code>{{Code|pi</code>}}, <code>{{Code|asin</code> }} and <code>{{Code|acos</code>}}. All Most functions are preceded by specified in the <code>math[https:</code> prefix/www.w3.org/TR/xpath-functions-31/ Functions and Operators Specification] of the upcoming XQuery 3.0 Recommendation, which is linked and some additional ones have been added in this module. =Conventions= All functions in this module are assigned to the <code><nowiki>http://www.w3.org/2005/xpath-functions/math</nowiki></code> namespace. Some of , which is statically bound to the functions have also been specified in the [http://www{{Code|math}} prefix.w3.org/TR/xpath-functions-30<br/ > =W3 Functions and Operators Specification] of the upcoming XQuery 3.0 Recommendation.=
==math:pi==
{||-| valign='top' width='90' | '''Signatures'''|<code><b>math:pi</b>() as xs:double</code>|-| valign='top' | ''100%'Summary'''|Returns the <code>xs:double</code> value of the mathematical constant π whose lexical representation is 3.141592653589793.|-| valign='top' | '''Examples'''|* <code>2*math:pi()</code> returns <code>6.283185307179586e0</code>.* <code>60 * (math:pi() div 180)</code> converts an angle of 60 degrees to radians.|} ==math:e=={|
|-
| valign='top' width='90120' | '''Signatures'''|<code><b>{{Func|math:e</b>() as pi||xs:double</code>}}
|-
| valign='top' | '''Summary'''|Returns the <code>{{Code|xs:double</code> }} value of the mathematical constant <i>e</i> π whose lexical representation is 23.718281828459045141592653589793.
|-
| valign='top' | '''Examples'''
|
* <code>5{{Code|2*math:epi()</code> }} returns <code>13{{Code|6.591409142295225</code>283185307179586e0}}.* {{Code|60 * (math:pi() div 180)}} converts an angle of 60 degrees to radians.
|}
==math:sqrt==
{|width='100%'
|-
| valign='top' width='90120' | '''Signatures'''|<code><b>{{Func|math:sqrt</b>(|$arg as xs:double?) as |xs:double?</code>}}
|-
| valign='top' | '''Summary'''|Returns the square root of <code>{{Code|$arg</code>}}.<br/>If <code>{{Code|$arg</code> }} is the empty sequence, the empty sequence is returned.<br />Otherwise the result is the <code>{{Code|xs:double</code> }} value of the mathematical square root of <code>{{Code|$arg</code>}}.
|}
==math:sin==
{|width='100%'
|-
| valign='top' width='90120' | '''Signatures'''|<code><b>{{Func|math:sin</b>(|$arg as xs:double?) as |xs:double?</code>}}
|-
| valign='top' | '''Summary'''|Returns the sine of the <code>{{Code|$arg</code>}}, expressed in radians.<br/>If <code>{{Code|$arg</code> }} is the empty sequence, the empty sequence is returned.<br />Otherwise the result is the sine of <code>{{Code|$arg</code>}}, treated as an angle in radians.
|}
==math:cos==
{|width='100%'
|-
| valign='top' width='90120' | '''Signatures'''|<code><b>{{Func|math:cos</b>(|$arg as xs:double?) as |xs:double?</code>}}
|-
| valign='top' | '''Summary'''|Returns the cosine of <code>{{Code|$arg</code>}}, expressed in radians.<br/>If <code>{{Code|$arg</code> }} is the empty sequence, the empty sequence is returned.<br />Otherwise the result is the cosine of <code>{{Code|$arg</code>}}, treated as an angle in radians.
|}
==math:tan==
{|width='100%'
|-
| valign='top' width='90120' | '''Signatures'''|<code><b>{{Func|math:tan</b>(|$ arg as xs:double?) as |xs:double?</code>}}
|-
| valign='top' | '''Summary'''|Returns the tangent of <code>{{Code|$arg</code>}}, expressed in radians.<br/>If <code>{{Code|$arg</code> }} is the empty sequence, the empty sequence is returned.<br />Otherwise the result is the tangent of <code>{{Code|$arg</code>}}, treated as an angle in radians.
|}
==math:asin==
{|width='100%'
|-
| valign='top' width='90120' | '''Signatures'''|<code><b>{{Func|math:asin</b>(|$arg as xs:double?) as |xs:double?</code>}}
|-
| valign='top' | '''Summary'''|Returns the arc sine of <code>{{Code|$arg</code>}}.<br/>If <code>{{Code|$arg</code> }} is the empty sequence, the empty sequence is returned.<br />Otherwise the result is the arc sine of <code>{{Code|$arg</code>}}, returned as an angle in radians in the range -π/2 to +π/2.
|}
==math:acos==
{|width='100%'
|-
| valign='top' width='90120' | '''Signatures'''|<code><b>{{Func|math:acos</b>(|$arg as xs:double?) as |xs:double?</code>}}
|-
| valign='top' | '''Summary'''|Returns the arc cosine of <code>{{Code|$arg</code>}}.<br/>If <code>{{Code|$arg</code> }} is the empty sequence, the empty sequence is returned.<br />Otherwise the result is the arc cosine of <code>{{Code|$arg</code>}}, returned as an angle in radians in the range 0 to +π.
|}
==math:atan==
{|width='100%'
|-
| valign='top' width='90120' | '''Signatures'''|<code><b>{{Func|math:atan</b>(|$arg as xs:double?) as |xs:double?</code>}}
|-
| valign='top' | '''Summary'''|Returns the arc tangent of <code>{{Code|$arg</code>}}.<br/>If <code>{{Code|$arg</code> }} is the empty sequence, the empty sequence is returned.<br />Otherwise the result is the arc tangent of <code>{{Code|$arg</code>}}, returned as an angle in radians in the range -π/2 to +π/2.
|}
==math:atan2==
{|width='100%'
|-
| valign='top' width='90120' | '''Signatures'''|<code><b>{{Func|math:atan2</b>(|$arg1 as xs:double?, $arg2 as xs:double) as |xs:double?</code>}}
|-
| valign='top' | '''Summary'''|Returns the arc tangent of <code>{{Code|$arg1</code> }} divided by <code>{{Code|$arg2</code>}}, the result being in the range -π/2 to +π/2 radians.<br/>If <code>{{Code|$arg1</code> }} is the empty sequence, the empty sequence is returned.<br />Otherwise the result is the arc tangent of <code>{{Code|$arg1</code> }} divided by <code>{{Code|$arg2</code>}}, returned as an angle in radians in the range -π to +π.
|}
==math:pow==
{|width='100%'
|-
| valign='top' width='90120' | '''Signatures'''|<code><b>{{Func|math:pow</b>(|$arg1 as xs:double?, $arg2 as xs:double) as |xs:double?</code>}}
|-
| valign='top' | '''Summary'''|Returns <code>{{Code|$arg1</code> }} raised to the power of <code>{{Code|$arg2</code>}}.<br/>If <code>{{Code|$arg1</code> }} is the empty sequence, the empty sequence is returned.<br />Otherwise the result is the <code>{{Code|$arg1</code> }} raised to the power of <code>{{Code|$arg2</code>}}.
|-
| valign='top' | '''Examples'''
|
* <code>{{Code|math:pow(2, 3)</code> }} returns <code>{{Code|8</code>}}.
|}
==math:exp==
{|width='100%'
|-
| valign='top' width='90120' | '''Signatures'''|<code><b>{{Func|math:exp</b>(|$arg as xs:double?) as |xs:double?</code>}}
|-
| valign='top' | '''Summary'''|Returns <i>e</i> raised to the power of <code>{{Code|$arg</code>}}.<br/>If <code>{{Code|$arg</code> }} is the empty sequence, the empty sequence is returned.<br />Otherwise the result is the value of <i>e</i> raised to the power of <code>{{Code|$arg</code>}}.
|-
| valign='top' | '''Examples'''
|
* <code>{{Code|math:exp(1)</code> }} returns <i>e</i>.
|}
==math:log==
{|width='100%'
|-
| valign='top' width='90120' | '''Signatures'''|<code><b>{{Func|math:log</b>(|$arg as xs:double?) as |xs:double?</code>}}
|-
| valign='top' | '''Summary'''|Returns the natural logarithm of <code>{{Code|$arg</code>}}.<br/>If <code>{{Code|$arg</code> }} is the empty sequence, the empty sequence is returned.<br />Otherwise the result is the natural logarithm (base <i>e</i>) of <code>{{Code|$arg</code>}}.
|-
| valign='top' | '''Examples'''
|
* <code>{{Code|math:log(math:e())</code> }} returns <code>{{Code|1</code>}}.
|}
==math:log10==
{|width='100%'
|-
| valign='top' width='90120' | '''Signatures'''|<code><b>{{Func|math:log10</b>(|$arg as xs:double?) as |xs:double?</code>}}
|-
| valign='top' | '''Summary'''|Returns the base 10 logarithm of <code>{{Code|$arg</code>}}.<br/>If <code>{{Code|$arg</code> }} is the empty sequence, the empty sequence is returned.<br />Otherwise the result is the base 10 logarithm of <code>{{Code|$arg</code>}}.
|-
| valign='top' | '''Examples'''
|
* <code>{{Code|math:log(100)</code> }} returns <code>{{Code|2</code>}}.
|}
=Additional Functions= ==math:randome=={|width='100%'|-| width='120' | '''Signatures'''|{{Func|math:e||xs:double}}
|-
| valign='top' width='90' | '''SignaturesSummary'''|<code><b>mathReturns the {{Code|xs:randomdouble}} value of the mathematical constant </bi>() as xs:double?e</codei>whose lexical representation is 2.718281828459045.
|-
| valign='top' | '''SummaryExamples'''|Returns a random <code>xs* {{Code|5*math:double</code> value between <code>0.0</code> and <code>1e()}} returns {{Code|13.0</code>591409142295225}}.
|}
==math:sinh==
{|width='100%'
|-
| valign='top' width='90120' | '''Signatures'''|<code><b>{{Func|math:sinh</b>(|$arg as xs:double?) as |xs:double?</code>}}
|-
| valign='top' | '''Summary'''|Returns the hyperbolic sine of <code>{{Code|$arg</code>}}.<br/>If <code>{{Code|$arg</code> }} is the empty sequence, the empty sequence is returned.<br />Otherwise the result is the hyperbolic sine of <code>{{Code|$arg</code>}}.
|-
| valign='top' | '''Examples'''
|
* <code>{{Code|math:sinh(0)</code> }} returns <code>{{Code|0</code>}}.
|}
==math:cosh==
{|width='100%'
|-
| valign='top' width='90120' | '''Signatures'''|<code><b>{{Func|math:cosh</b>(|$arg as xs:double?) as |xs:double?</code>}}
|-
| valign='top' | '''Summary'''|Returns the hyperbolic cosine of <code>{{Code|$arg</code>}}.<br/>If <code>{{Code|$arg</code> }} is the empty sequence, the empty sequence is returned.<br />Otherwise the result is the hyperbolic cosine of <code>{{Code|$arg</code>}}.
|-
| valign='top' | '''Examples'''
|
* <code>{{Code|math:cosh(0)</code> }} returns <code>{{Code|1</code>}}.
|}
==math:tanh==
{|width='100%'|-| width='120' | '''Signatures'''|{{Func|math:tanh|$arg as xs:double?|xs:double?}}|-| '''Summary'''|Returns the hyperbolic tangent of {{Code|$arg}}.<br/>If {{Code|$arg}} is the empty sequence, the empty sequence is returned.<br />Otherwise the result is the hyperbolic tangent of {{Code|$arg}}.|-| '''Examples'''|* {{Code|math:tanh(100)}} returns {{Code|1}}.|} ==math:crc32== {| width='100%'
|-
| valign='top' width='90120' | '''Signatures'''|<code><b>{{Func|math:tanh</b>(crc32|$arg string as xs:doublestring?) as |xs:doublehexBinary?}}<br /code>
|-
| valign='top' | '''Summary'''|Returns Calculates the hyperbolic tangent CRC32 check sum of <code>the given {{Code|$arg</code>string}}.<br/>If <code>$arg</code> is the an empty sequenceis supplied, the empty sequence is returned.<br />Otherwise the result is the hyperbolic tangent of <code>$arg</code>.
|-
| valign='top' | '''Examples'''
|
* <code>{{Code|math:tanhcrc32(100"")</code> }} returns <code>1</code>{{Code|'00000000'}}.* {{Code|math:crc32("BaseX")}} returns {{Code|'4C06FC7F'}}.
|}
=Changelog= ; Version 9.1* Updated: [[#math:crc32|math:crc32]] can be called with empty sequence. ; Version 7.5* Moved: [[Random Module#random:integer|math:random]] and [[Random Module#random:uuid|math:uuid]] have been moved to [[Random Module]]. ; Version 7.3* Added: [[#math:crc32|math:crc32]] and [[CategoryRandom Module#random:uuid|math:XQueryuuid]]have been adopted from the obsolete Utility Module.
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu