# Chalk SQL Reference: Numeric Functions
source: https://docs.chalk.ai/chalksql-docs#section-numeric-functions

## `abs(value)`
source: https://docs.chalk.ai/chalksql-docs#abs

Returns the absolute `value` of a number.

**Examples**

```sql
SELECT abs(-42);
```

```text
42
```

**Overloads**

#### `abs(value)`

**Parameters**

- `value`: `int64`
  The input `value`.

#### `abs(value)`

**Parameters**

- `value`: `double`
  The input `value`.

## `acos(x)`
source: https://docs.chalk.ai/chalksql-docs#acos

Calculates the inverse cosine in radians.

**Parameters**

- `x`: `double`
  The input value.

## `arccosh(x)`
source: https://docs.chalk.ai/chalksql-docs#arccosh

Calculates the inverse hyperbolic cosine.

**Parameters**

- `x`: `double`
  The input value.

## `arcsinh(x)`
source: https://docs.chalk.ai/chalksql-docs#arcsinh

Calculates the inverse hyperbolic sine.

**Parameters**

- `x`: `double`
  The input value.

## `arctanh(x)`
source: https://docs.chalk.ai/chalksql-docs#arctanh

Calculates the inverse hyperbolic tangent.

**Parameters**

- `x`: `double`
  The input value.

## `asin(x)`
source: https://docs.chalk.ai/chalksql-docs#asin

Calculates the inverse sine in radians.

**Parameters**

- `x`: `double`
  The input value.

## `atan(x)`
source: https://docs.chalk.ai/chalksql-docs#atan

Calculates the arctangent of a number in radians.

**Parameters**

- `x`: `double`
  The input value.

## `atan2(y, x)`
source: https://docs.chalk.ai/chalksql-docs#atan2

Calculates the arctangent of `y/x` in radians, handling quadrant correctly.

**Parameters**

- `y`: `double`
  The second input value.
- `x`: `double`
  The input value.

## `bankers_round(value, ...)`
source: https://docs.chalk.ai/chalksql-docs#bankers_round

Rounds a number using banker's rounding, optionally to a specified number of decimal places.

**Examples**

```sql
SELECT bankers_round(2.5);
```

```text
2.0
```

```sql
SELECT bankers_round(42.125, 2);
```

```text
42.12
```

**Overloads**

#### `bankers_round(value)`

Rounds a number using banker's rounding (round half to even).

**Parameters**

- `value`: `halffloat`
  The input `value`.

#### `bankers_round(value)`

Rounds a number using banker's rounding (round half to even).

**Parameters**

- `value`: `float`
  The input `value`.

#### `bankers_round(value)`

Rounds a number using banker's rounding (round half to even).

**Parameters**

- `value`: `double`
  The input `value`.

#### `bankers_round(value, decimals)`

Rounds a number to specified decimal places using banker's rounding (round half to even).

**Parameters**

- `value`: `halffloat`
  The input `value`.
- `decimals`: `int64`
  The number of decimal places to keep.

#### `bankers_round(value, decimals)`

Rounds a number to specified decimal places using banker's rounding (round half to even).

**Parameters**

- `value`: `float`
  The input `value`.
- `decimals`: `int64`
  The number of decimal places to keep.

#### `bankers_round(value, decimals)`

Rounds a number to specified decimal places using banker's rounding (round half to even).

**Parameters**

- `value`: `double`
  The input `value`.
- `decimals`: `int64`
  The number of decimal places to keep.

## `cbrt(x)`
source: https://docs.chalk.ai/chalksql-docs#cbrt

Calculates the cube root of a number.

**Examples**

```sql
SELECT cbrt(27);
```

```text
3.0
```

**Overloads**

#### `cbrt(x)`

Calculates the cube root of a number.

**Parameters**

- `x`: `double`
  The input value.

#### `cbrt(x)`

Calculates the cube root of an integer.

**Parameters**

- `x`: `int64`
  The input value.

## `ceil(value)`
source: https://docs.chalk.ai/chalksql-docs#ceil

