<?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 real rounding in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/real-rounding/m-p/781967#M28209</link>
    <description>Real numbers can rarely be expressed exactly in binary, so this problem is typical of working with reals.&lt;BR /&gt;&lt;BR /&gt;Is your example typical of what you want to do - always an exact number of steps (in this case 100).&lt;BR /&gt;&lt;BR /&gt;Suggest that you use an integer counter, and calculate &lt;BR /&gt;Beta = Betastart - (I-1)*Betastep&lt;BR /&gt;&lt;BR /&gt;or something silimar.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;David</description>
    <pubDate>Thu, 29 Mar 2012 02:51:47 GMT</pubDate>
    <dc:creator>DavidWhite</dc:creator>
    <dc:date>2012-03-29T02:51:47Z</dc:date>
    <item>
      <title>real rounding</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/real-rounding/m-p/781966#M28208</link>
      <description>We are finding some awkward rounding going on with real numbers&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;For example our program has &lt;BR /&gt;&lt;BR /&gt;real beta&lt;BR /&gt;beta = 1.0&lt;BR /&gt;&lt;BR /&gt;real betastep&lt;BR /&gt;betastep = 0.01&lt;BR /&gt;&lt;BR /&gt;but when you examine with the debugger betastep = 9.9999998E-3, which is not quite the same&lt;BR /&gt;&lt;BR /&gt;unfortuantely this showing up in our results - after a number of loops of&lt;BR /&gt;&lt;BR /&gt;beta = beta - betastep&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;the beta counter drifts off &lt;BR /&gt;&lt;BR /&gt;5.98004 instead of 5.98, 4.63001 instead of 4.63 etc&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I've tried the /fp:strict and /fp:precise and /Qfp_port compiler switches, but they dont seem to change anything&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Is there an easy fix? &lt;BR /&gt;&lt;BR /&gt;Or is it just 'one-of-those' rounding things?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thankx&lt;BR /&gt;&lt;BR /&gt;Jim</description>
      <pubDate>Thu, 29 Mar 2012 01:38:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/real-rounding/m-p/781966#M28208</guid>
      <dc:creator>jim_cox</dc:creator>
      <dc:date>2012-03-29T01:38:48Z</dc:date>
    </item>
    <item>
      <title>real rounding</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/real-rounding/m-p/781967#M28209</link>
      <description>Real numbers can rarely be expressed exactly in binary, so this problem is typical of working with reals.&lt;BR /&gt;&lt;BR /&gt;Is your example typical of what you want to do - always an exact number of steps (in this case 100).&lt;BR /&gt;&lt;BR /&gt;Suggest that you use an integer counter, and calculate &lt;BR /&gt;Beta = Betastart - (I-1)*Betastep&lt;BR /&gt;&lt;BR /&gt;or something silimar.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;David</description>
      <pubDate>Thu, 29 Mar 2012 02:51:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/real-rounding/m-p/781967#M28209</guid>
      <dc:creator>DavidWhite</dc:creator>
      <dc:date>2012-03-29T02:51:47Z</dc:date>
    </item>
    <item>
      <title>real rounding</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/real-rounding/m-p/781968#M28210</link>
      <description>&lt;P&gt;You could delay the drift (at lest I would think so) ifyou use double precission.&lt;BR /&gt;&lt;BR /&gt;real(8) beta = 1.0d&lt;BR /&gt;real(8) betastep=0.01d&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Lars&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2012 09:00:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/real-rounding/m-p/781968#M28210</guid>
      <dc:creator>Lars_Jakobsen</dc:creator>
      <dc:date>2012-03-29T09:00:43Z</dc:date>
    </item>
    <item>
      <title>Real rounding</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/real-rounding/m-p/781969#M28211</link>
      <description>&lt;P&gt;You're dealing with limitations of &lt;STRONG&gt;IEEE 754 Standard&lt;/STRONG&gt;. In case of a single-precision data type ( 24-bit precision) a rounding or inexact&lt;BR /&gt;issues start affecting a precision very quickly. The only solution is touse a double-precision data type ( 53-bit or 64-bitprecisions ) instead.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Sergey&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2012 13:01:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/real-rounding/m-p/781969#M28211</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2012-03-29T13:01:35Z</dc:date>
    </item>
    <item>
      <title>real rounding</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/real-rounding/m-p/781970#M28212</link>
      <description>Depending on what you are looking for, the "easy fix" might resemble;&lt;BR /&gt;&lt;BR /&gt;do i = 1,100&lt;BR /&gt; beta = (100 - i) / 100.&lt;BR /&gt;.....&lt;BR /&gt;&lt;BR /&gt;Not only would this avoid drift, it is a classic vectorizability transformation.&lt;BR /&gt;I think David (in the earlier response) may have meant this.</description>
      <pubDate>Thu, 29 Mar 2012 13:27:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/real-rounding/m-p/781970#M28212</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2012-03-29T13:27:50Z</dc:date>
    </item>
    <item>
      <title>real rounding</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/real-rounding/m-p/781971#M28213</link>
      <description>real beta, betaBase&lt;BR /&gt;betaBase = 1.0&lt;BR /&gt;&lt;BR /&gt;real betaStepMultiplier, betaStepInverse&lt;BR /&gt;betaStepMultiplier = 0.0&lt;BR /&gt;betaStepInverse = 100.0&lt;BR /&gt;&lt;BR /&gt;do I=1,N&lt;BR /&gt; beta = betaBase - (betaStepMultiplier  / betaStepInverse)&lt;BR /&gt; ...&lt;BR /&gt; betaStepMultiplier = betaStepMultiplier + 1.0&lt;BR /&gt;end do&lt;BR /&gt;&lt;BR /&gt;The above will provide better precision, and more importantly, will not accumulate roundoff errors.&lt;BR /&gt;Note, division is relatively fast on current processors.&lt;BR /&gt;&lt;BR /&gt;Jim Dempsey</description>
      <pubDate>Thu, 29 Mar 2012 16:03:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/real-rounding/m-p/781971#M28213</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2012-03-29T16:03:25Z</dc:date>
    </item>
  </channel>
</rss>

