Why is 0 divided by 0 an error?

前端 未结 18 759
耶瑟儿~
耶瑟儿~ 2021-02-05 07:20

I have come across this problem in a calculation I do in my code, where the divisor is 0 if the divident is 0 too. In my code I return 0 for that case. I am wondering, while div

18条回答
  •  别跟我提以往
    2021-02-05 08:03

    This is maths rather than programming, but briefly:

    • It's in some sense justifiable to assign a 'value' of positive-infinity to some-strictly-positive-quantity / 0, because the limit is well-defined

    • However, the limit of x / y as x and y both tend to zero depends on the path they take. For example, lim (x -> 0) 2x / x is clearly 2, whereas lim (x -> 0) x / 5x is clearly 1/5. The mathematical definition of a limit requires that it is the same whatever path is followed to the limit.

提交回复
热议问题