ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_except::isInf Interface Reference

Generate and return .true. if the input value is an IEEE-compliant negative or positive infinity. If the input value is a complex number, then the output is .true. if any of the two real or imaginary components or both components are either negative or positive infinities. More...

Detailed Description

Generate and return .true. if the input value is an IEEE-compliant negative or positive infinity. If the input value is a complex number, then the output is .true. if any of the two real or imaginary components or both components are either negative or positive infinities.

Parameters
[in]x: The input scalar or array of arbitrary rank of either
  type complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128), or
  type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
  whose value will be tested for being negative or positive infinity.
Returns
inf : The output scalar or array of the same shape as the input x of type logical of default kind LK whose value is .true. if the input x is a negative or positive infinity, otherwise it is .false..


Possible calling interfaces

use pm_except, only: isInf
use pm_kind, only: LK
logical(LK) :: inf
inf = isInf(x)
Generate and return .true. if the input value is an IEEE-compliant negative or positive infinity....
Definition: pm_except.F90:823
This module contains procedures and generic interfaces for testing for exceptional cases at runtime.
Definition: pm_except.F90:46
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
Remarks
The procedures under discussion are pure.
The procedures under discussion are elemental.
Note
A very simple test of negative or positive infinity of a variable x is the condition abs(x) > huge(x) that is .true. if x is a negative or positive infinity.
The procedures under this generic interface are equivalent to .not. (ieee_is_negative(x) .or. ieee_is_finite(x)) from the ieee_arithmetic intrinsic module to detect negative or positive infinity. This generic interface extends this function also to complex numbers.
See also
isInf
isNAN
getNAN
setNAN
isInfPos
isInfNeg
getInfPos
setInfPos
getInfNeg
setInfNeg


Example usage

