<?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: non-integers in a script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/non-integers-in-a-script/m-p/2487188#M799515</link>
    <description>Or maybe awk...&lt;BR /&gt;&lt;BR /&gt;x=10.1&lt;BR /&gt;y=20.2&lt;BR /&gt;awk -vx=$x -vy=$y 'BEGIN {z=x+y; print z;}'&lt;BR /&gt;awk -vx=$x -vy=$y 'BEGIN {z=cos(x)+sin(y); print z;}'&lt;BR /&gt;</description>
    <pubDate>Fri, 26 Jan 2001 21:15:01 GMT</pubDate>
    <dc:creator>Gregory Fruth</dc:creator>
    <dc:date>2001-01-26T21:15:01Z</dc:date>
    <item>
      <title>non-integers in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/non-integers-in-a-script/m-p/2487186#M799513</link>
      <description>Hello all,&lt;BR /&gt;I'm writing a ksh script and one of the commands I run returns non-integers (numbers like 2.5, 3.2, etc).  The problem comes in when I attempt to total the returns.  I was first using x=`expr $x + $y` and that was choking on the fact that $y wasn't an integer.  I then tried ((x=$x+$y)) and though that would produce a result, it just truncated everything after the decimal point.  &lt;BR /&gt;I've dug around a bit and haven't discovered how to work with non-integers.  Any help would be appreciated.  Thanks :)&lt;BR /&gt;Steve</description>
      <pubDate>Fri, 26 Jan 2001 20:29:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/non-integers-in-a-script/m-p/2487186#M799513</guid>
      <dc:creator>Steve Sauve</dc:creator>
      <dc:date>2001-01-26T20:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: non-integers in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/non-integers-in-a-script/m-p/2487187#M799514</link>
      <description>Steve:&lt;BR /&gt;&lt;BR /&gt;You must use 'bc' to do real number arithmetic.&lt;BR /&gt;&lt;BR /&gt;# echo "scale=2\n 10/4" | bc&lt;BR /&gt;&lt;BR /&gt;...returns 2.50&lt;BR /&gt;&lt;BR /&gt;Make sure you provide enough precision in the scale statement.  For instance:&lt;BR /&gt;&lt;BR /&gt;# echo "11/4" | bc &lt;BR /&gt;&lt;BR /&gt;...returns "2", and:&lt;BR /&gt;&lt;BR /&gt;# echo "scale=1\n 11/4" | bc&lt;BR /&gt;&lt;BR /&gt;...returns "2.7", and:&lt;BR /&gt;&lt;BR /&gt;# echo "scale=2\n 11/4" | bc&lt;BR /&gt;&lt;BR /&gt;...returns "2.75"&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 26 Jan 2001 20:39:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/non-integers-in-a-script/m-p/2487187#M799514</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-01-26T20:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: non-integers in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/non-integers-in-a-script/m-p/2487188#M799515</link>
      <description>Or maybe awk...&lt;BR /&gt;&lt;BR /&gt;x=10.1&lt;BR /&gt;y=20.2&lt;BR /&gt;awk -vx=$x -vy=$y 'BEGIN {z=x+y; print z;}'&lt;BR /&gt;awk -vx=$x -vy=$y 'BEGIN {z=cos(x)+sin(y); print z;}'&lt;BR /&gt;</description>
      <pubDate>Fri, 26 Jan 2001 21:15:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/non-integers-in-a-script/m-p/2487188#M799515</guid>
      <dc:creator>Gregory Fruth</dc:creator>
      <dc:date>2001-01-26T21:15:01Z</dc:date>
    </item>
  </channel>
</rss>

