check for infinity

check for infinity

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

4 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

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

Zitat:

TimP (Intel) schrieb:

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  .

fortran

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

Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen