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

34 of 2,018 cases

Case Name Expected Note Size
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
000200 regression/layout/n=11 Focused regression 50000000000␊50000000000␊10000000000␊73000000000␊… Values 0.d… × 10^11, with 1, 2, 3 and 17 significant digits. 12 values
000201 regression/layout/n=12 Focused regression 700000000000␊900000000000␊300000000000␊410000000… Values 0.d… × 10^12, with 1, 2, 3 and 17 significant digits. 12 values
000202 regression/layout/n=13 Focused regression 5000000000000␊2000000000000␊7000000000000␊720000… Values 0.d… × 10^13, with 1, 2, 3 and 17 significant digits. 12 values
000203 regression/layout/n=14 Focused regression 40000000000000␊10000000000000␊60000000000000␊190… Values 0.d… × 10^14, with 1, 2, 3 and 17 significant digits. 12 values
000204 regression/layout/n=15 Focused regression 300000000000000␊400000000000000␊300000000000000␊… Values 0.d… × 10^15, with 1, 2, 3 and 17 significant digits. 12 values
000205 regression/layout/n=16 Focused regression 7000000000000000␊7000000000000000␊80000000000000… Values 0.d… × 10^16, with 1, 2, 3 and 17 significant digits. 12 values
000206 regression/layout/n=17 Focused regression 70000000000000000␊10000000000000000␊600000000000… Values 0.d… × 10^17, with 1, 2, 3 and 17 significant digits. 12 values
000207 regression/layout/n=18 Focused regression 900000000000000000␊800000000000000000␊1000000000… Values 0.d… × 10^18, with 1, 2, 3 and 17 significant digits. 12 values
000208 regression/layout/n=19 Focused regression 2000000000000000000␊6000000000000000000␊20000000… Values 0.d… × 10^19, with 1, 2, 3 and 17 significant digits. 12 values
000209 regression/layout/n=20 Focused regression 80000000000000000000␊30000000000000000000␊400000… Values 0.d… × 10^20, with 1, 2, 3 and 17 significant digits. 12 values
000210 regression/layout/n=21 Focused regression 900000000000000000000␊700000000000000000000␊4000… Values 0.d… × 10^21, with 1, 2, 3 and 17 significant digits. 12 values
000211 regression/layout/n=22 Focused regression 5e+21␊2e+21␊8e+21␊3.9e+21␊2.6e+21␊4.1e+21␊6.45e+… Values 0.d… × 10^22, with 1, 2, 3 and 17 significant digits. 12 values
000212 regression/layout/n=23 Focused regression 1e+22␊4e+22␊9e+22␊7.6e+22␊6.9e+22␊4.1e+22␊1.12e+… Values 0.d… × 10^23, with 1, 2, 3 and 17 significant digits. 12 values
000213 regression/layout/n=24 Focused regression 9e+23␊9e+23␊7e+23␊4.5e+23␊8.6e+23␊2.4e+23␊9.32e+… Values 0.d… × 10^24, 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.