loading

Goal: To encode a 32-bit base ten number (normal counting system) that contains decimal values using the IEEE (Institute of Electrical and Electronics Engineers) floating point standard.

Step 1: Defined the Problem

Why Do This: A computer can only store data in binary format which is zeros and ones. This means that for humans to be able to communicate with a computer a common ground has to be formed when transferring data. This particular number conversion allows for people to do mathematical computations and share that information in a format a computer can process and manipulate.

Needed Materials: A writing utensil and paper, a calculator is not required for the calculations but helpful. The math involved is simple division and multiplication.

Time To Be Completed: The process should take about 10-20 minutes to complete with each step roughly taking 3-5 minutes.

Problem: : Use IEEE single format to encode the following decimal number into 32-bit floating point format: -10.3125

Tip: The images provided are examples of each step. They are to provide guidelines for formatting but they are different calculations.

Step 2: Converted the Number Into Binary Format

1) Split the number into two that separates the left side of the decimal from the right side of the decimal.

2) Take the left side of the decimal and divide the number by two.

-Save the remainder each time you do this (zero or one).

-Repeat this step until the number you have can no longer be divided by two. Once you can no longer divide, record the number by writing the last remainder first then to the right of that number write the second to last remainder and so on.

3) Take the right side of the decimal and multiply that number by 2.

-If the product is greater than one record the one and multiply the decimal remaining with by 2 again.

-If the product is less than one continue to multiply while recording the zero that is to the left of the decimal.

-Continue to multiply until the right side of the decimal becomes zero while recording the left side (zero or one). If it is zero or one, record it in the order it was obtained with the first recorded zero or one on the far left and the next number to its right and so on.

4) After you have the results of both numbers you should put them back on their respective sides with a decimal separating them.

Step 3: Calculated the Degree

1) Take the result from the previous step and move the decimal point to the right of the leftmost digit.

2) Keep track of how many spaces were moved left and record that as 2 to the power of (spaces moved).

3) This number should be recorded as the magnitude which will be used later.

Step 4: Determined the Sign Bit

1) This number will indicate whether the number is positive or negative.

2) If the original number is positive then record a zero else record a one.

3) This will be the sign bit that will be used later

Step 5: Determined the Magnitude

1) Take the number that was 2 to the power of blank and use it in this step.

2) Add 127 to this number and convert the result into binary using the same method of dividing it by two until you no longer can.

3) The result of this step should be an eight bit number that is called the magnitude.

Step 6: Built the Mantissa

1) Take the result from step one minus the leftmost bit and add zeros to the end until you have a 23-bit number.

2) This 23-bit long number is in binary format. This is known as the mantissa.

3) Store this number for later use.

Step 7: Complete the Conversion

1) Gather the previously calculated information which includes the sign bit, magnitude and mantissa.

2) The ordering should be as follows: Sign + Magnitude+ Mantissa = IEEE floating point number.

3) Convert the binary into a hex number by referring to the chart and exchanging each of the four bits into a hex digit. The numbers on the left are binary digits that will be replaced by the corresponding digits on the left.

4) Once completed, the resulting number should be an eight digit long hex number.

5) For further information regarding this type of conversion and other like it please visit the following link: https://en.wikipedia.org/wiki/Binary-coded_decimal

About This Instructable

138views

5favorites

License:

More by austin-brown2:DIY IEEE 32-bit Conversion IEEE 32-bit Conversion 
Add instructable to: