09-09-2015 07:31 AM
When I give 110 as x input and 1 as y input I am getting the output as 11111111111111111111111111111001 i.e 11001
But actually negation of 110 is 001; 001+ 1 is 010
Why I am getting the output as 11111111111111111111111111111001
Kind Regards,
Rashme SR
09-09-2015 07:40 AM - edited 09-09-2015 07:44 AM
Your math is wrong. 0b110 inverted is 0b001, then the logical OR of 0b001 and 0b001 is 0b001. But your input is not 0b110 it is actually 0b00000000000000000000000000000110 because your data type is a I32. So your output is correct
0b00000000000000000000000000000110 inverted is 0b11111111111111111111111111111001, then logical OR with 0b00000000000000000000000000000001 is 0b11111111111111111111111111111001
Also I suspect the difference between your two outputs is due to how the signed data type is handled, changing all data types to a U32 results in the same output.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
09-09-2015 07:40 AM
srrashme wrote:
But actually negation of 110 is 001; 001+ 1 is 010
OR is NOT an addition. In digital math, + is often used to denote OR and * is AND. So 001 + 001 = 001 when dealing with digital math (001 OR 001 = 001).
09-09-2015 07:56 AM
I understood my mistake..
Thank you so much
Kind Regards,
Rashme SR