bug-coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] SEQ BUG


From: Paul Eggert
Subject: Re: [PATCH] SEQ BUG
Date: Wed, 13 Jun 2007 09:08:26 -0700
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Pádraig Brady <address@hidden> writes:

> This patch makes `seq 0.1 0.1 0.9` output 0.1 to 0.9 inclusive, as expected.

I see some problems with that patch.

First, it continues to mishandle some similar cases.  For example,
'seq 0.1 1e-1 0.9' outputs only 0.1 through 0.8, i.e. it behaves
differently from 'seq 0.1 0.1 0.9', which is counterintutive.  I can
easily see getting some bug reports about that.

Second, it mishandles some cases that the current code handles
correctly.  For example, on my platform (Debian stable x86 with GCC
4.2) 'seq 922337203685477580.4 0.1 922337203685477580.5' currently
outputs this:

922337203685477580.4
922337203685477580.5

which is correct, but with the proposed patch it outputs this:

922337203685477580.4
922337203685477580.5
922337203685477580.6

due to rounding errors in 'long double' arithmetic (which uses a 64
bit fraction on my platform).

The "right" way to address this problem is to use arbitrary-precision
decimal arithmetic.  By comparison, fiddling with fixed-width IEEE
binary formats is problematic; it may fix some cases but it'll
probably introduce other problems and it'll make it harder to explain
the inevitable quirks.




reply via email to

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