[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with comparing and adding
From: |
Lec Maj |
Subject: |
Problem with comparing and adding |
Date: |
Mon, 6 Mar 2006 08:35:32 -0600 |
Hello,
I ran across a problem with comparing 2 numbers while adding. I am
not sure if this is suppose to be like this or if it is a bug. Can
you please verify this. I downloaded and compiled the latest version
of gawk and I see the same problem.
address@hidden ~]$ cat gettestcount
gawk '{c=0; if ($1 < (0.096+0.204)) print "yes"; else print "no";}'
infile # ok
gawk '{c=0; if ($1 < (0.097+0.203)) print "yes"; else print "no";}'
infile # ok
address@hidden ~]$ cat infile
0.300
address@hidden ~]$ ./gettestcount
no
yes
address@hidden ~]$
As you will notice, either way the answer is 0.3, but the conditional
statement acts differently. There is a work around to check each time
for <= or >=, but we do not know of all the places in the code this
is done, and we are bound to miss one. Thanks for your help.
Best,
Lec
- Problem with comparing and adding,
Lec Maj <=