bug-sh-utils
[Top][All Lists]
Advanced

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

sh-util-2.0 seq Bug


From: Juergen Salk
Subject: sh-util-2.0 seq Bug
Date: Fri, 14 Sep 2001 23:15:16 +0200
User-agent: Mutt/1.2.5i

I have observed an unexpected behavior in seq(1),
that is related to the general lack of absolute accuracy 
of floating point values.

The seq output may vary with different systems or compilers
and does not always print all numbers from FIRST to LAST.

Here is a screen dump on Linux-2.2.19 (i386):

address@hidden:~ > seq -s " " 0 .1 1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
address@hidden:~ > seq -s " " 0 .1 1.1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1
address@hidden:~ > seq -s " " 0 .1 1.2
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1
address@hidden:~ > seq -s " " 0 .1 1.3
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2
address@hidden:~ > seq -s " " 0 .1 1.4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3

And this is a screen dump on Solaris 8 (sparc)
lyra$ seq -s " " 0 .1 1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
lyra$ seq -s " " 0 .1 1.1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1
lyra$ seq -s " " 0 .1 1.2
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1
lyra$ seq -s " " 0 .1 1.3
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3
lyra$ seq -s " " 0 .1 1.4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3

Please find attached a suggested patch (unified diff) to 
overcome this problem.

Best regards - Juergen Salk

Attachment: seq.patch
Description: Text document


reply via email to

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