Average Error: 24.5 → 0.1
Time: 53.9s
Precision: 64
Internal Precision: 896
\[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
\[\left(x - \left(wj + wj\right) \cdot x\right) + \left(wj \cdot wj\right) \cdot \left(\frac{5}{2} \cdot x + \left(1 - wj\right)\right)\]

Error

Bits error versus wj

Bits error versus x

Target

Original24.5
Target24.5
Herbie0.1
\[wj - \left(\frac{wj}{wj + 1} - \frac{x}{e^{wj} + wj \cdot e^{wj}}\right)\]

Derivation

  1. Initial program 24.5

    \[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
  2. Using strategy rm
  3. Applied div-sub24.5

    \[\leadsto wj - \color{blue}{\left(\frac{wj \cdot e^{wj}}{e^{wj} + wj \cdot e^{wj}} - \frac{x}{e^{wj} + wj \cdot e^{wj}}\right)}\]
  4. Applied simplify24.5

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

    \[\leadsto wj - \left(\frac{wj}{wj + 1} - \color{blue}{\frac{\frac{x}{1 + wj}}{e^{wj}}}\right)\]
  6. Taylor expanded around 0 19.2

    \[\leadsto wj - \left(\color{blue}{\left(\left({wj}^{3} + wj\right) - {wj}^{2}\right)} - \frac{\frac{x}{1 + wj}}{e^{wj}}\right)\]
  7. Applied simplify9.0

    \[\leadsto \color{blue}{\frac{\frac{x}{e^{wj}}}{1 + wj} + \left(wj \cdot wj - {wj}^{3}\right)}\]
  8. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{\left(\left(\frac{5}{2} \cdot \left({wj}^{2} \cdot x\right) + x\right) - 2 \cdot \left(wj \cdot x\right)\right)} + \left(wj \cdot wj - {wj}^{3}\right)\]
  9. Applied simplify0.1

    \[\leadsto \color{blue}{\left(x - \left(wj + wj\right) \cdot x\right) + \left(wj \cdot wj\right) \cdot \left(\frac{5}{2} \cdot x + \left(1 - wj\right)\right)}\]
  10. Removed slow pow expressions.

Runtime

Time bar (total: 53.9s)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(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))))))