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

All 2,018 cases

Case Name Expected Note Size
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
000151 regression/empty Focused regression No values, so no output. 0 values
000152 regression/one half Focused regression 0.5␊ 1 value
000153 regression/one tenth Focused regression 0.1␊ 0.1 isn't exact in binary, but its shortest digits are 1. 1 value
000154 regression/0.1 + 0.2 Focused regression 0.30000000000000004␊ 1 value
000155 regression/one third Focused regression 0.3333333333333333␊ 1 value
000156 regression/two thirds Focused regression 0.6666666666666666␊ 1 value
000157 regression/pi Focused regression 3.141592653589793␊ 1 value
000158 regression/e Focused regression 2.718281828459045␊ 1 value
000159 regression/minus pi Focused regression -3.141592653589793␊ 1 value
000160 regression/threshold/100000000000000000000 Focused regression 100000000000000000000␊ The largest power of ten written out in full. 1 value
000161 regression/threshold/1e+22 Focused regression 1e+22␊ 1 value
000162 regression/threshold/1.5e+21 Focused regression 1.5e+21␊ 1 value
000163 regression/threshold/123000000000000000000 Focused regression 123000000000000000000␊ Three digits, then eighteen zeros. 1 value
000164 regression/threshold/12345678901234567000 Focused regression 12345678901234567000␊ Seventeen digits, then zeros. 1 value
000165 regression/threshold/1e-7 Focused regression 1e-7␊ The largest power of ten written with a negative exponent. 1 value
000166 regression/threshold/0.0000015 Focused regression 0.0000015␊ 1 value
000167 regression/threshold/1.5e-7 Focused regression 1.5e-7␊ 1 value
000168 regression/threshold/0.000001234 Focused regression 0.000001234␊ 1 value
000169 regression/threshold/1.234e-7 Focused regression 1.234e-7␊ 1 value
000170 regression/threshold/-1e+21 Focused regression -1e+21␊ 1 value
000171 regression/threshold/-1e-7 Focused regression -1e-7␊ 1 value
000172 regression/threshold/1e+100 Focused regression 1e+100␊ A three-digit exponent. 1 value
000173 regression/threshold/1e-100 Focused regression 1e-100␊ 1 value
000174 regression/threshold/1.25e-10 Focused regression 1.25e-10␊ 1 value
000175 regression/threshold/2.5e+300 Focused regression 2.5e+300␊ 1 value
000176 regression/threshold/around 1e21 Focused regression 999999999999999700000␊999999999999999900000␊1e+2… 1e21 and the two doubles either side of it. 5 values
000177 regression/threshold/around 1e-6 Focused regression 9.999999999999995e-7␊9.999999999999997e-7␊0.0000… 1e-6 and the two doubles either side of it. 5 values
000178 regression/threshold/around 1e-7 Focused regression 9.999999999999997e-8␊9.999999999999998e-8␊1e-7␊1… 1e-7 and the two doubles either side of it. 5 values
000179 regression/threshold/around 1e20 Focused regression 99999999999999970000␊99999999999999980000␊100000… 1e20 and the two doubles either side of it. 5 values
000180 regression/layout/n=-9 Focused regression 2e-10␊5e-10␊9e-10␊5.6e-10␊1.3e-10␊4.5e-10␊9.87e-… Values 0.d… × 10^-9, with 1, 2, 3 and 17 significant digits. 12 values
000181 regression/layout/n=-8 Focused regression 6e-9␊2e-9␊9e-9␊3.3e-9␊2.3e-9␊9.9e-9␊7.82e-9␊5.65… Values 0.d… × 10^-8, with 1, 2, 3 and 17 significant digits. 12 values
000182 regression/layout/n=-7 Focused regression 3e-8␊8e-8␊4e-8␊3.6e-8␊3.7e-8␊2.3e-8␊3.85e-8␊7.39… Values 0.d… × 10^-7, with 1, 2, 3 and 17 significant digits. 12 values
000183 regression/layout/n=-6 Focused regression 8e-7␊6e-7␊7e-7␊4.3e-7␊6.9e-7␊1.8e-7␊7.93e-7␊8.31… Values 0.d… × 10^-6, with 1, 2, 3 and 17 significant digits. 12 values
000184 regression/layout/n=-5 Focused regression 0.000008␊0.000006␊0.000008␊0.0000074␊0.0000091␊0… Values 0.d… × 10^-5, with 1, 2, 3 and 17 significant digits. 12 values
000185 regression/layout/n=-4 Focused regression 0.00002␊0.00001␊0.00005␊0.000041␊0.000097␊0.0000… Values 0.d… × 10^-4, with 1, 2, 3 and 17 significant digits. 12 values
000186 regression/layout/n=-3 Focused regression 0.0007␊0.0006␊0.0009␊0.00058␊0.00079␊0.00017␊0.0… Values 0.d… × 10^-3, with 1, 2, 3 and 17 significant digits. 12 values
000187 regression/layout/n=-2 Focused regression 0.008␊0.002␊0.003␊0.0094␊0.0024␊0.0018␊0.00322␊0… Values 0.d… × 10^-2, with 1, 2, 3 and 17 significant digits. 12 values
000188 regression/layout/n=-1 Focused regression 0.03␊0.02␊0.09␊0.093␊0.044␊0.091␊0.0658␊0.0838␊0… Values 0.d… × 10^-1, with 1, 2, 3 and 17 significant digits. 12 values
000189 regression/layout/n=0 Focused regression 0.7␊0.2␊0.8␊0.45␊0.45␊0.57␊0.691␊0.672␊0.451␊0.6… Values 0.d… × 10^0, with 1, 2, 3 and 17 significant digits. 12 values
000190 regression/layout/n=1 Focused regression 4␊3␊6␊4.6␊8.4␊4.8␊1.05␊1.67␊5.11␊1.1738859224010… Values 0.d… × 10^1, with 1, 2, 3 and 17 significant digits. 12 values
000191 regression/layout/n=2 Focused regression 80␊60␊70␊13␊81␊28␊36.8␊65.3␊39.2␊89.978030694591… Values 0.d… × 10^2, with 1, 2, 3 and 17 significant digits. 12 values
000192 regression/layout/n=3 Focused regression 200␊200␊900␊750␊710␊930␊224␊781␊352␊286.45787693… Values 0.d… × 10^3, with 1, 2, 3 and 17 significant digits. 12 values
000193 regression/layout/n=4 Focused regression 6000␊2000␊2000␊8600␊5400␊2800␊5850␊6890␊3860␊370… Values 0.d… × 10^4, with 1, 2, 3 and 17 significant digits. 12 values
000194 regression/layout/n=5 Focused regression 50000␊10000␊60000␊54000␊69000␊29000␊63500␊21200␊… Values 0.d… × 10^5, with 1, 2, 3 and 17 significant digits. 12 values
000195 regression/layout/n=6 Focused regression 400000␊400000␊700000␊750000␊250000␊180000␊291000… Values 0.d… × 10^6, with 1, 2, 3 and 17 significant digits. 12 values
000196 regression/layout/n=7 Focused regression 6000000␊9000000␊6000000␊1600000␊2100000␊5800000␊… Values 0.d… × 10^7, with 1, 2, 3 and 17 significant digits. 12 values
000197 regression/layout/n=8 Focused regression 60000000␊80000000␊60000000␊67000000␊29000000␊940… Values 0.d… × 10^8, with 1, 2, 3 and 17 significant digits. 12 values
000198 regression/layout/n=9 Focused regression 600000000␊400000000␊900000000␊220000000␊12000000… Values 0.d… × 10^9, with 1, 2, 3 and 17 significant digits. 12 values
000199 regression/layout/n=10 Focused regression 4000000000␊3000000000␊2000000000␊6100000000␊7400… Values 0.d… × 10^10, with 1, 2, 3 and 17 significant digits. 12 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.