[Top][All Lists]

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

seq problem representing zero

From: Simone Pascarosa
Subject: seq problem representing zero
Date: Sat, 08 Oct 2005 12:23:42 +0200
User-agent: Debian Thunderbird 1.0.2 (X11/20050602)

Hi all,
my name is Simone Pascarosa.
I'm reporting a problem I've found on seq command:

I'm using seq (coreutils) 5.2.1 on an IBook G4 (PowerPC architecture) with Debian GNU/Linux 3.1 "etch", with Linux When I use a non-integer number as increment, seq fails representing the number 0.

For instance:
> seq -3 0.6 1
-1.11022e-16   <==

The number highlighted must be 0, but it is approximated to -1.11022*10^(-16); in fact -0.000000000000000111022 is "almost" 0, but it's not!

Maybe this is just a problem with my math libraries or similar.

The same problems happens when using values:
given k non integer
> seq -(k*n) k x
where n is an integer value and x>-(k*n-1)
(I think) :)

The problem disappears using --format option; for instance:
> seq --format="%1.1f" -6 1.2 1

> seq --format="%1.20f" -6 1.2 1
-0.00000000000000022204   <==

I think it's only a problem with the representation of real numbers, but the output could be unhappy :)

Thanks for your daily job!

Simone Pascarosa
GNU/Linux User Group Perugia

reply via email to

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