You will learn how to generate assembly language from the compiler in your C program for more precise control.
In this assignment, you will be asked to write a “math library” function. You will be writing the function in C or C++, and using the compiler to generate Assembly code (also called Object Code). Please consult the Help options in Visual Studio on how to generate the assembly code. There are switches during compile that can generate the assembly code for you (researching how to generate the assembly code from Visual Studio using Help and the Web is part of the assignment).
You should use C/C++ for support tasks like defining local variables, returning a value from the function, etc.
The IA-32 Architecture includes the floating point instructions needed to implement these functions. You will save yourself a lot of work if you carefully choose the right instructions. This is a large and powerful instruction set, and you should make use of that power instead of “re-inventing the wheel.” In other words, don’t spend a lot of time writing a lot of dumb code. Instead, spend your time thinking first, and you will be able to write a smaller amount of smart code. Loops are not necessary for any of these assignments, and your code should not include them. Do not implement a mathematical solution such as a power series. There is no need for something like this and doing all that unneccessary work will reflect poorly on your understanding of the instructions available in the IA-32 Architecture.
Write a function named absD that returns the absolute value of its argument (the D indicates that the argument and return value are of type double). The function prototype is: double absD (double n); Submit your code as a03-yourname.c and also a03-yourname.asm (for the generated assembly file). Ensure you meet the coding guidelines and requirements.