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

213 of 2,018 cases

Case Name Expected Note Size
001928 generated/1410 Generated 8.451702349607962e-175␊-4.8130032560993286e-253␊ Seeded random values: any bits. 2 values
001930 generated/1412 Generated 4.79440808029788e-78␊ Seeded random values: any bits. 1 value
001947 generated/1429 Generated 1.3705673403183438e+308␊ Seeded random values: any bits. 1 value
001958 generated/1440 Generated -3.444718453797659e-38␊9.912544183670245e+186␊-1… Seeded random values: any bits. 36 values
001966 generated/1448 Generated -4.257340709000144e+85␊1.3215931293888716e-156␊4… Seeded random values: any bits. 25 values
001971 generated/1453 Generated 1.1574297058536607e+51␊ Seeded random values: any bits. 1 value
001979 generated/1461 Generated 5.034260074152063e-132␊2.408370715731014e-265␊-2… Seeded random values: any bits. 44 values
001987 generated/1469 Generated 1.4528643165881216e+274␊ Seeded random values: any bits. 1 value
001990 generated/1472 Generated -6.398467523618151e-7␊ Seeded random values: any bits. 1 value
001998 generated/1480 Generated -1.0717252023706555e+89␊-2.1414021374272817e+112… Seeded random values: any bits. 16 values
002003 generated/1485 Generated 1.4219135546990705e-96␊-1.2325207010940966e+41␊-… Seeded random values: any bits. 7 values
002005 generated/1487 Generated -2.1329942943648124e-235␊ Seeded random values: any bits. 1 value
002010 generated/1492 Generated -1.02110566411177e-258␊-1.6394666441616558e+195␊… Seeded random values: any bits. 7 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.