문제

I J, 0%0 (zero divided by zero) gives 0 as an answer. However, _%_ (infinity divided by infinity) gives a NaN error? Why isn't it defined, while 0%0 is?

도움이 되었습니까?

해결책 2

I think the comment from Eelvex gives the answer. infinity over infinity is indeterminate. The indeterminate symbol in J is _.. However, this exists only to take care of data coming from external source, and J sentences shouldn't gives _. as an answer.

If 0 over 0 is defined as 0, this is because it has some practical uses. There are no such practical uses for infinity over infinity.

다른 팁

"Although zero divided by zero is indeterminate, it is desirable to provide a fixed quotient for it in a programming environment, in order to reduce the number of circumstances when it is necessary to interrupt the execution of a problem." This is the explanation by E. E. McDonnell from the paper Zero Divided by Zero.

A problem with Infinity is that it is not a value, but it is treated as a value. If Infinity were a value then _%_ would be One, as is the typical case where a number is divided by itself. (J implements 0%0 as an exception to that pattern.) My intuition is that J would be better were _%_ computed as resolving to One, but it isn't. So, while I cannot give an answer to your question, I propose that no answer is available from mathematics, nor is one to be found in J documentation or commentary.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top