2018년 4월 12일 목요일

(강의내용 아님) isNaN, isInfinite


------------------------------------------------
static double NaN
A constant holding a Not-a-Number (NaN) value of type double.
Returns true if this Double value is a Not-a-Number (NaN)

isNaN
Returns true if this Double value is a Not-a-Number (NaN), false otherwise.

static double NEGATIVE_INFINITY
A constant holding the negative infinity of type double.

static double POSITIVE_INFINITY
A constant holding the positive infinity of type double.
------------------------------------------------
isInfinite()
The isInfinite() method of Float class
if this Float object is infinite floating point

isInfinite()
Returns true if this Float value is infinitely large in magnitude, false otherwise.
------------------------------------------------
*NaN은 Double타입 검증
* 숫자가 아님

* isInfinite는 Float타입 검증
* 숫자이지만 무한대
------------------------------------------------
참고사이트: http://killsia.tistory.com/entry/자바-NaN-Infinity
------------------------------------------------

The only difference is this:

!isNan(1/0) // --> true
isFinite(1/0) // --> false
isNaN checks whether the argument is a number or not. The Infinities (+/-) are also numerical, thus they pass the isNaN check, but don't pass the isFinite check.

** Note that any string which can be parsed as a number ("2", "3.14") will cause isNaN to return false.

Hope this helps.

PS: The answer given by user1170379 was very nearly perfect.

------------------------------------------------

https://stackoverflow.com/questions/10511170/java-0-2-0-false

------------------------------------------------
r = n mod x means that

1. 0≤r 2. for some a, n=xa+r

when x=0, the first condition cannot be satisfied

------------------------------------------------

댓글 없음:

댓글 쓰기

[Android Studio] Installation and Make a Layer for Mac OS(High Sierra)

1. download android studio https://developer.android.com/studio/#downloads 2. Make a Shared Resource(String in this case) 3...