【发布时间】:2012-12-13 19:08:24
【问题描述】:
我想知道下面的 C 程序是否有可能打印除 0 以外的东西?
double f(double x, double y) {
return x*x/x+x*x*x; // or whatever operations using *, /, +, -
}
int main(int argc, char** argv) {
double x = 4.0;
double y = 5.0;
double z = f(x,y);
x += 1e-7;
x -= 1e-7;
printf("%f\n", (f(x,y+1e-7)-z)/1e-7);
return 0;
}
任何人都可以启发我吗? 干杯,
【问题讨论】:
-
你为什么不试试看?
-
只是因为,我无法重现它。我只是想看看这段代码是否总是打印 0 函数 f 中使用的任何操作。