Re: floats truncated by strtod() if decimal point character differs
David Christensen <[email protected]> Wed, 18 Sep 2019 09:52:03 -0500
| Newsgroups | gmane.comp.db.postgresql.dbdpg |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail=_223A21B6-F86A-41FC-9148-90AA6F3CB175 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Sep 18, 2019, at 1:07 AM, Noah Misch <[email protected]> wrote: >=20 > On Tue, Sep 17, 2019 at 02:59:33PM +0200, Michael Weiser wrote: >> On Mon, Sep 02, 2019 at 10:06:00AM -0700, Noah Misch wrote: >>>> What are your >>>> thoughts on this, particularly license-wise where to grab an >>>> implementation from (BSD?)? >>> BSD is a good bet. More often than not, I use NetBSD as a source of = library >>> code like this. >>=20 >> I've finally had some time to look into this. The NetBSD as well as >> glibc implementations of strtod() are huge. Duplicating them in = DBD::Pg >> just for this single call would be a nightmare IMO. >=20 > That is unfortunate. How huge? >=20 >> I did however stumble across strtod_l() which takes a locale as a = third >> argument. >=20 > That function is not portable enough: > https://www.gnu.org/software/gnulib/manual/html_node/strtod_005fl.html This code claims to be in the public domain; no idea if it=E2=80=99s any = good, but looks like a reasonable size at least: https://gist.github.com/mattn/1890186 --Apple-Mail=_223A21B6-F86A-41FC-9148-90AA6F3CB175 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEECKA1l4YEfF4eK4/eN0ojyd+bZbgFAl2CRJQACgkQN0ojyd+b ZbjagQ/7BpHdFCesUvrv5JBTjpQo4PWLT3k6kBAiff9gpMcqRWWNyRW+Udrq0BVC kMc/g4AsFyXzo12Kgv0jAnyumiUHuByrMvmJdWtxt9IQCSkUT6GUTdtATFdee88Y vGIeYbgwiFxRtLW2bc9caMXhQxhAZgtMzJCpMjpCSH3FS5y/cQHpIltWMDjziPlN HSGOEce/gCsBvs+GrkuhWOkjv3cTLKM2ANTiUH4vnblqrC4Fc/92Jh+cUloi2AbM tJUbPtMbY2VQwdV+1+uUIusGeg+IjP1/yZh7LvehRAITwoOKl2GF6hB4E+2ttMjc mGOyutyCR4cNnHbiHy3T2Luol9d6w/TraHi8ZlkVTJnqINnB7coksYMqlskF3kam 2DijHE9bBdYoQphUvc/y7AmrqZ0YJ7/Tw1qP/MiXHQyZNaLYoyonFEnlYRSi0Em6 oHS9DiipYeA+ZR/zKT/o+clBlL0QCCr4ue2Zl4Yk6NojjRNDntVo24gTttPJlS4e olBeKxVpsuN66Z7ybDgv/Oz9rQEQjzH+qtblg0mdoHrWf6izdMhz+4SPbYIZ7bI6 kIC0wpQqP74+ElmFDgWTcy9J4KUN/zK41r0+1rEpIgzA6qViqeYAA8lX5JmJAA1p BQZxbM8MmGrdTPLdteCcq/otAXY09v8XAF82un8+burJMl1CnHA= =S1bJ -----END PGP SIGNATURE----- --Apple-Mail=_223A21B6-F86A-41FC-9148-90AA6F3CB175--