GNU bug report logs - #75994
"seq -w" is broken for large enough numbers

Previous Next

Package: coreutils;

Reported by: Alexey Dobriyan <adobriyan <at> gmail.com>

Date: Sat, 1 Feb 2025 17:45:01 UTC

Severity: normal

To reply to this bug, email your comments to 75994 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#75994; Package coreutils. (Sat, 01 Feb 2025 17:45:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alexey Dobriyan <adobriyan <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sat, 01 Feb 2025 17:45:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alexey Dobriyan <adobriyan <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: "seq -w" is broken for large enough numbers
Date: Sat, 1 Feb 2025 20:43:37 +0300
coreutils 9.3, 9.5

Steps to reproduce:

	# 21 digits
	$ seq 111111111111111111111 1 111111111111111111113
	111111111111111111111
	111111111111111111112
	111111111111111111113

	$ seq -w 111111111111111111111 1 111111111111111111113
	111111111111111111112	# what?
	111111111111111111112
	111111111111111111112
	111111111111111111112




Information forwarded to bug-coreutils <at> gnu.org:
bug#75994; Package coreutils. (Sat, 01 Feb 2025 20:02:01 GMT) Full text and rfc822 format available.

Message #8 received at 75994 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Alexey Dobriyan <adobriyan <at> gmail.com>, 75994 <at> debbugs.gnu.org
Subject: Re: bug#75994: "seq -w" is broken for large enough numbers
Date: Sat, 1 Feb 2025 20:01:18 +0000
On 01/02/2025 17:43, Alexey Dobriyan wrote:
> coreutils 9.3, 9.5
> 
> Steps to reproduce:
> 
> 	# 21 digits
> 	$ seq 111111111111111111111 1 111111111111111111113
> 	111111111111111111111
> 	111111111111111111112
> 	111111111111111111113

With no -w, seq doesn't use floating point
and instead operates on the ASCII values directly.

> 
> 	$ seq -w 111111111111111111111 1 111111111111111111113
> 	111111111111111111112	# what?
> 	111111111111111111112
> 	111111111111111111112
> 	111111111111111111112


With -w seq will use long doubles internally,
which usually have a 64 bit significand.
I.e. once you go above 2^64, you get approximations of integers.

Now we could adjust seq to use the "ASCII" increment method
in this case by handling leading zeros appropriately.
It would be good to know your use case here though,
as to know how common this issue might be.

cheers,
Pádraig




Information forwarded to bug-coreutils <at> gnu.org:
bug#75994; Package coreutils. (Sat, 01 Feb 2025 21:23:03 GMT) Full text and rfc822 format available.

Message #11 received at 75994 <at> debbugs.gnu.org (full text, mbox):

From: Alexey Dobriyan <adobriyan <at> gmail.com>
To: Pádraig Brady <P <at> draigbrady.com>
Cc: 75994 <at> debbugs.gnu.org
Subject: Re: bug#75994: "seq -w" is broken for large enough numbers
Date: Sat, 1 Feb 2025 23:34:31 +0300
On Sat, Feb 01, 2025 at 08:01:18PM +0000, Pádraig Brady wrote:
> With -w seq will use long doubles internally,
> which usually have a 64 bit significand.
> I.e. once you go above 2^64, you get approximations of integers.
> 
> Now we could adjust seq to use the "ASCII" increment method
> in this case by handling leading zeros appropriately.
> It would be good to know your use case here though,
> as to know how common this issue might be.

The usecase is using GNU seq as reference implementation. :^)

I'd do decimal fixed point. Given that seq only does addition
it won't be that bad.




Information forwarded to bug-coreutils <at> gnu.org:
bug#75994; Package coreutils. (Sun, 02 Feb 2025 07:29:01 GMT) Full text and rfc822 format available.

Message #14 received at 75994 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Alexey Dobriyan <adobriyan <at> gmail.com>
Cc: Pádraig Brady <P <at> draigbrady.com>, 75994 <at> debbugs.gnu.org
Subject: Re: bug#75994: "seq -w" is broken for large enough numbers
Date: Sat, 1 Feb 2025 23:28:21 -0800
On 2025-02-01 12:34, Alexey Dobriyan wrote:
> I'd do decimal fixed point.

Patches along those lines would be welcome, I expect.




This bug report was last modified 6 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.