summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1996-04-07 16:59:12 +0000
committerJim Meyering <jim@meyering.net>1996-04-07 16:59:12 +0000
commit45c51b256aa11649a0598d4a5302d304087a5d19 (patch)
tree79cba91c1342c9b96f5c7a971649c12548eb99dd
parentc1505fc01f46bdb0e4f6e719a05b7cccf40c53e2 (diff)
downloadcoreutils-45c51b256aa11649a0598d4a5302d304087a5d19.tar.xz
(main): Rearrange loops to get it right.
Reported by Karl Eichwalder <ke@ke.Central.DE>.
-rw-r--r--src/seq.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/seq.c b/src/seq.c
index 3cddcca58..c8997ce5c 100644
--- a/src/seq.c
+++ b/src/seq.c
@@ -399,15 +399,16 @@ print_numbers (const char *format_str)
/* NOTREACHED */
}
+ printf (format_str, first);
for (i = 0; /* empty */; i++)
{
double x = first + i * step;
- printf (format_str, x);
- if (x <= last)
+ if (x < last)
break;
fputs (separator, stdout);
+ printf (format_str, x);
}
}
else
@@ -421,15 +422,16 @@ print_numbers (const char *format_str)
/* NOTREACHED */
}
- for (i = 0; /* empty */; i++)
+ printf (format_str, first);
+ for (i = 1; /* empty */; i++)
{
double x = first + i * step;
- printf (format_str, x);
- if (x >= last)
+ if (x > last)
break;
fputs (separator, stdout);
+ printf (format_str, x);
}
}
fputs (terminator, stdout);