55 views

Uploaded by Kenny Roa

ieee

- AN1215_PID68HC11
- The CADNA software
- A2L File
- c1-3
- Addressing Modes
- NumberSystems.ppt.
- Numerical Analysis
- Floating Point
- Real Numbers Problems
- parthi12
- Hexadecimal Conversion Workbook
- 25.Memory Representation of Float Data Type in c
- 09 Arithmetic
- final_2009
- Computer Organization & Design The Hardware/Software Interface, 2nd Edition Patterson & Hennessy
- C++ Chapter 1 Introduction
- DCII-manual.pdf
- basicplc4
- Mvi56 Mnet User Manual
- 01 Introduction

You are on page 1of 6

com For an online converter that lets you check your work, see: http://www.h-schmidt.net/FloatApplet/IEEE754.html Unless otherwise stated, convert using the IEEE 754 single precision format. The IEEE 754 single precision format is 32 bits, which are (from left to right): One bit for the sign; 8 bits for the exponent and; 23 bits for the mantissa/significand. The IEEE 754 double One bit for the 11 bits for the 52 bits for the (In this course, we precision format is 64 bits, which are (from left to right): sign; exponent; mantissa/significand. don't work with double-precision numbers.)

The conversions in this file only work for non-zero numbers. The IEEE 754 bit pattern for zero is 00000000h. Negative zero is 80000000h. EXAMPLE 1: Show that decimal 147.625 equals binary 4313A000h in IEEE 754 format. ---------Step 1: Convert the decimal number to its binary fractional form. (Convert the parts on each side of the binary decimal point separately, using the techniques already learned in class.) The decimal number 147.625 converted to binary is: 10010011.101

Note that the implied binary exponent multiplier here is "1" (2**0). Step 2: Normalize the binary fractional number. Move the decimal point left or right so that only a single binary digit "1" is to the left of the binary decimal point. Compensate by adjusting the exponent in the opposite direction. 10010011.101 times 2**0 --> (move binary decimal point left 7) --> 1.0010011101 times 2**7 Moving the decimal left seven decreases the size of the number; so, we use an exponent of 7 to compensate and keep the number the same size. (Moving right would increase the size of the number, and the exponent would have to be negative, e.g. 0.001101 --> 1.101 times 2**(-3).) Step 3: Convert the exponent to 8-bit excess-127 notation. Add 127 to the exponent and convert it to 8-bit binary: 7 + 127 = 134 --> 10000110 ( = 128 + 4 + 2 )

Step 4: Convert the mantissa/significand to "hidden bit" format. Since every binary floating-point number (except zero!) is normalized with "1." at the start, there is no need to store that leftmost "1". Remove the leading "1." from the mantissa/significand:

1.0010011101

-->

0010011101

Step 5: Write down the 1+8+23 = 32 bits. 147.625 is positive - the sign bit is zero: The next eight bits are the exponent: The next 23 bits are the mantissa: 0 10000110 00100111010000000000000

Binary result (32 bits): 01000011000100111010000000000000 Step 6: Convert the 32 bits to hexadecimal, starting on the right. To convert 01000011000100111010000000000000 to hexadecimal, group the bits into chunks of four, starting from the right, and convert each four-bit chunk to its hexadecimal digit 0-9A-F: Answer (hex): 0100 0011 0001 0011 1010 0000 0000 0000 4 3 1 3 A 0 0 0

Answer: 147.625 is 4313A000h in IEEE 754 single-precision format. EXAMPLE 2: Show that decimal 2004 equals binary 44FA8000h in IEEE 754 format. ---------Step 1: decimal 2004 --> binary 11111010100.0 (no fractional part)

Step 2: normalize binary 11111010100.0 --> 1.11110101000 times 2**10 We shifted the binary decimal point 10 places to the left, making the number smaller. The exponent needed to compensate is therefore 2**10 Step 3: convert exponent 10 --> 10 + 127 = 137 --> binary 10001001 (=128+8+1) Step 4: remove hidden digit from 1.11110101000 --> 11110101000 Step 5: Write down the 1+8+23 = 32 bits. 2004 is positive - the sign bit is zero: The next eight bits are the exponent: The next 23 bits are the mantissa: 0 10001001 11110101000000000000000

