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

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

View Full Document Right Arrow Icon
BME303 Intro. to Computing Chapter 2 – cont‟d
Background image of page 1

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

View Full DocumentRight Arrow Icon
BME303 Intro. to Computing 2 Hexadecimal? 0001001010101011 12AB – a convenient way to represent binary strings 0001 0010 1010 1011 1 2 A B
Background image of page 2
BME303 Intro. to Computing 3 Hexadecimal? 0001 0010 1010 1011 1 2 A B Decimal value = ?
Background image of page 3

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

View Full DocumentRight Arrow Icon
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
Background image of page 4
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
Background image of page 5

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

View Full DocumentRight Arrow Icon
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
Background image of page 6
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
Background image of page 7

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

View Full DocumentRight Arrow Icon
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 ???
Background image of page 8
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
Background image of page 9

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

View Full DocumentRight Arrow Icon
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”)
Background image of page 10
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
Background image of page 11

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

View Full DocumentRight Arrow Icon
BME303 Intro. to Computing 12 Floating Point: Example • Exponent field is 00000000 - #0 • Exponent field is 11111111 - #inf
Background image of page 12
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
Background image of page 13

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

View Full DocumentRight Arrow Icon
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
Background image of page 14
Image of page 15
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 47

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

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

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