Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4 The Puzzles This section describes the puzzles that you will be solving in bits . c. Table 1 lists the puzzles in rought order
4 The Puzzles This section describes the puzzles that you will be solving in bits . c. Table 1 lists the puzzles in rought order of difficulty from easiest to hardest. The "Rating" field gives the difficulty rating (the number of points) for the puzzle, and the "Max ops" field gives the maximum number of operators you are allowed to use to implement each function. See the comments in bits.c for more details on the desired behavior of the functions. You may also refer to the test functions in tests . c. These are used as reference functions to express the correct behavior of your functions, although they don't satisfy the coding rules for your functions. Table 1: Datalab puzzles. For the floating point puzzles, value f is the floating-point number having the same bit representation as the unsigned integer uf. For the floating-point puzzles, you will implement some common single-precision floating-point operations. For these puzzles, you are allowed to use standard control structures (conditionals, loops), and you may use both int and unsigned data types, including arbitrary unsigned and integer constants. You may not use any unions, structs, or arrays. Most significantly, you may not use any floating point data types, operations, or constants. Instead, any floating-point operand will be passed to the function as having type unsigned, and any returned floating-point value will be of type unsigned. Your code should perform the bit manipulations that implement the specified floating point operations. The included program fshow helps you understand the structure of floating point numbers. To compile fshow, switch to the handout directory and type: unix> make You can use fshow to see what an arbitrary pattern represents as a floating-point number: unix> ./fshow 2080374784 Floating point value 2.658455992e+36 Bit Representation 0x7c000000, sign =0, exponent = f8, fraction =000000 Normalized. 1.00000000002(121) You can also give fshow hexadecimal and floating point values, and it will decipher their bit structure. Don't include the h> header file in your bits. c file, as it confuses dlc and results in some non-intuitive error messages. You will still be able to use printf in your bits. c file for debugging without including the stdio. h header, although gcc will print a warning that you can ignore. The dlc program enforces a stricter form of C declarations than is the case for C++ or that is enforced by gcc. In particular, any declaration must appear in a block (what you enclose in curly braces) before any statement that is not a declaration. For example, it will complain about the following code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started