ftoastr: depend on snprintf, improve comments
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 19 Nov 2010 05:30:29 +0000 (21:30 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 19 Nov 2010 05:31:05 +0000 (21:31 -0800)
* lib/ftoastr.c: Also mention Loitsch's draft.
* lib/ftoastr.h: Require WIDTH to be nonnegative.  This isn't
needed in the current implementation, but it might simplify
speeding up the code later.
* modules/ftoastr: Depend on snprintf; this improves portability.
Suggested by Bruno Haible in the same email.

ChangeLog
lib/ftoastr.c
lib/ftoastr.h
modules/ftoastr

index a1043bd..217fbba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-11-18  Paul Eggert  <eggert@cs.ucla.edu>
 
+       ftoastr: depend on snprintf, improve comments
+       * lib/ftoastr.c: Also mention Loitsch's draft.
+       * lib/ftoastr.h: Require WIDTH to be nonnegative.  This isn't
+       needed in the current implementation, but it might simplify
+       speeding up the code later.
+       * modules/ftoastr: Depend on snprintf; this improves portability.
+       Suggested by Bruno Haible in the same email.
+
        ftoastr: port to hosts lacking strtof and strtold
        Problem reported by Bruno Haible in
        <http://lists.gnu.org/archive/html/bug-gnulib/2010-11/msg00242.html>.
index ddc5251..f747400 100644 (file)
@@ -64,7 +64,8 @@ FTOASTR (char *buf, size_t bufsize, int flags, int width, FLOAT x)
 
      Florian Loitsch, Printing floating-point numbers quickly and accurately
      with integers.  ACM SIGPLAN notices 46, 6 (June 2010), 233-243
-     <http://dx.doi.org/10.1145/1809028.1806623>.  */
+     <http://dx.doi.org/10.1145/1809028.1806623>; also see the
+     2010-03-21 draft <http://florian.loitsch.com/tmp/article.pdf>.  */
 
   char format[sizeof "%-+ 0*.*Lg"];
   FLOAT abs_x = x < 0 ? -x : x;
index 4c4f890..fd7a802 100644 (file)
@@ -26,8 +26,8 @@
 /* Store into BUF (of size BUFSIZE) an accurate minimal-precision
    string representation of a floating point number.  FLAGS affect the
    formatting of the number.  Pad the output string with spaces as
-   necessary to width WIDTH bytes, in the style of printf.  X is the
-   floating-point number to be converted.
+   necessary to width WIDTH bytes, in the style of printf.  WIDTH must
+   be nonnegative.  X is the floating-point number to be converted.
 
    Return the number of bytes stored into BUF, not counting the
    terminating null.  However, do not overrun BUF: if BUF is too
index 64d0a77..862fb1a 100644 (file)
@@ -10,6 +10,7 @@ m4/c-strtod.m4
 
 Depends-on:
 intprops
+snprintf
 
 configure.ac:
 AC_REQUIRE([gl_C99_STRTOLD])