[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SERIOUS BUG: No consistent comparision of string-number vs number
From: |
Aharon Robbins |
Subject: |
Re: SERIOUS BUG: No consistent comparision of string-number vs number |
Date: |
Thu, 9 Oct 2003 16:42:36 +0200 |
Gawk is behaving correctly. You are comparing strings and numbers and
such mixed comparisons have their own rules. You should see the
node `Typing and Comparison' in the gawk manual. You can also see it
online at
http://www.gnu.org/manual/gawk-3.1.1/html_node/Typing-and-Comparison.html#Typing%20and%20Comparison
Your program produces identical results with all of gawk, mawk and the
Bell Labs awk. If you still feel it's a problem, you'll have to
find a different programming language.
Thanks,
Arnold
> To: address@hidden
> Subject: SERIOUS BUG: No consistent comparision of string-number vs number
> Date: Thu, 09 Oct 2003 17:24:05 +0200 (CEST)
> From: =?ISO-8859-1?Q?Bj=F6rn_Bergqvist?= <address@hidden>
>
> when i compare "3000.0" < 4.00 the statement will be true.
> Sometimes gawk will do right, sometimes wrong.
> I solved it for like this: "3000.0"+0. < 4.00" but ideally some changes should
> be made in gawk.
> Regards
> Björn Bergqvist
>
> #!/usr/bin/awk -f
>
> BEGIN {
> stringno[1]="1000.0"
> stringno[2]="2000.0"
> stringno[3]="3000.0"
> for (j=1;j<=3;j++){
> for (i=0;i<=5;i+=1){
> if (stringno[j]<i)
> print stringno[j],"<",i," is true => BUG!"
> else
> print stringno[j],"<",i," is false => OK!"
> }
> print "\n"
> }
> }
>
> ..................................................................
>
> VINN RESA VÄRD 5000:- Tävla på http://www.lokalnyheterna.se/tipsa.php
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: SERIOUS BUG: No consistent comparision of string-number vs number,
Aharon Robbins <=