BME303_lecture4

# BME303_lecture4 - BME303 Intro to Computing Chapter 2 contd...

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

BME303 Intro. to Computing Chapter 2 – cont‟d

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

View Full Document
BME303 Intro. to Computing 2 Hexadecimal? 0001001010101011 12AB – a convenient way to represent binary strings 0001 0010 1010 1011 1 2 A B
BME303 Intro. to Computing 3 Hexadecimal? 0001 0010 1010 1011 1 2 A B Decimal value = ?

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

View Full Document
BME303 Intro. to Computing 4 D 6 b 7 b 6 b 5 b 4 b 3 b 2 b 1 b 0 1 1 0 1 0 1 1 0 Working with long strings of 1s and 0s is difficult We use hexadecimal (or hex) notation as a form of shorthand 1101 0110 = 0x D 6 = # ??? Hex is a 16-base number system How to convert to/from hex? hint: use binary as middle-man What about sign? Hexadecimal Notation
BME303 Intro. to Computing 5 Hexadecimal Numbers Convert binary 0011011011010101 to hex 0x36D5 0011 0110 1101 0101 3 6 D 5 Binary Hex 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 0111 7 1000 8 1001 9 1010 A 1011 B 1100 C 1101 D 1110 E 1111 F 1 0 0 1 1 0 1 1 0 0 0 0 0 1 1 1 0 0 1 1 1 0 1 1 0 0 0 0 0 1 1 1 1 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1

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

View Full Document
BME303 Intro. to Computing 6 Hexadecimal Numbers Convert binary 0011011011010101 to hex 0x36D5 0011 0110 1101 0101 3 6 D 5 Binary Hex 0000 0 0001 1 0010 2 0011 3 0100 4 0101 5 0110 6 0111 7 1000 8 1001 9 1010 A 1011 B 1100 C 1101 D 1110 E 1111 F 1 0 0 1 1 0 1 1 0 0 0 0 0 1 1 1 9 B 0 7 0 0 1 1 1 0 1 1 0 0 0 0 0 1 1 1 3 B 0 7 1 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 D E 2 F 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 B E E F
BME303 Intro. to Computing 7 10 2 10 1 10 0 10 -1 10 -2 10 -3 100 10 1 1/10 1/100 1/1000 2 2 2 1 2 0 2 -1 2 -2 2 -3 4 2 1 1/2 1/4 1/8 = #3.50 Floating Point: Fractions Decimal Binary 3.5, 4.75, 5.25 ??? = #4.75 = #5.25 = #3.50 = #4.75 = #5.25

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

View Full Document
BME303 Intro. to Computing 8 10 2 10 1 10 0 10 -1 10 -2 10 -3 100 10 1 1/10 1/100 1/1000 3 5 4 7 5 5 2 5 2 2 2 1 2 0 2 -1 2 -2 2 -3 4 2 1 1/2 1/4 1/8 1 1 1 1 0 0 1 1 1 0 1 0 1 0 3·10 0 + 5·10 -1 = 3.5 10 = #3.5 1·2 1 + 1·2 0 + 1·2 -1 = 11.1 = #3.5 Floating Point: Fractions Decimal Binary 3.5, 4.75, 5.25 ???
BME303 Intro. to Computing 9 Floating Point Computers represent real numbers using Floating Point notations Decimal: 2007 = 2.007 · 10 3 Binary: 100.11 = 1.0011· 2 2 IEEE Standard : ( −1 ) S ·1. fraction ·2 exponent−127 (1 ≤ exponent ≤ 254) S exponent (8-bit) fraction (23-bit) 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 5 2 1 0 32 bits total; exponent is an unsigned 8-bit integer

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

View Full Document
BME303 Intro. to Computing 10 Floating Point Three step process: - convert the decimal number to a binary number - write binary number in “normalized” scientific notation - find the exponential term - store the number in the proper format ( −1 ) S ·1. fraction ·2 exponent−127 (1 ≤ exponent ≤ 254) S exponent (8-bit) fraction (23-bit) 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 5 2 1 0 IEEE Standard for Floating Point Arithmetic (“rules”)
BME303 Intro. to Computing 11 Floating Point: Example 1 01111110 10000000000000000000000b – Sign is 1 , meaning the number is negative – Exponent field is 01111110 = 126 (decimal) – Fraction is . 100000000000 1. 1 · 2 ( 126 -127) b= 1. 1 · 2 -1 b= 0.11 b= 0.75

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

View Full Document
BME303 Intro. to Computing 12 Floating Point: Example • Exponent field is 00000000 - #0 • Exponent field is 11111111 - #inf
BME303 Intro. to Computing 13 Floating Point Notation ( −1 ) S ·1. fraction ·2 exponent−127 (1 ≤ exponent ≤ 254) S exponent (8-bit) fraction (23-bit) 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 5 2 1 0 0 1 0 0 0 0 1 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Conversion: Binary to decimal

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

View Full Document
BME303 Intro. to Computing 14 Floating Point Notation ( −1 ) S ·1. fraction ·2 exponent−127 (1 ≤ exponent ≤ 254) S exponent (8-bit) fraction (23-bit) 31 30 29 28 27 26
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/24/2010 for the course BME 303 taught by Professor Ren during the Fall '08 term at University of Texas.

### Page1 / 47

BME303_lecture4 - BME303 Intro to Computing Chapter 2 contd...

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

View Full Document
Ask a homework question - tutors are online