Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> Tom> Oh yeah? Where's the code for this?
> Upstream code is at https://github.com/ulfjack/ryu
> ...
> I attach the patch I've used for testing, which has these changes from
> upstream Ryu:
Thanks. Just scanning through the code quickly, I note that it assumes
IEEE float format, which is probably okay but I suppose we might want
a configure switch to disable it (and revert to platform sprintf).
I couldn't immediately figure out if it's got endianness assumptions;
but even if it does, that'd likely only affect the initial disassembly
of the IEEE format, so probably not a huge deal.
I wonder which variant of the code you were testing (e.g. HAS_UINT128
or not).
There's a pretty large gap between this code and PG coding conventions,
both as to layout and portability rules. I wonder if we'd be better off
to implement the algorithm afresh instead of whacking this particular
code past the point of unrecognizability.
> The regression tests for
> float8 fail of course since Ryu's output format differs (it always
> includes an exponent, but the code for that part can be tweaked without
> touching the main algorithm).
Yeah, one would hope. But I wonder whether it always produces the
same low-order digits, and if not, whether people will complain.
We just had somebody griping about a change in insignificant zeroes
in timestamp output :-(. Still, seems worth further investigation.
regards, tom lane