log1pbeginner// Natural log of (1 + x), precise for small x
Math.log1p(0) // β 0
Math.log1p(0.001) // β 0.0009995...Use Math.log1p(x) instead of Math.log(1+x) for small x to avoid floating-point cancellation errors.
Returns the natural logarithm of 1 + x, i.e. ln(1 + x).
Challenge: Verify that Math.log1p(0) returns 0.