Question
First, copy this file (Links to an external site.) to your own Google drive. This allows you to edit the cells. Edit the blue cell
First, copy this file (Links to an external site.) to your own Google drive. This allows you to edit the cells. Edit the blue cell so that it is your student ID. The string displayed in the green cell is what you need to use as the input to your program.
This (Links to an external site.) is an archive of the CodeBlocks project that you can start with. Unzip the archive into its own folder, a CodeBlocks project is already created. Edit the file exp10to2.c and implement exp10ToExp2.
Your code should take the struct Number pointed by parameter "pn" and preserve the value v = m a n t i s s a 2 e x p 2 10 e x p 10. The restrictions are as follows:
- mantissa should end up as a value that has bit 63 set. mantissa is a 64-bit unsigned integer.
- exp10 should be 0 when your algorithm is done.
- exp2 can be any integer (signed)
- the represented value v should be preserved as much as possible
In the following editor area, indicates the following when your code completes
- mantissa (in base-10)
- exp2 (in base-10)
To run the program with your specific test input, do the following in CodeBlocks:
- put a break point at the end of exp10ToExp2, you can click slightly to the right of the line number to toggle breakpoint on a line.
- In the "Project" menu, click "set programs' arguments"
- In Program Arguments, enter the following without quotes:"-n 1.23e-10" (obviously change the floating point number to the one that you should use), click OK
- when the program stops at the break point, you can examine the expressing *pn
- In the Debugger pane, you can type the following command without the quotes "print *pn"
- Figure out how to use CodeBlocks and its debugger interface!
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