
(FPCore (wj x) :precision binary64 (let* ((t_0 (* wj (exp wj)))) (- wj (/ (- t_0 x) (+ (exp wj) t_0)))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
return wj - ((t_0 - x) / (exp(wj) + t_0));
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
t_0 = wj * exp(wj)
code = wj - ((t_0 - x) / (exp(wj) + t_0))
end function
public static double code(double wj, double x) {
double t_0 = wj * Math.exp(wj);
return wj - ((t_0 - x) / (Math.exp(wj) + t_0));
}
def code(wj, x): t_0 = wj * math.exp(wj) return wj - ((t_0 - x) / (math.exp(wj) + t_0))
function code(wj, x) t_0 = Float64(wj * exp(wj)) return Float64(wj - Float64(Float64(t_0 - x) / Float64(exp(wj) + t_0))) end
function tmp = code(wj, x) t_0 = wj * exp(wj); tmp = wj - ((t_0 - x) / (exp(wj) + t_0)); end
code[wj_, x_] := Block[{t$95$0 = N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, N[(wj - N[(N[(t$95$0 - x), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := wj \cdot e^{wj}\\
wj - \frac{t_0 - x}{e^{wj} + t_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (wj x) :precision binary64 (let* ((t_0 (* wj (exp wj)))) (- wj (/ (- t_0 x) (+ (exp wj) t_0)))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
return wj - ((t_0 - x) / (exp(wj) + t_0));
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
t_0 = wj * exp(wj)
code = wj - ((t_0 - x) / (exp(wj) + t_0))
end function
public static double code(double wj, double x) {
double t_0 = wj * Math.exp(wj);
return wj - ((t_0 - x) / (Math.exp(wj) + t_0));
}
def code(wj, x): t_0 = wj * math.exp(wj) return wj - ((t_0 - x) / (math.exp(wj) + t_0))
function code(wj, x) t_0 = Float64(wj * exp(wj)) return Float64(wj - Float64(Float64(t_0 - x) / Float64(exp(wj) + t_0))) end
function tmp = code(wj, x) t_0 = wj * exp(wj); tmp = wj - ((t_0 - x) / (exp(wj) + t_0)); end
code[wj_, x_] := Block[{t$95$0 = N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, N[(wj - N[(N[(t$95$0 - x), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := wj \cdot e^{wj}\\
wj - \frac{t_0 - x}{e^{wj} + t_0}
\end{array}
\end{array}
(FPCore (wj x)
:precision binary64
(if (<= wj -3.4e-7)
(+ wj (pow (/ (+ wj 1.0) (- (/ x (exp wj)) wj)) -1.0))
(if (<= wj 8.8e-11)
(- (+ (+ x (* -2.0 (* wj x))) (* wj wj)) (pow wj 3.0))
(+ (/ x (exp (+ wj (log1p wj)))) (- wj (/ wj (+ wj 1.0)))))))
double code(double wj, double x) {
double tmp;
if (wj <= -3.4e-7) {
tmp = wj + pow(((wj + 1.0) / ((x / exp(wj)) - wj)), -1.0);
} else if (wj <= 8.8e-11) {
tmp = ((x + (-2.0 * (wj * x))) + (wj * wj)) - pow(wj, 3.0);
} else {
tmp = (x / exp((wj + log1p(wj)))) + (wj - (wj / (wj + 1.0)));
}
return tmp;
}
public static double code(double wj, double x) {
double tmp;
if (wj <= -3.4e-7) {
tmp = wj + Math.pow(((wj + 1.0) / ((x / Math.exp(wj)) - wj)), -1.0);
} else if (wj <= 8.8e-11) {
tmp = ((x + (-2.0 * (wj * x))) + (wj * wj)) - Math.pow(wj, 3.0);
} else {
tmp = (x / Math.exp((wj + Math.log1p(wj)))) + (wj - (wj / (wj + 1.0)));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -3.4e-7: tmp = wj + math.pow(((wj + 1.0) / ((x / math.exp(wj)) - wj)), -1.0) elif wj <= 8.8e-11: tmp = ((x + (-2.0 * (wj * x))) + (wj * wj)) - math.pow(wj, 3.0) else: tmp = (x / math.exp((wj + math.log1p(wj)))) + (wj - (wj / (wj + 1.0))) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -3.4e-7) tmp = Float64(wj + (Float64(Float64(wj + 1.0) / Float64(Float64(x / exp(wj)) - wj)) ^ -1.0)); elseif (wj <= 8.8e-11) tmp = Float64(Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)) - (wj ^ 3.0)); else tmp = Float64(Float64(x / exp(Float64(wj + log1p(wj)))) + Float64(wj - Float64(wj / Float64(wj + 1.0)))); end return tmp end
code[wj_, x_] := If[LessEqual[wj, -3.4e-7], N[(wj + N[Power[N[(N[(wj + 1.0), $MachinePrecision] / N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 8.8e-11], N[(N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision] - N[Power[wj, 3.0], $MachinePrecision]), $MachinePrecision], N[(N[(x / N[Exp[N[(wj + N[Log[1 + wj], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -3.4 \cdot 10^{-7}:\\
\;\;\;\;wj + {\left(\frac{wj + 1}{\frac{x}{e^{wj}} - wj}\right)}^{-1}\\
\mathbf{elif}\;wj \leq 8.8 \cdot 10^{-11}:\\
\;\;\;\;\left(\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\right) - {wj}^{3}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{e^{wj + \mathsf{log1p}\left(wj\right)}} + \left(wj - \frac{wj}{wj + 1}\right)\\
\end{array}
\end{array}
if wj < -3.39999999999999974e-7Initial program 61.5%
sub-neg61.5%
div-sub61.1%
sub-neg61.1%
+-commutative61.1%
distribute-neg-in61.1%
remove-double-neg61.1%
sub-neg61.1%
div-sub61.5%
distribute-rgt1-in98.9%
associate-/l/98.4%
Simplified98.9%
clear-num99.1%
inv-pow99.1%
Applied egg-rr99.1%
if -3.39999999999999974e-7 < wj < 8.8000000000000006e-11Initial program 77.7%
sub-neg77.7%
div-sub77.7%
sub-neg77.7%
+-commutative77.7%
distribute-neg-in77.7%
remove-double-neg77.7%
sub-neg77.7%
div-sub77.7%
distribute-rgt1-in77.7%
associate-/l/77.7%
Simplified77.7%
Taylor expanded in wj around 0 100.0%
Taylor expanded in x around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
if 8.8000000000000006e-11 < wj Initial program 54.7%
sub-neg54.7%
div-sub54.7%
sub-neg54.7%
+-commutative54.7%
distribute-neg-in54.7%
remove-double-neg54.7%
sub-neg54.7%
div-sub54.7%
distribute-rgt1-in54.5%
associate-/l/54.8%
Simplified97.6%
+-commutative97.6%
div-sub97.6%
associate-+l-97.7%
associate-/l/97.7%
*-commutative97.7%
add-exp-log97.7%
+-commutative97.7%
log1p-udef97.7%
prod-exp98.0%
Applied egg-rr98.0%
Final simplification99.9%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (+ (* x -4.0) (* x 1.5))) (t_1 (* wj (exp wj))))
(if (<= (+ wj (/ (- x t_1) (+ (exp wj) t_1))) 2e-22)
(+
(*
(pow wj 3.0)
(- (- (- -1.0 (* -2.0 t_0)) (* x -3.0)) (* x 0.6666666666666666)))
(+ (* (- 1.0 t_0) (pow wj 2.0)) (+ x (* -2.0 (* wj x)))))
(+ wj (/ (- (* x (exp (- wj))) wj) (+ wj 1.0))))))
double code(double wj, double x) {
double t_0 = (x * -4.0) + (x * 1.5);
double t_1 = wj * exp(wj);
double tmp;
if ((wj + ((x - t_1) / (exp(wj) + t_1))) <= 2e-22) {
tmp = (pow(wj, 3.0) * (((-1.0 - (-2.0 * t_0)) - (x * -3.0)) - (x * 0.6666666666666666))) + (((1.0 - t_0) * pow(wj, 2.0)) + (x + (-2.0 * (wj * x))));
} else {
tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (x * (-4.0d0)) + (x * 1.5d0)
t_1 = wj * exp(wj)
if ((wj + ((x - t_1) / (exp(wj) + t_1))) <= 2d-22) then
tmp = ((wj ** 3.0d0) * ((((-1.0d0) - ((-2.0d0) * t_0)) - (x * (-3.0d0))) - (x * 0.6666666666666666d0))) + (((1.0d0 - t_0) * (wj ** 2.0d0)) + (x + ((-2.0d0) * (wj * x))))
else
tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double t_0 = (x * -4.0) + (x * 1.5);
double t_1 = wj * Math.exp(wj);
double tmp;
if ((wj + ((x - t_1) / (Math.exp(wj) + t_1))) <= 2e-22) {
tmp = (Math.pow(wj, 3.0) * (((-1.0 - (-2.0 * t_0)) - (x * -3.0)) - (x * 0.6666666666666666))) + (((1.0 - t_0) * Math.pow(wj, 2.0)) + (x + (-2.0 * (wj * x))));
} else {
tmp = wj + (((x * Math.exp(-wj)) - wj) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): t_0 = (x * -4.0) + (x * 1.5) t_1 = wj * math.exp(wj) tmp = 0 if (wj + ((x - t_1) / (math.exp(wj) + t_1))) <= 2e-22: tmp = (math.pow(wj, 3.0) * (((-1.0 - (-2.0 * t_0)) - (x * -3.0)) - (x * 0.6666666666666666))) + (((1.0 - t_0) * math.pow(wj, 2.0)) + (x + (-2.0 * (wj * x)))) else: tmp = wj + (((x * math.exp(-wj)) - wj) / (wj + 1.0)) return tmp
function code(wj, x) t_0 = Float64(Float64(x * -4.0) + Float64(x * 1.5)) t_1 = Float64(wj * exp(wj)) tmp = 0.0 if (Float64(wj + Float64(Float64(x - t_1) / Float64(exp(wj) + t_1))) <= 2e-22) tmp = Float64(Float64((wj ^ 3.0) * Float64(Float64(Float64(-1.0 - Float64(-2.0 * t_0)) - Float64(x * -3.0)) - Float64(x * 0.6666666666666666))) + Float64(Float64(Float64(1.0 - t_0) * (wj ^ 2.0)) + Float64(x + Float64(-2.0 * Float64(wj * x))))); else tmp = Float64(wj + Float64(Float64(Float64(x * exp(Float64(-wj))) - wj) / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) t_0 = (x * -4.0) + (x * 1.5); t_1 = wj * exp(wj); tmp = 0.0; if ((wj + ((x - t_1) / (exp(wj) + t_1))) <= 2e-22) tmp = ((wj ^ 3.0) * (((-1.0 - (-2.0 * t_0)) - (x * -3.0)) - (x * 0.6666666666666666))) + (((1.0 - t_0) * (wj ^ 2.0)) + (x + (-2.0 * (wj * x)))); else tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := Block[{t$95$0 = N[(N[(x * -4.0), $MachinePrecision] + N[(x * 1.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(wj + N[(N[(x - t$95$1), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e-22], N[(N[(N[Power[wj, 3.0], $MachinePrecision] * N[(N[(N[(-1.0 - N[(-2.0 * t$95$0), $MachinePrecision]), $MachinePrecision] - N[(x * -3.0), $MachinePrecision]), $MachinePrecision] - N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 - t$95$0), $MachinePrecision] * N[Power[wj, 2.0], $MachinePrecision]), $MachinePrecision] + N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(N[(N[(x * N[Exp[(-wj)], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot -4 + x \cdot 1.5\\
t_1 := wj \cdot e^{wj}\\
\mathbf{if}\;wj + \frac{x - t_1}{e^{wj} + t_1} \leq 2 \cdot 10^{-22}:\\
\;\;\;\;{wj}^{3} \cdot \left(\left(\left(-1 - -2 \cdot t_0\right) - x \cdot -3\right) - x \cdot 0.6666666666666666\right) + \left(\left(1 - t_0\right) \cdot {wj}^{2} + \left(x + -2 \cdot \left(wj \cdot x\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{x \cdot e^{-wj} - wj}{wj + 1}\\
\end{array}
\end{array}
if (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) < 2.0000000000000001e-22Initial program 68.7%
sub-neg68.7%
div-sub68.7%
sub-neg68.7%
+-commutative68.7%
distribute-neg-in68.7%
remove-double-neg68.7%
sub-neg68.7%
div-sub68.7%
distribute-rgt1-in69.3%
associate-/l/69.3%
Simplified69.3%
Taylor expanded in wj around 0 98.0%
if 2.0000000000000001e-22 < (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) Initial program 90.2%
sub-neg90.2%
div-sub90.1%
sub-neg90.1%
+-commutative90.1%
distribute-neg-in90.1%
remove-double-neg90.1%
sub-neg90.1%
div-sub90.2%
distribute-rgt1-in92.5%
associate-/l/92.5%
Simplified99.5%
clear-num99.3%
associate-/r/99.5%
rec-exp99.5%
Applied egg-rr99.5%
Final simplification98.5%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (- (/ x (exp wj)) wj)))
(if (<= wj -6.2e-7)
(+ wj (pow (/ (+ wj 1.0) t_0) -1.0))
(if (<= wj 4.6e-8)
(- (+ (+ x (* -2.0 (* wj x))) (* wj wj)) (pow wj 3.0))
(+ wj (/ t_0 (+ wj 1.0)))))))
double code(double wj, double x) {
double t_0 = (x / exp(wj)) - wj;
double tmp;
if (wj <= -6.2e-7) {
tmp = wj + pow(((wj + 1.0) / t_0), -1.0);
} else if (wj <= 4.6e-8) {
tmp = ((x + (-2.0 * (wj * x))) + (wj * wj)) - pow(wj, 3.0);
} else {
tmp = wj + (t_0 / (wj + 1.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = (x / exp(wj)) - wj
if (wj <= (-6.2d-7)) then
tmp = wj + (((wj + 1.0d0) / t_0) ** (-1.0d0))
else if (wj <= 4.6d-8) then
tmp = ((x + ((-2.0d0) * (wj * x))) + (wj * wj)) - (wj ** 3.0d0)
else
tmp = wj + (t_0 / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double t_0 = (x / Math.exp(wj)) - wj;
double tmp;
if (wj <= -6.2e-7) {
tmp = wj + Math.pow(((wj + 1.0) / t_0), -1.0);
} else if (wj <= 4.6e-8) {
tmp = ((x + (-2.0 * (wj * x))) + (wj * wj)) - Math.pow(wj, 3.0);
} else {
tmp = wj + (t_0 / (wj + 1.0));
}
return tmp;
}
def code(wj, x): t_0 = (x / math.exp(wj)) - wj tmp = 0 if wj <= -6.2e-7: tmp = wj + math.pow(((wj + 1.0) / t_0), -1.0) elif wj <= 4.6e-8: tmp = ((x + (-2.0 * (wj * x))) + (wj * wj)) - math.pow(wj, 3.0) else: tmp = wj + (t_0 / (wj + 1.0)) return tmp
function code(wj, x) t_0 = Float64(Float64(x / exp(wj)) - wj) tmp = 0.0 if (wj <= -6.2e-7) tmp = Float64(wj + (Float64(Float64(wj + 1.0) / t_0) ^ -1.0)); elseif (wj <= 4.6e-8) tmp = Float64(Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)) - (wj ^ 3.0)); else tmp = Float64(wj + Float64(t_0 / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) t_0 = (x / exp(wj)) - wj; tmp = 0.0; if (wj <= -6.2e-7) tmp = wj + (((wj + 1.0) / t_0) ^ -1.0); elseif (wj <= 4.6e-8) tmp = ((x + (-2.0 * (wj * x))) + (wj * wj)) - (wj ^ 3.0); else tmp = wj + (t_0 / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := Block[{t$95$0 = N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision]}, If[LessEqual[wj, -6.2e-7], N[(wj + N[Power[N[(N[(wj + 1.0), $MachinePrecision] / t$95$0), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 4.6e-8], N[(N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision] - N[Power[wj, 3.0], $MachinePrecision]), $MachinePrecision], N[(wj + N[(t$95$0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{e^{wj}} - wj\\
\mathbf{if}\;wj \leq -6.2 \cdot 10^{-7}:\\
\;\;\;\;wj + {\left(\frac{wj + 1}{t_0}\right)}^{-1}\\
\mathbf{elif}\;wj \leq 4.6 \cdot 10^{-8}:\\
\;\;\;\;\left(\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\right) - {wj}^{3}\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{t_0}{wj + 1}\\
\end{array}
\end{array}
if wj < -6.1999999999999999e-7Initial program 61.5%
sub-neg61.5%
div-sub61.1%
sub-neg61.1%
+-commutative61.1%
distribute-neg-in61.1%
remove-double-neg61.1%
sub-neg61.1%
div-sub61.5%
distribute-rgt1-in98.9%
associate-/l/98.4%
Simplified98.9%
clear-num99.1%
inv-pow99.1%
Applied egg-rr99.1%
if -6.1999999999999999e-7 < wj < 4.6000000000000002e-8Initial program 77.8%
sub-neg77.8%
div-sub77.8%
sub-neg77.8%
+-commutative77.8%
distribute-neg-in77.8%
remove-double-neg77.8%
sub-neg77.8%
div-sub77.8%
distribute-rgt1-in77.8%
associate-/l/77.8%
Simplified77.8%
Taylor expanded in wj around 0 100.0%
Taylor expanded in x around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
if 4.6000000000000002e-8 < wj Initial program 51.3%
sub-neg51.3%
div-sub51.3%
sub-neg51.3%
+-commutative51.3%
distribute-neg-in51.3%
remove-double-neg51.3%
sub-neg51.3%
div-sub51.3%
distribute-rgt1-in51.1%
associate-/l/51.4%
Simplified97.6%
Final simplification99.8%
(FPCore (wj x) :precision binary64 (if (or (<= wj -3.1e-7) (not (<= wj 4.5e-8))) (+ wj (/ (- (/ x (exp wj)) wj) (+ wj 1.0))) (- (+ (+ x (* -2.0 (* wj x))) (* wj wj)) (pow wj 3.0))))
double code(double wj, double x) {
double tmp;
if ((wj <= -3.1e-7) || !(wj <= 4.5e-8)) {
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = ((x + (-2.0 * (wj * x))) + (wj * wj)) - pow(wj, 3.0);
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if ((wj <= (-3.1d-7)) .or. (.not. (wj <= 4.5d-8))) then
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0d0))
else
tmp = ((x + ((-2.0d0) * (wj * x))) + (wj * wj)) - (wj ** 3.0d0)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if ((wj <= -3.1e-7) || !(wj <= 4.5e-8)) {
tmp = wj + (((x / Math.exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = ((x + (-2.0 * (wj * x))) + (wj * wj)) - Math.pow(wj, 3.0);
}
return tmp;
}
def code(wj, x): tmp = 0 if (wj <= -3.1e-7) or not (wj <= 4.5e-8): tmp = wj + (((x / math.exp(wj)) - wj) / (wj + 1.0)) else: tmp = ((x + (-2.0 * (wj * x))) + (wj * wj)) - math.pow(wj, 3.0) return tmp
function code(wj, x) tmp = 0.0 if ((wj <= -3.1e-7) || !(wj <= 4.5e-8)) tmp = Float64(wj + Float64(Float64(Float64(x / exp(wj)) - wj) / Float64(wj + 1.0))); else tmp = Float64(Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)) - (wj ^ 3.0)); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if ((wj <= -3.1e-7) || ~((wj <= 4.5e-8))) tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0)); else tmp = ((x + (-2.0 * (wj * x))) + (wj * wj)) - (wj ^ 3.0); end tmp_2 = tmp; end
code[wj_, x_] := If[Or[LessEqual[wj, -3.1e-7], N[Not[LessEqual[wj, 4.5e-8]], $MachinePrecision]], N[(wj + N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision] - N[Power[wj, 3.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -3.1 \cdot 10^{-7} \lor \neg \left(wj \leq 4.5 \cdot 10^{-8}\right):\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\right) - {wj}^{3}\\
\end{array}
\end{array}
if wj < -3.1e-7 or 4.49999999999999993e-8 < wj Initial program 55.2%
sub-neg55.2%
div-sub55.0%
sub-neg55.0%
+-commutative55.0%
distribute-neg-in55.0%
remove-double-neg55.0%
sub-neg55.0%
div-sub55.2%
distribute-rgt1-in69.3%
associate-/l/69.3%
Simplified98.1%
if -3.1e-7 < wj < 4.49999999999999993e-8Initial program 77.8%
sub-neg77.8%
div-sub77.8%
sub-neg77.8%
+-commutative77.8%
distribute-neg-in77.8%
remove-double-neg77.8%
sub-neg77.8%
div-sub77.8%
distribute-rgt1-in77.8%
associate-/l/77.8%
Simplified77.8%
Taylor expanded in wj around 0 100.0%
Taylor expanded in x around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
Final simplification99.8%
(FPCore (wj x) :precision binary64 (if (or (<= wj -5.5e-9) (not (<= wj 7.3e-9))) (+ wj (/ (- (/ x (exp wj)) wj) (+ wj 1.0))) (+ (+ x (* -2.0 (* wj x))) (* wj wj))))
double code(double wj, double x) {
double tmp;
if ((wj <= -5.5e-9) || !(wj <= 7.3e-9)) {
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if ((wj <= (-5.5d-9)) .or. (.not. (wj <= 7.3d-9))) then
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0d0))
else
tmp = (x + ((-2.0d0) * (wj * x))) + (wj * wj)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if ((wj <= -5.5e-9) || !(wj <= 7.3e-9)) {
tmp = wj + (((x / Math.exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
def code(wj, x): tmp = 0 if (wj <= -5.5e-9) or not (wj <= 7.3e-9): tmp = wj + (((x / math.exp(wj)) - wj) / (wj + 1.0)) else: tmp = (x + (-2.0 * (wj * x))) + (wj * wj) return tmp
function code(wj, x) tmp = 0.0 if ((wj <= -5.5e-9) || !(wj <= 7.3e-9)) tmp = Float64(wj + Float64(Float64(Float64(x / exp(wj)) - wj) / Float64(wj + 1.0))); else tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if ((wj <= -5.5e-9) || ~((wj <= 7.3e-9))) tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0)); else tmp = (x + (-2.0 * (wj * x))) + (wj * wj); end tmp_2 = tmp; end
code[wj_, x_] := If[Or[LessEqual[wj, -5.5e-9], N[Not[LessEqual[wj, 7.3e-9]], $MachinePrecision]], N[(wj + N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -5.5 \cdot 10^{-9} \lor \neg \left(wj \leq 7.3 \cdot 10^{-9}\right):\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\\
\end{array}
\end{array}
if wj < -5.4999999999999996e-9 or 7.30000000000000002e-9 < wj Initial program 55.2%
sub-neg55.2%
div-sub55.0%
sub-neg55.0%
+-commutative55.0%
distribute-neg-in55.0%
remove-double-neg55.0%
sub-neg55.0%
div-sub55.2%
distribute-rgt1-in69.3%
associate-/l/69.3%
Simplified98.1%
if -5.4999999999999996e-9 < wj < 7.30000000000000002e-9Initial program 77.8%
sub-neg77.8%
div-sub77.8%
sub-neg77.8%
+-commutative77.8%
distribute-neg-in77.8%
remove-double-neg77.8%
sub-neg77.8%
div-sub77.8%
distribute-rgt1-in77.8%
associate-/l/77.8%
Simplified77.8%
Taylor expanded in wj around 0 99.8%
Taylor expanded in x around 0 99.8%
unpow2100.0%
Simplified99.8%
Final simplification99.7%
(FPCore (wj x) :precision binary64 (if (<= wj 0.0055) (+ (+ x (* -2.0 (* wj x))) (* wj wj)) (- wj (/ wj (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 0.0055) {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= 0.0055d0) then
tmp = (x + ((-2.0d0) * (wj * x))) + (wj * wj)
else
tmp = wj - (wj / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 0.0055) {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 0.0055: tmp = (x + (-2.0 * (wj * x))) + (wj * wj) else: tmp = wj - (wj / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 0.0055) tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)); else tmp = Float64(wj - Float64(wj / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 0.0055) tmp = (x + (-2.0 * (wj * x))) + (wj * wj); else tmp = wj - (wj / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 0.0055], N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision], N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 0.0055:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 0.0054999999999999997Initial program 77.4%
sub-neg77.4%
div-sub77.4%
sub-neg77.4%
+-commutative77.4%
distribute-neg-in77.4%
remove-double-neg77.4%
sub-neg77.4%
div-sub77.4%
distribute-rgt1-in78.6%
associate-/l/78.6%
Simplified78.7%
Taylor expanded in wj around 0 96.7%
Taylor expanded in x around 0 96.6%
unpow296.9%
Simplified96.6%
if 0.0054999999999999997 < wj Initial program 39.2%
sub-neg39.2%
div-sub39.2%
sub-neg39.2%
+-commutative39.2%
distribute-neg-in39.2%
remove-double-neg39.2%
sub-neg39.2%
div-sub39.2%
distribute-rgt1-in39.2%
associate-/l/39.2%
Simplified99.2%
Taylor expanded in x around 0 89.4%
+-commutative89.4%
Simplified89.4%
Final simplification96.3%
(FPCore (wj x) :precision binary64 (if (<= wj 0.95) (+ x (* -2.0 (* wj x))) (+ wj -1.0)))
double code(double wj, double x) {
double tmp;
if (wj <= 0.95) {
tmp = x + (-2.0 * (wj * x));
} else {
tmp = wj + -1.0;
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= 0.95d0) then
tmp = x + ((-2.0d0) * (wj * x))
else
tmp = wj + (-1.0d0)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 0.95) {
tmp = x + (-2.0 * (wj * x));
} else {
tmp = wj + -1.0;
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 0.95: tmp = x + (-2.0 * (wj * x)) else: tmp = wj + -1.0 return tmp
function code(wj, x) tmp = 0.0 if (wj <= 0.95) tmp = Float64(x + Float64(-2.0 * Float64(wj * x))); else tmp = Float64(wj + -1.0); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 0.95) tmp = x + (-2.0 * (wj * x)); else tmp = wj + -1.0; end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 0.95], N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 0.95:\\
\;\;\;\;x + -2 \cdot \left(wj \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;wj + -1\\
\end{array}
\end{array}
if wj < 0.94999999999999996Initial program 77.6%
sub-neg77.6%
div-sub77.6%
sub-neg77.6%
+-commutative77.6%
distribute-neg-in77.6%
remove-double-neg77.6%
sub-neg77.6%
div-sub77.6%
distribute-rgt1-in78.8%
associate-/l/78.8%
Simplified78.8%
Taylor expanded in wj around 0 84.5%
if 0.94999999999999996 < wj Initial program 25.0%
sub-neg25.0%
div-sub25.0%
sub-neg25.0%
+-commutative25.0%
distribute-neg-in25.0%
remove-double-neg25.0%
sub-neg25.0%
div-sub25.0%
distribute-rgt1-in25.0%
associate-/l/25.0%
Simplified100.0%
Taylor expanded in wj around inf 74.4%
Final simplification84.2%
(FPCore (wj x) :precision binary64 (if (<= wj 4.2e-6) (+ x (* -2.0 (* wj x))) (- wj (/ wj (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 4.2e-6) {
tmp = x + (-2.0 * (wj * x));
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= 4.2d-6) then
tmp = x + ((-2.0d0) * (wj * x))
else
tmp = wj - (wj / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 4.2e-6) {
tmp = x + (-2.0 * (wj * x));
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 4.2e-6: tmp = x + (-2.0 * (wj * x)) else: tmp = wj - (wj / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 4.2e-6) tmp = Float64(x + Float64(-2.0 * Float64(wj * x))); else tmp = Float64(wj - Float64(wj / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 4.2e-6) tmp = x + (-2.0 * (wj * x)); else tmp = wj - (wj / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 4.2e-6], N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 4.2 \cdot 10^{-6}:\\
\;\;\;\;x + -2 \cdot \left(wj \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 4.1999999999999996e-6Initial program 77.3%
sub-neg77.3%
div-sub77.3%
sub-neg77.3%
+-commutative77.3%
distribute-neg-in77.3%
remove-double-neg77.3%
sub-neg77.3%
div-sub77.3%
distribute-rgt1-in78.6%
associate-/l/78.6%
Simplified78.6%
Taylor expanded in wj around 0 85.6%
if 4.1999999999999996e-6 < wj Initial program 47.3%
sub-neg47.3%
div-sub47.3%
sub-neg47.3%
+-commutative47.3%
distribute-neg-in47.3%
remove-double-neg47.3%
sub-neg47.3%
div-sub47.3%
distribute-rgt1-in47.3%
associate-/l/47.5%
Simplified97.5%
Taylor expanded in x around 0 81.2%
+-commutative81.2%
Simplified81.2%
Final simplification85.4%
(FPCore (wj x) :precision binary64 (if (<= wj 3.3e-7) (/ x (+ 1.0 (* wj 2.0))) (- wj (/ wj (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 3.3e-7) {
tmp = x / (1.0 + (wj * 2.0));
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= 3.3d-7) then
tmp = x / (1.0d0 + (wj * 2.0d0))
else
tmp = wj - (wj / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 3.3e-7) {
tmp = x / (1.0 + (wj * 2.0));
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 3.3e-7: tmp = x / (1.0 + (wj * 2.0)) else: tmp = wj - (wj / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 3.3e-7) tmp = Float64(x / Float64(1.0 + Float64(wj * 2.0))); else tmp = Float64(wj - Float64(wj / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 3.3e-7) tmp = x / (1.0 + (wj * 2.0)); else tmp = wj - (wj / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 3.3e-7], N[(x / N[(1.0 + N[(wj * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 3.3 \cdot 10^{-7}:\\
\;\;\;\;\frac{x}{1 + wj \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 3.3000000000000002e-7Initial program 77.3%
sub-neg77.3%
div-sub77.3%
sub-neg77.3%
+-commutative77.3%
distribute-neg-in77.3%
remove-double-neg77.3%
sub-neg77.3%
div-sub77.3%
distribute-rgt1-in78.6%
associate-/l/78.6%
Simplified78.6%
Taylor expanded in x around inf 87.0%
Taylor expanded in wj around 0 85.6%
*-commutative85.6%
Simplified85.6%
if 3.3000000000000002e-7 < wj Initial program 47.3%
sub-neg47.3%
div-sub47.3%
sub-neg47.3%
+-commutative47.3%
distribute-neg-in47.3%
remove-double-neg47.3%
sub-neg47.3%
div-sub47.3%
distribute-rgt1-in47.3%
associate-/l/47.5%
Simplified97.5%
Taylor expanded in x around 0 81.2%
+-commutative81.2%
Simplified81.2%
Final simplification85.4%
(FPCore (wj x) :precision binary64 (if (<= wj 1.2) x (+ wj -1.0)))
double code(double wj, double x) {
double tmp;
if (wj <= 1.2) {
tmp = x;
} else {
tmp = wj + -1.0;
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= 1.2d0) then
tmp = x
else
tmp = wj + (-1.0d0)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 1.2) {
tmp = x;
} else {
tmp = wj + -1.0;
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 1.2: tmp = x else: tmp = wj + -1.0 return tmp
function code(wj, x) tmp = 0.0 if (wj <= 1.2) tmp = x; else tmp = Float64(wj + -1.0); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 1.2) tmp = x; else tmp = wj + -1.0; end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 1.2], x, N[(wj + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 1.2:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;wj + -1\\
\end{array}
\end{array}
if wj < 1.19999999999999996Initial program 77.6%
sub-neg77.6%
div-sub77.6%
sub-neg77.6%
+-commutative77.6%
distribute-neg-in77.6%
remove-double-neg77.6%
sub-neg77.6%
div-sub77.6%
distribute-rgt1-in78.8%
associate-/l/78.8%
Simplified78.8%
Taylor expanded in wj around 0 83.7%
if 1.19999999999999996 < wj Initial program 25.0%
sub-neg25.0%
div-sub25.0%
sub-neg25.0%
+-commutative25.0%
distribute-neg-in25.0%
remove-double-neg25.0%
sub-neg25.0%
div-sub25.0%
distribute-rgt1-in25.0%
associate-/l/25.0%
Simplified100.0%
Taylor expanded in wj around inf 74.4%
Final simplification83.4%
(FPCore (wj x) :precision binary64 wj)
double code(double wj, double x) {
return wj;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = wj
end function
public static double code(double wj, double x) {
return wj;
}
def code(wj, x): return wj
function code(wj, x) return wj end
function tmp = code(wj, x) tmp = wj; end
code[wj_, x_] := wj
\begin{array}{l}
\\
wj
\end{array}
Initial program 75.9%
sub-neg75.9%
div-sub75.9%
sub-neg75.9%
+-commutative75.9%
distribute-neg-in75.9%
remove-double-neg75.9%
sub-neg75.9%
div-sub75.9%
distribute-rgt1-in77.1%
associate-/l/77.1%
Simplified79.5%
Taylor expanded in wj around inf 5.2%
Final simplification5.2%
(FPCore (wj x) :precision binary64 x)
double code(double wj, double x) {
return x;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = x
end function
public static double code(double wj, double x) {
return x;
}
def code(wj, x): return x
function code(wj, x) return x end
function tmp = code(wj, x) tmp = x; end
code[wj_, x_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 75.9%
sub-neg75.9%
div-sub75.9%
sub-neg75.9%
+-commutative75.9%
distribute-neg-in75.9%
remove-double-neg75.9%
sub-neg75.9%
div-sub75.9%
distribute-rgt1-in77.1%
associate-/l/77.1%
Simplified79.5%
Taylor expanded in wj around 0 81.2%
Final simplification81.2%
(FPCore (wj x) :precision binary64 (- wj (- (/ wj (+ wj 1.0)) (/ x (+ (exp wj) (* wj (exp wj)))))))
double code(double wj, double x) {
return wj - ((wj / (wj + 1.0)) - (x / (exp(wj) + (wj * exp(wj)))));
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = wj - ((wj / (wj + 1.0d0)) - (x / (exp(wj) + (wj * exp(wj)))))
end function
public static double code(double wj, double x) {
return wj - ((wj / (wj + 1.0)) - (x / (Math.exp(wj) + (wj * Math.exp(wj)))));
}
def code(wj, x): return wj - ((wj / (wj + 1.0)) - (x / (math.exp(wj) + (wj * math.exp(wj)))))
function code(wj, x) return Float64(wj - Float64(Float64(wj / Float64(wj + 1.0)) - Float64(x / Float64(exp(wj) + Float64(wj * exp(wj)))))) end
function tmp = code(wj, x) tmp = wj - ((wj / (wj + 1.0)) - (x / (exp(wj) + (wj * exp(wj))))); end
code[wj_, x_] := N[(wj - N[(N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[Exp[wj], $MachinePrecision] + N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
wj - \left(\frac{wj}{wj + 1} - \frac{x}{e^{wj} + wj \cdot e^{wj}}\right)
\end{array}
herbie shell --seed 2023201
(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))))))