<?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: BASIC CALCULATION THRU Korn Shell in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/basic-calculation-thru-korn-shell/m-p/3015641#M129485</link>
    <description>I do it his way.&lt;BR /&gt;&lt;BR /&gt;echo "1*2.33"|bc</description>
    <pubDate>Fri, 04 Jul 2003 11:51:00 GMT</pubDate>
    <dc:creator>RAC_1</dc:creator>
    <dc:date>2003-07-04T11:51:00Z</dc:date>
    <item>
      <title>BASIC CALCULATION THRU Korn Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/basic-calculation-thru-korn-shell/m-p/3015636#M129480</link>
      <description>Dear All!!&lt;BR /&gt;&lt;BR /&gt;Need your help to perform simple calculation thru korn shell.&lt;BR /&gt;&lt;BR /&gt;e.g #1&lt;BR /&gt;A=3&lt;BR /&gt;let B=$A*2&lt;BR /&gt;6&lt;BR /&gt;Rem = I got it and correct&lt;BR /&gt;e.g #2&lt;BR /&gt;A=3&lt;BR /&gt;let B=$A*1.33&lt;BR /&gt;3&lt;BR /&gt;Rem = The answer is 3 not 3.99,&lt;BR /&gt;Please assist me on how could I get 3.99&lt;BR /&gt;&lt;BR /&gt;TQVM&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Jul 2003 10:32:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/basic-calculation-thru-korn-shell/m-p/3015636#M129480</guid>
      <dc:creator>KAMARULZAMAN HJ ALI</dc:creator>
      <dc:date>2003-07-04T10:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: BASIC CALCULATION THRU Korn Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/basic-calculation-thru-korn-shell/m-p/3015637#M129481</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I'm afraid that ksh can only provide integer arithmetic - see man ksh.  How about using something like bc or dc?  There are man pages with examples of how to use them.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;&lt;BR /&gt;Darren.</description>
      <pubDate>Fri, 04 Jul 2003 10:41:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/basic-calculation-thru-korn-shell/m-p/3015637#M129481</guid>
      <dc:creator>Darren Prior</dc:creator>
      <dc:date>2003-07-04T10:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: BASIC CALCULATION THRU Korn Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/basic-calculation-thru-korn-shell/m-p/3015638#M129482</link>
      <description>As you said in hte subject line, this is a BASIC calculation, and ksh can only handle integers.</description>
      <pubDate>Fri, 04 Jul 2003 10:43:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/basic-calculation-thru-korn-shell/m-p/3015638#M129482</guid>
      <dc:creator>melvyn burnard</dc:creator>
      <dc:date>2003-07-04T10:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: BASIC CALCULATION THRU Korn Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/basic-calculation-thru-korn-shell/m-p/3015639#M129483</link>
      <description>try&lt;BR /&gt;&lt;BR /&gt;a=1.33&lt;BR /&gt;b=2&lt;BR /&gt;ans=$(echo $a $b | awk '{printf"%4.2f\n",$1*$2}')&lt;BR /&gt;echo $ans&lt;BR /&gt;&lt;BR /&gt;You can format your output with the printf statement, alternatively just use {print $1*$2} &amp;amp; see waht format you get!&lt;BR /&gt;&lt;BR /&gt;Tim</description>
      <pubDate>Fri, 04 Jul 2003 11:16:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/basic-calculation-thru-korn-shell/m-p/3015639#M129483</guid>
      <dc:creator>Tim D Fulford</dc:creator>
      <dc:date>2003-07-04T11:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: BASIC CALCULATION THRU Korn Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/basic-calculation-thru-korn-shell/m-p/3015640#M129484</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You can try awk. awk is capable of handling the calculation you mentioned.</description>
      <pubDate>Fri, 04 Jul 2003 11:32:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/basic-calculation-thru-korn-shell/m-p/3015640#M129484</guid>
      <dc:creator>Dagmar Boelen</dc:creator>
      <dc:date>2003-07-04T11:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: BASIC CALCULATION THRU Korn Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/basic-calculation-thru-korn-shell/m-p/3015641#M129485</link>
      <description>I do it his way.&lt;BR /&gt;&lt;BR /&gt;echo "1*2.33"|bc</description>
      <pubDate>Fri, 04 Jul 2003 11:51:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/basic-calculation-thru-korn-shell/m-p/3015641#M129485</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2003-07-04T11:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: BASIC CALCULATION THRU Korn Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/basic-calculation-thru-korn-shell/m-p/3015642#M129486</link>
      <description>Thanks A LOT for your help. I really apprecited it.&lt;BR /&gt;&lt;BR /&gt;Have a nice day...</description>
      <pubDate>Fri, 04 Jul 2003 12:47:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/basic-calculation-thru-korn-shell/m-p/3015642#M129486</guid>
      <dc:creator>KAMARULZAMAN HJ ALI</dc:creator>
      <dc:date>2003-07-04T12:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: BASIC CALCULATION THRU Korn Shell</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/basic-calculation-thru-korn-shell/m-p/3015643#M129487</link>
      <description>Hi,&lt;BR /&gt;Sorry for this late answere. It is perhaps forgotten that it is possible to do simple "floating point" calculations with integer arithmetic. It was nessecary with old system which have no floating point support at all. Try the following (3* 1.33):&lt;BR /&gt;&lt;BR /&gt;echo $((3*133/100)).$((3*133%100))&lt;BR /&gt;&lt;BR /&gt;% is the "mod" operator, the rest in a integer division.</description>
      <pubDate>Fri, 04 Jul 2003 13:58:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/basic-calculation-thru-korn-shell/m-p/3015643#M129487</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2003-07-04T13:58:05Z</dc:date>
    </item>
  </channel>
</rss>

