public double RoundXtoNearestIthPowerOfR(double x, double r, double i)
double res=0; r = Math.Abs(r);
if (r > 0)
double rr = x*Math.Pow(r, -i); double flrr = Math.Truncate(rr);
res = Math.Pow(r, i)*(flrr-Math.Truncate(2*flrr - 2*rr));
Writer, designer, inventor, musician, observer, and critic with many years of experience in each of these areas. I can do without the approval of "experts" because I believe candid statements and penetrating analysis bring greater rewards than a "pat on the back". And if I have something to say when you're not listening, I tell someone else about it.