[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug in seq command?
From: |
Andrew D Jewell |
Subject: |
Re: bug in seq command? |
Date: |
Sun, 23 Jan 2005 11:04:13 -0500 |
Please clear up my misunderstanding, because it seems to me that the
fix is indeed trivial.
Note 1) The million below should, of course, be a parameter
Note 2) I am not allowed to submit patches, so the below must be
taken only as a suggestion.
*** seq.c~ Wed Dec 1 23:45:17 2004
--- seq.c Sun Jan 23 07:55:07 2005
***************
*** 182,192 ****
print_numbers (const char *fmt)
{
double i;
for (i = 0; /* empty */; i++)
{
double x = first + i * step;
! if (step < 0 ? x < last : last < x)
break;
if (i)
fputs (separator, stdout);
--- 182,194 ----
print_numbers (const char *fmt)
{
double i;
+ double delta = step/1000000.0;
+ double nlast = last + delta;
for (i = 0; /* empty */; i++)
{
double x = first + i * step;
! if (step < 0 ? x < nlast : nlast < x)
break;
if (i)
fputs (separator, stdout);
At 10:15 PM -0800 1/21/05, Paul Eggert wrote:
"Luis A. Florit" <address@hidden> writes:
> the output of the command: seq -w 1 0.2 4
is the sequence
1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
Why there is no 4.0 in the last sequence?
Floating point roundoff error. It's documented in the manual.
If you can submit a fix, please do! It would improve seq.
(Warning: it won't be trivial.)
_______________________________________________
Bug-coreutils mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/bug-coreutils