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
000000 rfc8785/zero RFC 8785 Appendix B 0␊ RFC 8785 Appendix B: 0000000000000000 serializes as 0 (Zero). 1 value
000001 rfc8785/minus zero RFC 8785 Appendix B 0␊ RFC 8785 Appendix B: 8000000000000000 serializes as 0 (Minus zero). 1 value
000002 rfc8785/min pos number RFC 8785 Appendix B 5e-324␊ RFC 8785 Appendix B: 0000000000000001 serializes as 5e-324 (Min pos number). 1 value
000003 rfc8785/min neg number RFC 8785 Appendix B -5e-324␊ RFC 8785 Appendix B: 8000000000000001 serializes as -5e-324 (Min neg number). 1 value
000004 rfc8785/max pos number RFC 8785 Appendix B 1.7976931348623157e+308␊ RFC 8785 Appendix B: 7fefffffffffffff serializes as 1.7976931348623157e+308 (Max pos number). 1 value
000005 rfc8785/max neg number RFC 8785 Appendix B -1.7976931348623157e+308␊ RFC 8785 Appendix B: ffefffffffffffff serializes as -1.7976931348623157e+308 (Max neg number). 1 value
000006 rfc8785/max pos int RFC 8785 Appendix B 9007199254740992␊ RFC 8785 Appendix B: 4340000000000000 serializes as 9007199254740992 (Max pos int). 1 value
000007 rfc8785/max neg int RFC 8785 Appendix B -9007199254740992␊ RFC 8785 Appendix B: c340000000000000 serializes as -9007199254740992 (Max neg int). 1 value
000008 rfc8785/~2**68 RFC 8785 Appendix B 295147905179352830000␊ RFC 8785 Appendix B: 4430000000000000 serializes as 295147905179352830000 (~2**68). 1 value
000009 rfc8785/44b52d02c7e14af5 RFC 8785 Appendix B 9.999999999999997e+22␊ RFC 8785 Appendix B: 44b52d02c7e14af5 serializes as 9.999999999999997e+22. 1 value
000010 rfc8785/44b52d02c7e14af6 RFC 8785 Appendix B 1e+23␊ RFC 8785 Appendix B: 44b52d02c7e14af6 serializes as 1e+23. 1 value
000011 rfc8785/44b52d02c7e14af7 RFC 8785 Appendix B 1.0000000000000001e+23␊ RFC 8785 Appendix B: 44b52d02c7e14af7 serializes as 1.0000000000000001e+23. 1 value
000012 rfc8785/444b1ae4d6e2ef4e RFC 8785 Appendix B 999999999999999700000␊ RFC 8785 Appendix B: 444b1ae4d6e2ef4e serializes as 999999999999999700000. 1 value
000013 rfc8785/444b1ae4d6e2ef4f RFC 8785 Appendix B 999999999999999900000␊ RFC 8785 Appendix B: 444b1ae4d6e2ef4f serializes as 999999999999999900000. 1 value
000014 rfc8785/444b1ae4d6e2ef50 RFC 8785 Appendix B 1e+21␊ RFC 8785 Appendix B: 444b1ae4d6e2ef50 serializes as 1e+21. 1 value
000015 rfc8785/3eb0c6f7a0b5ed8c RFC 8785 Appendix B 9.999999999999997e-7␊ RFC 8785 Appendix B: 3eb0c6f7a0b5ed8c serializes as 9.999999999999997e-7. 1 value
000016 rfc8785/3eb0c6f7a0b5ed8d RFC 8785 Appendix B 0.000001␊ RFC 8785 Appendix B: 3eb0c6f7a0b5ed8d serializes as 0.000001. 1 value
000017 rfc8785/41b3de4355555553 RFC 8785 Appendix B 333333333.3333332␊ RFC 8785 Appendix B: 41b3de4355555553 serializes as 333333333.3333332. 1 value
000018 rfc8785/41b3de4355555554 RFC 8785 Appendix B 333333333.33333325␊ RFC 8785 Appendix B: 41b3de4355555554 serializes as 333333333.33333325. 1 value
000019 rfc8785/41b3de4355555555 RFC 8785 Appendix B 333333333.3333333␊ RFC 8785 Appendix B: 41b3de4355555555 serializes as 333333333.3333333. 1 value
000020 rfc8785/41b3de4355555556 RFC 8785 Appendix B 333333333.3333334␊ RFC 8785 Appendix B: 41b3de4355555556 serializes as 333333333.3333334. 1 value
000021 rfc8785/41b3de4355555557 RFC 8785 Appendix B 333333333.33333343␊ RFC 8785 Appendix B: 41b3de4355555557 serializes as 333333333.33333343. 1 value
000022 rfc8785/becbf647612f3696 RFC 8785 Appendix B -0.0000033333333333333333␊ RFC 8785 Appendix B: becbf647612f3696 serializes as -0.0000033333333333333333. 1 value
000023 rfc8785/round to even RFC 8785 Appendix B 1424953923781206.2␊ RFC 8785 Appendix B: 43143ff3c1cb0959 serializes as 1424953923781206.2 (Round to even). 1 value
000024 rfc8785/all samples RFC 8785 Appendix B 0␊0␊5e-324␊-5e-324␊1.7976931348623157e+308␊-1.79… Every finite sample of RFC 8785 Appendix B, in the table's order. 24 values
000025 ryu/Basic/1E0 Ryū’s tests 1␊ Ryū's d2s test Basic: 1.0 is 1E0 in Ryū's notation. 1 value
000026 ryu/Basic/-1E0 Ryū’s tests -1␊ Ryū's d2s test Basic: -1.0 is -1E0 in Ryū's notation. 1 value
000027 ryu/Basic/all Ryū’s tests 0␊0␊1␊-1␊ Every finite value of Ryū's d2s test Basic, in order. 4 values
000028 ryu/SwitchToSubnormal/2.2250738585072014E-308 Ryū’s tests 2.2250738585072014e-308␊ Ryū's d2s test SwitchToSubnormal: 2.2250738585072014E-308 is 2.2250738585072014E-308 in Ryū's notation. 1 value
000029 ryu/MinAndMax/all Ryū’s tests 1.7976931348623157e+308␊5e-324␊ Every finite value of Ryū's d2s test MinAndMax, in order. 2 values
000030 ryu/LotsOfTrailingZeros/2.9802322387695312E-8 Ryū’s tests 2.9802322387695312e-8␊ Ryū's d2s test LotsOfTrailingZeros: 2.98023223876953125E-8 is 2.9802322387695312E-8 in Ryū's notation. 1 value
000031 ryu/Regression/-2.109808898695963E16 Ryū’s tests -21098088986959630␊ Ryū's d2s test Regression: -2.109808898695963E16 is -2.109808898695963E16 in Ryū's notation. 1 value
000032 ryu/Regression/4.940656E-318 Ryū’s tests 4.940656e-318␊ Ryū's d2s test Regression: 4.940656E-318 is 4.940656E-318 in Ryū's notation. 1 value
000033 ryu/Regression/1.18575755E-316 Ryū’s tests 1.18575755e-316␊ Ryū's d2s test Regression: 1.18575755E-316 is 1.18575755E-316 in Ryū's notation. 1 value
000034 ryu/Regression/2.989102097996E-312 Ryū’s tests 2.989102097996e-312␊ Ryū's d2s test Regression: 2.989102097996E-312 is 2.989102097996E-312 in Ryū's notation. 1 value
000035 ryu/Regression/9.0608011534336E15 Ryū’s tests 9060801153433600␊ Ryū's d2s test Regression: 9.0608011534336E15 is 9.0608011534336E15 in Ryū's notation. 1 value
000036 ryu/Regression/4.708356024711512E18 Ryū’s tests 4708356024711512000␊ Ryū's d2s test Regression: 4.708356024711512E18 is 4.708356024711512E18 in Ryū's notation. 1 value
000037 ryu/Regression/9.409340012568248E18 Ryū’s tests 9409340012568248000␊ Ryū's d2s test Regression: 9.409340012568248E18 is 9.409340012568248E18 in Ryū's notation. 1 value
000038 ryu/Regression/1.2345678E0 Ryū’s tests 1.2345678␊ Ryū's d2s test Regression: 1.2345678 is 1.2345678E0 in Ryū's notation. 1 value
000039 ryu/Regression/all Ryū’s tests -21098088986959630␊4.940656e-318␊1.18575755e-316… Every finite value of Ryū's d2s test Regression, in order. 8 values
000040 ryu/LooksLikePow5/5.764607523034235E39 Ryū’s tests 5.764607523034235e+39␊ Ryū's d2s test LooksLikePow5: int64Bits2Double(0x4830F0CF064DD592) is 5.764607523034235E39 in Ryū's notation. 1 value
000041 ryu/LooksLikePow5/1.152921504606847E40 Ryū’s tests 1.152921504606847e+40␊ Ryū's d2s test LooksLikePow5: int64Bits2Double(0x4840F0CF064DD592) is 1.152921504606847E40 in Ryū's notation. 1 value
000042 ryu/LooksLikePow5/2.305843009213694E40 Ryū’s tests 2.305843009213694e+40␊ Ryū's d2s test LooksLikePow5: int64Bits2Double(0x4850F0CF064DD592) is 2.305843009213694E40 in Ryū's notation. 1 value
000043 ryu/LooksLikePow5/all Ryū’s tests 5.764607523034235e+39␊1.152921504606847e+40␊2.30… Every finite value of Ryū's d2s test LooksLikePow5, in order. 3 values
000044 ryu/OutputLength/1.2E0 Ryū’s tests 1.2␊ Ryū's d2s test OutputLength: 1.2 is 1.2E0 in Ryū's notation. 1 value
000045 ryu/OutputLength/1.23E0 Ryū’s tests 1.23␊ Ryū's d2s test OutputLength: 1.23 is 1.23E0 in Ryū's notation. 1 value
000046 ryu/OutputLength/1.234E0 Ryū’s tests 1.234␊ Ryū's d2s test OutputLength: 1.234 is 1.234E0 in Ryū's notation. 1 value
000047 ryu/OutputLength/1.2345E0 Ryū’s tests 1.2345␊ Ryū's d2s test OutputLength: 1.2345 is 1.2345E0 in Ryū's notation. 1 value
000048 ryu/OutputLength/1.23456E0 Ryū’s tests 1.23456␊ Ryū's d2s test OutputLength: 1.23456 is 1.23456E0 in Ryū's notation. 1 value
000049 ryu/OutputLength/1.234567E0 Ryū’s tests 1.234567␊ Ryū's d2s test OutputLength: 1.234567 is 1.234567E0 in Ryū's notation. 1 value

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.