The Mossolov problem – the phi function
if (x <= 0) return 0;
if (
n == 1)
return x/(
c+
r);
if (
r == 0)
return pow(x/
c,1/
n);
for (size_t i = 0; true; ++i) {
if (fabs(ry) <= tol && fabs(dy) <= tol) break;
if (y+dy > 0) {
y += dy;
} else {
y /= 2;
check_macro (1+y != y,
"phi: machine precision problem");
}
}
return y;
}
return 1/(
r +
n*
c*
pow(phi_x,-1+
n));
}
protected:
};