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:
Barry Lake <[log in to unmask]>
Reply To:
Barry Lake <[log in to unmask]>
Date:
Tue, 10 Sep 2013 13:43:19 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (38 lines)
At 4:33 PM -0400 9/10/13, James B. Byrne wrote:
>All I want is to be able to use it from inside a job stream
>such that I can return the integer part of the result to an
>MPR/iX variable.
>
>It strikes me as odd that this is proving to be as difficult as it
>seems.

It was never clear until just now what you wanted. If you're happy
with truncating your arithmetic result, that is, lopping off
everything to the right of the decimal point, including the decimal
point, then here's one way to do it:


  /SYS/PUB $ echo "31.1 * 4.7" | bc
  146.1
  /SYS/PUB $ echo "31.1 * 4.7" | bc | cut -f1 -d.
  146
  /SYS/PUB $ callci setvar result $(echo "31.1 * 4.7" | bc | cut -f1 -d.)
  /SYS/PUB $ callci showvar result
  RESULT = 146
  /SYS/PUB $ exit

  END OF PROGRAM
  : showvar result
  RESULT = 146
  :



-- 
Barry Lake                           mailto:[log in to unmask]
Allegro Consultants, Inc.            http://www.allegro.com
(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