Floating Point Numbers - continuing

Slides:



Advertisements
Similar presentations
CENG536 Computer Engineering department Çankaya University.
Advertisements

Digital Fundamentals Floyd Chapter 2 Tenth Edition
CSC 221 Computer Organization and Assembly Language
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Simple Data Type Representation and conversion of numbers
Numbers and number systems
Information Representation (Level ISA3) Floating point numbers.
Computer Arithmetic Nizamettin AYDIN
1 Lecture 5 Floating Point Numbers ITEC 1000 “Introduction to Information Technology”
ECE232: Hardware Organization and Design
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
Data Representation in Computer Systems
Computer Communication & Networks Lecture # 05 Physical Layer: Signals & Digital Transmission Nadeem Majeed Choudhary
CSC 221 Computer Organization and Assembly Language
British Computer Society (BCS)
Dr. ClincyLecture 2 Slide 1 Chapter 4 Handout #3 Dr. Clincy Professor of CS 6 of 10.
Introduction to Communication Lecture (11) 1. Digital Transmission A computer network is designed to send information from one point to another. This.
Dr. ClincyLecture 2 Slide 1 CS Chapter 2 (1 of 5) Dr. Clincy Professor of CS Note: Do not study chapter 2’s appendix (the topics will be covered.
Data Communication and Networking Digital Transmission Chapter 4.
Cosc 2150: Computer Organization Chapter 9, Part 3 Floating point numbers.
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
William Stallings Computer Organization and Architecture 8th Edition
Floating Point Representations
Data Communications and Networking
Cosc 2150: Computer Organization
Backgrounder: Binary Math
Dr. Clincy Professor of CS
Programming and Data Structure
Computer Science 210 Computer Organization
Binary Numbers The arithmetic used by computers differs in some ways from that used by people. Computers perform operations on numbers with finite and.
Dr. Clincy Professor of CS
Number Representation
Introduction To Computer Science
Dr. Clincy Professor of CS
Number Systems and Binary Arithmetic
Computer Communication & Networks
Digital Logic & Design Dr. Waseem Ikram Lecture 02.
DIGITAL MODULATION AND MULTIPLEXING
Floating Point Numbers: x 10-18
Dr. Clincy Professor of CS
CS 232: Computer Architecture II
April 2006 Saeid Nooshabadi
A Level Computing Component 2
Dr. Clincy Professor of CS
Dr. Clincy Professor of CS
CS1010 Programming Methodology
Data Structures Mohammed Thajeel To the second year students
Dr. Clincy Professor of CS
Topic 3d Representation of Real Numbers
Recent from Dr. Dan Lo regarding 12/11/17 Dept Exam
Dr. Clincy Professor of CS
Dr. Clincy Professor of CS
Dr. Clincy Professor of CS
Dr. Clincy Professor of CS
Dr. Clincy Professor of CS
Arithmetic Logical Unit
How to represent real numbers
Dr. Clincy Professor of CS
Digital Logic & Design Lecture 02.
Data Representation in Computer Systems
Data Representation in Computer Systems
Dr. Clincy Professor of CS
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
Dr. Clincy Professor of CS
Floating Point Numbers
Recent from Dr. Dan Lo regarding 12/11/17 Dept Exam
Topic 3d Representation of Real Numbers
Digital-to-digital Conversion
Presentation transcript:

Floating Point Numbers - continuing Dr. Clincy Professor of CS Dr. Clincy Lecture 7

IEEE Standards The IEEE has established a standard for floating-point numbers The IEEE-754 single precision floating point standard uses an 8-bit exponent (with a bias of 127) and a 23-bit significand. The IEEE-754 double precision standard uses an 11-bit exponent (with a bias of 1023) and a 52-bit significand. In both the IEEE single-precision and double-precision floating-point standard, the significand has an implied 1 to the LEFT of the radix point. The format for a significand using the IEEE format is: 1.xxx… For example, 4.5 = .1001 x 23 in IEEE format is 4.5 = 1.001 x 22. The 1 is implied, which means the bit does not need to be listed in the significand (the significand would include only 001). Dr. Clincy Lecture 7

Example Example: Express -3.75 as a floating point number using IEEE single precision. First, let’s normalize according to IEEE rules: 3.75 = -11.112 = -1.111 x 21 The bias is 127, so we add 127 + 1 = 128 (this is our exponent) The first 1 in the significand is implied, so we have: Since we have an implied 1 in the significand, this equates to -(1).1112 x 2 (128 – 127) = -1.1112 x 21 = -11.112 = -3.75. (implied) Dr. Clincy Lecture 7

The Zero Issue Both the 14-bit model that we have presented and the IEEE-754 floating point standard allow two representations for zero. Zero is indicated by all zeros in the exponent and the significand, but the sign bit can be either 0 or 1. This is why programmers should avoid testing a floating-point value for equality to zero. Negative zero does not equal positive zero. Dr. Clincy Lecture 7

Addition and Subtracting Floating-point addition and subtraction are done using methods analogous to how we perform calculations using pencil and paper. The first thing that we do is express both operands in the same exponential power, then add the numbers, preserving the exponent in the sum. If the exponent requires adjustment, we do so at the end of the calculation. Example: Find the sum of 1210 and 1.2510 using the 14-bit “simple” floating-point model. We find 1210 = 0.1100 x 2 4. And 1.2510 = 0.101 x 2 1 = 0.000101 x 2 4. Thus, our sum is 0.110101 x 2 4. Dr. Clincy Lecture 7

Multiplication Example: Floating-point multiplication is also carried out in a manner akin to how we perform multiplication using pencil and paper. We multiply the two operands and add their exponents. If the exponent requires adjustment, we do so at the end of the calculation. Example: Find the product of 1210 and 1.2510 using the 14-bit floating-point model. We find 1210 = 0.1100 x 2 4. And 1.2510 = 0.101 x 2 1. Thus, our product is 0.0111100 x 2 5 = 0.1111 x 2 4. The normalized product requires an exponent of 2210 = 101102. Dr. Clincy Lecture 7

Error Issue No matter how many bits we use in a floating-point representation, our model must be finite. The real number system is, of course, infinite, so our models can give nothing more than an approximation of a real value. At some point, every model breaks down, introducing errors into our calculations. By using a greater number of bits in our model, we can reduce these errors, but we can never totally eliminate them. We must also be aware that errors can compound through repetitive arithmetic operations. For example, our 14-bit model cannot exactly represent the decimal value 128.5. In binary, it is 9 bits wide: 10000000.12 = 128.510 When we try to express 128.510 in our 14-bit model, we lose the low-order bit, giving a relative error of: If we had a procedure that repetitively added 0.5 to 128.5, we would have an error of nearly 2% after only four iterations. 128.5 - 128 128.5  0.39% Dr. Clincy Lecture 7

Overflow and Underflow Floating-point overflow and underflow can cause programs to crash. Overflow occurs when there is no room to store the high-order bits resulting from a calculation. Underflow occurs when a value is too small to store, possibly resulting in division by zero. Experienced programmers know that it’s better for a program to crash than to have it produce incorrect, but plausible, results. Dr. Clincy Lecture 7

Dr. Clincy Professor of CS Ch 2 Appendix: Codes for Data Recording and Transmission Dr. Clincy Professor of CS Dr. Clincy Lecture 7

Codes for Data Recording and Transmission i.e. i.e. 56 as 0011 1000 Computer Results Digital or Analog Signals i.e. i.e. “5” & “6” as 0000101 0000110 Computer Computer (Codec, Modem) Magnetic Flux reversals Codes (w/parity) Rx or Recording Medium Results to Code Encoding Computer Signal travelling across transport facility or bus Network Receiver or Magnetic Tape or Disk Data to Signal Encoding or Translation (A/A, A/D, D/A, D/D) To transmit data, pulses of “high” and “low” voltage are sent across communications media. To store data, changes are induced in the magnetic polarity of the recording medium. These polarity changes are called flux reversals. The period of time during which a bit is transmitted, or the area of magnetic storage within which a bit is stored is called a bit cell. Dr. Clincy Lecture 7

Data Vs Signal Fully explain the difference between signal and data before getting into the details Digital Transmission DATA SIGNAL D D A Analog Transmission A D Dr. Clincy Lecture 7

DIGITAL-TO-DIGITAL CONVERSION Can represent digital data by using digital signals. The conversion involves three techniques: line coding – converting bit sequences to signals block coding – adding redundancy for error detection scrambling – deals with the long zero-level pulse issue Line coding is always needed; Block coding and scrambling may or may not be needed. Dr. Clincy Lecture 7

Line coding and decoding At Tx - Digital data represented as codes is converted to a digital signal via an encoder At Rx – Digital signal is converted back to digital codes via a decoder Dr. Clincy Lecture 7

Signal element versus data element Data element - smallest entity representing info Signal element – shortest unit of a digital signal (carriers) r – is the ratio of # of data elements carried per signal element Example of adding extra signal elements for synchronization Example of increasing data rate Dr. Clincy Lecture 7

Data Rate Versus Signal Rate Data rate (or bit rate) - # of data elements (or bits) transmitted in 1 second – bits-per-second is the unit Signal rate (pulse rate or baud rate) - # of signal elements transmitted in 1 second – baud is the unit OBJECTIVE ALWAYS: increase data rate while decreasing signal rate – more “bang” for the “buck” Is it intuitive that if you had a data pattern of all 0s or 1s, it would effect the signal rate ? Therefore to relate data-rate with signal-rate, the pattern matters. Worst Case Scenario – we need the maximum signaling rate (alternating 1/0s) Best Case Scenario – we need the minimum signaling rate (all 1/0s) Focus on average case S = c x N x 1/r N – data rate (bps) c – case factor S - # of signal elements r – ratio of data to signal Dr. Clincy Lecture 7

Example A signal is carrying data in which one data element is encoded as one signal element ( r = 1). If the bit rate is 100 kbps, what is the average value of the baud rate if c is between 0 and 1? Solution We assume that the average value of c is 1/2 . The baud rate is then Dr. Clincy Lecture 7

Line coding scheme categories Dr. Clincy Lecture 7