bug-coreutils
[Top][All Lists]
Advanced

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

Re: seq -w floating point incorrect formating


From: Philip Rowlands
Subject: Re: seq -w floating point incorrect formating
Date: Sat, 14 Feb 2009 01:51:00 +0000 (GMT)
User-agent: Alpine 1.10 (DEB 962 2008-03-14)

On Sat, 14 Feb 2009, Samuel Hap?k wrote:

I think that seq is not behaving correctly on this input:
seq -w 9 0.5 10

I obtain the output:
9.0
9.5
10.0

While I think I should obtain:
09.0
09.5
10.0


 From the info documentation:

`-w'
`--equal-width'
     Print all numbers with the same width, by padding with leading
     zeros.  FIRST, STEP, and LAST should all use a fixed point decimal
     representation.  (To have other kinds of padding, use `--format').

As your example doesn't use a fixed point representation (e.g. seq 9.0 0.5 10.0) the result is undefined. However, the wording is confusing ("should" use? why not "must"?). It would be helpful if seq assumed the ".0" where needed.

Another curious output comes from:

$ seq -w 1 4.5 112
01.0
05.5
10.0
14.5
19.0
23.5
28.0
32.5
37.0
41.5
46.0
50.5
55.0
59.5
64.0
68.5
73.0
77.5
82.0
86.5
91.0
95.5
100.0
104.5
109.0



Cheers,
Phil




reply via email to

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