Operating System - OpenVMS
1753499 Members
4442 Online
108794 Solutions
New Discussion

Converting string to floating number in DCL

 
MT93
Occasional Contributor

Converting string to floating number in DCL

Hi,

How can I convert this string to a floating number so I can do Mathematical operations? 

"9.8441676E-01"

Thanks!

MT

4 REPLIES 4
David R. Lennon
Valued Contributor

Re: Converting string to floating number in DCL

I don't think you'll have much luck with just DCL. You may want to look into also using this utility that looks like it is written with easy operability with DCL symbols in mind:

http://www.eight-cubed.com/downloads.html#math

MATH

A Bison based infix calculator supporting all the one argument double precision C math functions. The calculator allows you to output local or global DCL symbols, and reads string representations of floating point numbers from DCL symbols on the right hand side.

Steven Schweda
Honored Contributor

Re: Converting string to floating number in DCL

> How can I convert this string to a floating number so I can do
> Mathematical operations?

   DCL provides no floating-point support:

      HELP INTEGER

 What kinds of "Mathematical operations" on what?  As usual, a more
detailed description of the actual problem which you are trying to solve
might be helpful.

   Possibly interesting:

      http://antinode.info/dec/sw/bc.html

But those programs don't support "Exx" notation.

   One could, in principle, use basic string processing to convert
"9.8441676E-01" to "0.98441676", and proceed from there.

Craigers01
Advisor

Re: Converting string to floating number in DCL

We have a calculator executable, "calx" on our VMS 6.2 VAX.

Calx Version 5.0d
Calx is an interactive programmable scientific calculator program useful
for solving typical problems in computer engineering. Calx features
independent input and output radices in binary, octal, decimal, hex, or any
radix of base 2 through 36, as well as ascii characters and convenient "k"
(1024) notation. It allows nesting of parentheses, performs implied
multiplication, and features alternate scientific or engineering notation
outputs. Users may store data in the 10 user-assignable memories or in the
26 user-definable symbols (whose names may be up to six characters long).
Many common calculation parameters can be preset and reset through the use
of an initialization file. For more thorough information about Calx, see
the Calx Users Guide, CALX$LIBRARY:CALX.DOC, which is both a primer and a
reference guide to Calx.

joukj
Occasional Advisor

Re: Converting string to floating number in DCL

Can you give some information from where this calx program can be obtained?