Changes

Jump to navigation Jump to search
754 bytes added ,  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 Library|XQuery Module]] defines functions to perform mathematical operations, such as {{Code|pi}}, {{Code|asin}} and {{Code|acos}}. Most functions are specified in the [httphttps://www.w3.org/TR/xpath-functions-3031/ Functions and Operators Specification] of the upcoming XQuery 3.0 Recommendation, and some additional ones have been added in this module.
=Conventions=
All functions in this module are assigned to the {{Code|<code><nowiki>http://www.w3.org/2005/xpath-functions/math}} </nowiki></code> namespace, which is statically bound to the {{Code|math}} prefix.<br/>
=W3 Functions=
==math:pi==
{|width='100%'
|-
| width='90120' | '''Signatures'''
|{{Func|math:pi||xs:double}}
|-
* {{Code|2*math:pi()}} returns {{Code|6.283185307179586e0}}.
* {{Code|60 * (math:pi() div 180)}} converts an angle of 60 degrees to radians.
|}
 
==math:e==
{|
|-
| width='90' | '''Signatures'''
|{{Func|math:e||xs:double}}
|-
| '''Summary'''
|Returns the {{Code|xs:double}} value of the mathematical constant <i>e</i> whose lexical representation is 2.718281828459045.
|-
| '''Examples'''
|
* {{Code|5*math:e()}} returns {{Code|13.591409142295225}}.
|}
==math:sqrt==
{|width='100%'
|-
| width='90120' | '''Signatures'''
|{{Func|math:sqrt|$arg as xs:double?|xs:double?}}
|-
==math:sin==
{|width='100%'
|-
| width='90120' | '''Signatures'''
|{{Func|math:sin|$arg as xs:double?|xs:double?}}
|-
==math:cos==
{|width='100%'
|-
| width='90120' | '''Signatures'''
|{{Func|math:cos|$arg as xs:double?|xs:double?}}
|-
==math:tan==
{|width='100%'
|-
| width='90120' | '''Signatures'''|{{Func|math:tan|$ arg as xs:double?|xs:double?}}
|-
| '''Summary'''
==math:asin==
{|width='100%'
|-
| width='90120' | '''Signatures'''
|{{Func|math:asin|$arg as xs:double?|xs:double?}}
|-
==math:acos==
{|width='100%'
|-
| width='90120' | '''Signatures'''
|{{Func|math:acos|$arg as xs:double?|xs:double?}}
|-
==math:atan==
{|width='100%'
|-
| width='90120' | '''Signatures'''
|{{Func|math:atan|$arg as xs:double?|xs:double?}}
|-
==math:atan2==
{|width='100%'
|-
| width='90120' | '''Signatures'''
|{{Func|math:atan2|$arg1 as xs:double?, $arg2 as xs:double|xs:double?}}
|-
==math:pow==
{|width='100%'
|-
| width='90120' | '''Signatures'''
|{{Func|math:pow|$arg1 as xs:double?, $arg2 as xs:double|xs:double?}}
|-
==math:exp==
{|width='100%'
|-
| width='90120' | '''Signatures'''
|{{Func|math:exp|$arg as xs:double?|xs:double?}}
|-
==math:log==
{|width='100%'
|-
| width='90120' | '''Signatures'''
|{{Func|math:log|$arg as xs:double?|xs:double?}}
|-
==math:log10==
{|width='100%'
|-
| width='90120' | '''Signatures'''
|{{Func|math:log10|$arg as xs:double?|xs:double?}}
|-
|}
=Additional Functions= ==math:randome=={|width='100%'
|-
| width='90120' | '''Signatures'''|{{Func|math:randome||xs:double?}}
|-
| '''Summary'''
|Returns a random the {{Code|xs:double}} value between of the mathematical constant <i>e</i> whose lexical representation is 2.718281828459045.|-| '''Examples'''|* {{Code|0.05*math:e()}} and returns {{Code|113.0591409142295225}}.
|}
==math:sinh==
{|width='100%'
|-
| width='90120' | '''Signatures'''
|{{Func|math:sinh|$arg as xs:double?|xs:double?}}
|-
==math:cosh==
{|width='100%'
|-
| width='90120' | '''Signatures'''
|{{Func|math:cosh|$arg as xs:double?|xs:double?}}
|-
==math:tanh==
{|width='100%'
|-
| width='90120' | '''Signatures'''
|{{Func|math:tanh|$arg as xs:double?|xs:double?}}
|-
|
* {{Code|math:tanh(100)}} returns {{Code|1}}.
|}
 
==math:crc32==
 
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|math:crc32|$string as xs:string?|xs:hexBinary?}}<br />
|-
| '''Summary'''
|Calculates the CRC32 check sum of the given {{Code|$string}}.<br/>If an empty sequence is supplied, the empty sequence is returned.
|-
| '''Examples'''
|
* {{Code|math:crc32("")}} returns {{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 [[Random Module#mathrandom:uuid|math:uuid]] have been adopted from the obsolete Utility Module. [[Category:XQuery]]
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu