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
126 of 2,018 cases
| Case | Name | Expected | Note | Size |
|---|---|---|---|---|
| 000025 | ryu/Basic/1E0 Ryū’s tests |
1␊
|
1 value | |
| 000026 | ryu/Basic/-1E0 Ryū’s tests |
-1␊
|
1 value | |
| 000027 | ryu/Basic/all Ryū’s tests |
0␊0␊1␊-1␊
|
4 values | |
| 000028 | ryu/SwitchToSubnormal/2.2250738585072014E-308 Ryū’s tests |
2.2250738585072014e-308␊
|
1 value | |
| 000029 | ryu/MinAndMax/all Ryū’s tests |
1.7976931348623157e+308␊5e-324␊
|
2 values | |
| 000030 | ryu/LotsOfTrailingZeros/2.9802322387695312E-8 Ryū’s tests |
2.9802322387695312e-8␊
|
1 value | |
| 000031 | ryu/Regression/-2.109808898695963E16 Ryū’s tests |
-21098088986959630␊
|
1 value | |
| 000032 | ryu/Regression/4.940656E-318 Ryū’s tests |
4.940656e-318␊
|
1 value | |
| 000033 | ryu/Regression/1.18575755E-316 Ryū’s tests |
1.18575755e-316␊
|
1 value | |
| 000034 | ryu/Regression/2.989102097996E-312 Ryū’s tests |
2.989102097996e-312␊
|
1 value | |
| 000035 | ryu/Regression/9.0608011534336E15 Ryū’s tests |
9060801153433600␊
|
1 value | |
| 000036 | ryu/Regression/4.708356024711512E18 Ryū’s tests |
4708356024711512000␊
|
1 value | |
| 000037 | ryu/Regression/9.409340012568248E18 Ryū’s tests |
9409340012568248000␊
|
1 value | |
| 000038 | ryu/Regression/1.2345678E0 Ryū’s tests |
1.2345678␊
|
1 value | |
| 000039 | ryu/Regression/all Ryū’s tests |
-21098088986959630␊4.940656e-318␊1.18575755e-316…
|
8 values | |
| 000040 | ryu/LooksLikePow5/5.764607523034235E39 Ryū’s tests |
5.764607523034235e+39␊
|
1 value | |
| 000041 | ryu/LooksLikePow5/1.152921504606847E40 Ryū’s tests |
1.152921504606847e+40␊
|
1 value | |
| 000042 | ryu/LooksLikePow5/2.305843009213694E40 Ryū’s tests |
2.305843009213694e+40␊
|
1 value | |
| 000043 | ryu/LooksLikePow5/all Ryū’s tests |
5.764607523034235e+39␊1.152921504606847e+40␊2.30…
|
3 values | |
| 000044 | ryu/OutputLength/1.2E0 Ryū’s tests |
1.2␊
|
1 value | |
| 000045 | ryu/OutputLength/1.23E0 Ryū’s tests |
1.23␊
|
1 value | |
| 000046 | ryu/OutputLength/1.234E0 Ryū’s tests |
1.234␊
|
1 value | |
| 000047 | ryu/OutputLength/1.2345E0 Ryū’s tests |
1.2345␊
|
1 value | |
| 000048 | ryu/OutputLength/1.23456E0 Ryū’s tests |
1.23456␊
|
1 value | |
| 000049 | ryu/OutputLength/1.234567E0 Ryū’s tests |
1.234567␊
|
1 value | |
| 000050 | ryu/OutputLength/1.23456789E0 Ryū’s tests |
1.23456789␊
|
1 value | |
| 000051 | ryu/OutputLength/1.234567895E0 Ryū’s tests |
1.234567895␊
|
1 value | |
| 000052 | ryu/OutputLength/1.2345678901E0 Ryū’s tests |
1.2345678901␊
|
1 value | |
| 000053 | ryu/OutputLength/1.23456789012E0 Ryū’s tests |
1.23456789012␊
|
1 value | |
| 000054 | ryu/OutputLength/1.234567890123E0 Ryū’s tests |
1.234567890123␊
|
1 value | |
| 000055 | ryu/OutputLength/1.2345678901234E0 Ryū’s tests |
1.2345678901234␊
|
1 value | |
| 000056 | ryu/OutputLength/1.23456789012345E0 Ryū’s tests |
1.23456789012345␊
|
1 value | |
| 000057 | ryu/OutputLength/1.234567890123456E0 Ryū’s tests |
1.234567890123456␊
|
1 value | |
| 000058 | ryu/OutputLength/1.2345678901234567E0 Ryū’s tests |
1.2345678901234567␊
|
1 value | |
| 000059 | ryu/OutputLength/4.294967294E0 Ryū’s tests |
4.294967294␊
|
1 value | |
| 000060 | ryu/OutputLength/4.294967295E0 Ryū’s tests |
4.294967295␊
|
1 value | |
| 000061 | ryu/OutputLength/4.294967296E0 Ryū’s tests |
4.294967296␊
|
1 value | |
| 000062 | ryu/OutputLength/4.294967297E0 Ryū’s tests |
4.294967297␊
|
1 value | |
| 000063 | ryu/OutputLength/4.294967298E0 Ryū’s tests |
4.294967298␊
|
1 value | |
| 000064 | ryu/OutputLength/all Ryū’s tests |
1␊1.2␊1.23␊1.234␊1.2345␊1.23456␊1.234567␊1.23456…
|
22 values | |
| 000065 | ryu/MinMaxShift/1.7800590868057611E-307 Ryū’s tests |
1.7800590868057611e-307␊
|
1 value | |
| 000066 | ryu/MinMaxShift/2.8480945388892175E-306 Ryū’s tests |
2.8480945388892175e-306␊
|
1 value | |
| 000067 | ryu/MinMaxShift/2.446494580089078E-296 Ryū’s tests |
2.446494580089078e-296␊
|
1 value | |
| 000068 | ryu/MinMaxShift/4.8929891601781557E-296 Ryū’s tests |
4.8929891601781557e-296␊
|
1 value | |
| 000069 | ryu/MinMaxShift/1.8014398509481984E16 Ryū’s tests |
18014398509481984␊
|
1 value | |
| 000070 | ryu/MinMaxShift/3.6028797018963964E16 Ryū’s tests |
36028797018963964␊
|
1 value | |
| 000071 | ryu/MinMaxShift/2.900835519859558E-216 Ryū’s tests |
2.900835519859558e-216␊
|
1 value | |
| 000072 | ryu/MinMaxShift/5.801671039719115E-216 Ryū’s tests |
5.801671039719115e-216␊
|
1 value | |
| 000073 | ryu/MinMaxShift/3.196104012172126E-27 Ryū’s tests |
3.196104012172126e-27␊
|
1 value | |
| 000074 | ryu/MinMaxShift/all Ryū’s tests |
1.7800590868057611e-307␊2.8480945388892175e-306␊…
|
9 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