不明白为什么我会收到“控制可能达到非无效功能结束”的警告。有什么建议么?
这是我的代码:
long double geo_fn(long reps, int seed) {
double x, y, pythag_sum, total = 0, inside = 0;
default_random_engine engine(seed);
uniform_real_distribution<double>dist(0,1);
for(int i = 0; i< reps ;i++){
x = dist(engine);
y = dist(engine);
pythag_sum = (x*x)+(y*y);
if (pythag_sum <= 1){
inside += pythag_sum;
total += pythag_sum;
}
else {
total += pythag_sum;
}
return (inside/total)/10;
}
}