ASSEMBLY LANGUAGE HW Programming Floating-Point Arithmetic Implement functions t
ID: 3576521 • Letter: A
Question
ASSEMBLY LANGUAGE HW
Programming Floating-Point Arithmetic
Implement functions that perform calculation according to the tasks given below. All input and output variables must be of floating-point type (C/C++ float or double). Find correct formulas by yourself and define the required parameters and types in order to compute the result.
Note: Calculations, conditions and jumps may be implemented with Inline Assembler! Keep in mind that if you are using assembler module, then to return the floating-point result from the function by convention it must be placed in the FPU data register ST(0).
Apply The x87 FPU instructions for the solutions. Use the template below please and the app should be run without error.
Task for grade level 6: Calculate the area of parallelogram then the length of sides and angle between them is given.
Task for grade level 8: Calculate the surface area of cone when base radius and height is given.
Please use template below for the solutions;
#include "stdafx.h"
#include
#include
// For each grade level variant implement own function, e.g.:
double solution_for_grade_X(double a, double b, double c)
{
double r;
__asm
{
// Your Inline Assembler instructions for grade level X go here
// :::
fst QWORD PTR [r] ; r = st(0)
}
return r; // Please note that in assembler module the result must be placed in st(0)!
}
int main()
{
// Change the parameters according to your grade level function, e.g.:
double r = solution_for_grade_X(1.5, 2.3, 5.6);
// Print the result vector to the console:
_tprintf(_T("%d "), r);
// :::
return 0;
}
Explanation / Answer
A Java method is a collection of statements that are grouped together to perform an operation. When you call the System.out.println() method, for example, the system actually executes several statements in order to display a message on the console.
Now you will learn how to create your own methods with or without return values, invoke a method with or without parameters, and apply method abstraction in the program design.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.