Average Error: 13.7 → 2.1
Time: 17.5s
Precision: 64
Internal Precision: 896
\[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
\[\left({wj}^{2} + x\right) - 2 \cdot \left(wj \cdot x\right)\]

Error

Bits error versus wj

Bits error versus x

Target

Original13.7
Target13.2
Herbie2.1
\[wj - \left(\frac{wj}{wj + 1} - \frac{x}{e^{wj} + wj \cdot e^{wj}}\right)\]

Derivation

  1. Initial program 13.7

    \[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
  2. Taylor expanded around 0 2.1

    \[\leadsto \color{blue}{\left({wj}^{2} + x\right) - 2 \cdot \left(wj \cdot x\right)}\]

Runtime

Time bar (total: 17.5s)Debug logProfile

herbie shell --seed '#(1070355188 2193211668 3977393919 3454156579 3755371326 1656365382)' +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))))))