Numeric Types

It’s possible to explicitly cast between all numeric types. All numeric types can also be cast to and from str and json.

type int16

A 16-bit signed integer.

An integer value in range from -32768 to +32767 (inclusive).

type int32

A 32-bit signed integer.

An integer value in range from -2147483648 to +2147483647 (inclusive).

type int64

A 64-bit signed integer.

An integer value in range from -9223372036854775808 to +9223372036854775807 (inclusive).

type float32

A variable precision, inexact number.

Minimal guaranteed precision is at least 6 decimal digits. The approximate range of a float32 is -3.4e+38 to +3.4e+38.

type float64

A variable precision, inexact number.

Minimal guaranteed precision is at least 15 decimal digits. The approximate range of a float32 is -1.7e+308 to +1.7e+308.

type decimal

Any number of arbitrary precision.

The EdgeDB philosophy is that using decimal type should be an explicit opt-in, but once used, the values should not be accidentally cast into a numeric type with less precision.

In accordance with this the mathematical functions are designed to keep the separation between decimal values and the rest of the numeric types.

All of the following types can be explicitly cast into decimal: str, json, int16, int32, int64, float32, and float64.

A decimal type has it’s own literal:

db> 
SELECT 42n IS decimal;
{true}
db> 
SELECT 1.23n IS decimal;
{true}
type sequence

Auto-incrementing sequence of int64.