bug-coreutils
[Top][All Lists]
Advanced

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

Re: SEQ BUG


From: Micah Cowan
Subject: Re: SEQ BUG
Date: Thu, 07 Jun 2007 13:04:44 -0700
User-agent: Thunderbird 1.5.0.12 (X11/20070604)

Patrick Amstutz wrote:
> Hi,
> 
> I've the following behavior with the seq function on:
> 
> Linux version 2.6.18.8-0.3-default (address@hidden) (gcc version
> 4.1.220061115 (prerelease) (SUSE Linux)) #1
> 
> $ echo `seq 0.0 0.1 0.8`
> 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8
> $ echo `seq 0.0 0.1 0.9`
> 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8

Actually, not a bug. This behavior is described in the info manual
("info seq" or "info coreutils seq"), and has to do with the limitations
of binary floating point types; look for the line starting "Be careful
when using `seq' with a fractional INCREMENT".

You need to use something more like:
$ echo `seq 0.0 0.1 0.91`
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9

-- 
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/





reply via email to

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