I am using big-integer for JavaScript.
var bigInt = require('big-integer')
I have a bigInt instance:
var ratherLargeNumber = bigInt(2).pow(2048)
Can I get a (natural) log of it?
I am using big-integer for JavaScript.
var bigInt = require('big-integer')
I have a bigInt instance:
var ratherLargeNumber = bigInt(2).pow(2048)
Can I get a (natural) log of it?
Say you have a big integer x = 5384932048329483948394829348923849
.
If you convert x to a decimal string and count the digits, you can then represent x by 0.5384932048329483948394829348923849
× 1034.
You want to take the natural logarithm of x. Observe the following.
loge(x) = 34
loge(10
) + loge(0.5384932048329483948394829348923849
)
You can now use regular Number
computations and the regular Math.log
to perform the computation.
var bigInt = require('big-integer');
var integer = bigInt('5384932048329483948394829348923849').toString();
var ln_x = Math.log(10 + integer);