Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need algorithm
Message
 
 
To
07/07/2011 10:39:09
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Games
Category:
Trivia
Title:
Miscellaneous
Thread ID:
01517506
Message ID:
01517588
Views:
31
>>>>What I don't understand is how do you go from bit to number that will be stored in the field. For example, say only the 1st option box is selected. Does it mean that the value of 1 is set to the field? And if Option 1 and 2 are selected, the value of 3 is set to the field? And in case of all three options boxes, the value is 7?
>>>
>>>The options have numerical values 1, 2, and 4 assigned (for more than 3 options, use additional powers of 2: 8, 16, etc.). If one bit is set, add the values of the individual bits, e.g. 101(binary) = 4 + 1. To get the combined value:
>>>
>>>
>>>CombinedValue = iif(CheckBox0.Value, 1, 0) + iif(CheckBox1.Value, 2, 0) + iif(CheckBox2.Value, 4, 0)
>>>* (Assuming you changed the checkbox to a logical type. Otherwise, use iif(CheckBox.Value = 1...))
>>>
>>
>>I get it now. Thank you very much!
>
>A bit more theory: the binary system is quite similar to the decimal system we use on a daily basis - it is based on place-value. The only difference is that the decimal system uses base ten - meaning that each position is worth 10 times the position to its right (therefore it requires ten different digits). In binary, each position is worth twice the position to its right, thus only two digits are required.

Thank you. I kind of, sort of understood it before but your explanation makes it more clear.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform