Compliance cases

These are the 2,018 inputs a submission must format. Each output must match the expected text byte for byte. You can run the suite without reading it, or open any case to see its input and expected output.

The shortest decimal digits that round back to the value, the closest of them when several do, and the even one of an exact tie, laid out as ECMA-262 says: plain notation from 1e-6 up to 1e21, exponent notation such as 1e+21 and 1e-7 outside it. This is Ryū, Grisu, Schubfach or Dragonbox territory. The compliance suite has 59,086 values: every sample in RFC 8785 Appendix B, every value in Ryū's tests, 20,000 of the doubles in Gay's shortest-digit table, every power of two, the doubles at and around every power of ten, both ends of every binary exponent, every layout from n = -9 to 24, hundreds of exact ties, hundreds of values beside a decimal exactly halfway between two doubles, subnormals, and seeded random values. Exact rational arithmetic, Python's repr and V8 agree on every answer.

Run the full compliance suite locally. Replace your-component.wasm with your compiled component. Download the suite

curl -fLo format_f64_rfc8785.comply.wasm https://calculated.world/comply/format_f64_rfc8785.wasm
npx qipok your-component.wasm --suite format_f64_rfc8785.comply.wasm
Clear

223 of 2,018 cases

Case Name Expected Note Size
001876 generated/1357 Generated 0.06␊ Seeded random values: short decimal. 1 value
001886 generated/1367 Generated 9960000␊-344000000000␊660000␊0.0000015009␊0.0006… Seeded random values: short decimal. 15 values
001896 generated/1377 Generated 1780600␊0.000009759992␊35100␊0.54␊0.000087517␊0␊… Seeded random values: short decimal. 14 values
001898 generated/1379 Generated 7e-8␊ Seeded random values: short decimal. 1 value
001922 generated/1404 Generated -368260000000000␊0.000022␊ Seeded random values: short decimal. 2 values
001929 generated/1411 Generated 0.000007␊-0.432␊3017820000000␊-61674␊81622000000… Seeded random values: short decimal. 42 values
001935 generated/1417 Generated -1.83e-10␊-46272200␊0.0000839039␊734643.8␊470000… Seeded random values: short decimal. 59 values
001937 generated/1419 Generated 7.3759␊ Seeded random values: short decimal. 1 value
001938 generated/1420 Generated 0.04523164␊-513810␊0.0004232359␊-0.000075537␊590… Seeded random values: short decimal. 5 values
001951 generated/1433 Generated 0.00228␊ Seeded random values: short decimal. 1 value
001953 generated/1435 Generated 947114000000␊ Seeded random values: short decimal. 1 value
001954 generated/1436 Generated -2e-7␊ Seeded random values: short decimal. 1 value
001977 generated/1459 Generated 0.005139␊-18949000␊0␊20000␊71.48␊16␊70810000␊0␊7… Seeded random values: short decimal. 16 values
001982 generated/1464 Generated 0.004␊0.00008591354␊ Seeded random values: short decimal. 2 values
001986 generated/1468 Generated 0.0801␊9.3e-8␊554959000000000␊23␊7135000␊7021628… Seeded random values: short decimal. 45 values
001989 generated/1471 Generated 913.3932␊760000000␊-2680000␊452000000␊0.05779222… Seeded random values: short decimal. 15 values
001992 generated/1474 Generated 8e-7␊9.9096e-7␊0.00546575␊4409630000000000␊31930… Seeded random values: short decimal. 6 values
001996 generated/1478 Generated -3000000␊ Seeded random values: short decimal. 1 value
002002 generated/1484 Generated 5.942␊9.3e-11␊ Seeded random values: short decimal. 2 values
002008 generated/1490 Generated 446584100000000000␊ Seeded random values: short decimal. 1 value
002012 generated/1494 Generated 7.165␊ Seeded random values: short decimal. 1 value
002014 generated/1496 Generated 94848060000000000␊0.0025801␊-0.003585706␊9417460… Seeded random values: short decimal. 7 values
002016 generated/1498 Generated -50␊39␊ Seeded random values: short decimal. 2 values

Where these rules come from

RFC 8785 §3.2.2.3 serializes every JSON number as ECMAScript does, by ECMA-262’s Number::toString : the shortest digits that round back, the closest of those, and the even one of an exact tie, laid out in plain or exponent notation by the decimal exponent. Every answer is agreed by exact rational arithmetic and Python’s repr; the suite’s own tests add V8’s Number.prototype.toString and JSON.stringify, and the app’s tests add Erlang’s shortest formatting. Of the 59,086 values, 521 are ties.