<?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: Shell script problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4288498#M336451</link>
    <description>Hi Bibith,&lt;BR /&gt;&lt;BR /&gt;If you want to use large numbers you need to use bc as coprocess.&lt;BR /&gt;i.e.:&lt;BR /&gt;a=$(echo "$Z+$Y" |bc)&lt;BR /&gt;or ksh coprecess&lt;BR /&gt;&lt;BR /&gt;bc |&amp;amp;  # start bc as coprocess&lt;BR /&gt;exec 3&amp;gt;&amp;amp;p 4&amp;lt;&amp;amp;p&lt;BR /&gt;echo "$Z+$Y" &amp;gt;&amp;amp;3&lt;BR /&gt;read result &amp;lt;&amp;amp;4&lt;BR /&gt;echo $result&lt;BR /&gt;&lt;BR /&gt;echo ".+$Z" &amp;gt;&amp;amp;3&lt;BR /&gt;read result &amp;lt;&amp;amp;4&lt;BR /&gt;echo $result&lt;BR /&gt;&lt;BR /&gt;echo ".*$Z" &amp;gt;&amp;amp;3&lt;BR /&gt;read result &amp;lt;&amp;amp;4&lt;BR /&gt;echo $result&lt;BR /&gt; exec 3&amp;lt;&amp;amp;- 4&amp;lt;&amp;amp;-  # to exit the coprocess&lt;BR /&gt;&lt;BR /&gt;bc is using unlimited arithmetic.&lt;BR /&gt;if yu want floating points or mathematical functions use "bc -l"&lt;BR /&gt;</description>
    <pubDate>Fri, 17 Oct 2008 07:30:56 GMT</pubDate>
    <dc:creator>Laurent Menase</dc:creator>
    <dc:date>2008-10-17T07:30:56Z</dc:date>
    <item>
      <title>Shell script problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4288496#M336449</link>
      <description>Hi All &lt;BR /&gt;&lt;BR /&gt;can any one tell is their  any limitation in  lengh of numeric value that expr function can operate ?&lt;BR /&gt;&lt;BR /&gt;means ,in shell script if  i have set a value  Y=100000000000( more than 10 digit) and Z =100000000000 ( more than 10 digit).&lt;BR /&gt;and  do "expr $Y + $Z" i should get 200000000000, but i am getting some negative value . If i use 9 digit numbers for Y and Z i will get correct output .&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Please tell me why it is happeing  and how to over come the same &lt;BR /&gt;&lt;BR /&gt;Bibith Dathan&lt;BR /&gt;</description>
      <pubDate>Thu, 16 Oct 2008 15:27:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4288496#M336449</guid>
      <dc:creator>bibith dathan</dc:creator>
      <dc:date>2008-10-16T15:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4288497#M336450</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;The shell is using 32-bit arithmetic and you are seeing an overflow.  See our discussion here:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1273761" target="_blank"&gt;http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1273761&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 16 Oct 2008 15:35:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4288497#M336450</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-10-16T15:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4288498#M336451</link>
      <description>Hi Bibith,&lt;BR /&gt;&lt;BR /&gt;If you want to use large numbers you need to use bc as coprocess.&lt;BR /&gt;i.e.:&lt;BR /&gt;a=$(echo "$Z+$Y" |bc)&lt;BR /&gt;or ksh coprecess&lt;BR /&gt;&lt;BR /&gt;bc |&amp;amp;  # start bc as coprocess&lt;BR /&gt;exec 3&amp;gt;&amp;amp;p 4&amp;lt;&amp;amp;p&lt;BR /&gt;echo "$Z+$Y" &amp;gt;&amp;amp;3&lt;BR /&gt;read result &amp;lt;&amp;amp;4&lt;BR /&gt;echo $result&lt;BR /&gt;&lt;BR /&gt;echo ".+$Z" &amp;gt;&amp;amp;3&lt;BR /&gt;read result &amp;lt;&amp;amp;4&lt;BR /&gt;echo $result&lt;BR /&gt;&lt;BR /&gt;echo ".*$Z" &amp;gt;&amp;amp;3&lt;BR /&gt;read result &amp;lt;&amp;amp;4&lt;BR /&gt;echo $result&lt;BR /&gt; exec 3&amp;lt;&amp;amp;- 4&amp;lt;&amp;amp;-  # to exit the coprocess&lt;BR /&gt;&lt;BR /&gt;bc is using unlimited arithmetic.&lt;BR /&gt;if yu want floating points or mathematical functions use "bc -l"&lt;BR /&gt;</description>
      <pubDate>Fri, 17 Oct 2008 07:30:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-problem/m-p/4288498#M336451</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2008-10-17T07:30:56Z</dc:date>
    </item>
  </channel>
</rss>

