Average Error: 13.6 → 1.0
Time: 19.4s
Precision: 64
Internal Precision: 832
\[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
\[(\left(1 - wj\right) \cdot \left(wj \cdot wj\right) + \left({wj}^{4}\right))_* - \frac{-x}{(\left(e^{wj}\right) \cdot wj + \left(e^{wj}\right))_*}\]

Error

Bits error versus wj

Bits error versus x

Target

Original13.6
Target13.0
Herbie1.0
\[wj - \left(\frac{wj}{wj + 1} - \frac{x}{e^{wj} + wj \cdot e^{wj}}\right)\]

Derivation

  1. Initial program 13.6

    \[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
  2. Using strategy rm
  3. Applied distribute-rgt1-in13.6

    \[\leadsto wj - \frac{wj \cdot e^{wj} - x}{\color{blue}{\left(wj + 1\right) \cdot e^{wj}}}\]
  4. Applied *-un-lft-identity13.6

    \[\leadsto wj - \frac{\color{blue}{1 \cdot \left(wj \cdot e^{wj} - x\right)}}{\left(wj + 1\right) \cdot e^{wj}}\]
  5. Applied times-frac13.6

    \[\leadsto wj - \color{blue}{\frac{1}{wj + 1} \cdot \frac{wj \cdot e^{wj} - x}{e^{wj}}}\]
  6. Simplified13.0

    \[\leadsto wj - \frac{1}{wj + 1} \cdot \color{blue}{\left(wj - \frac{x}{e^{wj}}\right)}\]
  7. Using strategy rm
  8. Applied sub-neg13.0

    \[\leadsto wj - \frac{1}{wj + 1} \cdot \color{blue}{\left(wj + \left(-\frac{x}{e^{wj}}\right)\right)}\]
  9. Applied distribute-lft-in13.0

    \[\leadsto wj - \color{blue}{\left(\frac{1}{wj + 1} \cdot wj + \frac{1}{wj + 1} \cdot \left(-\frac{x}{e^{wj}}\right)\right)}\]
  10. Applied associate--r+6.7

    \[\leadsto \color{blue}{\left(wj - \frac{1}{wj + 1} \cdot wj\right) - \frac{1}{wj + 1} \cdot \left(-\frac{x}{e^{wj}}\right)}\]
  11. Simplified6.7

    \[\leadsto \left(wj - \frac{1}{wj + 1} \cdot wj\right) - \color{blue}{\frac{-x}{(\left(e^{wj}\right) \cdot wj + \left(e^{wj}\right))_*}}\]
  12. Taylor expanded around 0 1.0

    \[\leadsto \color{blue}{\left(\left({wj}^{2} + {wj}^{4}\right) - {wj}^{3}\right)} - \frac{-x}{(\left(e^{wj}\right) \cdot wj + \left(e^{wj}\right))_*}\]
  13. Simplified1.0

    \[\leadsto \color{blue}{(\left(1 - wj\right) \cdot \left(wj \cdot wj\right) + \left({wj}^{4}\right))_*} - \frac{-x}{(\left(e^{wj}\right) \cdot wj + \left(e^{wj}\right))_*}\]
  14. Final simplification1.0

    \[\leadsto (\left(1 - wj\right) \cdot \left(wj \cdot wj\right) + \left({wj}^{4}\right))_* - \frac{-x}{(\left(e^{wj}\right) \cdot wj + \left(e^{wj}\right))_*}\]

Runtime

Time bar (total: 19.4s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes1.01.00.10.90%
herbie shell --seed 2018296 +o rules:numerics
(FPCore (wj x)
  :name "Jmat.Real.lambertw, newton loop step"

  :herbie-target
  (- wj (- (/ wj (+ wj 1)) (/ x (+ (exp wj) (* wj (exp wj))))))

  (- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))