log1p function
Calculates logn 1+x
Implementation
double log1p(double x) {
if (x.isInfinite && !x.isNegative) {
return x;
} else {
final double u = 1 + x;
final double d = u - 1;
if (d == 0) {
return x;
} else {
return math.log(u) * x / d;
}
}
}