---
schema_version: "1"
id: f8a71e8ba17620026660bb93159bee4952783672f529233da351c7ef8cc17d12
title: Math (dw::util::Math)
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.12/dw-math.md
canonical_url: https://docs.mulesoft.com/dataweave/2.12/dw-math
source_site: docs.mulesoft.com
content_type: documentation
content_hash: afa1f4548bead0a12bdc0b7e317aab302269a8aed0e9e0c203a0928574db450b
description: MuleSoft Documentation Site
release: "2.12"
latest: false
---
---
product: DataWeave
version: 2.12
---

# Math (dw::util::Math)

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

A utility module that provides mathematical functions.

To use this module, you must import it to your DataWeave code, for example, by adding the line
`import * from dw::util::Math` to the header of your DataWeave script.

_Introduced in DataWeave version 2.4.0._

## Functions

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.12/dw-math-functions-acos">acos</a></p></td><td><p>Returns an arc cosine value that can range from <code>0.0</code> through pi.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.12/dw-math-functions-asin">asin</a></p></td><td><p>Returns an arc sine value that can range from <code>-pi/2</code> through <code>pi/2</code>.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.12/dw-math-functions-atan">atan</a></p></td><td><p>Returns an arc tangent value that can range from <code>-pi/2</code> through <code>pi/2</code>.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.12/dw-math-functions-cos">cos</a></p></td><td><p>Returns the trigonometric cosine of an angle from a given number of radians.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.12/dw-math-functions-decimaladd">decimalAdd</a></p></td><td><p>Performs number addition with rounding specified by the operation context.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.12/dw-math-functions-decimaldivide">decimalDivide</a></p></td><td><p>Performs number division with rounding specified by the operation context. If precision is set to <code>0</code> (unlimited precision) and the result has an infinite decimal expansion, the function returns an error.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.12/dw-math-functions-decimalmultiply">decimalMultiply</a></p></td><td><p>Performs number multiplication with rounding specified by the operation context.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.12/dw-math-functions-decimalpow">decimalPow</a></p></td><td><p>Returns a number with value base^exponent with rounding specified by the operation context. The maximum value for the exponent is <code>99999999</code>.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.12/dw-math-functions-decimalround">decimalRound</a></p></td><td><p>Returns the argument number with rounding specified by the operation context.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.12/dw-math-functions-decimalsqrt">decimalSqrt</a></p></td><td><p>Returns a number that approximates the square root of the argument with rounding specified by the operation context.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.12/dw-math-functions-decimalsubtract">decimalSubtract</a></p></td><td><p>Performs number subtraction with rounding specified by the operation context.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.12/dw-math-functions-log10">log10</a></p></td><td><p>Returns the logarithm base 10 of a number.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.12/dw-math-functions-logn">logn</a></p></td><td><p>Returns the natural logarithm (base <code>e</code>) of a number.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.12/dw-math-functions-sin">sin</a></p></td><td><p>Returns the trigonometric sine of an angle from a given number of radians.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.12/dw-math-functions-tan">tan</a></p></td><td><p>Returns the trigonometric tangent of an angle from a given number of radians.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.12/dw-math-functions-todegrees">toDegrees</a></p></td><td><p>Converts an angle measured in radians to an approximately equivalent number of degrees.</p></td></tr><tr><td><p><a href="https://docs.mulesoft.com/dataweave/2.12/dw-math-functions-toradians">toRadians</a></p></td><td><p>Converts a given number of degrees in an angle to an approximately equivalent number of radians.</p></td></tr></tbody></table>

## Variables

- [Math Variables](https://docs.mulesoft.com/dataweave/2.12/dw-math-variables)

## Types

- [Math Types](https://docs.mulesoft.com/dataweave/2.12/dw-math-types)
