bug-gnu-utils
[Top][All Lists]
Advanced

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

(possible) bug submission for gawk


From: Black Passion
Subject: (possible) bug submission for gawk
Date: Fri, 3 Nov 2006 17:33:18 +0100

Hello,

Today I was working with gawk and did discover IMHO something weird.
I downloaded the latest version and checked the behavior again (running
Fedora Core 4).

It seems that gawk is not printing the right digits which you specify
although the amount of characters is correct.
See below the examples where till three digits its correct but from the
fourth the last character is printed wrongly (I think at least)

address@hidden gawk-3.1.5]$ ./gawk --version
GNU Awk 3.1.5
Copyright (C) 1989, 1991-2005 Free Software Foundation.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
USA.
address@hidden gawk-3.1.5]$ echo 111111111.123456789 | ./gawk '{printf
"%.1f",$1}'; echo
111111111.1
address@hidden gawk-3.1.5]$ echo 111111111.123456789 | ./gawk '{printf
"%.2f",$1}'; echo
111111111.12
address@hidden gawk-3.1.5]$ echo 111111111.123456789 | ./gawk '{printf
"%.3f",$1}'; echo
111111111.123
address@hidden gawk-3.1.5]$ echo 111111111.123456789 | ./gawk '{printf
"%.4f",$1}'; echo
111111111.1235
address@hidden gawk-3.1.5]$ echo 111111111.123456789 | ./gawk '{printf
"%.5f",$1}'; echo
111111111.12346
                          ^-here I expect the character 5
address@hidden gawk-3.1.5]$ echo 111111111.123456789 | ./gawk '{printf
"%.6f",$1}'; echo
111111111.123457
                            ^- here I expect the character 6
address@hidden gawk-3.1.5]$ echo 111111111.123456789 | ./gawk '{printf
"%.7f",$1}'; echo
111111111.1234568
                              ^- here I expect the character 7

If I wrong than I'm sorry, else maybe you start to feel ;-)
--
Passion is what makes your live worthwhile...


reply via email to

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