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