<?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:std::isfinite(INFINITY) returns true on Linux in Intel® oneAPI DPC++/C++ Compiler</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1373604#M2016</link>
    <description>&lt;P&gt;Hi Alex,&lt;/P&gt;&lt;P&gt;I escalated this issue to development. I will update it as soon as I get any information.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 01 Apr 2022 13:17:56 GMT</pubDate>
    <dc:creator>DMITRY_T_Intel</dc:creator>
    <dc:date>2022-04-01T13:17:56Z</dc:date>
    <item>
      <title>std::isfinite(INFINITY) returns true on Linux</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1372018#M2001</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm using Intel oneAPI 2022.1.3 from APT on Ubuntu 20.04 LTS x64 English (Linux-based).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I got example code of std::isfinite() from&amp;nbsp;&lt;A href="https://en.cppreference.com/w/cpp/numeric/math/isfinite" target="_self"&gt;cppreference&lt;/A&gt;, compile them with DPC++ 2022.0.0.20211123 and it works incorrectly on Linux: not as C++ standard wants.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Linux build &amp;amp; execution log was attached.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Linux output:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="bash"&gt;isfinite(NaN) = true
isfinite(Inf) = true
isfinite(0.0) = true
isfinite(exp(800)) = true
isfinite(DBL_MIN/2.0) = true
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Windows version of DPC++ generates correct output:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="bash"&gt;isfinite(NaN) = false
isfinite(Inf) = false
isfinite(0.0) = true
isfinite(exp(800)) = false
isfinite(DBL_MIN/2.0) = true
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example code was attached as a test.cpp file in test.zip too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code was compiled with command &lt;EM&gt;&lt;STRONG&gt;dpcpp test.cpp -o test&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I fix that behavior?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With regards,&lt;BR /&gt;Alex&lt;/P&gt;</description>
      <pubDate>Fri, 25 Mar 2022 13:38:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1372018#M2001</guid>
      <dc:creator>AJIOB</dc:creator>
      <dc:date>2022-03-25T13:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: std::isfinite(INFINITY) returns true on Linux</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1372362#M2006</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for reaching out to us.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;&amp;gt;&amp;gt;How can I fix that behavior?&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please try with below command as it worked (as expected) from our end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;dpcpp test.cpp -fp-model=precise -o test&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please find the below screenshot for more details.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NoorjahanSk_Intel_0-1648459214066.png" style="width: 400px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/28033i7435A0B01D1660DB/image-size/medium?v=v2&amp;amp;px=400&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="NoorjahanSk_Intel_0-1648459214066.png" alt="NoorjahanSk_Intel_0-1648459214066.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"-fp-model=precise" disables the optimization for floating-point calculations, so that the result won't be changed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please refer to below link for more details.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/floating-point-options/fp-model-fp.html" target="_blank" rel="noopener"&gt;https://www.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/floating-point-options/fp-model-fp.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; regards,&lt;/P&gt;
&lt;P&gt;Noorjahan.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 09:20:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1372362#M2006</guid>
      <dc:creator>NoorjahanSk_Intel</dc:creator>
      <dc:date>2022-03-28T09:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: std::isfinite(INFINITY) returns true on Linux</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1372374#M2007</link>
      <description>&lt;P&gt;Hi Noorjahan,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, you are right, that flag was helpful for fixing behavior on Linux.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I need to have maximum speed for Linux &amp;amp; Windows with equal &amp;amp; correct behaviour.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What about fixing an optimized version?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With regards,&lt;BR /&gt;Alex&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 10:21:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1372374#M2007</guid>
      <dc:creator>AJIOB</dc:creator>
      <dc:date>2022-03-28T10:21:05Z</dc:date>
    </item>
    <item>
      <title>Re:std::isfinite(INFINITY) returns true on Linux</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1373548#M2015</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;We are working on your issue. We will get back to you soon.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Noorjahan&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Apr 2022 07:38:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1373548#M2015</guid>
      <dc:creator>NoorjahanSk_Intel</dc:creator>
      <dc:date>2022-04-01T07:38:16Z</dc:date>
    </item>
    <item>
      <title>Re:std::isfinite(INFINITY) returns true on Linux</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1373604#M2016</link>
      <description>&lt;P&gt;Hi Alex,&lt;/P&gt;&lt;P&gt;I escalated this issue to development. I will update it as soon as I get any information.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Apr 2022 13:17:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1373604#M2016</guid>
      <dc:creator>DMITRY_T_Intel</dc:creator>
      <dc:date>2022-04-01T13:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: std::isfinite(INFINITY) returns true on Linux</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1373871#M2017</link>
      <description>&lt;P&gt;I advice to test this version [1] as the original has the risk that everything is computed at compile time (try in godbolt for instance)&lt;/P&gt;
