# Number modifiers

Learn how to manipulate numeric values in CQL.

Number modifiers are natural language functions for manipulating numeric values. These functions are useful for tasks that involve transforming one thing into another, such as rounding a number, formatting it for display, and other similar tasks.

This is the summary of the available number modifiers for quick reference:

Modifier | Description |
---|---|

Round | Round a number to the nearest integer. |

## Round

This modifier rounds a number to the nearest whole number, based on the rounding mode and scale that you specify.

When you round a number, the output type remains the same as the input. For example, if you round a float value, the result will still be a float value. Rounding an integer has no effect, so the output is the same as the input.

### Syntax

This modifier has the following syntax:

/*<value>*/ rounded

You can optionally specify a rounding mode:

/*<value>*/ rounded /*<mode>*/

And also a scale:

/*<value>*/ rounded with scale of /*<scale>*/

The /*<mode>*/ is a literal word that specifies the rounding mode and cannot be specified dynamically using expressions.

Here is a list of the supported modes:

Mode | Description |
---|---|

up | Round away from zero. For example, 2.5 becomes 3 and -2.5 becomes -3. This is the default rounding mode. |

down | Round towards zero. For example, 2.5 becomes 2 and -2.5 becomes -2. |

half up | Round to the nearest integer, with .5 rounded up. For example, 2.5 becomes 3, and -2.5 becomes -3. |

half down | Round to the nearest integer, with .5 rounded down. For example, 2.5 becomes 2, and -2.5 becomes -2. |

half even | Round to the nearest integer, with .5 rounded to the nearest even number. For example, 2.5 becomes 2, and 3.5 becomes 4. |

half odd | Round to the nearest integer, with .5 rounded to nearest odd number. For example, 2.5 becomes 3, and 3.5 becomes 3. |

### Parameters

These are the supported parameters:

- valuenumber
The number to round.

- scale(optional)integer
A non-negative integer that specifies the number of digits to the right of the decimal point.

### Examples

Here is a basic example of how to round a number using the default rounding mode:

10.5 rounded // 11

For more control, you can specify the rounding mode:

10.5 rounded down // 10

If you want to round a number to a specific number of decimal places, you can specify the scale:

10.136 rounded with scale of 2 // 10.14