Subject: bug#12959: Aw: bug#12959: "seq -w -1e-3 9" misaligned

From: "Marcel Böhme" <[email-masked]>
Date: Fri, 23 Nov 2012 05:23:21 +0100 (CET)

Hi Pádraig,

The problem seems to be related to the computation of ret.width for arguments with exponent in method scan_arg. Apparently, the ret.precision is handled in the presence of an exponent while the ret.width is not.

More evidence:
$ seq -w 1e3 1e5 | head -2
1000
1001
$ seq -w 1e3 1e5 | tail -2
99999
100000

$ seq -w -1e-1 1
-00.1
000.9
$ seq -w -0.1 1
-0.1
00.9

Thanks!

Best regards,
 Marcel

On 11/22/2012 11:58 AM, Pádraig Brady wrote:

On 11/22/2012 10:49 AM, Marcel Böhme wrote:
> Hi,
>
> While the output of (1) "seq -w -1e-2 9" prints the width as expected, the output of (2) "seq -w -1e-3 9" does not:
> (1) vs. (2)
> -0.01 | -0.001
> 00.99 | 0.999
> 01.99 | 1.999
> 02.99 | 2.999
> 03.99 | 3.999
> 04.99 | 4.999
> 05.99 | 5.999
> 06.99 | 6.999
> 07.99 | 7.999
> 08.99 | 8.999
>
> Similarly, see "seq -w -1e2 -98" vs. "seq -w -1e3 -998".
>
> Can you kindly confirm that the bug was introduced 4 years ago in the following commit: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=86e4b778b148bdd82395fdc312ce8d937f303e33

Confirmed:

$ ~/git/coreutils/src/seq -w -1e-3 1
-0.001
0.999

$ ~/git/coreutils/src/seq -w -.001 1
-0.001
00.999

I'll have a look.

thanks,
Pádraig.