<?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: When 201.0 does not equal 201... in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894133#M79172</link>
    <description>&lt;DIV style="margin:0px;"&gt;Steve  we start off with a text string, and then parse it out, and eventually return a real number, and a flag that says whether or not we encountered an error (the starting text string was '201 '). Would an internal read be a better idea? Maybe...I never tried it.&lt;BR /&gt;&lt;BR /&gt;Tim  excellent catch. Ill be sure to fix that one.&lt;BR /&gt;&lt;BR /&gt;Jim  If I test for integer/not integer, then I already have to keep most of my code; so why not use the existing one-line calc that combines the sign, real, decimal, and exponent parts? At least I know what to expect with this thing. I think Ill dig deeper with internal reads and TABs; one of the first things we do when debugging a customers input is to yell at them if they used TABs, because we told them not to.&lt;BR /&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 25 Feb 2009 22:58:01 GMT</pubDate>
    <dc:creator>Nick2</dc:creator>
    <dc:date>2009-02-25T22:58:01Z</dc:date>
    <item>
      <title>When 201.0 does not equal 201...</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894125#M79164</link>
      <description>&lt;P&gt;Story goes something like this...&lt;BR /&gt;&lt;BR /&gt;A part of the code loads and stores all numbers as DOUBLE. It reads the number 201 and stores it as 0x40691FFFFFFFFFFF. Somewhere down the code-path, this needs to get converted to INTEGER, as in J=DUM, where J is an integer, andDUM is the double. Disassembly looks like this...&lt;BR /&gt;&lt;BR /&gt;0000000180006B40 fld qword ptr [DUM (181577670h)] &lt;BR /&gt;0000000180006B46 fstp qword ptr [rbp+0AC60h] &lt;BR /&gt;0000000180006B4C cvttsd2si rax,mmword ptr [rbp+0AC60h] &lt;BR /&gt;0000000180006B55 mov qword ptr [J (181577668h)],rax&lt;/P&gt;
&lt;BR /&gt;Unfortunately, after this is executed, J is now 200, not 201. What a bummer, DUM should have been 0x4069200000000000.&lt;BR /&gt;&lt;BR /&gt;What a bummer, now I get an array indexing error because J is 200 instead of 201.&lt;BR /&gt;&lt;BR /&gt;So how do I make sure that all doubles are, I suppose, converted to "nearest" integer, rather than "truncated" integer? Or is this even something I can forceafter the original 0x40691FFFFFFFFFFF was read in? The compiler version is 11.0.061, should this make a difference.&lt;BR /&gt;&lt;BR /&gt;Or is there a compiler flag that would automatically insert NINT() s instead of INT() s?</description>
      <pubDate>Wed, 25 Feb 2009 18:28:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894125#M79164</guid>
      <dc:creator>Nick2</dc:creator>
      <dc:date>2009-02-25T18:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: When 201.0 does not equal 201...</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894126#M79165</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
