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

213 of 2,018 cases

Case Name Expected Note Size
000005 rfc8785/max neg number RFC 8785 Appendix B -1.7976931348623157e+308␊ RFC 8785 Appendix B: ffefffffffffffff serializes as -1.7976931348623157e+308 (Max neg number). 1 value
000022 rfc8785/becbf647612f3696 RFC 8785 Appendix B -0.0000033333333333333333␊ RFC 8785 Appendix B: becbf647612f3696 serializes as -0.0000033333333333333333. 1 value
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
000177 regression/threshold/around 1e-6 Focused regression 9.999999999999995e-7␊9.999999999999997e-7␊0.0000… 1e-6 and the two doubles either side of it. 5 values
000184 regression/layout/n=-5 Focused regression 0.000008␊0.000006␊0.000008␊0.0000074␊0.0000091␊0… Values 0.d… × 10^-5, with 1, 2, 3 and 17 significant digits. 12 values
000256 regression/power of two/negative Focused regression -5e-324␊-6.4758e-319␊-8.487983164e-314␊-1.112536… 124 values
000266 regression/power of ten/1e-35 to 1e-4 Focused regression 9.999999999999999e-36␊1e-35␊1.0000000000000001e-… The double nearest each power of ten, and the doubles either side of it. 96 values
000292 regression/exponent edge/961 to 1024 Focused regression 2.1684043449710093e-19␊4.3368086899420173e-19␊4.… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 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
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
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
000370 gay/20000-20495 Gay’s shortest digits 5.5621077017484386e+278␊8.343316513800568e-140␊2… Every 5th double of double-conversion's gay-shortest.cc, entries 20000 to 20495, whose shortest digits David Gay's dtoa computed. 100 values
000373 gay/21500-21995 Gay’s shortest digits 3.627233461445588e-39␊2.0994931889575385e+58␊5.0… Every 5th double of double-conversion's gay-shortest.cc, entries 21500 to 21995, whose shortest digits David Gay's dtoa computed. 100 values
000379 gay/24500-24995 Gay’s shortest digits 3.452867947490233e-208␊1.8046279339583558e-149␊4… Every 5th double of double-conversion's gay-shortest.cc, entries 24500 to 24995, whose shortest digits David Gay's dtoa computed. 100 values
000423 gay/46500-46995 Gay’s shortest digits 1.3434902561543696e+194␊1.2540503140023304e-270␊… Every 5th double of double-conversion's gay-shortest.cc, entries 46500 to 46995, whose shortest digits David Gay's dtoa computed. 100 values
000428 gay/49000-49495 Gay’s shortest digits 1.917654961715642e+35␊6.6116656219710545e+66␊3.7… Every 5th double of double-conversion's gay-shortest.cc, entries 49000 to 49495, whose shortest digits David Gay's dtoa computed. 100 values
000446 gay/58000-58495 Gay’s shortest digits 3.367883060456173e+37␊2.436938282710036e+119␊1.8… Every 5th double of double-conversion's gay-shortest.cc, entries 58000 to 58495, whose shortest digits David Gay's dtoa computed. 100 values
000453 gay/61500-61995 Gay’s shortest digits 5.586593819834897e-282␊6.668645861731369e+292␊2.… Every 5th double of double-conversion's gay-shortest.cc, entries 61500 to 61995, whose shortest digits David Gay's dtoa computed. 100 values
000478 gay/74000-74495 Gay’s shortest digits 105012.83200714542␊1.8504869705638376e+219␊7.140… Every 5th double of double-conversion's gay-shortest.cc, entries 74000 to 74495, whose shortest digits David Gay's dtoa computed. 100 values
000480 gay/75000-75495 Gay’s shortest digits 1.1512085005465528e-20␊6.740789556449912e-211␊1.… Every 5th double of double-conversion's gay-shortest.cc, entries 75000 to 75495, whose shortest digits David Gay's dtoa computed. 100 values
000493 gay/81500-81995 Gay’s shortest digits 5.95979232626387e-121␊1.3264997123883215e-14␊2.0… Every 5th double of double-conversion's gay-shortest.cc, entries 81500 to 81995, whose shortest digits David Gay's dtoa computed. 100 values
000510 gay/90000-90495 Gay’s shortest digits 4.359995837807711e-44␊3.046856723947344e-68␊2.53… Every 5th double of double-conversion's gay-shortest.cc, entries 90000 to 90495, whose shortest digits David Gay's dtoa computed. 100 values
000530 generated/0000 Generated -3.15027242823036e-180␊-2.6522935840304094e+290␊… Seeded random values: any bits. 6 values
000537 generated/0007 Generated 3.557097329181908e+106␊-2.2351149978083815e+191␊ Seeded random values: any bits. 2 values
000549 generated/0019 Generated 0.0000010000000000000556␊ Seeded random values: near threshold. 1 value
000551 generated/0021 Generated 3.8020662662819882e+56␊2.1883755923363824e+33␊7.… Seeded random values: any bits. 25 values
000554 generated/0025 Generated -1.7861433832183334e-308␊8.3177640905e-314␊6.331… Seeded random values: subnormal. 13 values
000557 generated/0028 Generated -3.2359110990233524e-168␊ Seeded random values: any bits. 1 value
000564 generated/0035 Generated 1002985279887.8593␊2.3206821264822224e-149␊6.110… Seeded random values: any bits. 61 values
000571 generated/0042 Generated -2.7981932699581393e-304␊-2.9452538300521086e-24… Seeded random values: any bits. 3 values
000589 generated/0060 Generated -2.1148419925704483e-308␊-8.0597704e-317␊9.114e-… Seeded random values: subnormal. 14 values
000590 generated/0061 Generated 0.0000010000000000004055␊999999999999881.9␊ Seeded random values: near threshold. 2 values
000599 generated/0070 Generated -139532613173849.98␊1.0803455925018472e-277␊4.69… Seeded random values: any bits. 32 values
000618 generated/0089 Generated 9.999999999997367e-8␊0.0000010000000000003161␊99… Seeded random values: near threshold. 47 values
000620 generated/0091 Generated 8.534934430682185e-163␊-5.2197325707042964e+98␊8… Seeded random values: any bits. 29 values
000634 generated/0105 Generated 1.944321303897929e+57␊-32611.508517746708␊-3.794… Seeded random values: any bits. 58 values
000639 generated/0110 Generated 1.0000000000000286e+21␊999999999999748500000␊999… Seeded random values: near threshold. 31 values
000645 generated/0116 Generated -3.542603880651e-311␊1.4872665e-317␊-4.35133e-31… Seeded random values: subnormal. 16 values
000662 generated/0133 Generated 1.2318908284087778e-118␊-1.2586760787399238e-200… Seeded random values: any bits. 2 values
000667 generated/0138 Generated 10000000000001284␊9.999999999999416e-8␊100000000… Seeded random values: near threshold. 8 values
000669 generated/0140 Generated 9.99999999999911e-8␊1.0000000000001897e+21␊0.000… Seeded random values: near threshold. 62 values
000683 generated/0154 Generated -2.3815517541245127e-233␊-5.0402629550422567e+12… Seeded random values: any bits. 11 values
000686 generated/0157 Generated 5.876862343035666e+194␊3.8583265386429185e-284␊2… Seeded random values: 17 digits. 57 values
000703 generated/0174 Generated 3.6606821688406568e-298␊-2.8435261613908197e+158… Seeded random values: any bits. 6 values
000710 generated/0181 Generated 137601891257344140␊1.4008392729155796e-272␊3.762… Seeded random values: any bits. 25 values
000717 generated/0188 Generated 999999999999965800000␊999999999999810.5␊10000000… Seeded random values: near threshold. 41 values
000722 generated/0193 Generated 99999999999977800␊999999999999894000000␊99999999… Seeded random values: near threshold. 57 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.