Average Error: 38.9 → 0.0
Time: 4.0s
Precision: 64
Internal Precision: 128
\[\log \left(1 + x\right)\]
\[\log_* (1 + x)\]

Error

Bits error versus x

Target

Original38.9
Target0.3
Herbie0.0
\[\begin{array}{l} \mathbf{if}\;1 + x = 1:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \log \left(1 + x\right)}{\left(1 + x\right) - 1}\\ \end{array}\]

Derivation

  1. Initial program 38.9

    \[\log \left(1 + x\right)\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\log_* (1 + x)}\]
  3. Final simplification0.0

    \[\leadsto \log_* (1 + x)\]

Reproduce

herbie shell --seed 2019090 +o rules:numerics
(FPCore (x)
  :name "ln(1 + x)"

  :herbie-target
  (if (== (+ 1 x) 1) x (/ (* x (log (+ 1 x))) (- (+ 1 x) 1)))

  (log (+ 1 x)))