You will have to do this in the source - there is no compiler option to change such a fundamental aspect of the language.&lt;BR /&gt;&lt;BR /&gt;However - the number 201 is exactly representable as a double. Is it REALLY 201 you're reading in or something else?&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Feb 2009 19:16:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894126#M79165</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2009-02-25T19:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: When 201.0 does not equal 201...</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894127#M79166</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/219232"&gt;intel@karancevic.com&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;P&gt;Story goes something like this...&lt;BR /&gt;&lt;BR /&gt;A part of the code loads and stores all numbers as DOUBLE. It reads the number 201 and stores it as 0x40691FFFFFFFFFFF. Somewhere down the code-path, this needs to get converted to INTEGER, as in J=DUM, where J is an integer, andDUM is the double. Disassembly looks like this...&lt;BR /&gt;&lt;BR /&gt;0000000180006B40 fld qword ptr [DUM (181577670h)] &lt;BR /&gt;0000000180006B46 fstp qword ptr [rbp+0AC60h] &lt;BR /&gt;0000000180006B4C cvttsd2si rax,mmword ptr [rbp+0AC60h] &lt;BR /&gt;0000000180006B55 mov qword ptr [J (181577668h)],rax&lt;/P&gt;
&lt;BR /&gt;Unfortunately, after this is executed, J is now 200, not 201. What a bummer, DUM should have been 0x4069200000000000.&lt;BR /&gt;&lt;BR /&gt;What a bummer, now I get an array indexing error because J is 200 instead of 201.&lt;BR /&gt;&lt;BR /&gt;So how do I make sure that all doubles are, I suppose, converted to "nearest" integer, rather than "truncated" integer? Or is this even something I can forceafter the original 0x40691FFFFFFFFFFF was read in? The compiler version is 11.0.061, should this make a difference.&lt;BR /&gt;&lt;BR /&gt;Or is there a compiler flag that would automatically insert NINT() s instead of INT() s?&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;&lt;BR /&gt;0x40691FFFFFFFFFFF is not 201.0 it is as close as you can get to 201.&lt;BR /&gt;&lt;BR /&gt;index = dint(rindex + 0.5_8)&lt;BR /&gt;&lt;BR /&gt;where rindex approximates correct index within a few lsb bits in the DP FP format.&lt;BR /&gt;&lt;BR /&gt;When reading an integernumber from a text file, read into an INTEGER, then store into the DP FP variable. Then as long as you do not perform division or combine with a non-int real*8 the internal number will remain exact.&lt;BR /&gt;&lt;BR /&gt;Jim Dempsey</description>
      <pubDate>Wed, 25 Feb 2009 20:34:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894127#M79166</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2009-02-25T20:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: When 201.0 does not equal 201...</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894128#M79167</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/336209"&gt;Steve Lionel (Intel)&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;However - the number 201 is exactly representable as a double. Is it REALLY 201 you're reading in or something else?&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;Of course, the thingjusthappens to be&lt;BR /&gt;&lt;BR /&gt;(2+1/(10.D0**2.0))*(10.D0**2.0)&lt;BR /&gt;&lt;BR /&gt;And the problem magically goes away when I re-write it as&lt;BR /&gt;&lt;BR /&gt;2*(10.D0**2.0)+1*(10.D0**(2.0-2.0))&lt;BR /&gt;&lt;BR /&gt;(The problem is that 10^(-2) expands to an irrational binary number).&lt;BR /&gt;&lt;BR /&gt;Thanks Steve!</description>
      <pubDate>Wed, 25 Feb 2009 20:36:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894128#M79167</guid>
      <dc:creator>Nick2</dc:creator>
      <dc:date>2009-02-25T20:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: When 201.0 does not equal 201...</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894129#M79168</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/99850"&gt;jimdempseyatthecove&lt;/A&gt;&lt;EM&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;
&lt;DIV style="margin:0px;"&gt;When reading an integernumber from a text file, read into an INTEGER, then store into the DP FP variable. Then as long as you do not perform division or combine with a non-int real*8 the internal number will remain exact.&lt;BR /&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;That could work as well...I'll go throughmy code to see how easyit wouldbeto determine ahead of time whether I'm reading an integer or a real. Thanks Jim!</description>
      <pubDate>Wed, 25 Feb 2009 20:41:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894129#M79168</guid>
      <dc:creator>Nick2</dc:creator>
      <dc:date>2009-02-25T20:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: When 201.0 does not equal 201...</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894130#M79169</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/219232"&gt;intel@karancevic.com&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;Of course, the thingjusthappens to be&lt;BR /&gt;&lt;BR /&gt;(2+1/(10.D0**2.0))*(10.D0**2.0)&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
