Andy Turner wrote:
Hi,
I've implemented code for calculating a BigDecimal raised to the power of
another BigDecimal and which returns the result rounded to a specified number
of decimal places. It is in the maths package of my Generic library and can be
found via the following URL:
http://www.geog.leeds.ac.uk/people/a.turner/src/andyt/java/generic/
There are no third party dependencies. I have not fully tested the code and
already after I released I found a bug which is only updated in subversion
repository. Anyway in general the methods work and should be generally useful.
I looked for code to do this two years ago and although I expect there are
other implementations, I had no luck finding any and this week I bit the bullet.
I was recently doing something unrelated in Excel and OOCalc.
Someone had pointed out that cube root can (under some circumstances) be a
useful
transform for the x axis when plotting a graph.
It's similar to log(x) for positive x, but has (very!) different behaviour
for x < 1, and (very!) different behaviour for x < 0. In particular
the sign of the cube root is the same as the sign of x.
This applies for all odd numbered roots. Anyway.
I discovered that Excel is quite capable of evaluating power(x, 1/3) for
negative x,
where oocalc isn't.
I assume that oocalc is using the "obvious" but flawed implementation of
power(x, y)
invlog(log(x) * y))
You might want to check your implementation under such data.
BugBear
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]