Average Error: 18.7 → 0.0
Time: 1.0m
Precision: 64
Internal Precision: 896
\[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\]
\[\frac{x}{\left(1 + wj\right) \cdot e^{wj}} + \left(wj \cdot wj + \left({wj}^{4} - {wj}^{3}\right)\right)\]

Error

Bits error versus wj

Bits error versus x

Target

Original18.7
Target18.7
Herbie0.0
\[wj - \left(\frac{wj}{wj + 1} - \frac{x}{e^{wj} + wj \cdot e^{wj}}\right)\]

Derivation

  1. Initial program 18.7

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

    \[\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 associate--r-13.1

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

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

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

    \[\leadsto \color{blue}{\frac{x}{\left(1 + wj\right) \cdot e^{wj}} + \left(wj \cdot wj + \left({wj}^{4} - {wj}^{3}\right)\right)}\]
  8. Removed slow pow expressions.

Runtime

Time bar (total: 1.0m)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))))))