NOT Problem - Printable Version +- QB64 Phoenix Edition (https://staging.qb64phoenix.com) +-- Forum: Chatting and Socializing (https://staging.qb64phoenix.com/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://staging.qb64phoenix.com/forumdisplay.php?fid=2) +--- Thread: NOT Problem (/showthread.php?tid=1132) |
NOT Problem - Kernelpanic - 11-16-2022 The problem with NOT is a hidden error for me. In any case, I personally have no comprehensible explanation for the results. Better for the one result. Why is an incorrect result returned at only one point? PS: I've now tried everything I could think of again, the wrong result under No. 3 remains. Code: (Select All) 'NOT-Problem - 16. Nov. 2022 RE: NOT Problem - mnrvovrfc - 11-16-2022 Where is "(not a) and (not c)"? How about involving "c" and "d" only? You have to complete the test suite... RE: NOT Problem - Jack - 11-16-2022 Kernelpanic I don't know what you expect, here's the output from the C equivalent Code: (Select All) 1 Code: (Select All) #include <stdio.h> RE: NOT Problem - RhoSigma - 11-16-2022 Your problem is not the NOT, but the AND, and you overlook only 1 AND 1 = 1. Output 3: (NOT 10) AND (NOT 15) = (-11) AND (-16) = (11110101) AND (11110000) = 11110000 = -16 The last four bits result into 0s because only 1 AND 1 = 1, not 1 AND 0 and not 0 AND 1 either. RE: NOT Problem - bplus - 11-16-2022 Code: (Select All) Option _Explicit EDIT: naht& bAnd&, Anned& RE: NOT Problem - SMcNeill - 11-16-2022 (11-16-2022, 11:06 PM)RhoSigma Wrote: Your problem is not the NOT, but the AND, and you overlook only 1 AND 1 = 1. It's exactly as Rho describes here. Code: (Select All) Screen _NewImage(640, 480, 32) When you see the binary values of the number printed out, you can then look up and compare them bit by bit and see why they produce the answer they do. -11 gives you 11110101 in binary. -16 gives you 11110000 in binary. AND those ======== in binary 11110000 From the right to the left: 1 and 0 = 0 0 and 0 = 0 1 and 0 = 0 0 and 0 = 0 1 and 1 = 1 1 and 1 = 1 1 and 1 = 1 1 and 1 = 1 11110000 = -16, in binary. RE: NOT Problem - Jack - 11-16-2022 bplus, maybe you should have used nicht instead of naht RE: NOT Problem - bplus - 11-16-2022 It's my Ohio, USA English? accent ;-)) Probably less confusing if I used Anned& instead of bAnd& also. "bplus, maybe you should have used nicht instead of naht" Wait... do you mean "Guten nicht" RE: NOT Problem - CharlieJV - 11-16-2022 (11-16-2022, 11:06 PM)RhoSigma Wrote: Your problem is not the NOT, but the AND, and you overlook only 1 AND 1 = 1. Arg, you beat me to it. Same info, just the geeking out programming version: RE: NOT Problem - Kernelpanic - 11-17-2022 First of all thanks for all the tips. I tried a few things today. I was able to reproduce the result with "-16", but there are still a few things that are unclear to me, for example, how Not(20) And Not(40) leads to the correct result: = 61 1 1 1 1 + 1 0 1 1 (1)1 0 0 0 0 = -16 (Hope it!) |