DevSolar / pdclib

The Public Domain C Library
https://pdclib.rootdirectory.de
Creative Commons Zero v1.0 Universal
224 stars 41 forks source link

`strtod`: Add basic base-10 parsing #22

Closed glebm closed 5 months ago

glebm commented 6 months ago

Loosely based on the SQLite implementation from:

https://github.com/sqlite/sqlite/blob/6161cdd446eec170f7c0edf58d0d72a2cd3c5f85/src/util.c#L478

Not implemented:

  1. Base 16 parsing.
  2. Setting errno to ERANGE on overflow / underflow.

SQLite is Public Domain.

/cc @JayFoxRox

DevSolar commented 5 months ago

With #cfb71693, I added David M. Gay's dtoa.c to PDCLib, admitting defeat (for now) on the FP conversion front. That should give us strtod() out of the box, with integration into scanf() and printf() the next thing to do. There has not been any detailed testing on the configuration yet, but the weekend is over and I wanted to get this pushed before I return to the 9-to-5 work.