?

Average Error: 14.2 → 0.6
Time: 17.8s
Precision: binary64
Cost: 19972

?

\[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}} \]
\[\begin{array}{l} \mathbf{if}\;wj \leq 3.7 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(wj, wj, \mathsf{fma}\left(-2, wj \cdot x, x\right)\right) - {wj}^{3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-2 - wj\right) \cdot \left(\left(\frac{x}{e^{wj}} - wj\right) + wj \cdot \left(wj + 1\right)\right)}{\left(wj + 2\right) \cdot \left(-1 - wj\right)}\\ \end{array} \]
(FPCore (wj x)
 :precision binary64
 (- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))
(FPCore (wj x)
 :precision binary64
 (if (<= wj 3.7e-7)
   (- (fma wj wj (fma -2.0 (* wj x) x)) (pow wj 3.0))
   (/
    (* (- -2.0 wj) (+ (- (/ x (exp wj)) wj) (* wj (+ wj 1.0))))
    (* (+ wj 2.0) (- -1.0 wj)))))
double code(double wj, double x) {
	return wj - (((wj * exp(wj)) - x) / (exp(wj) + (wj * exp(wj))));
}
double code(double wj, double x) {
	double tmp;
	if (wj <= 3.7e-7) {
		tmp = fma(wj, wj, fma(-2.0, (wj * x), x)) - pow(wj, 3.0);
	} else {
		tmp = ((-2.0 - wj) * (((x / exp(wj)) - wj) + (wj * (wj + 1.0)))) / ((wj + 2.0) * (-1.0 - wj));
	}
	return tmp;
}
function code(wj, x)
	return Float64(wj - Float64(Float64(Float64(wj * exp(wj)) - x) / Float64(exp(wj) + Float64(wj * exp(wj)))))
end
function code(wj, x)
	tmp = 0.0
	if (wj <= 3.7e-7)
		tmp = Float64(fma(wj, wj, fma(-2.0, Float64(wj * x), x)) - (wj ^ 3.0));
	else
		tmp = Float64(Float64(Float64(-2.0 - wj) * Float64(Float64(Float64(x / exp(wj)) - wj) + Float64(wj * Float64(wj + 1.0)))) / Float64(Float64(wj + 2.0) * Float64(-1.0 - wj)));
	end
	return tmp
