Question: Construct a Turing machine that adds two binary real numbers. An input will be of the form X#Y, where X and Y are elements of

Construct a Turing machine that adds two binary real numbers. An input will be of the form X#Y, where X and Y are elements of {0, 1}+.{0, 1}+. In particular, X = xnxn-1 ... x1x0.x-1x-2 ... x-k, and Y = ymym-1 ... y1y0.y-1y-2 ... y-l with xi, yi in {0, 1}, X = (xn x 2n) + (xn-1 x 2n-1) + ... + (x1 x 21) + (x0 x 20) + (x-1 x 2-1) + ... + (x-k x 2-k), and Y = (ym x 2m) + (ym-1 x 2m-1) + ... + (y1 x 21) + (y0 x 20) + (y-1 x 2-1) + ... + (y-1 x 2-l). Your Turing machine must be a single tape, one way infinite, deterministic Turing machine. When the Turing machine completes, the tape should contain Z, where Z = X + Y. You do not need to delete X#Y from the tape, you can simply position the Turing machine\\\'s read/write head at the beginning of Z (leftmost symbol of Z). This is in jflap4.

Sol94:

1. Read the input string X#Y from the tape, where X and Y are binary real numbers separated by a \\\"#\\\" symbol.

2. Parse the binary real numbers X and Y by separating the integer and fractional parts of each number. This can be done by scanning from the left until the decimal point is reached, then continuing to scan from the right until the end of the string is reached.

3. Calculate the sum Z = X + Y by performing binary addition on the integer and fractional parts separately.

4. Write the binary real number Z to the tape in the same format as X and Y.

5. Move the Turing machine\\\'s read/write head to the leftmost symbol of Z, ready for output.

6. Halt the Turing machine.

The actual implementation of the Turing machine would require a detailed understanding of the binary addition algorithm, as well as the specific details of how to manipulate the tape and the Turing machine\\\'s internal state.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!