Why is 0 divided by 0 an error?

前端 未结 18 765
耶瑟儿~
耶瑟儿~ 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 07:54

    Let's say:

    0/0 = x
    

    Now, rearranging the equation (multiplying both sides by 0) gives:

    x * 0 = 0
    

    Now do you see the problem? There are an infinite number of values for x as anything multiplied by 0 is 0.

提交回复
热议问题