Number Systems and Number Representation

Total Page:16

File Type:pdf, Size:1020Kb

Number Systems and Number Representation Princeton University Computer Science 217: Introduction to Programming Systems Goals of this Lecture Help you learn (or refresh your memory) about: • The binary, hexadecimal, and octal number systems Number Systems • Finite representation of unsigned integers and • Finite representation of signed integers • Finite representation of rational (floating-point) numbers Number Representation Why? • A power programmer must know number systems and data representation to fully understand C䇻s primitive data types Q: Why do computer programmers confuse Christmas and Halloween? A: Because 25 Dec = 31 Oct Primitive values and the operations on them 1 2 Agenda The Decimal Number System Name 䇾decem䇿 (Latin) ֜ ten • Number Systems Characteristics Finite representation of unsigned integers • Ten symbols Finite representation of signed integers • 0 1 2 3 4 5 6 7 8 9 • Positional Finite representation of rational (floating-point) numbers • 2945 ≠ 2495 • 2945 = (2*103) + (9*102) + (4*101) + (5*100) (Most) people use the decimal number system Why? 3 4 The Binary Number System Decimal-Binary Equivalence binary Decimal Binary Decimal Binary adjective: being in a state of one of two mutually exclusive conditions such as 0 0 16 10000 on or off, true or false, molten or frozen, presence or absence of a signal. 1 1 17 10001 From Late Latin bīnārius (“consisting of two”). 2 10 18 10010 3 11 19 10011 Characteristics 4 100 20 10100 • Two symbols 5 101 21 10101 • 0 1 6 110 22 10110 7 111 23 10111 • Positional 8 1000 24 11000 • 1010B ≠ 1100B 9 1001 25 11001 10 1010 26 11010 Most (digital) computers use the binary number system 11 1011 27 11011 12 1100 28 11100 Terminology Why? 13 1101 29 11101 • Bit: a binary digit 14 1110 30 11110 • Byte: (typically) 8 bits 15 1111 31 11111 ... ... • Nibble (or nybble): 4 bits 5 6 Integer Decimal-Binary Conversion Decimal-Binary Conversion Integer Binary to decimal: expand using positional notation Binary to decimal: expand using positional notation 5 4 3 2 1 0 5 4 3 2 1 0 100101B = (1*2 )+(0*2 )+(0*2 )+(1*2 )+(0*2 )+(1*2 ) 100101B = (1*2 )+(0*2 )+(0*2 )+(1*2 )+(0*2 )+(1*2 ) = 32 + 0 + 0 + 4 + 0 + 1 = 32 + 0 + 0 + 4 + 0 + 1 = 37 = 37 These are integers Most-significant They exist as their pure selves bit (msb) no matter how we might choose to represent them with our Least-significant fingers or toes bit (lsb) 7 8 Integer-Binary Conversion Integer-Binary Conversion Integer to binary: do the reverse Integer to binary shortcut • Determine largest power of 2 ≤ number; write template • Repeatedly divide by 2, consider remainder 37 = (?*25)+(?*24)+(?*23)+(?*22)+(?*21)+(?*20) 37 / 2 = 18 R 1 • Fill in template 18 / 2 = 9 R 0 9 / 2 = 4 R 1 Read from bottom 37 = (1*25)+(0*24)+(0*23)+(1*22)+(0*21)+(1*20) 4 / 2 = 2 R 0 to top: 100101B -32 2 / 2 = 1 R 0 5 1 / 2 = 0 R 1 -4 1 100101B -1 0 9 10 The Hexadecimal Number System Decimal-Hexadecimal Equivalence Name Decimal Hex Decimal Hex Decimal Hex 䇾hexa䇿 (Greek) ֜ six 0 0 16 10 32 20 • 䇾decem䇿 (Latin) ֜ ten 1 1 17 11 33 21 • 2 2 18 12 34 22 Characteristics 3 3 19 13 35 23 • Sixteen symbols 4 4 20 14 36 24 5 5 21 15 37 25 • 0 1 2 3 4 5 6 7 8 9 A B C D E F 6 6 22 16 38 26 • Positional 7 7 23 17 39 27 • A13DH ≠ 3DA1H 8 8 24 18 40 28 9 9 25 19 41 29 Computer programmers often use hexadecimal Why? 10 A 26 1A 42 2A • In C: 0x prefix (0xA13D, etc.) 11 B 27 1B 43 2B 12 C 28 1C 44 2C 13 D 29 1D 45 2D 14 E 30 1E 46 2E 15 F 31 1F 47 2F ... ... 11 12 Integer-Hexadecimal Conversion Binary-Hexadecimal Conversion Hexadecimal to integer: expand using positional notation Observation: 161 = 24 • Every 1 hexadecimal digit corresponds to 4 binary digits 1 0 25H = (2*16 ) + (5*16 ) = 32 + 5 Binary to hexadecimal = 37 Digit count in binary number 1010000100111101 ֜ B not a multiple of 4 A 1 3 DH Integer to hexadecimal: use the shortcut pad with zeros on left Hexadecimal to binary 37 / 16 = 2 R 5 Read from bottom A 1 3 D Discard leading zeros 2 / 16 = 0 R 2 to top: 25 H H 1010000100111101B from binary number if appropriate Is it clear why programmers often use hexadecimal? 13 14 iClicker Question The Octal Number System Q: Convert binary 101010 into decimal and hex Name 䇾octo䇿 (Latin) ֜ eight • A. 21 decimal, 1A hex Characteristics • Eight symbols B. 42 decimal, 2A hex • 0 1 2 3 4 5 6 7 • Positional • 1743O ≠ 7314O C. 48 decimal, 32 hex Computer programmers often use octal (so does Mickey!) • In C: 0 prefix (01743, etc.) D. 55 decimal, 4G hex Why? 16 Agenda Integral Types in Java vs. C Java C Number Systems unsigned char /* 8 bits */ unsigned short Unsigned types char // 16 bits Finite representation of unsigned integers unsigned (int) unsigned long Finite representation of signed integers byte // 8 bits signed char /* Note 2 */ short // 16 bits (signed) short Signed types Finite representation of rational (floating-point) numbers int // 32 bits (signed) int long // 64 bits (signed) long float Floating-point float // 32 bits double types double // 64 bits long double 1. Not guaranteed by C, but on courselab, char = 8 bits, short = 16 bits, int = 32 bits, long = 64 bits, float = 32 bits, double = 64 bits 2. Not guaranteed by C, but on courselab, char is signed To understand C, must consider representation of both 17 unsigned and signed integers 18 Representing Unsigned Integers Representing Unsigned Integers Mathematics On pretend computer Unsigned • Range is 0 to ∞ Integer Rep 0 0000 Computer programming 1 0001 • Range limited by computer䇻s word size 2 0010 Word size is n bits ֜ range is 0 to 2n – 1 3 0011 • 4 0100 • Exceed range overflow 0101 5 ֜ Typical computers today 6 0110 7 0111 32 64 • n = 32 or 64, so range is 0 to 2 – 1 or 2 – 1 (huge!) 8 1000 9 1001 Pretend computer 10 1010 • n = 4, so range is 0 to 24 – 1 (15) 11 1011 12 1100 Hereafter, assume word size = 4 13 1101 • All points generalize to word size = 64, word size = n 14 1110 15 1111 19 20 Adding Unsigned Integers Subtracting Unsigned Integers Addition Subtraction 1 Start at right column Start at right column 3 0011B 111 + 10 + 1010B Proceed leftward Proceed leftward 10 1010B -- ---- Carry 1 when necessary - 7 - 0111B Borrow when necessary 13 1101B -- ---- 3 0011B 1 7 0111B Beware of overflow 1 + 10 + 1010B 3 0011B Beware of overflow -- ---- - 10 - 1010B 1 0001B -- ---- 9 1001B How would you How would you detect overflow detect overflow 4 4 Results are mod 2 programmatically? Results are mod 2 programmatically? 21 22 Shifting Unsigned Integers Other Operations on Unsigned Ints Bitwise right shift (>> in C): fill on left with zeros Bitwise NOT (~ in C) • Flip each bit ֜ 10 >> 1 5 What is the effect 1010B 0101B arithmetically? ~10 ֜ 5 (No fair looking ahead) 1010B 0101B 2 ֜ 2 << 10 1010 0010 B B Bitwise AND (& in C) Bitwise left shift (<< in C): fillill on right i ht with ith zeros • Logical AND corresponding bits 1010 10 10 ֜ 1 >> 5 What is the effect B 0101B 1010B & 7 & 0111B Useful for setting arithmetically? -- ---- (No fair looking ahead) selected bits to 0 0010B 2 12 ֜ 2 >> 3 0011B 1100B Results are mod 24 23 24 Other Operations on Unsigned Ints iClicker Question Bitwise OR: (| in C) Q: How do you set bit “n” (counting lsb=0) of • Logical OR corresponding bits unsigned variable “u” to zero? 10 1010B | 1 | 0001B Useful for setting A. u &= (0 << n); -- ---- selected bits to 1 11 1011B B. u |= (1 << n); Bitwise exclusive OR (^ in C) • Logical exclusive OR corresponding bits C. u &= ~(1 << n); 10 1010B ^ 10 ^ 1010B x ^ x sets D. u |= ~(1 << n); -- ---- all bits to 0 0 0000B E. u = ~u ^ (1 << n); 25 Aside: Using Bitwise Ops for Arith Aside: Example C Program Can use <<, >>, and & to do some arithmetic efficiently #include <stdio.h> #include <stdlib.h> x * 2y == x << y Fast way to multiply What does it int main(void) 2 ?by a power of 2 { unsigned int n; write 12 ֜ 2>>3 = 2*3 = 4*3 • y unsigned int count = 0; x / 2 == x >> y Fast way to divide printf("Enter an unsigned integer: "); (unsigned by power of 2 if (scanf("%u", &n) != 1 3 ֜ 2<<13 = 13/22 = 13/4 • { fprintf(stderr, "Error: Expect unsigned int.\n"); y y x % 2 == x & (2 -1) Fast way to mod exit(EXIT_FAILURE); • 13%4 = 13%22 = 13&(22-1) by a power of 2 } (while (n > 0 1 ֜ 3&13 = { count += (n & 1); 13 1101B Many compilers will n = n >> 1; & 3 & 0011B } How could you -- ---- do these transformations printf("%u\n", count); express this more 1 0001B automatically! return 0; succinctly? } 27 282 Agenda Sign-Magnitude Integer Rep Number Systems -7 1111 -6 1110 Finite representation of unsigned integers -5 1101 -4 1100 Definition Finite representation of signed integers -3 1011 High-order bit indicates sign -2 1010 Finite representation of rational (floating-point) numbers -1 1001 0 ֜ positive negative ֜ 1 1000 -0 0 0000 Remaining bits indicate magnitude 1 0001 2 0010 1101B = -101B = -5 3 0011 0101B = 101B = 5 4 0100 5 0101 6 0110 7 0111 29 30 Sign-Magnitude (cont.) Ones䇻 Complement Integer Rep Integer Rep -7 1111 -7 1000 -6 1110 Computing negative -6 1001 -5 1101 neg(x) = flip high order bit of x -5 1010 -4 1100 neg(0101 ) = 1101 -4 1011 Definition -3 1011 B B -3 1100 High-order bit has weight -7 -2 1010 neg(1101B) = 0101B -2 1101 -1 1001 -1 1110 1010B = (1*-7)+(0*4)+(1*2)+(0*1) -0 1000 Pros and cons -0 1111 = -5 0 0000 0 0000 0010 = (0*-7)+(0*4)+(1*2)+(0*1) 1 0001 + easy for people to understand 1 0001 B 2 0010 + symmetric 2 0010 = 2 3 0011 - two representations of zero 3 0011 4 0100 4 0100 5 0101 - need different algorithms to add 5 0101 6 0110 signed and unsigned numbers 6 0110 7 0111 7 0111 31 32 Ones䇻 Complement (cont.) Two䇻s Complement Integer Rep Integer Rep -7 1000 Computing negative
Recommended publications
  • 13054-Duodecimal.Pdf
    Universal Multiple-Octet Coded Character Set International Organization for Standardization Organisation Internationale de Normalisation Международная организация по стандартизации Doc Type: Working Group Document Title: Proposal to encode Duodecimal Digit Forms in the UCS Author: Karl Pentzlin Status: Individual Contribution Action: For consideration by JTC1/SC2/WG2 and UTC Date: 2013-03-30 1. Introduction The duodecimal system (also called dozenal) is a positional numbering system using 12 as its base, similar to the well-known decimal (base 10) and hexadecimal (base 16) systems. Thus, it needs 12 digits, instead of ten digits like the decimal system. It is used by teachers to explain the decimal system by comparing it to an alternative, by hobbyists (see e.g. fig. 1), and by propagators who claim it being superior to the decimal system (mostly because thirds can be expressed by a finite number of digits in a "duodecimal point" presentation). • Besides mathematical and hobbyist publications, the duodecimal system has appeared as subject in the press (see e.g. [Bellos 2012] in the English newspaper "The Guardian" from 2012-12-12, where the lack of types to represent these digits correctly is explicitly stated). Such examples emphasize the need of the encoding of the digit forms proposed here. While it is common practice to represent the extra six digits needed for the hexadecimal system by the uppercase Latin capital letters A,B.C,D,E,F, there is no such established convention regarding the duodecimal system. Some proponents use the Latin letters T and E as the first letters of the English names of "ten" and "eleven" (which obviously is directly perceivable only for English speakers).
    [Show full text]
  • Positional Notation Or Trigonometry [2, 13]
    The Greatest Mathematical Discovery? David H. Bailey∗ Jonathan M. Borweiny April 24, 2011 1 Introduction Question: What mathematical discovery more than 1500 years ago: • Is one of the greatest, if not the greatest, single discovery in the field of mathematics? • Involved three subtle ideas that eluded the greatest minds of antiquity, even geniuses such as Archimedes? • Was fiercely resisted in Europe for hundreds of years after its discovery? • Even today, in historical treatments of mathematics, is often dismissed with scant mention, or else is ascribed to the wrong source? Answer: Our modern system of positional decimal notation with zero, to- gether with the basic arithmetic computational schemes, which were discov- ered in India prior to 500 CE. ∗Bailey: Lawrence Berkeley National Laboratory, Berkeley, CA 94720, USA. Email: [email protected]. This work was supported by the Director, Office of Computational and Technology Research, Division of Mathematical, Information, and Computational Sciences of the U.S. Department of Energy, under contract number DE-AC02-05CH11231. yCentre for Computer Assisted Research Mathematics and its Applications (CARMA), University of Newcastle, Callaghan, NSW 2308, Australia. Email: [email protected]. 1 2 Why? As the 19th century mathematician Pierre-Simon Laplace explained: It is India that gave us the ingenious method of expressing all numbers by means of ten symbols, each symbol receiving a value of position as well as an absolute value; a profound and important idea which appears so simple to us now that we ignore its true merit. But its very sim- plicity and the great ease which it has lent to all computations put our arithmetic in the first rank of useful inventions; and we shall appre- ciate the grandeur of this achievement the more when we remember that it escaped the genius of Archimedes and Apollonius, two of the greatest men produced by antiquity.
    [Show full text]
  • Maths Week 2021
    Maths Week 2021 Survivor Series/Kia Mōrehurehu Monday Level 5 Questions What to do for students 1 You can work with one or two others. Teams can be different each day. 2 Do the tasks and write any working you did, along with your answers, in the spaces provided (or where your teacher says). 3 Your teacher will tell you how you can get the answers to the questions and/or have your work checked. 4 When you have finished each day, your teacher will give you a word or words from a proverb. 5 At the end of the week, put the words together in the right order and you will be able to find the complete proverb! Your teacher may ask you to explain what the proverb means. 6 Good luck. Task 1 – numbers in te reo Māori The following chart gives numbers in te reo Māori. Look at the chart carefully and note the patterns in the way the names are built up from 10 onwards. Work out what each of the numbers in the following calculations is, do each calculation, and write the answer in te reo Māori. Question Answer (a) whitu + toru (b) whā x wa (c) tekau mā waru – rua (d) ono tekau ma whā + rua tekau ma iwa (e) toru tekau ma rua + waru x tekau mā ono Task 2 - Roman numerals The picture shows the Roman Emperor, Julius Caesar, who was born in the year 100 BC. (a) How many years ago was 100 BC? You may have seen places where numbers have been written in Roman numerals.
    [Show full text]
  • The Hexadecimal Number System and Memory Addressing
    C5537_App C_1107_03/16/2005 APPENDIX C The Hexadecimal Number System and Memory Addressing nderstanding the number system and the coding system that computers use to U store data and communicate with each other is fundamental to understanding how computers work. Early attempts to invent an electronic computing device met with disappointing results as long as inventors tried to use the decimal number sys- tem, with the digits 0–9. Then John Atanasoff proposed using a coding system that expressed everything in terms of different sequences of only two numerals: one repre- sented by the presence of a charge and one represented by the absence of a charge. The numbering system that can be supported by the expression of only two numerals is called base 2, or binary; it was invented by Ada Lovelace many years before, using the numerals 0 and 1. Under Atanasoff’s design, all numbers and other characters would be converted to this binary number system, and all storage, comparisons, and arithmetic would be done using it. Even today, this is one of the basic principles of computers. Every character or number entered into a computer is first converted into a series of 0s and 1s. Many coding schemes and techniques have been invented to manipulate these 0s and 1s, called bits for binary digits. The most widespread binary coding scheme for microcomputers, which is recog- nized as the microcomputer standard, is called ASCII (American Standard Code for Information Interchange). (Appendix B lists the binary code for the basic 127- character set.) In ASCII, each character is assigned an 8-bit code called a byte.
    [Show full text]
  • The What and Why of Whole Number Arithmetic: Foundational Ideas from History, Language and Societal Changes
    Portland State University PDXScholar Mathematics and Statistics Faculty Fariborz Maseeh Department of Mathematics Publications and Presentations and Statistics 3-2018 The What and Why of Whole Number Arithmetic: Foundational Ideas from History, Language and Societal Changes Xu Hu Sun University of Macau Christine Chambris Université de Cergy-Pontoise Judy Sayers Stockholm University Man Keung Siu University of Hong Kong Jason Cooper Weizmann Institute of Science SeeFollow next this page and for additional additional works authors at: https:/ /pdxscholar.library.pdx.edu/mth_fac Part of the Science and Mathematics Education Commons Let us know how access to this document benefits ou.y Citation Details Sun X.H. et al. (2018) The What and Why of Whole Number Arithmetic: Foundational Ideas from History, Language and Societal Changes. In: Bartolini Bussi M., Sun X. (eds) Building the Foundation: Whole Numbers in the Primary Grades. New ICMI Study Series. Springer, Cham This Book Chapter is brought to you for free and open access. It has been accepted for inclusion in Mathematics and Statistics Faculty Publications and Presentations by an authorized administrator of PDXScholar. Please contact us if we can make this document more accessible: [email protected]. Authors Xu Hu Sun, Christine Chambris, Judy Sayers, Man Keung Siu, Jason Cooper, Jean-Luc Dorier, Sarah Inés González de Lora Sued, Eva Thanheiser, Nadia Azrou, Lynn McGarvey, Catherine Houdement, and Lisser Rye Ejersbo This book chapter is available at PDXScholar: https://pdxscholar.library.pdx.edu/mth_fac/253 Chapter 5 The What and Why of Whole Number Arithmetic: Foundational Ideas from History, Language and Societal Changes Xu Hua Sun , Christine Chambris Judy Sayers, Man Keung Siu, Jason Cooper , Jean-Luc Dorier , Sarah Inés González de Lora Sued , Eva Thanheiser , Nadia Azrou , Lynn McGarvey , Catherine Houdement , and Lisser Rye Ejersbo 5.1 Introduction Mathematics learning and teaching are deeply embedded in history, language and culture (e.g.
    [Show full text]
  • Positional Notation Consider 101 1015 = ? Binary: Base 2
    1/21/2019 CS 362: Computer Design Positional Notation Lecture 3: Number System Review • The meaning of a digit depends on its position in a number. • A number, written as the sequence of digits dndn‐1…d2d1d0 in base b represents the value d * bn + d * bn‐1 + ... + d * b2 + d * b1 + d * b0 Cynthia Taylor n n‐1 2 1 0 University of Illinois at Chicago • For a base b, digits will range from 0 to b‐1 September 5th, 2017 Consider 101 1015 = ? • In base 10, it represents the number 101 (one A. 26 hundred one) = B. 51 • In base 2, 1012 = C. 126 • In base 8, 1018 = D. 130 101‐3=? Binary: Base 2 A. ‐10 • Used by computers B. 8 • A number, written as the sequence of digits dndn‐1…d2d1d0 where d is in {0,1}, represents C. 10 the value n n‐1 2 1 0 dn * 2 + dn‐1 * 2 + ... + d2 * 2 + d1 * 2 + d0 * 2 D. ‐30 1 1/21/2019 Binary to Decimal Decimal to Binary • Use polynomial expansion • Repeatedly divide by 2, recording the remainders. • The remainders form the binary digits of the number. 101102 = • Converting 25 to binary 3410=?2 Hexadecimal: Base 16 A. 010001 • Like binary, but shorter! • Each digit is a “nibble”, or half a byte • Indicated by prefacing number with 0x B. 010010 • A number, written as the sequence of digits dndn‐ C. 100010 1…d2d1d0 where d is in {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}, represents the value D.
    [Show full text]
  • 2 1 2 = 30 60 and 1
    Math 153 Spring 2010 R. Schultz SOLUTIONS TO EXERCISES FROM math153exercises01.pdf As usual, \Burton" refers to the Seventh Edition of the course text by Burton (the page numbers for the Sixth Edition may be off slightly). Problems from Burton, p. 28 3. The fraction 1=6 is equal to 10=60 and therefore the sexagesimal expression is 0;10. To find the expansion for 1=9 we need to solve 1=9 = x=60. By elementary algebra this means 2 9x = 60 or x = 6 3 . Thus 6 2 1 6 40 1 x = + = + 60 3 · 60 60 60 · 60 which yields the sexagsimal expression 0; 10; 40 for 1/9. Finding the expression for 1/5 just amounts to writing this as 12/60, so the form here is 0;12. 1 1 30 To find 1=24 we again write 1=24 = x=60 and solve for x to get x = 2 2 . Now 2 = 60 and therefore we can proceed as in the second example to conclude that the sexagesimal form for 1/24 is 0;2,30. 1 One proceeds similarly for 1/40, solving 1=40 = x=60 to get x = 1 2 . Much as in the preceding discussion this yields the form 0;1,30. Finally, the same method leads to the equation 5=12 = x=60, which implies that 5/12 has the sexagesimal form 0;25. 4. We shall only rewrite these in standard base 10 fractional notation. The answers are in the back of Burton. (a) The sexagesimal number 1,23,45 is equal to 1 3600 + 23 60 + 45.
    [Show full text]
  • Bit, Byte, and Binary
    Bit, Byte, and Binary Number of Number of values 2 raised to the power Number of bytes Unit bits 1 2 1 Bit 0 / 1 2 4 2 3 8 3 4 16 4 Nibble Hexadecimal unit 5 32 5 6 64 6 7 128 7 8 256 8 1 Byte One character 9 512 9 10 1024 10 16 65,536 16 2 Number of bytes 2 raised to the power Unit 1 Byte One character 1024 10 KiloByte (Kb) Small text 1,048,576 20 MegaByte (Mb) A book 1,073,741,824 30 GigaByte (Gb) An large encyclopedia 1,099,511,627,776 40 TeraByte bit: Short for binary digit, the smallest unit of information on a machine. John Tukey, a leading statistician and adviser to five presidents first used the term in 1946. A single bit can hold only one of two values: 0 or 1. More meaningful information is obtained by combining consecutive bits into larger units. For example, a byte is composed of 8 consecutive bits. Computers are sometimes classified by the number of bits they can process at one time or by the number of bits they use to represent addresses. These two values are not always the same, which leads to confusion. For example, classifying a computer as a 32-bit machine might mean that its data registers are 32 bits wide or that it uses 32 bits to identify each address in memory. Whereas larger registers make a computer faster, using more bits for addresses enables a machine to support larger programs.
    [Show full text]
  • Number Systems and Number Representation Aarti Gupta
    Number Systems and Number Representation Aarti Gupta 1 For Your Amusement Question: Why do computer programmers confuse Christmas and Halloween? Answer: Because 25 Dec = 31 Oct -- http://www.electronicsweekly.com 2 Goals of this Lecture Help you learn (or refresh your memory) about: • The binary, hexadecimal, and octal number systems • Finite representation of unsigned integers • Finite representation of signed integers • Finite representation of rational numbers (if time) Why? • A power programmer must know number systems and data representation to fully understand C’s primitive data types Primitive values and the operations on them 3 Agenda Number Systems Finite representation of unsigned integers Finite representation of signed integers Finite representation of rational numbers (if time) 4 The Decimal Number System Name • “decem” (Latin) => ten Characteristics • Ten symbols • 0 1 2 3 4 5 6 7 8 9 • Positional • 2945 ≠ 2495 • 2945 = (2*103) + (9*102) + (4*101) + (5*100) (Most) people use the decimal number system Why? 5 The Binary Number System Name • “binarius” (Latin) => two Characteristics • Two symbols • 0 1 • Positional • 1010B ≠ 1100B Most (digital) computers use the binary number system Why? Terminology • Bit: a binary digit • Byte: (typically) 8 bits 6 Decimal-Binary Equivalence Decimal Binary Decimal Binary 0 0 16 10000 1 1 17 10001 2 10 18 10010 3 11 19 10011 4 100 20 10100 5 101 21 10101 6 110 22 10110 7 111 23 10111 8 1000 24 11000 9 1001 25 11001 10 1010 26 11010 11 1011 27 11011 12 1100 28 11100 13 1101 29 11101 14 1110 30 11110 15 1111 31 11111 ..
    [Show full text]
  • Binary Numbers
    Binary Numbers X. Zhang Fordham Univ. 1 Numeral System ! A way for expressing numbers, using symbols in a consistent manner. ! ! "11" can be interpreted differently:! ! in the binary symbol: three! ! in the decimal symbol: eleven! ! “LXXX” represents 80 in Roman numeral system! ! For every number, there is a unique representation (or at least a standard one) in the numeral system 2 Modern numeral system ! Positional base 10 numeral systems ! ◦ Mostly originated from India (Hindu-Arabic numeral system or Arabic numerals)! ! Positional number system (or place value system)! ◦ use same symbol for different orders of magnitude! ! For example, “1262” in base 10! ◦ the “2” in the rightmost is in “one’s place” representing “2 ones”! ◦ The “2” in the third position from right is in “hundred’s place”, representing “2 hundreds”! ◦ “one thousand 2 hundred and sixty two”! ◦ 1*103+2*102+6*101+2*100 3 Modern numeral system (2) ! In base 10 numeral system! ! there is 10 symbols: 0, 1, 2, 3, …, 9! ! Arithmetic operations for positional system is simple! ! Algorithm for multi-digit addition, subtraction, multiplication and division! ! This is a Chinese Abacus (there are many other types of Abacus in other civilizations) dated back to 200 BC 4 Other Positional Numeral System ! Base: number of digits (symbols) used in the system.! ◦ Base 2 (i.e., binary): only use 0 and 1! ◦ Base 8 (octal): only use 0,1,…7! ◦ Base 16 (hexadecimal): use 0,1,…9, A,B,C,D,E,F! ! Like in decimal system, ! ◦ Rightmost digit: represents its value times the base to the zeroth power!
    [Show full text]
  • About Numbers How These Basic Tools Appeared and Evolved in Diverse Cultures by Allen Klinger, Ph.D., New York Iota ’57
    About Numbers How these Basic Tools Appeared and Evolved in Diverse Cultures By Allen Klinger, Ph.D., New York Iota ’57 ANY BIRDS AND Representation of quantity by the AUTHOR’S NOTE insects possess a The original version of this article principle of one-to-one correspondence 1 “number sense.” “If is on the web at http://web.cs.ucla. was undoubtedly accompanied, and per- … a bird’s nest con- edu/~klinger/number.pdf haps preceded, by creation of number- mtains four eggs, one may be safely taken; words. These can be divided into two It was written when I was a fresh- but if two are removed, the bird becomes man. The humanities course had an main categories: those that arose before aware of the fact and generally deserts.”2 assignment to write a paper on an- the concept of number unrelated to The fact that many forms of life “sense” thropology. The instructor approved concrete objects, and those that arose number or symmetry may connect to the topic “number in early man.” after it. historic evolution of quantity in differ- At a reunion in 1997, I met a An extreme instance of the devel- classmate from 1954, who remem- ent human societies. We begin with the bered my paper from the same year. opment of number-words before the distinction between cardinal (counting) As a pack rat, somehow I found the abstract concept of number is that of the numbers and ordinal ones (that show original. Tsimshian language of a tribe in British position as in 1st or 2nd).
    [Show full text]
  • Application of Number System in Maths
    Application Of Number System In Maths Zollie is mystifying: she verbifies ethnically and unhusk her zoom. Elton congees pointlessly as Griswoldthigmotropic always Brooks scowls precipitates enharmonically her kinswoman and associated debussed his stout-heartedly.coatracks. Associable and communal Traces of the anthropomorphic origin of counting systems can is found show many languages. Thank you hesitate your rating. Accordingly there can be no fit in determining the place. Below provided a technique for harm with division problems with deed or more digits in the assert on the abacus. Attempts have been made people adopt better systems, fill it determined, they reresent zero and when that are rocked to verify right side represent one. Now customize the name see a clipboard to repeal your clips. Study the mortgage number systems in the joy given here. Indians abandoned the rest of rational numbers on the principal amount of the acuity at shanghai: number of natural numbers are related role of each week. The development of getting ten symbols and their use until a positional system comes to us primarily from India. Learn via the applications of algebra in women life. The one quantity is having constant multiple of more reciprocal demand the other. In this blog, a college entrance exam that includes many formal math abilities. We recommend just writing work somewhere this whole class can gauge them. Kagan curriculum for the base value numbers are not control for simplicity, telling us understand only eight is a tool for people attending class of number system in maths. When casting a hexagram, a the system how a spit to represent numbers.
    [Show full text]