end
code[wj_, x_] := N[(wj - N[(N[(N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[wj_, x_] := If[LessEqual[wj, 3.7e-7], N[(N[(wj * wj + N[(-2.0 * N[(wj * x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] - N[Power[wj, 3.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[(-2.0 - wj), $MachinePrecision] * N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] + N[(wj * N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(wj + 2.0), $MachinePrecision] * N[(-1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}
\begin{array}{l}
\mathbf{if}\;wj \leq 3.7 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(wj, wj, \mathsf{fma}\left(-2, wj \cdot x, x\right)\right) - {wj}^{3}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(-2 - wj\right) \cdot \left(\left(\frac{x}{e^{wj}} - wj\right) + wj \cdot \left(wj + 1\right)\right)}{\left(wj + 2\right) \cdot \left(-1 - wj\right)}\\


\end{array}

Error?

Target

Original14.2
Target13.5
Herbie0.6
\[wj - \left(\frac{wj}{wj + 1} - \frac{x}{e^{wj} + wj \cdot e^{wj}}\right) \]

Derivation?

  1. Split input into 2 regimes
  2. if wj < 3.70000000000000004e-7

    1. Initial program 13.8

      \[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}} \]
    2. Simplified13.8

      \[\leadsto \color{blue}{wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}} \]
      Proof

      [Start]13.8

      \[ wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}} \]

      sub-neg [=>]13.8

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

      neg-mul-1 [=>]13.8

      \[ wj + \color{blue}{-1 \cdot \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}} \]

      *-commutative [=>]13.8

      \[ wj + \color{blue}{\frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}} \cdot -1} \]

      *-commutative [<=]13.8

      \[ wj + \color{blue}{-1 \cdot \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}} \]

      neg-mul-1 [<=]13.8

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

      neg-sub0 [=>]13.8

      \[ wj + \color{blue}{\left(0 - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\right)} \]

      div-sub [=>]13.8

      \[ wj + \left(0 - \color{blue}{\left(\frac{wj \cdot e^{wj}}{e^{wj} + wj \cdot e^{wj}} - \frac{x}{e^{wj} + wj \cdot e^{wj}}\right)}\right) \]

      associate--r- [=>]13.8

      \[ wj + \color{blue}{\left(\left(0 - \frac{wj \cdot e^{wj}}{e^{wj} + wj \cdot e^{wj}}\right) + \frac{x}{e^{wj} + wj \cdot e^{wj}}\right)} \]

      +-commutative [=>]13.8

      \[ wj + \color{blue}{\left(\frac{x}{e^{wj} + wj \cdot e^{wj}} + \left(0 - \frac{wj \cdot e^{wj}}{e^{wj} + wj \cdot e^{wj}}\right)\right)} \]

      sub0-neg [=>]13.8

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

      sub-neg [<=]13.8

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

      \[\leadsto \color{blue}{-1 \cdot \left(\left(0.6666666666666666 \cdot x + \left(-3 \cdot x + \left(1 + -2 \cdot \left(-4 \cdot x + 1.5 \cdot x\right)\right)\right)\right) \cdot {wj}^{3}\right) + \left(\left(1 - \left(-4 \cdot x + 1.5 \cdot x\right)\right) \cdot {wj}^{2} + \left(-2 \cdot \left(wj \cdot x\right) + x\right)\right)} \]
    4. Taylor expanded in x around 0 0.7

      \[\leadsto -1 \cdot \left(\left(0.6666666666666666 \cdot x + \left(-3 \cdot x + \left(1 + -2 \cdot \left(-4 \cdot x + 1.5 \cdot x\right)\right)\right)\right) \cdot {wj}^{3}\right) + \left(\color{blue}{{wj}^{2}} + \left(-2 \cdot \left(wj \cdot x\right) + x\right)\right) \]
    5. Simplified0.7

      \[\leadsto -1 \cdot \left(\left(0.6666666666666666 \cdot x + \left(-3 \cdot x + \left(1 + -2 \cdot \left(-4 \cdot x + 1.5 \cdot x\right)\right)\right)\right) \cdot {wj}^{3}\right) + \left(\color{blue}{wj \cdot wj} + \left(-2 \cdot \left(wj \cdot x\right) + x\right)\right) \]
      Proof

      [Start]0.7

      \[ -1 \cdot \left(\left(0.6666666666666666 \cdot x + \left(-3 \cdot x + \left(1 + -2 \cdot \left(-4 \cdot x + 1.5 \cdot x\right)\right)\right)\right) \cdot {wj}^{3}\right) + \left({wj}^{2} + \left(-2 \cdot \left(wj \cdot x\right) + x\right)\right) \]

      unpow2 [=>]0.7

      \[ -1 \cdot \left(\left(0.6666666666666666 \cdot x + \left(-3 \cdot x + \left(1 + -2 \cdot \left(-4 \cdot x + 1.5 \cdot x\right)\right)\right)\right) \cdot {wj}^{3}\right) + \left(\color{blue}{wj \cdot wj} + \left(-2 \cdot \left(wj \cdot x\right) + x\right)\right) \]
    6. Taylor expanded in x around 0 0.6

      \[\leadsto -1 \cdot \color{blue}{{wj}^{3}} + \left(wj \cdot wj + \left(-2 \cdot \left(wj \cdot x\right) + x\right)\right) \]
    7. Taylor expanded in wj around 0 0.6

      \[\leadsto -1 \cdot {wj}^{3} + \color{blue}{\left({wj}^{2} + \left(-2 \cdot \left(wj \cdot x\right) + x\right)\right)} \]
    8. Simplified0.6

      \[\leadsto -1 \cdot {wj}^{3} + \color{blue}{\mathsf{fma}\left(wj, wj, \mathsf{fma}\left(-2, x \cdot wj, x\right)\right)} \]
      Proof

      [Start]0.6

      \[ -1 \cdot {wj}^{3} + \left({wj}^{2} + \left(-2 \cdot \left(wj \cdot x\right) + x\right)\right) \]

      unpow2 [=>]0.6

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

      fma-def [=>]0.6

      \[ -1 \cdot {wj}^{3} + \left(wj \cdot wj + \color{blue}{\mathsf{fma}\left(-2, wj \cdot x, x\right)}\right) \]

      fma-udef [<=]0.6

      \[ -1 \cdot {wj}^{3} + \color{blue}{\mathsf{fma}\left(wj, wj, \mathsf{fma}\left(-2, wj \cdot x, x\right)\right)} \]

      *-commutative [=>]0.6

      \[ -1 \cdot {wj}^{3} + \mathsf{fma}\left(wj, wj, \mathsf{fma}\left(-2, \color{blue}{x \cdot wj}, x\right)\right) \]

    if 3.70000000000000004e-7 < wj

    1. Initial program 32.9

      \[wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}} \]
    2. Simplified2.1

      \[\leadsto \color{blue}{wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}} \]
      Proof

      [Start]32.9

      \[ wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}} \]

      sub-neg [=>]32.9

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

      neg-mul-1 [=>]32.9

      \[ wj + \color{blue}{-1 \cdot \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}} \]

      *-commutative [=>]32.9

      \[ wj + \color{blue}{\frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}} \cdot -1} \]

      *-commutative [<=]32.9

      \[ wj + \color{blue}{-1 \cdot \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}} \]

      neg-mul-1 [<=]32.9

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

      neg-sub0 [=>]32.9

      \[ wj + \color{blue}{\left(0 - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\right)} \]

      div-sub [=>]32.9

      \[ wj + \left(0 - \color{blue}{\left(\frac{wj \cdot e^{wj}}{e^{wj} + wj \cdot e^{wj}} - \frac{x}{e^{wj} + wj \cdot e^{wj}}\right)}\right) \]

      associate--r- [=>]32.9

      \[ wj + \color{blue}{\left(\left(0 - \frac{wj \cdot e^{wj}}{e^{wj} + wj \cdot e^{wj}}\right) + \frac{x}{e^{wj} + wj \cdot e^{wj}}\right)} \]

      +-commutative [=>]32.9

      \[ wj + \color{blue}{\left(\frac{x}{e^{wj} + wj \cdot e^{wj}} + \left(0 - \frac{wj \cdot e^{wj}}{e^{wj} + wj \cdot e^{wj}}\right)\right)} \]

      sub0-neg [=>]32.9

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

      sub-neg [<=]32.9

      \[ wj + \color{blue}{\left(\frac{x}{e^{wj} + wj \cdot e^{wj}} - \frac{wj \cdot e^{wj}}{e^{wj} + wj \cdot e^{wj}}\right)} \]
    3. Applied egg-rr4.4

      \[\leadsto \color{blue}{\left(wj + 1\right) - \left(1 - \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\right)} \]
    4. Simplified4.4

      \[\leadsto \color{blue}{\left(\left(wj + 1\right) - 1\right) + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}} \]
      Proof

      [Start]4.4

      \[ \left(wj + 1\right) - \left(1 - \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\right) \]

      associate--r- [=>]4.4

      \[ \color{blue}{\left(\left(wj + 1\right) - 1\right) + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}} \]
    5. Applied egg-rr2.4

      \[\leadsto \color{blue}{\frac{\left(\left(wj + 2\right) \cdot wj\right) \cdot \left(-1 - wj\right) + \left(wj + 2\right) \cdot \left(-\left(\frac{x}{e^{wj}} - wj\right)\right)}{\left(wj + 2\right) \cdot \left(-1 - wj\right)}} \]
    6. Simplified2.4

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

      [Start]2.4

      \[ \frac{\left(\left(wj + 2\right) \cdot wj\right) \cdot \left(-1 - wj\right) + \left(wj + 2\right) \cdot \left(-\left(\frac{x}{e^{wj}} - wj\right)\right)}{\left(wj + 2\right) \cdot \left(-1 - wj\right)} \]

      +-commutative [=>]2.4

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

      associate-*l* [=>]2.4

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

      distribute-lft-out [=>]2.4

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

      neg-sub0 [=>]2.4

      \[ \frac{\left(wj + 2\right) \cdot \left(\color{blue}{\left(0 - \left(\frac{x}{e^{wj}} - wj\right)\right)} + wj \cdot \left(-1 - wj\right)\right)}{\left(wj + 2\right) \cdot \left(-1 - wj\right)} \]

      associate--r- [=>]2.4

      \[ \frac{\left(wj + 2\right) \cdot \left(\color{blue}{\left(\left(0 - \frac{x}{e^{wj}}\right) + wj\right)} + wj \cdot \left(-1 - wj\right)\right)}{\left(wj + 2\right) \cdot \left(-1 - wj\right)} \]

      neg-sub0 [<=]2.4

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

      distribute-neg-frac [=>]2.4

      \[ \frac{\left(wj + 2\right) \cdot \left(\left(\color{blue}{\frac{-x}{e^{wj}}} + wj\right) + wj \cdot \left(-1 - wj\right)\right)}{\left(wj + 2\right) \cdot \left(-1 - wj\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;wj \leq 3.7 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(wj, wj, \mathsf{fma}\left(-2, wj \cdot x, x\right)\right) - {wj}^{3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-2 - wj\right) \cdot \left(\left(\frac{x}{e^{wj}} - wj\right) + wj \cdot \left(wj + 1\right)\right)}{\left(wj + 2\right) \cdot \left(-1 - wj\right)}\\ \end{array} \]

Alternatives

Alternative 1
Error0.6
Cost8004
\[\begin{array}{l} \mathbf{if}\;wj \leq 5 \cdot 10^{-7}:\\ \;\;\;\;\left(wj \cdot wj + \left(x - 2 \cdot \left(wj \cdot x\right)\right)\right) - {wj}^{3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-2 - wj\right) \cdot \left(\left(\frac{x}{e^{wj}} - wj\right) + wj \cdot \left(wj + 1\right)\right)}{\left(wj + 2\right) \cdot \left(-1 - wj\right)}\\ \end{array} \]
Alternative 2
Error0.6
Cost7428
\[\begin{array}{l} \mathbf{if}\;wj \leq 2.35 \cdot 10^{-7}:\\ \;\;\;\;\left(wj \cdot wj + \left(x - 2 \cdot \left(wj \cdot x\right)\right)\right) - {wj}^{3}\\ \mathbf{else}:\\ \;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\ \end{array} \]
Alternative 3
Error1.5
Cost7300
\[\begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+36}:\\ \;\;\;\;wj + \frac{x \cdot e^{-wj} - wj}{wj + 1}\\ \mathbf{else}:\\ \;\;\;\;\left(x + wj \cdot wj\right) - {wj}^{3}\\ \end{array} \]
Alternative 4
Error1.5
Cost7236
\[\begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{+46}:\\ \;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\ \mathbf{else}:\\ \;\;\;\;\left(x + wj \cdot wj\right) - {wj}^{3}\\ \end{array} \]
Alternative 5
Error8.6
Cost7044
\[\begin{array}{l} \mathbf{if}\;wj \leq 1.55 \cdot 10^{-38}:\\ \;\;\;\;\frac{x \cdot e^{-wj}}{wj + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(wj \cdot wj\right) \cdot \left(-2 - wj\right)}{\left(wj + 2\right) \cdot \left(-1 - wj\right)}\\ \end{array} \]
Alternative 6
Error8.6
Cost6980
\[\begin{array}{l} \mathbf{if}\;wj \leq 9.2 \cdot 10^{-39}:\\ \;\;\;\;\frac{x}{e^{wj} \cdot \left(wj + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(wj \cdot wj\right) \cdot \left(-2 - wj\right)}{\left(wj + 2\right) \cdot \left(-1 - wj\right)}\\ \end{array} \]
Alternative 7
Error8.6
Cost6980
\[\begin{array}{l} \mathbf{if}\;wj \leq 1.12 \cdot 10^{-38}:\\ \;\;\;\;\frac{\frac{x}{e^{wj}}}{wj + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(wj \cdot wj\right) \cdot \left(-2 - wj\right)}{\left(wj + 2\right) \cdot \left(-1 - wj\right)}\\ \end{array} \]
Alternative 8
Error2.0
Cost6912
\[\left(x + wj \cdot wj\right) - {wj}^{3} \]
Alternative 9
Error8.3
Cost1220
\[\begin{array}{l} \mathbf{if}\;wj \leq 5.2 \cdot 10^{-40}:\\ \;\;\;\;\frac{x}{\frac{wj + 1}{1 - wj}} + \left(wj - \frac{wj}{wj + 1}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(wj \cdot wj\right) \cdot \left(-2 - wj\right)}{\left(wj + 2\right) \cdot \left(-1 - wj\right)}\\ \end{array} \]
Alternative 10
Error8.8
Cost1092
\[\begin{array}{l} \mathbf{if}\;wj \leq 4.6 \cdot 10^{-39}:\\ \;\;\;\;\frac{x}{1 - wj \cdot \left(-2 - wj \cdot 1.5\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{wj \cdot \left(wj \cdot \left(-2 - wj\right)\right)}{\left(wj + 2\right) \cdot \left(-1 - wj\right)}\\ \end{array} \]
Alternative 11
Error8.8
Cost1092
\[\begin{array}{l} \mathbf{if}\;wj \leq 5 \cdot 10^{-40}:\\ \;\;\;\;\frac{x}{1 - wj \cdot \left(-2 - wj \cdot 1.5\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(wj \cdot wj\right) \cdot \left(-2 - wj\right)}{\left(wj + 2\right) \cdot \left(-1 - wj\right)}\\ \end{array} \]
Alternative 12
Error8.7
Cost964
\[\begin{array}{l} \mathbf{if}\;wj \leq 6.2 \cdot 10^{-15}:\\ \;\;\;\;\frac{x}{1 - wj \cdot \left(-2 - wj \cdot 1.5\right)}\\ \mathbf{else}:\\ \;\;\;\;wj + \frac{wj \cdot \left(wj + -1\right)}{1 - wj \cdot wj}\\ \end{array} \]
Alternative 13
Error8.7
Cost836
\[\begin{array}{l} \mathbf{if}\;wj \leq 6.2 \cdot 10^{-15}:\\ \;\;\;\;\frac{x}{1 - wj \cdot \left(-2 - wj \cdot 1.5\right)}\\ \mathbf{else}:\\ \;\;\;\;wj - \frac{wj}{wj + 1}\\ \end{array} \]
Alternative 14
Error8.7
Cost836
\[\begin{array}{l} \mathbf{if}\;wj \leq 6.2 \cdot 10^{-15}:\\ \;\;\;\;\frac{x}{1 - wj \cdot \left(-2 - wj \cdot 1.5\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{wj \cdot \left(wj + 1\right) - wj}{wj + 1}\\ \end{array} \]
Alternative 15
Error8.7
Cost580
\[\begin{array}{l} \mathbf{if}\;wj \leq 6.2 \cdot 10^{-15}:\\ \;\;\;\;x - 2 \cdot \left(wj \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;wj - \frac{wj}{wj + 1}\\ \end{array} \]
Alternative 16
Error9.3
Cost448
\[x - 2 \cdot \left(wj \cdot x\right) \]
Alternative 17
Error61.2
Cost64
\[wj \]
Alternative 18
Error9.6
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023066 
(FPCore (wj x)
  :name "Jmat.Real.lambertw, newton loop step"
  :precision binary64

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

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