Computer Science

Binary Arithmetic

Binary arithmetic is a mathematical operation that involves only two digits, 0 and 1. It is the foundation of all digital systems and is used extensively in computer science. Binary arithmetic includes addition, subtraction, multiplication, and division of binary numbers.

Written by Perlego with AI-assistance

11 Key excerpts on "Binary Arithmetic"

  • Book cover image for: Computer Arithmetics for Nanoelectronics
    • Vlad P. Shmerko, Svetlana N. Yanushkevich, Sergey Edward Lyshevski(Authors)
    • 2018(Publication Date)
    • CRC Press
      (Publisher)
    3 Binary Arithmetic 3.1 Introduction The binary number system is the most important number system in digital design. This is because it is suited to the binary nature of the phenomena used in dominant microelectronic technology. Even in situations where the binary number system is not used as such, binary codes are employed to represent information at the signal level. However, other number systems can be useful in computing nanosystems. For example, 4,8,16, and 32 number systems can be used for memory devices. These systems address a multivalued logic. Multivalued logic values are often encoded using binary representations. However, humans prefer decimal numbers; that is, binary numbers must be converted into decimal numbers. In this chapter, Binary Arithmetic is introduced. The binary number system is fundamental to computers and to digital electronics in general. This arithmetic operate with two values, 0s and 1s, and is the base of all computer devices. Binary Arithmetic is used in computing nanodevices design because various chemical and physical phenomena can be encoded by 0s and 1s. Binary Arithmetic can be also considered as a fundamental basis for hybrid computing devices design, in which the computing components are implemented using various technologies. We introduce the techniques for the manipulation of binary numbers and show their relationship to other number systems such as decimal, hexadecimal, octal, and others. Binary data can be logically combined and computed by using theorems of Boolean algebra. Various number systems are examined that are used in digital data structures. These number systems, such as octal and hexadecimal, are used to simplify the manipulation of binary numbers. 59 60 Computer Arithmetics for Nanoelectronics 3.2 Positional numbers A number system is defined by its basic symbols, called digits or numbers , and the ways in which the digits can be combined to represent the full range of numbers we need.
  • Book cover image for: Electronic Digital System Fundamentals
    • Dale R. Patrick, Stephen W. Fardo, Vigyan Chandra(Authors)
    • 2020(Publication Date)
    • River Publishers
      (Publisher)
    Chapter 6 Binary Addition and Subtraction INTRODUCTION Digital systems are called on to perform a number of arithmetic func-tions in their operations. These functions deal with numbers in a variety of different forms. As a rule, the circuitry of a digital system must deal with binary numbers. The internal circuitry must manipulate the data very quickly and accurately. The subject of digital arithmetic can be very complex when all of the methods of computation and the theory behind it are understood. Fortu-nately, this level of understanding is not required by technicians until they become experienced system programmers. In this unit, we concentrate on those basic principles needed to understand how digital systems perform basic arithmetic operations. We first discuss arithmetic operations on bi-nary numbers using pencil and paper. We then examine logic circuits that perform these operations in a digital system. As a rule, most arithmetic operations can be achieved with integrated circuits. Special arithmetic ICs are readily available as off-the-shelf items. A person working with digital systems must be familiar with the operation of these devices in order to see how a system functions electronically. ADDITION Addition is a mathematical operation in which two or more numbers are combined together to obtain a simple equivalent quantity. Addition of integer A to integer B, or A + B, is the process of advancing integer A , B times. Addition is a process of memorizing a list of number combina-tions. In practice, it is extremely difficult to make a list of all the integer combinations needed to accomplish addition. A list of the base number combinations is however, very helpful in seeing how addition is accom-plished. Addition is basically a counting operation. The counting method 153 154 Electronic Digital System Fundamentals of addition is rather slow and somewhat awkward to handle when large numbers are involved.
  • Book cover image for: Electronic Digital System Fundamentals
    • Dale R. Patrick, Stephen W. Fardo, Vigyan (Vigs) Chandra, Brian W. Fardo(Authors)
    • 2023(Publication Date)
    • River Publishers
      (Publisher)
    6 Binary Addition and Subtraction 6.1 Introduction Digital systems are called on to perform several arithmetic functions in their operations. These functions deal with numbers in a variety of different forms. As a rule, the circuitry of a digital system must deal with binary numbers. The internal circuitry must manipulate the data very quickly and accurately. The subject of digital arithmetic can be very complex when all of the methods of computation and the theory behind it are understood. Fortunately, this level of understanding is not required by technicians until they become experienced system programmers. In this unit, we concentrate on those basic principles needed to understand how digital systems perform basic arithmetic operations. We first discuss arithmetic operations on binary numbers using pencil and paper. We then examine logic circuits that perform these operations in a digital system. As a rule, most arithmetic operations can be achieved with integrated circuits. Special arithmetic ICs are readily available as off-the-shelf items. A person working with digital systems must be familiar with the operation of these devices to see how a system functions electronically. 6.2 Addition The addition is a mathematical operation in which two or more numbers are combined together to obtain a simple equivalent quantity. The addition of integer A to integer B, or A + B, is the process of advancing integer A, B times. The addition is a process of memorizing a list of number combinations. In practice, it is extremely difficult to make a list of all the integer combinations needed to accomplish addition. A list of the base number combinations is, however, very helpful in seeing how addition is accomplished. The addition is basically a counting operation. The counting method of addition is rather slow and somewhat awkward to handle when large numbers are involved
  • Book cover image for: Digital Logic
    eBook - PDF

    Digital Logic

    With an Introduction to Verilog and FPGA-Based Design

    • M. Rafiquzzaman, Steven A. McNinch(Authors)
    • 2019(Publication Date)
    • Wiley
      (Publisher)
    This convention is normally adopted in floating-point number representation. Because all numbers will be assumed to be in normalized form, the binary point is not required to be represented in the computers. Typical 32-bit microprocessors such as the Intel 80486/Pentium and the Motorola 68040 and PowerPC contain on-chip floating-point hardware. This means that these microprocessors can be programmed using instructions to perform operations such as addition, subtraction, multiplication, and division using floating-point numbers. 36 Digital Logic with an Introduction to Verilog and FPGA-Based Design 2.5 Arithmetic Operations As mentioned before, computers can only add. Therefore, all other arithmetic operations are typically accomplished via addition. All numbers inside the computer are in binary form. These numbers are usually treated internally as integers, and any fractional arithmetic must be implemented by the programmer in the program. The arithmetic and logic unit (ALU) in the computer’s CPU performs typical arithmetic and logic operations. The ALU performs functions such as addition, subtraction, magnitude comparison, ANDing, and ORing of two binary or packed BCD numbers. The procedures involved in executing these functions are discussed now to provide an understanding of the basic arithmetic operations performed in a typical microcontroller and microprocessor. The logic operations are covered in Chapter 3 2.5.1 Binary Arithmetic Addition The addition of two binary numbers is carried out in the same way as the addition of decimal numbers. However, only four possible combinations can occur when adding two binary digits (bits): augend + addend = carry sum decimal value 0 + 0 = 0 0 0 1 + 0 = 0 1 1 0 + 1 = 0 1 1 1 + 1 = 1 0 2 The following are some examples of binary addition. The corresponding decimal additions are also included.
  • Book cover image for: Microprocessor Engineering
    1 Arithmetic 1.1 Introduction A microprocessor-based computing system has to have a numerical computation capability, and consequently it must be able to implement the four basic arithmetic processes of addition, subtraction, multiplication and division. Human beings perform arithmetic operations using the decimal number system, but, by comparison, a microprocessor is inherently a binary machine and its numerical calculations are executed using a binary number system. Additionally, the hexadecimal system is used in program listings, so the engineer who proposes to use this kind of machine must be familiar with a variety of different number systems. It is also true that arithmetic processes executed by a digital machine are not by any means identical to the pencil and paper methods normally employed by man. For example, the process of subtraction in this kind of machine is carried out as an addition, and this involves the use of complement arithmetic. Again, a frequent requirement is that the output of a microprocessor should be a decimal display, for obvious reasons. Since the machine works in binary, a way has to be found to represent decimal numbers in terms of binary digits and this involves the use of binary coded decimal. Methods then have to be devised so that arithmetic operations in the machine can be performed using binary coded decimal, and techniques for converting from pure binary to binary coded decimal and vice versa are also required. The purpose of this chapter is to describe the various number systems in common usage in microprocessor systems and to develop methods for implementing the various arithmetic opera- tions that have to be performed. 1 2 Arithmetic 1.2 Number systems The number system most familiar to man is the decimal system.
  • Book cover image for: Foundations of Digital Logic Design
    • Gideon Langholz, Abraham Kandel;Joe L Mott;;(Authors)
    • 1998(Publication Date)
    • WSPC
      (Publisher)
    2 Number Systems, Arithmetic Operations and Codes 2.1 INTRODUCTION Digital systems are characterized by signals restricted to two possible values which are represented by an alphabet of only two characters, commonly denoted by 0 and 1. Binary data representations are therefore of fundamental importance to the analysis and design of digital systems. We begin this chapter by considering numerical data representations. Working with digital systems usually requires familiarity with several number systems: Decimal Binary Octal Hexadecimal Binary-coded decimal (BCD) The binary number system is the most natural to use in a digital system. Sometimes, however, it is more convenient to employ the other number systems, in particular the familiar decimal number system. In such cases, the numbers are manipulated within the number system in use but are, nevertheless, represented as binary numbers within the digital system. We will introduce arithmetic operations to provide a basis for understanding how digital systems handle numbers in arithmetic computations. We will discuss unsigned and signed binary number representations and consider the four basic arithmetic operations: 21 22 CHAPTER 2 NUMBER SYSTEMS addition, subtraction, multiplication, and division. Binary coding is another important issue. Numbers can be represented in a variety of codes, some of which are more useful than others in particular situations, and can be operated upon. Nevertheless, since arithmetic (numerical) data are not the only data type used, we also discuss codes for representing nonnumerical data, such as letters of the alphabet. Finally, we provide a brief introduction to the fundamentals of protecting against various transmission errors when data are transferred over communication links, and the principles of coding control instructions in a digital system.
  • Book cover image for: Modern Digital Design and Switching Theory
    • Eugene D. Fabricius(Author)
    • 2017(Publication Date)
    • CRC Press
      (Publisher)
    CHAPTER 1
    Number Bases, Codes, and Binary Arithmetic 1.1    INTRODUCTION
    A digital system processes discrete information using electronic circuits that respond to and operate in a finite number of states, usually two states, on and off, which can be represented by the binary digits 1 and 0. The information so processed may represent anything from arithmetic integers and letters of the alphabet to values of physical quantities such as mass, velocity, and acceleration, or current, voltage, and impedance. A digital system accepts digital input representing numbers, symbols, or physical quantities, processes this input information in some specific manner, and produces a digital output.
    Digital systems are used in all types of control systems due to their flexibility, accuracy, reliability, and low cost. Flexibility is due to the ease with which digital systems can be reprogrammed. Accuracy is limited only by the number of bits (BInary digiTs, consisting of 1s and 0s) one wishes to use in representing the digital quantities being processed. Reliability is due to the ability of digital circuits to correctly interpret logical 1s and 0s. For example, in transistor-transistor logic or TTL technology, a logical 1 is represented by a voltage in the range of roughly 2.5 to 5.0 V, and a logical 0 is represented by a voltage of from 0 to about 1 V, and minor fluctuations in voltage levels are not misinterpreted by the hardware.
    The cost of all digital chips has dropped dramatically in the past three decades. This is primarily due to the number of transistors that can be put on a single chip. This number has been doubling almost every year for three decades, from a single transistor on a chip in 1960 to several million transistors per chip in 1990.
    This chapter starts with a discussion of number bases and how to convert from one number base to any other number base. Next, the topics of binary addition and subtraction and then multiplication and division are covered. Following this, binary codes are discussed, specifically the binary-coded decimal, and the excess-three, the Gray, and error-detecting codes are covered. This leads into the concept of Hamming distance and the requirements for detecting and/or correcting codes. The American standard code for information interchange (ASCII) alphanumeric code is also introduced.
  • Book cover image for: Numbers
    eBook - ePub

    Numbers

    Arithmetic and Computation

    • Asok Kumar Mallik, Amit Kumar Das(Authors)
    • 2022(Publication Date)
    • CRC Press
      (Publisher)
    Chapter 6 Computer and programming fundamentals
    We are now in a position to appreciate the potential of different types of numbers and their applications in describing real-life problems and their solutions. It is also expected that you might be eager to use a computer for solving some problems. Computers would be handy not only to save time, but to relieve you from the drudgery of manual computation as well. Last but not the least, computers may be a big help if you could not obtain an analytical solution.
    Here we will learn about the following, with the final goal of solving some of the problems presented in this book without the rigorous analytical acumen required otherwise.
    • How the numbers and codes are represented in computers.
    • Logic operations and logic gates.
    • How arithmetic and logic operations are done in a computer.
    • A Programming language with a tutorial introduction to programming in a concise form.
    Well, it seems to be a tall-order; believe us it would be very short and fun to learn.

    6.1 Advantages of binary representation of numbers

    In a computer the numbers are represented in binary. In fact, not only the numbers, the instruction or any other information is nothing other than some 0’s and 1’s stored in the memory, the main resource of the computer. A switch with its two states, namely, OFF and ON is the simplest possible 2-state device that be used to represent 0 and 1. So, a few switches together, say 8, may be used to represent a 8-bit binary number (b7 b6 ,…, b0 ) 000000002 to 111111112 ; i.e. 0 to 255 in decimal. Additionally, the ON and OFF states of the switches can be mapped to TRUE and FALSE in the logical domain. This is very important as the computer relies on logic operations as we shall see next.
    In short, if we choose to represent a number in decimal form, the computing system should be able to represent and identify 10 different states; 0 to 9 and carry out all arithmetic operations using 10-state devices. This leads to a complicated, costly and bulky solution. World’s first electronic computer ENIAC (1946), designed and installed in the University of Pennsylvania, USA used decimal representation of numbers. Moreover, transistors and ICs were not invented then and it was built using electronic valves. ENIAC weighed 27 tons, occupied 18,000 sq. ft. and consumed ONLY 150 KW of electricity.
  • Book cover image for: Digital Arithmetic
    • Miloš D. Ercegovac, Tomás Lang, Miloš D. Ercegovac(Authors)
    • 2003(Publication Date)
    • Morgan Kaufmann
      (Publisher)
    CHAPTER I Review of Basic Number Representations and Arithmetic Algorithms In this chapter we briefly review basic number representations and algorithms used in digital arithmetic. The treatment is very concise; readers that need a more detailed review should consult some of the references listed at the end of the chapter. More advanced algorithms as well as the implementations are the topic of later chapters. 1.1 Digital Arithmetic and Arithmetic Units Digital arithmetic encompasses the study of number representations, algorithms for operations on numbers, implementations of arithmetic units in hardware, and their use in general-purpose and application-specific systems. An arithmetic unit (processor) is a system that performs operations on num- bers. We limit ourselves to the most common cases in which these numbers are 1. fixed-point numbers 9 integersI = {-N,..., N} 9 rational numbers of the form x = a/2f (binary rationals), a ~ I and f positive integer floating-point numbers x • b E, x rational number, b the integer base, and E integer exponent. The floating-point numbers approximate real numbers and facilitate computations over a wide dynamic range. Collectively, we refer to these numbers as DA (digital arithmetic) numbers. . 4 c HA P T E R I Review of Basic Number Representations and Arithmetic Algorithms An arithmetic processor operates on one, two, or more operands depending on the operation. The operands are characterized by a representation and a set of values as defined in the next section. The operation is selected from an allowable set, which usually includes addition, subtraction, multiplication, division, square root, change of sign, comparison, and so on. The results can be DA numbers, logical variables (conditions), and/or singularity conditions (exceptions). Logical results occur for operations such as comparison, check for zero, and the like.
  • Book cover image for: Digital Electronics: A Primer
    eBook - ePub

    Digital Electronics: A Primer

    Introductory Logic Circuit Design

    • Mark Nixon(Author)
    • 2015(Publication Date)
    • ICP
      (Publisher)
    These reduced equations are identical to the earlier combinational design. This shows not only that there is redundancy within the MSI solution, but also how mathematics can be used to reduce circuits. Note the duality between hardware and software: all design approaches have reached the same result.

    7.4   Concluding Comments and Further Reading

    This chapter has introduced the main number coding systems used in computer and Binary Arithmetic. Coding systems find much wider use in communications systems to improve efficiency and for reasons of data security. The coding system always needs to be deciphered so that we can tell exactly what the code meant. A hardware implementation will be preferred due to speed though the complexity of the coding technique might require a software solution, perhaps even implemented using a parallel processing system to achieve a required speed. The examples included here have only concentrated on simple techniques for basic code conversion but form the basis for extension to more complex systems.
    The basis of computer arithmetic has been introduced. The most versatile system is floating-point arithmetic and this can be implemented in software and/or hardware in computer systems to handle the arithmetic processes (hardware is preferred for speed). There are other programmable logic chips, which include XOR gates (instead of the OR gates and sometimes called arithmetic devices) that better suit the design of counters. There are also more sophisticated design techniques for arithmetic circuits though these are beyond the scope of this text.
    If you would like to find more details concerning arithmetic circuits and their implementation some books now concentrate on computer arithmetic. They are older texts, but principles don’t change. Parhami (2010), Vladutiu and Du Iu (2012), and Ercegovac and Lang (2003) are all good sources. Naturally, none can divert to texts on computer architecture for which there are many since arithmetic is central to a computer’s organisation. A well-established and excellent text here is Patterson and Hennessy (2008).
  • Book cover image for: Encyclopedia of Computer Science and Technology
    eBook - ePub

    Encyclopedia of Computer Science and Technology

    Volume 2 - AN/FSQ-7 Computer to Bivalent Programming by Implicit Enumeration

    • Jack Belzer(Author)
    • 2020(Publication Date)
    • CRC Press
      (Publisher)
    Division of binary digits.
    1 1
    = 0
    0 1
    = 0
    1 0
    underfined
    0 0
    underfined
    Below are shown several simple arithmetic problems, with the problems solved in both the decimal and the binary number system.
    For fractional numbers the binary system uses negative powers of 2. For example, the fractional binary number 0.10112 is equivalent to the decimal number 0.687510 .
    1 ×
    2
    1
    =
    0.5
    0 ×
    2
    2
    =
    0
    1 ×
    2
    3
    =
    0.125
    1 ×
    2
    4
    =
    0.0625 ¯
    0.6875
    Some fractional values which can be represented exactly in one number system, give non-terminating values in another. Below is shown an example of such a situation.
    Thus, the decimal number 0.2 cannot be represented exactly in the binary number system.
    The word size of a computer dictates the largest number that can be stored in one memory cell. If a binary machine is said to have a word size of 32 bits, this means that each memory cell has 32 bistable devices available to store information. When storing numbers, one of the bistable devices (or bits as they are more often called) must be used to store the sign of the number. The usual convention is that the positive sign is represented by the 0 state, and the negative sign is represented by the 1 state. This leaves 31 bits to store the magnitude of the number. The largest integer that could be stored would be 11111111111111111111111111111112 , all 31 bits in the 1 state. The decimal equivalent to this number is 2,147,483,64710 . If a computer has a 16-bit word length, the largest integer that can be stored would be 1111111111111112 ,15 bits in the 1 state. The decimal equivalent to this number is 32,76710 .
    Computers of today use many ways to perform their arithmetic operations. It would be impossible to discuss all of the techniques that are employed. However, most of the techniques are variations and extensions of the basic concepts that will be presented.
    The heart of the arithmetic unit in a digital computer is the adder. The adder not only performs addition, but it is also used in the subtraction, multiplication, and division operations. An adder can be constructed from some rather simple electronic devices called gates. There are several types of gates, one of which is called an OR gate. Figure 1 shows a schematic sketch of a two-input OR gate, with two sequences of binary digits as its input, and a single sequence as its output. The input and output of the gate would be a train of electrical pulses over time. The presence of a pulse would indicate a 1; the absence of a pulse in a time frame would indicate a 0. From the figure it can be seen that the output from an OR
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.