So in fact you are NOT "reading 201." but rather the result of some computation that was not quite 201.?&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Feb 2009 20:47:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894130#M79169</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2009-02-25T20:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: When 201.0 does not equal 201...</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894131#M79170</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/219232"&gt;intel@karancevic.com&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;Of course, the thingjusthappens to be&lt;BR /&gt;&lt;BR /&gt;(2+1/(10.D0**2.0))*(10.D0**2.0)&lt;BR /&gt;&lt;BR /&gt;And the problem magically goes away when I re-write it as&lt;BR /&gt;&lt;BR /&gt;2*(10.D0**2.0)+1*(10.D0**(2.0-2.0))&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
You're still taking chances when you write ** with a default real exponent, if you meant an integer exponent.&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Feb 2009 20:49:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894131#M79170</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2009-02-25T20:49:12Z</dc:date>
    </item>
    <item>
      <title>Re: When 201.0 does not equal 201...</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894132#M79171</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/219232"&gt;intel@karancevic.com&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;That could work as well...I'll go throughmy code to see how easyit wouldbeto determine ahead of time whether I'm reading an integer or a real. Thanks Jim!&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;You might find this better&lt;BR /&gt;&lt;BR /&gt;Read from file into text variable&lt;BR /&gt;Scan text variable for if integer&lt;BR /&gt;When integer, use internal read from text variable into integer variable then convert to REAL variable&lt;BR /&gt;When not integer, use internal read direct into REAL variable&lt;BR /&gt;&lt;BR /&gt;The test for integer has to be smart enough to read 123.00D+03 or -345.00 or 123.00D-1, etc..&lt;BR /&gt;(and maybe even 123.4D+1 as int)&lt;BR /&gt;&lt;BR /&gt;Also the read to text can clean up the text to take care of the case where the input was prepared with a text editor and the text editor inserteg TAB into the file. READ tends to choke on this (and TAB is hard to see when trying to figure out the problem).&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Jim Dempsey&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Feb 2009 20:58:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894132#M79171</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2009-02-25T20:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: When 201.0 does not equal 201...</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894133#M79172</link>
      <description>&lt;DIV style="margin:0px;"&gt;Steve  we start off with a text string, and then parse it out, and eventually return a real number, and a flag that says whether or not we encountered an error (the starting text string was '201 '). Would an internal read be a better idea? Maybe...I never tried it.&lt;BR /&gt;&lt;BR /&gt;Tim  excellent catch. Ill be sure to fix that one.&lt;BR /&gt;&lt;BR /&gt;Jim  If I test for integer/not integer, then I already have to keep most of my code; so why not use the existing one-line calc that combines the sign, real, decimal, and exponent parts? At least I know what to expect with this thing. I think Ill dig deeper with internal reads and TABs; one of the first things we do when debugging a customers input is to yell at them if they used TABs, because we told them not to.&lt;BR /&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 25 Feb 2009 22:58:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894133#M79172</guid>
      <dc:creator>Nick2</dc:creator>
      <dc:date>2009-02-25T22:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: When 201.0 does not equal 201...</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894134#M79173</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
