# lect04_p.pdf - Lecture Summary Discrete Mathematics for...

• No School
• AA 1
• 13

This preview shows page 1 - 4 out of 13 pages.

The preview shows page 2 - 4 out of 13 pages.
Discrete Mathematicsfor ComputingMAT1101LogicSchool of Agricultural, Computational and Environmental SciencesFaculty of Health, Engineering and SciencesLecture 4MAT11011Lecture Summary1Integer arithmetic2Real numbers (Floating Point Numbers)3IEEE and floating point numbersImplications of truncationRangeUnderflow/Overflow4Introduction to logicPropositionsConnectivesBasic truth tablesInverse, converse and contrapositive5Laws of logicMAT11012Integer arithmetic on 4-bit computerIntegerComputerIntegerStoredValueValue-8100000000-7100110001-6101020010-5101130011-4110040100-3110150101-2111060110-1111170111Negative numbers all start witha1.The sign bit is1and has a placevalue of8in a 4-bit number.Hence, the 4-bit representationof the number is𝑛 + 16.Example:−4computerrepresentation is11002= 1210MAT11013Integer arithmetic on 4-bit computerIntegerComputerIntegerStoredValueValue-8100000000-7100110001-6101020010-5101130011-4110040100-3110150101-2111060110-1111170111Positive numbers all start with a0.Hence, the 4-bit representationof the number is0𝑏𝑏𝑏2.Example:4computerrepresentation is01002MAT11014
Integer arithmetic on 4-bit computerIntegerComputerIntegerStoredValueValue-8100000000-7100110001-6101020010-5101130011-4110040100-3110150101-2111060110-1111170111Suppose we add two integers.What do you notice?Consider6 + 7. Can we store it?NO, too large.However, if we restrict ourselvesto numbers which can be storedafter the addition, the additioncan be done by:Simple adding the two binarynumbers in the usual way.Except is a 1 arises in the fifthcolumn (i.e. 5 digits) it isignored.MAT11015Integer arithmetic on 4-bit computerIntegerComputerIntegerStoredValueValue-8100000000-7100110001-6101020010-5101130011-4110040100-3110150101-2111060110-1111170111Example12+300100011010152-4+71100011110011336+7011001111101-3which is out by16MAT11016Why does this work?An integer in this computer is either 16 more or the integer itself.Therefore the result either exceeds what it should by 16 or 32.Ignoring the fifth column is equivalent to−16.If the answer is not correct it must only differ in this computer by amultiple of 16.The problem with adding6 + 7is called anoverflow.Easy detected as adding two positive integers should not give anegative result. Similarly, adding tove integers should not give apositive result.MAT11017Real numbersWe need to store very large and very small numbers.Scientific notation.Mass of Earth5976000000000000000000000 kg5.976 × 1024kgRadius of an atom0.0000000000000012 m1.2 × 10−15mMAT11018
Normalised notationIn normalised notation we have:𝑚 × 10𝑒,where0.1 ≤ 𝑚 < 1,10is the base and𝑒is the power.𝑚is called the mantissa (significand).ExampleMass of Earth0.5976 × 1025kgRadius of an atom0.12 × 10−14mMAT11019Normalised binary exponential formIn normalised notation we have:𝑚 × 2𝑒,where0.1 ≤ 𝑚 < 1,2is the base and𝑒is the power (integer).

Course Hero member to access this document

Course Hero member to access this document

End of preview. Want to read all 13 pages?