Binary result (32 bits): 01000100111110101000000000000000 Step 6: 0100 0100 1111 1010 1000 0000 0000 0000 4 4 F A 8 0 0 0 Answer: 2004 is 44FA8000h in IEEE 754 single-precision format. EXAMPLE 3: Show that decimal -20.5 equals binary C1A40000h in IEEE 754 format. ---------Step 1: decimal 20.5 --> binary 10100.1 Step 2: normalize binary 10100.1 --> 1.01001 times 2**4 Step 3: exponent 4 + 127 = 131 = binary 10000011 Step 4: remove hidden digit from 1.01001 --> 01001 Step 5: -20.5 is negative - the sign bit is one: The next eight bits are the exponent: 1 10000011

010010000000000000000

Binary result (32 bits): 11000001101001000000000000000000 Step 6: 1100 0001 1010 0100 0000 0000 0000 0000 C 1 A 4 0 0 0 0 Answer: -20.5 is C1A40000h in IEEE 754 single-precision format. EXAMPLE 4: Show that decimal -0.5 equals binary BF000000h in IEEE 754 format. ---------Step 1: decimal 0.5 --> binary 0.1 Step 2: normalize binary 0.1 --> 1.0 times 2**(-1) We shifted the binary decimal point 1 place to the right, making the number larger. The exponent needed to compensate is therefore 2**(-1) Step 3: exponent -1 + 127 = 126 = binary 01111110 Step 4: remove hidden digit from 1.0 --> 0 Step 5: -0.5 is negative - the sign bit is one: The next eight bits are the exponent: The next 23 bits are the mantissa: 1 01111110 000000000000000000000

Binary result (32 bits): 10111111000000000000000000000000 Step 6: 1011 1111 0000 0000 0000 0000 0000 0000 B F 0 0 0 0 0 0 Answer: -0.5 is BF000000h in IEEE 754 single-precision format. EXAMPLE 5: Show that decimal -1 equals binary BF800000h in IEEE 754 format. ---------Step 1: decimal 1 --> binary 1.0 (no fractional part) Step 2: normalize binary 1.0 --> 1.0 times 2**0 The binary number 1.0 is already normalized. The exponent remains zero. Step 3: exponent 0 + 127 = 127 = binary 01111111 Step 4: remove hidden digit from 1.0 --> 0 Step 5: -1 is negative - the sign bit is one: The next eight bits are the exponent: The next 23 bits are the mantissa: 1 01111111 000000000000000000000 No need to shift.

Binary result (32 bits): 10111111100000000000000000000000 Step 6: 1011 1111 1000 0000 0000 0000 0000 0000 B F 8 0 0 0 0 0 Answer: -0.5 is BF800000h in IEEE 754 single-precision format.

EXAMPLE 6: Show that IEEE 754 binary 438F0000h is decimal 286 ---------We run the six steps in reverse order from above: Step 6: Convert the hexadecimal into binary: 4 3 8 F 0 0 0 0 0100 0011 1000 1111 0000 0000 0000 0000 Step 5: Split the binary into 1+8+23 bit pieces: 01000011100011110000000000000000 --> 0 10000111 00011110000000000000000 Number is positive - the sign bit is zero: The next eight bits are the exponent: The next 23 bits are the mantissa: 0 10000111 00011110000000000000000

Step 4: add back the missing hidden digit to the mantissa/significand 00011110000000000000000 --> 1.00011110000000000000000 Step 3: convert the exponent to decimal and subtract 127 binary 10000111 (=128+4+2+1) = 135 --> 135 - 127 = 8 --> 2**8 Step 2: de-normalize the mantissa/significand (make exponent zero) 1.00011110000000000000000 times 2**8 --> (must move right 8 places) --> 100011110.000000000000000 times 2**0 We moved the binary decimal point 8 places to the right, making the number larger, which allowed us to reduce the exponent by the same amount (to zero). Step 1: binary 100011110.000000000000000 --> decimal 286 (=256+16+8+4+2) Answer: IEEE 754 binary 438F0000h is decimal 286. EXAMPLE 7: Show that IEEE 754 binary BF880000h is decimal -1.0625 ---------Step 6: Convert the hexadecimal into binary: B F 8 8 0 0 0 0 1011 1111 1000 1000 0000 0000 0000 0000 Step 5: Split the binary into 1+8+23 bit pieces: 10111111100010000000000000000000 --> 1 01111111 00010000000000000000000 Number is negative - the sign bit is one: The next eight bits are the exponent: The next 23 bits are the mantissa: 1 01111111 00010000000000000000000

