Skip to content

Add 32- and 64-bit decimal support.#33

Merged
jheer merged 3 commits intov2.0.0from
jh/decimals
Feb 28, 2025
Merged

Add 32- and 64-bit decimal support.#33
jheer merged 3 commits intov2.0.0from
jh/decimals

Conversation

@jheer
Copy link
Member

@jheer jheer commented Feb 27, 2025

  • Add 32- and 64-bit decimal support. 64-bit decimals reuse the mechanisms as 128- and 256-bit decimals, but with a smaller stride into a backing BigUint64Array. 32-bit decimals directly use a backing (signed) Int32Array instead.

Note: The useDecimalBigInt flag causes 32-bit decimals to be returned as number-valued integers instead of floating point values with fractional digits. While minimizing changes, this introduces a misnomer, as the results (in the 32-bit case) are not BigInt values. We could consider changing the option name (e.g., to useDecimalInt). However, this could be a breaking change so I'm going to consider it for a subsequent PR.

Close #32.

@jheer jheer changed the base branch from main to v2.0.0 February 28, 2025 23:14
@jheer jheer merged commit 08bc6de into v2.0.0 Feb 28, 2025
2 checks passed
@jheer jheer deleted the jh/decimals branch February 28, 2025 23:15
jheer added a commit that referenced this pull request Feb 28, 2025
* feat: Add 32- and 64-bit decimal support.

* fix: Fix docs link typo.

* feat: Support bigint inputs to decimal32 builder.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Decimal32 and Decimal64 types

2 participants