<?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: Interesting Problem in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interesting-Problem/m-p/1561653#M170338</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-01-10 143828.png" style="width: 451px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/50189iB159B50BFBBF4E7D/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Screenshot 2024-01-10 143828.png" alt="Screenshot 2024-01-10 143828.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-01-10 145612.png" style="width: 562px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/50190i73BC371223F59295/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Screenshot 2024-01-10 145612.png" alt="Screenshot 2024-01-10 145612.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-01-10 144718.png" style="width: 996px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/50193i41E9EBE8B6AE1E2A/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Screenshot 2024-01-10 144718.png" alt="Screenshot 2024-01-10 144718.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;is only to about E15, certainly if the number is a = 1e16, then the math is a + 1 = a, only if exp is less than 16 is a+ 1 = b where a and b are distinct.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry just bored and waiting for a download.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jan 2024 21:00:18 GMT</pubDate>
    <dc:creator>JohnNichols</dc:creator>
    <dc:date>2024-01-10T21:00:18Z</dc:date>
    <item>
      <title>Interesting Problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interesting-Problem/m-p/1561638#M170337</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;program jellby0
implicit none
double precision znq,zmax,zmin,t3,vz, dum1, dum2,dum3,dum4,dum5
znq  =  1.0D0
zmax =  znq+1.0D0
zmin = -1.00000000000000D99
t3   =  1.00000000000000D0
dum1 = zmax-zmin
dum2 = dum1*t3
dum3 = znq - dum2
dum4 = dum3 - zmin
vz   =  zNQ-(zmax-zmin)*t3-zmin
dum5 = abs(zmin)*0.05D0
write(*,10)"vz               = ",vz, "znq - zmax       = ",(zNQ-zmax),"zmax - zmin      = ",dum1,"dum1*t3          = ",dum2,"znq - dum2       = ",dum3,"theoretically vz = ",dum4
10 Format (6(A,es20.12,/))
write(*,20)"error            = ",dum5
20 Format(6(A,es20.12,/))
! both should be -1 (if calculated with infinite precision arithmetic)
end program&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We do not live in a world of infinite precision, even the universe must have a countable number of atoms for as far as we can see.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the real answer depends on the error in your numbers, introduced by whatever method, so both 1 and 0 both answers, which is more correct is a matter of opinion, in terms of kindergarten math, -1 in terms of real physics, it is a cat in two boxes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the same as the integer problem.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-01-10 143828.png" style="width: 451px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/50186i3308779ED5296D35/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Screenshot 2024-01-10 143828.png" alt="Screenshot 2024-01-10 143828.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Line 8 should signal a flag in the addition operation that the first number is smaller than the error on the second number, just from the programming mathematics.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I meant to add this past the post by&amp;nbsp;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/41971"&gt;@mecej4&lt;/a&gt; in the jelby posts, but I made a mistake, apologies.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is like the thought experiments given in exams in Pure Math 1 at ANU.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 20:44:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interesting-Problem/m-p/1561638#M170337</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2024-01-10T20:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: Interesting Problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interesting-Problem/m-p/1561653#M170338</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-01-10 143828.png" style="width: 451px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/50189iB159B50BFBBF4E7D/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Screenshot 2024-01-10 143828.png" alt="Screenshot 2024-01-10 143828.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-01-10 145612.png" style="width: 562px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/50190i73BC371223F59295/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Screenshot 2024-01-10 145612.png" alt="Screenshot 2024-01-10 145612.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-01-10 144718.png" style="width: 996px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/50193i41E9EBE8B6AE1E2A/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Screenshot 2024-01-10 144718.png" alt="Screenshot 2024-01-10 144718.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;is only to about E15, certainly if the number is a = 1e16, then the math is a + 1 = a, only if exp is less than 16 is a+ 1 = b where a and b are distinct.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry just bored and waiting for a download.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 21:00:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interesting-Problem/m-p/1561653#M170338</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2024-01-10T21:00:18Z</dc:date>
    </item>
  </channel>
</rss>

