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

All 2,018 cases

Case Name Expected Note Size
000200 regression/layout/n=11 Focused regression 50000000000␊50000000000␊10000000000␊73000000000␊… Values 0.d… × 10^11, with 1, 2, 3 and 17 significant digits. 12 values
000201 regression/layout/n=12 Focused regression 700000000000␊900000000000␊300000000000␊410000000… Values 0.d… × 10^12, with 1, 2, 3 and 17 significant digits. 12 values
000202 regression/layout/n=13 Focused regression 5000000000000␊2000000000000␊7000000000000␊720000… Values 0.d… × 10^13, with 1, 2, 3 and 17 significant digits. 12 values
000203 regression/layout/n=14 Focused regression 40000000000000␊10000000000000␊60000000000000␊190… Values 0.d… × 10^14, with 1, 2, 3 and 17 significant digits. 12 values
000204 regression/layout/n=15 Focused regression 300000000000000␊400000000000000␊300000000000000␊… Values 0.d… × 10^15, with 1, 2, 3 and 17 significant digits. 12 values
000205 regression/layout/n=16 Focused regression 7000000000000000␊7000000000000000␊80000000000000… Values 0.d… × 10^16, with 1, 2, 3 and 17 significant digits. 12 values
000206 regression/layout/n=17 Focused regression 70000000000000000␊10000000000000000␊600000000000… Values 0.d… × 10^17, with 1, 2, 3 and 17 significant digits. 12 values
000207 regression/layout/n=18 Focused regression 900000000000000000␊800000000000000000␊1000000000… Values 0.d… × 10^18, with 1, 2, 3 and 17 significant digits. 12 values
000208 regression/layout/n=19 Focused regression 2000000000000000000␊6000000000000000000␊20000000… Values 0.d… × 10^19, with 1, 2, 3 and 17 significant digits. 12 values
000209 regression/layout/n=20 Focused regression 80000000000000000000␊30000000000000000000␊400000… Values 0.d… × 10^20, with 1, 2, 3 and 17 significant digits. 12 values
000210 regression/layout/n=21 Focused regression 900000000000000000000␊700000000000000000000␊4000… Values 0.d… × 10^21, with 1, 2, 3 and 17 significant digits. 12 values
000211 regression/layout/n=22 Focused regression 5e+21␊2e+21␊8e+21␊3.9e+21␊2.6e+21␊4.1e+21␊6.45e+… Values 0.d… × 10^22, with 1, 2, 3 and 17 significant digits. 12 values
000212 regression/layout/n=23 Focused regression 1e+22␊4e+22␊9e+22␊7.6e+22␊6.9e+22␊4.1e+22␊1.12e+… Values 0.d… × 10^23, with 1, 2, 3 and 17 significant digits. 12 values
000213 regression/layout/n=24 Focused regression 9e+23␊9e+23␊7e+23␊4.5e+23␊8.6e+23␊2.4e+23␊9.32e+… Values 0.d… × 10^24, with 1, 2, 3 and 17 significant digits. 12 values
000214 regression/largest subnormal Focused regression 2.225073858507201e-308␊ 1 value
000215 regression/twice the smallest Focused regression 1e-323␊ 1 value
000216 regression/thrice the smallest Focused regression 1.5e-323␊ 1 value
000217 regression/negative largest subnormal Focused regression -2.225073858507201e-308␊ 1 value
000218 regression/subnormal/the first 256 Focused regression 5e-324␊1e-323␊1.5e-323␊2e-323␊2.5e-323␊3e-323␊3.… The 256 smallest subnormals: very few digits, and several of them round back, so the closest must win. 256 values
000219 regression/integer/0 to 1023 Focused regression 0␊1␊2␊3␊4␊5␊6␊7␊8␊9␊10␊11␊12␊13␊14␊15␊16␊17␊18␊1… 1,024 values
000220 regression/integer/around 2^53 Focused regression 9007199254740928␊9007199254740929␊90071992547409… Every double from 2^53 − 64 to 2^53 + 128: past 2^53 only even integers exist. 129 values
000221 regression/integer/powers of ten Focused regression 1␊10␊100␊1000␊10000␊100000␊1000000␊10000000␊1000… 10^0 to 10^22, all exact in binary. 23 values
000222 regression/integer/2^31 2^32 2^63 2^64 Focused regression 2147483647␊2147483648␊4294967295␊4294967296␊9223… 6 values
000223 regression/power of two/2^-1074 to 2^-1011 Focused regression 5e-324␊1e-323␊2e-323␊4e-323␊8e-323␊1.6e-322␊3.16… Powers of two, where the gap to the next double down is half the gap up. 64 values
000224 regression/power of two/2^-1010 to 2^-947 Focused regression 9.113902524445497e-305␊1.8227805048890994e-304␊3… Powers of two, where the gap to the next double down is half the gap up. 64 values
000225 regression/power of two/2^-946 to 2^-883 Focused regression 1.681218273811815e-285␊3.36243654762363e-285␊6.7… Powers of two, where the gap to the next double down is half the gap up. 64 values
000226 regression/power of two/2^-882 to 2^-819 Focused regression 3.10130032290503e-266␊6.20260064581006e-266␊1.24… Powers of two, where the gap to the next double down is half the gap up. 64 values
000227 regression/power of two/2^-818 to 2^-755 Focused regression 5.720889335234188e-247␊1.1441778670468376e-246␊2… Powers of two, where the gap to the next double down is half the gap up. 64 values
000228 regression/power of two/2^-754 to 2^-691 Focused regression 1.0553178144107943e-227␊2.1106356288215886e-227␊… Powers of two, where the gap to the next double down is half the gap up. 64 values
000229 regression/power of two/2^-690 to 2^-627 Focused regression 1.9467177638862437e-208␊3.8934355277724873e-208␊… Powers of two, where the gap to the next double down is half the gap up. 64 values
000230 regression/power of two/2^-626 to 2^-563 Focused regression 3.5910604374153675e-189␊7.182120874830735e-189␊1… Powers of two, where the gap to the next double down is half the gap up. 64 values
000231 regression/power of two/2^-562 to 2^-499 Focused regression 6.624337284222476e-170␊1.3248674568444952e-169␊2… Powers of two, where the gap to the next double down is half the gap up. 64 values
000232 regression/power of two/2^-498 to 2^-435 Focused regression 1.221974545399842e-150␊2.443949090799684e-150␊4.… Powers of two, where the gap to the next double down is half the gap up. 64 values
000233 regression/power of two/2^-434 to 2^-371 Focused regression 2.2541451703578456e-131␊4.5082903407156913e-131␊… Powers of two, where the gap to the next double down is half the gap up. 64 values
000234 regression/power of two/2^-370 to 2^-307 Focused regression 4.15816390625796e-112␊8.31632781251592e-112␊1.66… Powers of two, where the gap to the next double down is half the gap up. 64 values
000235 regression/power of two/2^-306 to 2^-243 Focused regression 7.670458539527698e-93␊1.5340917079055395e-92␊3.0… Powers of two, where the gap to the next double down is half the gap up. 64 values
000236 regression/power of two/2^-242 to 2^-179 Focused regression 1.4149498560666738e-73␊2.8298997121333476e-73␊5.… Powers of two, where the gap to the next double down is half the gap up. 64 values
000237 regression/power of two/2^-178 to 2^-115 Focused regression 2.61012178719941e-54␊5.22024357439882e-54␊1.0440… Powers of two, where the gap to the next double down is half the gap up. 64 values
000238 regression/power of two/2^-114 to 2^-51 Focused regression 4.81482486096809e-35␊9.62964972193618e-35␊1.9259… Powers of two, where the gap to the next double down is half the gap up. 64 values
000239 regression/power of two/2^-50 to 2^13 Focused regression 8.881784197001252e-16␊1.7763568394002505e-15␊3.5… Powers of two, where the gap to the next double down is half the gap up. 64 values
000240 regression/power of two/2^14 to 2^77 Focused regression 16384␊32768␊65536␊131072␊262144␊524288␊1048576␊2… Powers of two, where the gap to the next double down is half the gap up. 64 values
000241 regression/power of two/2^78 to 2^141 Focused regression 3.022314549036573e+23␊6.044629098073146e+23␊1.20… Powers of two, where the gap to the next double down is half the gap up. 64 values
000242 regression/power of two/2^142 to 2^205 Focused regression 5.575186299632656e+42␊1.1150372599265312e+43␊2.2… Powers of two, where the gap to the next double down is half the gap up. 64 values
000243 regression/power of two/2^206 to 2^269 Focused regression 1.0284403483257538e+62␊2.0568806966515076e+62␊4.… Powers of two, where the gap to the next double down is half the gap up. 64 values
000244 regression/power of two/2^270 to 2^333 Focused regression 1.8971375900641885e+81␊3.794275180128377e+81␊7.5… Powers of two, where the gap to the next double down is half the gap up. 64 values
000245 regression/power of two/2^334 to 2^397 Focused regression 3.499601159652819e+100␊6.999202319305638e+100␊1.… Powers of two, where the gap to the next double down is half the gap up. 64 values
000246 regression/power of two/2^398 to 2^461 Focused regression 6.455624695217272e+119␊1.2911249390434543e+120␊2… Powers of two, where the gap to the next double down is half the gap up. 64 values
000247 regression/power of two/2^462 to 2^525 Focused regression 1.1908525658859223e+139␊2.3817051317718447e+139␊… Powers of two, where the gap to the next double down is half the gap up. 64 values
000248 regression/power of two/2^526 to 2^589 Focused regression 2.196735251241795e+158␊4.39347050248359e+158␊8.7… Powers of two, where the gap to the next double down is half the gap up. 64 values
000249 regression/power of two/2^590 to 2^653 Focused regression 4.052261297735345e+177␊8.10452259547069e+177␊1.6… Powers of two, where the gap to the next double down is half the gap up. 64 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.