since log1p(x) = Math.log(x+1)
, finding a natural logarithmic algorithm is enough for what you need.
Fast Natural Logarithm in Java
Here I found the following approximation, and not much information about it, except that it is called the “Borchardt algorithm”, and this is from the book “Dead Reconstruction: Computing Without Tools”. The approximation is not very good (some may say very bad ...), it gets worse, the greater the value. But approximation is also a monotonous, slowly increasing function, which is good enough for my use.
open static double log (double x) {return 6 * (x - 1) / (x + 1 + 4 * (Math.sqrt (x))); }
This approximation is 11.7 times faster than Math.log ().
See this site. Also, performance comparison for math libraries in java.
But maybe you need link to C ++ compiled material, detailed here .
source share