<?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 multiplication in a shell script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/multiplication-in-a-shell-script/m-p/5017859#M96835</link>
    <description>How can I devide a real number in a shell script.</description>
    <pubDate>Fri, 08 Dec 2006 15:34:53 GMT</pubDate>
    <dc:creator>Jacques Carriere</dc:creator>
    <dc:date>2006-12-08T15:34:53Z</dc:date>
    <item>
      <title>multiplication in a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/multiplication-in-a-shell-script/m-p/5017859#M96835</link>
      <description>How can I devide a real number in a shell script.</description>
      <pubDate>Fri, 08 Dec 2006 15:34:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/multiplication-in-a-shell-script/m-p/5017859#M96835</guid>
      <dc:creator>Jacques Carriere</dc:creator>
      <dc:date>2006-12-08T15:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: multiplication in a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/multiplication-in-a-shell-script/m-p/5017860#M96836</link>
      <description>Hi Jacques:&lt;BR /&gt;&lt;BR /&gt;Most shells only support integer arithmetic.&lt;BR /&gt;&lt;BR /&gt;# X=100;Y=25;((Z=X/Y));echo $Z&lt;BR /&gt;&lt;BR /&gt;If you want to incorporate real numbers, 'bc' provides a convenient vehicle. Choose the 'scale' to set the precision you want:&lt;BR /&gt;&lt;BR /&gt;# X=1;Y=8;echo "scale=3\n $X/$Y"|bc &lt;BR /&gt;&lt;BR /&gt;You can also leverage 'awk' and couple it with 'printf' to format output, including moving to a different number base:&lt;BR /&gt;&lt;BR /&gt;# X=1;Y=8;echo "$X $Y"|awk '{printf "%.4f\n",$1/$2}' &lt;BR /&gt;&lt;BR /&gt;# X=7;Y=8;echo "$X $Y"|awk '{printf "%4x\n",$1+$2}' &lt;BR /&gt;&lt;BR /&gt;If you use the Korn93 shell, its 'typeset' allows a more direct approach to real numbers:&lt;BR /&gt;&lt;BR /&gt;#!/usr/dt/bin/dtksh&lt;BR /&gt;typeset -F R1&lt;BR /&gt;typeset -F3 R2&lt;BR /&gt;typeset -E R3&lt;BR /&gt;let R1=1/8&lt;BR /&gt;echo $R1&lt;BR /&gt;let R2=1/8&lt;BR /&gt;echo $R2&lt;BR /&gt;let R3=1/8&lt;BR /&gt;echo $R3&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 08 Dec 2006 15:40:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/multiplication-in-a-shell-script/m-p/5017860#M96836</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-12-08T15:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: multiplication in a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/multiplication-in-a-shell-script/m-p/5017861#M96837</link>
      <description>thanks 10 points submitted&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Dec 2006 16:17:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/multiplication-in-a-shell-script/m-p/5017861#M96837</guid>
      <dc:creator>Jacques Carriere</dc:creator>
      <dc:date>2006-12-08T16:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: multiplication in a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/multiplication-in-a-shell-script/m-p/5017862#M96838</link>
      <description>this is what I was looking for THX</description>
      <pubDate>Fri, 08 Dec 2006 16:18:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/multiplication-in-a-shell-script/m-p/5017862#M96838</guid>
      <dc:creator>Jacques Carriere</dc:creator>
      <dc:date>2006-12-08T16:18:05Z</dc:date>
    </item>
  </channel>
</rss>

