Original Post
Hey I have a native struct and method and I'm wrapping it in CLI and when I create the wrapper to this function I get an argument: error C2665: 'sqrt' : none of the 3 overloads could convert all the argument types Here is the native method: and here is the CLI method: the value member in "QuadReal" is of type qd_real*. Not sure whats going on. Thanks in Advance, Devin
[source lang = "cpp"]
qd_real sqrt(const qd_real &a) {
/* Strategy:
Perform the following Newton iteration:
x' = x + (1 - a * x^2) * x / 2;
which converges to 1/sqrt(a), starting with the
double precision approximation to 1/sqrt(a).
Since Newton's iteration more or less doubles the
number of correct digits, we only need to perform it
twice.
*/
if (a.is_zero())
return 0.0;
if (a.is_negative()) {
qd_real::error("(qd_real::sqrt): Negative argument.");
return qd_real::_nan;
}
qd_real r = (1.0 / std::sqrt(a[0]));
qd_real h = mul_pwr2(a, 0.5);
r += ((0.5 - h * sqr(r)) * r);
r += ((0.5 - h * sqr(r)) * r);
r += ((0.5 - h * sqr(r)) * r);
r *= a;
return r;
}
[source lang = "cpp"]
static QuadReal Sqrt(QuadReal n)
{
qd_real qr = std::sqrt(n.value);
return QuadReal(qr);
}