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

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

Re: BUG REPORT -> gawk 3.1.5


From: Aharon Robbins
Subject: Re: BUG REPORT -> gawk 3.1.5
Date: Wed, 02 Aug 2006 07:28:49 +0300

Greetings. Re this:

> Date: Tue, 01 Aug 2006 23:30:45 +0200
> From: jef <address@hidden>
> Subject: BUG REPORT -> gawk 3.1.5
> To: address@hidden
>
> HLO,
>
> I think I find a bug in gawk 3.1.5. (I find the problem in 3.1.4 but it 
> is present in 3.1.5 too)
>
> I notice that equality test in boolean selection fails when string 
> values are between 0e0 and 0e9 (case insensitive).
> ie: The test :
>
>   0e1 == 0e3 return true !
>
>
> I join a sample file to illustrate.
>
> Use this command lines:
> cat test.txt
> awk '$2 == $3' {print} test.txt
>
> Xcuse my english faults ;o))
>
> Best regards.

Gawk is comparing these values as floating point numbers: zero with
numeric exponents.  Since zero equals zero, the result is true. You
can force a string comparison by concatenating the values with the
null string:

        ("" $2) == ("" $3)

Hope this helps,

Arnold




reply via email to

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