In <[log in to unmask]>
[log in to unmask] (John C. Vestal) writes:
[note: this answer extends to 70 columns of text, it may wrap funny after a few
responses...]
>
>
> I just tried it, and the only way you can do that is in MPEX. It
>seems MPEX can't count in this case. :-)
>
>In article <[log in to unmask]>, [log in to unmask] (Eero Laurila) wrote:
>
>> Jerry Fochtman ([log in to unmask]) wrote:
>> : I ran across an interesting situation the other day when using the CI to
>> : help perform some simple calculations. Consider the following:
>>
>>
>> : :SETVAR total 216340.17+61300.00+39800.00
>> : :SHOWVAR total
>> : TOTAL = 317440.1562500
>>
>> : I can appreciate that CI wouldn't necessarily know what precision to
>> : display the data. However, if this is rounded to 2 places, it would be
>> : 317440.16 .... when it should be 317440.17...
>>
>> - Wonder whose CI you're using... sure it's not MPE/iX CI since it only
>> deals with integers... no fractions. Or is this some April fools thing
>> six months in advance???
>>
>>
Ok folks, since I helped write this, I think I should shed some light...
In MPEX (yes, it is the VESOFT product that is the "culprit"), type
%HELP CALC
to get:
-------------------------------------------------------------------------------
-
%CALC
Syntax: %CALC expression
Examples: %CALC 123*456+789
56877, $DE2D, %157055, "...-"
<< output in decimal, hexadecimal, octal, and ASCII >>
<< ASCII has unprintable chars replaced by "." >>
%CALC 456.0//5.8
78.620689 << real arithmetic >>
%CALC TODAY+5
93/02/04 << date arithmetic >>
%CALC STR("TESTING"+"ONE"+"TWO"+"THREE",6,12)
NGONETWOTHRE << string manipulation >>
%CALC MPEXNUMSUCCEEDED//(MPEXNUMFAILED+MPEXNUMSUCCEEDED)
0.950000
The %CALC command evaluates an arbitrary expression (see Appendix for details
on expression syntax and the available operators).
The expression can involve integers, strings, logical values, real numbers,
dates, and times; it can also operate on MPEX VARIABLES (see the MPEX Variables
chapter) as well as on constants.
If the expression has an integer result, the result will be displayed in
decimal, hexadecimal, octal, ASCII representation of the 4 bytes, with
"garbage" (i.e. unprintable) characters represented by periods (".").
In addition to displaying the result, %CALC also sets the HPRESULT variable to
the calculated value.
-------------------------------------------------------------------------------
---
Ok, that establishes MPEX calc does a little more than HP's calc, but we have
to
travel to the appendix for information about REAL numbers. A few pages after
%HELP APPENDIX
we see:
-----------------------------------------------------------------------
----------
* REAL NUMBERS. Real numbers (32-bit single-precision, "HPREAL")
are also
supported -- saying
%CALC 1.2 * 3.4
in MPEX will give you the right value (4.08). The range of the
magnitude
of non-zero real values is 9.9999*(10^-75) through
1.000004*(10^76); real
numbers are accurate to 6.9 decimal places. Real constants can be
entered
in fixed-point format (1.234) or in the exponential format known
and loved
by all you FORTRAN programmers (5.6E10).
-----------------------------------------------------------------------
----------
Hope this settles the mystery somewhat
--
Tom Emerson
[log in to unmask] (here)
[log in to unmask] (preferred)
|