[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] gawk simple compare not working?
From: |
Andrew J. Schorr |
Subject: |
Re: [bug-gawk] gawk simple compare not working? |
Date: |
Tue, 31 Mar 2015 21:50:59 -0400 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Hi,
On Tue, Mar 31, 2015 at 05:08:08PM +0000, Dial, Mary wrote:
> I'm stumped! Any help is appreciated.
>
> I run this simple gawk compare program (below) and it does not return the
> correct answer. But if a append an 'x' to the compare, then it works. Im not
> sure if this is an gawk bug.
>
> I'm using Red Hat Linux 6.6. Both gawk 3.7.1 and 4.1 return the same results
>
> Here is the sample input where the 2nd to last characters are different
> File c1
> 073343000773200000000075
>
> File c2
> 073343000773200000000005
>
> Here is the run test run
> gawk_test_diff c1 c2
> Straight Compare - Lines are the same
> Add Char Compare - Lines are different
I think this should explain it:
https://www.gnu.org/software/gawk/manual/html_node/Variable-Typing.html
When a numeric comparison is used, there are overflow problems (both map to
73343000773200000843776 on my system). String comparison should work fine.
If you use the -M option, that may solve the numeric overflow issue.
Regards,
Andy