<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic It seems the compiler is in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/IFORT-define-for-infinity/m-p/1145936#M138564</link>
    <description>&lt;P&gt;It seems the compiler is complaining about a !DEC$ ATTRIBUTES directive, not the declarations you show. You cut off the error message so we can't know what the problem is.&lt;/P&gt;

&lt;P&gt;Please post a small but complete code sample, not just pieces of the error messages.&lt;/P&gt;

&lt;P&gt;A standard-conforming way of obtaining an Infinity value is:&lt;/P&gt;

&lt;P&gt;IEEE_VALUE (X,IEEE_POSITIVE_INF) ! or IEEE_NEGATIVE_INF&lt;/P&gt;

&lt;P&gt;where X is a value or variable of the real kind you want an Infinity for and you have done a USE IEEE_ARITHMETIC to make the function available. This isn't allowed in a constant expression in Fortran 2008 - it will be in the next standard revision.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Oct 2017 17:54:34 GMT</pubDate>
    <dc:creator>Steve_Lionel</dc:creator>
    <dc:date>2017-10-24T17:54:34Z</dc:date>
    <item>
      <title>IFORT define for infinity</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/IFORT-define-for-infinity/m-p/1145935#M138563</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Is there a proper define for infinity? We get the following compilation errors under IFort v17 on Windows 10:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="compiler-output ng-binding" name="stderr" style="font-size: 14px; font-family: &amp;quot;Courier New&amp;quot;, Consolas, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, monospace; border: 1px inset rgb(204, 204, 204); overflow-x: scroll; max-height: 350px; color: rgb(0, 0, 0);"&gt;C:\Dashboards\EMsoft\EMsoftPublic\Source\EMsoftLib/constants.f90(103): error #7995: DEC$ ATTRIBUTES DLLIMPORT  or DLLEXPORT data may not be equivalenced.   [INFTY]

REAL,public :: infty

---------------^

C:\Dashboards\EMsoft\EMsoftPublic\Source\EMsoftLib/constants.f90(108): error #7995: DEC$ ATTRIBUTES DLLIMPORT  or DLLEXPORT data may not be equivalenced.   [INFTYD]

REAL(kind=dbl),public :: inftyd

-------------------------^

compilation aborted for C:\Dashboards\EMsoft\EMsoftPublic\Source\EMsoftLib\constants.f90 (code 1)&lt;/PRE&gt;

&lt;P&gt;This code compiles find under GFortran v6.2.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks for any help.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 15:45:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/IFORT-define-for-infinity/m-p/1145935#M138563</guid>
      <dc:creator>bluequartz</dc:creator>
      <dc:date>2017-10-24T15:45:54Z</dc:date>
    </item>
    <item>
      <title>It seems the compiler is</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/IFORT-define-for-infinity/m-p/1145936#M138564</link>
      <description>&lt;P&gt;It seems the compiler is complaining about a !DEC$ ATTRIBUTES directive, not the declarations you show. You cut off the error message so we can't know what the problem is.&lt;/P&gt;

&lt;P&gt;Please post a small but complete code sample, not just pieces of the error messages.&lt;/P&gt;

&lt;P&gt;A standard-conforming way of obtaining an Infinity value is:&lt;/P&gt;

&lt;P&gt;IEEE_VALUE (X,IEEE_POSITIVE_INF) ! or IEEE_NEGATIVE_INF&lt;/P&gt;

&lt;P&gt;where X is a value or variable of the real kind you want an Infinity for and you have done a USE IEEE_ARITHMETIC to make the function available. This isn't allowed in a constant expression in Fortran 2008 - it will be in the next standard revision.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 17:54:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/IFORT-define-for-infinity/m-p/1145936#M138564</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2017-10-24T17:54:34Z</dc:date>
    </item>
    <item>
      <title>I think we would need a</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/IFORT-define-for-infinity/m-p/1145937#M138565</link>
      <description>&lt;P&gt;I think we would need a complete working example of your problem, if you don't care to change the code.&lt;/P&gt;

