ASSEMBLY LANGUAGE COURSE HOMEWORK Programming Floating-Point Arithmetic Implemen
ID: 3575905 • Letter: A
Question
ASSEMBLY LANGUAGE COURSE HOMEWORK
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
1)
Area of parallelogram =AB×DL=b×h=AB×DL=b×h
But hAD=sinhAD=sin
Or h=ADsinh=ADsin
Or h=csinh=csin
Area of ABCD=h×csinABCD=h×csin
Area of Parallelogram == Product of adjacent sides×sin×sin
Example:
Find the base of a parallelogram whose area is 256256square cm and height 3232cm.
Solution:
Since, area =256=256square cm
height =32=32cm
Area of parallelogram == base ×× height
256=256=base ×32×32
Base =25632=8=25632=8cm.
Example:
Find the area of a parallelogram, two adjacent sides of which are 1717cm and 2020cm and their included angle is6060.
Solution:
Here, one side, b=17b=17cm, other side, c=20c=20cm, =60=60
Area =bcsin=bcsin
=17×20×sin60=17×20×sin60
=340×0.866=340×0.866
=294.44=294.44square cm
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.