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

# Math Types (dw::util::Math)

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

<table><colgroup><col> <col> <col></colgroup><thead><tr><th>Type</th><th>Definition</th><th>Description</th></tr></thead><tbody><tr><td><p>OperationContext</p></td><td><div><div><p><code>type OperationContext = {| precision?: Number, roundingMode?: RoundingMode |}</code></p></div></div></td><td><div><div><p>Defines the configuration under which a math operation is executed.</p></div><div><ul><li><p><code>precision</code>: number of digits used for the operation.</p></li><li><p><code>roundingMode</code>: rounding mode applied to the operation.</p></li></ul></div></div></td></tr><tr><td><p>RoundCeiling</p></td><td><div><div><p><code>type RoundCeiling = "CEILING"</code></p></div></div></td><td><div><div><p>Rounding mode that rounds toward positive infinity. If the number is positive, it behaves like <code>ROUND_UP</code>. If negative, it behaves like <code>ROUND_DOWN</code>. This rounding mode never decreases the calculated value.</p></div></div></td></tr><tr><td><p>RoundDown</p></td><td><div><div><p><code>type RoundDown = "DOWN"</code></p></div></div></td><td><div><div><p>Rounding mode that rounds toward zero. It never increments the digit before a discarded fraction (for example, truncates).</p></div></div></td></tr><tr><td><p>RoundFloor</p></td><td><div><div><p><code>type RoundFloor = "FLOOR"</code></p></div></div></td><td><div><div><p>Rounding mode that rounds toward negative infinity. If the number is positive, it behaves like <code>ROUND_DOWN</code>. If negative, it behaves like <code>ROUND_UP</code>.</p></div></div></td></tr><tr><td><p>RoundHalfDown</p></td><td><div><div><p><code>type RoundHalfDown = "HALF_DOWN"</code></p></div></div></td><td><div><div><p>Rounding mode that rounds toward the nearest neighbor, unless both neighbors are equidistant, in which case it rounds down. If the discarded fraction is greater than 0.5, it behaves like <code>ROUND_UP</code>. Otherwise, it behaves like <code>ROUND_DOWN</code>.</p></div></div></td></tr><tr><td><p>RoundHalfEven</p></td><td><div><div><p><code>type RoundHalfEven = "HALF_EVEN"</code></p></div></div></td><td><div><div><p>Rounding mode that rounds toward the nearest neighbor, unless both neighbors are equidistant, in which case it rounds toward the even neighbor. If the digit to the left of the discarded fraction is odd, it behaves like <code>ROUND_HALF_UP</code>. If even, it behaves like <code>ROUND_HALF_DOWN</code>.</p></div></div></td></tr><tr><td><p>RoundHalfUp</p></td><td><div><div><p><code>type RoundHalfUp = "HALF_UP"</code></p></div></div></td><td><div><div><p>Rounding mode that rounds toward the nearest neighbor, unless both neighbors are equidistant, in which case it rounds up. If the discarded fraction is greater than or equal to 0.5, it behaves like <code>ROUND_UP</code>. Otherwise, it behaves like <code>ROUND_DOWN</code>.</p></div></div></td></tr><tr><td><p>RoundUnnecessary</p></td><td><div><div><p><code>type RoundUnnecessary = "UNNECESSARY"</code></p></div></div></td><td><div><div><p>Rounding mode that asserts that the requested operation has an exact result, so rounding isn’t necessary.</p></div></div></td></tr><tr><td><p>RoundUp</p></td><td><div><div><p><code>type RoundUp = "UP"</code></p></div></div></td><td><div><div><p>Rounding mode that rounds away from zero. It always increments the digit before a nonzero discarded fraction.</p></div></div></td></tr><tr><td><p>RoundingMode</p></td><td><div><div><p><code>type RoundingMode = RoundUp | RoundDown | RoundCeiling | RoundFloor | RoundHalfUp | RoundHalfDown | RoundHalfEven | RoundUnnecessary</code></p></div></div></td><td><div><div><p>Enumeration of rounding strategies available for math operations. Available options are: <code>RoundUp</code>, <code>RoundDown</code>, <code>RoundCeiling</code>, <code>RoundFloor</code>, <code>RoundHalfUp</code>, <code>RoundHalfDown</code>, <code>RoundHalfEven</code>, <code>RoundUnnecessary</code>.</p></div></div></td></tr></tbody></table>
