This week's book giveaways are in the Java EE and JavaScript forums. We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line! See this thread and this one for details.

I know how to take a primitive value to a decimal exponent, but how do you do this to a BigInteger too large to be cast to a primitive type? Is there a way to find square or cube roots of a BigInteger? The only other thing I need, but can't find is how to take find the log of a bigInteger value.

If anyone knows if any of these things are possible OR NOT, please reply! Thanks in advance for any help.

BigDecimal and BigInteger do not provide any methods to do roots or "to the power of" operations.

There are no exact root or "to the power of" operations available on primitives, either. There are no root or "to the power of" operations at all on integers. They do exist for "float" and "double", but are approximate. Of course, they couldn't be anything else, because "float" and "double" are always approximate. Even if you set a "double" variable to 9.0, it may not actually be set to exactly nine, and its square-root will not come out as exactly three.

Computers generally implement powers via an approximation (polynomial series, or something like that). Therefore, the "to the power of" operation is perhaps not appropriate for BigDecimal or BigInteger, which only do exact operations.

You should convert your BigDecimal to a "double", use the appropriate Math methods on it, and convert it back, remembering that the result is approximate.

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.

[Peter]: BigDecimal and BigInteger do not provide any methods to do roots or "to the power of" operations.

Sure they do. The methods are confusingly called pow() however, so they're easy to overlook. You can only raise to an integer power, no decimals - so you can't do roots. But pow() is exact; no approximations. I agree with Peter's reasoning about why fractional powers are not supported here. I believe that implementing these would've either been incredibly slow, or much, much less accurate than we get with other BigDecimal operations. People might get a number that looks like it has 50 digits, but only the first ten are accurate. For fractional powers, best to convert both arguments to double and live with the approximation.

It's not quite true that BigInteger and BigDecimal "only do exact operations". If you divide 1.0 by 3.0 using BigDecimal's divide() methods, the answer will be rounded at some point; it has to be. But at least you get to specify how accurate you want it to be, based on how much time and memory you're willing to spend on it.

As suggested, it may perform poorly but if you need to do it (for example if you are coding a math application) then the performance cost can not be avoided (although it can usually be improved depending on how smart your algorithm is).

I would search the internet for one of two things, a copy of this function that someone has all ready written, or a crash course on how to compute decimal exponents of numbers using series and/or bit operations.