Versions and security
jsonW 1.4.2: exact measures and money sums
One pound no longer becomes 0 kg. The measure column keeps the exact value, and calcular sums money in cents.
· jsonW 1.4.2
What was wrong
A medida[kg] column rounded the value to the whole unit. One pound became 0 kg, and ten pounds became 5 kg, with no warning.
What 1.4.2 changes
- The measure column keeps the exact value: 1 lb becomes 0.45359237 kg.
- Declare a scale when you want a fixed number of decimals:
medida[kg,3]rounds there, and 1 lb becomes 0.454 kg. - A unit with no exact scale is refused with the hint
a unidade m/s pede escala: medida[m/s,3]. calcular --valorsums money columns in whole cents, with no floating point, and only within one currency.
How it was measured
Real output of wjsw 1.4.2 on macOS arm64. The Linux binary gave the same output on Wortic's v3 server and passed the 37 permission-view checks.
$ wjsw de-texto 'id:i64,peso:medida[kg],preco:dinheiro' m.jsw.txt m.jsw
$ wjsw ver m.jsw
{id:1,peso:0.45359237 kg,preco:12.50 BRL}
{id:2,peso:0.90718474 kg,preco:0.25 BRL}
$ wjsw calcular m.jsw --valor preco
total: 2 linha(s) · soma 12.75 BRL · min 0.25 · max 12.5 · media 6.375
Compatibility
Files written with medida[kg] keep opening. Files written by 1.4.1 with the old rounding are not fixed by themselves: rewrite them from the source. A schema with a declared scale does not open in 1.4.1 readers.
Where to get it
Binaries for macOS, Linux and Windows are in the GitHub release notes. On npm, the package is @wortictecnologia/[email protected].