b2 b1 b0 2 the binary point is between bits 4 and 5

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: int binary numbers” ¢  Let's do that, using 8-­‐bit fixed point numbers as an example §  #1: the binary point is between bits 2 and 3 b7 b6 b5 b4 b3 [.] b2 b1 b0 §  #2: the binary point is between bits 4 and 5 b7 b6 b5 [.] b4 b3 b2 b1 b0 ¢  The posi-on of the binary point affects the range and precision of the representa-on § range: difference between largest and smallest numbers possible §  precision: smallest possible difference between any two numbers Frac-onal Values University of Washington Fixed Point Pros and Cons ¢  Pros §  It's simple. The same hardware that does integer arithme=c can do fixed point arithme=c §  In fact, the programmer can use ints with an implicit fixed point §  ints are just fixed point numbers with the binary point to the right of b0 ¢  Cons §  There is no good way to pick where the fixed point should be §  Some=mes you need range, some=mes you need precision – the more you have of one, the less of the other. Frac-onal Values University of Washington Integer & Floa-ng Point Numbers ¢  ¢  ¢  ¢  ¢  ¢  ¢  ¢  Representa-on of integers: unsigned and signed Unsigned and signed integers in C Arithme-c and shiBing Sign extension Background: frac-onal binary numbers IEEE floa-ng-­‐point standard Floa-ng-­‐point opera-ons and rounding Floa-ng-­‐point in C IEEE Floa-ng Point Standard University of Washington IEEE Floa-ng Point ¢  Analogous to scien-fic nota-on §  Not 12000000 but 1.2 x 107; not 0.0000012 but 1.2 x 10-­‐6 §  ¢  (write in C code as: 1.2e7; 1.2e-­‐6) IEEE Standard 754 §  Established in 1985 as uniform standard for floa=ng point arithme=c Before that, many idiosyncra=c formats §  Supported by all major CPUs today §  ¢  Driven by numerical concerns §  Standards for handling rounding, overflow, underflow §  Hard to make fast in hardware but numerically well-­‐behaved ¢  1989 Turin...
View Full Document

Ask a homework question - tutors are online