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

312 of 2,018 cases

Case Name Expected Note Size
000024 rfc8785/all samples RFC 8785 Appendix B 0␊0␊5e-324␊-5e-324␊1.7976931348623157e+308␊-1.79… Every finite sample of RFC 8785 Appendix B, in the table's order. 24 values
000027 ryu/Basic/all Ryū’s tests 0␊0␊1␊-1␊ Every finite value of Ryū's d2s test Basic, in order. 4 values
000029 ryu/MinAndMax/all Ryū’s tests 1.7976931348623157e+308␊5e-324␊ Every finite value of Ryū's d2s test MinAndMax, in order. 2 values
000039 ryu/Regression/all Ryū’s tests -21098088986959630␊4.940656e-318␊1.18575755e-316… Every finite value of Ryū's d2s test Regression, in order. 8 values
000043 ryu/LooksLikePow5/all Ryū’s tests 5.764607523034235e+39␊1.152921504606847e+40␊2.30… Every finite value of Ryū's d2s test LooksLikePow5, in order. 3 values
000064 ryu/OutputLength/all Ryū’s tests 1␊1.2␊1.23␊1.234␊1.2345␊1.23456␊1.234567␊1.23456… Every finite value of Ryū's d2s test OutputLength, in order. 22 values
000074 ryu/MinMaxShift/all Ryū’s tests 1.7800590868057611e-307␊2.8480945388892175e-306␊… Every finite value of Ryū's d2s test MinMaxShift, in order. 9 values
000150 ryu/SmallIntegers/all Ryū’s tests 9007199254740991␊9007199254740992␊1␊12␊123␊1234␊… Every finite value of Ryū's d2s test SmallIntegers, in order. 79 values
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
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
000250 regression/power of two/2^654 to 2^717 Focused regression 7.475102707912205e+196␊1.495020541582441e+197␊2.… Powers of two, where the gap to the next double down is half the gap up. 64 values
000251 regression/power of two/2^718 to 2^781 Focused regression 1.3789130657754968e+216␊2.7578261315509936e+216␊… Powers of two, where the gap to the next double down is half the gap up. 64 values
000252 regression/power of two/2^782 to 2^845 Focused regression 2.5436456424254815e+235␊5.087291284850963e+235␊1… Powers of two, where the gap to the next double down is half the gap up. 64 values
000253 regression/power of two/2^846 to 2^909 Focused regression 4.692198018002938e+254␊9.384396036005875e+254␊1.… Powers of two, where the gap to the next double down is half the gap up. 64 values
000254 regression/power of two/2^910 to 2^973 Focused regression 8.65557759812674e+273␊1.731115519625348e+274␊3.4… Powers of two, where the gap to the next double down is half the gap up. 64 values
000255 regression/power of two/2^974 to 2^1023 Focused regression 1.596672247627776e+293␊3.193344495255552e+293␊6.… Powers of two, where the gap to the next double down is half the gap up. 50 values
000256 regression/power of two/negative Focused regression -5e-324␊-6.4758e-319␊-8.487983164e-314␊-1.112536… 124 values
000257 regression/power of ten/1e-323 to 1e-292 Focused regression 5e-324␊1e-323␊1.5e-323␊9.4e-323␊1e-322␊1.04e-322… The double nearest each power of ten, and the doubles either side of it. 96 values
000258 regression/power of ten/1e-291 to 1e-260 Focused regression 9.999999999999998e-292␊1e-291␊1.0000000000000001… The double nearest each power of ten, and the doubles either side of it. 96 values
000259 regression/power of ten/1e-259 to 1e-228 Focused regression 9.999999999999999e-260␊1e-259␊1.0000000000000002… The double nearest each power of ten, and the doubles either side of it. 96 values
000260 regression/power of ten/1e-227 to 1e-196 Focused regression 9.999999999999998e-228␊1e-227␊1.0000000000000001… The double nearest each power of ten, and the doubles either side of it. 96 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.