Pádraig Brady wrote:

> Another thing I just noticed. I would expect the precision
> of all output in the following command to be to 2 decimal places not 1:
> 
> $ seq 0.00 0.01 0.90 | grep "\.[0-9]$"
> 0.1
> 0.2
> 0.3
> 0.4
> 0.5
> 0.6
> 0.7
> 0.8
> 0.9

I wouldn't. The documentation is fairly clear that the '%g' specifier is
what gets used by default. If you want something else, you need to
specify the format via the -f option; for example:

$ seq  -f %.2f 0.00 0.01 0.90| grep "\.[0-9]0$"
0.00
0.10
0.20
0.30
0.40
0.50
0.60
0.70
0.80
0.90

In any case, I think John's advice is wisest: don't use floating point
math for iteration. These are exactly the sorts of troubles you get when
doing so.

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



_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to