pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[formatting i18n 11/14] data-out: Reorganize output_Z() to be more easil


From: Ben Pfaff
Subject: [formatting i18n 11/14] data-out: Reorganize output_Z() to be more easily understood.
Date: Sat, 19 Feb 2011 17:42:23 -0800

It took me a minute to figure out what was going on here, so this commit
slightly reorganizes it.
---
 src/data/data-out.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/data/data-out.c b/src/data/data-out.c
index bb77437..1ed83bc 100644
--- a/src/data/data-out.c
+++ b/src/data/data-out.c
@@ -215,11 +215,9 @@ output_Z (const union value *input, const struct fmt_spec 
*format,
   char buf[128];
   if (input->f == SYSMIS)
     output_missing (format, output);
-  else if (fabs (number) >= power10 (format->w)
-           || sprintf (buf, "%0*.0f", format->w,
-                       fabs (round (number))) != format->w)
-    output_overflow (format, output);
-  else
+  else if (fabs (number) < power10 (format->w)
+           && sprintf (buf, "%0*.0f", format->w,
+                       fabs (round (number))) == format->w)
     {
       if (number < 0 && strspn (buf, "0") < format->w)
         {
@@ -229,6 +227,8 @@ output_Z (const union value *input, const struct fmt_spec 
*format,
       memcpy (output, buf, format->w);
       output[format->w] = '\0';
     }
+  else
+    output_overflow (format, output);
 }
 
 /* Outputs P format. */
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]