<?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 Re: Disabling use of libimf and resolving missing math functions in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533078#M168603</link>
    <description>&lt;P&gt;Link with libimf, and place Debug break points at those functions. Then look at the call stack to see if the issue resides with the code you compile or with a dependent library that you do not compile.&lt;/P&gt;&lt;P&gt;If in your code, you should be able to reconstruct it to not make these calls.&lt;/P&gt;&lt;P&gt;If in 3rd party library, then you may be out of luck...&lt;/P&gt;&lt;P&gt;... unless you write a shell function to convert the SIMD arguments into scalars and call your preferred function (for each lane in the SIMD register(s)), then return the result(s) back into SIMD registers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
    <pubDate>Thu, 12 Oct 2023 13:40:02 GMT</pubDate>
    <dc:creator>jimdempseyatthecove</dc:creator>
    <dc:date>2023-10-12T13:40:02Z</dc:date>
    <item>
      <title>Disabling use of libimf and resolving missing math functions</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1532986#M168601</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I'm currently working on a project to move away from use of the Intel math library (libimf) on a Intel Fortran compiled codebase. The aim is to switch to an open-source math library as this allows us to have (better) results consistency across various CPU manufacturers and OS's.&lt;/P&gt;&lt;P&gt;I'm able to integrate the alternate math library to the Intel Fortran compilation. However, as soon as I disable the linking of libimf through the link option '&lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;no&lt;/SPAN&gt;&lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;intel&lt;/SPAN&gt;&lt;SPAN&gt;-&lt;/SPAN&gt;&lt;SPAN&gt;lib&lt;/SPAN&gt;&lt;SPAN&gt;=libimf', I get a lot of linking errors for undefined math functions.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="bash"&gt;error: undefined reference to '__powr8i4'
