/*
* testmath - uni-REXX program to test the math function package
*
* You must rebuild the uni-REXX interpreter to include the math
* function package. Then run testmath using the new interpreter.
*
* The program 'mathbld' in this directory will regenerate uni-REXX
* and name the new interpreter 'rxxm'.
*
*
* Modification History:
*
* 19 May 94 pjt Initial implementation
* 13 Sep 94 pjt Put in conditional _cbrt execution for HP-UX
*
*/
hpux = 0
answered = 0
'clear'
do while \answered
say ''
say 'Are you running this program under HP-UX? (y or n)'
pull reply
select
when left(reply, 1) = 'Y' then do
hpux = 1
answered = 1
end
when left(reply, 1) = 'N' then answered = 1
otherwise say reply 'invalid - must be "y" or "n"'
end
end
'clear'
say ''
say 'The uni-REXX math function package is distributed on an'
say 'as-is basis. Because NUMERIC DIGITS in uni-REXX is currently'
say 'limited to 10, the system-specific library functions called'
say 'by this math package may not always return exact answers.'
say ''
say 'We hope that this package will be of use for some applications'
say 'but urge you to verify your results the first time you use it'
say 'for a specific application.'
say ''
say 'It is expected that this limitation on the setting of NUMERIC'
say 'DIGITS will be removed in a future release of the product.'
say ''
say ''
numeric digits 10
x = 3.141592654/2 /* 90 degrees in radians */
say ''
say 'Various trigonometric functions:'
say ''
say 'Sine 90 degrees: ' _sin(x)
say 'Cosine 90 degrees: ' _cos(x)
say 'Tangent 90 degrees: ' _tan(x)
say ''
say 'Arc sine 1: ' _asin(1)
say 'Arc cosine 0: ' _acos(0)
say 'Arc tangent 0: ' _atan(0)
say ''
if hpux then say 'Square roots:'
else say 'Square roots and cube roots:'
say ''
say 'Square root of 16: ' _sqrt(16)
if \hpux then
say 'Cube root of 8: ' _cbrt(8)
say ''
say 'Natural logarithm - log 10: ' _log(10)
say ''
say 'Exponential - E**4: ' _exp(4)