문제

In Java, (Number/0) throws an ArithmeticException while (Number/0.0) = Infinity. Why does this happen?

도움이 되었습니까?

해결책

Because IEEE-754 floating point numbers have a representation for infinity, whereas integers don't.

In other words, every bit pattern in int represents a normal integer; floating point values are rather more complicated with +/- infinity, "not a number" (NaN) values, normalized values, subnormal values etc.

다른 팁

From here

The IEEE floating-point standard, supported by almost all modern processors, specifies that every floating point arithmetic operation, including division by zero, has a well-defined result. The standard supports signed zero, as well as infinity and NaN (not a number). There are two zeroes, +0 (positive zero) and −0 (negative zero) and this removes any ambiguity when dividing. In IEEE 754 arithmetic, a ÷ +0 is positive infinity when a is positive, negative infinity when a is negative, and NaN when a = ±0. The infinity signs change when dividing by −0 instead.

Integer division by zero is usually handled differently from floating point since there is no integer representation for the result. Some processors generate an exception when an attempt is made to divide an integer by zero, although others will simply continue and generate an incorrect result for the division. The result depends on how division is implemented, and can either be zero, or sometimes the largest possible integer.

OOTB 워크 플로를 사용하면 항목을 복사하거나 이동할 수 없습니다. 몇 가지 옵션이 있습니다 :

  • 이벤트 수신기 (이미 말한 것처럼)
  • SharePoint JSOM ( "Nofollow"> JavaScript 객체모델 )
  • 사용자 정의 SharePoint Designer 워크 플로우 활동 ( oblex ).그들은 당신이 필요한 것을 정확히 수행하는 복사 목록 항목 확장 활동을 가지고 있습니다.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top