the_net_2.0
Banned
- Local time
- Today, 02:51
- Joined
- Sep 6, 2010
- Messages
- 812
OK guys,
Got a problem that's eluded me. Need an expert in Access! I have two numbers (2 fields) in an access table. They are LONG values, and I want to compare their binary bit string equivalents and see if certain bits match.
For instance, one number is 255 which translates to 11111111 in binary. So I want to compare that number to the number 1018 which translates to 1111111010 in binary. I want to use internal resources inside of access to determine if the bit strings are equal. Now, notice that 255's bit string is only 8 bits long but 1018's bit string is 10 bits long. I think that would be an issue, but I'm not sure because I don't know how Access interprets numbers. e.g. - I don't know if Access reads values using a set bit interpretation. For instance, if Access was reading every number I gave it using a bit-wise pattern of 10, the two numbers above would be read as:
255 = 0011111111
1018 = 1111111010
Don't 32/64 bit machines though, always use the matching bit numbers to interpret numbers and include the leading 0's in the binary conversion, if applicable?
Regardless though, I'm looking for a method that would enable me to compare specific bits in two different long numbers to see if they match. In my tests, I tried doing this in the immediate window in vba:
and the result is 1 (2nd number larger than 1st number), but when I get to larger spreads in numbers like comparing a 32-bit number with a 6 bit number, the result becomes -1 (opposite) and doesn't make any sense. I don't even think the FORMAT() function in the above code does any good. Correct?
I've also tried using expressions like 2837 And Not(63) in a query, but the query doesn't like the "NOT" word. I also experimented with MOD() to see if I could get to a comparison function somehow by using the remainders of the two numbers, but didn't find a solution or pattern there either.
Thanks guys!
Got a problem that's eluded me. Need an expert in Access! I have two numbers (2 fields) in an access table. They are LONG values, and I want to compare their binary bit string equivalents and see if certain bits match.
For instance, one number is 255 which translates to 11111111 in binary. So I want to compare that number to the number 1018 which translates to 1111111010 in binary. I want to use internal resources inside of access to determine if the bit strings are equal. Now, notice that 255's bit string is only 8 bits long but 1018's bit string is 10 bits long. I think that would be an issue, but I'm not sure because I don't know how Access interprets numbers. e.g. - I don't know if Access reads values using a set bit interpretation. For instance, if Access was reading every number I gave it using a bit-wise pattern of 10, the two numbers above would be read as:
255 = 0011111111
1018 = 1111111010
Don't 32/64 bit machines though, always use the matching bit numbers to interpret numbers and include the leading 0's in the binary conversion, if applicable?
Regardless though, I'm looking for a method that would enable me to compare specific bits in two different long numbers to see if they match. In my tests, I tried doing this in the immediate window in vba:
Code:
?strcomp(format(63, 000000), format(127, 000000),0)
and the result is 1 (2nd number larger than 1st number), but when I get to larger spreads in numbers like comparing a 32-bit number with a 6 bit number, the result becomes -1 (opposite) and doesn't make any sense. I don't even think the FORMAT() function in the above code does any good. Correct?
I've also tried using expressions like 2837 And Not(63) in a query, but the query doesn't like the "NOT" word. I also experimented with MOD() to see if I could get to a comparison function somehow by using the remainders of the two numbers, but didn't find a solution or pattern there either.
Thanks guys!