bug-coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] SEQ BUG


From: Pádraig Brady
Subject: Re: [PATCH] SEQ BUG
Date: Fri, 08 Jun 2007 10:35:53 +0100
User-agent: Thunderbird 1.5.0.8 (X11/20061116)

Pádraig Brady wrote:
> John Cowan wrote:
>> Pádraig Brady scripsit:
>>
>>> The issue and work around are documented in the info page,
>>> but why don't we do the suggestion automatically in code
>>> (using the precision that is automatically worked out already)?
>> That implies using either a fixed-point or a decimal-based floating-point
>> package.  GNU gmp seems to be the obvious candidate.
> 
> 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);
> +
>    if (format_str != NULL && equal_width)
>      {
>        error (0, 0, _("\

Err, the above will break for `seq 0 0.99 1.99`
How about:

--- seq.orig.c  2007-06-08 07:50:24.000000000 +0000
+++ seq.c       2007-06-08 09:34:00.000000000 +0000
@@ -357,6 +357,10 @@
        }
     }

+  /* perhaps can use nextafterl? */
+  #define PRECISION 1.0E-15
+  last.value += (step.value>0?PRECISION:-PRECISION);
+
   if (format_str != NULL && equal_width)
     {
       error (0, 0, _("\





reply via email to

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