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
000300 regression/exponent edge/1473 to 1536 Focused regression 2.907354897182428e+135␊5.8147097943648545e+135␊5… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000301 regression/exponent edge/1537 to 1600 Focused regression 5.36312317197704e+154␊1.0726246343954076e+155␊1.… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000302 regression/exponent edge/1601 to 1664 Focused regression 9.893216058924184e+173␊1.978643211784836e+174␊1.… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000303 regression/exponent edge/1665 to 1728 Focused regression 1.8249762470488785e+193␊3.6499524940977558e+193␊… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000304 regression/exponent edge/1729 to 1792 Focused regression 3.36648697699096e+212␊6.732973953981917e+212␊6.7… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000305 regression/exponent edge/1793 to 1856 Focused regression 6.210072369202837e+231␊1.242014473840567e+232␊1.… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000306 regression/exponent edge/1857 to 1920 Focused regression 1.1455561567389987e+251␊2.2911123134779966e+251␊… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000307 regression/exponent edge/1921 to 1984 Focused regression 2.1131781245426615e+270␊4.2263562490853215e+270␊… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000308 regression/exponent edge/1985 to 2046 Focused regression 3.8981256045600005e+289␊7.796251209119998e+289␊7… For each biased exponent: the significands 1, all ones, and all ones but the last. 186 values
000309 regression/tie/2^50 + j + 1/4 and 3/4 Focused regression 1125899906842624.2␊1125899906842624.8␊1125899906… Each is exactly halfway between two shortest candidates; the even last digit wins. 136 values
000310 regression/tie/found at random Focused regression 577443370697569.8␊1201643280559612.2␊17073344397… 256 random doubles whose shortest digits are a tie, found by search: about 1 in 1,700 is. 256 values
000311 regression/boundary/2^54 + 8 Focused regression 18014398509481990␊ 18014398509481990 is exactly halfway down to 2^54 + 4 and rounds to this double, whose significand is even. 1 value
000312 regression/boundary/2^54 + 4 Focused regression 18014398509481988␊ 18014398509481990 is exactly halfway up to 2^54 + 8 but rounds to that double, not this odd one, so it is not a candidate here. 1 value
000313 regression/boundary/around 1e23 Focused regression 9.999999999999997e+22␊1e+23␊1.0000000000000001e+… 1e23 is exactly halfway between the second and third of these: it is the answer for the second, whose significand is even, and wrong for the third. 4 values
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
000324 regression/longest line Focused regression -0.0000031834561795890424␊ Sign, 0.00000 and seventeen digits: 25 characters, the most any value needs. 1 value
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
000326 regression/byte order/2^-1074 + 2^-1022 Focused regression 2.225073858507202e-308␊ 1 value
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
000328 regression/json/coordinates Focused regression -33.86882␊151.20929␊51.507351␊-0.127758␊40.71277… 10 values
000329 regression/json/timestamps Focused regression 1700000000000␊1764115200123␊1764115200.123␊ 3 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

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.