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

66 of 2,018 cases

Case Name Expected Note Size
000010 rfc8785/44b52d02c7e14af6 RFC 8785 Appendix B 1e+23␊ RFC 8785 Appendix B: 44b52d02c7e14af6 serializes as 1e+23. 1 value
000011 rfc8785/44b52d02c7e14af7 RFC 8785 Appendix B 1.0000000000000001e+23␊ RFC 8785 Appendix B: 44b52d02c7e14af7 serializes as 1.0000000000000001e+23. 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
000031 ryu/Regression/-2.109808898695963E16 Ryū’s tests -21098088986959630␊ Ryū's d2s test Regression: -2.109808898695963E16 is -2.109808898695963E16 in Ryū's notation. 1 value
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
000206 regression/layout/n=17 Focused regression 70000000000000000␊10000000000000000␊600000000000… Values 0.d… × 10^17, with 1, 2, 3 and 17 significant digits. 12 values
000211 regression/layout/n=22 Focused regression 5e+21␊2e+21␊8e+21␊3.9e+21␊2.6e+21␊4.1e+21␊6.45e+… Values 0.d… × 10^22, with 1, 2, 3 and 17 significant digits. 12 values
000212 regression/layout/n=23 Focused regression 1e+22␊4e+22␊9e+22␊7.6e+22␊6.9e+22␊4.1e+22␊1.12e+… Values 0.d… × 10^23, with 1, 2, 3 and 17 significant digits. 12 values
000267 regression/power of ten/1e-3 to 1e28 Focused regression 0.0009999999999999998␊0.001␊0.001000000000000000… The double nearest each power of ten, and the doubles either side of it. 96 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
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
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
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
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
000372 gay/21000-21495 Gay’s shortest digits 3.479688042470626e-35␊4.764976511696254e+67␊2.49… Every 5th double of double-conversion's gay-shortest.cc, entries 21000 to 21495, whose shortest digits David Gay's dtoa computed. 100 values
000426 gay/48000-48495 Gay’s shortest digits 1.0433575494303774e-245␊7.961197724274944e+198␊1… Every 5th double of double-conversion's gay-shortest.cc, entries 48000 to 48495, 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
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
000483 gay/76500-76995 Gay’s shortest digits 1.5646640681598538e-306␊206909852644110.66␊6.762… Every 5th double of double-conversion's gay-shortest.cc, entries 76500 to 76995, whose shortest digits David Gay's dtoa computed. 100 values
000488 gay/79000-79495 Gay’s shortest digits 2.5109775948408224e-175␊3.0485936628776996e+100␊… Every 5th double of double-conversion's gay-shortest.cc, entries 79000 to 79495, whose shortest digits David Gay's dtoa computed. 100 values
000498 gay/84000-84495 Gay’s shortest digits 5.17034530217571e+151␊1.178375473148192e-92␊1.93… Every 5th double of double-conversion's gay-shortest.cc, entries 84000 to 84495, whose shortest digits David Gay's dtoa computed. 100 values
000646 generated/0117 Generated 99999999999987400␊ Seeded random values: near threshold. 1 value
000691 generated/0162 Generated 100000000000013390␊1.0000000000001226e-7␊ Seeded random values: near threshold. 2 values
000722 generated/0193 Generated 99999999999977800␊999999999999894000000␊99999999… Seeded random values: near threshold. 57 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
000866 generated/0337 Generated 10000000000003108␊100000000000016290␊1.000000000… Seeded random values: near threshold. 14 values
000908 generated/0379 Generated 999999999999952700000␊9999999999998002␊9.9999999… Seeded random values: near threshold. 55 values
000968 generated/0439 Generated 1.000000000000064e-7␊100000000000027410␊0.000001… Seeded random values: near threshold. 6 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
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
001153 generated/0626 Generated 9.999999999997841e-8␊1000000000000081.5␊99999999… Seeded random values: near threshold. 32 values
001192 generated/0666 Generated 1.0000000000000615e+21␊999999999999772.1␊1.00000… Seeded random values: near threshold. 35 values
001222 generated/0696 Generated 1.0000000000001469e+21␊999999999999753800000␊1.0… Seeded random values: near threshold. 28 values
001275 generated/0750 Generated 1.000000000000101e-7␊99999999999990200␊0.0000010… Seeded random values: near threshold. 47 values
001342 generated/0817 Generated 9.999999999998415e-8␊10000000000002034␊999999999… Seeded random values: near threshold. 50 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.