Page 1 of 1

I think I found a bug... but not sure.

Posted: Sat May 07, 2011 4:30 pm
by richh
So lately, I have been working with opening up files as binary then searching for specific information by hex. I came across something unusual and wanted to get addition opinions.

If I run this code in Windows, this statement is true. If I run the same code on a Mac, the statement is false.

Code: Select all

   if "00020000" = "20000d00" then
      answer "Equal"
   else
      answer "Not Equal"
   end if

According to logic, the statement should be false...

thoughts?

Re: I think I found a bug... but not sure.

Posted: Sat May 07, 2011 6:15 pm
by dunbarx
I am on a Mac, and I get "not equal". No surprise, the strings are different.

How could windows see these as the same? Is it just that Macs are superior machines?

Craig Newman

Re: I think I found a bug... but not sure.

Posted: Sat May 07, 2011 6:59 pm
by bangkok
Holly cow !

I get "equal" on windows !

:shock:

That's a good one.

Re: I think I found a bug... but not sure.

Posted: Sat May 07, 2011 11:25 pm
by richh
Should I email Runrev to report the problem or is there a specific place I should go to report it?

Re: I think I found a bug... but not sure.

Posted: Sun May 08, 2011 2:56 am
by dunbarx
Just tell Microsoft that their OS is awful, always was awful, and always will be.

Craig newman

Re: I think I found a bug... but not sure.

Posted: Sun May 08, 2011 3:19 am
by wsamples
I think there are two problems here. One is with Livecode and how it evaluates strings it determines are numeric values. I'm running openSUSE and the above evaluates to "not equal", however changing the test to "00020000" = "20000"' evaluates to "true" which is correct only if we are considering numeric values. The strings are clearly not identical, which is what the question is since they are quoted strings. This also occurs in OS X. The remaining question is why is the string being treated as a numeric in Windows. This is definitely something to pass along to the devs.

Re: I think I found a bug... but not sure.

Posted: Sun May 08, 2011 5:07 am
by richh
Craig:

Though my personal preference is mac, my employer sees things differently :( Oh well, slowly but surely Microsoft is losing their market share :)


wsamples:

I agree; however, there is a 3rd element to the mix in which the string on the right contains the d character. I am curious if this character is being mistaken for 0 which would then follow suite to your conclusion.

if "00020000" = "20000d00" then

I will send an email to the dev team. Thank you everyone for their input.

Re: I think I found a bug... but not sure.

Posted: Sun May 08, 2011 5:11 am
by wsamples
:D I was about to edit my post to clarify that I meant was talking about the string containing the "d" being treated as a numeric in Windows... Yes, it is really very odd and not possible to guess if that happens somehow in the Livecode engine or in Windows.

Re: I think I found a bug... but not sure.

Posted: Sun May 08, 2011 5:22 am
by wsamples
Some day I will learn to be thorough and efficient, but apparently I have a way to go...

The string containing the "d" is being truncated at the "d", which allows the statement to evaluate as true, based on the numeric value the string contains. This is NOT a good thing!

Re: I think I found a bug... but not sure.

Posted: Sun May 08, 2011 5:29 am
by richh
no worries it happens to me as well :P

I agree, this issue is not a good thing. I just sent an email to runrev's support team.