chap7_floatpoint

# chap7_floatpoint - V 0.1 1 Fixed Point Numbers • The...

This preview shows pages 1–7. Sign up to view the full content.

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

View Full Document

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

View Full Document

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

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

Unformatted text preview: V 0.1 1 Fixed Point Numbers • The binary integer arithmetic you are used to is known by the more general term of Fixed Point arithmetic. – Fixed Point means that we view the decimal point being in the same place for all numbers involved in the calculation. – For integer interpretation, the decimal point is all the way to the right \$C0 + \$25-------- \$E5 192. + 37.-------- 229. Unsigned integers, decimal point to the right. A common notation for fixed point is ‘X.Y’, where X is the number of digits to the left of the decimal point, Y is the number of digits to the right of the decimal point. V 0.1 2 Fixed Point (cont). • The decimal point can actually be located anywhere in the number -- to the right, somewhere in the middle, to the right \$11 + \$1F-------- \$30 Addition of two 8 bit numbers; different interpretations of results based on location of decimal point 17 + 31-------- 48 xxxxxxxx.0 decimal point to right. This is 8.0 notation. 4.25 + 7.75-------- 12.00 xxxxxx.yy two binary fractional digits. This is 6.2 notation. 0.07 + 0.12-------- 0.19 0.yyyyyyyy decimal point to left (all fractional digits). This is 0.8 notation. V 0.1 3 Algorithm for converting X.Y binary to decimal, decimal to X.Y format. Convert the number 34.7 to its closest representation in 8.4 (12 bit) format: Four bits to right of decimal point, so multiply by 2 4 = 16, truncate 34.7 * 16 = 555.2 = 555 = 0x22B Assume that 0x73A represents a 8.4 (12 bits) fixed point number, what is its decimal representation? Four bits to right of decimal point, so divide by 2 4 = 16 0x73A/16 = 1850 /16 = 115.625. V 0.1 4 Signed X.Y format (2’s complement) Follow the same conversion rules! For –3.25 to 8.4 signed format:-3.25 * 16 = -52 = 0xFCC as a 2’s complement number What is the decimal value of 0xA27 if 8.4 signed format? This is a negative number. Magnitude is: 0x000 – 0xA27 = 0x5D9, so number is –1497. Decimal value is –1497/16 = 93.5625 V 0.1 5 Unsiged Overflow • Recall that a carry out of the Most Significant Digit is an unsigned overflow. This indicates an error - the result is NOT correct! \$FF + \$01-------- \$00 255 + 1-------- 63.75 + 0.25----------- 0 xxxxxxxx.0 decimal point to right xxxxxx.yy two binary fractional digits (6.2 notation) 0.yyyyyyyy decimal point to left (all fractional digits). This 0.8 notation 0.99600 + 0.00391----------- 0 Addition of two 8 bit numbers; different interpretations of results based on location of decimal point V 0.1 6 Saturating Arithmetic • Saturating arithmetic means that if an overflow occurs, the number is clamped to the maximum possible value....
View Full Document

## This document was uploaded on 09/15/2009.

### Page1 / 24

chap7_floatpoint - V 0.1 1 Fixed Point Numbers • The...

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

View Full Document
Ask a homework question - tutors are online