
(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 18 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))) 4e-9)
(+
(/ x (exp (+ wj (log1p wj))))
(- (- (pow wj 4.0) (- (pow wj 3.0) (pow wj 2.0))) (pow wj 5.0)))
(+ (/ x (* (exp wj) (+ wj 1.0))) (- wj (/ wj (+ wj 1.0)))))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
double tmp;
if ((wj + ((x - t_0) / (exp(wj) + t_0))) <= 4e-9) {
tmp = (x / exp((wj + log1p(wj)))) + ((pow(wj, 4.0) - (pow(wj, 3.0) - pow(wj, 2.0))) - pow(wj, 5.0));
} else {
tmp = (x / (exp(wj) * (wj + 1.0))) + (wj - (wj / (wj + 1.0)));
}
return tmp;
}
public static double code(double wj, double x) {
double t_0 = wj * Math.exp(wj);
double tmp;
if ((wj + ((x - t_0) / (Math.exp(wj) + t_0))) <= 4e-9) {
tmp = (x / Math.exp((wj + Math.log1p(wj)))) + ((Math.pow(wj, 4.0) - (Math.pow(wj, 3.0) - Math.pow(wj, 2.0))) - Math.pow(wj, 5.0));
} else {
tmp = (x / (Math.exp(wj) * (wj + 1.0))) + (wj - (wj / (wj + 1.0)));
}
return tmp;
}
def code(wj, x): t_0 = wj * math.exp(wj) tmp = 0 if (wj + ((x - t_0) / (math.exp(wj) + t_0))) <= 4e-9: tmp = (x / math.exp((wj + math.log1p(wj)))) + ((math.pow(wj, 4.0) - (math.pow(wj, 3.0) - math.pow(wj, 2.0))) - math.pow(wj, 5.0)) else: tmp = (x / (math.exp(wj) * (wj + 1.0))) + (wj - (wj / (wj + 1.0))) 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))) <= 4e-9) tmp = Float64(Float64(x / exp(Float64(wj + log1p(wj)))) + Float64(Float64((wj ^ 4.0) - Float64((wj ^ 3.0) - (wj ^ 2.0))) - (wj ^ 5.0))); else tmp = Float64(Float64(x / Float64(exp(wj) * Float64(wj + 1.0))) + Float64(wj - Float64(wj / Float64(wj + 1.0)))); 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], 4e-9], N[(N[(x / N[Exp[N[(wj + N[Log[1 + wj], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[wj, 4.0], $MachinePrecision] - N[(N[Power[wj, 3.0], $MachinePrecision] - N[Power[wj, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[wj, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(N[Exp[wj], $MachinePrecision] * N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 4 \cdot 10^{-9}:\\
\;\;\;\;\frac{x}{e^{wj + \mathsf{log1p}\left(wj\right)}} + \left(\left({wj}^{4} - \left({wj}^{3} - {wj}^{2}\right)\right) - {wj}^{5}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{e^{wj} \cdot \left(wj + 1\right)} + \left(wj - \frac{wj}{wj + 1}\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))))) < 4.00000000000000025e-9Initial program 72.7%
sub-neg72.7%
div-sub72.7%
sub-neg72.7%
+-commutative72.7%
distribute-neg-in72.7%
remove-double-neg72.7%
sub-neg72.7%
div-sub72.7%
distribute-rgt1-in73.3%
associate-/l/73.3%
Simplified73.3%
+-commutative73.3%
div-sub73.3%
associate-+l-85.9%
associate-/l/85.9%
*-commutative85.9%
add-exp-log84.8%
+-commutative84.8%
log1p-udef84.8%
prod-exp84.8%
Applied egg-rr84.8%
Taylor expanded in wj around 0 98.9%
if 4.00000000000000025e-9 < (-.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-in98.4%
associate-/l/98.3%
Simplified99.7%
+-commutative99.7%
div-sub99.7%
associate-+l-99.7%
associate-/l/99.8%
*-commutative99.8%
add-exp-log97.0%
+-commutative97.0%
log1p-udef97.0%
prod-exp96.9%
Applied egg-rr96.9%
exp-sum97.0%
log1p-udef97.0%
+-commutative97.0%
add-exp-log99.8%
*-commutative99.8%
+-commutative99.8%
Applied egg-rr99.8%
Final simplification99.1%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (* wj (exp wj))))
(if (<= (+ wj (/ (- x t_0) (+ (exp wj) t_0))) 4e-9)
(+
(/ x (exp (+ wj (log1p wj))))
(+ (- (* wj wj) (pow wj 3.0)) (- (pow wj 4.0) (pow wj 5.0))))
(+ (/ x (* (exp wj) (+ wj 1.0))) (- wj (/ wj (+ wj 1.0)))))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
double tmp;
if ((wj + ((x - t_0) / (exp(wj) + t_0))) <= 4e-9) {
tmp = (x / exp((wj + log1p(wj)))) + (((wj * wj) - pow(wj, 3.0)) + (pow(wj, 4.0) - pow(wj, 5.0)));
} else {
tmp = (x / (exp(wj) * (wj + 1.0))) + (wj - (wj / (wj + 1.0)));
}
return tmp;
}
public static double code(double wj, double x) {
double t_0 = wj * Math.exp(wj);
double tmp;
if ((wj + ((x - t_0) / (Math.exp(wj) + t_0))) <= 4e-9) {
tmp = (x / Math.exp((wj + Math.log1p(wj)))) + (((wj * wj) - Math.pow(wj, 3.0)) + (Math.pow(wj, 4.0) - Math.pow(wj, 5.0)));
} else {
tmp = (x / (Math.exp(wj) * (wj + 1.0))) + (wj - (wj / (wj + 1.0)));
}
return tmp;
}
def code(wj, x): t_0 = wj * math.exp(wj) tmp = 0 if (wj + ((x - t_0) / (math.exp(wj) + t_0))) <= 4e-9: tmp = (x / math.exp((wj + math.log1p(wj)))) + (((wj * wj) - math.pow(wj, 3.0)) + (math.pow(wj, 4.0) - math.pow(wj, 5.0))) else: tmp = (x / (math.exp(wj) * (wj + 1.0))) + (wj - (wj / (wj + 1.0))) 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))) <= 4e-9) tmp = Float64(Float64(x / exp(Float64(wj + log1p(wj)))) + Float64(Float64(Float64(wj * wj) - (wj ^ 3.0)) + Float64((wj ^ 4.0) - (wj ^ 5.0)))); else tmp = Float64(Float64(x / Float64(exp(wj) * Float64(wj + 1.0))) + Float64(wj - Float64(wj / Float64(wj + 1.0)))); 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], 4e-9], N[(N[(x / N[Exp[N[(wj + N[Log[1 + wj], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(wj * wj), $MachinePrecision] - N[Power[wj, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[Power[wj, 4.0], $MachinePrecision] - N[Power[wj, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(N[Exp[wj], $MachinePrecision] * N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 4 \cdot 10^{-9}:\\
\;\;\;\;\frac{x}{e^{wj + \mathsf{log1p}\left(wj\right)}} + \left(\left(wj \cdot wj - {wj}^{3}\right) + \left({wj}^{4} - {wj}^{5}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{e^{wj} \cdot \left(wj + 1\right)} + \left(wj - \frac{wj}{wj + 1}\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))))) < 4.00000000000000025e-9Initial program 72.7%
sub-neg72.7%
div-sub72.7%
sub-neg72.7%
+-commutative72.7%
distribute-neg-in72.7%
remove-double-neg72.7%
sub-neg72.7%
div-sub72.7%
distribute-rgt1-in73.3%
associate-/l/73.3%
Simplified73.3%
+-commutative73.3%
div-sub73.3%
associate-+l-85.9%
associate-/l/85.9%
*-commutative85.9%
add-exp-log84.8%
+-commutative84.8%
log1p-udef84.8%
prod-exp84.8%
Applied egg-rr84.8%
Taylor expanded in wj around 0 98.9%
associate-+r+98.9%
+-commutative98.9%
+-commutative98.9%
mul-1-neg98.9%
unsub-neg98.9%
unpow298.9%
mul-1-neg98.9%
unsub-neg98.9%
Simplified98.9%
if 4.00000000000000025e-9 < (-.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-in98.4%
associate-/l/98.3%
Simplified99.7%
+-commutative99.7%
div-sub99.7%
associate-+l-99.7%
associate-/l/99.8%
*-commutative99.8%
add-exp-log97.0%
+-commutative97.0%
log1p-udef97.0%
prod-exp96.9%
Applied egg-rr96.9%
exp-sum97.0%
log1p-udef97.0%
+-commutative97.0%
add-exp-log99.8%
*-commutative99.8%
+-commutative99.8%
Applied egg-rr99.8%
Final simplification99.1%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (* wj (exp wj))))
(if (<= (+ wj (/ (- x t_0) (+ (exp wj) t_0))) 4e-9)
(+
(/ x (exp (+ wj (log1p wj))))
(- (pow wj 4.0) (- (pow wj 3.0) (* wj wj))))
(+ (/ x (* (exp wj) (+ wj 1.0))) (- wj (/ wj (+ wj 1.0)))))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
double tmp;
if ((wj + ((x - t_0) / (exp(wj) + t_0))) <= 4e-9) {
tmp = (x / exp((wj + log1p(wj)))) + (pow(wj, 4.0) - (pow(wj, 3.0) - (wj * wj)));
} else {
tmp = (x / (exp(wj) * (wj + 1.0))) + (wj - (wj / (wj + 1.0)));
}
return tmp;
}
public static double code(double wj, double x) {
double t_0 = wj * Math.exp(wj);
double tmp;
if ((wj + ((x - t_0) / (Math.exp(wj) + t_0))) <= 4e-9) {
tmp = (x / Math.exp((wj + Math.log1p(wj)))) + (Math.pow(wj, 4.0) - (Math.pow(wj, 3.0) - (wj * wj)));
} else {
tmp = (x / (Math.exp(wj) * (wj + 1.0))) + (wj - (wj / (wj + 1.0)));
}
return tmp;
}
def code(wj, x): t_0 = wj * math.exp(wj) tmp = 0 if (wj + ((x - t_0) / (math.exp(wj) + t_0))) <= 4e-9: tmp = (x / math.exp((wj + math.log1p(wj)))) + (math.pow(wj, 4.0) - (math.pow(wj, 3.0) - (wj * wj))) else: tmp = (x / (math.exp(wj) * (wj + 1.0))) + (wj - (wj / (wj + 1.0))) 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))) <= 4e-9) tmp = Float64(Float64(x / exp(Float64(wj + log1p(wj)))) + Float64((wj ^ 4.0) - Float64((wj ^ 3.0) - Float64(wj * wj)))); else tmp = Float64(Float64(x / Float64(exp(wj) * Float64(wj + 1.0))) + Float64(wj - Float64(wj / Float64(wj + 1.0)))); 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], 4e-9], N[(N[(x / N[Exp[N[(wj + N[Log[1 + wj], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Power[wj, 4.0], $MachinePrecision] - N[(N[Power[wj, 3.0], $MachinePrecision] - N[(wj * wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(N[Exp[wj], $MachinePrecision] * N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 4 \cdot 10^{-9}:\\
\;\;\;\;\frac{x}{e^{wj + \mathsf{log1p}\left(wj\right)}} + \left({wj}^{4} - \left({wj}^{3} - wj \cdot wj\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{e^{wj} \cdot \left(wj + 1\right)} + \left(wj - \frac{wj}{wj + 1}\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))))) < 4.00000000000000025e-9Initial program 72.7%
sub-neg72.7%
div-sub72.7%
sub-neg72.7%
+-commutative72.7%
distribute-neg-in72.7%
remove-double-neg72.7%
sub-neg72.7%
div-sub72.7%
distribute-rgt1-in73.3%
associate-/l/73.3%
Simplified73.3%
+-commutative73.3%
div-sub73.3%
associate-+l-85.9%
associate-/l/85.9%
*-commutative85.9%
add-exp-log84.8%
+-commutative84.8%
log1p-udef84.8%
prod-exp84.8%
Applied egg-rr84.8%
Taylor expanded in wj around 0 98.8%
+-commutative98.8%
mul-1-neg98.8%
unsub-neg98.8%
+-commutative98.8%
mul-1-neg98.8%
unsub-neg98.8%
unpow298.8%
Simplified98.8%
if 4.00000000000000025e-9 < (-.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-in98.4%
associate-/l/98.3%
Simplified99.7%
+-commutative99.7%
div-sub99.7%
associate-+l-99.7%
associate-/l/99.8%
*-commutative99.8%
add-exp-log97.0%
+-commutative97.0%
log1p-udef97.0%
prod-exp96.9%
Applied egg-rr96.9%
exp-sum97.0%
log1p-udef97.0%
+-commutative97.0%
add-exp-log99.8%
*-commutative99.8%
+-commutative99.8%
Applied egg-rr99.8%
Final simplification99.1%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (* wj (exp wj))))
(if (<= (+ wj (/ (- x t_0) (+ (exp wj) t_0))) 4e-9)
(+ (/ x (+ (* wj 2.0) 1.0)) (- (pow wj 4.0) (- (pow wj 3.0) (* wj wj))))
(+ (/ x (* (exp wj) (+ wj 1.0))) (- wj (/ wj (+ wj 1.0)))))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
double tmp;
if ((wj + ((x - t_0) / (exp(wj) + t_0))) <= 4e-9) {
tmp = (x / ((wj * 2.0) + 1.0)) + (pow(wj, 4.0) - (pow(wj, 3.0) - (wj * wj)));
} else {
tmp = (x / (exp(wj) * (wj + 1.0))) + (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) :: tmp
t_0 = wj * exp(wj)
if ((wj + ((x - t_0) / (exp(wj) + t_0))) <= 4d-9) then
tmp = (x / ((wj * 2.0d0) + 1.0d0)) + ((wj ** 4.0d0) - ((wj ** 3.0d0) - (wj * wj)))
else
tmp = (x / (exp(wj) * (wj + 1.0d0))) + (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 tmp;
if ((wj + ((x - t_0) / (Math.exp(wj) + t_0))) <= 4e-9) {
tmp = (x / ((wj * 2.0) + 1.0)) + (Math.pow(wj, 4.0) - (Math.pow(wj, 3.0) - (wj * wj)));
} else {
tmp = (x / (Math.exp(wj) * (wj + 1.0))) + (wj - (wj / (wj + 1.0)));
}
return tmp;
}
def code(wj, x): t_0 = wj * math.exp(wj) tmp = 0 if (wj + ((x - t_0) / (math.exp(wj) + t_0))) <= 4e-9: tmp = (x / ((wj * 2.0) + 1.0)) + (math.pow(wj, 4.0) - (math.pow(wj, 3.0) - (wj * wj))) else: tmp = (x / (math.exp(wj) * (wj + 1.0))) + (wj - (wj / (wj + 1.0))) 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))) <= 4e-9) tmp = Float64(Float64(x / Float64(Float64(wj * 2.0) + 1.0)) + Float64((wj ^ 4.0) - Float64((wj ^ 3.0) - Float64(wj * wj)))); else tmp = Float64(Float64(x / Float64(exp(wj) * Float64(wj + 1.0))) + Float64(wj - Float64(wj / Float64(wj + 1.0)))); end return tmp end
function tmp_2 = code(wj, x) t_0 = wj * exp(wj); tmp = 0.0; if ((wj + ((x - t_0) / (exp(wj) + t_0))) <= 4e-9) tmp = (x / ((wj * 2.0) + 1.0)) + ((wj ^ 4.0) - ((wj ^ 3.0) - (wj * wj))); else tmp = (x / (exp(wj) * (wj + 1.0))) + (wj - (wj / (wj + 1.0))); end tmp_2 = 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], 4e-9], N[(N[(x / N[(N[(wj * 2.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[Power[wj, 4.0], $MachinePrecision] - N[(N[Power[wj, 3.0], $MachinePrecision] - N[(wj * wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(N[Exp[wj], $MachinePrecision] * N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 4 \cdot 10^{-9}:\\
\;\;\;\;\frac{x}{wj \cdot 2 + 1} + \left({wj}^{4} - \left({wj}^{3} - wj \cdot wj\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{e^{wj} \cdot \left(wj + 1\right)} + \left(wj - \frac{wj}{wj + 1}\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))))) < 4.00000000000000025e-9Initial program 72.7%
sub-neg72.7%
div-sub72.7%
sub-neg72.7%
+-commutative72.7%
distribute-neg-in72.7%
remove-double-neg72.7%
sub-neg72.7%
div-sub72.7%
distribute-rgt1-in73.3%
associate-/l/73.3%
Simplified73.3%
+-commutative73.3%
div-sub73.3%
associate-+l-85.9%
associate-/l/85.9%
*-commutative85.9%
add-exp-log84.8%
+-commutative84.8%
log1p-udef84.8%
prod-exp84.8%
Applied egg-rr84.8%
Taylor expanded in wj around 0 98.8%
+-commutative98.8%
mul-1-neg98.8%
unsub-neg98.8%
+-commutative98.8%
mul-1-neg98.8%
unsub-neg98.8%
unpow298.8%
Simplified98.8%
Taylor expanded in wj around 0 98.7%
*-commutative84.7%
Simplified98.7%
if 4.00000000000000025e-9 < (-.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-in98.4%
associate-/l/98.3%
Simplified99.7%
+-commutative99.7%
div-sub99.7%
associate-+l-99.7%
associate-/l/99.8%
*-commutative99.8%
add-exp-log97.0%
+-commutative97.0%
log1p-udef97.0%
prod-exp96.9%
Applied egg-rr96.9%
exp-sum97.0%
log1p-udef97.0%
+-commutative97.0%
add-exp-log99.8%
*-commutative99.8%
+-commutative99.8%
Applied egg-rr99.8%
Final simplification99.0%
(FPCore (wj x)
:precision binary64
(if (<= x 2.4e-39)
(+
(*
(pow wj 3.0)
(-
(- (- -1.0 (* -2.0 (+ (* x -4.0) (* x 1.5)))) (* x -3.0))
(* x 0.6666666666666666)))
(+ (* (* wj wj) (- 1.0 (* x -2.5))) (+ x (* -2.0 (* wj x)))))
(+ wj (/ (- (* x (exp (- wj))) wj) (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (x <= 2.4e-39) {
tmp = (pow(wj, 3.0) * (((-1.0 - (-2.0 * ((x * -4.0) + (x * 1.5)))) - (x * -3.0)) - (x * 0.6666666666666666))) + (((wj * wj) * (1.0 - (x * -2.5))) + (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 (x <= 2.4d-39) then
tmp = ((wj ** 3.0d0) * ((((-1.0d0) - ((-2.0d0) * ((x * (-4.0d0)) + (x * 1.5d0)))) - (x * (-3.0d0))) - (x * 0.6666666666666666d0))) + (((wj * wj) * (1.0d0 - (x * (-2.5d0)))) + (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 (x <= 2.4e-39) {
tmp = (Math.pow(wj, 3.0) * (((-1.0 - (-2.0 * ((x * -4.0) + (x * 1.5)))) - (x * -3.0)) - (x * 0.6666666666666666))) + (((wj * wj) * (1.0 - (x * -2.5))) + (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 x <= 2.4e-39: tmp = (math.pow(wj, 3.0) * (((-1.0 - (-2.0 * ((x * -4.0) + (x * 1.5)))) - (x * -3.0)) - (x * 0.6666666666666666))) + (((wj * wj) * (1.0 - (x * -2.5))) + (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 (x <= 2.4e-39) 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(Float64(wj * wj) * Float64(1.0 - Float64(x * -2.5))) + 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 (x <= 2.4e-39) tmp = ((wj ^ 3.0) * (((-1.0 - (-2.0 * ((x * -4.0) + (x * 1.5)))) - (x * -3.0)) - (x * 0.6666666666666666))) + (((wj * wj) * (1.0 - (x * -2.5))) + (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[x, 2.4e-39], 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[(N[(wj * wj), $MachinePrecision] * N[(1.0 - N[(x * -2.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(N[(N[(x * N[Exp[(-wj)], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.4 \cdot 10^{-39}:\\
\;\;\;\;{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(\left(wj \cdot wj\right) \cdot \left(1 - x \cdot -2.5\right) + \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 x < 2.40000000000000016e-39Initial program 70.9%
sub-neg70.9%
div-sub70.9%
sub-neg70.9%
+-commutative70.9%
distribute-neg-in70.9%
remove-double-neg70.9%
sub-neg70.9%
div-sub70.9%
distribute-rgt1-in71.4%
associate-/l/71.4%
Simplified72.0%
Taylor expanded in wj around 0 97.9%
pow197.9%
distribute-rgt-out97.9%
metadata-eval97.9%
pow297.9%
Applied egg-rr97.9%
unpow197.9%
unpow297.9%
*-commutative97.9%
unpow297.9%
Simplified97.9%
if 2.40000000000000016e-39 < x Initial program 97.1%
sub-neg97.1%
div-sub97.1%
sub-neg97.1%
+-commutative97.1%
distribute-neg-in97.1%
remove-double-neg97.1%
sub-neg97.1%
div-sub97.1%
distribute-rgt1-in99.6%
associate-/l/99.7%
Simplified99.7%
clear-num99.5%
associate-/r/99.7%
rec-exp99.8%
Applied egg-rr99.8%
Final simplification98.5%
(FPCore (wj x)
:precision binary64
(if (<= x 4e-39)
(-
(+ (* wj wj) (+ x (* -2.0 (* wj x))))
(*
(pow wj 3.0)
(+
(* x 0.6666666666666666)
(+ (* x -3.0) (+ (* -2.0 (+ (* x -4.0) (* x 1.5))) 1.0)))))
(+ wj (/ (- (* x (exp (- wj))) wj) (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (x <= 4e-39) {
tmp = ((wj * wj) + (x + (-2.0 * (wj * x)))) - (pow(wj, 3.0) * ((x * 0.6666666666666666) + ((x * -3.0) + ((-2.0 * ((x * -4.0) + (x * 1.5))) + 1.0))));
} 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 (x <= 4d-39) then
tmp = ((wj * wj) + (x + ((-2.0d0) * (wj * x)))) - ((wj ** 3.0d0) * ((x * 0.6666666666666666d0) + ((x * (-3.0d0)) + (((-2.0d0) * ((x * (-4.0d0)) + (x * 1.5d0))) + 1.0d0))))
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 (x <= 4e-39) {
tmp = ((wj * wj) + (x + (-2.0 * (wj * x)))) - (Math.pow(wj, 3.0) * ((x * 0.6666666666666666) + ((x * -3.0) + ((-2.0 * ((x * -4.0) + (x * 1.5))) + 1.0))));
} else {
tmp = wj + (((x * Math.exp(-wj)) - wj) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if x <= 4e-39: tmp = ((wj * wj) + (x + (-2.0 * (wj * x)))) - (math.pow(wj, 3.0) * ((x * 0.6666666666666666) + ((x * -3.0) + ((-2.0 * ((x * -4.0) + (x * 1.5))) + 1.0)))) else: tmp = wj + (((x * math.exp(-wj)) - wj) / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (x <= 4e-39) tmp = Float64(Float64(Float64(wj * wj) + Float64(x + Float64(-2.0 * Float64(wj * x)))) - Float64((wj ^ 3.0) * Float64(Float64(x * 0.6666666666666666) + Float64(Float64(x * -3.0) + Float64(Float64(-2.0 * Float64(Float64(x * -4.0) + Float64(x * 1.5))) + 1.0))))); 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 (x <= 4e-39) tmp = ((wj * wj) + (x + (-2.0 * (wj * x)))) - ((wj ^ 3.0) * ((x * 0.6666666666666666) + ((x * -3.0) + ((-2.0 * ((x * -4.0) + (x * 1.5))) + 1.0)))); else tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[x, 4e-39], N[(N[(N[(wj * wj), $MachinePrecision] + N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Power[wj, 3.0], $MachinePrecision] * N[(N[(x * 0.6666666666666666), $MachinePrecision] + N[(N[(x * -3.0), $MachinePrecision] + N[(N[(-2.0 * N[(N[(x * -4.0), $MachinePrecision] + N[(x * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $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}
\mathbf{if}\;x \leq 4 \cdot 10^{-39}:\\
\;\;\;\;\left(wj \cdot wj + \left(x + -2 \cdot \left(wj \cdot x\right)\right)\right) - {wj}^{3} \cdot \left(x \cdot 0.6666666666666666 + \left(x \cdot -3 + \left(-2 \cdot \left(x \cdot -4 + x \cdot 1.5\right) + 1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{x \cdot e^{-wj} - wj}{wj + 1}\\
\end{array}
\end{array}
if x < 3.99999999999999972e-39Initial program 70.9%
sub-neg70.9%
div-sub70.9%
sub-neg70.9%
+-commutative70.9%
distribute-neg-in70.9%
remove-double-neg70.9%
sub-neg70.9%
div-sub70.9%
distribute-rgt1-in71.4%
associate-/l/71.4%
Simplified72.0%
Taylor expanded in wj around 0 97.9%
Taylor expanded in x around 0 97.6%
unpow297.6%
Simplified97.6%
if 3.99999999999999972e-39 < x Initial program 97.1%
sub-neg97.1%
div-sub97.1%
sub-neg97.1%
+-commutative97.1%
distribute-neg-in97.1%
remove-double-neg97.1%
sub-neg97.1%
div-sub97.1%
distribute-rgt1-in99.6%
associate-/l/99.7%
Simplified99.7%
clear-num99.5%
associate-/r/99.7%
rec-exp99.8%
Applied egg-rr99.8%
Final simplification98.3%
(FPCore (wj x)
:precision binary64
(if (<= wj -6.4e-9)
(+ wj (/ (- (* x (exp (- wj))) wj) (+ wj 1.0)))
(+
(+ x (* -2.0 (* wj x)))
(* (pow wj 2.0) (- 1.0 (+ (* x -4.0) (* x 1.5)))))))
double code(double wj, double x) {
double tmp;
if (wj <= -6.4e-9) {
tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (pow(wj, 2.0) * (1.0 - ((x * -4.0) + (x * 1.5))));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-6.4d-9)) then
tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0d0))
else
tmp = (x + ((-2.0d0) * (wj * x))) + ((wj ** 2.0d0) * (1.0d0 - ((x * (-4.0d0)) + (x * 1.5d0))))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -6.4e-9) {
tmp = wj + (((x * Math.exp(-wj)) - wj) / (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (Math.pow(wj, 2.0) * (1.0 - ((x * -4.0) + (x * 1.5))));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -6.4e-9: tmp = wj + (((x * math.exp(-wj)) - wj) / (wj + 1.0)) else: tmp = (x + (-2.0 * (wj * x))) + (math.pow(wj, 2.0) * (1.0 - ((x * -4.0) + (x * 1.5)))) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -6.4e-9) tmp = Float64(wj + Float64(Float64(Float64(x * exp(Float64(-wj))) - wj) / Float64(wj + 1.0))); else tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64((wj ^ 2.0) * Float64(1.0 - Float64(Float64(x * -4.0) + Float64(x * 1.5))))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -6.4e-9) tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0)); else tmp = (x + (-2.0 * (wj * x))) + ((wj ^ 2.0) * (1.0 - ((x * -4.0) + (x * 1.5)))); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -6.4e-9], N[(wj + N[(N[(N[(x * N[Exp[(-wj)], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[wj, 2.0], $MachinePrecision] * N[(1.0 - N[(N[(x * -4.0), $MachinePrecision] + N[(x * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -6.4 \cdot 10^{-9}:\\
\;\;\;\;wj + \frac{x \cdot e^{-wj} - wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + {wj}^{2} \cdot \left(1 - \left(x \cdot -4 + x \cdot 1.5\right)\right)\\
\end{array}
\end{array}
if wj < -6.40000000000000023e-9Initial program 61.7%
sub-neg61.7%
div-sub61.7%
sub-neg61.7%
+-commutative61.7%
distribute-neg-in61.7%
remove-double-neg61.7%
sub-neg61.7%
div-sub61.7%
distribute-rgt1-in86.5%
associate-/l/86.8%
Simplified86.8%
clear-num86.8%
associate-/r/86.9%
rec-exp86.9%
Applied egg-rr86.9%
if -6.40000000000000023e-9 < wj Initial program 80.0%
sub-neg80.0%
div-sub80.0%
sub-neg80.0%
+-commutative80.0%
distribute-neg-in80.0%
remove-double-neg80.0%
sub-neg80.0%
div-sub80.0%
distribute-rgt1-in80.0%
associate-/l/80.0%
Simplified80.4%
Taylor expanded in wj around 0 98.2%
Final simplification97.7%
(FPCore (wj x) :precision binary64 (if (<= wj -6.4e-9) (+ wj (/ (- (* x (exp (- wj))) wj) (+ wj 1.0))) (+ (+ x (* -2.0 (* wj x))) (* (pow wj 2.0) (+ x (+ x 1.0))))))
double code(double wj, double x) {
double tmp;
if (wj <= -6.4e-9) {
tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (pow(wj, 2.0) * (x + (x + 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 <= (-6.4d-9)) then
tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0d0))
else
tmp = (x + ((-2.0d0) * (wj * x))) + ((wj ** 2.0d0) * (x + (x + 1.0d0)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -6.4e-9) {
tmp = wj + (((x * Math.exp(-wj)) - wj) / (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (Math.pow(wj, 2.0) * (x + (x + 1.0)));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -6.4e-9: tmp = wj + (((x * math.exp(-wj)) - wj) / (wj + 1.0)) else: tmp = (x + (-2.0 * (wj * x))) + (math.pow(wj, 2.0) * (x + (x + 1.0))) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -6.4e-9) tmp = Float64(wj + Float64(Float64(Float64(x * exp(Float64(-wj))) - wj) / Float64(wj + 1.0))); else tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64((wj ^ 2.0) * Float64(x + Float64(x + 1.0)))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -6.4e-9) tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0)); else tmp = (x + (-2.0 * (wj * x))) + ((wj ^ 2.0) * (x + (x + 1.0))); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -6.4e-9], N[(wj + N[(N[(N[(x * N[Exp[(-wj)], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[wj, 2.0], $MachinePrecision] * N[(x + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -6.4 \cdot 10^{-9}:\\
\;\;\;\;wj + \frac{x \cdot e^{-wj} - wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + {wj}^{2} \cdot \left(x + \left(x + 1\right)\right)\\
\end{array}
\end{array}
if wj < -6.40000000000000023e-9Initial program 61.7%
sub-neg61.7%
div-sub61.7%
sub-neg61.7%
+-commutative61.7%
distribute-neg-in61.7%
remove-double-neg61.7%
sub-neg61.7%
div-sub61.7%
distribute-rgt1-in86.5%
associate-/l/86.8%
Simplified86.8%
clear-num86.8%
associate-/r/86.9%
rec-exp86.9%
Applied egg-rr86.9%
if -6.40000000000000023e-9 < wj Initial program 80.0%
sub-neg80.0%
div-sub80.0%
sub-neg80.0%
+-commutative80.0%
distribute-neg-in80.0%
remove-double-neg80.0%
sub-neg80.0%
div-sub80.0%
distribute-rgt1-in80.0%
associate-/l/80.0%
Simplified80.4%
Taylor expanded in wj around 0 79.5%
+-commutative79.5%
mul-1-neg79.5%
unsub-neg79.5%
*-commutative79.5%
Simplified79.5%
Taylor expanded in wj around 0 98.1%
Final simplification97.6%
(FPCore (wj x) :precision binary64 (+ (/ x (* (exp wj) (+ wj 1.0))) (- wj (/ wj (+ wj 1.0)))))
double code(double wj, double x) {
return (x / (exp(wj) * (wj + 1.0))) + (wj - (wj / (wj + 1.0)));
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = (x / (exp(wj) * (wj + 1.0d0))) + (wj - (wj / (wj + 1.0d0)))
end function
public static double code(double wj, double x) {
return (x / (Math.exp(wj) * (wj + 1.0))) + (wj - (wj / (wj + 1.0)));
}
def code(wj, x): return (x / (math.exp(wj) * (wj + 1.0))) + (wj - (wj / (wj + 1.0)))
function code(wj, x) return Float64(Float64(x / Float64(exp(wj) * Float64(wj + 1.0))) + Float64(wj - Float64(wj / Float64(wj + 1.0)))) end
function tmp = code(wj, x) tmp = (x / (exp(wj) * (wj + 1.0))) + (wj - (wj / (wj + 1.0))); end
code[wj_, x_] := N[(N[(x / N[(N[Exp[wj], $MachinePrecision] * N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{e^{wj} \cdot \left(wj + 1\right)} + \left(wj - \frac{wj}{wj + 1}\right)
\end{array}
Initial program 79.2%
sub-neg79.2%
div-sub79.2%
sub-neg79.2%
+-commutative79.2%
distribute-neg-in79.2%
remove-double-neg79.2%
sub-neg79.2%
div-sub79.2%
distribute-rgt1-in80.3%
associate-/l/80.3%
Simplified80.7%
+-commutative80.7%
div-sub80.7%
associate-+l-89.8%
associate-/l/89.8%
*-commutative89.8%
add-exp-log88.2%
+-commutative88.2%
log1p-udef88.2%
prod-exp88.2%
Applied egg-rr88.2%
exp-sum88.2%
log1p-udef88.2%
+-commutative88.2%
add-exp-log89.8%
*-commutative89.8%
+-commutative89.8%
Applied egg-rr89.8%
Final simplification89.8%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (/ wj (+ wj 1.0))))
(if (<= wj -6.4e-16)
(+ wj (/ (- (* x (exp (- wj))) wj) (+ wj 1.0)))
(if (<= wj -2.45e-23)
(* (- wj) (expm1 (- wj)))
(-
(/ x (+ (* wj 2.0) 1.0))
(/ (- (* t_0 t_0) (* wj wj)) (+ wj t_0)))))))
double code(double wj, double x) {
double t_0 = wj / (wj + 1.0);
double tmp;
if (wj <= -6.4e-16) {
tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0));
} else if (wj <= -2.45e-23) {
tmp = -wj * expm1(-wj);
} else {
tmp = (x / ((wj * 2.0) + 1.0)) - (((t_0 * t_0) - (wj * wj)) / (wj + t_0));
}
return tmp;
}
public static double code(double wj, double x) {
double t_0 = wj / (wj + 1.0);
double tmp;
if (wj <= -6.4e-16) {
tmp = wj + (((x * Math.exp(-wj)) - wj) / (wj + 1.0));
} else if (wj <= -2.45e-23) {
tmp = -wj * Math.expm1(-wj);
} else {
tmp = (x / ((wj * 2.0) + 1.0)) - (((t_0 * t_0) - (wj * wj)) / (wj + t_0));
}
return tmp;
}
def code(wj, x): t_0 = wj / (wj + 1.0) tmp = 0 if wj <= -6.4e-16: tmp = wj + (((x * math.exp(-wj)) - wj) / (wj + 1.0)) elif wj <= -2.45e-23: tmp = -wj * math.expm1(-wj) else: tmp = (x / ((wj * 2.0) + 1.0)) - (((t_0 * t_0) - (wj * wj)) / (wj + t_0)) return tmp
function code(wj, x) t_0 = Float64(wj / Float64(wj + 1.0)) tmp = 0.0 if (wj <= -6.4e-16) tmp = Float64(wj + Float64(Float64(Float64(x * exp(Float64(-wj))) - wj) / Float64(wj + 1.0))); elseif (wj <= -2.45e-23) tmp = Float64(Float64(-wj) * expm1(Float64(-wj))); else tmp = Float64(Float64(x / Float64(Float64(wj * 2.0) + 1.0)) - Float64(Float64(Float64(t_0 * t_0) - Float64(wj * wj)) / Float64(wj + t_0))); end return tmp end
code[wj_, x_] := Block[{t$95$0 = N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[wj, -6.4e-16], N[(wj + N[(N[(N[(x * N[Exp[(-wj)], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, -2.45e-23], N[((-wj) * N[(Exp[(-wj)] - 1), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(N[(wj * 2.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(wj * wj), $MachinePrecision]), $MachinePrecision] / N[(wj + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{wj}{wj + 1}\\
\mathbf{if}\;wj \leq -6.4 \cdot 10^{-16}:\\
\;\;\;\;wj + \frac{x \cdot e^{-wj} - wj}{wj + 1}\\
\mathbf{elif}\;wj \leq -2.45 \cdot 10^{-23}:\\
\;\;\;\;\left(-wj\right) \cdot \mathsf{expm1}\left(-wj\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{wj \cdot 2 + 1} - \frac{t_0 \cdot t_0 - wj \cdot wj}{wj + t_0}\\
\end{array}
\end{array}
if wj < -6.40000000000000046e-16Initial program 64.7%
sub-neg64.7%
div-sub64.7%
sub-neg64.7%
+-commutative64.7%
distribute-neg-in64.7%
remove-double-neg64.7%
sub-neg64.7%
div-sub64.7%
distribute-rgt1-in87.5%
associate-/l/87.7%
Simplified87.7%
clear-num87.8%
associate-/r/87.9%
rec-exp87.9%
Applied egg-rr87.9%
if -6.40000000000000046e-16 < wj < -2.4499999999999999e-23Initial program 11.1%
distribute-rgt1-in11.1%
Simplified11.1%
Taylor expanded in wj around 0 11.1%
+-commutative11.1%
unpow211.1%
Simplified11.1%
Taylor expanded in wj around -inf 10.8%
associate-*r*10.8%
neg-mul-110.8%
rec-exp11.0%
neg-mul-111.0%
expm1-def99.1%
neg-mul-199.1%
Simplified99.1%
if -2.4499999999999999e-23 < wj Initial program 81.4%
sub-neg81.4%
div-sub81.4%
sub-neg81.4%
+-commutative81.4%
distribute-neg-in81.4%
remove-double-neg81.4%
sub-neg81.4%
div-sub81.4%
distribute-rgt1-in81.4%
associate-/l/81.4%
Simplified81.8%
+-commutative81.8%
div-sub81.8%
associate-+l-91.6%
associate-/l/91.6%
*-commutative91.6%
add-exp-log91.6%
+-commutative91.6%
log1p-udef91.6%
prod-exp91.5%
Applied egg-rr91.5%
flip--91.5%
+-commutative91.5%
+-commutative91.5%
+-commutative91.5%
Applied egg-rr91.5%
Taylor expanded in wj around 0 90.6%
*-commutative90.6%
Simplified90.6%
Final simplification90.7%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (/ wj (+ wj 1.0))))
(if (<= wj -6.5e-16)
(+ wj (/ (- (/ x (exp wj)) wj) (+ wj 1.0)))
(if (<= wj -1.55e-23)
(* (- wj) (expm1 (- wj)))
(-
(/ x (+ (* wj 2.0) 1.0))
(/ (- (* t_0 t_0) (* wj wj)) (+ wj t_0)))))))
double code(double wj, double x) {
double t_0 = wj / (wj + 1.0);
double tmp;
if (wj <= -6.5e-16) {
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0));
} else if (wj <= -1.55e-23) {
tmp = -wj * expm1(-wj);
} else {
tmp = (x / ((wj * 2.0) + 1.0)) - (((t_0 * t_0) - (wj * wj)) / (wj + t_0));
}
return tmp;
}
public static double code(double wj, double x) {
double t_0 = wj / (wj + 1.0);
double tmp;
if (wj <= -6.5e-16) {
tmp = wj + (((x / Math.exp(wj)) - wj) / (wj + 1.0));
} else if (wj <= -1.55e-23) {
tmp = -wj * Math.expm1(-wj);
} else {
tmp = (x / ((wj * 2.0) + 1.0)) - (((t_0 * t_0) - (wj * wj)) / (wj + t_0));
}
return tmp;
}
def code(wj, x): t_0 = wj / (wj + 1.0) tmp = 0 if wj <= -6.5e-16: tmp = wj + (((x / math.exp(wj)) - wj) / (wj + 1.0)) elif wj <= -1.55e-23: tmp = -wj * math.expm1(-wj) else: tmp = (x / ((wj * 2.0) + 1.0)) - (((t_0 * t_0) - (wj * wj)) / (wj + t_0)) return tmp
function code(wj, x) t_0 = Float64(wj / Float64(wj + 1.0)) tmp = 0.0 if (wj <= -6.5e-16) tmp = Float64(wj + Float64(Float64(Float64(x / exp(wj)) - wj) / Float64(wj + 1.0))); elseif (wj <= -1.55e-23) tmp = Float64(Float64(-wj) * expm1(Float64(-wj))); else tmp = Float64(Float64(x / Float64(Float64(wj * 2.0) + 1.0)) - Float64(Float64(Float64(t_0 * t_0) - Float64(wj * wj)) / Float64(wj + t_0))); end return tmp end
code[wj_, x_] := Block[{t$95$0 = N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[wj, -6.5e-16], N[(wj + N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, -1.55e-23], N[((-wj) * N[(Exp[(-wj)] - 1), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(N[(wj * 2.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(wj * wj), $MachinePrecision]), $MachinePrecision] / N[(wj + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{wj}{wj + 1}\\
\mathbf{if}\;wj \leq -6.5 \cdot 10^{-16}:\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\
\mathbf{elif}\;wj \leq -1.55 \cdot 10^{-23}:\\
\;\;\;\;\left(-wj\right) \cdot \mathsf{expm1}\left(-wj\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{wj \cdot 2 + 1} - \frac{t_0 \cdot t_0 - wj \cdot wj}{wj + t_0}\\
\end{array}
\end{array}
if wj < -6.50000000000000011e-16Initial program 64.7%
sub-neg64.7%
div-sub64.7%
sub-neg64.7%
+-commutative64.7%
distribute-neg-in64.7%
remove-double-neg64.7%
sub-neg64.7%
div-sub64.7%
distribute-rgt1-in87.5%
associate-/l/87.7%
Simplified87.7%
if -6.50000000000000011e-16 < wj < -1.5499999999999999e-23Initial program 11.1%
distribute-rgt1-in11.1%
Simplified11.1%
Taylor expanded in wj around 0 11.1%
+-commutative11.1%
unpow211.1%
Simplified11.1%
Taylor expanded in wj around -inf 10.8%
associate-*r*10.8%
neg-mul-110.8%
rec-exp11.0%
neg-mul-111.0%
expm1-def99.1%
neg-mul-199.1%
Simplified99.1%
if -1.5499999999999999e-23 < wj Initial program 81.4%
sub-neg81.4%
div-sub81.4%
sub-neg81.4%
+-commutative81.4%
distribute-neg-in81.4%
remove-double-neg81.4%
sub-neg81.4%
div-sub81.4%
distribute-rgt1-in81.4%
associate-/l/81.4%
Simplified81.8%
+-commutative81.8%
div-sub81.8%
associate-+l-91.6%
associate-/l/91.6%
*-commutative91.6%
add-exp-log91.6%
+-commutative91.6%
log1p-udef91.6%
prod-exp91.5%
Applied egg-rr91.5%
flip--91.5%
+-commutative91.5%
+-commutative91.5%
+-commutative91.5%
Applied egg-rr91.5%
Taylor expanded in wj around 0 90.6%
*-commutative90.6%
Simplified90.6%
Final simplification90.6%
(FPCore (wj x) :precision binary64 (let* ((t_0 (/ wj (+ wj 1.0)))) (- (/ x (+ (* wj 2.0) 1.0)) (/ (- (* t_0 t_0) (* wj wj)) (+ wj t_0)))))
double code(double wj, double x) {
double t_0 = wj / (wj + 1.0);
return (x / ((wj * 2.0) + 1.0)) - (((t_0 * t_0) - (wj * wj)) / (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 / (wj + 1.0d0)
code = (x / ((wj * 2.0d0) + 1.0d0)) - (((t_0 * t_0) - (wj * wj)) / (wj + t_0))
end function
public static double code(double wj, double x) {
double t_0 = wj / (wj + 1.0);
return (x / ((wj * 2.0) + 1.0)) - (((t_0 * t_0) - (wj * wj)) / (wj + t_0));
}
def code(wj, x): t_0 = wj / (wj + 1.0) return (x / ((wj * 2.0) + 1.0)) - (((t_0 * t_0) - (wj * wj)) / (wj + t_0))
function code(wj, x) t_0 = Float64(wj / Float64(wj + 1.0)) return Float64(Float64(x / Float64(Float64(wj * 2.0) + 1.0)) - Float64(Float64(Float64(t_0 * t_0) - Float64(wj * wj)) / Float64(wj + t_0))) end
function tmp = code(wj, x) t_0 = wj / (wj + 1.0); tmp = (x / ((wj * 2.0) + 1.0)) - (((t_0 * t_0) - (wj * wj)) / (wj + t_0)); end
code[wj_, x_] := Block[{t$95$0 = N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]}, N[(N[(x / N[(N[(wj * 2.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(wj * wj), $MachinePrecision]), $MachinePrecision] / N[(wj + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{wj}{wj + 1}\\
\frac{x}{wj \cdot 2 + 1} - \frac{t_0 \cdot t_0 - wj \cdot wj}{wj + t_0}
\end{array}
\end{array}
Initial program 79.2%
sub-neg79.2%
div-sub79.2%
sub-neg79.2%
+-commutative79.2%
distribute-neg-in79.2%
remove-double-neg79.2%
sub-neg79.2%
div-sub79.2%
distribute-rgt1-in80.3%
associate-/l/80.3%
Simplified80.7%
+-commutative80.7%
div-sub80.7%
associate-+l-89.8%
associate-/l/89.8%
*-commutative89.8%
add-exp-log88.2%
+-commutative88.2%
log1p-udef88.2%
prod-exp88.2%
Applied egg-rr88.2%
flip--88.2%
+-commutative88.2%
+-commutative88.2%
+-commutative88.2%
Applied egg-rr88.2%
Taylor expanded in wj around 0 87.3%
*-commutative87.3%
Simplified87.3%
Final simplification87.3%
(FPCore (wj x) :precision binary64 (if (<= wj -5.3e-17) (+ wj (/ (- (- x (* wj x)) wj) (+ wj 1.0))) (/ (* x (- 1.0 wj)) (+ wj 1.0))))
double code(double wj, double x) {
double tmp;
if (wj <= -5.3e-17) {
tmp = wj + (((x - (wj * x)) - wj) / (wj + 1.0));
} else {
tmp = (x * (1.0 - 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 <= (-5.3d-17)) then
tmp = wj + (((x - (wj * x)) - wj) / (wj + 1.0d0))
else
tmp = (x * (1.0d0 - wj)) / (wj + 1.0d0)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -5.3e-17) {
tmp = wj + (((x - (wj * x)) - wj) / (wj + 1.0));
} else {
tmp = (x * (1.0 - wj)) / (wj + 1.0);
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -5.3e-17: tmp = wj + (((x - (wj * x)) - wj) / (wj + 1.0)) else: tmp = (x * (1.0 - wj)) / (wj + 1.0) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -5.3e-17) tmp = Float64(wj + Float64(Float64(Float64(x - Float64(wj * x)) - wj) / Float64(wj + 1.0))); else tmp = Float64(Float64(x * Float64(1.0 - wj)) / Float64(wj + 1.0)); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -5.3e-17) tmp = wj + (((x - (wj * x)) - wj) / (wj + 1.0)); else tmp = (x * (1.0 - wj)) / (wj + 1.0); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -5.3e-17], N[(wj + N[(N[(N[(x - N[(wj * x), $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(1.0 - wj), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -5.3 \cdot 10^{-17}:\\
\;\;\;\;wj + \frac{\left(x - wj \cdot x\right) - wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(1 - wj\right)}{wj + 1}\\
\end{array}
\end{array}
if wj < -5.2999999999999998e-17Initial program 59.1%
sub-neg59.1%
div-sub59.1%
sub-neg59.1%
+-commutative59.1%
distribute-neg-in59.1%
remove-double-neg59.1%
sub-neg59.1%
div-sub59.1%
distribute-rgt1-in78.9%
associate-/l/79.0%
Simplified79.0%
Taylor expanded in wj around 0 52.7%
+-commutative52.7%
mul-1-neg52.7%
unsub-neg52.7%
*-commutative52.7%
Simplified52.7%
if -5.2999999999999998e-17 < wj Initial program 80.4%
sub-neg80.4%
div-sub80.4%
sub-neg80.4%
+-commutative80.4%
distribute-neg-in80.4%
remove-double-neg80.4%
sub-neg80.4%
div-sub80.4%
distribute-rgt1-in80.4%
associate-/l/80.4%
Simplified80.8%
Taylor expanded in wj around 0 79.9%
+-commutative79.9%
mul-1-neg79.9%
unsub-neg79.9%
*-commutative79.9%
Simplified79.9%
add-cbrt-cube36.0%
associate--l-36.0%
+-commutative36.0%
associate--l-36.0%
+-commutative36.0%
associate--l-36.0%
+-commutative36.0%
Applied egg-rr36.0%
Taylor expanded in x around -inf 88.3%
*-commutative88.3%
neg-mul-188.3%
sub-neg88.3%
+-commutative88.3%
Simplified88.3%
Final simplification86.3%
(FPCore (wj x) :precision binary64 (/ x (/ (+ wj 1.0) (- 1.0 wj))))
double code(double wj, double x) {
return x / ((wj + 1.0) / (1.0 - wj));
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = x / ((wj + 1.0d0) / (1.0d0 - wj))
end function
public static double code(double wj, double x) {
return x / ((wj + 1.0) / (1.0 - wj));
}
def code(wj, x): return x / ((wj + 1.0) / (1.0 - wj))
function code(wj, x) return Float64(x / Float64(Float64(wj + 1.0) / Float64(1.0 - wj))) end
function tmp = code(wj, x) tmp = x / ((wj + 1.0) / (1.0 - wj)); end
code[wj_, x_] := N[(x / N[(N[(wj + 1.0), $MachinePrecision] / N[(1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{wj + 1}{1 - wj}}
\end{array}
Initial program 79.2%
sub-neg79.2%
div-sub79.2%
sub-neg79.2%
+-commutative79.2%
distribute-neg-in79.2%
remove-double-neg79.2%
sub-neg79.2%
div-sub79.2%
distribute-rgt1-in80.3%
associate-/l/80.3%
Simplified80.7%
Taylor expanded in wj around 0 78.3%
+-commutative78.3%
mul-1-neg78.3%
unsub-neg78.3%
*-commutative78.3%
Simplified78.3%
Taylor expanded in x around -inf 84.6%
*-commutative84.6%
associate-/l*84.6%
+-commutative84.6%
neg-mul-184.6%
sub-neg84.6%
Simplified84.6%
Final simplification84.6%
(FPCore (wj x) :precision binary64 (/ (* x (- 1.0 wj)) (+ wj 1.0)))
double code(double wj, double x) {
return (x * (1.0 - wj)) / (wj + 1.0);
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = (x * (1.0d0 - wj)) / (wj + 1.0d0)
end function
public static double code(double wj, double x) {
return (x * (1.0 - wj)) / (wj + 1.0);
}
def code(wj, x): return (x * (1.0 - wj)) / (wj + 1.0)
function code(wj, x) return Float64(Float64(x * Float64(1.0 - wj)) / Float64(wj + 1.0)) end
function tmp = code(wj, x) tmp = (x * (1.0 - wj)) / (wj + 1.0); end
code[wj_, x_] := N[(N[(x * N[(1.0 - wj), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(1 - wj\right)}{wj + 1}
\end{array}
Initial program 79.2%
sub-neg79.2%
div-sub79.2%
sub-neg79.2%
+-commutative79.2%
distribute-neg-in79.2%
remove-double-neg79.2%
sub-neg79.2%
div-sub79.2%
distribute-rgt1-in80.3%
associate-/l/80.3%
Simplified80.7%
Taylor expanded in wj around 0 78.3%
+-commutative78.3%
mul-1-neg78.3%
unsub-neg78.3%
*-commutative78.3%
Simplified78.3%
add-cbrt-cube37.4%
associate--l-37.4%
+-commutative37.4%
associate--l-37.4%
+-commutative37.4%
associate--l-37.4%
+-commutative37.4%
Applied egg-rr37.4%
Taylor expanded in x around -inf 84.6%
*-commutative84.6%
neg-mul-184.6%
sub-neg84.6%
+-commutative84.6%
Simplified84.6%
Final simplification84.6%
(FPCore (wj x) :precision binary64 (+ x (* -2.0 (* wj x))))
double code(double wj, double x) {
return x + (-2.0 * (wj * x));
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = x + ((-2.0d0) * (wj * x))
end function
public static double code(double wj, double x) {
return x + (-2.0 * (wj * x));
}
def code(wj, x): return x + (-2.0 * (wj * x))
function code(wj, x) return Float64(x + Float64(-2.0 * Float64(wj * x))) end
function tmp = code(wj, x) tmp = x + (-2.0 * (wj * x)); end
code[wj_, x_] := N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + -2 \cdot \left(wj \cdot x\right)
\end{array}
Initial program 79.2%
sub-neg79.2%
div-sub79.2%
sub-neg79.2%
+-commutative79.2%
distribute-neg-in79.2%
remove-double-neg79.2%
sub-neg79.2%
div-sub79.2%
distribute-rgt1-in80.3%
associate-/l/80.3%
Simplified80.7%
Taylor expanded in wj around 0 84.4%
Final simplification84.4%
(FPCore (wj x) :precision binary64 wj)
double code(double wj, double x) {
return wj;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = wj
end function
public static double code(double wj, double x) {
return wj;
}
def code(wj, x): return wj
function code(wj, x) return wj end
function tmp = code(wj, x) tmp = wj; end
code[wj_, x_] := wj
\begin{array}{l}
\\
wj
\end{array}
Initial program 79.2%
sub-neg79.2%
div-sub79.2%
sub-neg79.2%
+-commutative79.2%
distribute-neg-in79.2%
remove-double-neg79.2%
sub-neg79.2%
div-sub79.2%
distribute-rgt1-in80.3%
associate-/l/80.3%
Simplified80.7%
Taylor expanded in wj around inf 4.2%
Final simplification4.2%
(FPCore (wj x) :precision binary64 x)
double code(double wj, double x) {
return x;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = x
end function
public static double code(double wj, double x) {
return x;
}
def code(wj, x): return x
function code(wj, x) return x end
function tmp = code(wj, x) tmp = x; end
code[wj_, x_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 79.2%
sub-neg79.2%
div-sub79.2%
sub-neg79.2%
+-commutative79.2%
distribute-neg-in79.2%
remove-double-neg79.2%
sub-neg79.2%
div-sub79.2%
distribute-rgt1-in80.3%
associate-/l/80.3%
Simplified80.7%
Taylor expanded in wj around 0 83.7%
Final simplification83.7%
(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 2023240
(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))))))