error: undefined reference to 'f_pow2i'
error: undefined reference to 'pow2o3'
error: undefined reference to '__powq'
error: undefined reference to '__sqrtq'&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;I presume that the Intel Fortran compiler assumes use of libimf and therefore introduces such optimised math functions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there a way to modify the compilation to avoid pulling in libimf math functions?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Or, can you tell me where I can find the libimf header file so I can reproduce such functions for my project?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Ewan&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 08:55:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1532986#M168601</guid>
      <dc:creator>Towie__Ewan</dc:creator>
      <dc:date>2023-10-12T08:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: Disabling use of libimf and resolving missing math functions</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533078#M168603</link>
      <description>&lt;P&gt;Link with libimf, and place Debug break points at those functions. Then look at the call stack to see if the issue resides with the code you compile or with a dependent library that you do not compile.&lt;/P&gt;&lt;P&gt;If in your code, you should be able to reconstruct it to not make these calls.&lt;/P&gt;&lt;P&gt;If in 3rd party library, then you may be out of luck...&lt;/P&gt;&lt;P&gt;... unless you write a shell function to convert the SIMD arguments into scalars and call your preferred function (for each lane in the SIMD register(s)), then return the result(s) back into SIMD registers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 13:40:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533078#M168603</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2023-10-12T13:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Disabling use of libimf and resolving missing math functions</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533085#M168608</link>
      <description>&lt;P&gt;I've probably not been clear enough in my original post, but I'm not calling any of these functions and it's the compiler itself that is somehow inserting these function calls.&lt;/P&gt;&lt;P&gt;For example, the Fortran code that creates the call to '&lt;SPAN&gt;f_pow2i' is '&lt;/SPAN&gt;&lt;SPAN&gt;IT &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;**&lt;/SPAN&gt;&lt;SPAN&gt;(J&lt;/SPAN&gt;&lt;SPAN&gt;-2&lt;/SPAN&gt;&lt;SPAN&gt;)' where IT and J are integers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Or, the call to&amp;nbsp; 'y&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;x&lt;/SPAN&gt;&lt;SPAN&gt;**&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;2.d0&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;3.d0&lt;/SPAN&gt;&lt;SPAN&gt;)' where x and y are double precision creates a call to 'pow2o3'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;This is all beyond my control, as far as I am aware. I've trawled through the compiler manual, but information on libimf and what it provides in terms of an API is completely neglected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ewan&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 14:10:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533085#M168608</guid>
      <dc:creator>Towie__Ewan</dc:creator>
      <dc:date>2023-10-12T14:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: Disabling use of libimf and resolving missing math functions</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533146#M168613</link>
      <description>&lt;P&gt;Try rewriting your equations so there are no powers, use something like logs.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 16:04:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533146#M168613</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2023-10-12T16:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: Disabling use of libimf and resolving missing math functions</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533206#M168618</link>
      <description>&lt;P&gt;The only way you're going to get there is if, as Jim suggests, you write your own wrappers for these libimf functions. Unfortunately, they are not documented. There is no option to substitute a different set of library calls.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 18:10:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533206#M168618</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2023-10-12T18:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: Disabling use of libimf and resolving missing math functions</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533248#M168621</link>
      <description>&lt;P&gt;This may seem odd, but it may work for the instances of **&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create a generic function, call the interface it my_pow&lt;/P&gt;&lt;P&gt;And supply functions to match the various permutations of arguments:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;integer, integer&lt;/P&gt;&lt;P&gt;real,real&lt;/P&gt;&lt;P&gt;real, integer&lt;/P&gt;&lt;P&gt;double, real&lt;/P&gt;&lt;P&gt;double, double&lt;/P&gt;&lt;P&gt;double, integer&lt;/P&gt;&lt;P&gt;and possibly real,double&lt;/P&gt;&lt;P&gt;then fix all instances of ** to look like&lt;/P&gt;&lt;P&gt;! was&lt;SPAN class=""&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;IT &amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;2&lt;/SPAN&gt;&lt;SPAN class=""&gt;**&lt;/SPAN&gt;&lt;SPAN class=""&gt;(J&lt;/SPAN&gt;&lt;SPAN class=""&gt;-2&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;IT = my_pow(2, (J-2))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should be relatively easy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jim Dempsey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 20:11:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533248#M168621</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2023-10-12T20:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: Disabling use of libimf and resolving missing math functions</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533467#M168623</link>
      <description>&lt;P&gt;I did suspect as much, but I though it was a good question for the community!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Although the other suggestions are pragmatic, my aim here is to provide a solution that avoids modifying the project code. So I'll look to provide some wrapper somewhere that directs the libimf functions back to some 'generic' libm calls.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 13:29:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533467#M168623</guid>
      <dc:creator>Towie__Ewan</dc:creator>
      <dc:date>2023-10-13T13:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Disabling use of libimf and resolving missing math functions</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533505#M168625</link>
      <description>&lt;P&gt;Outline of what you need to do:&lt;/P&gt;&lt;P&gt;Build candidate program (x64 I presume) and set a break point.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimdempseyatthecove_0-1697205379057.png" style="width: 400px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/46752iAF17CB1500FB6717/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="jimdempseyatthecove_0-1697205379057.png" alt="jimdempseyatthecove_0-1697205379057.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Open Dissassembly window:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimdempseyatthecove_1-1697205449422.png" style="width: 400px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/46753iEB02B311F290012D/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="jimdempseyatthecove_1-1697205449422.png" alt="jimdempseyatthecove_1-1697205449422.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In this example (f_pow2i), the arguments are integer (other functions will have different argument types).&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the call, the two arguments are passed in edx (J-1) and ecx (not sure why this is 1 and not 2).&lt;/P&gt;&lt;P&gt;Add an Intel icx Static Library (and make the Fortran Project depend on it).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimdempseyatthecove_3-1697209652924.png" style="width: 400px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/46757iE0909B8B9E048EE0/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="jimdempseyatthecove_3-1697209652924.png" alt="jimdempseyatthecove_3-1697209652924.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;With the breakpoints set as above, you can see the values of the arguments as discussed earlier.&lt;/P&gt;&lt;P&gt;Now that you have the two arguments in hand, you can construct the results as you wish.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note, I did not have to use the&amp;nbsp;&lt;SPAN class=""&gt;ink option '&lt;/SPAN&gt;&lt;SPAN class=""&gt;-&lt;/SPAN&gt;&lt;SPAN class=""&gt;no&lt;/SPAN&gt;&lt;SPAN class=""&gt;-&lt;/SPAN&gt;&lt;SPAN class=""&gt;intel&lt;/SPAN&gt;&lt;SPAN class=""&gt;-&lt;/SPAN&gt;&lt;SPAN class=""&gt;lib&lt;/SPAN&gt;&lt;SPAN class=""&gt;=libimf'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;This should get you going.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Jim Dempsey&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 15:13:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533505#M168625</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2023-10-13T15:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Disabling use of libimf and resolving missing math functions</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533510#M168626</link>
      <description>&lt;P&gt;Thanks Jim for such an in-depth answer!&lt;/P&gt;&lt;P&gt;I've started writing a wrapper in C++ similar to your 'imf.cpp' to direct the libimf calls back to &amp;lt;cmath&amp;gt; standard calls. I'm hoping then, and I need to check, that the open-source math library I then subsequently link will be picked up. The open-source math library already overloads the standard C/C++ libm functions.&lt;/P&gt;&lt;P&gt;What I hadn't banked on was the intrinsic support for quad precision in Fortran, and seemingly in libimf. Here I'm having to direct the math functions to the &amp;lt;quadmath.h&amp;gt; library and hope that there isn't a big difference in code optimisation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 15:21:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533510#M168626</guid>
      <dc:creator>Towie__Ewan</dc:creator>
      <dc:date>2023-10-13T15:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Disabling use of libimf and resolving missing math functions</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533523#M168629</link>
      <description>&lt;P&gt;And pow203 (power of 2 over 3):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimdempseyatthecove_1-1697211526062.png" style="width: 839px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/46763i57CA50A6D9DE82D3/image-dimensions/839x446/is-moderation-mode/true?v=v2&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" width="839" height="446" role="button" title="jimdempseyatthecove_1-1697211526062.png" alt="jimdempseyatthecove_1-1697211526062.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The __asm syntax is strange (I had to look up examples), but once you get one or two functions written, the remainder will be much of the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 15:39:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533523#M168629</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2023-10-13T15:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Disabling use of libimf and resolving missing math functions</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533545#M168630</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;&lt;EM&gt;Here I'm having to direct the math functions to the &amp;lt;quadmath.h&amp;gt; library and hope that there isn't a big difference in code optimisation.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;You may also have quality of returned data.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I would suggest finding a Fortran Source that calculates rational powers. Then compare the results with what you get from quadmath.h&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;From:&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/2882706/how-can-i-write-a-power-function-myself" target="_blank"&gt;https://stackoverflow.com/questions/2882706/how-can-i-write-a-power-function-myself&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There is a C example (for double) that you can adapt to Fortran using quad precision:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;#define MAX_DELTA_DOUBLE 1.0E-15
#define EULERS_NUMBER 2.718281828459045

double MathAbs_Double (double x) {
    return ((x &amp;gt;= 0) ? x : -x);
}

int MathAbs_Int (int x) {
    return ((x &amp;gt;= 0) ? x : -x);
}

double MathPow_Double_Int(double x, int n) {
    double ret;
    if ((x == 1.0) || (n == 1)) {
        ret = x;
    } else if (n &amp;lt; 0) {
        ret = 1.0 / MathPow_Double_Int(x, -n);
    } else {
        ret = 1.0;
        while (n--) {
            ret *= x;
        }
    }
    return (ret);
}

double MathLn_Double(double x) {
    double ret = 0.0, d;
    if (x &amp;gt; 0) {
        int n = 0;
        do {
            int a = 2 * n + 1;
            d = (1.0 / a) * MathPow_Double_Int((x - 1) / (x + 1), a);
            ret += d;
            n++;
        } while (MathAbs_Double(d) &amp;gt; MAX_DELTA_DOUBLE);
    } else {
        printf("\nerror: x &amp;lt; 0 in ln(x)\n");
        exit(-1);
    }
    return (ret * 2);
}

double MathExp_Double(double x) {
    double ret;
    if (x == 1.0) {
        ret = EULERS_NUMBER;
    } else if (x &amp;lt; 0) {
        ret = 1.0 / MathExp_Double(-x);
    } else {
        int n = 2;
        double d;
        ret = 1.0 + x;
        do {
            d = x;
            for (int i = 2; i &amp;lt;= n; i++) {
                d *= x / i;
            }
            ret += d;
            n++;
        } while (d &amp;gt; MAX_DELTA_DOUBLE);
    }
    return (ret);
}

double MathPow_Double_Double(double x, double a) {
    double ret;
    if ((x == 1.0) || (a == 1.0)) {
        ret = x;
    } else if (a &amp;lt; 0) {
        ret = 1.0 / MathPow_Double_Double(x, -a);
    } else {
        ret = MathExp_Double(a * MathLn_Double(x));
    }
    return (ret);
}&lt;/LI-CODE&gt;&lt;P&gt;Jim Dempsey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 16:08:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1533545#M168630</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2023-10-13T16:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: Disabling use of libimf and resolving missing math functions</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1552597#M169889</link>
      <description>&lt;P&gt;I've spent more time on this project recently and made some breakthroughs on how to disable the use of the Intel Math library (libimf).&lt;/P&gt;&lt;P&gt;I've figured that the use of the '-fp-model' compiler argument strongly controls which libimf specific optimised math routines are called. By simply telling ifort to use the '-fp-model strict' it seems to push the compiler to use mostly standard libm/math.h math function calls. (Note that I encountered very odd behaviour with other '-fp-model' parameters and alternative math libraries; it seems that the compiler makes additional assumptions regarding libimf).&lt;/P&gt;&lt;P&gt;There is still a requirement to write a wrapper object to capture any libimf calls that are implicitly included by the Intel compiler. These are mostly a set of power functions that have an integer exponent. The 'standard' libm will usually promote these all to pow&amp;lt;double,double&amp;gt; calls so overloading these with some custom/optimised integer power code is probably for the greater good.&lt;/P&gt;&lt;P&gt;Finally, if linking with the Intel compiler, then use of the '-no-intel-lib=libimf' argument to force it to not auto-link the libimf library is the final stage.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After all this, I've been able to manipulate Intel Fortran compiled code to use an alternative math library of my choice. The final binaries, due to linking Intel Fortran compiler library (libifcore) will still pull in libimf, but this at least is a 3rd-party pull-in and appears after my preferential math library (and hopefully shouldn't interfere with my code).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In short, this is possible but messy and ultimately you still have to provide a copy of libimf somewhere to get it all to work!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2023 11:53:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Disabling-use-of-libimf-and-resolving-missing-math-functions/m-p/1552597#M169889</guid>
      <dc:creator>Towie__Ewan</dc:creator>
      <dc:date>2023-12-11T11:53:42Z</dc:date>
    </item>
  </channel>
</rss>

