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

295 of 2,018 cases

Case Name Expected Note Size
000075 ryu/SmallIntegers/9.007199254740991E15 Ryū’s tests 9007199254740991␊ Ryū's d2s test SmallIntegers: 9007199254740991.0 is 9.007199254740991E15 in Ryū's notation. 1 value
000076 ryu/SmallIntegers/1.2E1 Ryū’s tests 12␊ Ryū's d2s test SmallIntegers: 1.2e+1 is 1.2E1 in Ryū's notation. 1 value
000077 ryu/SmallIntegers/1.23E2 Ryū’s tests 123␊ Ryū's d2s test SmallIntegers: 1.23e+2 is 1.23E2 in Ryū's notation. 1 value
000078 ryu/SmallIntegers/1.234E3 Ryū’s tests 1234␊ Ryū's d2s test SmallIntegers: 1.234e+3 is 1.234E3 in Ryū's notation. 1 value
000079 ryu/SmallIntegers/1.2345E4 Ryū’s tests 12345␊ Ryū's d2s test SmallIntegers: 1.2345e+4 is 1.2345E4 in Ryū's notation. 1 value
000080 ryu/SmallIntegers/1.23456E5 Ryū’s tests 123456␊ Ryū's d2s test SmallIntegers: 1.23456e+5 is 1.23456E5 in Ryū's notation. 1 value
000081 ryu/SmallIntegers/1.234567E6 Ryū’s tests 1234567␊ Ryū's d2s test SmallIntegers: 1.234567e+6 is 1.234567E6 in Ryū's notation. 1 value
000082 ryu/SmallIntegers/1.2345678E7 Ryū’s tests 12345678␊ Ryū's d2s test SmallIntegers: 1.2345678e+7 is 1.2345678E7 in Ryū's notation. 1 value
000083 ryu/SmallIntegers/1.23456789E8 Ryū’s tests 123456789␊ Ryū's d2s test SmallIntegers: 1.23456789e+8 is 1.23456789E8 in Ryū's notation. 1 value
000084 ryu/SmallIntegers/1.23456789E9 Ryū’s tests 1234567890␊ Ryū's d2s test SmallIntegers: 1.23456789e+9 is 1.23456789E9 in Ryū's notation. 1 value
000085 ryu/SmallIntegers/1.234567895E9 Ryū’s tests 1234567895␊ Ryū's d2s test SmallIntegers: 1.234567895e+9 is 1.234567895E9 in Ryū's notation. 1 value
000086 ryu/SmallIntegers/1.2345678901E10 Ryū’s tests 12345678901␊ Ryū's d2s test SmallIntegers: 1.2345678901e+10 is 1.2345678901E10 in Ryū's notation. 1 value
000087 ryu/SmallIntegers/1.23456789012E11 Ryū’s tests 123456789012␊ Ryū's d2s test SmallIntegers: 1.23456789012e+11 is 1.23456789012E11 in Ryū's notation. 1 value
000088 ryu/SmallIntegers/1.234567890123E12 Ryū’s tests 1234567890123␊ Ryū's d2s test SmallIntegers: 1.234567890123e+12 is 1.234567890123E12 in Ryū's notation. 1 value
000089 ryu/SmallIntegers/1.2345678901234E13 Ryū’s tests 12345678901234␊ Ryū's d2s test SmallIntegers: 1.2345678901234e+13 is 1.2345678901234E13 in Ryū's notation. 1 value
000090 ryu/SmallIntegers/1.23456789012345E14 Ryū’s tests 123456789012345␊ Ryū's d2s test SmallIntegers: 1.23456789012345e+14 is 1.23456789012345E14 in Ryū's notation. 1 value
000091 ryu/SmallIntegers/1.234567890123456E15 Ryū’s tests 1234567890123456␊ Ryū's d2s test SmallIntegers: 1.234567890123456e+15 is 1.234567890123456E15 in Ryū's notation. 1 value
000092 ryu/SmallIntegers/1E1 Ryū’s tests 10␊ Ryū's d2s test SmallIntegers: 1.0e+1 is 1E1 in Ryū's notation. 1 value
000093 ryu/SmallIntegers/1E2 Ryū’s tests 100␊ Ryū's d2s test SmallIntegers: 1.0e+2 is 1E2 in Ryū's notation. 1 value
000094 ryu/SmallIntegers/1E3 Ryū’s tests 1000␊ Ryū's d2s test SmallIntegers: 1.0e+3 is 1E3 in Ryū's notation. 1 value
000095 ryu/SmallIntegers/1E4 Ryū’s tests 10000␊ Ryū's d2s test SmallIntegers: 1.0e+4 is 1E4 in Ryū's notation. 1 value
000096 ryu/SmallIntegers/1E5 Ryū’s tests 100000␊ Ryū's d2s test SmallIntegers: 1.0e+5 is 1E5 in Ryū's notation. 1 value
000097 ryu/SmallIntegers/1E6 Ryū’s tests 1000000␊ Ryū's d2s test SmallIntegers: 1.0e+6 is 1E6 in Ryū's notation. 1 value
000098 ryu/SmallIntegers/1E7 Ryū’s tests 10000000␊ Ryū's d2s test SmallIntegers: 1.0e+7 is 1E7 in Ryū's notation. 1 value
000099 ryu/SmallIntegers/1E8 Ryū’s tests 100000000␊ Ryū's d2s test SmallIntegers: 1.0e+8 is 1E8 in Ryū's notation. 1 value
000100 ryu/SmallIntegers/1E9 Ryū’s tests 1000000000␊ Ryū's d2s test SmallIntegers: 1.0e+9 is 1E9 in Ryū's notation. 1 value
000101 ryu/SmallIntegers/1E10 Ryū’s tests 10000000000␊ Ryū's d2s test SmallIntegers: 1.0e+10 is 1E10 in Ryū's notation. 1 value
000102 ryu/SmallIntegers/1E11 Ryū’s tests 100000000000␊ Ryū's d2s test SmallIntegers: 1.0e+11 is 1E11 in Ryū's notation. 1 value
000103 ryu/SmallIntegers/1E12 Ryū’s tests 1000000000000␊ Ryū's d2s test SmallIntegers: 1.0e+12 is 1E12 in Ryū's notation. 1 value
000104 ryu/SmallIntegers/1E13 Ryū’s tests 10000000000000␊ Ryū's d2s test SmallIntegers: 1.0e+13 is 1E13 in Ryū's notation. 1 value
000105 ryu/SmallIntegers/1E14 Ryū’s tests 100000000000000␊ Ryū's d2s test SmallIntegers: 1.0e+14 is 1E14 in Ryū's notation. 1 value
000106 ryu/SmallIntegers/1E15 Ryū’s tests 1000000000000000␊ Ryū's d2s test SmallIntegers: 1.0e+15 is 1E15 in Ryū's notation. 1 value
000107 ryu/SmallIntegers/1.000000000000001E15 Ryū’s tests 1000000000000001␊ Ryū's d2s test SmallIntegers: 1.0e+15 + 1.0e+0 is 1.000000000000001E15 in Ryū's notation. 1 value
000108 ryu/SmallIntegers/1.00000000000001E15 Ryū’s tests 1000000000000010␊ Ryū's d2s test SmallIntegers: 1.0e+15 + 1.0e+1 is 1.00000000000001E15 in Ryū's notation. 1 value
000109 ryu/SmallIntegers/1.0000000000001E15 Ryū’s tests 1000000000000100␊ Ryū's d2s test SmallIntegers: 1.0e+15 + 1.0e+2 is 1.0000000000001E15 in Ryū's notation. 1 value
000110 ryu/SmallIntegers/1.000000000001E15 Ryū’s tests 1000000000001000␊ Ryū's d2s test SmallIntegers: 1.0e+15 + 1.0e+3 is 1.000000000001E15 in Ryū's notation. 1 value
000111 ryu/SmallIntegers/1.00000000001E15 Ryū’s tests 1000000000010000␊ Ryū's d2s test SmallIntegers: 1.0e+15 + 1.0e+4 is 1.00000000001E15 in Ryū's notation. 1 value
000112 ryu/SmallIntegers/1.0000000001E15 Ryū’s tests 1000000000100000␊ Ryū's d2s test SmallIntegers: 1.0e+15 + 1.0e+5 is 1.0000000001E15 in Ryū's notation. 1 value
000113 ryu/SmallIntegers/1.000000001E15 Ryū’s tests 1000000001000000␊ Ryū's d2s test SmallIntegers: 1.0e+15 + 1.0e+6 is 1.000000001E15 in Ryū's notation. 1 value
000114 ryu/SmallIntegers/1.00000001E15 Ryū’s tests 1000000010000000␊ Ryū's d2s test SmallIntegers: 1.0e+15 + 1.0e+7 is 1.00000001E15 in Ryū's notation. 1 value
000115 ryu/SmallIntegers/1.0000001E15 Ryū’s tests 1000000100000000␊ Ryū's d2s test SmallIntegers: 1.0e+15 + 1.0e+8 is 1.0000001E15 in Ryū's notation. 1 value
000116 ryu/SmallIntegers/1.000001E15 Ryū’s tests 1000001000000000␊ Ryū's d2s test SmallIntegers: 1.0e+15 + 1.0e+9 is 1.000001E15 in Ryū's notation. 1 value
000117 ryu/SmallIntegers/1.00001E15 Ryū’s tests 1000010000000000␊ Ryū's d2s test SmallIntegers: 1.0e+15 + 1.0e+10 is 1.00001E15 in Ryū's notation. 1 value
000118 ryu/SmallIntegers/1.0001E15 Ryū’s tests 1000100000000000␊ Ryū's d2s test SmallIntegers: 1.0e+15 + 1.0e+11 is 1.0001E15 in Ryū's notation. 1 value
000119 ryu/SmallIntegers/1.001E15 Ryū’s tests 1001000000000000␊ Ryū's d2s test SmallIntegers: 1.0e+15 + 1.0e+12 is 1.001E15 in Ryū's notation. 1 value
000120 ryu/SmallIntegers/1.01E15 Ryū’s tests 1010000000000000␊ Ryū's d2s test SmallIntegers: 1.0e+15 + 1.0e+13 is 1.01E15 in Ryū's notation. 1 value
000121 ryu/SmallIntegers/1.1E15 Ryū’s tests 1100000000000000␊ Ryū's d2s test SmallIntegers: 1.0e+15 + 1.0e+14 is 1.1E15 in Ryū's notation. 1 value
000122 ryu/SmallIntegers/8E0 Ryū’s tests 8␊ Ryū's d2s test SmallIntegers: 8.0 is 8E0 in Ryū's notation. 1 value
000123 ryu/SmallIntegers/6.4E1 Ryū’s tests 64␊ Ryū's d2s test SmallIntegers: 64.0 is 6.4E1 in Ryū's notation. 1 value
000124 ryu/SmallIntegers/5.12E2 Ryū’s tests 512␊ Ryū's d2s test SmallIntegers: 512.0 is 5.12E2 in Ryū's notation. 1 value

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.