cp1_lect_4 - Floating-Point Representation A number...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
5/10/10 Floating-Point Representation A number containing an integer and a fraction E.g., 24.345 Converting to Binary 1. Convert the integer part to binary (same as earlier) Convert the fraction part to binary (Use 0.125 0.2 50 0.5 00 1.0 00 0.0 00 0 . 0 0 1 Stop when the result is 0 Try: 0.4 to a binary of 6 bits 0.01100
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
5/10/10 Arithmetic with 2’s Compl. Fl. Pt. 00101000.101 (40.625) + 11111110.110 (-1.25) 00100111.011 (39.375) 2-1 = 0.5 2-2 = 0.25 2-3 = 0.125 If binary points are aligned , addition and subtraction still works: Try: 4.25 – 2.75 = ? In 2’s complement binary (Use 4 bits for integer and 3 bits for fractional part.
Background image of page 2
5/10/10 Normalization Why do we need normalized floating point numbers? Sign, all bits, and position of decimal point Operations on numbers become difficult Solution: Standard representation (normalized floating pt)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
5/10/10 Floating point Numbers: Sign, After a number is normalized , store Sign, Exponent, and Mantissa
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

cp1_lect_4 - Floating-Point Representation A number...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online