# Datalab

Topics: Floating point, C, Fixed-point arithmetic Pages: 7 (2606 words) Published: February 18, 2013
15-213/18-213 Fall 2012 Data Lab: Manipulating Bits Assigned: Thu, Aug 30, Due: Thu, Sep 13, 11:59PM Last Possible Time to Turn in: Sun, Sep 16, 11:59PM

1 Introduction
The purpose of this assignment is to become more familiar with bit-level representations of common patterns, integers, and ﬂoating-point numbers. You’ll do this by solving a series of programming “puzzles.” Many of these puzzles are quite artiﬁcial, but you’ll ﬁnd yourself thinking much more about bits in working your way through them.

2 Logistics
• This is an individual project. All handins are electronic using the Autolab service. • You should do all of your work in an Andrew directory, using either the shark machines or a Linux Andrew machine.

3 Logging in to Autolab
All 15-213 labs are being offered this term through a Web service developed by CMU students and faculty called Autolab. Before you can download your lab materials, you will need to update your Autolab account. Point your browser at the Autolab front page https://autolab.cs.cmu.edu You will be asked to authenticate via WebISO. After you authenticate this ﬁrst time, Autolab will prompt you to update your account information with a nickname. Your nickname is the external name that identiﬁes 1

you on the public scoreboards that Autolab maintains for each assignment, so pick something interesting! You can change your nickname as often as you like. Once you have updated your account information, click on “Save Changes” button, and then select the “Home” link to proceed to the main Autolab page. If you added the class late, you might not be included in Autolab’s list of valid students. In this case, you won’t see the 15-213/18-213 course listed on your Autolab home page. If this happens, just contact the staff.

4 Handout Instructions

5 The Puzzles
This section describes the puzzles that you will be solving in bits.c.

2

5.1 Bit Manipulations
Table 1 describes a set of functions that manipulate and test sets of bits. The “Rating” ﬁeld gives the difﬁculty rating (the number of points) for the puzzle, and the “Max ops” ﬁeld 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...