
(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 14 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))))
(if (<= (+ wj (/ (- x t_0) (+ (exp wj) t_0))) 1.35e-17)
(- (* wj wj) (+ (* wj (+ x x)) (- (pow wj 3.0) x)))
(fma (- (/ x (exp wj)) wj) (/ 1.0 (+ wj 1.0)) wj))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
double tmp;
if ((wj + ((x - t_0) / (exp(wj) + t_0))) <= 1.35e-17) {
tmp = (wj * wj) - ((wj * (x + x)) + (pow(wj, 3.0) - x));
} else {
tmp = fma(((x / exp(wj)) - wj), (1.0 / (wj + 1.0)), wj);
}
return tmp;
}
function code(wj, x) t_0 = Float64(wj * exp(wj)) tmp = 0.0 if (Float64(wj + Float64(Float64(x - t_0) / Float64(exp(wj) + t_0))) <= 1.35e-17) tmp = Float64(Float64(wj * wj) - Float64(Float64(wj * Float64(x + x)) + Float64((wj ^ 3.0) - x))); else tmp = fma(Float64(Float64(x / exp(wj)) - wj), Float64(1.0 / Float64(wj + 1.0)), wj); end return tmp end
code[wj_, x_] := Block[{t$95$0 = N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(wj + N[(N[(x - t$95$0), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.35e-17], N[(N[(wj * wj), $MachinePrecision] - N[(N[(wj * N[(x + x), $MachinePrecision]), $MachinePrecision] + N[(N[Power[wj, 3.0], $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] * N[(1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision] + wj), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := wj \cdot e^{wj}\\
\mathbf{if}\;wj + \frac{x - t_0}{e^{wj} + t_0} \leq 1.35 \cdot 10^{-17}:\\
\;\;\;\;wj \cdot wj - \left(wj \cdot \left(x + x\right) + \left({wj}^{3} - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{e^{wj}} - wj, \frac{1}{wj + 1}, wj\right)\\
\end{array}
\end{array}
if (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) < 1.3500000000000001e-17Initial program 67.9%
sub-neg67.9%
div-sub67.9%
sub-neg67.9%
+-commutative67.9%
distribute-neg-in67.9%
remove-double-neg67.9%
sub-neg67.9%
div-sub67.9%
distribute-rgt1-in69.0%
associate-/l/69.0%
Simplified69.0%
Taylor expanded in wj around 0 67.9%
Taylor expanded in wj around 0 98.9%
Taylor expanded in x around 0 98.9%
unpow298.9%
Simplified98.9%
Taylor expanded in x around 0 98.9%
mul-1-neg98.9%
Simplified98.9%
if 1.3500000000000001e-17 < (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) Initial program 95.6%
sub-neg95.6%
div-sub95.6%
sub-neg95.6%
+-commutative95.6%
distribute-neg-in95.6%
remove-double-neg95.6%
sub-neg95.6%
div-sub95.6%
distribute-rgt1-in96.9%
associate-/l/96.9%
Simplified99.5%
+-commutative99.5%
div-inv99.5%
fma-def99.6%
Applied egg-rr99.6%
Final simplification99.1%
(FPCore (wj x) :precision binary64 (- (+ (* wj wj) (+ x (* -2.0 (* wj x)))) (pow wj 3.0)))
double code(double wj, double x) {
return ((wj * wj) + (x + (-2.0 * (wj * x)))) - pow(wj, 3.0);
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = ((wj * wj) + (x + ((-2.0d0) * (wj * x)))) - (wj ** 3.0d0)
end function
public static double code(double wj, double x) {
return ((wj * wj) + (x + (-2.0 * (wj * x)))) - Math.pow(wj, 3.0);
}
def code(wj, x): return ((wj * wj) + (x + (-2.0 * (wj * x)))) - math.pow(wj, 3.0)
function code(wj, x) return Float64(Float64(Float64(wj * wj) + Float64(x + Float64(-2.0 * Float64(wj * x)))) - (wj ^ 3.0)) end
function tmp = code(wj, x) tmp = ((wj * wj) + (x + (-2.0 * (wj * x)))) - (wj ^ 3.0); end
code[wj_, x_] := N[(N[(N[(wj * wj), $MachinePrecision] + N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[wj, 3.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(wj \cdot wj + \left(x + -2 \cdot \left(wj \cdot x\right)\right)\right) - {wj}^{3}
\end{array}
Initial program 76.1%
sub-neg76.1%
div-sub76.1%
sub-neg76.1%
+-commutative76.1%
distribute-neg-in76.1%
remove-double-neg76.1%
sub-neg76.1%
div-sub76.1%
distribute-rgt1-in77.3%
associate-/l/77.3%
Simplified78.1%
Taylor expanded in wj around 0 96.9%
Taylor expanded in x around 0 96.7%
unpow296.7%
Simplified96.7%
Taylor expanded in x around 0 97.1%
Final simplification97.1%
(FPCore (wj x) :precision binary64 (- (* wj wj) (+ (* wj (+ x x)) (- (pow wj 3.0) x))))
double code(double wj, double x) {
return (wj * wj) - ((wj * (x + x)) + (pow(wj, 3.0) - x));
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = (wj * wj) - ((wj * (x + x)) + ((wj ** 3.0d0) - x))
end function
public static double code(double wj, double x) {
return (wj * wj) - ((wj * (x + x)) + (Math.pow(wj, 3.0) - x));
}
def code(wj, x): return (wj * wj) - ((wj * (x + x)) + (math.pow(wj, 3.0) - x))
function code(wj, x) return Float64(Float64(wj * wj) - Float64(Float64(wj * Float64(x + x)) + Float64((wj ^ 3.0) - x))) end
function tmp = code(wj, x) tmp = (wj * wj) - ((wj * (x + x)) + ((wj ^ 3.0) - x)); end
code[wj_, x_] := N[(N[(wj * wj), $MachinePrecision] - N[(N[(wj * N[(x + x), $MachinePrecision]), $MachinePrecision] + N[(N[Power[wj, 3.0], $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
wj \cdot wj - \left(wj \cdot \left(x + x\right) + \left({wj}^{3} - x\right)\right)
\end{array}
Initial program 76.1%
sub-neg76.1%
div-sub76.1%
sub-neg76.1%
+-commutative76.1%
distribute-neg-in76.1%
remove-double-neg76.1%
sub-neg76.1%
div-sub76.1%
distribute-rgt1-in77.3%
associate-/l/77.3%
Simplified78.1%
Taylor expanded in wj around 0 76.3%
Taylor expanded in wj around 0 97.1%
Taylor expanded in x around 0 97.1%
unpow297.1%
Simplified97.1%
Taylor expanded in x around 0 97.1%
mul-1-neg97.1%
Simplified97.1%
Final simplification97.1%
(FPCore (wj x) :precision binary64 (fma wj (+ (+ wj (* (* wj x) 2.0)) (* x -2.0)) x))
double code(double wj, double x) {
return fma(wj, ((wj + ((wj * x) * 2.0)) + (x * -2.0)), x);
}
function code(wj, x) return fma(wj, Float64(Float64(wj + Float64(Float64(wj * x) * 2.0)) + Float64(x * -2.0)), x) end
code[wj_, x_] := N[(wj * N[(N[(wj + N[(N[(wj * x), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] + N[(x * -2.0), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(wj, \left(wj + \left(wj \cdot x\right) \cdot 2\right) + x \cdot -2, x\right)
\end{array}
Initial program 76.1%
sub-neg76.1%
div-sub76.1%
sub-neg76.1%
+-commutative76.1%
distribute-neg-in76.1%
remove-double-neg76.1%
sub-neg76.1%
div-sub76.1%
distribute-rgt1-in77.3%
associate-/l/77.3%
Simplified78.1%
Taylor expanded in wj around 0 76.3%
Taylor expanded in wj around 0 97.1%
Taylor expanded in wj around 0 96.7%
associate-+r+96.7%
remove-double-neg96.7%
unsub-neg96.7%
unpow296.7%
sub-neg96.7%
neg-mul-196.7%
remove-double-neg96.7%
associate-*l*96.7%
*-commutative96.7%
distribute-lft-out96.7%
fma-neg96.7%
Simplified96.7%
Taylor expanded in x around 0 96.7%
Final simplification96.7%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (/ wj (+ wj 1.0))))
(if (or (<= x -1.5e-138) (not (<= x -1.05e-225)))
(+ (- wj t_0) (* x (- (/ 1.0 (+ wj 1.0)) t_0)))
(- (* wj wj) (pow wj 3.0)))))
double code(double wj, double x) {
double t_0 = wj / (wj + 1.0);
double tmp;
if ((x <= -1.5e-138) || !(x <= -1.05e-225)) {
tmp = (wj - t_0) + (x * ((1.0 / (wj + 1.0)) - t_0));
} else {
tmp = (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) :: t_0
real(8) :: tmp
t_0 = wj / (wj + 1.0d0)
if ((x <= (-1.5d-138)) .or. (.not. (x <= (-1.05d-225)))) then
tmp = (wj - t_0) + (x * ((1.0d0 / (wj + 1.0d0)) - t_0))
else
tmp = (wj * wj) - (wj ** 3.0d0)
end if
code = tmp
end function
public static double code(double wj, double x) {
double t_0 = wj / (wj + 1.0);
double tmp;
if ((x <= -1.5e-138) || !(x <= -1.05e-225)) {
tmp = (wj - t_0) + (x * ((1.0 / (wj + 1.0)) - t_0));
} else {
tmp = (wj * wj) - Math.pow(wj, 3.0);
}
return tmp;
}
def code(wj, x): t_0 = wj / (wj + 1.0) tmp = 0 if (x <= -1.5e-138) or not (x <= -1.05e-225): tmp = (wj - t_0) + (x * ((1.0 / (wj + 1.0)) - t_0)) else: tmp = (wj * wj) - math.pow(wj, 3.0) return tmp
function code(wj, x) t_0 = Float64(wj / Float64(wj + 1.0)) tmp = 0.0 if ((x <= -1.5e-138) || !(x <= -1.05e-225)) tmp = Float64(Float64(wj - t_0) + Float64(x * Float64(Float64(1.0 / Float64(wj + 1.0)) - t_0))); else tmp = Float64(Float64(wj * wj) - (wj ^ 3.0)); end return tmp end
function tmp_2 = code(wj, x) t_0 = wj / (wj + 1.0); tmp = 0.0; if ((x <= -1.5e-138) || ~((x <= -1.05e-225))) tmp = (wj - t_0) + (x * ((1.0 / (wj + 1.0)) - t_0)); else tmp = (wj * wj) - (wj ^ 3.0); end tmp_2 = tmp; end
code[wj_, x_] := Block[{t$95$0 = N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -1.5e-138], N[Not[LessEqual[x, -1.05e-225]], $MachinePrecision]], N[(N[(wj - t$95$0), $MachinePrecision] + N[(x * N[(N[(1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(wj * wj), $MachinePrecision] - N[Power[wj, 3.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{wj}{wj + 1}\\
\mathbf{if}\;x \leq -1.5 \cdot 10^{-138} \lor \neg \left(x \leq -1.05 \cdot 10^{-225}\right):\\
\;\;\;\;\left(wj - t_0\right) + x \cdot \left(\frac{1}{wj + 1} - t_0\right)\\
\mathbf{else}:\\
\;\;\;\;wj \cdot wj - {wj}^{3}\\
\end{array}
\end{array}
if x < -1.5e-138 or -1.05e-225 < x Initial program 79.8%
sub-neg79.8%
div-sub79.8%
sub-neg79.8%
+-commutative79.8%
distribute-neg-in79.8%
remove-double-neg79.8%
sub-neg79.8%
div-sub79.8%
distribute-rgt1-in80.7%
associate-/l/80.7%
Simplified81.5%
+-commutative81.5%
div-inv81.5%
fma-def81.5%
Applied egg-rr81.5%
Taylor expanded in wj around 0 80.1%
Taylor expanded in x around -inf 80.0%
associate-+r+91.7%
mul-1-neg91.7%
unsub-neg91.7%
+-commutative91.7%
mul-1-neg91.7%
+-commutative91.7%
unsub-neg91.7%
*-commutative91.7%
sub-neg91.7%
+-commutative91.7%
+-commutative91.7%
distribute-neg-frac91.7%
metadata-eval91.7%
Simplified91.7%
if -1.5e-138 < x < -1.05e-225Initial program 16.8%
sub-neg16.8%
div-sub16.8%
sub-neg16.8%
+-commutative16.8%
distribute-neg-in16.8%
remove-double-neg16.8%
sub-neg16.8%
div-sub16.8%
distribute-rgt1-in23.5%
associate-/l/23.5%
Simplified23.5%
Taylor expanded in wj around 0 16.8%
Taylor expanded in wj around 0 93.4%
Taylor expanded in x around 0 68.7%
mul-1-neg68.7%
unsub-neg68.7%
unpow268.7%
Simplified68.7%
Final simplification90.4%
(FPCore (wj x) :precision binary64 (+ (* wj wj) (fma (- (- x) x) wj x)))
double code(double wj, double x) {
return (wj * wj) + fma((-x - x), wj, x);
}
function code(wj, x) return Float64(Float64(wj * wj) + fma(Float64(Float64(-x) - x), wj, x)) end
code[wj_, x_] := N[(N[(wj * wj), $MachinePrecision] + N[(N[((-x) - x), $MachinePrecision] * wj + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
wj \cdot wj + \mathsf{fma}\left(\left(-x\right) - x, wj, x\right)
\end{array}
Initial program 76.1%
sub-neg76.1%
div-sub76.1%
sub-neg76.1%
+-commutative76.1%
distribute-neg-in76.1%
remove-double-neg76.1%
sub-neg76.1%
div-sub76.1%
distribute-rgt1-in77.3%
associate-/l/77.3%
Simplified78.1%
Taylor expanded in wj around 0 76.3%
Taylor expanded in wj around 0 97.1%
Taylor expanded in x around 0 97.1%
unpow297.1%
Simplified97.1%
Taylor expanded in wj around 0 96.7%
+-commutative96.7%
fma-def96.7%
neg-mul-196.7%
unpow296.7%
Simplified96.7%
Final simplification96.7%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (/ wj (+ wj 1.0))))
(if (or (<= x -1.5e-138) (not (<= x -1.05e-225)))
(+ (- wj t_0) (* x (- (/ 1.0 (+ wj 1.0)) t_0)))
(* wj wj))))
double code(double wj, double x) {
double t_0 = wj / (wj + 1.0);
double tmp;
if ((x <= -1.5e-138) || !(x <= -1.05e-225)) {
tmp = (wj - t_0) + (x * ((1.0 / (wj + 1.0)) - t_0));
} else {
tmp = wj * wj;
}
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 = wj / (wj + 1.0d0)
if ((x <= (-1.5d-138)) .or. (.not. (x <= (-1.05d-225)))) then
tmp = (wj - t_0) + (x * ((1.0d0 / (wj + 1.0d0)) - t_0))
else
tmp = wj * wj
end if
code = tmp
end function
public static double code(double wj, double x) {
double t_0 = wj / (wj + 1.0);
double tmp;
if ((x <= -1.5e-138) || !(x <= -1.05e-225)) {
tmp = (wj - t_0) + (x * ((1.0 / (wj + 1.0)) - t_0));
} else {
tmp = wj * wj;
}
return tmp;
}
def code(wj, x): t_0 = wj / (wj + 1.0) tmp = 0 if (x <= -1.5e-138) or not (x <= -1.05e-225): tmp = (wj - t_0) + (x * ((1.0 / (wj + 1.0)) - t_0)) else: tmp = wj * wj return tmp
function code(wj, x) t_0 = Float64(wj / Float64(wj + 1.0)) tmp = 0.0 if ((x <= -1.5e-138) || !(x <= -1.05e-225)) tmp = Float64(Float64(wj - t_0) + Float64(x * Float64(Float64(1.0 / Float64(wj + 1.0)) - t_0))); else tmp = Float64(wj * wj); end return tmp end
function tmp_2 = code(wj, x) t_0 = wj / (wj + 1.0); tmp = 0.0; if ((x <= -1.5e-138) || ~((x <= -1.05e-225))) tmp = (wj - t_0) + (x * ((1.0 / (wj + 1.0)) - t_0)); else tmp = wj * wj; end tmp_2 = tmp; end
code[wj_, x_] := Block[{t$95$0 = N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -1.5e-138], N[Not[LessEqual[x, -1.05e-225]], $MachinePrecision]], N[(N[(wj - t$95$0), $MachinePrecision] + N[(x * N[(N[(1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj * wj), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{wj}{wj + 1}\\
\mathbf{if}\;x \leq -1.5 \cdot 10^{-138} \lor \neg \left(x \leq -1.05 \cdot 10^{-225}\right):\\
\;\;\;\;\left(wj - t_0\right) + x \cdot \left(\frac{1}{wj + 1} - t_0\right)\\
\mathbf{else}:\\
\;\;\;\;wj \cdot wj\\
\end{array}
\end{array}
if x < -1.5e-138 or -1.05e-225 < x Initial program 79.8%
sub-neg79.8%
div-sub79.8%
sub-neg79.8%
+-commutative79.8%
distribute-neg-in79.8%
remove-double-neg79.8%
sub-neg79.8%
div-sub79.8%
distribute-rgt1-in80.7%
associate-/l/80.7%
Simplified81.5%
+-commutative81.5%
div-inv81.5%
fma-def81.5%
Applied egg-rr81.5%
Taylor expanded in wj around 0 80.1%
Taylor expanded in x around -inf 80.0%
associate-+r+91.7%
mul-1-neg91.7%
unsub-neg91.7%
+-commutative91.7%
mul-1-neg91.7%
+-commutative91.7%
unsub-neg91.7%
*-commutative91.7%
sub-neg91.7%
+-commutative91.7%
+-commutative91.7%
distribute-neg-frac91.7%
metadata-eval91.7%
Simplified91.7%
if -1.5e-138 < x < -1.05e-225Initial program 16.8%
sub-neg16.8%
div-sub16.8%
sub-neg16.8%
+-commutative16.8%
distribute-neg-in16.8%
remove-double-neg16.8%
sub-neg16.8%
div-sub16.8%
distribute-rgt1-in23.5%
associate-/l/23.5%
Simplified23.5%
Taylor expanded in wj around 0 16.8%
Taylor expanded in wj around 0 93.4%
Taylor expanded in wj around 0 93.4%
associate-+r+93.4%
remove-double-neg93.4%
unsub-neg93.4%
unpow293.4%
sub-neg93.4%
neg-mul-193.4%
remove-double-neg93.4%
associate-*l*93.4%
*-commutative93.4%
distribute-lft-out93.4%
fma-neg93.5%
Simplified93.5%
Taylor expanded in x around 0 68.7%
unpow268.7%
Simplified68.7%
Final simplification90.4%
(FPCore (wj x) :precision binary64 (if (<= x -1.5e-138) (* x (/ (- 1.0 wj) (+ wj 1.0))) (if (<= x -4e-282) (* wj wj) (* x (+ (* wj (- (* wj 2.0) 2.0)) 1.0)))))
double code(double wj, double x) {
double tmp;
if (x <= -1.5e-138) {
tmp = x * ((1.0 - wj) / (wj + 1.0));
} else if (x <= -4e-282) {
tmp = wj * wj;
} else {
tmp = x * ((wj * ((wj * 2.0) - 2.0)) + 1.0);
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-1.5d-138)) then
tmp = x * ((1.0d0 - wj) / (wj + 1.0d0))
else if (x <= (-4d-282)) then
tmp = wj * wj
else
tmp = x * ((wj * ((wj * 2.0d0) - 2.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (x <= -1.5e-138) {
tmp = x * ((1.0 - wj) / (wj + 1.0));
} else if (x <= -4e-282) {
tmp = wj * wj;
} else {
tmp = x * ((wj * ((wj * 2.0) - 2.0)) + 1.0);
}
return tmp;
}
def code(wj, x): tmp = 0 if x <= -1.5e-138: tmp = x * ((1.0 - wj) / (wj + 1.0)) elif x <= -4e-282: tmp = wj * wj else: tmp = x * ((wj * ((wj * 2.0) - 2.0)) + 1.0) return tmp
function code(wj, x) tmp = 0.0 if (x <= -1.5e-138) tmp = Float64(x * Float64(Float64(1.0 - wj) / Float64(wj + 1.0))); elseif (x <= -4e-282) tmp = Float64(wj * wj); else tmp = Float64(x * Float64(Float64(wj * Float64(Float64(wj * 2.0) - 2.0)) + 1.0)); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (x <= -1.5e-138) tmp = x * ((1.0 - wj) / (wj + 1.0)); elseif (x <= -4e-282) tmp = wj * wj; else tmp = x * ((wj * ((wj * 2.0) - 2.0)) + 1.0); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[x, -1.5e-138], N[(x * N[(N[(1.0 - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4e-282], N[(wj * wj), $MachinePrecision], N[(x * N[(N[(wj * N[(N[(wj * 2.0), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-138}:\\
\;\;\;\;x \cdot \frac{1 - wj}{wj + 1}\\
\mathbf{elif}\;x \leq -4 \cdot 10^{-282}:\\
\;\;\;\;wj \cdot wj\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(wj \cdot \left(wj \cdot 2 - 2\right) + 1\right)\\
\end{array}
\end{array}
if x < -1.5e-138Initial program 92.3%
sub-neg92.3%
div-sub92.3%
sub-neg92.3%
+-commutative92.3%
distribute-neg-in92.3%
remove-double-neg92.3%
sub-neg92.3%
div-sub92.3%
distribute-rgt1-in93.3%
associate-/l/93.3%
Simplified94.4%
Taylor expanded in wj around 0 92.3%
Taylor expanded in x around inf 95.9%
*-commutative95.9%
+-commutative95.9%
mul-1-neg95.9%
unsub-neg95.9%
+-commutative95.9%
+-commutative95.9%
Simplified95.9%
Taylor expanded in x around 0 95.9%
*-commutative95.9%
+-commutative95.9%
+-commutative95.9%
div-sub95.9%
Simplified95.9%
if -1.5e-138 < x < -4.0000000000000001e-282Initial program 19.4%
sub-neg19.4%
div-sub19.4%
sub-neg19.4%
+-commutative19.4%
distribute-neg-in19.4%
remove-double-neg19.4%
sub-neg19.4%
div-sub19.4%
distribute-rgt1-in22.9%
associate-/l/22.9%
Simplified22.9%
Taylor expanded in wj around 0 19.4%
Taylor expanded in wj around 0 93.9%
Taylor expanded in wj around 0 93.7%
associate-+r+93.7%
remove-double-neg93.7%
unsub-neg93.7%
unpow293.7%
sub-neg93.7%
neg-mul-193.7%
remove-double-neg93.7%
associate-*l*93.7%
*-commutative93.7%
distribute-lft-out93.7%
fma-neg93.8%
Simplified93.8%
Taylor expanded in x around 0 59.2%
unpow259.2%
Simplified59.2%
if -4.0000000000000001e-282 < x Initial program 76.7%
sub-neg76.7%
div-sub76.7%
sub-neg76.7%
+-commutative76.7%
distribute-neg-in76.7%
remove-double-neg76.7%
sub-neg76.7%
div-sub76.7%
distribute-rgt1-in77.4%
associate-/l/77.4%
Simplified78.2%
Taylor expanded in wj around 0 77.0%
Taylor expanded in wj around 0 97.2%
Taylor expanded in wj around 0 97.0%
associate-+r+97.0%
remove-double-neg97.0%
unsub-neg97.0%
unpow297.0%
sub-neg97.0%
neg-mul-197.0%
remove-double-neg97.0%
associate-*l*97.0%
*-commutative97.0%
distribute-lft-out97.0%
fma-neg97.0%
Simplified97.0%
Taylor expanded in x around inf 89.6%
Final simplification88.6%
(FPCore (wj x) :precision binary64 (if (or (<= x -1.5e-138) (not (<= x -8.5e-280))) (* x (/ (- 1.0 wj) (+ wj 1.0))) (* wj wj)))
double code(double wj, double x) {
double tmp;
if ((x <= -1.5e-138) || !(x <= -8.5e-280)) {
tmp = x * ((1.0 - wj) / (wj + 1.0));
} 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 ((x <= (-1.5d-138)) .or. (.not. (x <= (-8.5d-280)))) then
tmp = x * ((1.0d0 - wj) / (wj + 1.0d0))
else
tmp = wj * wj
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if ((x <= -1.5e-138) || !(x <= -8.5e-280)) {
tmp = x * ((1.0 - wj) / (wj + 1.0));
} else {
tmp = wj * wj;
}
return tmp;
}
def code(wj, x): tmp = 0 if (x <= -1.5e-138) or not (x <= -8.5e-280): tmp = x * ((1.0 - wj) / (wj + 1.0)) else: tmp = wj * wj return tmp
function code(wj, x) tmp = 0.0 if ((x <= -1.5e-138) || !(x <= -8.5e-280)) tmp = Float64(x * Float64(Float64(1.0 - wj) / Float64(wj + 1.0))); else tmp = Float64(wj * wj); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if ((x <= -1.5e-138) || ~((x <= -8.5e-280))) tmp = x * ((1.0 - wj) / (wj + 1.0)); else tmp = wj * wj; end tmp_2 = tmp; end
code[wj_, x_] := If[Or[LessEqual[x, -1.5e-138], N[Not[LessEqual[x, -8.5e-280]], $MachinePrecision]], N[(x * N[(N[(1.0 - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj * wj), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-138} \lor \neg \left(x \leq -8.5 \cdot 10^{-280}\right):\\
\;\;\;\;x \cdot \frac{1 - wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;wj \cdot wj\\
\end{array}
\end{array}
if x < -1.5e-138 or -8.50000000000000037e-280 < x Initial program 83.1%
sub-neg83.1%
div-sub83.1%
sub-neg83.1%
+-commutative83.1%
distribute-neg-in83.1%
remove-double-neg83.1%
sub-neg83.1%
div-sub83.1%
distribute-rgt1-in84.0%
associate-/l/84.0%
Simplified84.9%
Taylor expanded in wj around 0 83.3%
Taylor expanded in x around inf 92.1%
*-commutative92.1%
+-commutative92.1%
mul-1-neg92.1%
unsub-neg92.1%
+-commutative92.1%
+-commutative92.1%
Simplified92.1%
Taylor expanded in x around 0 92.1%
*-commutative92.1%
+-commutative92.1%
+-commutative92.1%
div-sub92.1%
Simplified92.1%
if -1.5e-138 < x < -8.50000000000000037e-280Initial program 19.4%
sub-neg19.4%
div-sub19.4%
sub-neg19.4%
+-commutative19.4%
distribute-neg-in19.4%
remove-double-neg19.4%
sub-neg19.4%
div-sub19.4%
distribute-rgt1-in22.9%
associate-/l/22.9%
Simplified22.9%
Taylor expanded in wj around 0 19.4%
Taylor expanded in wj around 0 93.9%
Taylor expanded in wj around 0 93.7%
associate-+r+93.7%
remove-double-neg93.7%
unsub-neg93.7%
unpow293.7%
sub-neg93.7%
neg-mul-193.7%
remove-double-neg93.7%
associate-*l*93.7%
*-commutative93.7%
distribute-lft-out93.7%
fma-neg93.8%
Simplified93.8%
Taylor expanded in x around 0 59.2%
unpow259.2%
Simplified59.2%
Final simplification88.5%
(FPCore (wj x) :precision binary64 (if (or (<= x -1.5e-138) (not (<= x -2.6e-279))) (* x (+ (* wj -2.0) 1.0)) (* wj wj)))
double code(double wj, double x) {
double tmp;
if ((x <= -1.5e-138) || !(x <= -2.6e-279)) {
tmp = x * ((wj * -2.0) + 1.0);
} 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 ((x <= (-1.5d-138)) .or. (.not. (x <= (-2.6d-279)))) then
tmp = x * ((wj * (-2.0d0)) + 1.0d0)
else
tmp = wj * wj
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if ((x <= -1.5e-138) || !(x <= -2.6e-279)) {
tmp = x * ((wj * -2.0) + 1.0);
} else {
tmp = wj * wj;
}
return tmp;
}
def code(wj, x): tmp = 0 if (x <= -1.5e-138) or not (x <= -2.6e-279): tmp = x * ((wj * -2.0) + 1.0) else: tmp = wj * wj return tmp
function code(wj, x) tmp = 0.0 if ((x <= -1.5e-138) || !(x <= -2.6e-279)) tmp = Float64(x * Float64(Float64(wj * -2.0) + 1.0)); else tmp = Float64(wj * wj); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if ((x <= -1.5e-138) || ~((x <= -2.6e-279))) tmp = x * ((wj * -2.0) + 1.0); else tmp = wj * wj; end tmp_2 = tmp; end
code[wj_, x_] := If[Or[LessEqual[x, -1.5e-138], N[Not[LessEqual[x, -2.6e-279]], $MachinePrecision]], N[(x * N[(N[(wj * -2.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(wj * wj), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-138} \lor \neg \left(x \leq -2.6 \cdot 10^{-279}\right):\\
\;\;\;\;x \cdot \left(wj \cdot -2 + 1\right)\\
\mathbf{else}:\\
\;\;\;\;wj \cdot wj\\
\end{array}
\end{array}
if x < -1.5e-138 or -2.6000000000000002e-279 < x Initial program 83.1%
sub-neg83.1%
div-sub83.1%
sub-neg83.1%
+-commutative83.1%
distribute-neg-in83.1%
remove-double-neg83.1%
sub-neg83.1%
div-sub83.1%
distribute-rgt1-in84.0%
associate-/l/84.0%
Simplified84.9%
Taylor expanded in wj around 0 92.1%
Taylor expanded in x around 0 92.1%
if -1.5e-138 < x < -2.6000000000000002e-279Initial program 19.4%
sub-neg19.4%
div-sub19.4%
sub-neg19.4%
+-commutative19.4%
distribute-neg-in19.4%
remove-double-neg19.4%
sub-neg19.4%
div-sub19.4%
distribute-rgt1-in22.9%
associate-/l/22.9%
Simplified22.9%
Taylor expanded in wj around 0 19.4%
Taylor expanded in wj around 0 93.9%
Taylor expanded in wj around 0 93.7%
associate-+r+93.7%
remove-double-neg93.7%
unsub-neg93.7%
unpow293.7%
sub-neg93.7%
neg-mul-193.7%
remove-double-neg93.7%
associate-*l*93.7%
*-commutative93.7%
distribute-lft-out93.7%
fma-neg93.8%
Simplified93.8%
Taylor expanded in x around 0 59.2%
unpow259.2%
Simplified59.2%
Final simplification88.5%
(FPCore (wj x) :precision binary64 (if (<= x -1.5e-138) (+ x (* -2.0 (* wj x))) (if (<= x -2.8e-279) (* wj wj) (* x (+ (* wj -2.0) 1.0)))))
double code(double wj, double x) {
double tmp;
if (x <= -1.5e-138) {
tmp = x + (-2.0 * (wj * x));
} else if (x <= -2.8e-279) {
tmp = wj * wj;
} else {
tmp = x * ((wj * -2.0) + 1.0);
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-1.5d-138)) then
tmp = x + ((-2.0d0) * (wj * x))
else if (x <= (-2.8d-279)) then
tmp = wj * wj
else
tmp = x * ((wj * (-2.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (x <= -1.5e-138) {
tmp = x + (-2.0 * (wj * x));
} else if (x <= -2.8e-279) {
tmp = wj * wj;
} else {
tmp = x * ((wj * -2.0) + 1.0);
}
return tmp;
}
def code(wj, x): tmp = 0 if x <= -1.5e-138: tmp = x + (-2.0 * (wj * x)) elif x <= -2.8e-279: tmp = wj * wj else: tmp = x * ((wj * -2.0) + 1.0) return tmp
function code(wj, x) tmp = 0.0 if (x <= -1.5e-138) tmp = Float64(x + Float64(-2.0 * Float64(wj * x))); elseif (x <= -2.8e-279) tmp = Float64(wj * wj); else tmp = Float64(x * Float64(Float64(wj * -2.0) + 1.0)); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (x <= -1.5e-138) tmp = x + (-2.0 * (wj * x)); elseif (x <= -2.8e-279) tmp = wj * wj; else tmp = x * ((wj * -2.0) + 1.0); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[x, -1.5e-138], N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.8e-279], N[(wj * wj), $MachinePrecision], N[(x * N[(N[(wj * -2.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-138}:\\
\;\;\;\;x + -2 \cdot \left(wj \cdot x\right)\\
\mathbf{elif}\;x \leq -2.8 \cdot 10^{-279}:\\
\;\;\;\;wj \cdot wj\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(wj \cdot -2 + 1\right)\\
\end{array}
\end{array}
if x < -1.5e-138Initial program 92.3%
sub-neg92.3%
div-sub92.3%
sub-neg92.3%
+-commutative92.3%
distribute-neg-in92.3%
remove-double-neg92.3%
sub-neg92.3%
div-sub92.3%
distribute-rgt1-in93.3%
associate-/l/93.3%
Simplified94.4%
Taylor expanded in wj around 0 95.8%
if -1.5e-138 < x < -2.8000000000000001e-279Initial program 19.4%
sub-neg19.4%
div-sub19.4%
sub-neg19.4%
+-commutative19.4%
distribute-neg-in19.4%
remove-double-neg19.4%
sub-neg19.4%
div-sub19.4%
distribute-rgt1-in22.9%
associate-/l/22.9%
Simplified22.9%
Taylor expanded in wj around 0 19.4%
Taylor expanded in wj around 0 93.9%
Taylor expanded in wj around 0 93.7%
associate-+r+93.7%
remove-double-neg93.7%
unsub-neg93.7%
unpow293.7%
sub-neg93.7%
neg-mul-193.7%
remove-double-neg93.7%
associate-*l*93.7%
*-commutative93.7%
distribute-lft-out93.7%
fma-neg93.8%
Simplified93.8%
Taylor expanded in x around 0 59.2%
unpow259.2%
Simplified59.2%
if -2.8000000000000001e-279 < x Initial program 76.7%
sub-neg76.7%
div-sub76.7%
sub-neg76.7%
+-commutative76.7%
distribute-neg-in76.7%
remove-double-neg76.7%
sub-neg76.7%
div-sub76.7%
distribute-rgt1-in77.4%
associate-/l/77.4%
Simplified78.2%
Taylor expanded in wj around 0 89.4%
Taylor expanded in x around 0 89.4%
Final simplification88.5%
(FPCore (wj x) :precision binary64 (if (<= x -1.5e-138) x (if (<= x -6e-280) (* wj wj) x)))
double code(double wj, double x) {
double tmp;
if (x <= -1.5e-138) {
tmp = x;
} else if (x <= -6e-280) {
tmp = wj * wj;
} else {
tmp = 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.5d-138)) then
tmp = x
else if (x <= (-6d-280)) then
tmp = wj * wj
else
tmp = x
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (x <= -1.5e-138) {
tmp = x;
} else if (x <= -6e-280) {
tmp = wj * wj;
} else {
tmp = x;
}
return tmp;
}
def code(wj, x): tmp = 0 if x <= -1.5e-138: tmp = x elif x <= -6e-280: tmp = wj * wj else: tmp = x return tmp
function code(wj, x) tmp = 0.0 if (x <= -1.5e-138) tmp = x; elseif (x <= -6e-280) tmp = Float64(wj * wj); else tmp = x; end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (x <= -1.5e-138) tmp = x; elseif (x <= -6e-280) tmp = wj * wj; else tmp = x; end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[x, -1.5e-138], x, If[LessEqual[x, -6e-280], N[(wj * wj), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-138}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq -6 \cdot 10^{-280}:\\
\;\;\;\;wj \cdot wj\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.5e-138 or -5.99999999999999974e-280 < x Initial program 83.1%
sub-neg83.1%
div-sub83.1%
sub-neg83.1%
+-commutative83.1%
distribute-neg-in83.1%
remove-double-neg83.1%
sub-neg83.1%
div-sub83.1%
distribute-rgt1-in84.0%
associate-/l/84.0%
Simplified84.9%
Taylor expanded in wj around 0 91.6%
if -1.5e-138 < x < -5.99999999999999974e-280Initial program 19.4%
sub-neg19.4%
div-sub19.4%
sub-neg19.4%
+-commutative19.4%
distribute-neg-in19.4%
remove-double-neg19.4%
sub-neg19.4%
div-sub19.4%
distribute-rgt1-in22.9%
associate-/l/22.9%
Simplified22.9%
Taylor expanded in wj around 0 19.4%
Taylor expanded in wj around 0 93.9%
Taylor expanded in wj around 0 93.7%
associate-+r+93.7%
remove-double-neg93.7%
unsub-neg93.7%
unpow293.7%
sub-neg93.7%
neg-mul-193.7%
remove-double-neg93.7%
associate-*l*93.7%
*-commutative93.7%
distribute-lft-out93.7%
fma-neg93.8%
Simplified93.8%
Taylor expanded in x around 0 59.2%
unpow259.2%
Simplified59.2%
Final simplification88.1%
(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 76.1%
sub-neg76.1%
div-sub76.1%
sub-neg76.1%
+-commutative76.1%
distribute-neg-in76.1%
remove-double-neg76.1%
sub-neg76.1%
div-sub76.1%
distribute-rgt1-in77.3%
associate-/l/77.3%
Simplified78.1%
Taylor expanded in wj around inf 4.4%
Final simplification4.4%
(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 76.1%
sub-neg76.1%
div-sub76.1%
sub-neg76.1%
+-commutative76.1%
distribute-neg-in76.1%
remove-double-neg76.1%
sub-neg76.1%
div-sub76.1%
distribute-rgt1-in77.3%
associate-/l/77.3%
Simplified78.1%
Taylor expanded in wj around 0 85.3%
Final simplification85.3%
(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 2023238
(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))))))