Implement ecvt, fcvt, gcvt
Implement POSIX legacy functions ecvt
, fcvt
and gcvt
, see http://pubs.opengroup.org/onlinepubs/7908799/xsh/ecvt.html. ecvt
and fcvt
are implemented basically by picking apart the output of Rust's format!
macro. gcvt
has a simple C implementation taken from musl.
There are quite a few corner cases here, thus the expected output file is pretty large. Turns out this was also a bit of a stress test for printf
's floating point handling, which is why the value is not printed in each output line.
gcvt
is not part of this MR. It should be trivial to implement in C, but I had some trouble getting it to build (probably just need to understand the cbindgen setup etc.).
Edit: got gcvt
to "work", i.e. it is callable but the underlying %.*g
formatting does not currently seem to be supported.
Edit 2: Rebased after 57917c0e fixed the %.*g
issue, gcvt
is now working. printf
still does not like infinity, though.