# Math Functions

This module defines functions to perform mathematical operations, such as `pi`

, `asin`

and `acos`

. Most functions are described in detail in the XQuery Functions and Operators Specification, and some functions have been added.

## Conventions

All functions in this module are assigned to the `http://www.w3.org/2005/xpath-functions/math`

namespace, which is statically bound to the `math`

prefix.

## Functions

`math:pi`

Signature | math:pi() as xs:double |
---|---|

Summary | Returns the value of the mathematical constant π. |

Examples | Result: `3.141592653589793e0` Converts an angle of 60 degrees to radians. |

`math:e`

Signature | math:e() as xs:double |
---|---|

Summary | Returns the `xs:double` value of the mathematical constant e. |

Examples | Result: `2.718281828459045e0` |

`math:sqrt`

Signature | math:sqrt( $value as xs:double? ) as xs:double? |
---|---|

Summary | Returns the square root of `$value` . |

`math:pow`

Signature | math:pow( $x as xs:double?, $y as xs:double ) as xs:double? |
---|---|

Summary | Returns `$x` raised to the power of `$y` . |

Examples | Result: `8` |

`math:exp`

Signature | math:exp( $value as xs:double? ) as xs:double? |
---|---|

Summary | Returns e raised to the power of `$value` . |

Examples | Returns e. |

`math:log`

Signature | math:log( $value as xs:double? ) as xs:double? |
---|---|

Summary | Returns the natural logarithm (base e) of `$value` . |

Examples | Result: `1` |

`math:log10`

Signature | math:log10( $value as xs:double? ) as xs:double? |
---|---|

Summary | Returns the base 10 logarithm of `$value` . |

Examples | Result: `4.605170185988092e0` |

`math:sin`

Signature | math:sin( $radians as xs:double? ) as xs:double? |
---|---|

Summary | Returns the sine of `$radians` , expressed as an angle in radians. |

`math:cos`

Signature | math:cos( $radians as xs:double? ) as xs:double? |
---|---|

Summary | Returns the cosine of `$radians` , expressed as an angle in radians. |

`math:tan`

Signature | math:tan( $radians as xs:double? ) as xs:double? |
---|---|

Summary | Returns the tangent of `$radians` , expressed as an angle in radians. |

`math:asin`

Signature | math:asin( $value as xs:double? ) as xs:double? |
---|---|

Summary | Returns the arc sine of `$value` , expressed as an angle in radians in the range –π/2 to +π/2. |

`math:acos`

Signature | math:acos( $value as xs:double? ) as xs:double? |
---|---|

Summary | Returns the arc cosine of `$value` , expressed as an angle in radians in the range 0 to +π. |

`math:atan`

Signature | math:atan( $value as xs:double? ) as xs:double? |
---|---|

Summary | Returns the arc tangent of `$value` , expressed as an angle in radians in the range –π/2 to +π/2. |

`math:atan2`

Signature | math:atan2( $x as xs:double?, $y as xs:double ) as xs:double? |
---|---|

Summary | Returns the arc tangent of `$x` divided by `$y` , expressed as an angle in radians in the range –π to +π. |

`math:sinh`

Signature | math:sinh( $value as xs:double? ) as xs:double? |
---|---|

Summary | Returns the hyperbolic sine of `$value` |

Examples | Result: `0` |

`math:cosh`

Signature | math:cosh( $value as xs:double? ) as xs:double? |
---|---|

Summary | Returns the hyperbolic cosine of `$value` . |

Examples | Result: `1` |

`math:tanh`

Signature | math:tanh( $value as xs:double? ) as xs:double? |
---|---|

Summary | Returns the hyperbolic tangent of `$value` . |

Examples | Result: `1` |

## Changelog

**Version 11.0**

- Updated:
`math:e`

,`math:sinh`

,`math:cosh`

and`math:tanh`

are now part of the standard. - Removed:
`math:crc32`

in favor of`fn:hash`

.

**Version 9.1**

- Updated:
`math:crc32`

can be called with empty sequence.

**Version 7.5**

- Moved:
`math:random`

and`math:uuid`

have been moved to the Random Functions.

**Version 7.3**

- Added:
`math:crc32`

and`math:uuid`

have been adopted from the obsolete Utility Module.

⚡Generated with XQuery