Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need algorithm
Message
 
General information
Forum:
Games
Category:
Trivia
Title:
Miscellaneous
Thread ID:
01517506
Message ID:
01517568
Views:
30
>>>>I need to create algorithm (based on an integer number) that by applying some formula or equation to this number I can identify if the number belongs to group 1, 2, or 3 or any combination of them (e.g. 1 and 2, 1 and 3, 1 and 2 and 3, 2 and 3)
>>>>For example, number 8 would indicate belonging to all three groups (since I can divide this number by the group number without a remainder.
>>>>Any suggestions?
>>>
>>>It just occured to me that the answer is very simple.
>>
>>
>>Is this about your options ? (from yesterday)
>>
>>Then the groups are just bits. Test witth BitTest()
>>
>>And belonging to all three groups = 7
>
>Yes, this is a follow up to the options thread from yesterday. But I can't seem to grasp how to apply BitTest() to this issue. I can't understand how the value of 7 by using BitTest() indicates that 7 belongs to all three groups? Could you please explain?

I found a very good explanation of bit operations here
http://sqlfool.com/2009/02/bitwise-operations/

Here is another helpful link
http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/MSSQLServer/how-to-flip-a-bit-in-sql-server-by-using
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform