0 Up votes0 Down votes

8 views5 pagesnumbers

Feb 09, 2014

© Attribution Non-Commercial (BY-NC)

DOC, PDF, TXT or read online from Scribd

numbers

Attribution Non-Commercial (BY-NC)

8 views

numbers

Attribution Non-Commercial (BY-NC)

- Neuromancer
- The E-Myth Revisited: Why Most Small Businesses Don't Work and
- How Not to Be Wrong: The Power of Mathematical Thinking
- Drive: The Surprising Truth About What Motivates Us
- Chaos: Making a New Science
- The Joy of x: A Guided Tour of Math, from One to Infinity
- How to Read a Person Like a Book
- Moonwalking with Einstein: The Art and Science of Remembering Everything
- The Wright Brothers
- The Other Einstein: A Novel
- The 6th Extinction
- The Housekeeper and the Professor: A Novel
- The Power of Discipline: 7 Ways it Can Change Your Life
- The 10X Rule: The Only Difference Between Success and Failure
- A Short History of Nearly Everything
- The Kiss Quotient: A Novel
- The End of Average: How We Succeed in a World That Values Sameness
- Made to Stick: Why Some Ideas Survive and Others Die
- Algorithms to Live By: The Computer Science of Human Decisions
- The Universe in a Nutshell

You are on page 1of 5

Object of laboratory The object of this laboratory is understanding the way an integer or decimal number is converted from a base to another. This paper will focus on converting integer and decimal numbers from base 10 to a random base, especially bases 16, 2 and 8, and also on the reverse conversion, from a random base to base 10, especially from bases 16, 2 and 8. irect conversion from base 16 to bases 2 or 8, and vice versa, will also be studied. !imple operations "add, subtract# in different numeration bases will be presented later. Theoretical considerations $ numeration system consists of all the number representation rules by means of certain symbols, called digits. %or any numeration system, the number of distinct symbols for the system&s digits is e'ual with the base "b#. !o, if the base b(2 "the numbers are written in binary#, the symbols will be the 0 and 1 digits. %or base b(16 "he)adecimal# the symbols will be 0, 1, 2, *, +, ,, 6, -, 8, ., $, /, 0, , 1, %. 2ne can notice that for numbers written in a base higher than 10, other symbols "letters# are used besides the common digits for base 10. Therefore, in the case of numbers written in he)adecimal, the letters $, /, 0, , 1, % have the associated values of 10, 11, 12, 1*, 1+, 1,. To ma3e an easier distinction between numbers written in a certain base, at the the end of the number another letter is written, which represents the base, for instance4 / for numbers written in binary "base 2# 5 for numbers written in octal "base 8# for numbers written in decimal "base 10# 6 for numbers written in he)adecimal "base 16# 7sually, numbers written in decimal don&t necessarily have to be followed by the 8 9 symbol, because this base is considered to be implicit. There are others ways to write a number, li3e writing the base at the end of the number in brac3ets, for instance4 100101001 "2# or 1-$6/ "16#. :f a number in a certain base 8b9 is given, as an integer and a decimal part4 ;r "b# ( 0n 0n<1 0n<2 = 0201 00 , 1 2 2 *= , than its value in base 10 will be4 ;r "10# ( 0n > bn ? 0 n<1 > bn<1 ? = ? 0 2 > b2 ? 0 1 > b1? 0 0 > b0 ? 1 > b<1 ? 2 > b @2 ? ? * > b @* ? = Number conversion from base 10 to a random base %irst of all, it must be pointed out that for converting a number that consists of both integer and decimal part, both parts have to be converted separately.

Converting the integer part The simplest algorithm consists of successively dividing the number written in decimal to the base that the conversion will be made to "the number is divided by the base, then the 'uotient is divided by the base and so on, until the 'uotient becomes 0#, after which the rests that were obtained are ta3en, reversing the order they appeared in, which represents the value of the number in that base. 1)amples4 0onverting the integer numbers *+- and +*8 from base 10 to bases 16, 2 and 8. %irst, the numbers will be converted to base 16 because this operation is done with fewer divisions than the conversions to bases 2 and 8. *+- 16 *2 21 16 2- 16 1 16 16 5 0 0 11 1 "which is 8B9# Therefore, reversing the order of the rests we have 1,/ "6#. %urther on, one can convert to bases 2 and 8 in the same manner, but there is also a 'uic3er way to convert numbers between bases 2, 8 and 16, given the fact that for each he)a digit there is a corresponding + binary digit number, and that for each digit in octal there are * corresponding binary digits, as seen in the table below4 Aalue in decimal 0 1 2 * + , 6 8 . 10 11 12 1* 1+ 1, Aalue in he)adecimal 0 1 2 * + , 6 8 . $ / 0 1 % /inary number corresponding to he)adecimal 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 /inary number corresponding to octal 000 001 010 011 100 101 110 111