&lt;P&gt;I suppose that use of the Fortran HUGE() and ieee_arithmetic infinity constants would be recommended, as both gfortran and ifort have supported them for years now.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 17:55:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/IFORT-define-for-infinity/m-p/1145937#M138565</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2017-10-24T17:55:17Z</dc:date>
    </item>
    <item>
      <title>Here is the code snippet:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/IFORT-define-for-infinity/m-p/1145938#M138566</link>
      <description>Here is the code snippet:
!----------------------------------------------------------------------------------------
! the rotations.f90 routines need to have access to the value +Infinity
! which is defined here (using the LaTeX name infty)
INTEGER,private :: inf
REAL,public :: infty
EQUIVALENCE (inf,infty) ! stores two variable at the same address
DATA inf/z'7f800000'/ !Hex for +Infinity

INTEGER(kind=8),private :: infd
REAL(kind=dbl),public :: inftyd
EQUIVALENCE (infd,inftyd) ! stores two variable at the same address
DATA infd/z'7FF0000000000000'/ !Hex for +Infinity
!----------------------------------------------------------------------------------------
! solution to Intel fortran compiler not liking the above definitions for infty and inftyd
!!REAL(kind=sgl),public :: infty = HUGE(0.0_sgl)
!!REAL(kind=dbl),public :: inftyd = HUGE(0.0_dbl)
!DEC$ ATTRIBUTES DLLEXPORT :: infty
!DEC$ ATTRIBUTES DLLEXPORT :: inftyd

!----------------------------------------------------------------------------------------

This is some of the explanation that I get from the author of the code:
*********
The comparison tests with the two definitions of infty do not give the same result, it seems; in the old definition, the value of infty is effectively the IEEE INF value, whereas using the HUGE() definition produces just a really large number, but not the IEEE INF. I'm not sure why the intel compiler did like these definitions; maybe we need to review that as well and see if there isn't a way to work with INF on intel...
*********

There are parts of the code that have calculations that result in infinity that we need to compare to actual Infinity. So we are trying to figure out how to rectify the 2 compilers behavior.

We will give
IEEE_VALUE (X,IEEE_POSITIVE_INF) ! or IEEE_NEGATIVE_INF
a try and see what happens.

After some more poking around on Google I see how to use it in a normal code line but is there a way to define a global constant?

I tried 
INTEGER,private :: inf
REAL,public :: infty
!EQUIVALENCE (inf,infty) ! stores two variable at the same address
!DATA inf/z'7f800000'/ !Hex for +Infinity
infty = IEEE_VALUE (infty,IEEE_POSITIVE_INF)

and the compiler does like that, and it make sense because I am now defining something instead of just declaring it.</description>
      <pubDate>Tue, 24 Oct 2017 18:28:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/IFORT-define-for-infinity/m-p/1145938#M138566</guid>
      <dc:creator>bluequartz</dc:creator>
      <dc:date>2017-10-24T18:28:27Z</dc:date>
    </item>
    <item>
      <title>Ok - now you have posted</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/IFORT-define-for-infinity/m-p/1145939#M138567</link>
      <description>&lt;P&gt;Ok - now you have posted enough for us to see the issue. The complaint is:&lt;/P&gt;

&lt;P&gt;DEC$ ATTRIBUTES DLLIMPORT&amp;nbsp; or DLLEXPORT data may not be equivalenced.&lt;/P&gt;

&lt;P&gt;It has nothing to do with "defining infinity"&lt;/P&gt;

&lt;P&gt;This is a restriction of the Intel compiler - what you are doing (DLLEXPORT) is nonstandard and compilers can apply their own rules to it.&lt;/P&gt;

&lt;P&gt;You don't need to use EQUIVALENCE, though. The following works and is even standard (other than the DLLEXPORT):&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;module foo
integer, parameter :: dbl = 8
REAL,public :: infty
DATA infty/z'7f800000'/ !Hex for +Infinity

REAL(kind=dbl),public :: inftyd
DATA inftyd/z'7FF0000000000000'/ !Hex for +Infinity

!DEC$ ATTRIBUTES DLLEXPORT :: infty
!DEC$ ATTRIBUTES DLLEXPORT :: inftyd
end&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2017 19:51:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/IFORT-define-for-infinity/m-p/1145939#M138567</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2017-10-24T19:51:00Z</dc:date>
    </item>
  </channel>
</rss>

