Logical operation

Discussion in 'Microsoft Certification' started by c.h1523@hotmail.com, May 6, 2009.

  1. Guest

    This is a test for the high school :

    the logical operation as this ("a">"A" xor 1), and get the result is -2,
    what is the negative value meaning ?
    , May 6, 2009
    #1
    1. Advertising

  2. "" <@discussions.microsoft.com> wrote
    in message news:...
    > This is a test for the high school :
    >
    > the logical operation as this ("a">"A" xor 1), and get the result is -2,
    > what is the negative value meaning ?



    You cannot draw inferences from the negative or positive nature of the
    value.

    Most systems define True/False as non-zero and zero.

    But, to explain what has actually happened....

    First you performed a logical comparison "a" > "A" which is True, and
    returned some non-zero result.

    And then you performed an XOR operation with the value '1'
    (<some_nonzero_value> XOR 0x00000001),
    and it looks like the value returned is 0xFFFFFFFE, of which the last eight
    bits are 0x111111110,
    and that's where the -2 is coming from.

    From that, we can "reverse engineer" the logic, and consider this
    possibility:
    If the nonzero value returned was -1 (0xFFFFFFFF) then the result of
    0xFFFFFFFF XOR 0x00000001
    is that the last bit is set to 0 (XOR fails), and all other bits are set to
    1 -- and the result is -2.

    --
    Lawrence Garvin, M.S., MCITP:EA, MCDBA
    Principal/CTO, Onsite Technology Solutions, Houston, Texas
    Microsoft MVP - Software Distribution (2005-2009)

    MS WSUS Website: http://www.microsoft.com/wsus
    My Websites: http://www.onsitechsolutions.com;
    http://wsusinfo.onsitechsolutions.com
    My MVP Profile: http://mvp.support.microsoft.com/profile/Lawrence.Garvin
    Lawrence Garvin [MVP], May 6, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AM
    Replies:
    0
    Views:
    422
  2. Replies:
    0
    Views:
    534
  3. =?Utf-8?B?QUQgRG9jdW1lbnRhdGlvbj8/Pw==?=

    AD Logical Design Documentation Templates

    =?Utf-8?B?QUQgRG9jdW1lbnRhdGlvbj8/Pw==?=, Mar 9, 2006, in forum: MCSE
    Replies:
    6
    Views:
    3,013
  4. lfnetworking

    pix 506 logical port support

    lfnetworking, Mar 18, 2006, in forum: Cisco
    Replies:
    1
    Views:
    390
    Walter Roberson
    Mar 18, 2006
  5. Arawak
    Replies:
    1
    Views:
    431
    Harrison
    Dec 8, 2003
Loading...

Share This Page