<?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: scripting question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2528165#M868331</link>
    <description>For example :&lt;BR /&gt;&lt;BR /&gt;set type -i x&lt;BR /&gt;x=`echo 100.99 + 200.88 | bc`&lt;BR /&gt;echo $x&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 15 May 2001 17:19:07 GMT</pubDate>
    <dc:creator>Abel Berger</dc:creator>
    <dc:date>2001-05-15T17:19:07Z</dc:date>
    <item>
      <title>scripting question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2528162#M868328</link>
      <description>Group,&lt;BR /&gt;&lt;BR /&gt;Anyway to add two decimal numbers of differing precision in a ksh script?&lt;BR /&gt;&lt;BR /&gt;tx,&lt;BR /&gt;&lt;BR /&gt;C</description>
      <pubDate>Mon, 14 May 2001 18:11:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2528162#M868328</guid>
      <dc:creator>Charles McCary</dc:creator>
      <dc:date>2001-05-14T18:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: scripting question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2528163#M868329</link>
      <description>Hi Charles:&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;echo "1.11 + 3.3"|bc&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 14 May 2001 18:23:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2528163#M868329</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-05-14T18:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: scripting question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2528164#M868330</link>
      <description>For example :&lt;BR /&gt;&lt;BR /&gt;set typ -i x&lt;BR /&gt;x=`echo 100.99 + 200.88 | bc`&lt;BR /&gt;echo $x&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 15 May 2001 17:18:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2528164#M868330</guid>
      <dc:creator>Abel Berger</dc:creator>
      <dc:date>2001-05-15T17:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: scripting question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2528165#M868331</link>
      <description>For example :&lt;BR /&gt;&lt;BR /&gt;set type -i x&lt;BR /&gt;x=`echo 100.99 + 200.88 | bc`&lt;BR /&gt;echo $x&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 15 May 2001 17:19:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2528165#M868331</guid>
      <dc:creator>Abel Berger</dc:creator>
      <dc:date>2001-05-15T17:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: scripting question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2528166#M868332</link>
      <description>Oops,&lt;BR /&gt;set type -i  x&lt;BR /&gt;is nonsense! This sets $1 to "type", $2 to "-i" and $3 to "x"&lt;BR /&gt;&lt;BR /&gt;But a typeset -i x&lt;BR /&gt;would set $x to integer, and this is not usefull here, because the&lt;BR /&gt;result is a float.&lt;BR /&gt;&lt;BR /&gt;So simply use:&lt;BR /&gt;$ x=$(echo "1.11+3.3"|bc); echo "$x"&lt;BR /&gt;4.41&lt;BR /&gt;is ok&lt;BR /&gt;&lt;BR /&gt;By the way, mind the precision in bc:&lt;BR /&gt;$ echo 'scale=6; 10/3' | bc&lt;BR /&gt;3.333333&lt;BR /&gt;$ echo 'scale=3; 10/3' | bc&lt;BR /&gt;3.333&lt;BR /&gt;$ echo '10/3' | bc&lt;BR /&gt;3&lt;BR /&gt;&lt;BR /&gt;Hanno</description>
      <pubDate>Wed, 16 May 2001 11:40:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2528166#M868332</guid>
      <dc:creator>Johannes Falk</dc:creator>
      <dc:date>2001-05-16T11:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: scripting question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2528167#M868333</link>
      <description>Hi Falk,&lt;BR /&gt;&lt;BR /&gt;I MADE THE TEST AND ITS FUNCTIONED.&lt;BR /&gt;I WOULD LIKE THAT YOU MADE TOO.&lt;BR /&gt;THEREFORE WHEN YOU USE BC COMMAND THE &lt;BR /&gt;INTEGER VARIABLE BECOMES FLOATING,&lt;BR /&gt;&lt;BR /&gt;OK.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 17 May 2001 18:36:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2528167#M868333</guid>
      <dc:creator>Abel Berger</dc:creator>
      <dc:date>2001-05-17T18:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: scripting question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2528168#M868334</link>
      <description>Hi Abel,&lt;BR /&gt;&lt;BR /&gt;I didn't understand your last question but I tested this:&lt;BR /&gt;c13:/tmp$ x=$(echo "1.11+3.3"|bc); echo "$x"&lt;BR /&gt;4.41&lt;BR /&gt;c13:/tmp$ typeset -i x&lt;BR /&gt;c13:/tmp$ x=$(echo "1.11+3.3"|bc); echo "$x"&lt;BR /&gt;4&lt;BR /&gt;&lt;BR /&gt;So x remains an int if it is set so,&lt;BR /&gt;and the result becomes truncated.</description>
      <pubDate>Fri, 18 May 2001 08:03:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2528168#M868334</guid>
      <dc:creator>Johannes Falk</dc:creator>
      <dc:date>2001-05-18T08:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: scripting question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2528169#M868335</link>
      <description>Hi Falk,&lt;BR /&gt;&lt;BR /&gt;The problem among my test and your test is&lt;BR /&gt;the ` `. Your test use () and $ therefore the&lt;BR /&gt;results are different. &lt;BR /&gt;Test makes equal mine is above and looks at the result. OK !&lt;BR /&gt;&lt;BR /&gt;Regards...&lt;BR /&gt;Abel Berger&lt;BR /&gt;</description>
      <pubDate>Fri, 18 May 2001 12:22:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-question/m-p/2528169#M868335</guid>
      <dc:creator>Abel Berger</dc:creator>
      <dc:date>2001-05-18T12:22:08Z</dc:date>
    </item>
  </channel>
</rss>