Step 4: add back the missing hidden digit to the mantissa/significand 00010000000000000000000 --> 1.00010000000000000000000

Step 3: convert the exponent to decimal and subtract 127 binary 01111111 = (2**7)-1 = 127 --> 127 - 127 = 0 --> 2**0 Step 2: de-normalize the mantissa/significand (make exponent zero) 1.00010000000000000000000 times 2**0 --> (no need to move decimal) --> 1.00010000000000000000000 times 2**0 An exponent of zero means no adjustment is needed. Step 1: binary 1.00010000000000000000000 --> decimal 1.0625 ( = 1 + 1*(2**(-4)) = 1 + 0.0625 = 1.0625 ) Answer: IEEE 754 binary BF880000h is decimal -1.0625 EXAMPLE 8: Show that decimal 128.5625 equals binary 43009000h in IEEE 754 format. ---------Step 1: Convert the decimal number to its binary fractional form. (Convert the parts on each side of the binary decimal point separately, using the techniques already learned in class.) The decimal number 128.5625 converted to binary is: 10000000.1001

Note that the implied binary exponent multiplier here is "1" (2**0). Step 2: Normalize the binary fractional number. Move the decimal point left or right so that only a single binary digit "1" is to the left of the binary decimal point. Compensate by adjusting the exponent in the opposite direction. 10000000.1001 times 2**0 --> (move binary decimal point left 7) --> 1.00000001001 times 2**7 Moving the decimal left seven decreases the size of the number; so, we use an exponent of 7 to compensate and keep the number the same size. Step 3: Convert the exponent to 8-bit excess-127 notation. Add 127 to the exponent and convert it to 8-bit binary: 7 + 127 = 134 --> 10000110 ( = 128 + 4 + 2 )

Step 4: Convert the mantissa/significand to "hidden bit" format. Since every binary floating-point number (except zero!) is normalized with "1." at the start, there is no need to store that leftmost "1". Remove the leading "1." from the mantissa/significand: 1.00000001001 --> 00000001001

Step 5: Write down the 1+8+23 = 32 bits. 128.5625 is positive - the sign bit is zero: 0 The next eight bits are the exponent: 10000110 The next 23 bits are the mantissa: 00000001001000000000000 Binary result (32 bits): 01000011000000001001000000000000

Step 6: Convert the 32 bits to hexadecimal, starting on the right. To convert 01000011000000001001000000000000 to hexadecimal, group the bits into chunks of four, starting from the right, and convert each four-bit chunk to its hexadecimal digit 0-9A-F: Answer (hex): 0100 0011 0000 0000 1001 0000 0000 0000 4 3 0 0 9 0 0 0

Answer: 128.5625 is 43009000h in IEEE 754 single-precision format. ---------------------------------------------------------------------------*) The IEEE 754 floating-point number 81234567h is negative. Without converting, give the hexadecimal for the same number, only positive. Turn off the sign bit (8->0): *) 01234567h

The IEEE 754 floating-point number 7EDCBA98h is positive. Without converting, give the hexadecimal for the same number, only negative. Turn on the sign bit (7->F): FEDCBA98h

*)

Without converting, circle all the IEEE 754 negative numbers: 1837A654h 7A6A3B65h 87B5CDE2h 90A5B5EFh A0000037h D1B8765Ah F0000000h Anything with the sign bit on is negative. (Choose anything starting with hex digits 8..F)

-| Ian! D. Allen - idallen@idallen.ca - Ottawa, Ontario, Canada | Home Page: http://idallen.com/ Contact Improv: http://contactimprov.ca/ | College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/ | Defend digital freedom: http://eff.org/ and have fun: http://fools.ca/

