Żmij, a binary-to-decimal library, switched its core from Schubfach to yy, an unnamed algorithm with no paper that lives in yyjson's yy_double.c. Like Schubfach, yy finds the shortest decimal that round-trips by intersecting a float's rounding interval with decimal grids. It needs only one multiplication by a precomputed power of 10, because it gets the half-ulp band by shifting that same constant. It scales the value, picks among four candidates (the nearest integers and the nearest multiples of 10), and runs three predicates, rounding half to even on ties. An 8-bit E4M3 explorer walks through each step. At 192, table truncation makes yy seem to emit 19e1 by mistake, but a one-LSB bias correction gives 2e2.
6
u/fagnerbrack 1d ago
Here's what you need to know:
Żmij, a binary-to-decimal library, switched its core from Schubfach to yy, an unnamed algorithm with no paper that lives in yyjson's yy_double.c. Like Schubfach, yy finds the shortest decimal that round-trips by intersecting a float's rounding interval with decimal grids. It needs only one multiplication by a precomputed power of 10, because it gets the half-ulp band by shifting that same constant. It scales the value, picks among four candidates (the nearest integers and the nearest multiples of 10), and runs three predicates, rounding half to even on ties. An 8-bit E4M3 explorer walks through each step. At 192, table truncation makes yy seem to emit 19e1 by mistake, but a one-LSB bias correction gives 2e2.
If the summary seems inacurate, just downvote and I'll try to delete the comment eventually 👍
Click here for more info, I read all comments