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
000314 regression/boundary/sweep 1 Focused regression 21673333067937468␊21673333067937470␊194252951047… Pairs of doubles either side of a decimal exactly halfway between them, from 2^54 up: the even one's shortest digits are that decimal, and the odd one's are not. 64 values
000315 regression/boundary/sweep 2 Focused regression 6180998896200000000␊6180998896200001000␊52449312… Pairs of doubles either side of a decimal exactly halfway between them, from 2^54 up: the even one's shortest digits are that decimal, and the odd one's are not. 64 values
000316 regression/boundary/sweep 3 Focused regression 1.5668823999999999e+21␊1.5668824e+21␊1.227099999… Pairs of doubles either side of a decimal exactly halfway between them, from 2^54 up: the even one's shortest digits are that decimal, and the odd one's are not. 64 values
000317 regression/boundary/sweep 4 Focused regression 4e+23␊4.0000000000000003e+23␊3.6799999999999997e… Pairs of doubles either side of a decimal exactly halfway between them, from 2^54 up: the even one's shortest digits are that decimal, and the odd one's are not. 64 values
000318 regression/boundary/sweep 5 Focused regression 8.6016e+25␊8.601600000000001e+25␊1.024e+26␊1.024… Pairs of doubles either side of a decimal exactly halfway between them, from 2^54 up: the even one's shortest digits are that decimal, and the odd one's are not. 64 values
000319 regression/boundary/sweep 6 Focused regression 2.2439526399999998e+28␊2.24395264e+28␊1.99229439… Pairs of doubles either side of a decimal exactly halfway between them, from 2^54 up: the even one's shortest digits are that decimal, and the odd one's are not. 64 values
000320 regression/boundary/sweep 7 Focused regression 8.2141249536e+30␊8.214124953600001e+30␊9.3952409… Pairs of doubles either side of a decimal exactly halfway between them, from 2^54 up: the even one's shortest digits are that decimal, and the odd one's are not. 64 values
000321 regression/boundary/sweep 8 Focused regression 1.8554258718719999e+33␊1.855425871872e+33␊1.7179… Pairs of doubles either side of a decimal exactly halfway between them, from 2^54 up: the even one's shortest digits are that decimal, and the odd one's are not. 64 values
000322 regression/boundary/sweep 9 Focused regression 4.398046511104e+35␊4.3980465111040004e+35␊4.8202… Pairs of doubles either side of a decimal exactly halfway between them, from 2^54 up: the even one's shortest digits are that decimal, and the odd one's are not. 54 values
000323 regression/boundary/negative Focused regression -21673333067937468␊-66396327804624904␊-727227805… 63 values
000325 regression/longest lines, full input Focused regression -0.0000031834561795890424␊-0.0000034740378247494… 8,192 values of 25 characters each in the largest input (65,536 bytes), so the output is 212,992 bytes: an output buffer of less than 26 bytes per value overflows. 8,192 values
000327 regression/json/prices Focused regression 0␊9.97␊19.94␊29.91␊39.88␊49.85␊59.82␊69.79␊79.76… Two-decimal amounts as parsed from JSON: each must come back as it was written. 101 values
000330 gay/00000-00495 Gay’s shortest digits 1.3252057186783201e-106␊4.591997693252064e-133␊2… Every 5th double of double-conversion's gay-shortest.cc, entries 0 to 495, whose shortest digits David Gay's dtoa computed. 100 values
000331 gay/00500-00995 Gay’s shortest digits 6.84223028929593e+234␊2.1802629531850214e+28␊3.9… Every 5th double of double-conversion's gay-shortest.cc, entries 500 to 995, whose shortest digits David Gay's dtoa computed. 100 values
000332 gay/01000-01495 Gay’s shortest digits 5.329198588883745e+203␊5.4331578160589666e-245␊5… Every 5th double of double-conversion's gay-shortest.cc, entries 1000 to 1495, whose shortest digits David Gay's dtoa computed. 100 values
000333 gay/01500-01995 Gay’s shortest digits 1.8751389107848105e-28␊1.0451944940360035e-192␊7… Every 5th double of double-conversion's gay-shortest.cc, entries 1500 to 1995, whose shortest digits David Gay's dtoa computed. 100 values
000334 gay/02000-02495 Gay’s shortest digits 2.544270803852018e-186␊4.7714690896451466e+231␊1… Every 5th double of double-conversion's gay-shortest.cc, entries 2000 to 2495, whose shortest digits David Gay's dtoa computed. 100 values
000335 gay/02500-02995 Gay’s shortest digits 6.594455338560602e-282␊2.5158271557959386e-17␊2.… Every 5th double of double-conversion's gay-shortest.cc, entries 2500 to 2995, whose shortest digits David Gay's dtoa computed. 100 values
000336 gay/03000-03495 Gay’s shortest digits 1.1591878313288584e-116␊1.863301312762879e+165␊8… Every 5th double of double-conversion's gay-shortest.cc, entries 3000 to 3495, whose shortest digits David Gay's dtoa computed. 100 values
000337 gay/03500-03995 Gay’s shortest digits 2.1046792697227626e+71␊9.450879895282121e+30␊7.1… Every 5th double of double-conversion's gay-shortest.cc, entries 3500 to 3995, whose shortest digits David Gay's dtoa computed. 100 values
000338 gay/04000-04495 Gay’s shortest digits 8253119352655320␊1.2338830408974042e+125␊2.53510… Every 5th double of double-conversion's gay-shortest.cc, entries 4000 to 4495, whose shortest digits David Gay's dtoa computed. 100 values
000339 gay/04500-04995 Gay’s shortest digits 2.9945709892043748e+181␊3.243642773731877e-63␊5.… Every 5th double of double-conversion's gay-shortest.cc, entries 4500 to 4995, whose shortest digits David Gay's dtoa computed. 100 values
000340 gay/05000-05495 Gay’s shortest digits 3.3318362177544806e-232␊2.995451006412155e+184␊5… Every 5th double of double-conversion's gay-shortest.cc, entries 5000 to 5495, whose shortest digits David Gay's dtoa computed. 100 values
000341 gay/05500-05995 Gay’s shortest digits 1.4489731465348995e-131␊4.893746798839223e+189␊2… Every 5th double of double-conversion's gay-shortest.cc, entries 5500 to 5995, whose shortest digits David Gay's dtoa computed. 100 values
000342 gay/06000-06495 Gay’s shortest digits 2.018556714393278e+227␊2.348771438967682e+245␊9.… Every 5th double of double-conversion's gay-shortest.cc, entries 6000 to 6495, whose shortest digits David Gay's dtoa computed. 100 values
000343 gay/06500-06995 Gay’s shortest digits 2.5149691763132806e-76␊1.3839073237307056e-107␊3… Every 5th double of double-conversion's gay-shortest.cc, entries 6500 to 6995, whose shortest digits David Gay's dtoa computed. 100 values
000344 gay/07000-07495 Gay’s shortest digits 1.5616587150114692e+207␊3.2186852569976833e+155␊… Every 5th double of double-conversion's gay-shortest.cc, entries 7000 to 7495, whose shortest digits David Gay's dtoa computed. 100 values
000345 gay/07500-07995 Gay’s shortest digits 1.9865132824820708e-151␊1.5999072229458768e-128␊… Every 5th double of double-conversion's gay-shortest.cc, entries 7500 to 7995, whose shortest digits David Gay's dtoa computed. 100 values
000346 gay/08000-08495 Gay’s shortest digits 8.052685325904623e+150␊9.270575954352546e+253␊2.… Every 5th double of double-conversion's gay-shortest.cc, entries 8000 to 8495, whose shortest digits David Gay's dtoa computed. 100 values
000347 gay/08500-08995 Gay’s shortest digits 1.4023054216697665e+29␊1.1564820244162631e+108␊9… Every 5th double of double-conversion's gay-shortest.cc, entries 8500 to 8995, whose shortest digits David Gay's dtoa computed. 100 values
000348 gay/09000-09495 Gay’s shortest digits 5.23519871769419e+38␊2.6806482857007053e+211␊7.9… Every 5th double of double-conversion's gay-shortest.cc, entries 9000 to 9495, whose shortest digits David Gay's dtoa computed. 100 values
000349 gay/09500-09995 Gay’s shortest digits 3.8415385675051335e+23␊1.5132609958588325e+49␊3.… Every 5th double of double-conversion's gay-shortest.cc, entries 9500 to 9995, whose shortest digits David Gay's dtoa computed. 100 values
000350 gay/10000-10495 Gay’s shortest digits 2.7747221561118585e+246␊3.572431807514749e-292␊5… Every 5th double of double-conversion's gay-shortest.cc, entries 10000 to 10495, whose shortest digits David Gay's dtoa computed. 100 values
000351 gay/10500-10995 Gay’s shortest digits 1.3227120738424102e+112␊2.7636080934786005e+243␊… Every 5th double of double-conversion's gay-shortest.cc, entries 10500 to 10995, whose shortest digits David Gay's dtoa computed. 100 values
000352 gay/11000-11495 Gay’s shortest digits 3.362259460902014e-101␊2.453732335190232e-187␊1.… Every 5th double of double-conversion's gay-shortest.cc, entries 11000 to 11495, whose shortest digits David Gay's dtoa computed. 100 values
000353 gay/11500-11995 Gay’s shortest digits 1.6512898034020462e-288␊6.124219010275023e+84␊1.… Every 5th double of double-conversion's gay-shortest.cc, entries 11500 to 11995, whose shortest digits David Gay's dtoa computed. 100 values
000354 gay/12000-12495 Gay’s shortest digits 1.9091387657116856e+28␊1.2225647215226808e+112␊1… Every 5th double of double-conversion's gay-shortest.cc, entries 12000 to 12495, whose shortest digits David Gay's dtoa computed. 100 values
000355 gay/12500-12995 Gay’s shortest digits 2.3832317731539046e-178␊3.4891171037471894e-253␊… Every 5th double of double-conversion's gay-shortest.cc, entries 12500 to 12995, whose shortest digits David Gay's dtoa computed. 100 values
000356 gay/13000-13495 Gay’s shortest digits 1.8533237024415362e+192␊2.14528296642905e-120␊1.… Every 5th double of double-conversion's gay-shortest.cc, entries 13000 to 13495, whose shortest digits David Gay's dtoa computed. 100 values
000357 gay/13500-13995 Gay’s shortest digits 4.420839614494162e+246␊4.101880564322978e+98␊5.2… Every 5th double of double-conversion's gay-shortest.cc, entries 13500 to 13995, whose shortest digits David Gay's dtoa computed. 100 values
000358 gay/14000-14495 Gay’s shortest digits 3.5418443267735145e-249␊6.842883386129877e-112␊3… Every 5th double of double-conversion's gay-shortest.cc, entries 14000 to 14495, whose shortest digits David Gay's dtoa computed. 100 values
000359 gay/14500-14995 Gay’s shortest digits 6997380.23003368␊2.7484430984986514e-242␊2.16672… Every 5th double of double-conversion's gay-shortest.cc, entries 14500 to 14995, whose shortest digits David Gay's dtoa computed. 100 values
000360 gay/15000-15495 Gay’s shortest digits 9.6003369882244e-202␊2.4506497164491603e-222␊2.7… Every 5th double of double-conversion's gay-shortest.cc, entries 15000 to 15495, whose shortest digits David Gay's dtoa computed. 100 values
000361 gay/15500-15995 Gay’s shortest digits 9.411963801438683e+229␊2.4198410655732007e+78␊3.… Every 5th double of double-conversion's gay-shortest.cc, entries 15500 to 15995, whose shortest digits David Gay's dtoa computed. 100 values
000362 gay/16000-16495 Gay’s shortest digits 1.0557847732033788e+84␊3.805352504824424e-173␊4.… Every 5th double of double-conversion's gay-shortest.cc, entries 16000 to 16495, whose shortest digits David Gay's dtoa computed. 100 values
000363 gay/16500-16995 Gay’s shortest digits 2.348885746754903e+154␊4.921267107614515e+169␊7.… Every 5th double of double-conversion's gay-shortest.cc, entries 16500 to 16995, whose shortest digits David Gay's dtoa computed. 100 values
000364 gay/17000-17495 Gay’s shortest digits 7.009890811104875e-256␊4.019430933123495e+270␊1.… Every 5th double of double-conversion's gay-shortest.cc, entries 17000 to 17495, whose shortest digits David Gay's dtoa computed. 100 values
000365 gay/17500-17995 Gay’s shortest digits 1.4305570247953641e+237␊1.23730825715337e-171␊9.… Every 5th double of double-conversion's gay-shortest.cc, entries 17500 to 17995, whose shortest digits David Gay's dtoa computed. 100 values
000366 gay/18000-18495 Gay’s shortest digits 1.5522524595402566e-13␊4.872439632003308e-262␊1.… Every 5th double of double-conversion's gay-shortest.cc, entries 18000 to 18495, whose shortest digits David Gay's dtoa computed. 100 values
000367 gay/18500-18995 Gay’s shortest digits 2.5737008234483286e-45␊4.2672675741744924e-206␊6… Every 5th double of double-conversion's gay-shortest.cc, entries 18500 to 18995, whose shortest digits David Gay's dtoa computed. 100 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.