# dec

> **dec**(`value`): [`DecValue`](https://stage.docs.arkiv.network/typescript-sdk/api-reference/main/type-aliases/decvalue/)

Defined in: [src/attr/values.ts:226](https://github.com/Arkiv-Network/arkiv-sdk-js/blob/488e08c3687cc5cfaf5dd8ab0fe0f7fed40930bb/src/attr/values.ts#L226)

A signed fixed-point decimal with exactly 18 decimal places, indexed for equality and range
queries.

Pass fractional values as **strings**. A JavaScript number cannot represent most decimals
exactly, so accepting `dec(0.1 + 0.2)` would quietly store `0.30000000000000004`; requiring the
string keeps what you write and what is stored the same thing. Excess precision is likewise an
error rather than a rounding.

## Parameters

### value

A decimal string, or an integral `number` / `bigint`.

`string` | `number` | `bigint`

## Returns

[`DecValue`](https://stage.docs.arkiv.network/typescript-sdk/api-reference/main/type-aliases/decvalue/)

## Throws

If the value is malformed, has more than 18 fractional digits, or
falls outside the `int256` range.

## Example

```ts
dec("3.5")
dec("-0.000000000000000001")  // the smallest step
dec(5)                        // integers may be passed bare
```