Alias for [ceiling](https://docs.chalk.ai/chalksql-docs#ceiling).

**Examples**

```sql
SELECT ceil(42.1);
```

```text
43.0
```

## `ceiling(value)`
source: https://docs.chalk.ai/chalksql-docs#ceiling

Returns the smallest integer greater than or equal to the given number.

**Examples**

```sql
SELECT ceiling(42.1);
```

```text
43.0
```

**Overloads**

#### `ceiling(value)`

**Parameters**

- `value`: `halffloat`
  The input `value`.

#### `ceiling(value)`

**Parameters**

- `value`: `float`
  The input `value`.

#### `ceiling(value)`

**Parameters**

- `value`: `double`
  The input `value`.

## `clamp(value, low, high)`
source: https://docs.chalk.ai/chalksql-docs#clamp

Constrains a `value` to a minimum and maximum range.

**Examples**

```sql
SELECT clamp(12, 0, 10);
```

```text
10
```

**Overloads**

#### `clamp(value, low, high)`

Constrains a `value` between a minimum and maximum range.

**Parameters**

- `value`: `double`
  The input `value`.
- `low`: `double`
  The lower bound.
- `high`: `double`
  The upper bound.

#### `clamp(value, low, high)`

Constrains an integer `value` between a minimum and maximum range.

**Parameters**

- `value`: `int64`
  The input `value`.
- `low`: `int64`
  The lower bound.
- `high`: `int64`
  The upper bound.

## `cos(x)`
source: https://docs.chalk.ai/chalksql-docs#cos

Calculates the cosine of an angle in radians.

**Parameters**

- `x`: `double`
  The input value.

## `cosh(x)`
source: https://docs.chalk.ai/chalksql-docs#cosh

Calculates the hyperbolic cosine of a number.

**Parameters**

- `x`: `double`
  The input value.

## `cot(x)`
source: https://docs.chalk.ai/chalksql-docs#cot

Calculates the cotangent of an angle in radians.

**Parameters**

- `x`: `double`
  The input value.

## `degrees(radians)`
source: https://docs.chalk.ai/chalksql-docs#degrees

Converts `radians` to degrees.

**Parameters**

- `radians`: `double`
  The angle in `radians`.

**Examples**

```sql
SELECT degrees(pi());
```

```text
180.0
```

## `e()`
source: https://docs.chalk.ai/chalksql-docs#e

Returns the mathematical constant e (Euler's number).

**Parameters**

None

## `exp(x)`
source: https://docs.chalk.ai/chalksql-docs#exp

Calculates e raised to the power of a number.

**Parameters**

- `x`: `double`
  The input value.

## `floor(value)`
source: https://docs.chalk.ai/chalksql-docs#floor

Returns the largest integer less than or equal to the given number.

**Examples**

```sql
SELECT floor(42.9);
```

```text
42.0
```

**Overloads**

#### `floor(value)`

**Parameters**

- `value`: `halffloat`
  The input `value`.

#### `floor(value)`

**Parameters**

- `value`: `float`
  The input `value`.

#### `floor(value)`

**Parameters**

- `value`: `double`
  The input `value`.

## `is_finite(value)`
source: https://docs.chalk.ai/chalksql-docs#is_finite

Checks if a floating-point number is finite (not NaN or infinite).

**Parameters**

- `value`: `double`
  The input `value`.

## `is_infinite(value)`
source: https://docs.chalk.ai/chalksql-docs#is_infinite

Checks if a floating-point number is infinite.

**Parameters**

- `value`: `double`
  The input `value`.

## `is_nan(value)`
source: https://docs.chalk.ai/chalksql-docs#is_nan

Checks if a floating-point number is NaN (Not a Number).

**Parameters**

- `value`: `double`
  The input `value`.

## `ln(x)`
source: https://docs.chalk.ai/chalksql-docs#ln

Calculates the natural logarithm of a number.

**Parameters**

- `x`: `double`
  The input value.

## `log(...)`
source: https://docs.chalk.ai/chalksql-docs#log

Calculates the logarithm of a number with a specified or default `base`.

**Examples**

```sql
SELECT log(10, 100);
```

```text
2.0
```

**Overloads**

#### `log(base, value)`

Calculates the logarithm of x with the given `base`.

**Parameters**

- `base`: `double`
  The logarithm `base`.
- `value`: `double`
  The input `value`.

#### `log(x)`

Calculates the base-10 logarithm of a number.

**Parameters**

- `x`: `double`
  The input value.

## `log10(x)`
source: https://docs.chalk.ai/chalksql-docs#log10

Calculates the base-10 logarithm of a number.

**Parameters**

- `x`: `double`
  The input value.

## `log1p(x)`
source: https://docs.chalk.ai/chalksql-docs#log1p

Calculates the natural logarithm of (1 + `x`), accurate for small `x`.

**Parameters**

- `x`: `double`
  The input value.

## `log2(x)`
source: https://docs.chalk.ai/chalksql-docs#log2

Calculates the base-2 logarithm of a number.

**Parameters**

- `x`: `double`
  The input value.

## `nan()`
source: https://docs.chalk.ai/chalksql-docs#nan

Returns a floating point NaN (Not a Number) value.

**Parameters**

None

## `negate(value)`
source: https://docs.chalk.ai/chalksql-docs#negate

Returns the negative `value` of a number.

**Overloads**

#### `negate(value)`

**Parameters**

- `value`: `int64`
  The input `value`.

#### `negate(value)`

**Parameters**

- `value`: `double`
  The input `value`.

## `pi()`
source: https://docs.chalk.ai/chalksql-docs#pi

Returns the mathematical constant π (pi).

**Parameters**

None

## `pow(base, exponent)`
source: https://docs.chalk.ai/chalksql-docs#pow

Raises a number to the power of another number.

**Parameters**

- `base`: `double`
  The `base` value.
- `exponent`: `double`
  The `exponent` to raise the base to.

**Examples**

```sql
SELECT pow(2.0, 8.0);
```

```text
256.0
```

## `power(base, exponent)`
source: https://docs.chalk.ai/chalksql-docs#power

Raises the first number to the power of the second number.

**Parameters**

- `base`: `double`
  The `base` value.
- `exponent`: `double`
  The `exponent` to raise the base to.

**Examples**

```sql
SELECT power(2.0, 8.0);
```

```text
256.0
```

## `radians(degrees)`
source: https://docs.chalk.ai/chalksql-docs#radians

Converts `degrees` to radians.

**Parameters**

- `degrees`: `double`
  The angle in `degrees`.

**Examples**

```sql
SELECT radians(180.0);
```

```text
3.141592653589793
```

## `rand()`
source: https://docs.chalk.ai/chalksql-docs#rand

Generates a random float between 0 and 1.

**Parameters**

None

## `random(n)`
source: https://docs.chalk.ai/chalksql-docs#random

Generates a pseudo-random float or integer.

**Examples**

```sql
SELECT random();
```

```text
<random double in [0, 1)>
```

**Overloads**

#### `random()`

Generates a pseudo-random float between 0 and 1.

**Parameters**

None

#### `random(n)`

Generates a pseudo-random integer within the bounds of the specified type.

**Parameters**

- `n`: `int8`
  The exclusive upper bound for the generated value.

#### `random(n)`

Generates a pseudo-random integer within the bounds of the specified type.

**Parameters**

- `n`: `int16`
  The exclusive upper bound for the generated value.

#### `random(n)`

Generates a pseudo-random integer within the bounds of the specified type.

**Parameters**

- `n`: `int32`
  The exclusive upper bound for the generated value.

#### `random(n)`

Generates a pseudo-random integer within the bounds of the specified type.

**Parameters**

- `n`: `int64`
  The exclusive upper bound for the generated value.

## `round(value, ...)`
source: https://docs.chalk.ai/chalksql-docs#round

Rounds a floating point number, optionally to a specified number of decimal places.

**Examples**

```sql
SELECT round(42.5);
```

```text
43.0
```

```sql
SELECT round(42.125, 2);
```

```text
42.13
```

**Overloads**

#### `round(value)`

Rounds a floating point number to the nearest integer.

**Parameters**

- `value`: `halffloat`
  The input `value`.

#### `round(value)`

Rounds a floating point number to the nearest integer.

**Parameters**

- `value`: `float`
  The input `value`.

#### `round(value)`

Rounds a floating point number to the nearest integer.

**Parameters**

- `value`: `double`
  The input `value`.

#### `round(value, decimals)`

Rounds a floating point number to the specified number of decimal places.

**Parameters**

- `value`: `halffloat`
  The input `value`.
- `decimals`: `int64`
  The number of decimal places to keep.

#### `round(value, decimals)`

Rounds a floating point number to the specified number of decimal places.

**Parameters**

- `value`: `float`
  The input `value`.
- `decimals`: `int64`
  The number of decimal places to keep.

#### `round(value, decimals)`

Rounds a floating point number to the specified number of decimal places.

**Parameters**

- `value`: `double`
  The input `value`.
- `decimals`: `int64`
  The number of decimal places to keep.

## `round_sig_figs(value, digits)`
source: https://docs.chalk.ai/chalksql-docs#round_sig_figs

Rounds a number to n significant figures.

**Parameters**

- `value`: `double`
  The input `value`.
- `digits`: `int64`
  The number of significant `digits` to keep.

## `secure_random(lower, upper)`
source: https://docs.chalk.ai/chalksql-docs#secure_random

Generates a cryptographically secure random float or number.

**Overloads**

#### `secure_random()`

Generates a cryptographically secure random float between 0 and 1.

**Parameters**

None

#### `secure_random(lower, upper)`

Generates a cryptographically secure random number between the specified bounds.

**Parameters**

- `lower`: `int8`
- `upper`: `int8`

#### `secure_random(lower, upper)`

Generates a cryptographically secure random number between the specified bounds.

**Parameters**

- `lower`: `int16`
- `upper`: `int16`

#### `secure_random(lower, upper)`

Generates a cryptographically secure random number between the specified bounds.

**Parameters**

- `lower`: `int32`
- `upper`: `int32`

#### `secure_random(lower, upper)`

Generates a cryptographically secure random number between the specified bounds.

**Parameters**

- `lower`: `int64`
- `upper`: `int64`

#### `secure_random(lower, upper)`

Generates a cryptographically secure random number between the specified bounds.

**Parameters**

- `lower`: `float`
- `upper`: `float`

#### `secure_random(lower, upper)`

Generates a cryptographically secure random number between the specified bounds.

**Parameters**

- `lower`: `double`
- `upper`: `double`

## `sign(value)`
source: https://docs.chalk.ai/chalksql-docs#sign

Returns the sign of a number as -1, 0, or 1.

**Examples**

```sql
SELECT sign(-42);
```

```text
-1
```

**Overloads**

#### `sign(value)`

Returns the sign of a number (-1, 0, or 1).

**Parameters**

- `value`: `double`
  The input `value`.

#### `sign(value)`

Returns the sign of an integer (-1, 0, or 1).

**Parameters**

- `value`: `int64`
  The input `value`.

## `sin(x)`
source: https://docs.chalk.ai/chalksql-docs#sin

Calculates the sine of an angle in radians.

**Parameters**

- `x`: `double`
  The input value.

## `sqrt(x)`
source: https://docs.chalk.ai/chalksql-docs#sqrt

Calculates the square root of a number.

**Parameters**

- `x`: `double`
  The input value.

**Examples**

```sql
SELECT sqrt(144.0);
```

```text
12.0
```

## `tan(x)`
source: https://docs.chalk.ai/chalksql-docs#tan

Calculates the tangent of an angle in radians.

**Parameters**

- `x`: `double`
  The input value.

## `tanh(x)`
source: https://docs.chalk.ai/chalksql-docs#tanh

Calculates the hyperbolic tangent of a number.

**Parameters**

- `x`: `double`
  The input value.

## `trunc(value)`
source: https://docs.chalk.ai/chalksql-docs#trunc

Alias for [truncate](https://docs.chalk.ai/chalksql-docs#truncate).

## `truncate(value, ...)`
source: https://docs.chalk.ai/chalksql-docs#truncate

Truncates a floating-point number, optionally to a specified number of decimal places.

**Examples**

```sql
SELECT truncate(42.987);
```

```text
42.0
```

```sql
SELECT truncate(42.987, 2);
```

```text
42.98
```

**Overloads**

#### `truncate(value)`

Truncates a floating-point number to remove the decimal part.

**Parameters**

- `value`: `double`
  The input `value`.

#### `truncate(value, decimals)`

Truncates a floating-point number to have `n` digits after the decimal.

**Parameters**

- `value`: `double`
  The input `value`.
- `decimals`: `int32`
  The number of decimal places to keep.

## `%...`
source: https://docs.chalk.ai/chalksql-docs#%25

Returns the remainder after dividing the first value by the second.

**Examples**

```sql
SELECT 7 % 3;
```

```text
1
```

**Overloads**

#### `n % m`

Calculates the modulo (remainder) of two integers.

**Parameters**

- `n`: `int64`
  The dividend.
- `m`: `int64`
  The divisor.

#### `n % m`

Calculates the modulo (remainder) of two floating-point numbers.

**Parameters**

- `n`: `double`
  The dividend.
- `m`: `double`
  The divisor.

#### `x % y`

exact decimal modulo

**Parameters**

- `x`: `$Decimal`
  The input value.
- `y`: `$Decimal`
  The second input value.

#### `n % m`

Calculates the modulo (remainder) of two integers.

**Parameters**

- `n`: `int64`
  The dividend.
- `m`: `int64`
  The divisor.

#### `n % m`

Calculates the modulo (remainder) of two floating-point numbers.

**Parameters**

- `n`: `double`
  The dividend.
- `m`: `double`
  The divisor.

## `x * y`
source: https://docs.chalk.ai/chalksql-docs#%2A

Multiplies numeric values, or scales a duration by a numeric value.

**Examples**

```sql
SELECT 6 * 7;
```

```text
42
```

**Overloads**

#### `x * y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x * y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(3, 0)`
  The second input value.

#### `x * y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(3, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x * y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(5, 0)`
  The second input value.

#### `x * y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(5, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x * y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(10, 0)`
  The second input value.

#### `x * y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(10, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x * y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(19, 0)`
  The second input value.

#### `x * y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(19, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x * y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(3, 0)`
  The second input value.

#### `x * y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(3, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x * y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(5, 0)`
  The second input value.

#### `x * y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(5, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x * y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(10, 0)`
  The second input value.

#### `x * y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(10, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x * y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(20, 0)`
  The second input value.

#### `x * y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(20, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x * y`

basic binary * operation

**Parameters**

- `x`: `int8`
  The input value.
- `y`: `int8`
  The second input value.

#### `x * y`

basic binary * operation

**Parameters**

- `x`: `int16`
  The input value.
- `y`: `int16`
  The second input value.

#### `x * y`

basic binary * operation

**Parameters**

- `x`: `int32`
  The input value.
- `y`: `int32`
  The second input value.

#### `x * y`

basic binary * operation

**Parameters**

- `x`: `int64`
  The input value.
- `y`: `int64`
  The second input value.

#### `x * y`

basic binary * operation

**Parameters**

- `x`: `halffloat`
  The input value.
- `y`: `halffloat`
  The second input value.

#### `x * y`

basic binary * operation

**Parameters**

- `x`: `float`
  The input value.
- `y`: `float`
  The second input value.

#### `x * y`

basic binary * operation

**Parameters**

- `x`: `double`
  The input value.
- `y`: `double`
  The second input value.

#### `x * y`

num * duration multiplication

**Parameters**

- `x`: `int64`
  The input value.
- `y`: `duration[us]`
  The second input value.

#### `x * y`

num * duration multiplication

**Parameters**

- `x`: `duration[us]`
  The input value.
- `y`: `int64`
  The second input value.

#### `x * y`

num * duration multiplication

**Parameters**

- `x`: `double`
  The input value.
- `y`: `duration[us]`
  The second input value.

#### `x * y`

num * duration multiplication

**Parameters**

- `x`: `duration[us]`
  The input value.
- `y`: `double`
  The second input value.

#### `x * y`

num * month-day-nano interval multiplication

**Parameters**

- `x`: `int64`
  The input value.
- `y`: `month_day_nano_interval`
  The second input value.

#### `x * y`

num * month-day-nano interval multiplication

**Parameters**

- `x`: `month_day_nano_interval`
  The input value.
- `y`: `int64`
  The second input value.

## `x ** y`
source: https://docs.chalk.ai/chalksql-docs#%2A%2A

basic binary ** operation

**Parameters**

- `x`: `double`
  The input value.
- `y`: `double`
  The second input value.

## `x + y`
source: https://docs.chalk.ai/chalksql-docs#%2B

Adds numeric, temporal, or interval values.

**Examples**

```sql
SELECT 2 + 3;
```

```text
5
```

**Overloads**

#### `x + y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x + y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(3, 0)`
  The second input value.

#### `x + y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(3, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x + y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(5, 0)`
  The second input value.

#### `x + y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(5, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x + y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(10, 0)`
  The second input value.

#### `x + y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(10, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x + y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(19, 0)`
  The second input value.

#### `x + y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(19, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x + y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(3, 0)`
  The second input value.

#### `x + y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(3, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x + y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(5, 0)`
  The second input value.

#### `x + y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(5, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x + y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(10, 0)`
  The second input value.

#### `x + y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(10, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x + y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(20, 0)`
  The second input value.

#### `x + y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(20, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x + y`

number + number addition

**Parameters**

- `x`: `int8`
  The input value.
- `y`: `int8`
  The second input value.

#### `x + y`

number + number addition

**Parameters**

- `x`: `int16`
  The input value.
- `y`: `int16`
  The second input value.

#### `x + y`

number + number addition

**Parameters**

- `x`: `int32`
  The input value.
- `y`: `int32`
  The second input value.

#### `x + y`

number + number addition

**Parameters**

- `x`: `int64`
  The input value.
- `y`: `int64`
  The second input value.

#### `x + y`

number + number addition

**Parameters**

- `x`: `halffloat`
  The input value.
- `y`: `halffloat`
  The second input value.

#### `x + y`

number + number addition

**Parameters**

- `x`: `float`
  The input value.
- `y`: `float`
  The second input value.

#### `x + y`

number + number addition

**Parameters**

- `x`: `double`
  The input value.
- `y`: `double`
  The second input value.

#### `x + y`

number + number addition

**Parameters**

- `x`: `duration[us]`
  The input value.
- `y`: `duration[us]`
  The second input value.

#### `x + y`

time + duration addition

**Parameters**

- `x`: `timestamp[us, tz=UTC]`
  The input value.
- `y`: `duration[us]`
  The second input value.

#### `x + y`

time + duration addition

**Parameters**

- `x`: `duration[us]`
  The input value.
- `y`: `timestamp[us, tz=UTC]`
  The second input value.

#### `x + y`

string or binary concatenation

**Parameters**

- `x`: `binary`
  The input value.
- `y`: `binary`
  The second input value.

#### `x + y`

string or binary concatenation

**Parameters**

- `x`: `large_binary`
  The input value.
- `y`: `large_binary`
  The second input value.

#### `x + y`

interval + interval addition

**Parameters**

- `x`: `month_interval`
  The input value.
- `y`: `month_interval`
  The second input value.

#### `x + y`

month-day-nano interval + month-day-nano interval addition

**Parameters**

- `x`: `month_day_nano_interval`
  The input value.
- `y`: `month_day_nano_interval`
  The second input value.

#### `x + y`

timestamp + interval addition

**Parameters**

- `x`: `timestamp[us, tz=UTC]`
  The input value.
- `y`: `month_interval`
  The second input value.

#### `x + y`

interval + timestamp addition

**Parameters**

- `x`: `month_interval`
  The input value.
- `y`: `timestamp[us, tz=UTC]`
  The second input value.

#### `x + y`

timestamp + month-day-nano interval addition

**Parameters**

- `x`: `timestamp[us, tz=UTC]`
  The input value.
- `y`: `month_day_nano_interval`
  The second input value.

#### `x + y`

month-day-nano interval + timestamp addition

**Parameters**

- `x`: `month_day_nano_interval`
  The input value.
- `y`: `timestamp[us, tz=UTC]`
  The second input value.

#### `x + y`

time + duration addition

**Parameters**

- `x`: `time64[us]`
  The input value.
- `y`: `duration[us]`
  The second input value.

#### `x + y`

duration + time addition

**Parameters**

- `x`: `duration[us]`
  The input value.
- `y`: `time64[us]`
  The second input value.

#### `x + y`

date + month-day-nano interval addition

**Parameters**

- `x`: `date32[day]`
  The input value.
- `y`: `month_day_nano_interval`
  The second input value.

#### `x + y`

month-day-nano interval + date addition

**Parameters**

- `x`: `month_day_nano_interval`
  The input value.
- `y`: `date32[day]`
  The second input value.

#### `x + y`

date + month-day-nano interval addition

**Parameters**

- `x`: `date64[ms]`
  The input value.
- `y`: `month_day_nano_interval`
  The second input value.

#### `x + y`

month-day-nano interval + date addition

**Parameters**

- `x`: `month_day_nano_interval`
  The input value.
- `y`: `date64[ms]`
  The second input value.

## `x - y`
source: https://docs.chalk.ai/chalksql-docs#-

Subtracts numeric, temporal, or interval values.

**Examples**

```sql
SELECT 7 - 3;
```

```text
4
```

**Overloads**

#### `x - y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x - y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(3, 0)`
  The second input value.

#### `x - y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(3, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x - y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(5, 0)`
  The second input value.

#### `x - y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(5, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x - y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(10, 0)`
  The second input value.

#### `x - y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(10, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x - y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(19, 0)`
  The second input value.

#### `x - y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(19, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x - y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(3, 0)`
  The second input value.

#### `x - y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(3, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x - y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(5, 0)`
  The second input value.

#### `x - y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(5, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x - y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(10, 0)`
  The second input value.

#### `x - y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(10, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x - y`

exact decimal arithmetic

**Parameters**

- `x`: `$Decimal1`
  The input value.
- `y`: `decimal128(20, 0)`
  The second input value.

#### `x - y`

exact decimal arithmetic

**Parameters**

- `x`: `decimal128(20, 0)`
  The input value.
- `y`: `$Decimal2`
  The second input value.

#### `x - y`

time - duration subtraction

**Parameters**

- `x`: `timestamp[us, tz=UTC]`
  The input value.
- `y`: `duration[us]`
  The second input value.

#### `x - y`

basic binary - operation

**Parameters**

- `x`: `int8`
  The input value.
- `y`: `int8`
  The second input value.

#### `x - y`

basic binary - operation

**Parameters**

- `x`: `int16`
  The input value.
- `y`: `int16`
  The second input value.

#### `x - y`

basic binary - operation

**Parameters**

- `x`: `int32`
  The input value.
- `y`: `int32`
  The second input value.

#### `x - y`

basic binary - operation

**Parameters**

- `x`: `int64`
  The input value.
- `y`: `int64`
  The second input value.

#### `x - y`

basic binary - operation

**Parameters**

- `x`: `halffloat`
  The input value.
- `y`: `halffloat`
  The second input value.

#### `x - y`

basic binary - operation

**Parameters**

- `x`: `float`
  The input value.
- `y`: `float`
  The second input value.

#### `x - y`

basic binary - operation

**Parameters**

- `x`: `double`
  The input value.
- `y`: `double`
  The second input value.

#### `x - y`

basic binary - operation

**Parameters**

- `x`: `duration[us]`
  The input value.
- `y`: `duration[us]`
  The second input value.

#### `x - y`

date(time) subtraction

**Parameters**

- `x`: `date32[day]`
  The input value.
- `y`: `date32[day]`
  The second input value.

#### `x - y`

date(time) subtraction

**Parameters**

- `x`: `date64[ms]`
  The input value.
- `y`: `date64[ms]`
  The second input value.

#### `x - y`

date(time) subtraction

**Parameters**

- `x`: `timestamp[us, tz=UTC]`
  The input value.
- `y`: `timestamp[us, tz=UTC]`
  The second input value.

#### `x - y`

interval - interval subtraction

**Parameters**

- `x`: `month_interval`
  The input value.
- `y`: `month_interval`
  The second input value.

#### `x - y`

month-day-nano interval - month-day-nano interval subtraction

**Parameters**

- `x`: `month_day_nano_interval`
  The input value.
- `y`: `month_day_nano_interval`
  The second input value.

#### `x - y`

timestamp - interval subtraction

**Parameters**

- `x`: `timestamp[us, tz=UTC]`
  The input value.
- `y`: `month_interval`
  The second input value.

#### `x - y`

timestamp - month-day-nano interval subtraction

**Parameters**

- `x`: `timestamp[us, tz=UTC]`
  The input value.
- `y`: `month_day_nano_interval`
  The second input value.

#### `x - y`

time - duration subtraction

**Parameters**

- `x`: `time64[us]`
  The input value.
- `y`: `duration[us]`
  The second input value.

#### `x - y`

date - month-day-nano interval subtraction

**Parameters**

- `x`: `date32[day]`
  The input value.
- `y`: `month_day_nano_interval`
  The second input value.

#### `x - y`

date - month-day-nano interval subtraction

**Parameters**

- `x`: `date64[ms]`
  The input value.
- `y`: `month_day_nano_interval`
  The second input value.

## `-x`
source: https://docs.chalk.ai/chalksql-docs#unary-minus

Negates a numeric or interval `value`.

**Examples**

```sql
SELECT -42;
```

```text
-42
```

```sql
SELECT 7 - 3;
```

```text
4
```

**Overloads**

#### `-value`

Returns the negative `value` of a number.

**Parameters**

- `value`: `int64`
  The input `value`.

#### `-value`

Returns the negative `value` of a number.

**Parameters**

- `value`: `double`
  The input `value`.

#### `-x`

month-day-nano interval negation

**Parameters**

- `x`: `month_day_nano_interval`
  The input value.

## `x / y`
source: https://docs.chalk.ai/chalksql-docs#/

Divides numeric values, or divides a duration by a numeric value.

**Examples**

```sql
SELECT 7.0 / 2.0;
```

```text
3.5
```

**Overloads**

#### `x / y`

basic binary float / operation

**Parameters**

- `x`: `double`
  The input value.
- `y`: `double`
  The second input value.

#### `x / y`

duration / num division

**Parameters**

- `x`: `duration[us]`
  The input value.
- `y`: `int64`
  The second input value.

#### `x / y`

duration / num division

**Parameters**

- `x`: `duration[us]`
  The input value.
- `y`: `double`
  The second input value.

## `x // y`
source: https://docs.chalk.ai/chalksql-docs#//

floor division

**Overloads**

#### `x // y`

**Parameters**

- `x`: `int8`
  The input value.
- `y`: `int8`
  The second input value.

#### `x // y`

**Parameters**

- `x`: `int16`
  The input value.
- `y`: `int16`
  The second input value.

#### `x // y`

**Parameters**

- `x`: `int32`
  The input value.
- `y`: `int32`
  The second input value.

#### `x // y`

**Parameters**

- `x`: `int64`
  The input value.
- `y`: `int64`
  The second input value.

## `base ^ exponent`
source: https://docs.chalk.ai/chalksql-docs#%5E

Alias for [pow](https://docs.chalk.ai/chalksql-docs#pow).

**Examples**

```sql
SELECT pow(2.0, 8.0);
```

```text
256.0
```
