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 arejson.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.
- The arithmetic comes from a vendored copy of cockroachdb/apd v3.2.3 (Apache-2.0) in
Fixes (#34)
-
$split/$match/$replacelimits, the$flattendepth and compound path indexes acceptjson.Numberarguments, whichEvalBytespreviously rejected with T0410. -
npm:
gnata-js@0.5.2