Skip to content

Commit 0e1ebd0

Browse files
authored
Warn about BigDecimal limitations (#130)
1 parent 20a60a0 commit 0e1ebd0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pages/en/developer/assemblyscript-api.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ import { BigDecimal } from '@graphprotocol/graph-ts'
9393

9494
`BigDecimal` is used to represent arbitrary precision decimals.
9595

96+
> Note: [Internally](https://github.com/graphprotocol/graph-node/blob/master/graph/src/data/store/scalar.rs) `BigDecimal` is stored in [IEEE-754 decimal128 floating-point format](https://en.wikipedia.org/wiki/Decimal128_floating-point_format), which supports 34 decimal digits of significand. This makes `BigDecimal` unsuitable for representing fixed-point types that can span wider than 34 digits, such as a Solidity [`ufixed256x18`](https://docs.soliditylang.org/en/latest/types.html#fixed-point-numbers) or equivalent.
97+
9698
_Construction_
9799

98100
- `constructor(bigInt: BigInt)` – creates a `BigDecimal` from an `BigInt`.

0 commit comments

Comments
 (0)