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

234 of 2,018 cases

Case Name Expected Note Size
001789 generated/1269 Generated 100000000000010800␊9.999999999999457e-8␊99999999… Seeded random values: near threshold. 30 values
001812 generated/1292 Generated 999999999999813.4␊999999999999882␊0.000001000000… Seeded random values: near threshold. 32 values
001813 generated/1293 Generated 1000000000000094.4␊ Seeded random values: near threshold. 1 value
001814 generated/1294 Generated 10000000000003886␊ Seeded random values: near threshold. 1 value
001825 generated/1305 Generated 999999999999925600000␊99999999999971870␊9.999999… Seeded random values: near threshold. 25 values
001832 generated/1312 Generated 9.999999999996656e-7␊9.999999999999682e-8␊1.0000… Seeded random values: near threshold. 9 values
001838 generated/1319 Generated 1.0000000000000101e+21␊1.0000000000000108e-7␊9.9… Seeded random values: near threshold. 13 values
001845 generated/1326 Generated 1000000000000097␊9.999999999997742e-7␊9.99999999… Seeded random values: near threshold. 52 values
001848 generated/1329 Generated 100000000000029700␊10000000000003914␊9.999999999… Seeded random values: near threshold. 11 values
001851 generated/1332 Generated 10000000000003110␊ Seeded random values: near threshold. 1 value
001856 generated/1337 Generated 1000000000000127.1␊9.999999999996565e-7␊ Seeded random values: near threshold. 2 values
001863 generated/1344 Generated 100000000000009950␊ Seeded random values: near threshold. 1 value
001866 generated/1347 Generated 1.0000000000001981e-7␊9.999999999998145e-7␊0.000… Seeded random values: near threshold. 49 values
001874 generated/1355 Generated 1.0000000000000321e+21␊ Seeded random values: near threshold. 1 value
001890 generated/1371 Generated 999999999999798.9␊ Seeded random values: near threshold. 1 value
001892 generated/1373 Generated 0.000001000000000000061␊1000000000000117.8␊0.000… Seeded random values: near threshold. 4 values
001895 generated/1376 Generated 9.999999999996889e-7␊999999999999801␊ Seeded random values: near threshold. 2 values
001909 generated/1391 Generated 9.999999999998587e-7␊0.0000010000000000001924␊ Seeded random values: near threshold. 2 values
001913 generated/1395 Generated 9999999999996066␊9.999999999999112e-7␊ Seeded random values: near threshold. 2 values
001923 generated/1405 Generated 10000000000000312␊999999999999857800000␊ Seeded random values: near threshold. 2 values
001939 generated/1421 Generated 9999999999998798␊ Seeded random values: near threshold. 1 value
001942 generated/1424 Generated 99999999999984060␊ Seeded random values: near threshold. 1 value
001949 generated/1431 Generated 100000000000008910␊ Seeded random values: near threshold. 1 value
001957 generated/1439 Generated 9.999999999999572e-8␊999999999999854600000␊1.000… Seeded random values: near threshold. 22 values
001960 generated/1442 Generated 100000000000029820␊999999999999826600000␊1.00000… Seeded random values: near threshold. 31 values
001965 generated/1447 Generated 9.99999999999804e-7␊ Seeded random values: near threshold. 1 value
001968 generated/1450 Generated 10000000000001712␊9.999999999999669e-8␊ Seeded random values: near threshold. 2 values
001969 generated/1451 Generated 9999999999999806␊0.0000010000000000000438␊9.9999… Seeded random values: near threshold. 36 values
001970 generated/1452 Generated 0.000001000000000000277␊999999999999881800000␊10… Seeded random values: near threshold. 8 values
001978 generated/1460 Generated 99999999999971120␊ Seeded random values: near threshold. 1 value
001994 generated/1476 Generated 999999999999875.4␊10000000000001998␊999999999999… Seeded random values: near threshold. 30 values
002000 generated/1482 Generated 1.0000000000002465e-7␊ Seeded random values: near threshold. 1 value
002007 generated/1489 Generated 1.0000000000002523e-7␊999999999999931600000␊ Seeded random values: near threshold. 2 values
002013 generated/1495 Generated 9.99999999999701e-7␊1000000000000160.9␊9.9999999… Seeded random values: near threshold. 3 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.