bug-coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] SEQ BUG


From: Andreas Schwab
Subject: Re: [PATCH] SEQ BUG
Date: Fri, 08 Jun 2007 11:55:49 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.97 (gnu/linux)

Pádraig Brady <address@hidden> writes:

> Yes you could use gmp, but for normal uses of `seq`
> you could just use appropriate comparisons?
> How about the following patch, and we can also
> remove the workaround info from the docs.
>
> Pádraig.
>
> --- seq.orig.c  2007-06-08 07:50:24.000000000 +0000
> +++ seq.c       2007-06-08 09:05:23.000000000 +0000
> @@ -357,6 +357,10 @@
>         }
>      }
>
> +  /* perhaps can use nextafterl? */
> +  #define PRECISION 1.0E-15
> +  last.value += step.value + (step.value>0?-PRECISION:PRECISION);

That won't be enough, since the error adds up, so if you have a small
step but a big range you can still overshoot.  And if the error of your
step value is negative you may print more than expected.

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

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