<?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: script that can handle exponentials in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-that-can-handle-exponentials/m-p/4893058#M402722</link>
    <description>Perl natively understands exponential notation and can easily output in the same or in the floating point output format of your choice. Normally Perl does all math in floating-point and you have to tell it explicitly (via "use integer;") to do integer math.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;my $a = 7.00e-5;&lt;BR /&gt;my $b = 2000.0&lt;BR /&gt;my $c = $a * $b;&lt;BR /&gt;printf("Fixed point: %10.2f  Exponential: %e\n",$c,$c);&lt;BR /&gt;</description>
    <pubDate>Mon, 28 Mar 2005 11:34:52 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2005-03-28T11:34:52Z</dc:date>
    <item>
      <title>script that can handle exponentials</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-that-can-handle-exponentials/m-p/4893056#M402720</link>
      <description>any tricks in perl or ksh to take an input value, for example, 7.00E-5, and multiply it by a similar value?&lt;BR /&gt;&lt;BR /&gt;basically i am writing a very simple calculator for some engineers here but have no idea on how to add, subtract, multiply, etc.. values in the format 8.03e-3&lt;BR /&gt;&lt;BR /&gt;in the past i have used "bc" but not sure if there was an elegant way of working with exponents like this</description>
      <pubDate>Mon, 28 Mar 2005 11:19:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-that-can-handle-exponentials/m-p/4893056#M402720</guid>
      <dc:creator>Marc Ahrendt</dc:creator>
      <dc:date>2005-03-28T11:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: script that can handle exponentials</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-that-can-handle-exponentials/m-p/4893057#M402721</link>
      <description>bc is the catch-all executable for all of these kinds of things.  I find it quite elegant, actually.  The korn shell itself has very limited math capability.  Its limited to the "let" statement--denoted with double parens: (( and )).  &lt;BR /&gt;&lt;BR /&gt;I don't do perl, but suspect that it too uses bc.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Mon, 28 Mar 2005 11:24:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-that-can-handle-exponentials/m-p/4893057#M402721</guid>
      <dc:creator>Chris Vail</dc:creator>
      <dc:date>2005-03-28T11:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: script that can handle exponentials</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-that-can-handle-exponentials/m-p/4893058#M402722</link>
      <description>Perl natively understands exponential notation and can easily output in the same or in the floating point output format of your choice. Normally Perl does all math in floating-point and you have to tell it explicitly (via "use integer;") to do integer math.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;my $a = 7.00e-5;&lt;BR /&gt;my $b = 2000.0&lt;BR /&gt;my $c = $a * $b;&lt;BR /&gt;printf("Fixed point: %10.2f  Exponential: %e\n",$c,$c);&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Mar 2005 11:34:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-that-can-handle-exponentials/m-p/4893058#M402722</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-03-28T11:34:52Z</dc:date>
    </item>
    <item>
      <title>Re: script that can handle exponentials</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-that-can-handle-exponentials/m-p/4893059#M402723</link>
      <description>If you want to multiply, say 7.00e-5 with 5.00e2, &lt;BR /&gt;then you do something like this:&lt;BR /&gt;&lt;BR /&gt;----&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;a="7.00*e(-5)"&lt;BR /&gt;b="5.00*e(2)"&lt;BR /&gt;echo "a=($a)*($b)" | bc -l&lt;BR /&gt;----&lt;BR /&gt;&lt;BR /&gt;Basically, you need to take the user input and&lt;BR /&gt;format it to a string like 'a' and 'b' as shown &lt;BR /&gt;above. See bc(1) manpages for all the cool maths &lt;BR /&gt;things you can do.&lt;BR /&gt;&lt;BR /&gt;- Biswajit&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Mar 2005 14:34:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-that-can-handle-exponentials/m-p/4893059#M402723</guid>
      <dc:creator>Biswajit Tripathy</dc:creator>
      <dc:date>2005-03-28T14:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: script that can handle exponentials</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-that-can-handle-exponentials/m-p/4893060#M402724</link>
      <description>Sorry for the typo in my last post. Change the&lt;BR /&gt;script to:&lt;BR /&gt;&lt;BR /&gt;---&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;a="7.00*e(-5)"&lt;BR /&gt;b="5.00*e(2)"&lt;BR /&gt;echo "($a)*($b)" | bc -l&lt;BR /&gt;---&lt;BR /&gt;&lt;BR /&gt;- Biswajit&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Mar 2005 14:37:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-that-can-handle-exponentials/m-p/4893060#M402724</guid>
      <dc:creator>Biswajit Tripathy</dc:creator>
      <dc:date>2005-03-28T14:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: script that can handle exponentials</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-that-can-handle-exponentials/m-p/4893061#M402725</link>
      <description>thx ...the quick feedback was very helpful</description>
      <pubDate>Mon, 28 Mar 2005 16:11:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-that-can-handle-exponentials/m-p/4893061#M402725</guid>
      <dc:creator>Marc Ahrendt</dc:creator>
      <dc:date>2005-03-28T16:11:47Z</dc:date>
    </item>
  </channel>
</rss>

