Author: Jaime Benito de Valle Ruiz
Date: 08:04:08 09/10/03
Go up one level in this thread
On September 10, 2003 at 09:36:20, Uri Blass wrote:
>On September 10, 2003 at 09:16:04, Tim Foden wrote:
>
>>On September 10, 2003 at 08:45:22, Uri Blass wrote:
>>
>>>I found that my program printed the numbers 0 and 1 when it did the following
>>>code without printing mistake or mistake1.
>>>
>>>zobpawnkey[hply]=zobpawn;
>>>if (nodes==663719)
>>>{
>>> if (zobpawnkey[hply]!=zobpawn)
>>> printf("mistake");
>>> if ((zobpawnkey[hply]&1)!=(zobpawn&1))
>>> printf("mistake1");
>>> printf(" %d %d ",(zobpawn&1),(zobpawnkey[hply]&1));
>> ^^ ^^ these expect int, not __int64.
>>
>>If using Microsoft's compiler system, you should use %I64d instead.
>>
>>Cheers, Tim.
>
>I understand that %d does not give me the right value but the fact that it
>prints different numbers for identical numbers still seems strange to me.
>
>Uri
Because it is printing different numbers from ONLY one number (zobpawn&1), i.e.
from the lower and upper 32 bits of it. None of those numbers displayed by the
printf("%d %d"...) has anything to do with (zobpawnkey[hply]&1).
Probably, (zobpawn) and (zobpawnkey[hply]) in this example are the same, and
both equal to 0x0000000100000000. That's why you don't get errors in the first
place, and why you get your 0 and 1 on the screen!
I hope it's clear what I say.
Regards,
Jaime
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.