<?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 Decimal add in ksh in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/decimal-add-in-ksh/m-p/2562878#M919076</link>
    <description>I need a summary this:&lt;BR /&gt;let TOTAL=$(($TOTAL + $CPU))&lt;BR /&gt;&lt;BR /&gt;and then; TOTAL variable return integer result whitout decimal. &lt;BR /&gt;&lt;BR /&gt;any ideas ?</description>
    <pubDate>Tue, 07 Aug 2001 18:20:49 GMT</pubDate>
    <dc:creator>Marcelo De Florio_1</dc:creator>
    <dc:date>2001-08-07T18:20:49Z</dc:date>
    <item>
      <title>Decimal add in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/decimal-add-in-ksh/m-p/2562878#M919076</link>
      <description>I need a summary this:&lt;BR /&gt;let TOTAL=$(($TOTAL + $CPU))&lt;BR /&gt;&lt;BR /&gt;and then; TOTAL variable return integer result whitout decimal. &lt;BR /&gt;&lt;BR /&gt;any ideas ?</description>
      <pubDate>Tue, 07 Aug 2001 18:20:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/decimal-add-in-ksh/m-p/2562878#M919076</guid>
      <dc:creator>Marcelo De Florio_1</dc:creator>
      <dc:date>2001-08-07T18:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: Decimal add in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/decimal-add-in-ksh/m-p/2562879#M919077</link>
      <description>Hi Marcelo:&lt;BR /&gt;&lt;BR /&gt;How about something like this:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;trunc()&lt;BR /&gt;{&lt;BR /&gt;  printf "%.0f\n" $1&lt;BR /&gt;  return 0&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;A=12.56&lt;BR /&gt;B=4.2&lt;BR /&gt;&lt;BR /&gt;echo "A=${A}"&lt;BR /&gt;echo "B=${B}"&lt;BR /&gt;&lt;BR /&gt;A=`trunc ${A}`&lt;BR /&gt;B=`trunc ${B}`&lt;BR /&gt;&lt;BR /&gt;TOT=$((${A} + ${B}))&lt;BR /&gt;echo "TOT = ${TOT}"&lt;BR /&gt;&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;Clay</description>
      <pubDate>Tue, 07 Aug 2001 18:42:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/decimal-add-in-ksh/m-p/2562879#M919077</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-08-07T18:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Decimal add in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/decimal-add-in-ksh/m-p/2562880#M919078</link>
      <description>Hi Marcelo:&lt;BR /&gt;&lt;BR /&gt;One way is:&lt;BR /&gt;&lt;BR /&gt;# TOTAL=17.11&lt;BR /&gt;# CPU=0.37&lt;BR /&gt;&lt;BR /&gt;# TOTAL=`$TOTAL $CPU|awk '{print $1 + $2}'` &lt;BR /&gt;# echo $TOTAL&lt;BR /&gt;&lt;BR /&gt;Another is:&lt;BR /&gt;&lt;BR /&gt;# TOTAL=`echo "scale=2;$TOTAL + $CPU"|bc`&lt;BR /&gt;# echo $TOTAL&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 07 Aug 2001 18:47:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/decimal-add-in-ksh/m-p/2562880#M919078</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-08-07T18:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Decimal add in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/decimal-add-in-ksh/m-p/2562881#M919079</link>
      <description>Clay, I need a view result &lt;BR /&gt;&lt;BR /&gt;A + B=16.76 &lt;BR /&gt;&lt;BR /&gt;How can i view this result?&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;MDF</description>
      <pubDate>Tue, 07 Aug 2001 18:57:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/decimal-add-in-ksh/m-p/2562881#M919079</guid>
      <dc:creator>Marcelo De Florio_1</dc:creator>
      <dc:date>2001-08-07T18:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: Decimal add in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/decimal-add-in-ksh/m-p/2562882#M919080</link>
      <description>Hi (again) Marcelo:&lt;BR /&gt;&lt;BR /&gt;Sorry, in the first example, I forgot the 'echo'.  It should read:&lt;BR /&gt;&lt;BR /&gt;# TOTAL=`echo $TOTAL $CPU|awk '{print $1 + $2}'`&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Aug 2001 19:07:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/decimal-add-in-ksh/m-p/2562882#M919080</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-08-07T19:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Decimal add in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/decimal-add-in-ksh/m-p/2562883#M919081</link>
      <description>Sorry Marcelo, I read your question to mean that you had floating point operands that you wanted to convert to an integer total.&lt;BR /&gt;&lt;BR /&gt;A=12.56&lt;BR /&gt;B=4.67&lt;BR /&gt;&lt;BR /&gt;TOT=`echo "${A} ${B}" | awk '{printf("%.2f\n",$1,$2)}'`&lt;BR /&gt;&lt;BR /&gt;That should do the floating point total rounded to 2 decimal places. You can change the printf format to any desired precision.&lt;BR /&gt;&lt;BR /&gt;Clay&lt;BR /&gt;&lt;BR /&gt;Clay</description>
      <pubDate>Tue, 07 Aug 2001 19:13:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/decimal-add-in-ksh/m-p/2562883#M919081</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-08-07T19:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: Decimal add in ksh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/decimal-add-in-ksh/m-p/2562884#M919082</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;  U can try this&lt;BR /&gt;&lt;BR /&gt;  TOTAL = `echo "$TOTAL + $CPU" | bc -l `&lt;BR /&gt;&lt;BR /&gt;  This should return TOTAL in Decimal&lt;BR /&gt;&lt;BR /&gt;Sundar</description>
      <pubDate>Wed, 08 Aug 2001 14:22:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/decimal-add-in-ksh/m-p/2562884#M919082</guid>
      <dc:creator>Sundar_7</dc:creator>
      <dc:date>2001-08-08T14:22:50Z</dc:date>
    </item>
  </channel>
</rss>

