Computer Science

Binary Conversion

Binary conversion is the process of converting numbers or data from a decimal (base-10) system to a binary (base-2) system. In computer science, this is essential for representing and processing data in digital systems. It involves breaking down numbers into their binary equivalents, which consist of only 0s and 1s, and is fundamental to understanding how computers store and manipulate information.

Written by Perlego with AI-assistance

8 Key excerpts on "Binary Conversion"

Index pages curate the most relevant extracts from our library of academic textbooks. They’ve been created using an in-house natural language model (NLM), each adding context and meaning to key research topics.
  • Understanding Forensic Digital Imaging
    • Herbert L. Blitzer, Karen Stein-Ferguson, Jeffrey Huang(Authors)
    • 2010(Publication Date)
    • Academic Press
      (Publisher)

    ...Using digital signal for communication can prevent signal drifts. DATA REPRESENTATION IN DIGITAL SYSTEMS One important aspect of digital system design is how information ultimately will be converted into a bit pattern. Numeric values are the most prevalent and natural type of data representation from an analog source. When converting numeric information to binary codes, it is necessary to have a good mapping strategy, so that the data can be well represented relative to how it will be used. Numeric information can be categorized into three data types: Integer Negative value Floating point representation This section discusses the representation of these three data types. Integer Representation: Decimal versus Binary or Hexadecimal To introduce binary data representation, it is useful to dissect the more common decimal system we all know. The decimal number 123 is based on powers of 10 (hence the term decimal, from the Latin for ten). It is really 1 times 10 2 plus 2 times 10 1 plus 3 times 10 0. or 1 * 100 + 2 * 10 + 3 * 1 = 100 + 20 + 3 = 123. Each place holder is multiplied by 10 raised to a power consistent with its place in the string of digits, and the value in each place holder can be any whole number between zero and 9. The powers of 10 increase by one, going up from zero, as one progresses to the left. Similar rules apply in the binary system but the values are different. Each place holder is multiplied by 2 raised to some power, and the value in each place holder can be any whole number between zero and one. The powers of 2 increase by one, going up from zero, as one progresses to the left. Binary is represented by only zeros and ones. A binary pattern (number) can be converted to a decimal number and a decimal number can be converted to binary. The binary number system is sometimes called the base-2 system, and base might be indicated by 2, b, B, or Bin. So 1011 2 or 1011 B are both binary numbers...

  • Basic Electricity and Electronics for Control: Fundamentals and Applications, Third Edition

    ...However, there are many good technical books, papers, and guides to assist you if you care to study the matter further. COMPUTATIONAL Before we discuss binary computations, we need to know how to represent a string of 1s and 0s, that is, how they are organized and what they mean. Some definitions first: bit —a contraction of binary digit, the smallest piece of information byte —by convention, it currently means eight bits octet —eight bits nibble —a small byte, four bits binary —only two states, 1 and 0 ADD How do we add binary numbers? Just as you do in the decimal system, only the decimal system (a digital system—all number systems are digital) uses ten states as opposed to the binary system, which uses two. Figure 17–13 illustrates binary addition. It should be apparent that decimal and binary 0 = 0 and that decimal and binary 1 = 1. However, the rules are the same for all number systems. If you add two numbers (in decimal, think 9 and 1) and they exceed the number of states available, you have a carry. In decimal, we add 1 to the next column over. In the case of adding 9 and 1: 9 + 1 = 0, carry 1 or 10. If you add 19 and 1 you add up the units column, place a zero, and add your carry to the tens column to give you 20...

  • Digital Design
    eBook - ePub

    Digital Design

    Basic Concepts and Principles

    • Mohammad A. Karim, Xinghao Chen(Authors)
    • 2017(Publication Date)
    • CRC Press
      (Publisher)

    ...Many other reasons exist for coding information; among them are error detection and correction and encryption. In this section, in particular, we shall explore a few important coding schemes that have been devised to represent decimal numbers. In general, the set of bit string used to represent a set of objects is called a code and each such bit string in the set is called a code word. Several special-purpose binary codes have already been developed over the years for performing specific functions. They each have particular advantages and characteristics. The assignment of code words to objects can be given either by an algebraic expression or by an assignment table. One of the goals in coding is to standardize a set of universal codes that can be used by all. To code 2 n distinct quantities in binary, a minimum of n bits are required. Since there is no constraint on the maximum number of bits and if efficient codes are not a requirement, there can be numerous choices for binary coding. For example, the decimal numbers can be coded with ten bits, and each decimal number could be assigned a bit combination of a single 1 and nine Os. In this particular coding scheme, the digit 6 can be coded, for example, as 0000001000 and, similarly, the digit 2 is coded as 0010000000. Consider a different coding scheme for the decimal number 10. We could write its equivalent in binary as 1010, or the individual decimal characters could be coded separately as 0001 and 0000. Herein, each decimal digit is represented by its 4-bit binary equivalent. Although this means of expressing the number in binary form requires multiple strings of four bits, this method is useful because it provides ease of conversion. This scheme could be used to express more complex numbers. For example, 657 can be readily expressed as 0110 0101 0111 instead of by its binary equivalent 1010010001 2. This most frequently used decimal code is called the binary coded decimal (BCD) code...

  • Introduction to Digital Electronics

    ...2 Arithmetic and digital electronics 2.1 INTRODUCTION Many of the applications of digital electronic circuits involve representing and manipulating numbers as binary code (i.e. O’s and l’s). For instance in order to input any analogue value (e.g. a voltage or temperature) into a digital circuit it must be first encoded as a binary value, whilst subsequent arithmetic performed on such an input must be carried out by further digital circuits. The way in which some arithmetic operations are implemented as digital electronic circuits is considered in the next chapter. Here, as a prelude to this, some of the many ways in which numbers can be represented as binary code are introduced, followed by a description of how to perform binary arithmetic; that is addition, subtraction, multiplication and division on numbers represented only by O’s and l’s. 2.2 BASES-2, 10 AND 16 (BINARY, DECIMAL AND HEXADECIMAL) Numbers are most commonly represented using the 10 digits 0 to 9, that is in base-10 (or decimal). This widespread use is linked to our possession of 10 fingers and their value as a simple counting aid. However, from a purely mathematical viewpoint the base system used for counting is unimportant (indeed before metrification in Europe (use of base-10 in all weights and measures) many other bases were common). In digital electronics the only choice of base in which to perform arithmetic is base-2, that is binary arithmetic, using the only two digits available, 0 and 1. 1 Before continuing it is necessary to consider how to convert numbers from one base to another. 2.2.1 Conversion from base- n to decimal In order to do this it is essential to realise what a number expressed in any base actually represents. For example the number 152 10 in base-10 represents 2 the sum of 1 hundred, 5 tens and 2 units giving 152 10 units...

  • Microprocessor Technology
    • J S Anderson(Author)
    • 2012(Publication Date)
    • Routledge
      (Publisher)

    ...Chapter 2 Binary maths and number systems The decimal system The decimal system is so called because there are ten digits available, 0 to 9. All other numbers in the system are made up of combinations of these. (Dec means 10 as in decade – 10 years, December – 10th month (July and August have been added) and decathlon – 10 events, etc.) A number like 255 really means: 100s 10s Units 2 5 5 We can recognise 255 instantly because we are used to using decimal numbers, but in the binary system, 255 would be written as: 1111 1111. This is not so recognisable (unless we are used to it) although we could easily work it out. Similarly, we could work out the value of 255: In ‘index’ notation (powers of 10) the column headings are: 10 3 10 2 10 1 10 0 (1000s) (100s) (10s) (Units) 4 5 2 7 i.e. (Remember, incidentally, that x 0 = 1, whatever the value of x.) Table 2.1 Decimal numbers 0 to 64 with their binary equivalents. Note how the convention of writing the numbers in groups of four is adhered to. (They're easier to read like this and each group of four can be represented by a single hexadecimal digit as we shall see later.) Frequently, the leading zeros are also written down, e.g. 62D would be written as 0011 1110. This is how it would appear in a CPU register or memory location Decimal Binary Decimal Binary 0 0 33 10 0001 1 1 34 10 0010 2 10 35 10 0011 3 11 36 10 0100 4 100 37 10 0101 5 101 38 10 0110 6 110 39 10 0111 7 111 40 10 1000 8 1000 41 10 1001 9 1001 42 10 1010 10 1010 43 10 1011 11 1011 44 10 1100 12 1100 45 10 1101 13 1101 46 10 1110 14 1110 47 10 1111 15 1111 48 11 0000 16 1...

  • Programmable Controllers for Factory Automation
    • David Johnson(Author)
    • 2020(Publication Date)
    • CRC Press
      (Publisher)

    ...3 Numbering Systems and Coding Techniques A fella’ can no more tell you what he don’t know than he can be from where he ain’t been. Origin Unknown 3.1 NUMBERING SYSTEMS AND CONVERSIONS-BINARY, OCTAL, DECIMAL, AND HEXADECIMAL Numbers and numbering systems are used in many everyday occurrences to state, restate, or communicate some type of information. All programmable controllers, from the smallest to the largest and most complex, rely on efficient numbering systems to accomplish their tasks. While it is true that the internal working system of the microprocessor-based programmable controller uses the binary numbering system (that is 1 and 0), many parts of the rest of the system use other numbering systems. Examples include: (1) Input/Output systems that are addressed in octal, (2) displays that use the Binary Coded Decimal or BCD system, (3) register values that are displayed and used in decimal, and (4) documentation printouts that are referenced in hexadecimal format. In this chapter we shall examine each type of system, present conversion methods from one to the other, and methods in which they are used with programmable controllers. The first numbering system we shall examine is the binary system. It uses as its base the number 2, which means that only 1 and 0 are allowed for use in this system. A base for a numbering system refers to its reference–contrast this to decimal which uses as its base the number 10. Binary is the primary system used internally in the programmable controller, and is used extensively in most of the manufacturers’ documentation, especially in the register and I/O formatting sections, and the diagnostics sections. Table 3.1 shows an example of how the binary system works. Using four digits, different combinations of 1 and 0 are used to represent the numbers 0 to 15 in decimal. You will note that the digit in the binary number that is the rightmost of the four changes the most frequently in the transition from 0 to 15...

  • Programmable Logic Controllers
    • William Bolton(Author)
    • 2015(Publication Date)
    • Newnes
      (Publisher)

    ...However, the PLC itself works with binary numbers. In this chapter we take a look at the various number systems. We also take an introductory look at logic systems. A Combinational logic systems take binary inputs and combine them to give a binary output. The relationship between the inputs and the output can be described by truth tables. With such systems, the output of a particular combination of inputs is determined only by their state at the instant of time concerned. However, with sequential logic systems the output is influenced by the history of the past inputs as well as by the present inputs. Both combinational logic and sequential logic systems are introduced in this chapter. 3.1 The Binary System The binary system is based on just two digits: 0 and 1. These are termed bi nary digi ts, or bits. When a number is represented by this system, the digit position in the number indicates the weight attached to each digit, the weight increasing by a factor of 2 as we proceed from right to left. 2 3 2 2 2 1 2 0 bit 3 bit 2 bit 1 bit 0 Binary 1000 100 10 1 Bit 0 is termed the least significant bit (LSB) and the highest bit in a binary number is termed the most significant bit (MSB). For example, with the binary number 1010, the LSB is the bit at the right end of the number (0 in this example). The MSB is the bit at the left end of the number (1 in this example). The conversion of a binary number to a denary number involves the addition of the powers of 2 indicated by the place position of a number in the overall number. Thus for the binary number 1010, we have 1 with a place value of 2 3, 0 with a place value of 2 2, 1 with a place value of 2 1, and 0 with a place value of 2 0, and so the conversion to a denary number is as follows: 2 3 2 2 2 1 2 0 Binary 1 0 1 0 Denary 2 3 = 8 0 2 1 = 2 0 Thus the denary equivalent is 10. The conversion of a denary number to a binary number involves looking for the appropriate powers of 2...

  • Programmable Logic Controllers
    • William Bolton(Author)
    • 2009(Publication Date)
    • Newnes
      (Publisher)

    ...Chapter 3. Digital Systems Digital systems work with inputs, which are essentially just off/on signals, with the two signal levels represented by 0 and 1. These are termed binary digits. The number system used for everyday calculations is the denary or decimal system. This is based on the use of the 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. With a number represented by this system, the digit position in the number indicates the weight attached to each digit, the weight increasing by a factor of 10 as we proceed from right to left. Hence we have: 10 3 10 2 10 1 10 0 Thousands Hundreds Tens Units Denary 1000 100 10 1 Thus if we have the denary number 1234, we have 1 with a place value of 10 3, 2 with a place value of 10 2, 3 with a place value of 10 1, and 4 with a place value of 10 0. Counting can, however, be done to any base. The denary system is convenient mainly because we have 10 fingers. If we had only two fingers, our system for everyday counting would probably have been different. Computers, and hence PLC systems, are based on counting in twos because it is convenient for their systems, their two digits being effectively just the off and on signals. When working with PLCs, other base number systems are also used; for example, input and output addresses are often specified using the octal system, that is, base 8. However, the PLC itself works with binary numbers. In this chapter we take a look at the various number systems. We also take an introductory look at logic systems. With combinational logic systems, these take binary inputs and combine them to give a binary output. The relationship between the inputs and the output can be described by truth tables. With such systems, the output of a particular combination of inputs is determined only by their state at the instant of time concerned. However, with sequential logic systems the output is influenced by the history of the past inputs as well as by the present inputs...