<?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: arithmetic operations problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555500#M702385</link>
    <description>Paul,&lt;BR /&gt;&lt;BR /&gt;Take a look at Knowledge Base Doc. ID 4000099480 .  This explains workarounds to 32 bit integer limitations.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Eric</description>
    <pubDate>Wed, 01 Jun 2005 05:39:16 GMT</pubDate>
    <dc:creator>erics_1</dc:creator>
    <dc:date>2005-06-01T05:39:16Z</dc:date>
    <item>
      <title>arithmetic operations problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555496#M702381</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;This is using POSIX shell.&lt;BR /&gt;&lt;BR /&gt;I.&lt;BR /&gt;&lt;BR /&gt;#((x=1000000000+1));echo $x&lt;BR /&gt;1000000001&lt;BR /&gt;&lt;BR /&gt;II.&lt;BR /&gt;&lt;BR /&gt;#((x=10000000000+1));echo $x&lt;BR /&gt;1410065409&lt;BR /&gt;&lt;BR /&gt;I notice that POSIX is not capable of computing more that 10 digit. Is there a way around this? Any other alternative?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Paul</description>
      <pubDate>Wed, 01 Jun 2005 04:41:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555496#M702381</guid>
      <dc:creator>Paul_481</dc:creator>
      <dc:date>2005-06-01T04:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: arithmetic operations problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555497#M702382</link>
      <description>Hi Paul,&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;((x=500000000+1));((y=500000000));echo $x;echo $y;((z=$y+$x));echo $z&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;&lt;BR /&gt;Eric Antunes</description>
      <pubDate>Wed, 01 Jun 2005 04:58:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555497#M702382</guid>
      <dc:creator>Eric Antunes</dc:creator>
      <dc:date>2005-06-01T04:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: arithmetic operations problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555498#M702383</link>
      <description>Hi Eric,&lt;BR /&gt;&lt;BR /&gt;((x=500000000+1));((y=500000000));echo $x;echo $y;((z=$y+$x));echo $z&lt;BR /&gt;&lt;BR /&gt;From you example the value of x is still less than 10.&lt;BR /&gt;&lt;BR /&gt;What I need is for a way to compute 11 digit integer.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Paul</description>
      <pubDate>Wed, 01 Jun 2005 05:26:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555498#M702383</guid>
      <dc:creator>Paul_481</dc:creator>
      <dc:date>2005-06-01T05:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: arithmetic operations problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555499#M702384</link>
      <description>Arithmetic operations are 32 bit wide.&lt;BR /&gt;&lt;BR /&gt;integers range are: from -2^31 (-2147483648) to +2^31-1 (+2147483647)&lt;BR /&gt;&lt;BR /&gt;Following commands show only low 32-bit are used:&lt;BR /&gt;&lt;BR /&gt;(( x=2147483647)); (( x=x+1 )); echo $x&lt;BR /&gt;-2147483648&lt;BR /&gt;&lt;BR /&gt;I should use "bc" command (or "dc" utility) instead.</description>
      <pubDate>Wed, 01 Jun 2005 05:34:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555499#M702384</guid>
      <dc:creator>CAS_2</dc:creator>
      <dc:date>2005-06-01T05:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: arithmetic operations problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555500#M702385</link>
      <description>Paul,&lt;BR /&gt;&lt;BR /&gt;Take a look at Knowledge Base Doc. ID 4000099480 .  This explains workarounds to 32 bit integer limitations.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Eric</description>
      <pubDate>Wed, 01 Jun 2005 05:39:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555500#M702385</guid>
      <dc:creator>erics_1</dc:creator>
      <dc:date>2005-06-01T05:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: arithmetic operations problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555501#M702386</link>
      <description>Using bc command:&lt;BR /&gt;&lt;BR /&gt;echo 10000000000+1 | bc | read x&lt;BR /&gt;echo $x&lt;BR /&gt;&lt;BR /&gt;Note that the 32-bit arithmetic is also applicable to INTEGER shell variables defined by means of 'typeset -i' (or 'integer' alias). Therefore, the shell variables used to handle this big values HAVE TO BE NON-INTEGER.&lt;BR /&gt;&lt;BR /&gt;The following examples:&lt;BR /&gt;&lt;BR /&gt;typeset -i x&lt;BR /&gt;echo 10000000000+1 | bc | read x&lt;BR /&gt;echo $x&lt;BR /&gt;&lt;BR /&gt;typeset +i x&lt;BR /&gt;echo 10000000000+1 | bc | read x&lt;BR /&gt;echo $x&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;wil print:&lt;BR /&gt;&lt;BR /&gt;1410065409&lt;BR /&gt;10000000001&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Jun 2005 05:44:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555501#M702386</guid>
      <dc:creator>CAS_2</dc:creator>
      <dc:date>2005-06-01T05:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: arithmetic operations problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555502#M702387</link>
      <description>Sorry Paul, I missed one zero...&lt;BR /&gt;&lt;BR /&gt;I also have this 32 bits maximum:&lt;BR /&gt;&lt;BR /&gt;2^0+2^1+...+2^31=2^32-2^0=4294967296-1=4294967295 but since we also need to use negative numbers, our limit is as CAS said...&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;&lt;BR /&gt;Eric Antunes</description>
      <pubDate>Wed, 01 Jun 2005 06:00:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555502#M702387</guid>
      <dc:creator>Eric Antunes</dc:creator>
      <dc:date>2005-06-01T06:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: arithmetic operations problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555503#M702388</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I have problem storing the output of bc into variable. I need to get to correct results and process it further.&lt;BR /&gt;&lt;BR /&gt;cscpcc@idmp005 [/home/cscpcc]&lt;BR /&gt;#print "2124582832+256000000"|bc&lt;BR /&gt;2380582832&lt;BR /&gt;&lt;BR /&gt;cscpcc@idmp005 [/home/cscpcc]&lt;BR /&gt;#print "2124582832+256000000"|bc|read x|echo $x&lt;BR /&gt;-1914384464&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Paul&lt;BR /&gt;</description>
      <pubDate>Fri, 03 Jun 2005 02:35:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555503#M702388</guid>
      <dc:creator>Paul_481</dc:creator>
      <dc:date>2005-06-03T02:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: arithmetic operations problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555504#M702389</link>
      <description>You probably meant&lt;BR /&gt;&lt;BR /&gt;# print "2124582832+256000000"|bc|read x;echo $x&lt;BR /&gt;&lt;BR /&gt;(i.e. lose the last pipe)&lt;BR /&gt;&lt;BR /&gt;Works for me!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 03 Jun 2005 02:47:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555504#M702389</guid>
      <dc:creator>Stephen Keane</dc:creator>
      <dc:date>2005-06-03T02:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: arithmetic operations problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555505#M702390</link>
      <description>(well apart from the 32-bit integer rounding bit!)</description>
      <pubDate>Fri, 03 Jun 2005 02:48:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555505#M702390</guid>
      <dc:creator>Stephen Keane</dc:creator>
      <dc:date>2005-06-03T02:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: arithmetic operations problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555506#M702391</link>
      <description>Hello All,&lt;BR /&gt;&lt;BR /&gt;Well I finally able to make my script work. Actually the script is for disk utilization computation from bdf output. My script is working ok until we upgrade our disk to EVA when we add a couple of Terbytes disk.&lt;BR /&gt;&lt;BR /&gt;Any way, I used "bc" as suggested and it works.&lt;BR /&gt;&lt;BR /&gt;Thanks everyone for the reply.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Paul</description>
      <pubDate>Mon, 06 Jun 2005 08:04:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/arithmetic-operations-problem/m-p/3555506#M702391</guid>
      <dc:creator>Paul_481</dc:creator>
      <dc:date>2005-06-06T08:04:51Z</dc:date>
    </item>
  </channel>
</rss>

