Starting from:

$25

Homework 5 IEEE 754 binary representation

Problem 1. Show the IEEE 754 binary representation for the following fraction numbers in single precision. State if each number can be represented exactly. a. – 2.125 b. 2/3 Problem 2. What decimal number does the following bit pattern represent if it is a single precision floating-point number using the IEEE 754 standard? a. 0x0D000000 b. 0xC4650000 Problem 3. At a candy shop, the 1st candy costs 10cents. Each sequent candy costs 10 cents more than the previous one. For one dollar, how many candies can you purchase at most? Here is a program written in C to answer that question. float fundLeft = 1.0; float cost; int numCandies = 0; for(cost=0.1; cost <= fundLeft; cost += 0.1) { numCandies++; fundLeft = fundLeft - cost; } printf(”%d candies; %f left over\n”, numCandies, fundLeft); Run the program and report the result. If the result is not what is expected, explain why? Modify the program so that the correct answer can be obtained. Present your modified program.
Problem 4: Implement in ARM assembly language for sorting with a linkedlist. In the main function, open a file to read a sequence of unsorted integers. For the first input integer, create a root node (8 bytes), holding the integer and one empty pointer. For each of the following input integers, build a link (call it X) containing the number and insert it to the linked list such that for any link with smaller integer should go before X and any link with integer of bigger or equal value should go after X. After all integers are inserted, the program would traverse the linked list and print out the sorted integers separated by space onto the screen.
Specification: you should write Insert as a recursive function. data Null or a Pointer to the next link

More products