Effect CommunityEC
Effect Community16mo ago
5 replies
Minh Nguyen

BigDecimal precision

From https://effect-ts.github.io/effect/effect/BigDecimal.ts.html

Internally, BigDecimal uses a BigInt object, paired with a 64-bit integer which determines the position of the decimal point. Therefore, the precision is not actually arbitrary, but limited to 2^63 decimal places.

But looking at the source code, I see a regular JavaScript number is used to represent scale, and as far as I understand, numbers in JS can only represent 53-bit integers (https://stackoverflow.com/a/24037917). Is this a documentation issue? Or is the intent to actually support up to 64 bits? In which case perhaps another BigInt could be used?
effect
An ecosystem of tools for building production-grade applications in TypeScript.
Was this page helpful?