PC Review


Reply
Thread Tools Rate Thread

binary logic operators

 
 
Kevin Brown
Guest
Posts: n/a
 
      8th Sep 2003
I'm trying to do some simple logic operations; I've used
the limited functions DEC2BIN for converting decimal
number to binary format, now need to operate on the binary
results, e.g. convert to 2's complement, simple AND, OR
type functions...anyone have ideas?
 
Reply With Quote
 
 
 
 
Harlan Grove
Guest
Posts: n/a
 
      9th Sep 2003
"Kevin Brown" <(E-Mail Removed)> wrote...
>I'm trying to do some simple logic operations; I've used
>the limited functions DEC2BIN for converting decimal
>number to binary format, now need to operate on the binary
>results, e.g. convert to 2's complement, simple AND, OR
>type functions...anyone have ideas?


You don't need to convert integers to binary (text) representation. See

http://groups.google.com/groups?thre...280a%40phx.gbl


 
Reply With Quote
 
Myrna Larson
Guest
Posts: n/a
 
      9th Sep 2003
If you mean bit-wise AND and OR, etc, you need VBA functions. The worksheet functions are
logical AND, logical OR, not bitwise. VBA's AND, OR, and NOT are bit-wise operators.

The code is straight-forward. The arguments are ordinary decimal numbers, not the text result of
DEC2BIN.

Function BitAnd(X As Long, Y As Long)
BitAnd = X And Y
End Function

Function BitOR(X As Long, Y As Long)
BitOR = X Or Y
End Function

My memory is fading, but isn't the 2's complement of X equal to -X + 1? If so, you can implement
that with a worksheet formula without converting to binary.


On Mon, 8 Sep 2003 14:03:38 -0700, "Kevin Brown" <(E-Mail Removed)> wrote:

>I'm trying to do some simple logic operations; I've used
>the limited functions DEC2BIN for converting decimal
>number to binary format, now need to operate on the binary
>results, e.g. convert to 2's complement, simple AND, OR
>type functions...anyone have ideas?


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pattern Matching ..Waterfall Logic ... Table Logic? =?Utf-8?B?d2F1c2FndXk0NA==?= Microsoft Access 2 16th Mar 2007 02:31 AM
Logic Operators with 3 arguments pamelafluente@libero.it Microsoft VB .NET 2 1st Oct 2006 09:54 AM
Using binary operators to compare byte[]s =?Utf-8?B?TmF0aGFuVg==?= Microsoft C# .NET 3 7th Jan 2005 03:13 AM
Support for binary operators Gerald Klein Microsoft ADO .NET 0 16th Mar 2004 02:13 PM
Logic operators =?Utf-8?B?VG9tIEg=?= Microsoft Access Reports 1 13th Feb 2004 01:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:45 AM.