Lecture_11_E7_L9_Representation_F07

# Lecture_11_E7_L9_Representation_F07 - 1 E7 INTRODUCTION TO...

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

E7 L9 1 E7: INTRODUCTION TO COMPUTER E7: INTRODUCTION TO COMPUTER PROGRAMMING FOR SCIENTISTS AND PROGRAMMING FOR SCIENTISTS AND ENGINEERS ENGINEERS Lecture Outline 1. Number representation in a computer 1. IEEE Floating point standard Copyright 2007, Horowitz, Packard. This work is licensed under the Creative Commons Attribution-Share Alike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

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

View Full Document
5 10 15 20 25 30 35 40 45 50 0 5 Midterm 1 Score Number of Students E7 Midterm 1 Results Average = 38 Standard deviation: 7 generated using the matlab histogram (hist) command
Excel 2007 can’t multiply some numbers Excel 2007 can’t multiply some numbers E7 L9 3

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

View Full Document
Using matlab >> A = 77.1; B = 850; >> C =[ A B A*B (A*B+1) A*B*B ] C = 77.1 850 65535 65536 55704750 What is special about the number 65535 ?
Lets convert 65535 into its binary representation >> C_dec = 65535; >> C_bin = dec2bin(C_dec) C_bin = 1111111111111111 >> C_hex = dec2hex(C_dec) C_hex = FFFF E7 L9 5 The number 65535 The number 65535 largest 16 bit binary number F F F F hexadecimal representation

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

View Full Document
E7 L9 6 Decimal VS binary representation Decimal VS binary representation In everyday practice, all numbers are typically represented using the decimal system (base-10). e.g. (7345.47) 10 However, computers favor the binary system (base-2). e.g. (10010.1110) 2 The binary system is natural for computers where information is coded according to whether an electrical circuit is on (1) or off (0) .
E7 L9 7 Computer representation of numbers Computers store numbers using a finite sequence of binary digits ( bits ). Integers are stored using 16, 32 or 64 (double precision) bits Reals are stored using 32, 64 (double precision), 80 or 128 bits. Definition: 1 byte = 8 bits (powers of 2 are magic.) Disk or memory capacity is denominated in KBytes (10 3 bytes), MBytes (10 6 bytes), GBytes (10 9 bytes) and TBytes(10 12 bytes).

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

View Full Document
E7 L9 8 The base10 number (2075) means What are the “rules”? In each digit, there is a number from 0 to 9 The “value” of the slots are increasing powers of 10, starting at 10 0 Integers in base 10 Integers in base 10 0 1 2 3 10 5 10 7 10 0 10 2 × + × + × + × Throughout the lecture, the explanatory expression is given in base 10
E7 L9 9 What are the “rules”? In each digit, there is a number from 0 to 1 The “value” of the slots are increasing powers of 2, starting at 2 0 Integers in base 2 Integers in base 2 0 1 2 3 4 5 6 2 1 2 0 2 1 2 1 2 0 2 0 2 1 × + × + × + × + × + × + × This explanatory expression is given in base 10

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

View Full Document
E7 L9 10 Rational numbers in base 10 Rational numbers in base 10 What are the “rules”? In each digit, there is a number from 0 to 9 The “value” of the slots to the left of the decimal point are increasing powers of 10, starting at 10 0 The “value” of the slots to the right of the decimal -1 3 2 1 0 1 10 6 10 9 10 3 10 5 10 7 - - - × + × + × + × + ×
E7 L9 11 Rational numbers in base 2 Rational numbers in base 2 What are the “rules”?

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.

{[ snackBarMessage ]}

### Page1 / 43

Lecture_11_E7_L9_Representation_F07 - 1 E7 INTRODUCTION TO...

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

View Full Document
Ask a homework question - tutors are online