Logarithms in Java BigInteger

Arne Vajhøj

Usenet Archive
Joined
Nov 17, 2007
Messages
1,826
Reaction score
0
Christian said:
ah I see I was confused just thought you wanted to change the base so it could be calculated by an easier to create base 10 log.

But wouldn't it then be ?
return ln(v.divide(TWO)).add(LNTWO);
You wanted to calculate it recursively right?

Yes.

You are absolutely correct.

Arne
 
Joined
Nov 29, 2025
Messages
1
Reaction score
0
Given zBD=BigDecimal(10).pow(1000), 10^1000 the log10 of zBD (integer) for any length zBD can be created with limited mantissa precision via zstr=char(zBD.toString()); Length_zBD=length(zstr);
Log10_z=Length_zBD+log10(str2num(['.' zstr]))
For numbers with decimals the length is digits to the decimal point and then final calculation needs the decimal removed from zstr.
The precision is based on precision for double.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,049
Messages
3,104,245
Members
248,133
Latest member
DujonT

Latest Threads

Top