
(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
(let* ((t_0 (* wj (exp wj))) (t_1 (+ wj (/ (- x t_0) (+ (exp wj) t_0)))))
(if (<= t_1 -2e+57)
(/ (/ x (exp wj)) (+ wj 1.0))
(if (<= t_1 2e-14)
(+
(*
(pow wj 3.0)
(-
(- (- -1.0 (* -2.0 (+ (* x -4.0) (* x 1.5)))) (* x -3.0))
(* x 0.6666666666666666)))
(+ (* wj wj) (+ x (* -2.0 (* wj x)))))
(+ wj (/ (- (* x (exp (- wj))) wj) (+ wj 1.0)))))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
double t_1 = wj + ((x - t_0) / (exp(wj) + t_0));
double tmp;
if (t_1 <= -2e+57) {
tmp = (x / exp(wj)) / (wj + 1.0);
} else if (t_1 <= 2e-14) {
tmp = (pow(wj, 3.0) * (((-1.0 - (-2.0 * ((x * -4.0) + (x * 1.5)))) - (x * -3.0)) - (x * 0.6666666666666666))) + ((wj * wj) + (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 = wj * exp(wj)
t_1 = wj + ((x - t_0) / (exp(wj) + t_0))
if (t_1 <= (-2d+57)) then
tmp = (x / exp(wj)) / (wj + 1.0d0)
else if (t_1 <= 2d-14) then
tmp = ((wj ** 3.0d0) * ((((-1.0d0) - ((-2.0d0) * ((x * (-4.0d0)) + (x * 1.5d0)))) - (x * (-3.0d0))) - (x * 0.6666666666666666d0))) + ((wj * wj) + (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 = wj * Math.exp(wj);
double t_1 = wj + ((x - t_0) / (Math.exp(wj) + t_0));
double tmp;
if (t_1 <= -2e+57) {
tmp = (x / Math.exp(wj)) / (wj + 1.0);
} else if (t_1 <= 2e-14) {
tmp = (Math.pow(wj, 3.0) * (((-1.0 - (-2.0 * ((x * -4.0) + (x * 1.5)))) - (x * -3.0)) - (x * 0.6666666666666666))) + ((wj * wj) + (x + (-2.0 * (wj * x))));
} else {
tmp = wj + (((x * Math.exp(-wj)) - wj) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): t_0 = wj * math.exp(wj) t_1 = wj + ((x - t_0) / (math.exp(wj) + t_0)) tmp = 0 if t_1 <= -2e+57: tmp = (x / math.exp(wj)) / (wj + 1.0) elif t_1 <= 2e-14: tmp = (math.pow(wj, 3.0) * (((-1.0 - (-2.0 * ((x * -4.0) + (x * 1.5)))) - (x * -3.0)) - (x * 0.6666666666666666))) + ((wj * wj) + (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(wj * exp(wj)) t_1 = Float64(wj + Float64(Float64(x - t_0) / Float64(exp(wj) + t_0))) tmp = 0.0 if (t_1 <= -2e+57) tmp = Float64(Float64(x / exp(wj)) / Float64(wj + 1.0)); elseif (t_1 <= 2e-14) tmp = Float64(Float64((wj ^ 3.0) * Float64(Float64(Float64(-1.0 - Float64(-2.0 * Float64(Float64(x * -4.0) + Float64(x * 1.5)))) - Float64(x * -3.0)) - Float64(x * 0.6666666666666666))) + Float64(Float64(wj * wj) + 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 = wj * exp(wj); t_1 = wj + ((x - t_0) / (exp(wj) + t_0)); tmp = 0.0; if (t_1 <= -2e+57) tmp = (x / exp(wj)) / (wj + 1.0); elseif (t_1 <= 2e-14) tmp = ((wj ^ 3.0) * (((-1.0 - (-2.0 * ((x * -4.0) + (x * 1.5)))) - (x * -3.0)) - (x * 0.6666666666666666))) + ((wj * wj) + (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[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(wj + N[(N[(x - t$95$0), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+57], N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-14], N[(N[(N[Power[wj, 3.0], $MachinePrecision] * N[(N[(N[(-1.0 - N[(-2.0 * N[(N[(x * -4.0), $MachinePrecision] + N[(x * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * -3.0), $MachinePrecision]), $MachinePrecision] - N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(wj * wj), $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 := wj \cdot e^{wj}\\
t_1 := wj + \frac{x - t_0}{e^{wj} + t_0}\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+57}:\\
\;\;\;\;\frac{\frac{x}{e^{wj}}}{wj + 1}\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{-14}:\\
\;\;\;\;{wj}^{3} \cdot \left(\left(\left(-1 - -2 \cdot \left(x \cdot -4 + x \cdot 1.5\right)\right) - x \cdot -3\right) - x \cdot 0.6666666666666666\right) + \left(wj \cdot wj + \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.0000000000000001e57Initial program 96.7%
sub-neg96.7%
div-sub96.7%
sub-neg96.7%
+-commutative96.7%
distribute-neg-in96.7%
remove-double-neg96.7%
sub-neg96.7%
div-sub96.7%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
+-commutative100.0%
div-inv99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 100.0%
associate-/l/100.0%
+-commutative100.0%
Simplified100.0%
if -2.0000000000000001e57 < (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) < 2e-14Initial program 64.3%
sub-neg64.3%
div-sub64.3%
sub-neg64.3%
+-commutative64.3%
distribute-neg-in64.3%
remove-double-neg64.3%
sub-neg64.3%
div-sub64.3%
distribute-rgt1-in64.2%
associate-/l/64.4%
Simplified64.4%
Taylor expanded in wj around 0 99.9%
Taylor expanded in x around 0 99.9%
unpow299.9%
Simplified99.9%
if 2e-14 < (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) Initial program 93.8%
sub-neg93.8%
div-sub93.8%
sub-neg93.8%
+-commutative93.8%
distribute-neg-in93.8%
remove-double-neg93.8%
sub-neg93.8%
div-sub93.8%
distribute-rgt1-in93.9%
associate-/l/93.8%
Simplified97.9%
clear-num97.6%
associate-/r/97.9%
rec-exp97.9%
Applied egg-rr97.9%
Final simplification99.3%
(FPCore (wj x)
:precision binary64
(if (<= wj -3.15e-9)
(+ wj (/ (- (/ x (exp wj)) wj) (+ wj 1.0)))
(if (<= wj 7.2e-9)
(+ (* wj wj) (+ x (* -2.0 (* wj x))))
(+ wj (/ (- (* x (exp (- wj))) wj) (+ wj 1.0))))))
double code(double wj, double x) {
double tmp;
if (wj <= -3.15e-9) {
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0));
} else if (wj <= 7.2e-9) {
tmp = (wj * wj) + (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) :: tmp
if (wj <= (-3.15d-9)) then
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0d0))
else if (wj <= 7.2d-9) then
tmp = (wj * wj) + (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 tmp;
if (wj <= -3.15e-9) {
tmp = wj + (((x / Math.exp(wj)) - wj) / (wj + 1.0));
} else if (wj <= 7.2e-9) {
tmp = (wj * wj) + (x + (-2.0 * (wj * x)));
} else {
tmp = wj + (((x * Math.exp(-wj)) - wj) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -3.15e-9: tmp = wj + (((x / math.exp(wj)) - wj) / (wj + 1.0)) elif wj <= 7.2e-9: tmp = (wj * wj) + (x + (-2.0 * (wj * x))) else: tmp = wj + (((x * math.exp(-wj)) - wj) / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -3.15e-9) tmp = Float64(wj + Float64(Float64(Float64(x / exp(wj)) - wj) / Float64(wj + 1.0))); elseif (wj <= 7.2e-9) tmp = Float64(Float64(wj * wj) + 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) tmp = 0.0; if (wj <= -3.15e-9) tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0)); elseif (wj <= 7.2e-9) tmp = (wj * wj) + (x + (-2.0 * (wj * x))); else tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -3.15e-9], N[(wj + N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 7.2e-9], N[(N[(wj * wj), $MachinePrecision] + N[(x + N[(-2.0 * N[(wj * x), $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}
\mathbf{if}\;wj \leq -3.15 \cdot 10^{-9}:\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\
\mathbf{elif}\;wj \leq 7.2 \cdot 10^{-9}:\\
\;\;\;\;wj \cdot wj + \left(x + -2 \cdot \left(wj \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{x \cdot e^{-wj} - wj}{wj + 1}\\
\end{array}
\end{array}
if wj < -3.1500000000000001e-9Initial program 60.2%
sub-neg60.2%
div-sub60.2%
sub-neg60.2%
+-commutative60.2%
distribute-neg-in60.2%
remove-double-neg60.2%
sub-neg60.2%
div-sub60.2%
distribute-rgt1-in86.5%
associate-/l/86.5%
Simplified86.5%
if -3.1500000000000001e-9 < wj < 7.2e-9Initial program 82.3%
distribute-rgt1-in82.3%
Simplified82.3%
Taylor expanded in wj around 0 82.3%
count-282.3%
Simplified82.3%
Taylor expanded in wj around 0 99.5%
Taylor expanded in x around 0 99.9%
unpow299.9%
Simplified99.9%
if 7.2e-9 < wj Initial program 62.1%
sub-neg62.1%
div-sub62.1%
sub-neg62.1%
+-commutative62.1%
distribute-neg-in62.1%
remove-double-neg62.1%
sub-neg62.1%
div-sub62.1%
distribute-rgt1-in61.9%
associate-/l/61.7%
Simplified91.7%
clear-num91.7%
associate-/r/91.7%
rec-exp91.8%
Applied egg-rr91.8%
Final simplification99.1%
(FPCore (wj x) :precision binary64 (if (or (<= wj -2.9e-9) (not (<= wj 8.2e-9))) (+ wj (/ (- (/ x (exp wj)) wj) (+ wj 1.0))) (+ (* wj wj) (+ x (* -2.0 (* wj x))))))
double code(double wj, double x) {
double tmp;
if ((wj <= -2.9e-9) || !(wj <= 8.2e-9)) {
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = (wj * wj) + (x + (-2.0 * (wj * x)));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if ((wj <= (-2.9d-9)) .or. (.not. (wj <= 8.2d-9))) then
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0d0))
else
tmp = (wj * wj) + (x + ((-2.0d0) * (wj * x)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if ((wj <= -2.9e-9) || !(wj <= 8.2e-9)) {
tmp = wj + (((x / Math.exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = (wj * wj) + (x + (-2.0 * (wj * x)));
}
return tmp;
}
def code(wj, x): tmp = 0 if (wj <= -2.9e-9) or not (wj <= 8.2e-9): tmp = wj + (((x / math.exp(wj)) - wj) / (wj + 1.0)) else: tmp = (wj * wj) + (x + (-2.0 * (wj * x))) return tmp
function code(wj, x) tmp = 0.0 if ((wj <= -2.9e-9) || !(wj <= 8.2e-9)) tmp = Float64(wj + Float64(Float64(Float64(x / exp(wj)) - wj) / Float64(wj + 1.0))); else tmp = Float64(Float64(wj * wj) + Float64(x + Float64(-2.0 * Float64(wj * x)))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if ((wj <= -2.9e-9) || ~((wj <= 8.2e-9))) tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0)); else tmp = (wj * wj) + (x + (-2.0 * (wj * x))); end tmp_2 = tmp; end
code[wj_, x_] := If[Or[LessEqual[wj, -2.9e-9], N[Not[LessEqual[wj, 8.2e-9]], $MachinePrecision]], N[(wj + N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(wj * wj), $MachinePrecision] + N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -2.9 \cdot 10^{-9} \lor \neg \left(wj \leq 8.2 \cdot 10^{-9}\right):\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;wj \cdot wj + \left(x + -2 \cdot \left(wj \cdot x\right)\right)\\
\end{array}
\end{array}
if wj < -2.89999999999999991e-9 or 8.2000000000000006e-9 < wj Initial program 61.3%
sub-neg61.3%
div-sub61.3%
sub-neg61.3%
+-commutative61.3%
distribute-neg-in61.3%
remove-double-neg61.3%
sub-neg61.3%
div-sub61.3%
distribute-rgt1-in72.8%
associate-/l/72.7%
Simplified89.4%
if -2.89999999999999991e-9 < wj < 8.2000000000000006e-9Initial program 82.3%
distribute-rgt1-in82.3%
Simplified82.3%
Taylor expanded in wj around 0 82.3%
count-282.3%
Simplified82.3%
Taylor expanded in wj around 0 99.5%
Taylor expanded in x around 0 99.9%
unpow299.9%
Simplified99.9%
Final simplification99.1%
(FPCore (wj x) :precision binary64 (if (<= x -1.35e-37) (+ wj (/ (/ x (exp wj)) (+ wj 1.0))) (+ (* wj wj) (+ x (* -2.0 (* wj x))))))
double code(double wj, double x) {
double tmp;
if (x <= -1.35e-37) {
tmp = wj + ((x / exp(wj)) / (wj + 1.0));
} else {
tmp = (wj * wj) + (x + (-2.0 * (wj * x)));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-1.35d-37)) then
tmp = wj + ((x / exp(wj)) / (wj + 1.0d0))
else
tmp = (wj * wj) + (x + ((-2.0d0) * (wj * x)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (x <= -1.35e-37) {
tmp = wj + ((x / Math.exp(wj)) / (wj + 1.0));
} else {
tmp = (wj * wj) + (x + (-2.0 * (wj * x)));
}
return tmp;
}
def code(wj, x): tmp = 0 if x <= -1.35e-37: tmp = wj + ((x / math.exp(wj)) / (wj + 1.0)) else: tmp = (wj * wj) + (x + (-2.0 * (wj * x))) return tmp
function code(wj, x) tmp = 0.0 if (x <= -1.35e-37) tmp = Float64(wj + Float64(Float64(x / exp(wj)) / Float64(wj + 1.0))); else tmp = Float64(Float64(wj * wj) + Float64(x + Float64(-2.0 * Float64(wj * x)))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (x <= -1.35e-37) tmp = wj + ((x / exp(wj)) / (wj + 1.0)); else tmp = (wj * wj) + (x + (-2.0 * (wj * x))); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[x, -1.35e-37], N[(wj + N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(wj * wj), $MachinePrecision] + N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{-37}:\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}}}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;wj \cdot wj + \left(x + -2 \cdot \left(wj \cdot x\right)\right)\\
\end{array}
\end{array}
if x < -1.35000000000000008e-37Initial program 95.9%
distribute-rgt1-in98.6%
Simplified98.6%
Taylor expanded in x around inf 99.5%
associate-*r/99.5%
neg-mul-199.5%
+-commutative99.5%
associate-/r*99.5%
Simplified99.5%
if -1.35000000000000008e-37 < x Initial program 74.5%
distribute-rgt1-in74.6%
Simplified74.6%
Taylor expanded in wj around 0 72.2%
count-272.2%
Simplified72.2%
Taylor expanded in wj around 0 94.9%
Taylor expanded in x around 0 95.3%
unpow295.3%
Simplified95.3%
Final simplification96.5%
(FPCore (wj x)
:precision binary64
(if (<= wj -0.00082)
(/ x (* (exp wj) (+ wj 1.0)))
(if (<= wj 6e-6)
(+ (* wj wj) (+ x (* -2.0 (* wj x))))
(- wj (/ wj (+ wj 1.0))))))
double code(double wj, double x) {
double tmp;
if (wj <= -0.00082) {
tmp = x / (exp(wj) * (wj + 1.0));
} else if (wj <= 6e-6) {
tmp = (wj * wj) + (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 <= (-0.00082d0)) then
tmp = x / (exp(wj) * (wj + 1.0d0))
else if (wj <= 6d-6) then
tmp = (wj * wj) + (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 <= -0.00082) {
tmp = x / (Math.exp(wj) * (wj + 1.0));
} else if (wj <= 6e-6) {
tmp = (wj * wj) + (x + (-2.0 * (wj * x)));
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -0.00082: tmp = x / (math.exp(wj) * (wj + 1.0)) elif wj <= 6e-6: tmp = (wj * wj) + (x + (-2.0 * (wj * x))) else: tmp = wj - (wj / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -0.00082) tmp = Float64(x / Float64(exp(wj) * Float64(wj + 1.0))); elseif (wj <= 6e-6) tmp = Float64(Float64(wj * wj) + 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 <= -0.00082) tmp = x / (exp(wj) * (wj + 1.0)); elseif (wj <= 6e-6) tmp = (wj * wj) + (x + (-2.0 * (wj * x))); else tmp = wj - (wj / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -0.00082], N[(x / N[(N[Exp[wj], $MachinePrecision] * N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 6e-6], N[(N[(wj * wj), $MachinePrecision] + N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -0.00082:\\
\;\;\;\;\frac{x}{e^{wj} \cdot \left(wj + 1\right)}\\
\mathbf{elif}\;wj \leq 6 \cdot 10^{-6}:\\
\;\;\;\;wj \cdot wj + \left(x + -2 \cdot \left(wj \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\end{array}
\end{array}
if wj < -8.1999999999999998e-4Initial program 39.4%
sub-neg39.4%
div-sub39.4%
sub-neg39.4%
+-commutative39.4%
distribute-neg-in39.4%
remove-double-neg39.4%
sub-neg39.4%
div-sub39.4%
distribute-rgt1-in81.4%
associate-/l/81.4%
Simplified81.4%
Taylor expanded in x around inf 81.4%
if -8.1999999999999998e-4 < wj < 6.0000000000000002e-6Initial program 82.4%
distribute-rgt1-in82.4%
Simplified82.4%
Taylor expanded in wj around 0 82.0%
count-282.0%
Simplified82.0%
Taylor expanded in wj around 0 98.9%
Taylor expanded in x around 0 99.2%
unpow299.2%
Simplified99.2%
if 6.0000000000000002e-6 < wj Initial program 56.8%
sub-neg56.8%
div-sub56.8%
sub-neg56.8%
+-commutative56.8%
distribute-neg-in56.8%
remove-double-neg56.8%
sub-neg56.8%
div-sub56.8%
distribute-rgt1-in57.0%
associate-/l/56.7%
Simplified94.2%
Taylor expanded in x around 0 69.4%
+-commutative69.4%
Simplified69.4%
Final simplification97.9%
(FPCore (wj x) :precision binary64 (if (<= wj 6e-6) (+ (* wj wj) (+ x (* -2.0 (* wj x)))) (- wj (/ wj (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 6e-6) {
tmp = (wj * wj) + (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 <= 6d-6) then
tmp = (wj * wj) + (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 <= 6e-6) {
tmp = (wj * wj) + (x + (-2.0 * (wj * x)));
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 6e-6: tmp = (wj * wj) + (x + (-2.0 * (wj * x))) else: tmp = wj - (wj / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 6e-6) tmp = Float64(Float64(wj * wj) + 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 <= 6e-6) tmp = (wj * wj) + (x + (-2.0 * (wj * x))); else tmp = wj - (wj / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 6e-6], N[(N[(wj * wj), $MachinePrecision] + N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 6 \cdot 10^{-6}:\\
\;\;\;\;wj \cdot wj + \left(x + -2 \cdot \left(wj \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 6.0000000000000002e-6Initial program 81.6%
distribute-rgt1-in82.4%
Simplified82.4%
Taylor expanded in wj around 0 80.5%
count-280.5%
Simplified80.5%
Taylor expanded in wj around 0 96.9%
Taylor expanded in x around 0 97.2%
unpow297.2%
Simplified97.2%
if 6.0000000000000002e-6 < wj Initial program 56.8%
sub-neg56.8%
div-sub56.8%
sub-neg56.8%
+-commutative56.8%
distribute-neg-in56.8%
remove-double-neg56.8%
sub-neg56.8%
div-sub56.8%
distribute-rgt1-in57.0%
associate-/l/56.7%
Simplified94.2%
Taylor expanded in x around 0 69.4%
+-commutative69.4%
Simplified69.4%
Final simplification96.4%
(FPCore (wj x) :precision binary64 (if (<= wj 3.1e-30) (+ x (* -2.0 (* wj x))) (if (<= wj 9.8e-9) (* wj wj) (- wj (/ wj (+ wj 1.0))))))
double code(double wj, double x) {
double tmp;
if (wj <= 3.1e-30) {
tmp = x + (-2.0 * (wj * x));
} else if (wj <= 9.8e-9) {
tmp = 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 <= 3.1d-30) then
tmp = x + ((-2.0d0) * (wj * x))
else if (wj <= 9.8d-9) then
tmp = 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 <= 3.1e-30) {
tmp = x + (-2.0 * (wj * x));
} else if (wj <= 9.8e-9) {
tmp = wj * wj;
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 3.1e-30: tmp = x + (-2.0 * (wj * x)) elif wj <= 9.8e-9: tmp = wj * wj else: tmp = wj - (wj / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 3.1e-30) tmp = Float64(x + Float64(-2.0 * Float64(wj * x))); elseif (wj <= 9.8e-9) tmp = 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 <= 3.1e-30) tmp = x + (-2.0 * (wj * x)); elseif (wj <= 9.8e-9) tmp = wj * wj; else tmp = wj - (wj / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 3.1e-30], N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 9.8e-9], N[(wj * wj), $MachinePrecision], N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 3.1 \cdot 10^{-30}:\\
\;\;\;\;x + -2 \cdot \left(wj \cdot x\right)\\
\mathbf{elif}\;wj \leq 9.8 \cdot 10^{-9}:\\
\;\;\;\;wj \cdot wj\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 3.09999999999999991e-30Initial program 83.8%
sub-neg83.8%
div-sub83.8%
sub-neg83.8%
+-commutative83.8%
distribute-neg-in83.8%
remove-double-neg83.8%
sub-neg83.8%
div-sub83.8%
distribute-rgt1-in84.7%
associate-/l/84.8%
Simplified84.8%
Taylor expanded in wj around 0 92.2%
if 3.09999999999999991e-30 < wj < 9.80000000000000007e-9Initial program 27.9%
distribute-rgt1-in27.9%
Simplified27.9%
Taylor expanded in wj around 0 28.0%
count-228.0%
Simplified28.0%
Taylor expanded in x around 0 8.9%
associate-/l*9.8%
count-29.8%
Simplified9.8%
Taylor expanded in wj around 0 77.6%
unpow277.6%
Simplified77.6%
if 9.80000000000000007e-9 < wj Initial program 62.1%
sub-neg62.1%
div-sub62.1%
sub-neg62.1%
+-commutative62.1%
distribute-neg-in62.1%
remove-double-neg62.1%
sub-neg62.1%
div-sub62.1%
distribute-rgt1-in61.9%
associate-/l/61.7%
Simplified91.7%
Taylor expanded in x around 0 62.4%
+-commutative62.4%
Simplified62.4%
Final simplification90.5%
(FPCore (wj x) :precision binary64 (if (<= wj 3.5e-30) (/ x (+ 1.0 (+ wj wj))) (if (<= wj 9.8e-9) (* wj wj) (- wj (/ wj (+ wj 1.0))))))
double code(double wj, double x) {
double tmp;
if (wj <= 3.5e-30) {
tmp = x / (1.0 + (wj + wj));
} else if (wj <= 9.8e-9) {
tmp = 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 <= 3.5d-30) then
tmp = x / (1.0d0 + (wj + wj))
else if (wj <= 9.8d-9) then
tmp = 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 <= 3.5e-30) {
tmp = x / (1.0 + (wj + wj));
} else if (wj <= 9.8e-9) {
tmp = wj * wj;
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 3.5e-30: tmp = x / (1.0 + (wj + wj)) elif wj <= 9.8e-9: tmp = wj * wj else: tmp = wj - (wj / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 3.5e-30) tmp = Float64(x / Float64(1.0 + Float64(wj + wj))); elseif (wj <= 9.8e-9) tmp = 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 <= 3.5e-30) tmp = x / (1.0 + (wj + wj)); elseif (wj <= 9.8e-9) tmp = wj * wj; else tmp = wj - (wj / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 3.5e-30], N[(x / N[(1.0 + N[(wj + wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 9.8e-9], N[(wj * wj), $MachinePrecision], N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 3.5 \cdot 10^{-30}:\\
\;\;\;\;\frac{x}{1 + \left(wj + wj\right)}\\
\mathbf{elif}\;wj \leq 9.8 \cdot 10^{-9}:\\
\;\;\;\;wj \cdot wj\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 3.5000000000000003e-30Initial program 83.8%
distribute-rgt1-in84.7%
Simplified84.7%
Taylor expanded in wj around 0 82.8%
count-282.8%
Simplified82.8%
Taylor expanded in x around inf 92.3%
count-292.3%
Simplified92.3%
if 3.5000000000000003e-30 < wj < 9.80000000000000007e-9Initial program 27.9%
distribute-rgt1-in27.9%
Simplified27.9%
Taylor expanded in wj around 0 28.0%
count-228.0%
Simplified28.0%
Taylor expanded in x around 0 8.9%
associate-/l*9.8%
count-29.8%
Simplified9.8%
Taylor expanded in wj around 0 77.6%
unpow277.6%
Simplified77.6%
if 9.80000000000000007e-9 < wj Initial program 62.1%
sub-neg62.1%
div-sub62.1%
sub-neg62.1%
+-commutative62.1%
distribute-neg-in62.1%
remove-double-neg62.1%
sub-neg62.1%
div-sub62.1%
distribute-rgt1-in61.9%
associate-/l/61.7%
Simplified91.7%
Taylor expanded in x around 0 62.4%
+-commutative62.4%
Simplified62.4%
Final simplification90.6%
(FPCore (wj x) :precision binary64 (if (<= wj 2.3e-30) (+ x (* -2.0 (* wj x))) (* wj wj)))
double code(double wj, double x) {
double tmp;
if (wj <= 2.3e-30) {
tmp = x + (-2.0 * (wj * x));
} else {
tmp = 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 <= 2.3d-30) then
tmp = x + ((-2.0d0) * (wj * x))
else
tmp = wj * wj
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 2.3e-30) {
tmp = x + (-2.0 * (wj * x));
} else {
tmp = wj * wj;
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 2.3e-30: tmp = x + (-2.0 * (wj * x)) else: tmp = wj * wj return tmp
function code(wj, x) tmp = 0.0 if (wj <= 2.3e-30) tmp = Float64(x + Float64(-2.0 * Float64(wj * x))); else tmp = Float64(wj * wj); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 2.3e-30) tmp = x + (-2.0 * (wj * x)); else tmp = wj * wj; end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 2.3e-30], N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj * wj), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 2.3 \cdot 10^{-30}:\\
\;\;\;\;x + -2 \cdot \left(wj \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;wj \cdot wj\\
\end{array}
\end{array}
if wj < 2.29999999999999984e-30Initial program 83.8%
sub-neg83.8%
div-sub83.8%
sub-neg83.8%
+-commutative83.8%
distribute-neg-in83.8%
remove-double-neg83.8%
sub-neg83.8%
div-sub83.8%
distribute-rgt1-in84.7%
associate-/l/84.8%
Simplified84.8%
Taylor expanded in wj around 0 92.2%
if 2.29999999999999984e-30 < wj Initial program 45.0%
distribute-rgt1-in44.9%
Simplified44.9%
Taylor expanded in wj around 0 26.1%
count-226.1%
Simplified26.1%
Taylor expanded in x around 0 12.3%
associate-/l*12.7%
count-212.7%
Simplified12.7%
Taylor expanded in wj around 0 48.7%
unpow248.7%
Simplified48.7%
Final simplification88.8%
(FPCore (wj x) :precision binary64 (if (<= wj 3.5e-30) x (* wj wj)))
double code(double wj, double x) {
double tmp;
if (wj <= 3.5e-30) {
tmp = x;
} else {
tmp = 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 <= 3.5d-30) then
tmp = x
else
tmp = wj * wj
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 3.5e-30) {
tmp = x;
} else {
tmp = wj * wj;
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 3.5e-30: tmp = x else: tmp = wj * wj return tmp
function code(wj, x) tmp = 0.0 if (wj <= 3.5e-30) tmp = x; else tmp = Float64(wj * wj); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 3.5e-30) tmp = x; else tmp = wj * wj; end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 3.5e-30], x, N[(wj * wj), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 3.5 \cdot 10^{-30}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;wj \cdot wj\\
\end{array}
\end{array}
if wj < 3.5000000000000003e-30Initial program 83.8%
sub-neg83.8%
div-sub83.8%
sub-neg83.8%
+-commutative83.8%
distribute-neg-in83.8%
remove-double-neg83.8%
sub-neg83.8%
div-sub83.8%
distribute-rgt1-in84.7%
associate-/l/84.8%
Simplified84.8%
Taylor expanded in wj around 0 91.9%
if 3.5000000000000003e-30 < wj Initial program 45.0%
distribute-rgt1-in44.9%
Simplified44.9%
Taylor expanded in wj around 0 26.1%
count-226.1%
Simplified26.1%
Taylor expanded in x around 0 12.3%
associate-/l*12.7%
count-212.7%
Simplified12.7%
Taylor expanded in wj around 0 48.7%
unpow248.7%
Simplified48.7%
Final simplification88.5%
(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 80.8%
sub-neg80.8%
div-sub80.8%
sub-neg80.8%
+-commutative80.8%
distribute-neg-in80.8%
remove-double-neg80.8%
sub-neg80.8%
div-sub80.8%
distribute-rgt1-in81.6%
associate-/l/81.7%
Simplified82.8%
Taylor expanded in wj around inf 4.6%
Final simplification4.6%
(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 80.8%
sub-neg80.8%
div-sub80.8%
sub-neg80.8%
+-commutative80.8%
distribute-neg-in80.8%
remove-double-neg80.8%
sub-neg80.8%
div-sub80.8%
distribute-rgt1-in81.6%
associate-/l/81.7%
Simplified82.8%
Taylor expanded in wj around 0 86.0%
Final simplification86.0%
(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 2023230
(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))))))