HP3000-L Archives

September 2013, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Donna Hofmeister <[log in to unmask]>
Reply To:
Donna Hofmeister <[log in to unmask]>
Date:
Tue, 10 Sep 2013 08:57:01 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (42 lines)
On Tue, Sep 10, 2013 at 8:33 AM, James B. Byrne <[log in to unmask]>wrote:

>
> That sort of avoids the issue as I would like to calculate a formula
> with containing factors of arbitrary decimal precision and assign the
> integer result to a variable.  Inside the shell I can do this:
>
> shell/iX> x=$(echo "31.1 * 4.7" | bc)
> shell/iX> echo $x
> 146.1
> shell/iX> x=$(echo "31.1 * 4.7 + 2" | bc)
> shell/iX> echo $x
> 148.1
> shell/iX> x=$(echo "31.1 * 4.70 + 2" | bc)
> shell/iX> echo $x
> 148.17
>
> What I would like to do is the same thing albeit at the MPE : prompt
> instead and assign the result to an MPE variable
>

CI numeric variables only handle integers (whole numbers).  If your answer
needs to be expressed with a decimal value (like 148.17 as shown above) you
might be able to do something to express it as a string to the CI (setvar
string_x "!x").

This is really sounding like something that's best handled by another
solution -- like a compiled program or maybe a perl script.

fwiw, the perl bundle that's available from Allegro has the MPE extensions
included.  This means you could do take advantage of perl's 'getoptions' as
well as 'hpcicmds' (if you really need to get your result available at the
CI level...)      - d

-- 
Donna Hofmeister
Allegro Consultants, Inc.
408-252-2330

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2