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

312 of 2,018 cases

Case Name Expected Note Size
000261 regression/power of ten/1e-195 to 1e-164 Focused regression 9.999999999999999e-196␊1e-195␊1.0000000000000003… The double nearest each power of ten, and the doubles either side of it. 96 values
000262 regression/power of ten/1e-163 to 1e-132 Focused regression 9.999999999999998e-164␊1e-163␊1.0000000000000001… The double nearest each power of ten, and the doubles either side of it. 96 values
000263 regression/power of ten/1e-131 to 1e-100 Focused regression 9.999999999999999e-132␊1e-131␊1.0000000000000001… The double nearest each power of ten, and the doubles either side of it. 96 values
000264 regression/power of ten/1e-99 to 1e-68 Focused regression 9.999999999999998e-100␊1e-99␊1.0000000000000002e… The double nearest each power of ten, and the doubles either side of it. 96 values
000265 regression/power of ten/1e-67 to 1e-36 Focused regression 9.999999999999998e-68␊1e-67␊1.0000000000000001e-… The double nearest each power of ten, and the doubles either side of it. 96 values
000266 regression/power of ten/1e-35 to 1e-4 Focused regression 9.999999999999999e-36␊1e-35␊1.0000000000000001e-… The double nearest each power of ten, and the doubles either side of it. 96 values
000267 regression/power of ten/1e-3 to 1e28 Focused regression 0.0009999999999999998␊0.001␊0.001000000000000000… The double nearest each power of ten, and the doubles either side of it. 96 values
000268 regression/power of ten/1e29 to 1e60 Focused regression 9.999999999999997e+28␊1e+29␊1.0000000000000001e+… The double nearest each power of ten, and the doubles either side of it. 96 values
000269 regression/power of ten/1e61 to 1e92 Focused regression 9.999999999999998e+60␊1e+61␊1.0000000000000001e+… The double nearest each power of ten, and the doubles either side of it. 96 values
000270 regression/power of ten/1e93 to 1e124 Focused regression 9.999999999999999e+92␊1e+93␊1.0000000000000002e+… The double nearest each power of ten, and the doubles either side of it. 96 values
000271 regression/power of ten/1e125 to 1e156 Focused regression 9.999999999999997e+124␊1e+125␊1.0000000000000001… The double nearest each power of ten, and the doubles either side of it. 96 values
000272 regression/power of ten/1e157 to 1e188 Focused regression 9.999999999999998e+156␊1e+157␊1.0000000000000001… The double nearest each power of ten, and the doubles either side of it. 96 values
000273 regression/power of ten/1e189 to 1e220 Focused regression 9.999999999999999e+188␊1e+189␊1.0000000000000001… The double nearest each power of ten, and the doubles either side of it. 96 values
000274 regression/power of ten/1e221 to 1e252 Focused regression 9.999999999999998e+220␊1e+221␊1.0000000000000002… The double nearest each power of ten, and the doubles either side of it. 96 values
000275 regression/power of ten/1e253 to 1e284 Focused regression 9.999999999999998e+252␊1e+253␊1.0000000000000001… The double nearest each power of ten, and the doubles either side of it. 96 values
000276 regression/power of ten/1e285 to 1e308 Focused regression 9.999999999999998e+284␊1e+285␊1.0000000000000001… The double nearest each power of ten, and the doubles either side of it. 72 values
000277 regression/exponent edge/1 to 64 Focused regression 2.225073858507202e-308␊4.4501477170144023e-308␊4… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000278 regression/exponent edge/65 to 128 Focused regression 4.104536801298377e-289␊8.209073602596752e-289␊8.… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000279 regression/exponent edge/129 to 192 Focused regression 7.57153399146736e-270␊1.5143067982934715e-269␊1.… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000280 regression/exponent edge/193 to 256 Focused regression 1.3967014978599095e-250␊2.793402995719818e-250␊2… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000281 regression/exponent edge/257 to 320 Focused regression 2.576459507838854e-231␊5.152919015677706e-231␊5.… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000282 regression/exponent edge/321 to 384 Focused regression 4.752728915737901e-212␊9.505457831475798e-212␊9.… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000283 regression/exponent edge/385 to 448 Focused regression 8.767237396033614e-193␊1.7534474792067222e-192␊1… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000284 regression/exponent edge/449 to 512 Focused regression 1.6172698447808783e-173␊3.2345396895617556e-173␊… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000285 regression/exponent edge/513 to 576 Focused regression 2.9833362924800834e-154␊5.966672584960165e-154␊5… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000286 regression/exponent edge/577 to 640 Focused regression 5.50328410731896e-135␊1.1006568214637917e-134␊1.… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000287 regression/exponent edge/641 to 704 Focused regression 1.01517673492626e-115␊2.0303534698525192e-115␊2.… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000288 regression/exponent edge/705 to 768 Focused regression 1.8726705418768797e-96␊3.7453410837537582e-96␊3.… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000289 regression/exponent edge/769 to 832 Focused regression 3.454467422037779e-77␊6.908934844075555e-77␊6.90… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000290 regression/exponent edge/833 to 896 Focused regression 6.37236764452981e-58␊1.2744735289059617e-57␊1.27… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000291 regression/exponent edge/897 to 960 Focused regression 1.1754943508222878e-38␊2.3509887016445748e-38␊2.… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000292 regression/exponent edge/961 to 1024 Focused regression 2.1684043449710093e-19␊4.3368086899420173e-19␊4.… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000293 regression/exponent edge/1025 to 1088 Focused regression 4.000000000000001␊7.999999999999999␊7.9999999999… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000294 regression/exponent edge/1089 to 1152 Focused regression 73786976294838220000␊147573952589676400000␊14757… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000295 regression/exponent edge/1153 to 1216 Focused regression 1.3611294676837542e+39␊2.7222589353675074e+39␊2.… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000296 regression/exponent edge/1217 to 1280 Focused regression 2.510840694154673e+58␊5.021681388309344e+58␊5.02… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000297 regression/exponent edge/1281 to 1344 Focused regression 4.631683569492649e+77␊9.263367138985295e+77␊9.26… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000298 regression/exponent edge/1345 to 1408 Focused regression 8.543948143683642e+96␊1.7087896287367279e+97␊1.7… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000299 regression/exponent edge/1409 to 1472 Focused regression 1.5760802478557795e+116␊3.152160495711558e+116␊3… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000300 regression/exponent edge/1473 to 1536 Focused regression 2.907354897182428e+135␊5.8147097943648545e+135␊5… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000301 regression/exponent edge/1537 to 1600 Focused regression 5.36312317197704e+154␊1.0726246343954076e+155␊1.… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000302 regression/exponent edge/1601 to 1664 Focused regression 9.893216058924184e+173␊1.978643211784836e+174␊1.… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000303 regression/exponent edge/1665 to 1728 Focused regression 1.8249762470488785e+193␊3.6499524940977558e+193␊… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000304 regression/exponent edge/1729 to 1792 Focused regression 3.36648697699096e+212␊6.732973953981917e+212␊6.7… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000305 regression/exponent edge/1793 to 1856 Focused regression 6.210072369202837e+231␊1.242014473840567e+232␊1.… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000306 regression/exponent edge/1857 to 1920 Focused regression 1.1455561567389987e+251␊2.2911123134779966e+251␊… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000307 regression/exponent edge/1921 to 1984 Focused regression 2.1131781245426615e+270␊4.2263562490853215e+270␊… For each biased exponent: the significands 1, all ones, and all ones but the last. 192 values
000308 regression/exponent edge/1985 to 2046 Focused regression 3.8981256045600005e+289␊7.796251209119998e+289␊7… For each biased exponent: the significands 1, all ones, and all ones but the last. 186 values
000309 regression/tie/2^50 + j + 1/4 and 3/4 Focused regression 1125899906842624.2␊1125899906842624.8␊1125899906… Each is exactly halfway between two shortest candidates; the even last digit wins. 136 values
000310 regression/tie/found at random Focused regression 577443370697569.8␊1201643280559612.2␊17073344397… 256 random doubles whose shortest digits are a tie, found by search: about 1 in 1,700 is. 256 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.