github RecoLabs/gnata v0.5.2

4 hours ago

Changes

Features

  • Opt-in exact decimal arithmetic: WithDecimalPrecision(digits) (17–100 significant digits). Number literals, arithmetic (fractional powers included), the range operator, comparisons, structural equality, in, sorting, $distinct, $string, & and the numeric builtins compute in decimal, rounded half to even — e.g. 0.1 + 0.2 = 0.3, uint256 values with 78 digits, and $formatNumber(1.015, '0.00') = "1.02". Results computed in decimal are json.Number. Default float64 behaviour is unchanged. Based on the proposal by @peterbroadhurst in #31. (#34)
    • The arithmetic comes from a vendored copy of cockroachdb/apd v3.2.3 (Apache-2.0) in internal/third_party/apd; no new module dependency.
    • Magnitudes stay within the float64 range, with overflow reported (D1001, or D3061 for $power) even where float64 would miss it after rounding.
    • A fractional power costs about 1 ms at 100 digits. The decimal support adds about 140 KB to a TinyGo WebAssembly build.

Fixes (#34)

  • $split / $match / $replace limits, the $flatten depth and compound path indexes accept json.Number arguments, which EvalBytes previously rejected with T0410.

  • npm: gnata-js@0.5.2

Don't miss a new gnata release

NewReleases is sending notifications on new releases.