Simple high precision calculator
Simon Bowring
pmmail@rpglink.com
Wed, 05 Apr 2000 17:25:14 +0100 (BST)
On Wed, 05 Apr 2000 12:10:32 -0300 (ADT), Trevor Smith wrote:
>BTW, my
>calculator can't process 377^52 (can yours?)
Mine can, it's enclosed (12 lines of rexx)! I have it set
for 64 significant decimal digits, but I upped it to 254
for this calc! (You will probably wish to adjust the SigDigs
variable back down to 32 or 64 or something).
The command line is any valid rexx expression that returns
a result, and you can call any of the rexxutil functions.
It's also useful for testing what a particular rexx function
returns etc
e.g. calc 377**52
calc (34.2323232323232455677*5)/3 + x2d(ABC)/PI
Enjoy
Simon
--------cut-here-------
/* Simple calculator (using rexx)
*/
parse arg expression
/* 64 decimal sig digits gives better than 215 bit integers
*/
SigDigs = 254
/* Set some ASCII symbols etc */
LF=x2c(0a)
CR=x2c(0d)
PI=3.1415926
numeric digits SigDigs+1
numeric form engineering
/* Adjust user's expression to store result in 'Result'
*/
res_expression = "Result = " || expression
/* Adjust expression to load OS/2 standard RexxUtil library */
res_expression = "Call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
; rc = SysLoadFuncs() ; "|| res_expression
interpret res_expression
say expression || " = " || Result
exit Result