Divided by Zero

Divided by Zero

output(1 / 0);

What should the program output ?
NaN ? Error ?

5 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

I think "error, division by zero, line 1"

john_e_lilley的头像

Agreed, or something similar. However, there some other cases:var x = 1/0; // produce error here?output(x); // or here?var x = pow(10,pow(10,100)); // INF error here?output(x); // or here?

Quoting john_e_lilley
Agreed, or something similar. However, there some other cases:var x = 1/0; // produce error here?output(x); // or here?var x = pow(10,pow(10,100)); // INF error here?output(x); // or here?I think in first step in first and second examples

john_e_lilley的头像

Judges, do you have a preference that NaN and Inf numbers be detected at evaluation time, or at output time?

登陆并发表评论。