Re: [sqlite] Use David Gay's fast & accurate strtod?

2012-02-21 Thread Bob Burger
> The license for David Gay's dtoa.c is not compatible with SQLite.

Thanks for checking into it, and I'm very sorry to hear it's incompatible. Our 
software uses the SQLite binary interface to bind parameters in most cases, but 
there are a few occasions when users specify queries in text.

What would you think of providing a configuration option for SQLite to use the 
strtod C library function?

Bob
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Use David Gay's fast & accurate strtod?

2012-02-21 Thread Bob Burger
On 1 Nov 2011, Richard Hipp wrote:
> Floating-point numbers are approximations.  There is no way to represent
> 290.08 or 6.97 or 283.11 in binary.  The closest  you can get to these
> numbers using IEEE doubles is:

>  290.079998408384271897375583648681640625
>  6.96975131004248396493494510650634765625
>  283.11000136424205265939235687255859375

> And to compound the difficulty, SQLite does not attempt to get that close,
> as doing so requires infinite-precision integer math in the worst case and
> a noticeable performance hit.  SQLite, therefore, goes for a rougher
> approximation and settles for 14 significant digits.

Are you familiar with David Gay's fast, accurate & free strtod
implementation (http://www.netlib.org/fp/dtoa.c)? It should be as fast
as the SQLite implementation in util.c for strings with fewer than 9
digits, and it will always return the correctly rounded result.

Having the text parser accurately handle floating-point input is
important to my company. I have permission to donate my time to
integrate his code and provide a suite of test cases, if you're
interested.

Sincerely,
Bob Burger
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users