
(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 15 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 -4.3e-7)
(+ wj (/ (- (* x (exp (- wj))) wj) (+ wj 1.0)))
(if (<= wj 6.2e-7)
(+ x (+ (* -2.0 (* wj x)) (- (* wj wj) (pow wj 3.0))))
(- wj (/ (- wj (/ x (exp wj))) (+ wj 1.0))))))
double code(double wj, double x) {
double tmp;
if (wj <= -4.3e-7) {
tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0));
} else if (wj <= 6.2e-7) {
tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) - pow(wj, 3.0)));
} else {
tmp = wj - ((wj - (x / exp(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.3d-7)) then
tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0d0))
else if (wj <= 6.2d-7) then
tmp = x + (((-2.0d0) * (wj * x)) + ((wj * wj) - (wj ** 3.0d0)))
else
tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -4.3e-7) {
tmp = wj + (((x * Math.exp(-wj)) - wj) / (wj + 1.0));
} else if (wj <= 6.2e-7) {
tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) - Math.pow(wj, 3.0)));
} else {
tmp = wj - ((wj - (x / Math.exp(wj))) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -4.3e-7: tmp = wj + (((x * math.exp(-wj)) - wj) / (wj + 1.0)) elif wj <= 6.2e-7: tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) - math.pow(wj, 3.0))) else: tmp = wj - ((wj - (x / math.exp(wj))) / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -4.3e-7) tmp = Float64(wj + Float64(Float64(Float64(x * exp(Float64(-wj))) - wj) / Float64(wj + 1.0))); elseif (wj <= 6.2e-7) tmp = Float64(x + Float64(Float64(-2.0 * Float64(wj * x)) + Float64(Float64(wj * wj) - (wj ^ 3.0)))); else tmp = Float64(wj - Float64(Float64(wj - Float64(x / exp(wj))) / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -4.3e-7) tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0)); elseif (wj <= 6.2e-7) tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) - (wj ^ 3.0))); else tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -4.3e-7], N[(wj + N[(N[(N[(x * N[Exp[(-wj)], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 6.2e-7], N[(x + N[(N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision] + N[(N[(wj * wj), $MachinePrecision] - N[Power[wj, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj - N[(N[(wj - N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -4.3 \cdot 10^{-7}:\\
\;\;\;\;wj + \frac{x \cdot e^{-wj} - wj}{wj + 1}\\
\mathbf{elif}\;wj \leq 6.2 \cdot 10^{-7}:\\
\;\;\;\;x + \left(-2 \cdot \left(wj \cdot x\right) + \left(wj \cdot wj - {wj}^{3}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj - \frac{x}{e^{wj}}}{wj + 1}\\
\end{array}
\end{array}
if wj < -4.3000000000000001e-7Initial program 55.5%
div-sub55.6%
associate-/l*55.9%
distribute-rgt1-in55.9%
associate-/l*55.9%
*-inverses55.9%
/-rgt-identity55.9%
distribute-rgt1-in97.6%
associate-/l/97.6%
div-sub97.6%
Simplified97.6%
clear-num97.7%
associate-/r/97.7%
rec-exp97.8%
Applied egg-rr97.8%
if -4.3000000000000001e-7 < wj < 6.1999999999999999e-7Initial program 78.8%
div-sub78.8%
associate-/l*78.8%
distribute-rgt1-in78.8%
associate-/l*78.8%
*-inverses78.8%
/-rgt-identity78.8%
distribute-rgt1-in78.8%
associate-/l/78.8%
div-sub78.8%
Simplified78.8%
Taylor expanded in wj around 0 99.9%
Taylor expanded in x around 0 99.9%
unpow299.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in wj around 0 99.9%
neg-mul-199.9%
+-commutative99.9%
unsub-neg99.9%
unpow299.9%
Simplified99.9%
if 6.1999999999999999e-7 < wj Initial program 20.0%
div-sub20.0%
associate-/l*20.0%
distribute-rgt1-in20.0%
associate-/l*20.0%
*-inverses100.0%
/-rgt-identity100.0%
distribute-rgt1-in100.0%
associate-/l/100.0%
div-sub100.0%
Simplified100.0%
Final simplification99.8%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (* wj (exp wj))) (t_1 (+ (* x -4.0) (* x 1.5))))
(if (<= (+ wj (/ (- x t_0) (+ (exp wj) t_0))) 2e-13)
(+
x
(+
(* -2.0 (* wj x))
(+
(*
(pow wj 3.0)
(- -1.0 (+ (* x -3.0) (+ (* -2.0 t_1) (* x 0.6666666666666666)))))
(* (pow wj 2.0) (- 1.0 t_1)))))
(+ wj (/ (- (* x (exp (- wj))) wj) (+ wj 1.0))))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
double t_1 = (x * -4.0) + (x * 1.5);
double tmp;
if ((wj + ((x - t_0) / (exp(wj) + t_0))) <= 2e-13) {
tmp = x + ((-2.0 * (wj * x)) + ((pow(wj, 3.0) * (-1.0 - ((x * -3.0) + ((-2.0 * t_1) + (x * 0.6666666666666666))))) + (pow(wj, 2.0) * (1.0 - t_1))));
} 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 = (x * (-4.0d0)) + (x * 1.5d0)
if ((wj + ((x - t_0) / (exp(wj) + t_0))) <= 2d-13) then
tmp = x + (((-2.0d0) * (wj * x)) + (((wj ** 3.0d0) * ((-1.0d0) - ((x * (-3.0d0)) + (((-2.0d0) * t_1) + (x * 0.6666666666666666d0))))) + ((wj ** 2.0d0) * (1.0d0 - t_1))))
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 = (x * -4.0) + (x * 1.5);
double tmp;
if ((wj + ((x - t_0) / (Math.exp(wj) + t_0))) <= 2e-13) {
tmp = x + ((-2.0 * (wj * x)) + ((Math.pow(wj, 3.0) * (-1.0 - ((x * -3.0) + ((-2.0 * t_1) + (x * 0.6666666666666666))))) + (Math.pow(wj, 2.0) * (1.0 - t_1))));
} 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 = (x * -4.0) + (x * 1.5) tmp = 0 if (wj + ((x - t_0) / (math.exp(wj) + t_0))) <= 2e-13: tmp = x + ((-2.0 * (wj * x)) + ((math.pow(wj, 3.0) * (-1.0 - ((x * -3.0) + ((-2.0 * t_1) + (x * 0.6666666666666666))))) + (math.pow(wj, 2.0) * (1.0 - t_1)))) 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(Float64(x * -4.0) + Float64(x * 1.5)) tmp = 0.0 if (Float64(wj + Float64(Float64(x - t_0) / Float64(exp(wj) + t_0))) <= 2e-13) tmp = Float64(x + Float64(Float64(-2.0 * Float64(wj * x)) + Float64(Float64((wj ^ 3.0) * Float64(-1.0 - Float64(Float64(x * -3.0) + Float64(Float64(-2.0 * t_1) + Float64(x * 0.6666666666666666))))) + Float64((wj ^ 2.0) * Float64(1.0 - t_1))))); 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 = (x * -4.0) + (x * 1.5); tmp = 0.0; if ((wj + ((x - t_0) / (exp(wj) + t_0))) <= 2e-13) tmp = x + ((-2.0 * (wj * x)) + (((wj ^ 3.0) * (-1.0 - ((x * -3.0) + ((-2.0 * t_1) + (x * 0.6666666666666666))))) + ((wj ^ 2.0) * (1.0 - t_1)))); 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[(N[(x * -4.0), $MachinePrecision] + N[(x * 1.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(wj + N[(N[(x - t$95$0), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e-13], N[(x + N[(N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[wj, 3.0], $MachinePrecision] * N[(-1.0 - N[(N[(x * -3.0), $MachinePrecision] + N[(N[(-2.0 * t$95$1), $MachinePrecision] + N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[wj, 2.0], $MachinePrecision] * N[(1.0 - t$95$1), $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 := x \cdot -4 + x \cdot 1.5\\
\mathbf{if}\;wj + \frac{x - t_0}{e^{wj} + t_0} \leq 2 \cdot 10^{-13}:\\
\;\;\;\;x + \left(-2 \cdot \left(wj \cdot x\right) + \left({wj}^{3} \cdot \left(-1 - \left(x \cdot -3 + \left(-2 \cdot t_1 + x \cdot 0.6666666666666666\right)\right)\right) + {wj}^{2} \cdot \left(1 - t_1\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-13Initial program 71.6%
div-sub71.6%
associate-/l*71.6%
distribute-rgt1-in71.6%
associate-/l*71.6%
*-inverses71.6%
/-rgt-identity71.6%
distribute-rgt1-in72.2%
associate-/l/72.2%
div-sub72.2%
Simplified72.2%
Taylor expanded in wj around 0 98.7%
if 2.0000000000000001e-13 < (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) Initial program 88.7%
div-sub88.7%
associate-/l*88.8%
distribute-rgt1-in88.8%
associate-/l*88.8%
*-inverses94.2%
/-rgt-identity94.2%
distribute-rgt1-in99.6%
associate-/l/99.5%
div-sub99.5%
Simplified99.5%
clear-num99.4%
associate-/r/99.6%
rec-exp99.6%
Applied egg-rr99.6%
Final simplification99.0%
(FPCore (wj x) :precision binary64 (if (or (<= wj -2.9e-6) (not (<= wj 6.6e-9))) (+ wj (/ (- (/ x (exp wj)) wj) (+ wj 1.0))) (+ x (+ (* -2.0 (* wj x)) (* (* wj wj) (+ 1.0 (* x 2.5)))))))
double code(double wj, double x) {
double tmp;
if ((wj <= -2.9e-6) || !(wj <= 6.6e-9)) {
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5))));
}
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-6)) .or. (.not. (wj <= 6.6d-9))) then
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0d0))
else
tmp = x + (((-2.0d0) * (wj * x)) + ((wj * wj) * (1.0d0 + (x * 2.5d0))))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if ((wj <= -2.9e-6) || !(wj <= 6.6e-9)) {
tmp = wj + (((x / Math.exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5))));
}
return tmp;
}
def code(wj, x): tmp = 0 if (wj <= -2.9e-6) or not (wj <= 6.6e-9): tmp = wj + (((x / math.exp(wj)) - wj) / (wj + 1.0)) else: tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5)))) return tmp
function code(wj, x) tmp = 0.0 if ((wj <= -2.9e-6) || !(wj <= 6.6e-9)) tmp = Float64(wj + Float64(Float64(Float64(x / exp(wj)) - wj) / Float64(wj + 1.0))); else tmp = Float64(x + Float64(Float64(-2.0 * Float64(wj * x)) + Float64(Float64(wj * wj) * Float64(1.0 + Float64(x * 2.5))))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if ((wj <= -2.9e-6) || ~((wj <= 6.6e-9))) tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0)); else tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5)))); end tmp_2 = tmp; end
code[wj_, x_] := If[Or[LessEqual[wj, -2.9e-6], N[Not[LessEqual[wj, 6.6e-9]], $MachinePrecision]], N[(wj + N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision] + N[(N[(wj * wj), $MachinePrecision] * N[(1.0 + N[(x * 2.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -2.9 \cdot 10^{-6} \lor \neg \left(wj \leq 6.6 \cdot 10^{-9}\right):\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;x + \left(-2 \cdot \left(wj \cdot x\right) + \left(wj \cdot wj\right) \cdot \left(1 + x \cdot 2.5\right)\right)\\
\end{array}
\end{array}
if wj < -2.9000000000000002e-6 or 6.60000000000000037e-9 < wj Initial program 46.5%
div-sub46.6%
associate-/l*46.8%
distribute-rgt1-in46.8%
associate-/l*46.8%
*-inverses69.0%
/-rgt-identity69.0%
distribute-rgt1-in96.8%
associate-/l/96.8%
div-sub96.8%
Simplified96.8%
if -2.9000000000000002e-6 < wj < 6.60000000000000037e-9Initial program 78.8%
div-sub78.8%
associate-/l*78.8%
distribute-rgt1-in78.8%
associate-/l*78.8%
*-inverses78.8%
/-rgt-identity78.8%
distribute-rgt1-in78.8%
associate-/l/78.8%
div-sub78.8%
Simplified78.8%
clear-num78.7%
associate-/r/78.8%
rec-exp78.8%
Applied egg-rr78.8%
Taylor expanded in wj around 0 78.8%
associate-*r*78.8%
neg-mul-178.8%
associate-*r*78.8%
distribute-rgt-out78.8%
*-commutative78.8%
unpow278.8%
Simplified78.8%
Taylor expanded in wj around 0 99.7%
+-commutative99.7%
fma-def99.7%
unpow299.7%
associate--l+99.7%
distribute-rgt-out--99.7%
metadata-eval99.7%
sub-neg99.7%
mul-1-neg99.7%
distribute-rgt-out99.7%
metadata-eval99.7%
associate-*l*99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
fma-udef99.7%
*-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
Applied egg-rr99.7%
Final simplification99.5%
(FPCore (wj x)
:precision binary64
(if (<= wj -2.9e-6)
(+ wj (/ (- (* x (exp (- wj))) wj) (+ wj 1.0)))
(if (<= wj 8.5e-9)
(+ x (+ (* -2.0 (* wj x)) (* (* wj wj) (+ 1.0 (* x 2.5)))))
(- wj (/ (- wj (/ x (exp wj))) (+ wj 1.0))))))
double code(double wj, double x) {
double tmp;
if (wj <= -2.9e-6) {
tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0));
} else if (wj <= 8.5e-9) {
tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5))));
} else {
tmp = wj - ((wj - (x / exp(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 <= (-2.9d-6)) then
tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0d0))
else if (wj <= 8.5d-9) then
tmp = x + (((-2.0d0) * (wj * x)) + ((wj * wj) * (1.0d0 + (x * 2.5d0))))
else
tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -2.9e-6) {
tmp = wj + (((x * Math.exp(-wj)) - wj) / (wj + 1.0));
} else if (wj <= 8.5e-9) {
tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5))));
} else {
tmp = wj - ((wj - (x / Math.exp(wj))) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -2.9e-6: tmp = wj + (((x * math.exp(-wj)) - wj) / (wj + 1.0)) elif wj <= 8.5e-9: tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5)))) else: tmp = wj - ((wj - (x / math.exp(wj))) / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -2.9e-6) tmp = Float64(wj + Float64(Float64(Float64(x * exp(Float64(-wj))) - wj) / Float64(wj + 1.0))); elseif (wj <= 8.5e-9) tmp = Float64(x + Float64(Float64(-2.0 * Float64(wj * x)) + Float64(Float64(wj * wj) * Float64(1.0 + Float64(x * 2.5))))); else tmp = Float64(wj - Float64(Float64(wj - Float64(x / exp(wj))) / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -2.9e-6) tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0)); elseif (wj <= 8.5e-9) tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5)))); else tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -2.9e-6], N[(wj + N[(N[(N[(x * N[Exp[(-wj)], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 8.5e-9], N[(x + N[(N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision] + N[(N[(wj * wj), $MachinePrecision] * N[(1.0 + N[(x * 2.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj - N[(N[(wj - N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -2.9 \cdot 10^{-6}:\\
\;\;\;\;wj + \frac{x \cdot e^{-wj} - wj}{wj + 1}\\
\mathbf{elif}\;wj \leq 8.5 \cdot 10^{-9}:\\
\;\;\;\;x + \left(-2 \cdot \left(wj \cdot x\right) + \left(wj \cdot wj\right) \cdot \left(1 + x \cdot 2.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj - \frac{x}{e^{wj}}}{wj + 1}\\
\end{array}
\end{array}
if wj < -2.9000000000000002e-6Initial program 51.6%
div-sub51.7%
associate-/l*52.0%
distribute-rgt1-in52.0%
associate-/l*52.0%
*-inverses52.0%
/-rgt-identity52.0%
distribute-rgt1-in97.5%
associate-/l/97.5%
div-sub97.5%
Simplified97.5%
clear-num97.6%
associate-/r/97.5%
rec-exp97.6%
Applied egg-rr97.6%
if -2.9000000000000002e-6 < wj < 8.5e-9Initial program 78.8%
div-sub78.8%
associate-/l*78.8%
distribute-rgt1-in78.8%
associate-/l*78.8%
*-inverses78.8%
/-rgt-identity78.8%
distribute-rgt1-in78.8%
associate-/l/78.8%
div-sub78.8%
Simplified78.8%
clear-num78.7%
associate-/r/78.8%
rec-exp78.8%
Applied egg-rr78.8%
Taylor expanded in wj around 0 78.8%
associate-*r*78.8%
neg-mul-178.8%
associate-*r*78.8%
distribute-rgt-out78.8%
*-commutative78.8%
unpow278.8%
Simplified78.8%
Taylor expanded in wj around 0 99.7%
+-commutative99.7%
fma-def99.7%
unpow299.7%
associate--l+99.7%
distribute-rgt-out--99.7%
metadata-eval99.7%
sub-neg99.7%
mul-1-neg99.7%
distribute-rgt-out99.7%
metadata-eval99.7%
associate-*l*99.7%
*-commutative99.7%
associate-*l*99.7%
Simplified99.7%
fma-udef99.7%
*-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
Applied egg-rr99.7%
if 8.5e-9 < wj Initial program 38.6%
div-sub38.6%
associate-/l*38.6%
distribute-rgt1-in38.6%
associate-/l*38.6%
*-inverses95.7%
/-rgt-identity95.7%
distribute-rgt1-in95.7%
associate-/l/95.7%
div-sub95.7%
Simplified95.7%
Final simplification99.5%
(FPCore (wj x) :precision binary64 (if (<= wj -0.00028) (/ (* x (exp (- wj))) (+ wj 1.0)) (+ x (+ (* -2.0 (* wj x)) (* (* wj wj) (+ 1.0 (* x 2.5)))))))
double code(double wj, double x) {
double tmp;
if (wj <= -0.00028) {
tmp = (x * exp(-wj)) / (wj + 1.0);
} else {
tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5))));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-0.00028d0)) then
tmp = (x * exp(-wj)) / (wj + 1.0d0)
else
tmp = x + (((-2.0d0) * (wj * x)) + ((wj * wj) * (1.0d0 + (x * 2.5d0))))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -0.00028) {
tmp = (x * Math.exp(-wj)) / (wj + 1.0);
} else {
tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5))));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -0.00028: tmp = (x * math.exp(-wj)) / (wj + 1.0) else: tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5)))) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -0.00028) tmp = Float64(Float64(x * exp(Float64(-wj))) / Float64(wj + 1.0)); else tmp = Float64(x + Float64(Float64(-2.0 * Float64(wj * x)) + Float64(Float64(wj * wj) * Float64(1.0 + Float64(x * 2.5))))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -0.00028) tmp = (x * exp(-wj)) / (wj + 1.0); else tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5)))); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -0.00028], N[(N[(x * N[Exp[(-wj)], $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision] + N[(N[(wj * wj), $MachinePrecision] * N[(1.0 + N[(x * 2.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -0.00028:\\
\;\;\;\;\frac{x \cdot e^{-wj}}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;x + \left(-2 \cdot \left(wj \cdot x\right) + \left(wj \cdot wj\right) \cdot \left(1 + x \cdot 2.5\right)\right)\\
\end{array}
\end{array}
if wj < -2.7999999999999998e-4Initial program 49.4%
div-sub49.5%
associate-/l*49.5%
distribute-rgt1-in49.5%
associate-/l*49.5%
*-inverses49.5%
/-rgt-identity49.5%
distribute-rgt1-in99.5%
associate-/l/99.5%
div-sub99.5%
Simplified99.5%
clear-num99.7%
associate-/r/99.5%
rec-exp99.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 87.7%
if -2.7999999999999998e-4 < wj Initial program 77.7%
div-sub77.7%
associate-/l*77.7%
distribute-rgt1-in77.7%
associate-/l*77.7%
*-inverses79.3%
/-rgt-identity79.3%
distribute-rgt1-in79.3%
associate-/l/79.3%
div-sub79.3%
Simplified79.3%
clear-num79.1%
associate-/r/79.3%
rec-exp79.3%
Applied egg-rr79.3%
Taylor expanded in wj around 0 79.0%
associate-*r*79.0%
neg-mul-179.0%
associate-*r*79.0%
distribute-rgt-out79.0%
*-commutative79.0%
unpow279.0%
Simplified79.0%
Taylor expanded in wj around 0 97.5%
+-commutative97.5%
fma-def97.5%
unpow297.5%
associate--l+97.5%
distribute-rgt-out--97.5%
metadata-eval97.5%
sub-neg97.5%
mul-1-neg97.5%
distribute-rgt-out97.5%
metadata-eval97.5%
associate-*l*97.5%
*-commutative97.5%
associate-*l*97.5%
Simplified97.5%
fma-udef97.5%
*-commutative97.5%
*-commutative97.5%
associate-*r*97.5%
Applied egg-rr97.5%
Final simplification97.1%
(FPCore (wj x) :precision binary64 (if (<= wj -0.00044) (/ x (* (exp wj) (+ wj 1.0))) (+ x (+ (* -2.0 (* wj x)) (* (* wj wj) (+ 1.0 (* x 2.5)))))))
double code(double wj, double x) {
double tmp;
if (wj <= -0.00044) {
tmp = x / (exp(wj) * (wj + 1.0));
} else {
tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5))));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-0.00044d0)) then
tmp = x / (exp(wj) * (wj + 1.0d0))
else
tmp = x + (((-2.0d0) * (wj * x)) + ((wj * wj) * (1.0d0 + (x * 2.5d0))))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -0.00044) {
tmp = x / (Math.exp(wj) * (wj + 1.0));
} else {
tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5))));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -0.00044: tmp = x / (math.exp(wj) * (wj + 1.0)) else: tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5)))) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -0.00044) tmp = Float64(x / Float64(exp(wj) * Float64(wj + 1.0))); else tmp = Float64(x + Float64(Float64(-2.0 * Float64(wj * x)) + Float64(Float64(wj * wj) * Float64(1.0 + Float64(x * 2.5))))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -0.00044) tmp = x / (exp(wj) * (wj + 1.0)); else tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5)))); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -0.00044], N[(x / N[(N[Exp[wj], $MachinePrecision] * N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision] + N[(N[(wj * wj), $MachinePrecision] * N[(1.0 + N[(x * 2.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -0.00044:\\
\;\;\;\;\frac{x}{e^{wj} \cdot \left(wj + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;x + \left(-2 \cdot \left(wj \cdot x\right) + \left(wj \cdot wj\right) \cdot \left(1 + x \cdot 2.5\right)\right)\\
\end{array}
\end{array}
if wj < -4.40000000000000016e-4Initial program 49.4%
div-sub49.5%
associate-/l*49.5%
distribute-rgt1-in49.5%
associate-/l*49.5%
*-inverses49.5%
/-rgt-identity49.5%
distribute-rgt1-in99.5%
associate-/l/99.5%
div-sub99.5%
Simplified99.5%
Taylor expanded in x around inf 87.5%
+-commutative87.5%
Simplified87.5%
if -4.40000000000000016e-4 < wj Initial program 77.7%
div-sub77.7%
associate-/l*77.7%
distribute-rgt1-in77.7%
associate-/l*77.7%
*-inverses79.3%
/-rgt-identity79.3%
distribute-rgt1-in79.3%
associate-/l/79.3%
div-sub79.3%
Simplified79.3%
clear-num79.1%
associate-/r/79.3%
rec-exp79.3%
Applied egg-rr79.3%
Taylor expanded in wj around 0 79.0%
associate-*r*79.0%
neg-mul-179.0%
associate-*r*79.0%
distribute-rgt-out79.0%
*-commutative79.0%
unpow279.0%
Simplified79.0%
Taylor expanded in wj around 0 97.5%
+-commutative97.5%
fma-def97.5%
unpow297.5%
associate--l+97.5%
distribute-rgt-out--97.5%
metadata-eval97.5%
sub-neg97.5%
mul-1-neg97.5%
distribute-rgt-out97.5%
metadata-eval97.5%
associate-*l*97.5%
*-commutative97.5%
associate-*l*97.5%
Simplified97.5%
fma-udef97.5%
*-commutative97.5%
*-commutative97.5%
associate-*r*97.5%
Applied egg-rr97.5%
Final simplification97.1%
(FPCore (wj x) :precision binary64 (if (<= wj -1.0) (/ x (* wj (exp wj))) (+ x (+ (* -2.0 (* wj x)) (* (* wj wj) (+ 1.0 (* x 2.5)))))))
double code(double wj, double x) {
double tmp;
if (wj <= -1.0) {
tmp = x / (wj * exp(wj));
} else {
tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5))));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-1.0d0)) then
tmp = x / (wj * exp(wj))
else
tmp = x + (((-2.0d0) * (wj * x)) + ((wj * wj) * (1.0d0 + (x * 2.5d0))))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -1.0) {
tmp = x / (wj * Math.exp(wj));
} else {
tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5))));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -1.0: tmp = x / (wj * math.exp(wj)) else: tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5)))) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -1.0) tmp = Float64(x / Float64(wj * exp(wj))); else tmp = Float64(x + Float64(Float64(-2.0 * Float64(wj * x)) + Float64(Float64(wj * wj) * Float64(1.0 + Float64(x * 2.5))))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -1.0) tmp = x / (wj * exp(wj)); else tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5)))); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -1.0], N[(x / N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision] + N[(N[(wj * wj), $MachinePrecision] * N[(1.0 + N[(x * 2.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -1:\\
\;\;\;\;\frac{x}{wj \cdot e^{wj}}\\
\mathbf{else}:\\
\;\;\;\;x + \left(-2 \cdot \left(wj \cdot x\right) + \left(wj \cdot wj\right) \cdot \left(1 + x \cdot 2.5\right)\right)\\
\end{array}
\end{array}
if wj < -1Initial program 28.3%
div-sub28.3%
associate-/l*28.3%
distribute-rgt1-in28.3%
associate-/l*28.3%
*-inverses28.3%
/-rgt-identity28.3%
distribute-rgt1-in99.8%
associate-/l/100.0%
div-sub100.0%
Simplified100.0%
clear-num100.0%
associate-/r/99.8%
rec-exp100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 100.0%
associate-/l*100.0%
+-commutative100.0%
associate-/r/100.0%
exp-neg99.8%
times-frac99.8%
*-commutative99.8%
*-lft-identity99.8%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in wj around inf 78.8%
if -1 < wj Initial program 77.9%
div-sub77.9%
associate-/l*77.9%
distribute-rgt1-in77.9%
associate-/l*77.9%
*-inverses79.6%
/-rgt-identity79.6%
distribute-rgt1-in79.6%
associate-/l/79.5%
div-sub79.5%
Simplified79.5%
clear-num79.4%
associate-/r/79.5%
rec-exp79.6%
Applied egg-rr79.6%
Taylor expanded in wj around 0 78.9%
associate-*r*78.9%
neg-mul-178.9%
associate-*r*78.9%
distribute-rgt-out78.9%
*-commutative78.9%
unpow278.9%
Simplified78.9%
Taylor expanded in wj around 0 96.9%
+-commutative96.9%
fma-def96.9%
unpow296.9%
associate--l+96.9%
distribute-rgt-out--96.9%
metadata-eval96.9%
sub-neg96.9%
mul-1-neg96.9%
distribute-rgt-out96.9%
metadata-eval96.9%
associate-*l*96.9%
*-commutative96.9%
associate-*l*96.9%
Simplified96.9%
fma-udef96.9%
*-commutative96.9%
*-commutative96.9%
associate-*r*96.9%
Applied egg-rr96.9%
Final simplification96.4%
(FPCore (wj x) :precision binary64 (+ x (+ (* -2.0 (* wj x)) (* (* wj wj) (+ 1.0 (* x 2.5))))))
double code(double wj, double x) {
return x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5))));
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = x + (((-2.0d0) * (wj * x)) + ((wj * wj) * (1.0d0 + (x * 2.5d0))))
end function
public static double code(double wj, double x) {
return x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5))));
}
def code(wj, x): return x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5))))
function code(wj, x) return Float64(x + Float64(Float64(-2.0 * Float64(wj * x)) + Float64(Float64(wj * wj) * Float64(1.0 + Float64(x * 2.5))))) end
function tmp = code(wj, x) tmp = x + ((-2.0 * (wj * x)) + ((wj * wj) * (1.0 + (x * 2.5)))); end
code[wj_, x_] := N[(x + N[(N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision] + N[(N[(wj * wj), $MachinePrecision] * N[(1.0 + N[(x * 2.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(-2 \cdot \left(wj \cdot x\right) + \left(wj \cdot wj\right) \cdot \left(1 + x \cdot 2.5\right)\right)
\end{array}
Initial program 76.6%
div-sub76.6%
associate-/l*76.6%
distribute-rgt1-in76.6%
associate-/l*76.6%
*-inverses78.2%
/-rgt-identity78.2%
distribute-rgt1-in80.1%
associate-/l/80.1%
div-sub80.1%
Simplified80.1%
clear-num79.9%
associate-/r/80.1%
rec-exp80.1%
Applied egg-rr80.1%
Taylor expanded in wj around 0 77.3%
associate-*r*77.3%
neg-mul-177.3%
associate-*r*77.3%
distribute-rgt-out77.3%
*-commutative77.3%
unpow277.3%
Simplified77.3%
Taylor expanded in wj around 0 94.3%
+-commutative94.3%
fma-def94.3%
unpow294.3%
associate--l+94.3%
distribute-rgt-out--94.3%
metadata-eval94.3%
sub-neg94.3%
mul-1-neg94.3%
distribute-rgt-out94.3%
metadata-eval94.3%
associate-*l*94.3%
*-commutative94.3%
associate-*l*94.3%
Simplified94.3%
fma-udef94.3%
*-commutative94.3%
*-commutative94.3%
associate-*r*94.3%
Applied egg-rr94.3%
Final simplification94.3%
(FPCore (wj x) :precision binary64 (if (or (<= x -3e-240) (not (<= x 8e-287))) (/ (- x (* wj x)) (+ wj 1.0)) (* wj wj)))
double code(double wj, double x) {
double tmp;
if ((x <= -3e-240) || !(x <= 8e-287)) {
tmp = (x - (wj * x)) / (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 <= (-3d-240)) .or. (.not. (x <= 8d-287))) then
tmp = (x - (wj * x)) / (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 <= -3e-240) || !(x <= 8e-287)) {
tmp = (x - (wj * x)) / (wj + 1.0);
} else {
tmp = wj * wj;
}
return tmp;
}
def code(wj, x): tmp = 0 if (x <= -3e-240) or not (x <= 8e-287): tmp = (x - (wj * x)) / (wj + 1.0) else: tmp = wj * wj return tmp
function code(wj, x) tmp = 0.0 if ((x <= -3e-240) || !(x <= 8e-287)) tmp = Float64(Float64(x - Float64(wj * x)) / Float64(wj + 1.0)); else tmp = Float64(wj * wj); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if ((x <= -3e-240) || ~((x <= 8e-287))) tmp = (x - (wj * x)) / (wj + 1.0); else tmp = wj * wj; end tmp_2 = tmp; end
code[wj_, x_] := If[Or[LessEqual[x, -3e-240], N[Not[LessEqual[x, 8e-287]], $MachinePrecision]], N[(N[(x - N[(wj * x), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision], N[(wj * wj), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{-240} \lor \neg \left(x \leq 8 \cdot 10^{-287}\right):\\
\;\;\;\;\frac{x - wj \cdot x}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;wj \cdot wj\\
\end{array}
\end{array}
if x < -2.99999999999999991e-240 or 8.00000000000000017e-287 < x Initial program 80.7%
div-sub80.7%
associate-/l*80.7%
distribute-rgt1-in80.7%
associate-/l*80.7%
*-inverses82.4%
/-rgt-identity82.4%
distribute-rgt1-in84.1%
associate-/l/84.0%
div-sub84.0%
Simplified84.0%
clear-num83.9%
associate-/r/84.1%
rec-exp84.1%
Applied egg-rr84.1%
Taylor expanded in x around inf 88.2%
associate-/l*88.1%
+-commutative88.1%
associate-/r/88.2%
exp-neg88.1%
times-frac88.1%
*-commutative88.1%
*-lft-identity88.1%
associate-/l/88.1%
Simplified88.1%
Taylor expanded in wj around 0 85.0%
mul-1-neg85.0%
*-commutative85.0%
Simplified85.0%
if -2.99999999999999991e-240 < x < 8.00000000000000017e-287Initial program 22.3%
div-sub22.3%
associate-/l*22.3%
distribute-rgt1-in22.3%
associate-/l*22.3%
*-inverses22.3%
/-rgt-identity22.3%
distribute-rgt1-in27.8%
associate-/l/27.8%
div-sub27.8%
Simplified27.8%
Taylor expanded in x around 0 12.4%
+-commutative12.4%
Simplified12.4%
flip3--10.4%
Applied egg-rr10.4%
Taylor expanded in wj around 0 64.4%
unpow264.4%
Simplified64.4%
Final simplification83.5%
(FPCore (wj x) :precision binary64 (if (or (<= x -2.6e-243) (not (<= x 9e-287))) (+ x (* -2.0 (* wj x))) (* wj wj)))
double code(double wj, double x) {
double tmp;
if ((x <= -2.6e-243) || !(x <= 9e-287)) {
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 ((x <= (-2.6d-243)) .or. (.not. (x <= 9d-287))) 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 ((x <= -2.6e-243) || !(x <= 9e-287)) {
tmp = x + (-2.0 * (wj * x));
} else {
tmp = wj * wj;
}
return tmp;
}
def code(wj, x): tmp = 0 if (x <= -2.6e-243) or not (x <= 9e-287): tmp = x + (-2.0 * (wj * x)) else: tmp = wj * wj return tmp
function code(wj, x) tmp = 0.0 if ((x <= -2.6e-243) || !(x <= 9e-287)) 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 ((x <= -2.6e-243) || ~((x <= 9e-287))) tmp = x + (-2.0 * (wj * x)); else tmp = wj * wj; end tmp_2 = tmp; end
code[wj_, x_] := If[Or[LessEqual[x, -2.6e-243], N[Not[LessEqual[x, 9e-287]], $MachinePrecision]], N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj * wj), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-243} \lor \neg \left(x \leq 9 \cdot 10^{-287}\right):\\
\;\;\;\;x + -2 \cdot \left(wj \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;wj \cdot wj\\
\end{array}
\end{array}
if x < -2.5999999999999998e-243 or 9.00000000000000034e-287 < x Initial program 80.7%
div-sub80.7%
associate-/l*80.7%
distribute-rgt1-in80.7%
associate-/l*80.7%
*-inverses82.4%
/-rgt-identity82.4%
distribute-rgt1-in84.1%
associate-/l/84.0%
div-sub84.0%
Simplified84.0%
Taylor expanded in wj around 0 84.8%
*-commutative84.8%
Simplified84.8%
if -2.5999999999999998e-243 < x < 9.00000000000000034e-287Initial program 22.3%
div-sub22.3%
associate-/l*22.3%
distribute-rgt1-in22.3%
associate-/l*22.3%
*-inverses22.3%
/-rgt-identity22.3%
distribute-rgt1-in27.8%
associate-/l/27.8%
div-sub27.8%
Simplified27.8%
Taylor expanded in x around 0 12.4%
+-commutative12.4%
Simplified12.4%
flip3--10.4%
Applied egg-rr10.4%
Taylor expanded in wj around 0 64.4%
unpow264.4%
Simplified64.4%
Final simplification83.3%
(FPCore (wj x) :precision binary64 (+ x (+ (* -2.0 (* wj x)) (* wj wj))))
double code(double wj, double x) {
return x + ((-2.0 * (wj * x)) + (wj * wj));
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = x + (((-2.0d0) * (wj * x)) + (wj * wj))
end function
public static double code(double wj, double x) {
return x + ((-2.0 * (wj * x)) + (wj * wj));
}
def code(wj, x): return x + ((-2.0 * (wj * x)) + (wj * wj))
function code(wj, x) return Float64(x + Float64(Float64(-2.0 * Float64(wj * x)) + Float64(wj * wj))) end
function tmp = code(wj, x) tmp = x + ((-2.0 * (wj * x)) + (wj * wj)); end
code[wj_, x_] := N[(x + N[(N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(-2 \cdot \left(wj \cdot x\right) + wj \cdot wj\right)
\end{array}
Initial program 76.6%
div-sub76.6%
associate-/l*76.6%
distribute-rgt1-in76.6%
associate-/l*76.6%
*-inverses78.2%
/-rgt-identity78.2%
distribute-rgt1-in80.1%
associate-/l/80.1%
div-sub80.1%
Simplified80.1%
Taylor expanded in wj around 0 94.7%
Taylor expanded in x around 0 94.4%
unpow294.4%
Simplified94.4%
Taylor expanded in x around 0 94.4%
Taylor expanded in wj around 0 94.0%
unpow294.0%
Simplified94.0%
Final simplification94.0%
(FPCore (wj x) :precision binary64 (if (<= x -4.1e-243) x (if (<= x 4e-287) (* wj wj) x)))
double code(double wj, double x) {
double tmp;
if (x <= -4.1e-243) {
tmp = x;
} else if (x <= 4e-287) {
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 <= (-4.1d-243)) then
tmp = x
else if (x <= 4d-287) 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 <= -4.1e-243) {
tmp = x;
} else if (x <= 4e-287) {
tmp = wj * wj;
} else {
tmp = x;
}
return tmp;
}
def code(wj, x): tmp = 0 if x <= -4.1e-243: tmp = x elif x <= 4e-287: tmp = wj * wj else: tmp = x return tmp
function code(wj, x) tmp = 0.0 if (x <= -4.1e-243) tmp = x; elseif (x <= 4e-287) tmp = Float64(wj * wj); else tmp = x; end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (x <= -4.1e-243) tmp = x; elseif (x <= 4e-287) tmp = wj * wj; else tmp = x; end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[x, -4.1e-243], x, If[LessEqual[x, 4e-287], N[(wj * wj), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.1 \cdot 10^{-243}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-287}:\\
\;\;\;\;wj \cdot wj\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.09999999999999981e-243 or 4.00000000000000009e-287 < x Initial program 80.7%
div-sub80.7%
associate-/l*80.7%
distribute-rgt1-in80.7%
associate-/l*80.7%
*-inverses82.4%
/-rgt-identity82.4%
distribute-rgt1-in84.1%
associate-/l/84.0%
div-sub84.0%
Simplified84.0%
Taylor expanded in wj around 0 83.8%
if -4.09999999999999981e-243 < x < 4.00000000000000009e-287Initial program 22.3%
div-sub22.3%
associate-/l*22.3%
distribute-rgt1-in22.3%
associate-/l*22.3%
*-inverses22.3%
/-rgt-identity22.3%
distribute-rgt1-in27.8%
associate-/l/27.8%
div-sub27.8%
Simplified27.8%
Taylor expanded in x around 0 12.4%
+-commutative12.4%
Simplified12.4%
flip3--10.4%
Applied egg-rr10.4%
Taylor expanded in wj around 0 64.4%
unpow264.4%
Simplified64.4%
Final simplification82.5%
(FPCore (wj x) :precision binary64 (if (<= wj 8.2e-31) x (if (<= wj 1.55e-16) (* wj wj) (+ wj x))))
double code(double wj, double x) {
double tmp;
if (wj <= 8.2e-31) {
tmp = x;
} else if (wj <= 1.55e-16) {
tmp = wj * wj;
} else {
tmp = 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 <= 8.2d-31) then
tmp = x
else if (wj <= 1.55d-16) then
tmp = wj * wj
else
tmp = wj + x
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 8.2e-31) {
tmp = x;
} else if (wj <= 1.55e-16) {
tmp = wj * wj;
} else {
tmp = wj + x;
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 8.2e-31: tmp = x elif wj <= 1.55e-16: tmp = wj * wj else: tmp = wj + x return tmp
function code(wj, x) tmp = 0.0 if (wj <= 8.2e-31) tmp = x; elseif (wj <= 1.55e-16) tmp = Float64(wj * wj); else tmp = Float64(wj + x); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 8.2e-31) tmp = x; elseif (wj <= 1.55e-16) tmp = wj * wj; else tmp = wj + x; end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 8.2e-31], x, If[LessEqual[wj, 1.55e-16], N[(wj * wj), $MachinePrecision], N[(wj + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 8.2 \cdot 10^{-31}:\\
\;\;\;\;x\\
\mathbf{elif}\;wj \leq 1.55 \cdot 10^{-16}:\\
\;\;\;\;wj \cdot wj\\
\mathbf{else}:\\
\;\;\;\;wj + x\\
\end{array}
\end{array}
if wj < 8.1999999999999993e-31Initial program 79.5%
div-sub79.5%
associate-/l*79.5%
distribute-rgt1-in79.5%
associate-/l*79.5%
*-inverses79.5%
/-rgt-identity79.5%
distribute-rgt1-in81.6%
associate-/l/81.6%
div-sub81.6%
Simplified81.6%
Taylor expanded in wj around 0 84.5%
if 8.1999999999999993e-31 < wj < 1.55e-16Initial program 17.6%
div-sub17.6%
associate-/l*17.6%
distribute-rgt1-in17.6%
associate-/l*17.6%
*-inverses17.6%
/-rgt-identity17.6%
distribute-rgt1-in17.6%
associate-/l/17.6%
div-sub17.6%
Simplified17.6%
Taylor expanded in x around 0 5.3%
+-commutative5.3%
Simplified5.3%
flip3--5.2%
Applied egg-rr5.2%
Taylor expanded in wj around 0 70.0%
unpow270.0%
Simplified70.0%
if 1.55e-16 < wj Initial program 59.0%
div-sub59.0%
associate-/l*58.9%
distribute-rgt1-in58.9%
associate-/l*58.9%
*-inverses92.3%
/-rgt-identity92.3%
distribute-rgt1-in92.3%
associate-/l/92.1%
div-sub92.1%
Simplified92.1%
Taylor expanded in wj around 0 52.6%
neg-mul-152.6%
Simplified52.6%
Final simplification82.6%
(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.6%
div-sub76.6%
associate-/l*76.6%
distribute-rgt1-in76.6%
associate-/l*76.6%
*-inverses78.2%
/-rgt-identity78.2%
distribute-rgt1-in80.1%
associate-/l/80.1%
div-sub80.1%
Simplified80.1%
Taylor expanded in wj around inf 4.7%
Final simplification4.7%
(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.6%
div-sub76.6%
associate-/l*76.6%
distribute-rgt1-in76.6%
associate-/l*76.6%
*-inverses78.2%
/-rgt-identity78.2%
distribute-rgt1-in80.1%
associate-/l/80.1%
div-sub80.1%
Simplified80.1%
Taylor expanded in wj around 0 80.1%
Final simplification80.1%
(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 2023271
(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))))))