BME303_lecture4

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

This preview shows pages 1–13. 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 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: BME303 Intro. to Computing Chapter 2 – cont’d BME303 Intro. to Computing Hexadecimal? 0001001010101011 0001 0010 1010 1011 2 12AB – a convenient way to represent binary strings 1 2 A B BME303 Intro. to Computing Hexadecimal? 0001 0010 1010 1011 Decimal value = ? 3 1 2 A B = ? BME303 Intro. to Computing Working with long strings of 1s and 0s is difficult We use hexadecimal (or hex) notation as a form of shorthand 101 110 = 0x = # ??? Hexadecimal Notation 4 D 6 b 7 b 6 b 5 b 4 b 3 b 2 b 1 b 1 1 1 1 1 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? BME303 Intro. to Computing Hexadecimal Numbers Convert binary 0011011011010101 to hex 0x36D5 0011 0110 1101 0101 3 6 D 5 Binary Hex 0000 0001 1 0010 2 0011 3 0100 4 0101 5 1 1 1 1 1 1 1 1 5 0110 6 0111 7 1000 8 1001 9 1010 A 1011 B 1100 C 1101 D 1110 E 1111 F 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 BME303 Intro. to Computing 10 2 10 1 10 10-1 10-2 10-3 100 10 1 1/10 1/100 1/1000 #3.50 Floating Point: Fractions Decimal 3.5, 4.75, 5.25 ??? 7 2 2 2 1 2 2-1 2-2 2-3 4 2 1 1/2 1/4 1/8 = #3.50 Binary = #4.75 = #5.25 = #3.50 = #4.75 = #5.25 BME303 Intro. to Computing Floating Point Computers represent real numbers using Floating Point notations Decimal: 2007 = 2.007 · 10 3 Binary: 100.11 = 1.0011· 2 2 9 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 32 bits total; exponent is an unsigned 8-bit integer BME303 Intro. to Computing Floating Point Three step process:- convert the decimal number to a binary number- write binary number in “normalized” scientific notation (-1 ) S ·1. fraction ·2 exponent-127 (1 ≤ exponent ≤ 254) IEEE Standard for Floating Point Arithmetic (“rules”) 10- find the exponential term- store the number in the proper format 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 BME303 Intro. to Computing Floating Point: Example 1 01111110 10000000000000000000000b – Sign is 1 , meaning the number is negative 11 – Exponent field is 01111110 = 126 (decimal) – Fraction is 1 .100000000000…- 1.1 · 2 (126-127) b= - 1.1 · 2-1 b= - 0.11 b= - 0.75 BME303 Intro. to Computing Floating Point: Example • Exponent field is 00000000 - #0 • Exponent field is 11111111 - #inf 12 BME303 Intro. to Computing Floating Point Notation 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 Conversion: Binary to decimal 13 (-1 ) S ·1. fraction ·2 exponent-127 (1 ≤ exponent ≤ 254) 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 BME303 Intro. to Computing Floating Point Notation 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...
View Full Document

• Spring '08
• Ren
• Logic, Binary numeral system, Logical connective, Intro., medicine AND biology medicine OR biology biology AND medicine AND engineering biology AND medicine OR engineering biology OR medicine OR engineering biology AND medicine AND NOT engineering

{[ snackBarMessage ]}

### Page1 / 43

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

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

View Full Document
Ask a homework question - tutors are online