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
200 of 2,018 cases
| Case | Name | Expected | Note | Size |
|---|---|---|---|---|
| 000330 | gay/00000-00495 Gay’s shortest digits |
1.3252057186783201e-106␊4.591997693252064e-133␊2…
|
100 values | |
| 000331 | gay/00500-00995 Gay’s shortest digits |
6.84223028929593e+234␊2.1802629531850214e+28␊3.9…
|
100 values | |
| 000332 | gay/01000-01495 Gay’s shortest digits |
5.329198588883745e+203␊5.4331578160589666e-245␊5…
|
100 values | |
| 000333 | gay/01500-01995 Gay’s shortest digits |
1.8751389107848105e-28␊1.0451944940360035e-192␊7…
|
100 values | |
| 000334 | gay/02000-02495 Gay’s shortest digits |
2.544270803852018e-186␊4.7714690896451466e+231␊1…
|
100 values | |
| 000335 | gay/02500-02995 Gay’s shortest digits |
6.594455338560602e-282␊2.5158271557959386e-17␊2.…
|
100 values | |
| 000336 | gay/03000-03495 Gay’s shortest digits |
1.1591878313288584e-116␊1.863301312762879e+165␊8…
|
100 values | |
| 000337 | gay/03500-03995 Gay’s shortest digits |
2.1046792697227626e+71␊9.450879895282121e+30␊7.1…
|
100 values | |
| 000338 | gay/04000-04495 Gay’s shortest digits |
8253119352655320␊1.2338830408974042e+125␊2.53510…
|
100 values | |
| 000339 | gay/04500-04995 Gay’s shortest digits |
2.9945709892043748e+181␊3.243642773731877e-63␊5.…
|
100 values | |
| 000340 | gay/05000-05495 Gay’s shortest digits |
3.3318362177544806e-232␊2.995451006412155e+184␊5…
|
100 values | |
| 000341 | gay/05500-05995 Gay’s shortest digits |
1.4489731465348995e-131␊4.893746798839223e+189␊2…
|
100 values | |
| 000342 | gay/06000-06495 Gay’s shortest digits |
2.018556714393278e+227␊2.348771438967682e+245␊9.…
|
100 values | |
| 000343 | gay/06500-06995 Gay’s shortest digits |
2.5149691763132806e-76␊1.3839073237307056e-107␊3…
|
100 values | |
| 000344 | gay/07000-07495 Gay’s shortest digits |
1.5616587150114692e+207␊3.2186852569976833e+155␊…
|
100 values | |
| 000345 | gay/07500-07995 Gay’s shortest digits |
1.9865132824820708e-151␊1.5999072229458768e-128␊…
|
100 values | |
| 000346 | gay/08000-08495 Gay’s shortest digits |
8.052685325904623e+150␊9.270575954352546e+253␊2.…
|
100 values | |
| 000347 | gay/08500-08995 Gay’s shortest digits |
1.4023054216697665e+29␊1.1564820244162631e+108␊9…
|
100 values | |
| 000348 | gay/09000-09495 Gay’s shortest digits |
5.23519871769419e+38␊2.6806482857007053e+211␊7.9…
|
100 values | |
| 000349 | gay/09500-09995 Gay’s shortest digits |
3.8415385675051335e+23␊1.5132609958588325e+49␊3.…
|
100 values | |
| 000350 | gay/10000-10495 Gay’s shortest digits |
2.7747221561118585e+246␊3.572431807514749e-292␊5…
|
100 values | |
| 000351 | gay/10500-10995 Gay’s shortest digits |
1.3227120738424102e+112␊2.7636080934786005e+243␊…
|
100 values | |
| 000352 | gay/11000-11495 Gay’s shortest digits |
3.362259460902014e-101␊2.453732335190232e-187␊1.…
|
100 values | |
| 000353 | gay/11500-11995 Gay’s shortest digits |
1.6512898034020462e-288␊6.124219010275023e+84␊1.…
|
100 values | |
| 000354 | gay/12000-12495 Gay’s shortest digits |
1.9091387657116856e+28␊1.2225647215226808e+112␊1…
|
100 values | |
| 000355 | gay/12500-12995 Gay’s shortest digits |
2.3832317731539046e-178␊3.4891171037471894e-253␊…
|
100 values | |
| 000356 | gay/13000-13495 Gay’s shortest digits |
1.8533237024415362e+192␊2.14528296642905e-120␊1.…
|
100 values | |
| 000357 | gay/13500-13995 Gay’s shortest digits |
4.420839614494162e+246␊4.101880564322978e+98␊5.2…
|
100 values | |
| 000358 | gay/14000-14495 Gay’s shortest digits |
3.5418443267735145e-249␊6.842883386129877e-112␊3…
|
100 values | |
| 000359 | gay/14500-14995 Gay’s shortest digits |
6997380.23003368␊2.7484430984986514e-242␊2.16672…
|
100 values | |
| 000360 | gay/15000-15495 Gay’s shortest digits |
9.6003369882244e-202␊2.4506497164491603e-222␊2.7…
|
100 values | |
| 000361 | gay/15500-15995 Gay’s shortest digits |
9.411963801438683e+229␊2.4198410655732007e+78␊3.…
|
100 values | |
| 000362 | gay/16000-16495 Gay’s shortest digits |
1.0557847732033788e+84␊3.805352504824424e-173␊4.…
|
100 values | |
| 000363 | gay/16500-16995 Gay’s shortest digits |
2.348885746754903e+154␊4.921267107614515e+169␊7.…
|
100 values | |
| 000364 | gay/17000-17495 Gay’s shortest digits |
7.009890811104875e-256␊4.019430933123495e+270␊1.…
|
100 values | |
| 000365 | gay/17500-17995 Gay’s shortest digits |
1.4305570247953641e+237␊1.23730825715337e-171␊9.…
|
100 values | |
| 000366 | gay/18000-18495 Gay’s shortest digits |
1.5522524595402566e-13␊4.872439632003308e-262␊1.…
|
100 values | |
| 000367 | gay/18500-18995 Gay’s shortest digits |
2.5737008234483286e-45␊4.2672675741744924e-206␊6…
|
100 values | |
| 000368 | gay/19000-19495 Gay’s shortest digits |
2.344094114768209e-66␊5.0473650485118345e-164␊3.…
|
100 values | |
| 000369 | gay/19500-19995 Gay’s shortest digits |
1.4774390457175408e-189␊6.949211900571584e-280␊3…
|
100 values | |
| 000370 | gay/20000-20495 Gay’s shortest digits |
5.5621077017484386e+278␊8.343316513800568e-140␊2…
|
100 values | |
| 000371 | gay/20500-20995 Gay’s shortest digits |
1.2655906318600543e+279␊3.7487780661557654e+132␊…
|
100 values | |
| 000372 | gay/21000-21495 Gay’s shortest digits |
3.479688042470626e-35␊4.764976511696254e+67␊2.49…
|
100 values | |
| 000373 | gay/21500-21995 Gay’s shortest digits |
3.627233461445588e-39␊2.0994931889575385e+58␊5.0…
|
100 values | |
| 000374 | gay/22000-22495 Gay’s shortest digits |
3.682049007280831e-199␊1.9009522322285258e+37␊7.…
|
100 values | |
| 000375 | gay/22500-22995 Gay’s shortest digits |
5.6767288202763084e+246␊2.1765444230093757e-277␊…
|
100 values | |
| 000376 | gay/23000-23495 Gay’s shortest digits |
1.1642405279244382e-43␊2.6476611045686703e-188␊2…
|
100 values | |
| 000377 | gay/23500-23995 Gay’s shortest digits |
2.1595190467784675e+99␊6.67823095625727e-200␊339…
|
100 values | |
| 000378 | gay/24000-24495 Gay’s shortest digits |
4.945945494565756e+92␊2.4075207233360173e-111␊3.…
|
100 values | |
| 000379 | gay/24500-24995 Gay’s shortest digits |
3.452867947490233e-208␊1.8046279339583558e-149␊4…
|
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.
- RFC 8785 Appendix B — the RFC’s number serialization samples, the source of the 25 rfc8785 cases
- Ryū’s d2s tests — Ulf Adams’s test values, from his paper Ryū: fast float-to-string conversion
- double-conversion’s gay-shortest.cc — 100,000 random doubles with the digits David Gay’s dtoa gives; every one is checked, and every fifth is in the 200 gay cases