# Decimal

A fixed point signed decimal number with 64 bits to the left of the decimal point and 19 decimal digits of precision after the point.

## [](#_storage_representation)Storage representation

A decimal number is stored as a 64-bit signed integer part, and an unsigned 19-digit fractional part. As a consequence, the range of values for decimal is from −263 to 263 − 10−19 (inclusive).

## [](#_define_a_decimal_attribute_type)Define a decimal attribute type

```typeql
#!test[schema]
define
  attribute account-balance value decimal;
```

## [](#_insert_data_that_has_a_decimal_attribute)Insert data that has a decimal attribute

```typeql
#!test[schema]
#{{
define
  entity account, owns account-balance;
#}}
#!test[write]
insert
  $a isa account, has account-balance 0.02dec;
```

## [](#_insert_a_standalone_decimal_attribute)Insert a standalone decimal attribute

```typeql
#!test[write]
insert
  $_ isa account-balance 0.02dec;
```

## [](#_specify_valid_values_for_a_decimal_attribute_type)Specify valid values for a decimal attribute type

```typeql
#!test[schema]
define
  attribute subscription-fee value decimal @values(4.99dec, 9.99dec, 19.99dec);
```

## [](#_specify_valid_values_for_owning_a_decimal_attribute_type)Specify valid values for owning a decimal attribute type

```typeql
#!test[schema]
define
  entity basic-plan owns subscription-fee @values(4.99dec, 9.99dec);
```

## [](#_specify_range_of_valid_values_for_a_decimal_attribute_type)Specify range of valid values for a decimal attribute type

```typeql
#!test[schema]
define
  attribute interest-rate value decimal @range(0.0dec..25.0dec);
```

## [](#_specify_range_of_valid_values_for_owning_a_decimal_attribute_type)Specify range of valid values for owning a decimal attribute type

```typeql
#!test[schema]
define
  entity savings-account owns interest-rate @range(0.0dec..10.0dec);
```

## [](#_retrieve_data_by_decimal_attribute)Retrieve data by decimal attribute

```typeql
#!test[read]
match
  $a isa account, has account-balance 0.02dec;
```

[Double](../double/index.md) [String](../string/index.md)

[Edit on GitHub](https://github.com/typedb/typedb-docs/edit/3.x-development/typeql-reference/modules/ROOT/pages/value-types/decimal.adoc) Edit this page on GitHub.