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
000518 gay/94000-94495 Gay’s shortest digits 2.1928458725884446e+190␊5.43888044657602e-228␊3.… Every 5th double of double-conversion's gay-shortest.cc, entries 94000 to 94495, whose shortest digits David Gay's dtoa computed. 100 values
000519 gay/94500-94995 Gay’s shortest digits 6.973245409217188e-241␊1.457507561594344e+281␊2.… Every 5th double of double-conversion's gay-shortest.cc, entries 94500 to 94995, whose shortest digits David Gay's dtoa computed. 100 values
000520 gay/95000-95495 Gay’s shortest digits 2.8648974318927384e+60␊4.1933244530598904e-149␊3… Every 5th double of double-conversion's gay-shortest.cc, entries 95000 to 95495, whose shortest digits David Gay's dtoa computed. 100 values
000521 gay/95500-95995 Gay’s shortest digits 3272.163822818773␊3.426682474369147e+292␊8.23175… Every 5th double of double-conversion's gay-shortest.cc, entries 95500 to 95995, whose shortest digits David Gay's dtoa computed. 100 values
000522 gay/96000-96495 Gay’s shortest digits 6.496113895977728e-117␊1.4409923898392762e-257␊6… Every 5th double of double-conversion's gay-shortest.cc, entries 96000 to 96495, whose shortest digits David Gay's dtoa computed. 100 values
000523 gay/96500-96995 Gay’s shortest digits 3.1109343263351398e-242␊1.1429208317453388e-71␊4… Every 5th double of double-conversion's gay-shortest.cc, entries 96500 to 96995, whose shortest digits David Gay's dtoa computed. 100 values
000524 gay/97000-97495 Gay’s shortest digits 4.497935016652547e-139␊200325738537.52917␊1.8055… Every 5th double of double-conversion's gay-shortest.cc, entries 97000 to 97495, whose shortest digits David Gay's dtoa computed. 100 values
000525 gay/97500-97995 Gay’s shortest digits 1.6812656283591975e+145␊6.561351793051983e-161␊9… Every 5th double of double-conversion's gay-shortest.cc, entries 97500 to 97995, whose shortest digits David Gay's dtoa computed. 100 values
000526 gay/98000-98495 Gay’s shortest digits 1.6701007602077343e-29␊1.7046772144039784e+292␊5… Every 5th double of double-conversion's gay-shortest.cc, entries 98000 to 98495, whose shortest digits David Gay's dtoa computed. 100 values
000527 gay/98500-98995 Gay’s shortest digits 1.1138772862293722e-261␊5.782637218867633e+102␊1… Every 5th double of double-conversion's gay-shortest.cc, entries 98500 to 98995, whose shortest digits David Gay's dtoa computed. 100 values
000528 gay/99000-99495 Gay’s shortest digits 6.735688280373288e+188␊3.886833559995876e-301␊2.… Every 5th double of double-conversion's gay-shortest.cc, entries 99000 to 99495, whose shortest digits David Gay's dtoa computed. 100 values
000529 gay/99500-99995 Gay’s shortest digits 0.07221858280850174␊4.219423673711869e-164␊4.169… Every 5th double of double-conversion's gay-shortest.cc, entries 99500 to 99995, 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.