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
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).
Insert data that has a decimal attribute
#!test[schema]
#{{
define
entity account, owns account-balance;
#}}
#!test[write]
insert
$a isa account, has account-balance 0.02dec;
Specify valid values for a decimal attribute type
#!test[schema]
define
attribute subscription-fee value decimal @values(4.99dec, 9.99dec, 19.99dec);
Specify valid values for owning a decimal attribute type
#!test[schema]
define
entity basic-plan owns subscription-fee @values(4.99dec, 9.99dec);
Specify range of valid values for a decimal attribute type
#!test[schema]
define
attribute interest-rate value decimal @range(0.0dec..25.0dec);