From 8a55f06f1878e987d1b3d0b09a74d58291c33887 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 3 Nov 2007 02:32:37 +0000 Subject: [PATCH] Use isfinite, round modules from gnulib. --- ChangeLog | 4 ++++ Smake | 2 ++ src/data/ChangeLog | 9 +++++++++ src/data/data-out.c | 15 ++------------- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 853b0724..5768f68b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-11-02 Ben Pfaff + + * Smake (GNULIB_MODULES): Add isfinite, round modules. + 2007-10-12 Ben Pfaff Use trunc module from gnulib instead of our home-grown solution. diff --git a/Smake b/Smake index d2dc497a..aaf1ff90 100644 --- a/Smake +++ b/Smake @@ -24,6 +24,7 @@ GNULIB_MODULES = \ getopt \ gettext-h \ gettimeofday \ + isfinite \ intprops \ inttostr \ linebreak \ @@ -42,6 +43,7 @@ GNULIB_MODULES = \ printf-safe \ progname \ relocatable-prog \ + round \ snprintf \ snprintf-posix \ sprintf-posix \ diff --git a/src/data/ChangeLog b/src/data/ChangeLog index ad2d8287..6f116701 100644 --- a/src/data/ChangeLog +++ b/src/data/ChangeLog @@ -1,3 +1,12 @@ +2007-11-02 Ben Pfaff + + * data-out.c (output_number): Use isfinite (from C99) instead of + gsl_isfinite, since we now have universal support for it in + gnulib. + (output_infinite): Ditto. + [!HAVE_ROUND] (round): Remove definition, since we now have a + replacement in gnulib. + 2007-10-27 John Darrington * dictionary.c: Fixed bug in dict_clone, where the vardict.dict member diff --git a/src/data/data-out.c b/src/data/data-out.c index 8091cefd..967f57ed 100644 --- a/src/data/data-out.c +++ b/src/data/data-out.c @@ -24,7 +24,6 @@ #include #include #include -#include #include "calendar.h" #include "format.h" @@ -150,7 +149,7 @@ output_number (const union value *input, const struct fmt_spec *format, if (number == SYSMIS) output_missing (format, output); - else if (!gsl_finite (number)) + else if (!isfinite (number)) output_infinite (number, format, output); else { @@ -710,16 +709,6 @@ output_scientific (double number, const struct fmt_spec *format, return true; } -#ifndef HAVE_ROUND -/* Return X rounded to the nearest integer, - rounding ties away from zero. */ -static double -round (double x) -{ - return x >= 0.0 ? floor (x + .5) : ceil (x - .5); -} -#endif /* !HAVE_ROUND */ - /* Returns true if the magnitude represented by R should be rounded up when chopped off at DECIMALS decimal places, false if it should be rounded down. */ @@ -948,7 +937,7 @@ power256 (int x) static void output_infinite (double number, const struct fmt_spec *format, char *output) { - assert (!gsl_finite (number)); + assert (!isfinite (number)); if (format->w >= 3) { -- 2.30.2