&lt;P&gt;with Ofast (aka finite-math) one DOES expect isfinite(NAN) to be true&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with latest gcc I get&lt;/P&gt;
&lt;P&gt;c++ -O3 isfinite.cpp; ./a.out&lt;BR /&gt;isfinite(NaN) = false&lt;BR /&gt;isfinite(Inf) = false&lt;BR /&gt;isfinite(0.0) = true&lt;BR /&gt;isfinite(exp(800)) = false&lt;BR /&gt;isfinite(DBL_MIN/2.0) = true&lt;BR /&gt;x = 0&lt;BR /&gt;isfinite(0.f/x) = false&lt;BR /&gt;isfinite(1.f/x) = false&lt;BR /&gt;isfinite(x) = true&lt;BR /&gt;isfinite(exp(x)) = true&lt;BR /&gt;isfinite(DBL_MIN/x) = false&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;c++ -Ofast isfinite.cpp&lt;BR /&gt;&amp;nbsp;./a.out&lt;/P&gt;
&lt;P&gt;isfinite(NaN) = false&lt;BR /&gt;isfinite(Inf) = false&lt;BR /&gt;isfinite(0.0) = true&lt;BR /&gt;isfinite(exp(800)) = true&lt;BR /&gt;isfinite(DBL_MIN/2.0) = true&lt;BR /&gt;x = 0&lt;BR /&gt;isfinite(0.f/x) = true&lt;BR /&gt;isfinite(1.f/x) = true&lt;BR /&gt;isfinite(x) = true&lt;BR /&gt;isfinite(exp(x)) = true&lt;BR /&gt;isfinite(DBL_MIN/x) = true&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[1]&lt;/P&gt;
&lt;P&gt;#include &amp;lt;iostream&amp;gt;&lt;BR /&gt;#include &amp;lt;cmath&amp;gt;&lt;BR /&gt;#include &amp;lt;cfloat&amp;gt;&lt;/P&gt;
&lt;P&gt;int main(int argc, char**)&lt;BR /&gt;{&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;float x = 1.f -float(argc);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;std::cout &amp;lt;&amp;lt; std::boolalpha&lt;BR /&gt;&amp;lt;&amp;lt; "isfinite(NaN) = " &amp;lt;&amp;lt; std::isfinite(NAN) &amp;lt;&amp;lt; '\n'&lt;BR /&gt;&amp;lt;&amp;lt; "isfinite(Inf) = " &amp;lt;&amp;lt; std::isfinite(INFINITY) &amp;lt;&amp;lt; '\n'&lt;BR /&gt;&amp;lt;&amp;lt; "isfinite(0.0) = " &amp;lt;&amp;lt; std::isfinite(0.0) &amp;lt;&amp;lt; '\n'&lt;BR /&gt;&amp;lt;&amp;lt; "isfinite(exp(800)) = " &amp;lt;&amp;lt; std::isfinite(std::exp(800)) &amp;lt;&amp;lt; '\n'&lt;BR /&gt;&amp;lt;&amp;lt; "isfinite(DBL_MIN/2.0) = " &amp;lt;&amp;lt; std::isfinite(DBL_MIN/2.0) &amp;lt;&amp;lt; '\n';&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;std::cout &amp;lt;&amp;lt; std::boolalpha&lt;BR /&gt;&amp;lt;&amp;lt; "x = " &amp;lt;&amp;lt; x &amp;lt;&amp;lt; '\n'&lt;BR /&gt;&amp;lt;&amp;lt; "isfinite(0.f/x) = " &amp;lt;&amp;lt; std::isfinite(0.f/x) &amp;lt;&amp;lt; '\n'&lt;BR /&gt;&amp;lt;&amp;lt; "isfinite(1.f/x) = " &amp;lt;&amp;lt; std::isfinite(1.f/x) &amp;lt;&amp;lt; '\n'&lt;BR /&gt;&amp;lt;&amp;lt; "isfinite(x) = " &amp;lt;&amp;lt; std::isfinite(0.0) &amp;lt;&amp;lt; '\n'&lt;BR /&gt;&amp;lt;&amp;lt; "isfinite(exp(x)) = " &amp;lt;&amp;lt; std::isfinite(std::exp(x)) &amp;lt;&amp;lt; '\n'&lt;BR /&gt;&amp;lt;&amp;lt; "isfinite(DBL_MIN/x) = " &amp;lt;&amp;lt; std::isfinite(DBL_MIN/x) &amp;lt;&amp;lt; '\n';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2022 12:20:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1373871#M2017</guid>
      <dc:creator>VinInn</dc:creator>
      <dc:date>2022-04-03T12:20:02Z</dc:date>
    </item>
    <item>
      <title>Re:std::isfinite(INFINITY) returns true on Linux</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1374302#M2026</link>
      <description>&lt;P&gt;Hi Alex,&lt;/P&gt;&lt;P&gt;I got reply from developers:&lt;/P&gt;&lt;P&gt;"Use of&amp;nbsp;dpcpp&amp;nbsp;or&amp;nbsp;icpx&amp;nbsp;uses Intel defaults, which includes&amp;nbsp;-fp-model=fast. This behavior is expected."&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Apr 2022 04:54:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1374302#M2026</guid>
      <dc:creator>DMITRY_T_Intel</dc:creator>
      <dc:date>2022-04-05T04:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: std::isfinite(INFINITY) returns true on Linux</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1499280#M3156</link>
      <description>&lt;P&gt;The old compiler, icc, also had&amp;nbsp;&lt;SPAN&gt;-fp-model=fast (or its equivalent) as the default, did it not? And yet isfinite&amp;nbsp;&lt;EM&gt;does&lt;/EM&gt; work on icc even in this mode.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have a program that needs to have isfinite working. It runs about half as fast when I compile it with icx in precise mode as with icc in fast mode. I am eager to switch from icc to icx, but given this performance hit it is not an option for me right now.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Are there any prospects for fixing isfinite in icx in the fast mode?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 21:05:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1499280#M3156</guid>
      <dc:creator>lpsinger</dc:creator>
      <dc:date>2023-06-26T21:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: std::isfinite(INFINITY) returns true on Linux</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1499310#M3157</link>
      <description>&lt;P&gt;...My apologies. This behavior&amp;nbsp;&lt;EM&gt;is&lt;/EM&gt; consistent with the most recent versions of gcc and clang in fast math mode. The solution is to add the compiler option&amp;nbsp;-fno-finite-math-only, which is supported by gcc, clang, and icx.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 21:39:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/std-isfinite-INFINITY-returns-true-on-Linux/m-p/1499310#M3157</guid>
      <dc:creator>lpsinger</dc:creator>
      <dc:date>2023-06-26T21:39:16Z</dc:date>
    </item>
  </channel>
</rss>

