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
001190 generated/0664 Generated 10000000000003690␊9999999999999290␊ Seeded random values: near threshold. 2 values
001192 generated/0666 Generated 1.0000000000000615e+21␊999999999999772.1␊1.00000… Seeded random values: near threshold. 35 values
001196 generated/0670 Generated 10000000000001816␊ Seeded random values: near threshold. 1 value
001201 generated/0675 Generated 999999999999941.1␊9.999999999999417e-7␊9.9999999… Seeded random values: near threshold. 8 values
001202 generated/0676 Generated 999999999999746400000␊1.0000000000001426e-7␊ Seeded random values: near threshold. 2 values
001203 generated/0677 Generated 99999999999979660␊100000000000016100␊ Seeded random values: near threshold. 2 values
001222 generated/0696 Generated 1.0000000000001469e+21␊999999999999753800000␊1.0… Seeded random values: near threshold. 28 values
001224 generated/0698 Generated 9999999999997516␊ Seeded random values: near threshold. 1 value
001231 generated/0706 Generated 1.0000000000002344e+21␊9999999999996140␊9.999999… Seeded random values: near threshold. 6 values
001233 generated/0708 Generated 100000000000015520␊ Seeded random values: near threshold. 1 value
001241 generated/0716 Generated 1.0000000000000088e+21␊ Seeded random values: near threshold. 1 value
001243 generated/0718 Generated 99999999999979580␊ Seeded random values: near threshold. 1 value
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
001266 generated/0741 Generated 9.999999999997637e-8␊1000000000000230.5␊99999999… Seeded random values: near threshold. 8 values
001272 generated/0747 Generated 999999999999863.5␊ Seeded random values: near threshold. 1 value
001275 generated/0750 Generated 1.000000000000101e-7␊99999999999990200␊0.0000010… Seeded random values: near threshold. 47 values
001278 generated/0753 Generated 100000000000024690␊ Seeded random values: near threshold. 1 value
001283 generated/0758 Generated 9.999999999999164e-8␊9999999999998126␊ Seeded random values: near threshold. 2 values
001294 generated/0769 Generated 9.99999999999859e-7␊ Seeded random values: near threshold. 1 value
001297 generated/0772 Generated 999999999999751100000␊99999999999973540␊99999999… Seeded random values: near threshold. 6 values
001309 generated/0784 Generated 999999999999815700000␊ Seeded random values: near threshold. 1 value
001312 generated/0787 Generated 1000000000000199␊ Seeded random values: near threshold. 1 value
001319 generated/0794 Generated 9999999999998996␊ Seeded random values: near threshold. 1 value
001321 generated/0796 Generated 1000000000000125.6␊ Seeded random values: near threshold. 1 value
001327 generated/0802 Generated 99999999999979840␊ Seeded random values: near threshold. 1 value
001328 generated/0803 Generated 1000000000000208.8␊10000000000002430␊1.000000000… Seeded random values: near threshold. 12 values
001334 generated/0809 Generated 0.0000010000000000000133␊ Seeded random values: near threshold. 1 value
001340 generated/0815 Generated 1.0000000000001676e+21␊10000000000001200␊ Seeded random values: near threshold. 2 values
001342 generated/0817 Generated 9.999999999998415e-8␊10000000000002034␊999999999… Seeded random values: near threshold. 50 values
001348 generated/0823 Generated 999999999999979.5␊10000000000002236␊ Seeded random values: near threshold. 2 values
001351 generated/0826 Generated 99999999999977740␊0.0000010000000000002437␊ Seeded random values: near threshold. 2 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
001369 generated/0844 Generated 9.999999999999555e-8␊999999999999838.6␊999999999… Seeded random values: near threshold. 7 values
001377 generated/0852 Generated 10000000000001950␊1.0000000000001041e+21␊ Seeded random values: near threshold. 2 values
001378 generated/0853 Generated 100000000000009710␊999999999999762400000␊1000000… Seeded random values: near threshold. 58 values
001383 generated/0858 Generated 0.0000010000000000000654␊100000000000013060␊1000… Seeded random values: near threshold. 35 values
001387 generated/0862 Generated 1.000000000000262e+21␊999999999999829700000␊9999… Seeded random values: near threshold. 6 values
001390 generated/0865 Generated 1.0000000000001032e-7␊1000000000000150.6␊ Seeded random values: near threshold. 2 values
001391 generated/0866 Generated 100000000000001440␊9.999999999997867e-8␊1.000000… Seeded random values: near threshold. 6 values
001395 generated/0871 Generated 1.000000000000136e+21␊ Seeded random values: near threshold. 1 value
001401 generated/0878 Generated 0.0000010000000000001736␊0.000001000000000000265… Seeded random values: near threshold. 3 values
001404 generated/0881 Generated 10000000000002062␊10000000000000092␊ Seeded random values: near threshold. 2 values
001414 generated/0891 Generated 99999999999986140␊ Seeded random values: near threshold. 1 value
001415 generated/0892 Generated 100000000000006900␊999999999999870200000␊ Seeded random values: near threshold. 2 values
001421 generated/0898 Generated 99999999999993340␊ Seeded random values: near threshold. 1 value
001429 generated/0906 Generated 9999999999998196␊ Seeded random values: near threshold. 1 value
001436 generated/0913 Generated 9999999999996356␊0.0000010000000000002352␊9.9999… Seeded random values: near threshold. 59 values
001437 generated/0914 Generated 999999999999779400000␊ Seeded random values: near threshold. 1 value

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.