I do a lot of financial number crunching, and occasionally need a simple script to compute CAGRs (compound average growth rates).
The CAGR formula requires a fractional exponent to be evaluated, and I was surprised to learn that NetRexx doesn't support fractional exponents, just like its daddy Classic Rexx.
The appeal of NetRexx for me is better portability, performance and the ability to leverage so much in the rich JVM ecosystem. But the lack of a simple fractional exponent operation is a little annoying.
Anybody know why this is, and more importantly, what the most practical workaround?
Anybody know why this is, and more importantly, what the most practical
Arbitrary fractional exponents were not defined for Rexx or NetRexx
because all the arithmetic operators are correctly rounded, and at the time Rexx
and NetRexx were written no algorithm for a correctly rounded power
operator was known. Recently it has been proven it is possible to
correctly round the operation but no upper bound on execution time has been
Hence I'd still say that it's best to use a function which can then
be defined as 'usually correctly rounded' and improve it later
Since you cannot guarantee an exact/precise result in this case you
may as well convert to doubles and use Java's Math.pow
(If the fractional part is only 1 or 2 digits always I think there's
a workaround where you multiply it by (say) 100 to make it an integer, raise to
the integer power and then take the 100th root. Or something like that ...
it's a long time since I looked at this.)