ROUND

fun <T : Number?> ROUND(column: KQLiteColumn<T>, digits: Int? = null): KQLiteColumn<T>

Represents the SQLite ROUND() function, which rounds a numeric value.

This function can be called in two ways:

  1. ROUND(column): Rounds the value to the nearest integer. For values halfway between two integers (e.g., 2.5), it rounds away from zero (e.g., 2.5 becomes 3.0, -2.5 becomes -3.0).

  2. ROUND(column, digits): Rounds the value to a specified number of decimal places (digits). If digits is negative, it rounds to the left of the decimal point.

The return type is the same as the input column's type (INTEGER or REAL).

Return

A KQLiteColumn with the rounded value, preserving the input type.

Author

MOHAMMAD AZIM ANSARI

Parameters

column

The column containing the numeric value to be rounded.

digits

The number of digits to round to. If null (default), rounds to the nearest integer.

Type Parameters

T

The numeric type of the column.

See also