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

213 of 2,018 cases

Case Name Expected Note Size
001894 generated/1375 Generated 7.291198213993778e-58␊8.815007766488357e-125␊-8.… Seeded random values: any bits. 14 values
001903 generated/1385 Generated 2.292812772485845e+39␊-8.0081412374876905e+208␊ Seeded random values: any bits. 2 values
001909 generated/1391 Generated 9.999999999998587e-7␊0.0000010000000000001924␊ Seeded random values: near threshold. 2 values
001928 generated/1410 Generated 8.451702349607962e-175␊-4.8130032560993286e-253␊ Seeded random values: any bits. 2 values
001958 generated/1440 Generated -3.444718453797659e-38␊9.912544183670245e+186␊-1… Seeded random values: any bits. 36 values
001960 generated/1442 Generated 100000000000029820␊999999999999826600000␊1.00000… Seeded random values: near threshold. 31 values
001966 generated/1448 Generated -4.257340709000144e+85␊1.3215931293888716e-156␊4… Seeded random values: any bits. 25 values
001969 generated/1451 Generated 9999999999999806␊0.0000010000000000000438␊9.9999… Seeded random values: near threshold. 36 values
001979 generated/1461 Generated 5.034260074152063e-132␊2.408370715731014e-265␊-2… Seeded random values: any bits. 44 values
001994 generated/1476 Generated 999999999999875.4␊10000000000001998␊999999999999… Seeded random values: near threshold. 30 values
001998 generated/1480 Generated -1.0717252023706555e+89␊-2.1414021374272817e+112… Seeded random values: any bits. 16 values
002005 generated/1487 Generated -2.1329942943648124e-235␊ Seeded random values: any bits. 1 value
002010 generated/1492 Generated -1.02110566411177e-258␊-1.6394666441616558e+195␊… Seeded random values: any bits. 7 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.