I would recommend a scan through the string for characters you want to consider valid and then an internal read with a Fsomething.0 format.&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Feb 2009 01:38:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894134#M79173</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2009-02-26T01:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: When 201.0 does not equal 201...</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894135#M79174</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/219232"&gt;intel@karancevic.com&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;P&gt;Story goes something like this...&lt;BR /&gt;&lt;BR /&gt;A part of the code loads and stores all numbers as DOUBLE. It reads the number 201 and stores it as 0x40691FFFFFFFFFFF. Somewhere down the code-path, this needs to get converted to INTEGER, as in J=DUM, where J is an integer, andDUM is the double. Disassembly looks like this...&lt;BR /&gt;&lt;BR /&gt;0000000180006B40 fld qword ptr [DUM (181577670h)] &lt;BR /&gt;0000000180006B46 fstp qword ptr [rbp+0AC60h] &lt;BR /&gt;0000000180006B4C cvttsd2si rax,mmword ptr [rbp+0AC60h] &lt;BR /&gt;0000000180006B55 mov qword ptr [J (181577668h)],rax&lt;/P&gt;
&lt;BR /&gt;Unfortunately, after this is executed, J is now 200, not 201. What a bummer, DUM should have been 0x4069200000000000.&lt;BR /&gt;&lt;BR /&gt;What a bummer, now I get an array indexing error because J is 200 instead of 201.&lt;BR /&gt;&lt;BR /&gt;So how do I make sure that all doubles are, I suppose, converted to "nearest" integer, rather than "truncated" integer? Or is this even something I can forceafter the original 0x40691FFFFFFFFFFF was read in? The compiler version is 11.0.061, should this make a difference.&lt;BR /&gt;&lt;BR /&gt;Or is there a compiler flag that would automatically insert NINT() s instead of INT() s?&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;BR /&gt;Hi.&lt;BR /&gt;&lt;BR /&gt;Somehow, conversion from float or double to integer can be done with the functions lrintf &amp;amp; lrint. Unfortunately, these functions are missing in compilers due to controversies over the C99 standard.&lt;BR /&gt;&lt;BR /&gt;An implementation of lrint is given below, the function rounds a FP number to the nearest integer. If two integers are equally near then the even integer is returned. There is no check for overflow. The function can be tried for 32-bit Linux &amp;amp; 32-bit windows -&lt;BR /&gt;&lt;BR /&gt;static inline int lrint (double const x) { //round to nearest integer&lt;BR /&gt;int n;&lt;BR /&gt;&lt;BR /&gt;#if defined (__unix__) || defined (__GNUC__)&lt;BR /&gt; // 32-bit Linux, GNU/AT&amp;amp;T syntax;&lt;BR /&gt; __asm("fldl %l n fistpl %0 " : "=n"(n) : "n"(x) : " "memory");&lt;BR /&gt;else&lt;BR /&gt; // 32-bit windows, Intel/MASM syntax&lt;BR /&gt; __asm fld qword ptr x;&lt;BR /&gt; __asm fistp dword ptr n;&lt;BR /&gt;#endif&lt;BR /&gt;&lt;BR /&gt;return n:}&lt;BR /&gt;-----&lt;BR /&gt;&lt;BR /&gt;The following example shows how to use the lrint function -&lt;BR /&gt;&lt;BR /&gt;double d = 1.6;&lt;BR /&gt;int a, b;&lt;BR /&gt;a = (int) d; // Truncation is slow, value of a will be 1&lt;BR /&gt;b = lrint(d); // Rounding is fast, value of b will be 2&lt;BR /&gt;-----&lt;BR /&gt;&lt;BR /&gt;In 64-bit mode or when SSE2 is enabled, the missing functions can be implemented as follows for 64-bit or when SSE2 instrcutions is enabled -&lt;/P&gt;
&lt;P&gt;#include &lt;EMMINTRIN.H&gt;&lt;/EMMINTRIN.H&gt;&lt;/P&gt;
&lt;P&gt;static inline int lrintf (float const x) {&lt;BR /&gt; return __mm_cvtss_si32 (__mm_load_ss(&amp;amp;x));&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;static inline int lrint (double const x) {&lt;BR /&gt; return __mm_cvtsd_si32(__mm_load_sd(&amp;amp;x));&lt;BR /&gt;}&lt;BR /&gt;-----&lt;BR /&gt;&lt;BR /&gt;Normally, all conversions from FP numbers to integers use truncation towards zero, rather than rounding, and truncation takes much longer cycles than rounding. It is better to improve efficiency by using rounding instead truncation. Above, SSE2 basedis faster.&lt;BR /&gt;&lt;BR /&gt;~BR&lt;/P&gt;</description>
      <pubDate>Sat, 28 Feb 2009 18:38:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894135#M79174</guid>
      <dc:creator>srimks</dc:creator>
      <dc:date>2009-02-28T18:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: When 201.0 does not equal 201...</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894136#M79175</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/219232"&gt;intel@karancevic.com&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;DIV style="margin:0px;"&gt;Steve  we start off with a text string, and then parse it out, and eventually return a real number, and a flag that says whether or not we encountered an error (the starting text string was '201 '). Would an internal read be a better idea? Maybe...I never tried it.&lt;BR /&gt;&lt;BR /&gt;Tim  excellent catch. Ill be sure to fix that one.&lt;BR /&gt;&lt;BR /&gt;Jim  If I test for integer/not integer, then I already have to keep most of my code; so why not use the existing one-line calc that combines the sign, real, decimal, and exponent parts? At least I know what to expect with this thing. I think Ill dig deeper with internal reads and TABs; one of the first things we do when debugging a customers input is to yell at them if they used TABs, because we told them not to.&lt;BR /&gt;&lt;/DIV&gt;
&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;While you may tell the customer not to use tabs, tabs may come in indirectly and out of the customer's control. When data comes out of Excel spreadsheet it may or may not have tabs. Also, the excel FP format may have specifications that are different from Fortran input specifications.&lt;BR /&gt;&lt;BR /&gt; 12345.67D00&lt;BR /&gt;&lt;BR /&gt;May be a problem in Fortran (Fortran wants E regardless if you are reading into REAL*4 or REAL*8).&lt;BR /&gt;&lt;BR /&gt;I am suggesting that as long as you are digging around in that section of code, you might as well fix it now. That is unless you want additional billable hours later.&lt;BR /&gt;&lt;BR /&gt;The other thing you should consider doing is, provided the user data is not still on punched cards, the data is likely to be delimited as opposed to fixed fields. Write your input routine to token-ize the input such that it is not sensitive to field width or separator (comma, tab, space, other??).&lt;BR /&gt;&lt;BR /&gt;Jim&lt;BR /&gt;</description>
      <pubDate>Sat, 28 Feb 2009 21:56:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/When-201-0-does-not-equal-201/m-p/894136#M79175</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2009-02-28T21:56:12Z</dc:date>
    </item>
  </channel>
</rss>