There also has to be considered that when a number is passed between bases 2, 8, 16, grouping the digits is done 8from the comma towards the e)tremities9, meaning that for

integer numbers it is done from the right to the left "by completing the number with Beros on the left side in case this is re'uired, that is on the side that doesn&t affect its value#, and for decimal numbers the grouping is done after the comma, from the left side to the right, by filling in with Beros at the right side of the number. Therefore, *+- " # ( 1,/ "6# ( 1 0101 1011 "/# ( ,** "2# +*8 " # ( 1/6 "6# ( 1 1011 0110 "/# ( 666 "2# Converting the decimal part To convert a sub<unitary number "that is the fractionary part of a number# from base 10 to a random base, a series of successive multiplications of the fractionary parts has to be done, until the fractionary part becomes null, a period is found or the representation capacity is surpassed "a sufficient number of digits has been obtained, although the algorithm hasn&t finished#. The digit that surpasses the decimal part at each multiplication is a digit of that number, in the base that the conversion is made to. $s an e)ample, it is easy to use the following scheme, in which the digits of the representation are more clearly represented with the help of the two lines. $lso, the position of the comma is more obvious "the numbers below the first multiplication, that is the ones under the line, are positioned after the comma#. 2ne must notice that only what is on the right side of the comma is multiplied. 1)ample4 0onversion of the number 0, +- " # to binary, octal and he)adecimal4 0, +->2 0 .+ 1 88 1 -6 1 ,2 1 0+ 0 08 0 16 0 *2 0 6+ 1 28 0 ,6 1 12 0 2+ 0 +8 0 .6 1 ... !o4 0, +- " # ( 0, 0111 1000 0101 0001 "/# ( 0, -8,1 "6# ( 0, *60, "2# 0onverting a number that has both an integer and a decimal part is done by successively converting the integer part and the decimal one.

1)ample4 Cepresentation in bases 2 and 16 of the real number 1+, -, De obtain4 1+ " # ( 1110 "/# ( 1 "6# and 0, -, " # ( 0, 11 "/# ( 0 "6#. Therefore 1+, -, " # ( 1110, 11 "/# ( 1, 0 "6# Converting a number from a random base to base 10 %or converting a number from a random base to base 10 one can use the formula that was defined in the first part of this lab, meaning that if a number is written in a random base 8b9 as an integer and decimal part4 ;r "b# ( 0n 0n<1 0n<2 = 0201 00 , 1 2 2 *= than its value in base 10 will be4 ;r "10# ( 0n > bn ? 0 n<1 > bn<1 ? = ? 0 2 > b2 ? 0 1 > b1? 0 0 > b0 ? 1 > b<1 ? 2 > b @2 ? ? * > b @* ? = 1)ample4 The number *$8 "6# is given in he)adecimal and its value in decimal is re'uired4 ; ( *>162 ? 10>16 1 ? 8 ( *>2,6 ? 160 ? 8 ( .*6 " # The fractionary number 0, *+1 "5# written in base 8 is given and its value in decimal is re'uired4 ; ( *>8 @1 ? +>8 @2 ?1>8 @* ( *E8 ?+E6+ ? 1E,12 ( 0. +*.+ " # The binary number 110, 11 "/# is given and its values in he)adecimal and decimal are re'uired4 ; ( 110, 11 "/# ( 6, 0 "6# ( 6, -, " #

