Pádraig Brady <[EMAIL PROTECTED]> 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.


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to