Homework 1

Next: Histogram equalization Up: Homework 1 Previous: Prerequisites

# Digital representation of numbers

You can either write your answers to theoretical questions on paper or edit them in the file hw1/paper.tex. Please show all the mathematical derivations that you perform.

1. UT's burnt orange'' color is expressed by code #BF5700, where each pair of symbols (BF, 57, and 00) refers to a hexadecimal (base 16) representation of the red, green, and blue components. Convert these numbers to an octal (base 8) and a decimal (base 10) representations.

2. The C program listed below, when compiled and run from the command line, takes a string from the user and prints out the string characters. Modify the program to output ASCII integer codes for each character in the string. What is the ASCII code for the special new line character \n''?

 #include /* for printf and scanf */ int main(void) { char *s, string[101]; printf("Input a string:"); scanf("%100s",string); /* loop over characters */ for (s=string; *s != ''; s++) printf("%c",*s); } 

3. Write a program that prints out little'' if the computer is little-endian and big'' if the computer is big-endian. Test it on your computer.

4. In the IEEE double-precision floating-point standard, 64 bits (binary digits) are used to represent a real number: 1 bit for the sign, 11 bits for the exponent, and 52 bits for the mantissa. A double-precision normalized non-zero number can be written in this standard as

with , and for . What is the largest number that can be expressed in this system?

 Homework 1

Next: Histogram equalization Up: Homework 1 Previous: Prerequisites

2014-09-08