Simple operations with numbers written in different bases %urther, the adding and subtracting of integer unsigned numbers written in binary, octal and he)adecimal is presented. Adding $dding is done by the same rules that e)ist in decimal, with the remar3 that the highest digit in a base 8b9 will be b<1 ". in decimal, - in octal, 1 in binary and % in he)adecimal#. Therefore, when a result higher than b<1 is obtained by adding two digits of ran3 8i9, a carry will appear to the digit having the 8i9?1 ran3. 2n the position ran3ed 8i9 will be the rest of the division of the result obtained by adding the ran3 8i9 digits, by the base. The carry to the 8i9?1 ran3 digit will become a new unit to the adding of the ran3 8i9?1 digits, meaning that a 1 will be added "the carry#. 1)amples4 1111 1 11 11 01010110 "/#? 1*6+ "5#? 6 8$*2 "6#? 10110101 "/# *-21 "5# **1+08 "6# 100001011 "/# ,*0, "5# $161%$ "6#

The 1 unit carry to the higher ran3ed digit was mar3ed by writing a 1 above the superior ran3ed digit to which the carry was made. The adding operation in binary is useful for representing a number in complement by 2 , when one chooses to add a 1 to the number&s representation in complement by 1 "see lab about data representation#. 1)amples4 The students have to add the 2 integer numbers *+- " # and +*8 " # that were converted earlier in the lab to bases 16 and 8, and to chec3 the result by converting it to base 10. *+- " #? +*8 " # ( -8, " # 1,/ "6# ? 1/6 "6# ( *11 "6#. 0hec3ing4 *11 "6# ( *>2,6?1>16?1 ( -8, ,** "5# ? 666 "5# ( 1+21 "5#. 0hec3ing41+21 "5# ( 1>,12?+>6+?2>8?1 ( -8, Subtraction The subtraction rules in decimal are also used for other bases4 if one can&t subtract two digits of ran3 8i9 "if the minuend&s digit is lower than the subtrahend&s#, then a unit is 8borrowed9 from the ne)t ran3ed digit "8i9?1#. :f the digit from which borrowing is desired is 0, than one borrows further from the ne)t ran3ed digit. 1)amples4 .. 01011010 "/# @ 01001100 "/# 00001110 "/# . . $* + "6# @ -,1/ "6# 21/. "6#

The students have to subtract the two integer numbers *+- " # Fi +*8 " # that were converted earlier in the lab to the numeration bases 16 and 8, and to chec3 the result by converting it to decimal.

+*8 @ *+- ( .1 " # 1/6 "6# @ 1,/ "6# ( ,/ "6#. 0hec3ing4 ,/ "6# ( ,>16?11 ( .1 666 "5# @ ,** "5# ( 1** "5#. 0hec3ing4 1** "5# ( 1>6+?*>8?* ( .1 !ubtraction is useful when it is desired to represent numbers in complement by 2 and a subtraction from 2noGofGrepreBGdigits ? 1 of the absolute value of the number is made. Lab tas s The students will do the presented conversions4 0onverting the numbers from base 10 to bases 2, 8 and 16 0onverting a number between bases 2, 8 and 16 0onverting from bases 2, 8 and 16 to base 10 0onverting decimal numbers from base 10 to bases 2 and 16 The add and subtract operations for numbers in bases 2 and 16

- Collection of Number Programs Using Recursion Version 1Uploaded byDeep Patel
- 1 2 3 ak binarynumbersconversionUploaded byapi-290804719
- Exp 1- Number System-2017Uploaded byEdwin Quinlat Deviza
- Chap 4 UpdatedUploaded byShihabAkhand
- Dll Mathematics 6 q3 w4Uploaded byRaquel Tomas Castillo
- Introduction to ComputersUploaded bySashweana Rajendran
- 01.NumberSystemsUploaded bylloydadam_029
- huuliUploaded byTuluvsaikhan Battulga
- Lesson 1(Ictelective)Uploaded byEric Leo Asiamah
- A Textbook of Engineering Physics_M. N. Avadhanulu, And P. G. KshirsagarUploaded bySHREYASI PATIL
- 01.NumberSystemsUploaded bykjislam
- Lecture 3 - Data Rep. and Storage cont..pdfUploaded bysunnyopg
- Computer Representation of Numbers and Computer ArithmeticUploaded byprabuparthiban
- COM-CH#5 9th Half.docxUploaded byMuhammad Asim
- 05) Mathematics for General Computing.pptxUploaded byRuffee Careem
- test uploadUploaded byJun Heng
- Binary to DecimalUploaded byCons Monreal Jr.
- avr-booklet.pdfUploaded byYassineZkl
- CS1101 fcpUploaded byAamir Khan
- binaryUploaded byapi-417400228
- subtraction from 4 and 5Uploaded byapi-242929438
- enen abmbUploaded byabrahnm
- Logic DevicesUploaded byChandan Chandrashekar
- Exam 1 Answers (1)Uploaded byAbdul Ali
- To Learn Mathematics-mayan MathematicsUploaded byAbraham Toriz Cruz
- R1. Computer Fundamental by Goel AnitaUploaded byssjatav
- Arithmetic CircuitsUploaded byjames-lawson
- Modern Cryptography DdddUploaded byShot Shot
- MELJUN CORTES CS 123 Digital Design and Pc Trouble Shooting- Teacher-itUploaded byMELJUN CORTES, MBA,MPA
- kj-mod1-130728202756-phpapp02Uploaded byGopi

