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

# 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>