- AN1215_PID68HC11Uploaded byrwong1231
- The CADNA softwareUploaded bykaveg
- A2L FileUploaded byRam Krishan Sharma
- c1-3Uploaded byapi-3853770
- Addressing ModesUploaded bylogintojalluri
- NumberSystems.ppt.Uploaded bysfmovin
- Numerical AnalysisUploaded byAsif javed
- Floating PointUploaded bykarimM
- Real Numbers ProblemsUploaded byEdgardo Leysa
- parthi12Uploaded byMohan Raj
- Hexadecimal Conversion WorkbookUploaded bypuma384
- 25.Memory Representation of Float Data Type in cUploaded byGanesh Nimbolkar
- 09 ArithmeticUploaded byFatima Al-Thwadi
- final_2009Uploaded byDaniel Echeverria
- Computer Organization & Design The Hardware/Software Interface, 2nd Edition Patterson & HennessyUploaded byMr.Puppy
- C++ Chapter 1 IntroductionUploaded byEricSeng
- DCII-manual.pdfUploaded byMihai Paun
- basicplc4Uploaded byvamsidar47
- Mvi56 Mnet User ManualUploaded bygondai
- 01 IntroductionUploaded byDikxon Hervery Sihombing
- Bcd to Hex ConversionUploaded bynirmal_inbox
- DldUploaded bySandy Ronaldo
- DataRepresentationUploaded bykaylaroberts
- DLD02 Number SystemUploaded byS.M.Abbas Zadi.
- digital and microprosessor foundationsUploaded byapi-240936934
- Understanding the StackUploaded bymanikantamnk11
- Assignment No 1 DCLD Bca 2CUploaded byKaushal Arora
- journey inside - unit 3 digit informationUploaded byapi-360544753
- Lect-2 Lexical ConventionsUploaded bySahil Sharma
- Ece3430 Lecture 01Uploaded byRafael Alves

- Lista5 Equacao 2 GrauUploaded byAntonio Carlos Lima Barbosa Sinezio
- Floating Point NumbersUploaded bykalidass88
- Chapt 17Uploaded bybarbarossa17
- hw1_solnUploaded byDan Huynh
- Binary to LcdUploaded byNaveena Johnson
- Floating Point NumbersUploaded bySanchita Kadambari
- lab1Uploaded bysibarama20k
- 319433-015Uploaded byM8Rlawio
- Pm130 Plus ModbusUploaded bysanthoshvsp
- IA-64 Architecture - A Detailed TutorialUploaded byRaja Mustafa
- Mysql Bt0075Uploaded byAbdul Majeed Mohamed
- Floating point dders and multipliersUploaded byRohit Stan
- III BCA VBUploaded byMalathi Sankar
- Biomass e2es Sum v1.0Uploaded bypjjurado
- ch4Uploaded byUpinder Kaur
- 64057518_R07_IND780_PLC_ENUploaded byrafixcunhad
- c_goodUploaded bygobue
- Numerical AnalysisUploaded byAnh Dinh
- CS-02 March Morning Session.pdfUploaded byPrasenjit Chatterjee
- PreludeProgramming6ed_pp02.pdfUploaded bySadie
- 3 Fractional NumbersUploaded byabhilasha
- AN0051Uploaded bykleeph
- 18912 - Converting Floating Point or REAL Datatypes Into IntegersUploaded bymars_bruce_lee
- Oreilly-Java Virtual MachineUploaded byMaria Teresa Valera Gallegos
- Demmel Chapter 1Uploaded bySeema Soleja
- Implementation of Single Precision Floating Point Multiplier on FPGAUploaded byInternational Journal for Scientific Research and Development - IJSRD
- Allen Bradley OS 9 Assembler LinkerUploaded byscribdblowschunks
- STM32F4 Technical TrainingUploaded byVport Port
- Microprocessor 8086 lecture 1 by Ayad M.KwadUploaded byAyad M Al-Awsi
- Sdd Hsc Notes-1Uploaded byAlex Smith