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
000250 regression/power of two/2^654 to 2^717 Focused regression 7.475102707912205e+196␊1.495020541582441e+197␊2.… Powers of two, where the gap to the next double down is half the gap up. 64 values
000251 regression/power of two/2^718 to 2^781 Focused regression 1.3789130657754968e+216␊2.7578261315509936e+216␊… Powers of two, where the gap to the next double down is half the gap up. 64 values
000252 regression/power of two/2^782 to 2^845 Focused regression 2.5436456424254815e+235␊5.087291284850963e+235␊1… Powers of two, where the gap to the next double down is half the gap up. 64 values
000253 regression/power of two/2^846 to 2^909 Focused regression 4.692198018002938e+254␊9.384396036005875e+254␊1.… Powers of two, where the gap to the next double down is half the gap up. 64 values
000254 regression/power of two/2^910 to 2^973 Focused regression 8.65557759812674e+273␊1.731115519625348e+274␊3.4… Powers of two, where the gap to the next double down is half the gap up. 64 values
000255 regression/power of two/2^974 to 2^1023 Focused regression 1.596672247627776e+293␊3.193344495255552e+293␊6.… Powers of two, where the gap to the next double down is half the gap up. 50 values
000256 regression/power of two/negative Focused regression -5e-324␊-6.4758e-319␊-8.487983164e-314␊-1.112536… 124 values
000257 regression/power of ten/1e-323 to 1e-292 Focused regression 5e-324␊1e-323␊1.5e-323␊9.4e-323␊1e-322␊1.04e-322… The double nearest each power of ten, and the doubles either side of it. 96 values
000258 regression/power of ten/1e-291 to 1e-260 Focused regression 9.999999999999998e-292␊1e-291␊1.0000000000000001… The double nearest each power of ten, and the doubles either side of it. 96 values
000259 regression/power of ten/1e-259 to 1e-228 Focused regression 9.999999999999999e-260␊1e-259␊1.0000000000000002… The double nearest each power of ten, and the doubles either side of it. 96 values
000260 regression/power of ten/1e-227 to 1e-196 Focused regression 9.999999999999998e-228␊1e-227␊1.0000000000000001… The double nearest each power of ten, and the doubles either side of it. 96 values
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

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.