The tasks for this lab are to edit the file prog2.c available on agate in ~cs520/public/prog2:
sign: 1; exponent: 6A3; fraction: 0F563AB5189CD.Just show the bits for each component using hex. Do not un-bias the exponent or insert the hidden 1 bit into the fraction. Display the leading zeroes for each component, so always print one hex digit for the sign, three hex digits for the exponent, and thirteen hex digits for the fraction.
#include <stdio.h> long d2l(long); int main(void) { long in; in = 0x402e000000000000L; d2l(in); return 0; }
If the main function is in the file main.c and your implementation of d2l is in the file prog2.c, then to compile and run the program:
gcc -Wall -std=c99 prog2.c main.c -o prog2 ./prog2
Turn in this laboratory, by typing:
% ~cs520/bin/submit lab3 prog2.c
Submissions can be checked by typing:
% ~cs520/bin/scheck lab3
Use #if C preprocessor commands to control whether the debugging prints are enabled. (See the Program 2 specification for more information about how to do this.) Leave the debugging prints enabled for your submission of this lab.
Remember that there are no late submissions of labs. Submit what you have prior to noon on Sunday February 14.
Comments and questions should be directed to pjh@cs.unh.edu