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, _("\
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils