[Bug 1799868] Re: seq command has problems near its max integer

C de-Avillez hggdh2 at ubuntu.com
Mon Oct 29 22:52:47 UTC 2018


Hello Kevin, and thank you for opening this bug and helping make Ubuntu
better.

The info page for seq (info seq) has the following note:

" On most systems, seq can produce whole-number output for values up to
at least 2^{53}.  Larger integers are approximated.  The details differ
depending on your floating-point implementation.  *Note Floating
point::.  A common case is that ‘seq’ works with integers through
2^{64}, and larger integers may not be numerically correct:

     $ seq 50000000000000000000 2 50000000000000000004
     50000000000000000000
     50000000000000000000
     50000000000000000004

   However, note that when limited to non-negative whole numbers, an
increment of 1 and no format-specifying option, seq can print
arbitrarily large numbers.

   Be careful when using ‘seq’ with outlandish values: otherwise you may
see surprising results, as ‘seq’ uses floating point internally.  For
example, on the x86 platform, where the internal representation uses a
64-bit fraction, the command:

     seq 1 0.0000000000000000001 1.0000000000000000009

   outputs 1.0000000000000000007 twice and skips 1.0000000000000000008."

Now, 2^64 is 18446744073709551616, which is *much* smaller than the
values you are using. So... you are in the boundary of the map, where it
is written "here be dragons."

I ran 'seq' with your initial value, and increment of 1, and varying
end-values, all larger than the initial value. All seemed to work
correctly. But the moment I changed the increment... things went south
very fast (including what seemed as an infinite loop, with 'seq'
outputting the same value over and over).

I am in a mind of closing this bug INVALID, but wanted to have your
input before that.

Thank you.

** Changed in: coreutils (Ubuntu)
       Status: New => Incomplete

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to coreutils in Ubuntu.
https://bugs.launchpad.net/bugs/1799868

Title:
  seq command has problems near its max integer

Status in coreutils package in Ubuntu:
  Incomplete

Bug description:
  I can use seq(1) to generate sequences of large numbers if I use the
  default increment:

  $ seq 170141183460469231731687303715884105721 170141183460469231731687303715884105725
  170141183460469231731687303715884105721
  170141183460469231731687303715884105722
  170141183460469231731687303715884105723
  170141183460469231731687303715884105724
  170141183460469231731687303715884105725
  $

  However, if I use an increment of 2 (which should stop 2 short of the max int,) it starts with the max integer+1 (2^127) and outputs it forever:
  $ seq 170141183460469231731687303715884105721 2 170141183460469231731687303715884105725 | less
  170141183460469231731687303715884105728
  170141183460469231731687303715884105728
  170141183460469231731687303715884105728
  170141183460469231731687303715884105728
  .
  .
  .

  ProblemType: Bug
  DistroRelease: Ubuntu 18.04
  Package: coreutils 8.28-1ubuntu1
  ProcVersionSignature: Ubuntu 4.15.0-36.39-generic 4.15.18
  Uname: Linux 4.15.0-36-generic x86_64
  NonfreeKernelModules: nvidia_modeset nvidia
  ApportVersion: 2.20.9-0ubuntu7.4
  Architecture: amd64
  CurrentDesktop: ubuntu:GNOME
  Date: Wed Oct 24 20:17:15 2018
  SourcePackage: coreutils
  UpgradeStatus: Upgraded to bionic on 2018-08-19 (66 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/1799868/+subscriptions



More information about the foundations-bugs mailing list