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
312 of 2,018 cases
| Case | Name | Expected | Note | Size |
|---|---|---|---|---|
| 000418 | gay/44000-44495 Gay’s shortest digits |
1.4339969074622043e+149␊6.029112076746075e+76␊1.…
|
100 values | |
| 000419 | gay/44500-44995 Gay’s shortest digits |
2.424875621270154e+118␊17915706.86148159␊8.83100…
|
100 values | |
| 000420 | gay/45000-45495 Gay’s shortest digits |
2.607852494219181e+271␊4.7287646491594194e-241␊8…
|
100 values | |
| 000421 | gay/45500-45995 Gay’s shortest digits |
1.9519251596100484e+282␊7.263710142993314e-293␊5…
|
100 values | |
| 000422 | gay/46000-46495 Gay’s shortest digits |
5.408854305765933e+198␊1.5102870277208397e-150␊6…
|
100 values | |
| 000423 | gay/46500-46995 Gay’s shortest digits |
1.3434902561543696e+194␊1.2540503140023304e-270␊…
|
100 values | |
| 000424 | gay/47000-47495 Gay’s shortest digits |
5.5646451419418375e-232␊8.804616885243626e+217␊2…
|
100 values | |
| 000425 | gay/47500-47995 Gay’s shortest digits |
1.1489037807789154e-137␊1.78769527462934e+87␊7.9…
|
100 values | |
| 000426 | gay/48000-48495 Gay’s shortest digits |
1.0433575494303774e-245␊7.961197724274944e+198␊1…
|
100 values | |
| 000427 | gay/48500-48995 Gay’s shortest digits |
1.919342449500169e-96␊8.114755102923792e-226␊2.3…
|
100 values | |
| 000428 | gay/49000-49495 Gay’s shortest digits |
1.917654961715642e+35␊6.6116656219710545e+66␊3.7…
|
100 values | |
| 000429 | gay/49500-49995 Gay’s shortest digits |
1.2124807433347487e-68␊9.889599160823934e-119␊9.…
|
100 values | |
| 000430 | gay/50000-50495 Gay’s shortest digits |
6.895755151664176e-16␊1.6117042044652543e+258␊1.…
|
100 values | |
| 000431 | gay/50500-50995 Gay’s shortest digits |
3.534319603631292e-72␊9.389345769877841e+244␊1.2…
|
100 values | |
| 000432 | gay/51000-51495 Gay’s shortest digits |
7.41625473126901e+39␊1.1098375273580797e+96␊1.38…
|
100 values | |
| 000433 | gay/51500-51995 Gay’s shortest digits |
3.37030967552666e+280␊2.1486500402967938e+37␊243…
|
100 values | |
| 000434 | gay/52000-52495 Gay’s shortest digits |
2.2801080988354222e+215␊4.4602511120868143e-246␊…
|
100 values | |
| 000435 | gay/52500-52995 Gay’s shortest digits |
1.211051864396912e-124␊2.7572688036382747e-303␊4…
|
100 values | |
| 000436 | gay/53000-53495 Gay’s shortest digits |
1.0131931594875496e+239␊4.2978350989908755e-144␊…
|
100 values | |
| 000437 | gay/53500-53995 Gay’s shortest digits |
0.000003487630954634373␊7.643091020012738e-23␊7.…
|
100 values | |
| 000438 | gay/54000-54495 Gay’s shortest digits |
3.7556936262622233e+58␊1.749006343679548e+92␊3.9…
|
100 values | |
| 000439 | gay/54500-54995 Gay’s shortest digits |
9.40490702034138e-263␊4.496171493808505e-122␊2.5…
|
100 values | |
| 000440 | gay/55000-55495 Gay’s shortest digits |
6.367974255909101e+251␊1.6206106781115965e+63␊3.…
|
100 values | |
| 000441 | gay/55500-55995 Gay’s shortest digits |
3.825202904579199e-10␊1.0303161645856298e+135␊1.…
|
100 values | |
| 000442 | gay/56000-56495 Gay’s shortest digits |
5.505799589204923e-271␊6.442547329713399e+125␊7.…
|
100 values | |
| 000443 | gay/56500-56995 Gay’s shortest digits |
2.1177950147384554e-257␊1.0003841384141533e-102␊…
|
100 values | |
| 000444 | gay/57000-57495 Gay’s shortest digits |
2.350887493039259e-241␊1.1700596197869501e+64␊5.…
|
100 values | |
| 000445 | gay/57500-57995 Gay’s shortest digits |
2.7749506063576477e-113␊46717177918.15998␊9.0516…
|
100 values | |
| 000446 | gay/58000-58495 Gay’s shortest digits |
3.367883060456173e+37␊2.436938282710036e+119␊1.8…
|
100 values | |
| 000447 | gay/58500-58995 Gay’s shortest digits |
3.218849554336786e-126␊1.7957028486635423e+152␊2…
|
100 values | |
| 000448 | gay/59000-59495 Gay’s shortest digits |
1.7680538177805808e-209␊2.106370077032573e-40␊2.…
|
100 values | |
| 000449 | gay/59500-59995 Gay’s shortest digits |
6.312695625992255e+133␊2.3371541048271626e-168␊4…
|
100 values | |
| 000450 | gay/60000-60495 Gay’s shortest digits |
3.168659521249572e-80␊9.043723747851085e-238␊4.6…
|
100 values | |
| 000451 | gay/60500-60995 Gay’s shortest digits |
2.051774253343569e+51␊5.599023272162947e-279␊303…
|
100 values | |
| 000452 | gay/61000-61495 Gay’s shortest digits |
2.267388937149243e-86␊6.217308973059368e+181␊7.3…
|
100 values | |
| 000453 | gay/61500-61995 Gay’s shortest digits |
5.586593819834897e-282␊6.668645861731369e+292␊2.…
|
100 values | |
| 000454 | gay/62000-62495 Gay’s shortest digits |
3.486521520480363e-99␊2.690995797990329e+258␊7.7…
|
100 values | |
| 000455 | gay/62500-62995 Gay’s shortest digits |
4.293989876525387e+217␊2.0414291116116266e+48␊4.…
|
100 values | |
| 000456 | gay/63000-63495 Gay’s shortest digits |
9.973785838503356e+163␊5.282089952079002e+32␊1.0…
|
100 values | |
| 000457 | gay/63500-63995 Gay’s shortest digits |
1.491867858580492e-225␊270095574698.53613␊4.8822…
|
100 values | |
| 000458 | gay/64000-64495 Gay’s shortest digits |
7.086012468190923e+88␊1.445226906080633e-222␊1.4…
|
100 values | |
| 000459 | gay/64500-64995 Gay’s shortest digits |
5.6985306498239466e-105␊2.896156898505078e+203␊3…
|
100 values | |
| 000460 | gay/65000-65495 Gay’s shortest digits |
1.0048371530942373e+198␊6.478733155756573e+166␊5…
|
100 values | |
| 000461 | gay/65500-65995 Gay’s shortest digits |
3.691263762066236e+49␊8.336567853372831e-209␊1.4…
|
100 values | |
| 000462 | gay/66000-66495 Gay’s shortest digits |
6.925760082337737e-175␊2.2494689304594791e+111␊4…
|
100 values | |
| 000463 | gay/66500-66995 Gay’s shortest digits |
5.625968431155337e+74␊2.5110641390224707e-180␊8.…
|
100 values | |
| 000464 | gay/67000-67495 Gay’s shortest digits |
1.143995162388985e+260␊3.30483427555201e-216␊1.3…
|
100 values | |
| 000465 | gay/67500-67995 Gay’s shortest digits |
3.855225614042991e-210␊1.0671607103372354e-243␊4…
|
100 values | |
| 000466 | gay/68000-68495 Gay’s shortest digits |
6.090668574314741e+278␊3.2143567515060394e+179␊1…
|
100 values | |
| 000467 | gay/68500-68995 Gay’s shortest digits |
3.81888013023767e-260␊2.368659597138922e+28␊1.86…
|
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