Mirage Source http://web.miragesource.net/forums/ |
|
Binary/Memory (WIP) http://web.miragesource.net/forums/viewtopic.php?f=210&t=1398 |
Page 1 of 2 |
Author: | Verrigan [ Thu Feb 22, 2007 6:55 am ] |
Post subject: | Binary/Memory (WIP) |
WARNING This is a WORK IN PROGRESS (WIP). Some information contained herein may be lacking sufficient proof. Don't worry... I will make sure everything is tested 100% so as to prove such information without a doubt. As I add information to this article, I will post a single note, saying when I last updated the article. In the event that the responses to this article become too many, I will clean the thread up. The final section of this article will list all of the people who helped to contribute to this article. (Yes, you can post your ideas, and I will add relevant information to the article, giving you credit for contributing to the article.) Table of Contents
For the purposes of this article, VB.Net is not considered to be Visual Basic. If you decide to argue this point, do it somewhere else. This is an article about Binary and Memory. It is not about the differences between two programming languages. To be clear, this article is geared towards Visual Basic 6.0. (Some or all parts may apply to Visual Basic 5, but it will be purely coincidental.) This is not to say that you can't discuss the different ways to perform the same procedures in other programming languages. Feel free to bring up comparisons.
Octal - You can use 8 values to represent a digit in this Base-8 numbering system, so the usable values are 0-7. Decimal - The Base-10 numbering system allows for the use of 10 different values. Starting at 0, we are able to use the values from 0 to 9. Hexadecimal - You guesed it! 16 different values can be used. But wait! There are only 10 numerical digits! So, being 'part decimal', the hexidecimal system can represent a digit with 0-9. But we need 6 more digits, so we use letters to represent the values 10-15. Always start with the lowest, so you can use A-F. So a single hexadecimal digit can be represented with the values 0-F. 2.1. Converting Binary to Decimal (and Back)
Binary to Decimal
Position 0: 1 * 2^0 = 1 Position 1: 0 * 2^1 = 0 Position 2: 1 * 2^2 = 4 Position 3: 0 * 2^3 = 0 Position 4: 0 * 2^4 = 0 Position 5: 1 * 2^5 = 32 Position 6: 1 * 2^6 = 64 Decimal Value of 1100101 = 101
Position 0: 1 * 16^0 = 1 Position 1: 0 * 16^1 = 0 Position 2: 1 * 16^2 = 256 Position 3: 0 * 16^3 = 0 Position 4: 0 * 16^4 = 0 Position 5: 1 * 16^5 = 1,048,576 Position 6: 1 * 16^6 = 16,777,216 Decimal Value of 1100101 = 17,826,049
Position 0: 0 * 2 + 1 = 1 Position 1: 1 * 2 + 1 = 3 Position 2: 3 * 2 + 0 = 6 Position 3: 6 * 2 + 0 = 12 Position 4: 12 * 2 + 1 = 25 Position 5: 25 * 2 + 0 = 50 Position 6: 50 * 2 + 1 = 101 (Decimal Value)
Position 0: 0 * 16 + 1 = 1 Position 1: 1 * 16 + 1 = 17 Position 2: 17 * 16 + 0 = 272 Position 3: 272 * 16 + 0 = 4,352 Position 4: 4,352 * 16 + 1 = 69,633 Position 5: 69,633 * 16 + 0 = 1,114,128 Position 6: 1,114,128 * 16 + 1 = 17,826,049 (Decimal Value)
101 / 2 = 50 R 1 50 / 2 = 25 R 0 25 / 2 = 12 R 1 12 / 2 = 6 R 0 6 / 2 = 3 R 0 3 / 2 = 1 R 1 1 / 2 = 0 R 1 The answer is all of the remainders, starting with the final one: 1100101
17,826,049 / 16 = 1,114,128 R 1 1,114,128 / 16 = 69,633 R 0 69,633 / 16 = 4,352 R 1 4,352 / 16 = 272 R 0 272 / 16 = 17 R 0 17 / 16 = 1 R 1 1 / 16 = 0 R 1 The answer: 1100101
Have you ever wondered why it takes 1,024 bytes to make a Kilobyte (KB)? The answer is because even though we use the term Kilo, which is usually 1,000, the computer doesn't work in 1,000s. It works in binary. Instead of multiplying times 1,000, you multiply times 2^10. So, 1 KB = 2^10 = 1024 Bytes. To get Megabytes (MB), you use 2^20, which is 1,048,576 bytes. This can be confusing for people who are familiar with metric conversions. Just remember that a computer works in binary (powers of 2), not metric. A byte is made up of 8 bits. (2^3) To figure out how many bits are in a Kilobyte, you calculate 2^3 * 2^10. So a kilobyte contains 8,192 bits. When you look at a 100Mbps Ethernet connection (You plug the ethernet cable into your network card) on your computer, it is actually Megabits (lower-case b = bits) per second. This is actually 100,000,000 bits per second. Bits per second are calculated using the metric system. So, to figure out your maximum number of kilobytes per second (KB/Sec) you divide 100,000,000 by 2^13 (8,192). (About 12,207 KB/Sec) To figure out the number of Megabytes per second (MB/Sec), you divide 12,207 by 2^10 (1024). (Just under 12 MB/Sec) So your maximum up/download capability on a 100Mbps connection is around 12 MB/Sec. If you're on wireless 802.11G (54Mbps), you can do close to 6.5 MB/Sec, but your wireless card/router can usually boost this using compression and packet bursting to increase this. [More to come]
|
Author: | William [ Thu Feb 22, 2007 11:30 am ] |
Post subject: | |
Do your thing mate Seems like you got a lot of goods things in there to explain |
Author: | Dragoons Master [ Thu Feb 22, 2007 3:41 pm ] |
Post subject: | |
This probly will be greeeat stuff. Knowing memory is needed to know how things work on the computer and how to speed your code as much as possible, if you don't want that, just buy a new top line computer and it probly will do the same job xD. Good luck Verrigan! If you need help I think I can help you out with a few things on binary, not that you don't know of, just for time saving. |
Author: | Verrigan [ Thu Feb 22, 2007 4:04 pm ] |
Post subject: | |
I'd love some help. If everyone who is interested would write information down, I can collaborate all of our efforts into this article, and it will likely get done a lot faster than if I do it all by myself. I'm fairly certain the Overview is done, but gonna think on it for a couple of days while I try to figure out the best way to explain the Binary and Decimal systems, and how to convert between the two. Now, that said.. I want everyone who helps to use their own words when describing an aspect of this article.. I want to be able to tell from your writing that you understand what you're writing about. You can use sources for your information, but make absolute certain that you understand what you read before writing about it. Also, please include your sources (As much information as possible) so that I can add them to the Bibliography. I'm still psyched about this, and I want to thank everyone who has made me come to the decision to do this. (You guys don't know [well... maybe you do] who you are, but thanks! ) |
Author: | Robin [ Thu Feb 22, 2007 4:42 pm ] |
Post subject: | |
*looks at all the little (WIP) stickers* That's a lot of Work In Progress But hopefully I'll be able to learn a lot from it... I act big-headed but in actual fact I am a complete retard! (y) |
Author: | Verrigan [ Fri Feb 23, 2007 7:43 am ] |
Post subject: | |
Started on Binary Basics.. Getting tired... (Not much sleep last night...) Anyways.. There is more to come.. Just not right now... I'll probably change some of what has been written before I'm done.. |
Author: | William [ Fri Feb 23, 2007 8:45 am ] |
Post subject: | |
What you've done so far is very sweet |
Author: | Verrigan [ Fri Feb 23, 2007 7:40 pm ] |
Post subject: | |
Added some more information. Thanks to Dragoons Master for providing some conversion math help. |
Author: | Lea [ Fri Feb 23, 2007 8:19 pm ] |
Post subject: | |
Another trick to converting binary numbers to decimal is this: Using this method, we'll always work from left to right. Frequently, a binary number will have 0's in the beginning. Truncate all the 0's until your first number is a 1 Start with the decimal value "1" in your mind. Now work left to right, for each 0 you encounter, double the number in your mind. For each 1 you encounter, double the number and add 1 For example, the number 001101 Truncate the begining 0's. 1101 Start with 1 double and add 1 3 double 6 double and add 1 13 = final answer Now lets convert it the other way to proove it The Number: 001101 Position 0: 1 * 2^0 = 1 Position 1: 0 * 2^1 = 0 Position 2: 1 * 2^2 = 4 Position 3: 1 * 2^3 = 8 Position 4: 0 * 2^4 = 0 Position 5: 0 * 2^5 = 0 Decimal Value of 001101 = 13 ---------------------------------- Binary and Bytes Much the same way as the decimal system is broken into thousands, the binary system is broken into bytes. There are 8 bits in one byte, same as there are 3 digits in a thousand. A byte can hold a maximum of 255 values. Two bytes in a row can hold a maximum of 65535 values. That's all I got for that --------------------------------- Visual Basic Data Types. In Visual Basic 6 there are 11 different data types. These are Boolean, Byte, Currency, Date, Double, Integer, Long, Object, Single, String, and Variant. The common ones: Boolean The Boolean data type has only two states, True and False. These types of variables are stored as 16-bit (2 Byte) numbers, and are usually used for flags • Byte The Byte data type is an 8-bit variable which can store value from 0 to 255. This data type is very useful for storing binary data. • Double The Double data type is a 64-bit floating point number used when high accuracy is needed. These variables can range from -1.79769313486232e308 to -4.94065645841247e-324 for negative values and from 4.94065645841247e-324 to 1.79769313486232e308 for positive values. • Integer The Integer data type is a 16-bit number which can range from -32768 to 32767. Integers should be used when you are working with values that can not contain fractional numbers. • Long The Long data type is a 32-bit number which can range from -2,147,483,648 to 2,147,483,647. Long variables can only contain non-fractional integer values. I myself use Long variables over Integers for increased performance. • Single The Single data type is a 32-bit number ranging from -3.402823e38 to -1.401298e-45 for negative values and from 1.401298e-45 to 3.402823e38 for positive values. When you need fractional numbers within this range, this is the data type to use. • String The String data type is usually used as a variable-length type of variable. A variable-length string can contain up to approximately 2 billion characters. Each character has a value ranging from 0 to 255 based on the ASCII character set. Strings are used when Text is involved. http://www.rentron.com/datatypes.htm |
Author: | Verrigan [ Sat Feb 24, 2007 7:03 am ] |
Post subject: | |
Thanks, Dave. I figured out a 'formula' to explain your method.. (Don't know if it makes it any more clear, but oh well...) Anyways.. I'll add the data types at some point, but I'm too tired to do it right now.. (Long day that also included a lot of driving.) BTW, your numbers on the bit-byte stuff are slightly off.. (0 is a value..) and 1000 has 4 digits. |
Author: | Lea [ Sat Feb 24, 2007 3:16 pm ] |
Post subject: | |
bah, I was tired when writing that. |
Author: | Verrigan [ Sun Feb 25, 2007 1:50 am ] |
Post subject: | |
Conversion from decimal has been added. I think I'm going to change the bibliography to just one section... Shorten it up a bit. |
Author: | Verrigan [ Sun Feb 25, 2007 8:58 pm ] |
Post subject: | |
Added Binary and Bytes section. Currently incomplete.. Will write more later. [Edit] I haven't written on this in about a week... Sorry guys.. and I'll need a little more time before I can write much of an update.. Kids.. work.. You guys know the drill. I'll try to get back to this as soon as I can. |
Author: | William [ Thu Jun 28, 2007 9:34 am ] |
Post subject: | Re: Binary/Memory (WIP) |
Are you going to update it more ? |
Author: | Verrigan [ Thu Jun 28, 2007 6:42 pm ] |
Post subject: | Re: Binary/Memory (WIP) |
Yes.. Eventually. Been pretty busy with my full time job + part-time work.. Part-time work will end this week. |
Author: | Lea [ Mon Oct 08, 2007 2:55 am ] |
Post subject: | Re: Binary/Memory (WIP) |
Wanted to add something I learned just now - The method I described to convert binary to decimal is in fact called the Horners Algorithm. |
Author: | Skieth777 [ Mon Oct 20, 2008 10:11 pm ] |
Post subject: | Re: Binary/Memory (WIP) |
someone should SERIOUSLY update this |
Author: | Lea [ Tue Oct 21, 2008 1:54 am ] |
Post subject: | Re: Binary/Memory (WIP) |
I'll update the hex section later, because it's way wrong... |
Author: | miniming [ Mon May 23, 2022 8:27 am ] |
Post subject: | Re: Binary/Memory (WIP) |
When you are not lucky on LeoVegas roulette or you just want to mix up things you can try various other great live casino games. Especially Evolution Gaming offers สล็อตฝากถอน true wallet เว็บตรง a very wide selection of live dealer games. One of the most popular recent games is Monopoly Live. Monopoly Live is a very entertaining game which features on big wheel filled with numbers and bonus symbols. When you bet on a number and it lands you will win the number as multiplier. A €5,- bet on the number 10 will get you for example €50,-. When the wheel stops on bonus or chance you will enjoy a extra feature. This can be a multiplier, cash prizes or spins on the Monopoly bonus board. |
Page 1 of 2 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |