FINITE Function
Returns a value indicating if the input variable is finite or not.
Usage
result = FINITE(x)
Input Parameters
x—A scalar or array expression of single-precision complex, double-precision complex, single-precision floating point, or double-precision floating point data type.
Returned Value
result—Returns 1 if x is finite. Returns 0 if x is infinite or not a defined number (NaN). Undefined numbers result from ill-defined operations, such as dividing zero by zero, or taking the logarithm of zero or a negative number.
Keywords
None.
Example 1
x = [100, SQRT(-1), ALOG(0), 99.9]
PM, x
; On UNIX systems, PV-WAVE prints:
; 100.000
; NaN
; -Inf
; 99.9000
; On Windows systems, PV-WAVE prints:
; 100.000
; -1.#IND0
; -1.#INF0
; 99.9000
PM, FINITE(x)
; PV-WAVE prints:
; 1
; 0
; 0
; 1
Example 2
; NOTE: This example requires PV-WAVE Advantage.
; Get the single-precision, floating-point machine constants.
MATH_INIT
fmach = MACHINE(/Float)
; Create a five-element vector containing single-precision,
; floating-point NaN, positive infinity, negative infinity, and
; finite values.
a = [fmach.nan, 3.0, fmach.pos_inf, 5.2, fmach.neg_inf]
b = FINITE(a)
; View result of FINITE.
INFO, b
; PV-WAVE prints: B BYTE = Array(5)
; Print vectors a and b. Note that vector b contains a 0
; when NaN or infinity occurs in a. Vector b contains 1 at
; the indices where vector a contains finite values.
FOR i=0L, 4 DO PRINT, a(i), b(i)
; On UNIX systems, PV-WAVE prints:
; NaN 0
; 3.00000 1
; Inf 0
; 5.20000 1
; -Inf 0
; On Windows systems, PV-WAVE prints:
; 1.#QNAN 0
; 3.00000 1
; 1.#INF0 0
; 5.20000 1
; -1.#INF0 0
See Also
For more details, see PV‑WAVE Programmer’s Guide.
Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.