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

85 of 2,018 cases

Case Name Expected Note Size
001249 generated/0724 Generated 10000000000002992␊99999999999970320␊9.9999999999… Seeded random values: near threshold. 63 values
001252 generated/0727 Generated 1000000000000094␊0.0000010000000000000542␊999999… Seeded random values: near threshold. 6 values
001275 generated/0750 Generated 1.000000000000101e-7␊99999999999990200␊0.0000010… Seeded random values: near threshold. 47 values
001315 generated/0790 Generated 8.865397297812226e-288␊8.040527152632869e-24␊4.7… Seeded random values: 17 digits. 54 values
001328 generated/0803 Generated 1000000000000208.8␊10000000000002430␊1.000000000… Seeded random values: near threshold. 12 values
001342 generated/0817 Generated 9.999999999998415e-8␊10000000000002034␊999999999… Seeded random values: near threshold. 50 values
001352 generated/0827 Generated 99999999999985360␊9.999999999997809e-8␊0.0000010… Seeded random values: near threshold. 31 values
001365 generated/0840 Generated 0.0000010000000000002774␊9.999999999997736e-8␊1.… Seeded random values: near threshold. 24 values
001378 generated/0853 Generated 100000000000009710␊999999999999762400000␊1000000… Seeded random values: near threshold. 58 values
001436 generated/0913 Generated 9999999999996356␊0.0000010000000000002352␊9.9999… Seeded random values: near threshold. 59 values
001471 generated/0948 Generated 7.511391853533812e+88␊2.634893770394183e-246␊-3.… Seeded random values: any bits. 14 values
001499 generated/0976 Generated 999999999999834300000␊99999999999991300␊10000000… Seeded random values: near threshold. 13 values
001501 generated/0978 Generated 100000000000004080␊999999999999762.2␊0.000001000… Seeded random values: near threshold. 36 values
001579 generated/1057 Generated 0.000001000000000000067␊10000000000002148␊100000… Seeded random values: near threshold. 60 values
001602 generated/1080 Generated 1000000000000130.4␊0.0000010000000000000088␊0.00… Seeded random values: near threshold. 43 values
001623 generated/1101 Generated 9.999999999999208e-8␊1000000000000209.2␊ Seeded random values: near threshold. 2 values
001641 generated/1119 Generated 999999999999994.2␊1.0000000000000545e+21␊1000000… Seeded random values: near threshold. 44 values
001666 generated/1145 Generated 999999999999823.2␊999999999999959200000␊ Seeded random values: near threshold. 2 values
001675 generated/1154 Generated 999999999999789.2␊9.999999999997422e-7␊ Seeded random values: near threshold. 2 values
001685 generated/1164 Generated 1000000000000191.5␊9.999999999999652e-7␊0.000001… Seeded random values: near threshold. 29 values
001693 generated/1172 Generated 0.000001000000000000157␊9999999999998872␊9999999… Seeded random values: near threshold. 38 values
001717 generated/1196 Generated 9999999999996238␊9.999999999999053e-8␊9999999999… Seeded random values: near threshold. 24 values
001735 generated/1215 Generated 999999999999970.9␊999999999999999␊9.999999999999… Seeded random values: near threshold. 32 values
001755 generated/1235 Generated 1000000000000206.2␊ Seeded random values: near threshold. 1 value
001767 generated/1247 Generated 9999999999996544␊10000000000003758␊9999999999998… Seeded random values: near threshold. 50 values
001768 generated/1248 Generated 9.999999999999711e-8␊1.000000000000249e-7␊100000… Seeded random values: near threshold. 33 values
001775 generated/1255 Generated 999999999999920000000␊9.99999999999752e-7␊100000… Seeded random values: near threshold. 27 values
001777 generated/1257 Generated 1000000000000000.8␊100000000000031570␊ Seeded random values: near threshold. 2 values
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
001848 generated/1329 Generated 100000000000029700␊10000000000003914␊9.999999999… Seeded random values: near threshold. 11 values
001866 generated/1347 Generated 1.0000000000001981e-7␊9.999999999998145e-7␊0.000… Seeded random values: near threshold. 49 values
001892 generated/1373 Generated 0.000001000000000000061␊1000000000000117.8␊0.000… Seeded random values: near threshold. 4 values
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

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.