VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Boolean arithmetic

by Derek Haas (4 Submissions)
Category: Math/Dates
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

This program includes functions for performing Boolean (bitwise) AND, OR, and XOR; as well as left shift, right shift, and one's complement. Right now, the subroutines are set up to use the values in the textboxes and output the results to another text box. However, you can easily modify them to take passed variables and return the results as a function.

Inputs
AND, OR, XOR, Shift Left, and Shift Right take the two numbers to be operated on, One's Complement takes a single number.
Assumes
A very brief explanation of boolean arithmetic: AND - Compares each bit of one number to the corresponding bit in another number. If both are 1, then the corresponding bit in the output is 1 OR - Same as above, except the outputted bit is 1 if either or both input bits is 1 XOR - Same as above, except the outputted bit is 1 only if either of the input bits is 1 (not both) Shift Left - All bits are moved left the given number of spaces and 0's are filled in from the right. Bits that move out of the variable are lost. Shift Right - Same as above, except bits are moved right, with 0's filled in from left. Bits shifted out are lost. One's Complement - All 1's become 0's and all 0's become 1's
Code Returns
Puts the result into a text box

Rate Boolean arithmetic

Download Boolean arithmetic

Download Boolean arithmetic (4 KB)

Boolean arithmetic Comments

No comments have been posted about Boolean arithmetic. Why not be the first to post a comment about Boolean arithmetic.

Post your comment

Subject:
Message:
0/1000 characters