DOC PREVIEW
UCLA COMSCI 33 - CS33-7

This preview shows page 1-2-3-23-24-25-26-47-48-49 out of 49 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Floating PointNumber RangesReal NumbersFixed Point RepresentationFixed Point ProblemScientific NotationFloating Point RepresentationFloating Point FieldsFloating Point FormatsFloating Point RangesFloating Point Example: SPFloating Point Practice: SPSlide 13Slide 14Slide 15Slide 16Slide 17Floating Point Example: DPFloating Point Practice: DPSlide 20Slide 21Slide 22Summary: Number BasesSummary: Real NumbersMIPS Floating Point ArchitectureMIPS Floating Point RegistersSource Code FormatsInstruction VariantsFloating Point Instruction TypesArithmetic Instructions (3 operand)Arithmetic Instructions (2 operand)Compare InstructionsBranch InstructionsMove Float to Float InstructionsInteger/Float Move and ConvertSlide 36Move to Coprocessor 1Move from Coprocessor 1Convert Integer to SingleConvert Integer to DoubleConvert Single to DoubleConvert Single to IntegerConvert Double to IntegerConvert Double to SingleLoad and Store InstructionsProgrammed LoadProgrammed Load and ConvertProgrammed StoreUpdatesCS 33: Computer OrganizationTopic 7: Floating Point4/2009 John A. Rohr All Rights ReservedJAR 7-1Floating PointCS 33: Computer OrganizationTopic 7: Floating Point4/2009 John A. Rohr All Rights ReservedJAR 7-2Number Ranges•Sign and Magnitude–-(2n-1-1)  +(2n-1-1)–Has Negative zero•Ones Complement–-(2n-1-1)  +(2n-1-1)–Has Negative zero•Twos Complement–-(2n-1)  +(2n-1-1)–No Negative zero; One more – than + numberCS 33: Computer OrganizationTopic 7: Floating Point4/2009 John A. Rohr All Rights ReservedJAR 7-3Real Numbers•Real numbers–Integer part–Fractional part•Either can be zero/omitted•Radix point separates•Example•104 103 102 101 100 10-1 10-2 10-3• 1 2 3 4 5 . 6 7 8CS 33: Computer OrganizationTopic 7: Floating Point4/2009 John A. Rohr All Rights ReservedJAR 7-4Fixed Point Representation•Many possibilities–16 Integer bits; 16 Fraction bits–24 Integer bits; 8 Fraction bits–8 Integer bits; 24 Fraction bits31 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 3 2 1 031 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 3 2 1 031 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 3 2 1 0CS 33: Computer OrganizationTopic 7: Floating Point4/2009 John A. Rohr All Rights ReservedJAR 7-5Fixed Point Problem•Must choose one representation•Will not work for all situations•Would like to be able to move the binary point to different places for different situations•Still limited by available range–Only 2n possible distinct values–Not enough for real-world problemsCS 33: Computer OrganizationTopic 7: Floating Point4/2009 John A. Rohr All Rights ReservedJAR 7-6Scientific Notation•One digit before the decimal point•Multiplication by a power of 10•Example–12345.678 = 1.2345678 x 104•Can also be used with binary•Example–1011.1101 = 1.0111101 x 23CS 33: Computer OrganizationTopic 7: Floating Point4/2009 John A. Rohr All Rights ReservedJAR 7-7Floating Point Representation•Can represent a large range of numbers•Maximizes use of available bits•Based on binary numbers written in scientific notation•Three separate parts–Sign–Normalized value–ExponentCS 33: Computer OrganizationTopic 7: Floating Point4/2009 John A. Rohr All Rights ReservedJAR 7-8Floating Point Fields •Sign–0 for positive; 1 for negative–Independent of other bits•Exponent–Power of 2–Biased by 12710 (SP) or 102310 (DP)•Mantissa–Normalized value–Leading 1-bit is omitted•Zero is a special case: All zero bitsCS 33: Computer OrganizationTopic 7: Floating Point4/2009 John A. Rohr All Rights ReservedJAR 7-9Floating Point Formats31 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 3 2 1 0CharacteristicSMantissa31 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 3 2 1 0Mantissa (Continued)Double Precision31 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 3 2 1 0CharacteristicSMantissaSingle PrecisionCS 33: Computer OrganizationTopic 7: Floating Point4/2009 John A. Rohr All Rights ReservedJAR 7-10Floating Point Ranges •Single Precision–1 Bit Sign –8 Bit Characteristic: -12610 < Exponent < 12710–23 Bit Mantissa–+2.0*10-38 ~< Value ~< + 2.0*1038•Double Precision–1 Bit Sign –11 Bit Characteristic: -102210 < Exponent < 102310–52 Bit Mantissa–+10-308 ~< Value ~< +10308CS 33: Computer OrganizationTopic 7: Floating Point4/2009 John A. Rohr All Rights ReservedJAR 7-11Floating Point Example: SP •Convert 21.375 to Single Precision Floating Point–Positive number  Sign = 0–Convert to binary: 10101.011–Normalize: 1.0101011 * 24–Exponent: 12710 + 410 = 13110 = 100000112–Mantissa: Delete leading 1; Expand to 23 bits–Mantissa: 01010110000000000000000–Final Result: 41AB000016 =–0100 0001 1010 1011 0000 0000 0000 0000CS 33: Computer OrganizationTopic 7: Floating Point4/2009 John A. Rohr All Rights ReservedJAR 7-12Floating Point Practice: SP •Convert 1 to Single Precision Floating PointCS 33: Computer OrganizationTopic 7: Floating Point4/2009 John A. Rohr All Rights ReservedJAR 7-13Floating Point Practice: SP •Convert 1 to Single Precision Floating Point–Positive number  Sign = 0–Convert to binary: 1.0–Normalize: 1.0 * 20–Exponent: 12710 + 010 = 12710 = 011111112–Mantissa: Delete leading 1; Expand to 23 bits–Mantissa: 00000000000000000000000–Final Result: 3F80000016 =–0011 1111 1000 0000 0000 0000 0000 0000CS 33: Computer OrganizationTopic 7: Floating Point4/2009 John A. Rohr All Rights ReservedJAR 7-14Floating Point Practice: SP •Convert 198.5 to Single Precision Floating PointCS 33: Computer OrganizationTopic 7: Floating Point4/2009 John A. Rohr All Rights ReservedJAR 7-15Floating Point Practice: SP •Convert 198.5 to Single Precision Floating Point–Positive number  Sign = 0–Convert to binary: 11000110.1–Normalize: 1.10001101 * 27–Exponent: 12710 + 710 = 13410 = 100001102–Mantissa: Delete leading 1; Expand to 23 bits–Mantissa: 10001101000000000000000–Final Result: 4346800016 =–0100 0011 0100 0110 1000 0000 0000 0000CS 33: Computer OrganizationTopic 7: Floating Point4/2009 John A. Rohr All Rights ReservedJAR 7-16Floating Point Practice:


View Full Document

UCLA COMSCI 33 - CS33-7

Download CS33-7
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view CS33-7 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view CS33-7 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?