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

85 of 2,018 cases

Case Name Expected Note Size
000023 rfc8785/round to even RFC 8785 Appendix B 1424953923781206.2␊ RFC 8785 Appendix B: 43143ff3c1cb0959 serializes as 1424953923781206.2 (Round to even). 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
000030 ryu/LotsOfTrailingZeros/2.9802322387695312E-8 Ryū’s tests 2.9802322387695312e-8␊ Ryū's d2s test LotsOfTrailingZeros: 2.98023223876953125E-8 is 2.9802322387695312E-8 in Ryū's notation. 1 value
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
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
000293 regression/exponent edge/1025 to 1088 Focused regression 4.000000000000001␊7.999999999999999␊7.9999999999… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 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
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
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
000374 gay/22000-22495 Gay’s shortest digits 3.682049007280831e-199␊1.9009522322285258e+37␊7.… Every 5th double of double-conversion's gay-shortest.cc, entries 22000 to 22495, whose shortest digits David Gay's dtoa computed. 100 values
000385 gay/27500-27995 Gay’s shortest digits 6.315307715916178e-248␊9.925660628845098e-79␊4.9… Every 5th double of double-conversion's gay-shortest.cc, entries 27500 to 27995, whose shortest digits David Gay's dtoa computed. 100 values
000405 gay/37500-37995 Gay’s shortest digits 1.983518044552817e+59␊3.039806271980666e-256␊1.0… Every 5th double of double-conversion's gay-shortest.cc, entries 37500 to 37995, whose shortest digits David Gay's dtoa computed. 100 values
000439 gay/54500-54995 Gay’s shortest digits 9.40490702034138e-263␊4.496171493808505e-122␊2.5… Every 5th double of double-conversion's gay-shortest.cc, entries 54500 to 54995, whose shortest digits David Gay's dtoa computed. 100 values
000456 gay/63000-63495 Gay’s shortest digits 9.973785838503356e+163␊5.282089952079002e+32␊1.0… Every 5th double of double-conversion's gay-shortest.cc, entries 63000 to 63495, whose shortest digits David Gay's dtoa computed. 100 values
000477 gay/73500-73995 Gay’s shortest digits 9.881981324703855e-107␊2.019700062302725e+149␊1.… Every 5th double of double-conversion's gay-shortest.cc, entries 73500 to 73995, whose shortest digits David Gay's dtoa computed. 100 values
000490 gay/80000-80495 Gay’s shortest digits 1.7231479448263837e+219␊1.9360317217086693e-202␊… Every 5th double of double-conversion's gay-shortest.cc, entries 80000 to 80495, whose shortest digits David Gay's dtoa computed. 100 values
000497 gay/83500-83995 Gay’s shortest digits 7.869322271412284e-116␊1.131000946969453e+225␊4.… Every 5th double of double-conversion's gay-shortest.cc, entries 83500 to 83995, whose shortest digits David Gay's dtoa computed. 100 values
000535 generated/0005 Generated 999999999999938.8␊ Seeded random values: near threshold. 1 value
000618 generated/0089 Generated 9.999999999997367e-8␊0.0000010000000000003161␊99… Seeded random values: near threshold. 47 values
000625 generated/0096 Generated 1.0000000000001375e+21␊1.0000000000000959e-7␊100… Seeded random values: near threshold. 9 values
000632 generated/0103 Generated 999999999999793.2␊99999999999981630␊ Seeded random values: near threshold. 2 values
000653 generated/0124 Generated 1000000000000099.2␊ Seeded random values: near threshold. 1 value
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
000706 generated/0177 Generated 1000000000000074.8␊100000000000015840␊ Seeded random values: near threshold. 2 values
000722 generated/0193 Generated 99999999999977800␊999999999999894000000␊99999999… Seeded random values: near threshold. 57 values
000741 generated/0212 Generated 100000000000020960␊0.0000010000000000001653␊9999… Seeded random values: near threshold. 55 values
000762 generated/0233 Generated 9.999999999998988e-8␊1.0000000000002483e+21␊9999… Seeded random values: near threshold. 56 values
000789 generated/0260 Generated 1.0000000000001028e+21␊1000000000000242.2␊999999… Seeded random values: near threshold. 22 values
000803 generated/0274 Generated 999999999999789600000␊99999999999991660␊10000000… Seeded random values: near threshold. 38 values
000809 generated/0280 Generated 9.999999999997807e-8␊1.0000000000001801e-7␊99999… Seeded random values: near threshold. 8 values
000814 generated/0285 Generated 1.0000000000000151e+21␊1.0000000000000379e+21␊9.… Seeded random values: near threshold. 16 values
000817 generated/0288 Generated 9.999999999999395e-8␊1.0000000000000901e-7␊9.999… Seeded random values: near threshold. 56 values
000826 generated/0297 Generated 100000000000011680␊999999999999856.2␊1.000000000… Seeded random values: near threshold. 30 values
000835 generated/0306 Generated 999999999999763.4␊1.0000000000001459e+21␊9999999… Seeded random values: near threshold. 10 values
000840 generated/0311 Generated 99999999999987500␊9999999999999572␊9999999999998… Seeded random values: near threshold. 13 values
000846 generated/0317 Generated 1.0000000000001387e+21␊99999999999968980␊1000000… Seeded random values: near threshold. 8 values
000908 generated/0379 Generated 999999999999952700000␊9999999999998002␊9.9999999… Seeded random values: near threshold. 55 values
000912 generated/0383 Generated 1000000000000120.8␊100000000000029250␊0.00000100… Seeded random values: near threshold. 15 values
000999 generated/0470 Generated 0.0000010000000000000906␊1000000000000208.6␊1000… Seeded random values: near threshold. 9 values
001006 generated/0477 Generated 100000000000001420␊10000000000001510␊99999999999… Seeded random values: near threshold. 29 values
001048 generated/0520 Generated 1.0000000000001863e-7␊9999999999997958␊9.9999999… Seeded random values: near threshold. 31 values
001098 generated/0571 Generated 9.999999999998859e-8␊9999999999998574␊9999999999… Seeded random values: near threshold. 27 values
001106 generated/0579 Generated 1000000000000047.8␊999999999999770.9␊9.999999999… Seeded random values: near threshold. 23 values
001109 generated/0582 Generated 999999999999951.8␊9.999999999999811e-7␊100000000… Seeded random values: near threshold. 12 values
001121 generated/0594 Generated 4.2845623603910743e+254␊-2.3711020099003735e-60␊… Seeded random values: any bits. 34 values
001140 generated/0613 Generated 0.000001000000000000078␊1.0000000000002275e+21␊1… Seeded random values: near threshold. 22 values
001179 generated/0652 Generated 9.999999999998783e-8␊10000000000000310␊999999999… Seeded random values: near threshold. 48 values
001201 generated/0675 Generated 999999999999941.1␊9.999999999999417e-7␊9.9999999… Seeded random values: near threshold. 8 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.