<?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: Double precision problems in C++ ( aCC compiler) in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/double-precision-problems-in-c-acc-compiler/m-p/3148265#M717982</link>
    <description>Thanks for all inputs.&lt;BR /&gt;&lt;BR /&gt;My special thanks to Anatov, which clarified my understanding about precision limits.&lt;BR /&gt;&lt;BR /&gt;It looks like, I have to look for some other solutions to retain precision ( One solution could be , to use arbitary precision math library)&lt;BR /&gt;&lt;BR /&gt;-Hari</description>
    <pubDate>Mon, 22 Dec 2003 00:47:53 GMT</pubDate>
    <dc:creator>Haribaskar</dc:creator>
    <dc:date>2003-12-22T00:47:53Z</dc:date>
    <item>
      <title>Double precision problems in C++ ( aCC compiler)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/double-precision-problems-in-c-acc-compiler/m-p/3148261#M717978</link>
      <description>I have a C++ program, which needs to account for precision upto 16 digits.&lt;BR /&gt;&lt;BR /&gt;I have aCC compiler (A. 3.33) in HP 11.0( 32 bit)&lt;BR /&gt;I faced the problem with compiler truncating some digits in decimals.&lt;BR /&gt;&lt;BR /&gt;I wrote a sample program. &lt;BR /&gt;&lt;BR /&gt;double d = 123456789.123456789123456789;&lt;BR /&gt;cout &amp;lt;&amp;lt; setprecision(30) &amp;lt;&amp;lt; d;&lt;BR /&gt;&lt;BR /&gt;I got the program output as&lt;BR /&gt;123456789.12345679&lt;BR /&gt;&lt;BR /&gt;I have read in some of the books that a double variable occypying 64 bits , can keep upto a maximum of 19 digits before decimal and 16 digits after the decimal. But, this does not seem to be happening.&lt;BR /&gt;&lt;BR /&gt;Could somebody help me in solving this problem.?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Dec 2003 09:20:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/double-precision-problems-in-c-acc-compiler/m-p/3148261#M717978</guid>
      <dc:creator>Haribaskar</dc:creator>
      <dc:date>2003-12-18T09:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Double precision problems in C++ ( aCC compiler)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/double-precision-problems-in-c-acc-compiler/m-p/3148262#M717979</link>
      <description>i've tried the same in gcc... and the output was: 123456789.123456791&lt;BR /&gt;Seems like you reach some limits..&lt;BR /&gt;&lt;BR /&gt;-Tomek</description>
      <pubDate>Thu, 18 Dec 2003 09:30:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/double-precision-problems-in-c-acc-compiler/m-p/3148262#M717979</guid>
      <dc:creator>Tomek Gryszkiewicz</dc:creator>
      <dc:date>2003-12-18T09:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Double precision problems in C++ ( aCC compiler)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/double-precision-problems-in-c-acc-compiler/m-p/3148263#M717980</link>
      <description>Hello:&lt;BR /&gt;&lt;BR /&gt;I think IEEE-754 is the standard for floating point, and you get 14 significant figures with double precision and 28 with long double.  Below is an example of 28 sig. figures:&lt;BR /&gt;&lt;BR /&gt;H:src:357$ cat test.C&lt;BR /&gt;#include &lt;IOSTREAM&gt;&lt;BR /&gt;#include &lt;IOMANIP&gt;&lt;BR /&gt;&lt;BR /&gt;using namespace std;&lt;BR /&gt;&lt;BR /&gt;int main(int argc, char *argv[])&lt;BR /&gt;{&lt;BR /&gt;    long double ld = 0.9999999999999999999999999999l;&lt;BR /&gt;    &lt;BR /&gt;&lt;BR /&gt;    cout &amp;lt;&amp;lt; setprecision(28) &amp;lt;&amp;lt; 0.9999999999999999999999999999l &amp;lt;&amp;lt; ' '&lt;BR /&gt;         &amp;lt;&amp;lt; ld &amp;lt;&amp;lt; endl;&lt;BR /&gt;&lt;BR /&gt;    return 0;&lt;BR /&gt;}&lt;BR /&gt;    &lt;BR /&gt;H:src:358$ aCC +DA2.0W -AA test.C&lt;BR /&gt;H:src:359$ ./a.out&lt;BR /&gt;0.9999999999999999999999999999 0.9999999999999999999999999999&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;   Dave&lt;/IOMANIP&gt;&lt;/IOSTREAM&gt;</description>
      <pubDate>Fri, 19 Dec 2003 11:02:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/double-precision-problems-in-c-acc-compiler/m-p/3148263#M717980</guid>
      <dc:creator>David Johns</dc:creator>
      <dc:date>2003-12-19T11:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: Double precision problems in C++ ( aCC compiler)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/double-precision-problems-in-c-acc-compiler/m-p/3148264#M717981</link>
      <description>Hi Haribaskar,&lt;BR /&gt;IEEE standard has 3 types of floating point:&lt;BR /&gt;1) single precision figured on 32 bit&lt;BR /&gt;2) double precision figured on 64 bit&lt;BR /&gt;2) long double precision figured on 80 bit.&lt;BR /&gt;Notice IEEE doesn't refer to language but to CPU rappresentation.&lt;BR /&gt;The FP number has 2 section: the exponent and mantissa. Now I don't remember the the # of bits for every precision but I'm sure of limit:&lt;BR /&gt;1) single precision +/- 1.6 E30: you have 6 digits 1/2 of precision (for example 199999);&lt;BR /&gt;2) double precision +/- 1.9 E300: you have 18 digits 1/2 of precision (for example 1123456789012345678).&lt;BR /&gt;This means you can see any number of double precision with 18 digit plus digit 1 as most significative digit; also FP doesn't different digit before or after decimal point; so you can see 1.123456789012345678 or 11234567890.12345678 or 1123456789012345678 etc.&lt;BR /&gt;Also note you can't see follow 2123456789012345678 because 1st digit before 18 digits may be only 0 or 1.&lt;BR /&gt;IEEE can figure also NaN (invalid value) and infinite with double and long double precision; thees value are not avaiable in single precision.&lt;BR /&gt;At least, IEEE required compiler use long double in computate and result must be coonvert in less precision; this means avery compiler could convert any variable to long double, compute the result and reconvert to original precision.&lt;BR /&gt; &lt;BR /&gt;H.T.H.&lt;BR /&gt;Antoniov&lt;BR /&gt;</description>
      <pubDate>Sun, 21 Dec 2003 03:19:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/double-precision-problems-in-c-acc-compiler/m-p/3148264#M717981</guid>
      <dc:creator>Antoniov.</dc:creator>
      <dc:date>2003-12-21T03:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: Double precision problems in C++ ( aCC compiler)</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/double-precision-problems-in-c-acc-compiler/m-p/3148265#M717982</link>
      <description>Thanks for all inputs.&lt;BR /&gt;&lt;BR /&gt;My special thanks to Anatov, which clarified my understanding about precision limits.&lt;BR /&gt;&lt;BR /&gt;It looks like, I have to look for some other solutions to retain precision ( One solution could be , to use arbitary precision math library)&lt;BR /&gt;&lt;BR /&gt;-Hari</description>
      <pubDate>Mon, 22 Dec 2003 00:47:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/double-precision-problems-in-c-acc-compiler/m-p/3148265#M717982</guid>
      <dc:creator>Haribaskar</dc:creator>
      <dc:date>2003-12-22T00:47:53Z</dc:date>
    </item>
  </channel>
</rss>