1program example
2
3 use pm_kind, only: SK, IK
4 use pm_kind, only: RKS, RKD, RKH ! all processor types and kinds are supported.
5 use pm_kind, only: CKS, CKD, CKH ! all processor types and kinds are supported.
7 use pm_io, only: display_type
8
9 implicit none
10
11 real(RKH) :: X_RKH(3)
12 real(RKD) :: X_RKD(3)
13 real(RKS) :: X_RKS(3)
14 complex(CKH) :: X_CKH(3)
15 complex(CKD) :: X_CKD(3)
16 complex(CKS) :: X_CKS(3)
17
18 type(display_type) :: disp
19 disp = display_type(file = "main.out.F90")
20
21 call setInfPos(X_RKH)
22 call setInfNeg(X_RKD)
23 call setInfPos(X_RKS)
24
25 call setInfPos(X_CKH)
26 call setInfNeg(X_CKD)
27 call setInfPos(X_CKS)
28
29 X_RKH(2) = 0._RKH
30 X_RKD(2) = 0._RKD
31 X_RKS(2) = 0._RKS
32
33 X_CKH(2) = (0._CKH, 0._CKH)
34 X_CKD(2) = (0._CKD, 0._CKD)
35 X_CKS(2) = (0._CKS, 0._CKS)
36
37 X_CKH(2) = cmplx(0._CKH, X_RKH(1), CKH)
38 X_CKD(2) = cmplx(-X_RKD(1), 0._CKD, CKD)
39 X_CKS(2) = cmplx(0._CKS, 0._CKS, CKS)
40
41 call disp%skip
42 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
43 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
44 call disp%show("!Generate real IEEE-compliant negative or positive infinity.")
45 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
46 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
47 call disp%skip
48
49 call disp%skip
50 call disp%show("!%%%%%%%%%%%")
51 call disp%show("!32-bit real")
52 call disp%show("!%%%%%%%%%%%")
53 call disp%skip
54
55 call disp%skip
56 call disp%show("X_RKS(1)")
57 call disp%show( X_RKS(1) )
58 call disp%show("isInf(X_RKS(1))")
59 call disp%show( isInf(X_RKS(1)) )
60 call disp%skip
61
62 call disp%skip
63 call disp%show("X_RKS")
64 call disp%show( X_RKS )
65 call disp%show("isInf(X_RKS)")
66 call disp%show( isInf(X_RKS) )
67 call disp%skip
68
69 call disp%skip
70 call disp%show("!%%%%%%%%%%%")
71 call disp%show("!64-bit real")
72 call disp%show("!%%%%%%%%%%%")
73 call disp%skip
74
75 call disp%skip
76 call disp%show("X_RKD(1)")
77 call disp%show( X_RKD(1) )
78 call disp%show("isInf(X_RKD(1))")
79 call disp%show( isInf(X_RKD(1)) )
80 call disp%skip
81
82 call disp%skip
83 call disp%show("X_RKD")
84 call disp%show( X_RKD )
85 call disp%show("isInf(X_RKD)")
86 call disp%show( isInf(X_RKD) )
87 call disp%skip
88
89 call disp%skip
90 call disp%show("!%%%%%%%%%%%%")
91 call disp%show("!128-bit real")
92 call disp%show("!%%%%%%%%%%%%")
93 call disp%skip
94
95 call disp%skip
96 call disp%show("X_RKH(1)")
97 call disp%show( X_RKH(1) )
98 call disp%show("isInf(X_RKH(1))")
99 call disp%show( isInf(X_RKH(1)) )
100 call disp%skip
101
102 call disp%skip
103 call disp%show("X_RKH")
104 call disp%show( X_RKH )
105 call disp%show("isInf(X_RKH)")
106 call disp%show( isInf(X_RKH) )
107 call disp%skip
108
109
110 call disp%skip
111 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
112 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
113 call disp%show("!Generate complex IEEE-compliant negative or positive infinity.")
114 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
115 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
116 call disp%skip
117
118
119 call disp%skip
120 call disp%show("!%%%%%%%%%%%%%%")
121 call disp%show("!32-bit complex")
122 call disp%show("!%%%%%%%%%%%%%%")
123 call disp%skip
124
125 call disp%skip
126 call disp%show("X_CKS(1)")
127 call disp%show( X_CKS(1) )
128 call disp%show("isInf(X_CKS(1))")
129 call disp%show( isInf(X_CKS(1)) )
130 call disp%skip
131
132 call disp%skip
133 call disp%show("X_CKS")
134 call disp%show( X_CKS )
135 call disp%show("isInf(X_CKS)")
136 call disp%show( isInf(X_CKS) )
137 call disp%skip
138
139 call disp%skip
140 call disp%show("!%%%%%%%%%%%%%%")
141 call disp%show("!64-bit complex")
142 call disp%show("!%%%%%%%%%%%%%%")
143 call disp%skip
144
145 call disp%skip
146 call disp%show("X_CKD(1)")
147 call disp%show( X_CKD(1) )
148 call disp%show("isInf(X_CKD(1))")
149 call disp%show( isInf(X_CKD(1)) )
150 call disp%skip
151
152 call disp%skip
153 call disp%show("X_CKD")
154 call disp%show( X_CKD )
155 call disp%show("isInf(X_CKD)")
156 call disp%show( isInf(X_CKD) )
157 call disp%skip
158
159 call disp%skip
160 call disp%show("!%%%%%%%%%%%%%%%")
161 call disp%show("!128-bit complex")
162 call disp%show("!%%%%%%%%%%%%%%%")
163 call disp%skip
164
165 call disp%skip
166 call disp%show("X_CKH(1)")
167 call disp%show( X_CKH(1) )
168 call disp%show("isInf(X_CKH(1))")
169 call disp%show( isInf(X_CKH(1)) )
170 call disp%skip
171
172 call disp%skip
173 call disp%show("X_CKH")
174 call disp%show( X_CKH )
175 call disp%show("isInf(X_CKH)")
176 call disp%show( isInf(X_CKH) )
177 call disp%skip
178
179end program example
Return an IEEE-compliant negative infinity.
Definition: pm_except.F90:1893
Return an IEEE-compliant positive infinity.
Definition: pm_except.F90:1363
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
integer, parameter CKH
The scalar integer constant of intrinsic default kind, representing the highest-precision complex kin...
Definition: pm_kind.F90:843
integer, parameter CKS
The single-precision complex kind in Fortran mode. On most platforms, this is a 32-bit real kind.
Definition: pm_kind.F90:570
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter CKD
The double precision complex kind in Fortran mode. On most platforms, this is a 64-bit real kind.
Definition: pm_kind.F90:571
integer, parameter RKD
The double precision real kind in Fortran mode. On most platforms, this is an 64-bit real kind.
Definition: pm_kind.F90:568
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
integer, parameter RKH
The scalar integer constant of intrinsic default kind, representing the highest-precision real kind t...
Definition: pm_kind.F90:858
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
Definition: pm_kind.F90:567
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
2!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4!Generate real IEEE-compliant negative or positive infinity.
5!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7
8
9!%%%%%%%%%%%
10!32-bit real
11!%%%%%%%%%%%
12
13
14X_RKS(1)
15+Inf
16isInf(X_RKS(1))
17T
18
19
20X_RKS
21+Inf, +0.00000000, +Inf
22isInf(X_RKS)
23T, F, T
24
25
26!%%%%%%%%%%%
27!64-bit real
28!%%%%%%%%%%%
29
30
31X_RKD(1)
32-Inf
33isInf(X_RKD(1))
34T
35
36
37X_RKD
38-Inf, +0.0000000000000000, -Inf
39isInf(X_RKD)
40T, F, T
41
42
43!%%%%%%%%%%%%
44!128-bit real
45!%%%%%%%%%%%%
46
47
48X_RKH(1)
49+Inf
50isInf(X_RKH(1))
51T
52
53
54X_RKH
55+Inf, +0.00000000000000000000000000000000000, +Inf
56isInf(X_RKH)
57T, F, T
58
59
60!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62!Generate complex IEEE-compliant negative or positive infinity.
63!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65
66
67!%%%%%%%%%%%%%%
68!32-bit complex
69!%%%%%%%%%%%%%%
70
71
72X_CKS(1)
73(+Inf, +Inf)
74isInf(X_CKS(1))
75T
76
77
78X_CKS
79(+Inf, +Inf), (+0.00000000, +0.00000000), (+Inf, +Inf)
80isInf(X_CKS)
81T, F, T
82
83
84!%%%%%%%%%%%%%%
85!64-bit complex
86!%%%%%%%%%%%%%%
87
88
89X_CKD(1)
90(-Inf, -Inf)
91isInf(X_CKD(1))
92T
93
94
95X_CKD
96(-Inf, -Inf), (+Inf, +0.0000000000000000), (-Inf, -Inf)
97isInf(X_CKD)
98T, T, T
99
100
101!%%%%%%%%%%%%%%%
102!128-bit complex
103!%%%%%%%%%%%%%%%
104
105
106X_CKH(1)
107(+Inf, +Inf)
108isInf(X_CKH(1))
109T
110
111
112X_CKH
113(+Inf, +Inf), (+0.00000000000000000000000000000000000, +Inf), (+Inf, +Inf)
114isInf(X_CKH)
115T, T, T
116
117
Test:
test_pm_except


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, Friday 1:54 AM, April 21, 2017, Institute for Computational Engineering and Sciences (ICES), The University of Texas, Austin, TX

Definition at line 823 of file pm_except.F90.


The documentation for this interface was generated from the following file: