Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a code that turns a double precision decimal number into its 64-bit binary

ID: 3551255 • Letter: W

Question

Write a code that turns a double precision decimal number into its 64-bit binary equivalent. Hint, you may want to use the log2 and floor commands in MATLAB when finding the charateristic and the mantissa. Again do not turn in your code, but write down the key steps for how you determine the characteristic and the mantissa of your decimal number. Further explain how you find the binary strings associated with these values. As a little hint, if the characteristic, c, is given by where we have used the mod function to find the remainder of dividing c by 2 . Then we see that I leave the rest up to you. If you multiply the mantissa by a certain number, you can use the same approach for finding the binary representations of both the characteristic and the mantissa. What is this number, and why does it work?

Explanation / Answer

a=input('enter the number');

b=zeros(1,64);

for i=1:4

b(i)=mod(a,2);

if a>1

a=0.5*(a-b(i));

else

i=65;

end

end

disp(b)

  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote