Please help me multiply 1.34 to the result of the square root double hullSpeed(d
ID: 3669841 • Letter: P
Question
Please help me multiply 1.34 to the result of the square root
double hullSpeed(double lgth)
{
double result;
//double z = 1.34;
__asm__ ("fldl %1 ;"//load x TOS
"fsqrt ;"//compute square root!!!!!!
"fstl %0 ;"//store new value
///////////////////////////////////////////////////////
//withouth this two lines the square root works fine
//Trying to multiply 1.34 to the square root result
"fmul %0;"
"fstl %0 ;"//load new value
////////////////////////////////////////////////////////////////////////
: "=g" (result)
: "g" (lgth)
);
return result;
}
Explanation / Answer
Modify your function to something like this:
double hullSpeed(double lgth)
{
double result;
__asm__ ("fldl %1 "//load x TOS
"fsqrt "//compute square root!!!!!!
"fmulp " //multiplication
: "=g" (result) : "g" (lgth), "f" (1.34));
return result;
}