[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] ftoastr: new module, for lossless conversion of floats to sh
From: |
Paul Eggert |
Subject: |
Re: [PATCH] ftoastr: new module, for lossless conversion of floats to short strings |
Date: |
Thu, 18 Nov 2010 09:35:20 -0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.15) Gecko/20101027 Thunderbird/3.0.10 |
On 11/18/10 08:36, Jim Meyering wrote:
> Before I'd looked through the code I started thinking this might
> be useful in avoiding snprintf's unhealthy need to malloc.
> Then I saw that it uses snprintf. Oh well ;-)
There's a comment on how to fix that, for the common cases of
double on float on hosts with IEEE floating point and 64-bit ints.
It's a paper published earlier this year by Florian Loitsch
<http://dx.doi.org/10.1145/1809028.1806623>. Not only would
this fix the malloc problem, it would run rings around sprintf,
performance-wise, on all libc implementations that I know of
that print floating-point numbers accurately.
The idea behind the latest checkin has been in Emacs for years, but the
immediate prompt for it was a bug that I found in coreutils
od, when I attempted to use it to generate floating point
numbers at random (by reading /dev/urandom). The generated numbers
turned out to be non-random, and I tracked it down to a bug
in od. I'll check in a fix to coreutils shortly.
- [PATCH] ftoastr: new module, for lossless conversion of floats to short strings, Paul Eggert, 2010/11/17
- Re: [PATCH] ftoastr: new module, for lossless conversion of floats to short strings, Jim Meyering, 2010/11/18
- Re: [PATCH] ftoastr: new module, for lossless conversion of floats to short strings,
Paul Eggert <=
- Re: ftoastr vs. sprintf, Bruno Haible, 2010/11/18
- Re: [PATCH] ftoastr: new module, for lossless conversion of floats to short strings, Bruno Haible, 2010/11/18
- Re: [PATCH] ftoastr: new module, for lossless conversion of floats to short strings, Bruno Haible, 2010/11/27