- symplectic geometryUploaded byIulian Danciu
- Doc1Uploaded byIulian Danciu
- EquivalenceUploaded byIulian Danciu
- LinearAlgebra-Ver1.4[1].pdfUploaded byIulian Danciu
- math for developersUploaded byIulian Danciu
- Maths - geometryUploaded byIulian Danciu
- PlaylistUploaded byIulian Danciu
- Beamer Class Example3Uploaded byNchank Saja
- Manifolds 2012Uploaded byKirk Bennett
- math problemUploaded byIulian Danciu
- about movie JesusUploaded byIulian Danciu
- volum matwUploaded byIulian Danciu
- guide englezeUploaded byIulian Danciu
- test englishUploaded byIulian Danciu
- Lecture10_3.4Uploaded byIulian Danciu
- Lecture NotesUploaded bySohail Afridi
- VladUploaded byIulian Danciu
- maths.txtUploaded byIulian Danciu
- MathsUploaded byIulian Danciu
- The Moscow PuzzleUploaded bymartosportos
- Moment Map - Symplectit GeometryUploaded byIulian Danciu
- Moment Map - Symplectit GeometryUploaded byIulian Danciu
- comunicareUploaded byIulian Danciu
- Actions groupsUploaded byIulian Danciu
- gelfan's theoremUploaded byIulian Danciu
- CombinatoricsUploaded byIulian Danciu
- 23 RearrangeUploaded byIulian Danciu
- Watch ListUploaded byIulian Danciu
- miktexUploaded byIulian Danciu

- AlgebraUploaded byhassial
- numbook1Uploaded byapi-306029279
- 3Uploaded byKxng Bryce
- BesUploaded byJomer Ruego
- expt 2Uploaded bytoshgangwar
- 6th grade math curriculum and pacing guide 16-17Uploaded byapi-361165187
- Chapter IV Computer Arithmetic (1)Uploaded byjohnsamvlb
- fxngcdnUploaded bywexler
- Basic Arithmetic Operations Short CutsUploaded bykarupu31081991
- Design of Double Precision IEEE-754 Floating-Point UnitsUploaded byMichael Kennedy
- r5220404-Switching Theory and Logic Design 2-2 r05 AllsetsUploaded bysivabharathamurthy
- 5 Variable K-Map.pptUploaded byBen Sewell
- Aptitude ShortcutsUploaded bycadeautulip
- Conversion TableUploaded byRicardo Vivanco
- aimepracUploaded byxpgong
- 77096278 F1 Maths Annual Scheme of Work 2012Uploaded bySayidiAshrafChan
- 15 Surds and Indices.pdfUploaded byashna
- 3-3 Adding and Subtracting DecimalsUploaded byThe Isabelina Official
- DOC-20190418-WA0004.pdfUploaded byJochum
- GWM Homework HelperUploaded byLori Phillips Simonson
- Lecture07_IE321_DrAtifShahzad.pdfUploaded byatifshahzad
- One Stop MBA - 3Uploaded byvishnu_mcj
- Mathematics Part-1 of 4Uploaded byKamapantula Srinivas
- 98Uploaded bySilviu
- Positive and Negative IntegersUploaded byRoxenette Gil Bernales Pangilinan
- C++ Beginner's Guide CH02Uploaded byapi-3742858
- Decimal NumbersUploaded byHardik Desai
- Mathematics FactsUploaded bydandelions
- Takwim PdP 2016 Mathematics Form 1-SainaUploaded bysitihajar88
- 1447122550-[it-eb.com].pdfUploaded byAlex Sanchez

## Much more than documents.

Discover everything Scribd has to offer, including books and audiobooks from major publishers.

Cancel anytime.