黄舟2017-04-17 13:40:03
is no problem originally, but the n
and m
you input here are too large, and the integer overflows, causing i * i
to become 0
after overflow, and a division-by-zero exception in the denominator occurs.
PHP中文网2017-04-17 13:40:03
1/(i*i)
is the division of two integers (in this case, 1/3 is not equal to 0.3333... but equal to 0), I think you need to use 1.0/(i*i)
for this. Since i*i
may indeed be 0, you'd better judge ahead of time.