Question
Please help Using FPU assembly code in the double hullSpeed(double lgth) part ! -compute the hull speed for the specified boat length, - implementing the
Please help Using FPU assembly code in the "double hullSpeed(double lgth)" part !
-compute the hull speed for the specified boat length,
- implementing the numerical computation in GNU Assembly Language
- through use of FPU instructions (do NOT call sqrt() from math.h)
#include
#include
#include
// do not change anything above this comment
double hullSpeed(double lgth) // -----------assembly code ----------
{
// here you will compute the hull speed for the specified boat length,
// implementing the numerical computation in GNU Assembly Language
// through use of FPU instructions (do NOT call sqrt() from math.h)
return 0.0;
}
// do not change anything below this comment, except for printing out your name
double hullSpeedC(double lgth)
{
// this C implementation of the hull speed computation is provided
// so you can compare its correct results with the results of your code
return 1.34 * sqrt(lgth);
}
int main(int argc, char **argv)
{
double lgth;
double hullSpd, hullSpdC;
printf("CS201 - Assignment 02 - I. Forgot ");
if (argc != 2) {
printf("need 1 argument: boat length ");
return -1;
}
lgth = atof(argv[1]);
hullSpd = hullSpeed(lgth);
hullSpdC = hullSpeedC(lgth);
printf("hullSpeed(%.0f) = %.3f, %.3f ", lgth, hullSpd, hullSpdC);
return 0;
}
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