Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

check for infinity

tropfen
New Contributor I
2,186 Views
Hello,

is there a way to check for the value Infinity? (like ISNAN)

I do know it would be better to avoid Infinity before it comes. But what i need is a check for.

If there is no good way by now, is it possible to add a function into IVF to do this? The value Infinity must have in some way a spezific look like.

Thanks in advance
Frank

0 Kudos
3 Replies
TimP
Honored Contributor III
2,186 Views
IEEE_IS_FINITE and IEEE_IS_NAN are documented for the current release. They were supported before appearing in the documentation.
0 Kudos
Wang_J_
Beginner
2,186 Views

TimP (Intel) wrote:

IEEE_IS_FINITE and IEEE_IS_NAN are documented for the current release. They were supported before appearing in the documentation.

How to use 'IEEE_IS_FINITE '?  When  i directly use it like 'if(variable==IEEE_IS_FINITE ) then', it does not work well. Even 'variable' is infinity, the progam do not go into the if  .

0 Kudos
Les_Neilson
Valued Contributor II
2,186 Views

You will need something like :

    use, intrinsic :: ieee_arithmetic
    ...
    logical result
    ...
    result = ieee_is_finite(variable)
and test  if (.not.result) then     ! variable is not finite
or

    if (.not. ieee_is_finite(variable)) then
        ! variable is not finite
    endif

Les

0 Kudos
Reply