> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alumio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Math: round

> Rounds a number to the provided precision.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Rounds a number to the provided precision, using normal rounding rules (a digit of 5 or higher rounds up, lower rounds down). Use this to tidy up prices, weights, or calculated totals so they have a consistent number of decimal places, for example rounding `19.876` to `19.88`.

This documentation describes: [Schema](/schemas/mapper/math-round)

## Fields

<FormField property="precision" label="Precision" required>
  How many decimal places to keep. Use `0` to round to a whole number, `2` to round to two decimals (handy for prices), and so on. The value cannot be negative.
</FormField>

## Sample data

| Field     | Value |
| --------- | ----- |
| Precision | `2`   |

Input:

```json theme={null}
{
    "price": 19.876
}
```

Output:

```json theme={null}
{
    "price": 19.88
}
```

```json Configuration theme={null}
{
  "prototype": "math-round",
  "parameters": {
    "precision": 2
  }
}
```
