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
000125 ryu/SmallIntegers/8.192E3 Ryū’s tests 8192␊ Ryū's d2s test SmallIntegers: 8192.0 is 8.192E3 in Ryū's notation. 1 value
000126 ryu/SmallIntegers/6.5536E4 Ryū’s tests 65536␊ Ryū's d2s test SmallIntegers: 65536.0 is 6.5536E4 in Ryū's notation. 1 value
000127 ryu/SmallIntegers/5.24288E5 Ryū’s tests 524288␊ Ryū's d2s test SmallIntegers: 524288.0 is 5.24288E5 in Ryū's notation. 1 value
000128 ryu/SmallIntegers/8.388608E6 Ryū’s tests 8388608␊ Ryū's d2s test SmallIntegers: 8388608.0 is 8.388608E6 in Ryū's notation. 1 value
000129 ryu/SmallIntegers/6.7108864E7 Ryū’s tests 67108864␊ Ryū's d2s test SmallIntegers: 67108864.0 is 6.7108864E7 in Ryū's notation. 1 value
000130 ryu/SmallIntegers/5.36870912E8 Ryū’s tests 536870912␊ Ryū's d2s test SmallIntegers: 536870912.0 is 5.36870912E8 in Ryū's notation. 1 value
000131 ryu/SmallIntegers/8.589934592E9 Ryū’s tests 8589934592␊ Ryū's d2s test SmallIntegers: 8589934592.0 is 8.589934592E9 in Ryū's notation. 1 value
000132 ryu/SmallIntegers/6.8719476736E10 Ryū’s tests 68719476736␊ Ryū's d2s test SmallIntegers: 68719476736.0 is 6.8719476736E10 in Ryū's notation. 1 value
000133 ryu/SmallIntegers/5.49755813888E11 Ryū’s tests 549755813888␊ Ryū's d2s test SmallIntegers: 549755813888.0 is 5.49755813888E11 in Ryū's notation. 1 value
000134 ryu/SmallIntegers/8.796093022208E12 Ryū’s tests 8796093022208␊ Ryū's d2s test SmallIntegers: 8796093022208.0 is 8.796093022208E12 in Ryū's notation. 1 value
000135 ryu/SmallIntegers/7.0368744177664E13 Ryū’s tests 70368744177664␊ Ryū's d2s test SmallIntegers: 70368744177664.0 is 7.0368744177664E13 in Ryū's notation. 1 value
000136 ryu/SmallIntegers/5.62949953421312E14 Ryū’s tests 562949953421312␊ Ryū's d2s test SmallIntegers: 562949953421312.0 is 5.62949953421312E14 in Ryū's notation. 1 value
000137 ryu/SmallIntegers/8E3 Ryū’s tests 8000␊ Ryū's d2s test SmallIntegers: 8.0e+3 is 8E3 in Ryū's notation. 1 value
000138 ryu/SmallIntegers/6.4E4 Ryū’s tests 64000␊ Ryū's d2s test SmallIntegers: 64.0e+3 is 6.4E4 in Ryū's notation. 1 value
000139 ryu/SmallIntegers/5.12E5 Ryū’s tests 512000␊ Ryū's d2s test SmallIntegers: 512.0e+3 is 5.12E5 in Ryū's notation. 1 value
000140 ryu/SmallIntegers/8.192E6 Ryū’s tests 8192000␊ Ryū's d2s test SmallIntegers: 8192.0e+3 is 8.192E6 in Ryū's notation. 1 value
000141 ryu/SmallIntegers/6.5536E7 Ryū’s tests 65536000␊ Ryū's d2s test SmallIntegers: 65536.0e+3 is 6.5536E7 in Ryū's notation. 1 value
000142 ryu/SmallIntegers/5.24288E8 Ryū’s tests 524288000␊ Ryū's d2s test SmallIntegers: 524288.0e+3 is 5.24288E8 in Ryū's notation. 1 value
000143 ryu/SmallIntegers/8.388608E9 Ryū’s tests 8388608000␊ Ryū's d2s test SmallIntegers: 8388608.0e+3 is 8.388608E9 in Ryū's notation. 1 value
000144 ryu/SmallIntegers/6.7108864E10 Ryū’s tests 67108864000␊ Ryū's d2s test SmallIntegers: 67108864.0e+3 is 6.7108864E10 in Ryū's notation. 1 value
000145 ryu/SmallIntegers/5.36870912E11 Ryū’s tests 536870912000␊ Ryū's d2s test SmallIntegers: 536870912.0e+3 is 5.36870912E11 in Ryū's notation. 1 value
000146 ryu/SmallIntegers/8.589934592E12 Ryū’s tests 8589934592000␊ Ryū's d2s test SmallIntegers: 8589934592.0e+3 is 8.589934592E12 in Ryū's notation. 1 value
000147 ryu/SmallIntegers/6.8719476736E13 Ryū’s tests 68719476736000␊ Ryū's d2s test SmallIntegers: 68719476736.0e+3 is 6.8719476736E13 in Ryū's notation. 1 value
000148 ryu/SmallIntegers/5.49755813888E14 Ryū’s tests 549755813888000␊ Ryū's d2s test SmallIntegers: 549755813888.0e+3 is 5.49755813888E14 in Ryū's notation. 1 value
000149 ryu/SmallIntegers/8.796093022208E15 Ryū’s tests 8796093022208000␊ Ryū's d2s test SmallIntegers: 8796093022208.0e+3 is 8.796093022208E15 in Ryū's notation. 1 value
000150 ryu/SmallIntegers/all Ryū’s tests 9007199254740991␊9007199254740992␊1␊12␊123␊1234␊… Every finite value of Ryū's d2s test SmallIntegers, in order. 79 values
000219 regression/integer/0 to 1023 Focused regression 0␊1␊2␊3␊4␊5␊6␊7␊8␊9␊10␊11␊12␊13␊14␊15␊16␊17␊18␊1… 1,024 values
000220 regression/integer/around 2^53 Focused regression 9007199254740928␊9007199254740929␊90071992547409… Every double from 2^53 − 64 to 2^53 + 128: past 2^53 only even integers exist. 129 values
000221 regression/integer/powers of ten Focused regression 1␊10␊100␊1000␊10000␊100000␊1000000␊10000000␊1000… 10^0 to 10^22, all exact in binary. 23 values
000222 regression/integer/2^31 2^32 2^63 2^64 Focused regression 2147483647␊2147483648␊4294967295␊4294967296␊9223… 6 values
000329 regression/json/timestamps Focused regression 1700000000000␊1764115200123␊1764115200.123␊ 3 values
000532 generated/0002 Generated 15971947769323␊-106303␊10240␊-1919354240␊-169669… Seeded random values: integer. 11 values
000539 generated/0009 Generated 23275531␊-5270261995824␊58208159719776␊264914525… Seeded random values: integer. 6 values
000546 generated/0016 Generated 149␊ Seeded random values: integer. 1 value
000559 generated/0030 Generated 8498295064␊ Seeded random values: integer. 1 value
000566 generated/0037 Generated 274086440391␊ Seeded random values: integer. 1 value
000573 generated/0044 Generated 247␊ Seeded random values: integer. 1 value
000580 generated/0051 Generated 29934␊ Seeded random values: integer. 1 value
000587 generated/0058 Generated 0␊-1␊2␊-156578050839␊-62117422655␊-6681346963099… Seeded random values: integer. 6 values
000594 generated/0065 Generated -13131480747␊-7272809252836␊846583␊1191529554186… Seeded random values: integer. 8 values
000601 generated/0072 Generated 637162957072762␊-110464206␊36310598778␊113725132… Seeded random values: integer. 13 values
000608 generated/0079 Generated 0␊3634055674␊-2049371544768␊-44445␊2743256042␊-7… Seeded random values: integer. 60 values
000615 generated/0086 Generated 10872␊2049103812␊-7259␊412830␊-2365␊9746811␊1480… Seeded random values: integer. 48 values
000622 generated/0093 Generated -193344373589041␊1␊ Seeded random values: integer. 2 values
000629 generated/0100 Generated -15472684458741␊ Seeded random values: integer. 1 value
000636 generated/0107 Generated -248␊ Seeded random values: integer. 1 value
000643 generated/0114 Generated 345589␊8511␊-202␊102043␊88987␊45␊12␊-26838638647… Seeded random values: integer. 44 values
000650 generated/0121 Generated 18203838␊ Seeded random values: integer. 1 value
000657 generated/0128 Generated -2014767385697␊-43232948662␊246823780127␊-774␊-8… Seeded random values: integer. 10 values
000664 generated/0135 Generated 25962␊127607␊ Seeded random values: integer. 2 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.