This is not a bug.

http://www.gnu.org/manual/gawk/gawk.html#Floating-Point-Issues

It is important to note that the string value for a number may not
reflect the full value (all the digits) that the numeric value actually
contains. The following program (values.awk) illustrates this:

     {
        $1 = $2 + $3
        # see it for what it is
        printf("$1 = %.12g\n", $1)
        # use CONVFMT
        a = "<" $1 ">"
        print "a =", a
        # use OFMT
        print "$1 =", $1
     }

This program shows the full value of the sum of $2 and $3 using printf,
and then prints the string values obtained from both automatic
conversion (via CONVFMT) and from printing (via OFMT).

Here is what happens when the program is run:

     $ echo 2 3.654321 1.2345678 | awk -f values.awk
     -| $1 = 4.8888888
     -| a = <4.88889>
     -| $1 = 4.88889

This makes it clear that the full numeric value is different from what
the default string representations show.

** Changed in: gawk (Ubuntu)
       Status: New => Invalid

-- 
The == operator doesn't work appropriately
https://bugs.launchpad.net/bugs/304125
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to