
(FPCore (wj x) :precision binary64 (let* ((t_0 (* wj (exp wj)))) (- wj (/ (- t_0 x) (+ (exp wj) t_0)))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
return wj - ((t_0 - x) / (exp(wj) + t_0));
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
t_0 = wj * exp(wj)
code = wj - ((t_0 - x) / (exp(wj) + t_0))
end function
public static double code(double wj, double x) {
double t_0 = wj * Math.exp(wj);
return wj - ((t_0 - x) / (Math.exp(wj) + t_0));
}
def code(wj, x): t_0 = wj * math.exp(wj) return wj - ((t_0 - x) / (math.exp(wj) + t_0))
function code(wj, x) t_0 = Float64(wj * exp(wj)) return Float64(wj - Float64(Float64(t_0 - x) / Float64(exp(wj) + t_0))) end
function tmp = code(wj, x) t_0 = wj * exp(wj); tmp = wj - ((t_0 - x) / (exp(wj) + t_0)); end
code[wj_, x_] := Block[{t$95$0 = N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, N[(wj - N[(N[(t$95$0 - x), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := wj \cdot e^{wj}\\
wj - \frac{t_0 - x}{e^{wj} + t_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (wj x) :precision binary64 (let* ((t_0 (* wj (exp wj)))) (- wj (/ (- t_0 x) (+ (exp wj) t_0)))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
return wj - ((t_0 - x) / (exp(wj) + t_0));
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
t_0 = wj * exp(wj)
code = wj - ((t_0 - x) / (exp(wj) + t_0))
end function
public static double code(double wj, double x) {
double t_0 = wj * Math.exp(wj);
return wj - ((t_0 - x) / (Math.exp(wj) + t_0));
}
def code(wj, x): t_0 = wj * math.exp(wj) return wj - ((t_0 - x) / (math.exp(wj) + t_0))
function code(wj, x) t_0 = Float64(wj * exp(wj)) return Float64(wj - Float64(Float64(t_0 - x) / Float64(exp(wj) + t_0))) end
function tmp = code(wj, x) t_0 = wj * exp(wj); tmp = wj - ((t_0 - x) / (exp(wj) + t_0)); end
code[wj_, x_] := Block[{t$95$0 = N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, N[(wj - N[(N[(t$95$0 - x), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := wj \cdot e^{wj}\\
wj - \frac{t_0 - x}{e^{wj} + t_0}
\end{array}
\end{array}
(FPCore (wj x)
:precision binary64
(let* ((t_0 (+ (* x -4.0) (* x 1.5))))
(if (<= wj -1.4e-7)
(- wj (/ (- wj (/ x (exp wj))) (+ wj 1.0)))
(+
(*
(pow wj 3.0)
(- (- (- -1.0 (* -2.0 t_0)) (* x -3.0)) (* x 0.6666666666666666)))
(+ (* (- 1.0 t_0) (pow wj 2.0)) (+ x (* -2.0 (* wj x))))))))
double code(double wj, double x) {
double t_0 = (x * -4.0) + (x * 1.5);
double tmp;
if (wj <= -1.4e-7) {
tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0));
} else {
tmp = (pow(wj, 3.0) * (((-1.0 - (-2.0 * t_0)) - (x * -3.0)) - (x * 0.6666666666666666))) + (((1.0 - t_0) * pow(wj, 2.0)) + (x + (-2.0 * (wj * x))));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = (x * (-4.0d0)) + (x * 1.5d0)
if (wj <= (-1.4d-7)) then
tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0d0))
else
tmp = ((wj ** 3.0d0) * ((((-1.0d0) - ((-2.0d0) * t_0)) - (x * (-3.0d0))) - (x * 0.6666666666666666d0))) + (((1.0d0 - t_0) * (wj ** 2.0d0)) + (x + ((-2.0d0) * (wj * x))))
end if
code = tmp
end function
public static double code(double wj, double x) {
double t_0 = (x * -4.0) + (x * 1.5);
double tmp;
if (wj <= -1.4e-7) {
tmp = wj - ((wj - (x / Math.exp(wj))) / (wj + 1.0));
} else {
tmp = (Math.pow(wj, 3.0) * (((-1.0 - (-2.0 * t_0)) - (x * -3.0)) - (x * 0.6666666666666666))) + (((1.0 - t_0) * Math.pow(wj, 2.0)) + (x + (-2.0 * (wj * x))));
}
return tmp;
}
def code(wj, x): t_0 = (x * -4.0) + (x * 1.5) tmp = 0 if wj <= -1.4e-7: tmp = wj - ((wj - (x / math.exp(wj))) / (wj + 1.0)) else: tmp = (math.pow(wj, 3.0) * (((-1.0 - (-2.0 * t_0)) - (x * -3.0)) - (x * 0.6666666666666666))) + (((1.0 - t_0) * math.pow(wj, 2.0)) + (x + (-2.0 * (wj * x)))) return tmp
function code(wj, x) t_0 = Float64(Float64(x * -4.0) + Float64(x * 1.5)) tmp = 0.0 if (wj <= -1.4e-7) tmp = Float64(wj - Float64(Float64(wj - Float64(x / exp(wj))) / Float64(wj + 1.0))); else tmp = Float64(Float64((wj ^ 3.0) * Float64(Float64(Float64(-1.0 - Float64(-2.0 * t_0)) - Float64(x * -3.0)) - Float64(x * 0.6666666666666666))) + Float64(Float64(Float64(1.0 - t_0) * (wj ^ 2.0)) + Float64(x + Float64(-2.0 * Float64(wj * x))))); end return tmp end
function tmp_2 = code(wj, x) t_0 = (x * -4.0) + (x * 1.5); tmp = 0.0; if (wj <= -1.4e-7) tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0)); else tmp = ((wj ^ 3.0) * (((-1.0 - (-2.0 * t_0)) - (x * -3.0)) - (x * 0.6666666666666666))) + (((1.0 - t_0) * (wj ^ 2.0)) + (x + (-2.0 * (wj * x)))); end tmp_2 = tmp; end
code[wj_, x_] := Block[{t$95$0 = N[(N[(x * -4.0), $MachinePrecision] + N[(x * 1.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[wj, -1.4e-7], N[(wj - N[(N[(wj - N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[wj, 3.0], $MachinePrecision] * N[(N[(N[(-1.0 - N[(-2.0 * t$95$0), $MachinePrecision]), $MachinePrecision] - N[(x * -3.0), $MachinePrecision]), $MachinePrecision] - N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 - t$95$0), $MachinePrecision] * N[Power[wj, 2.0], $MachinePrecision]), $MachinePrecision] + N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot -4 + x \cdot 1.5\\
\mathbf{if}\;wj \leq -1.4 \cdot 10^{-7}:\\
\;\;\;\;wj - \frac{wj - \frac{x}{e^{wj}}}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;{wj}^{3} \cdot \left(\left(\left(-1 - -2 \cdot t_0\right) - x \cdot -3\right) - x \cdot 0.6666666666666666\right) + \left(\left(1 - t_0\right) \cdot {wj}^{2} + \left(x + -2 \cdot \left(wj \cdot x\right)\right)\right)\\
\end{array}
\end{array}
if wj < -1.4000000000000001e-7Initial program 72.6%
sub-neg72.6%
div-sub72.6%
sub-neg72.6%
+-commutative72.6%
distribute-neg-in72.6%
remove-double-neg72.6%
sub-neg72.6%
div-sub72.6%
distribute-rgt1-in97.6%
associate-/l/97.7%
Simplified97.7%
if -1.4000000000000001e-7 < wj Initial program 79.8%
sub-neg79.8%
div-sub79.8%
sub-neg79.8%
+-commutative79.8%
distribute-neg-in79.8%
remove-double-neg79.8%
sub-neg79.8%
div-sub79.8%
distribute-rgt1-in79.8%
associate-/l/79.8%
Simplified80.6%
Taylor expanded in wj around 0 98.8%
Final simplification98.8%
(FPCore (wj x)
:precision binary64
(if (<= wj -9e-9)
(+ wj (pow (/ (+ wj 1.0) (- (/ x (exp wj)) wj)) -1.0))
(+
(* (- 1.0 (+ (* x -4.0) (* x 1.5))) (pow wj 2.0))
(+ x (* -2.0 (* wj x))))))
double code(double wj, double x) {
double tmp;
if (wj <= -9e-9) {
tmp = wj + pow(((wj + 1.0) / ((x / exp(wj)) - wj)), -1.0);
} else {
tmp = ((1.0 - ((x * -4.0) + (x * 1.5))) * pow(wj, 2.0)) + (x + (-2.0 * (wj * x)));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-9d-9)) then
tmp = wj + (((wj + 1.0d0) / ((x / exp(wj)) - wj)) ** (-1.0d0))
else
tmp = ((1.0d0 - ((x * (-4.0d0)) + (x * 1.5d0))) * (wj ** 2.0d0)) + (x + ((-2.0d0) * (wj * x)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -9e-9) {
tmp = wj + Math.pow(((wj + 1.0) / ((x / Math.exp(wj)) - wj)), -1.0);
} else {
tmp = ((1.0 - ((x * -4.0) + (x * 1.5))) * Math.pow(wj, 2.0)) + (x + (-2.0 * (wj * x)));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -9e-9: tmp = wj + math.pow(((wj + 1.0) / ((x / math.exp(wj)) - wj)), -1.0) else: tmp = ((1.0 - ((x * -4.0) + (x * 1.5))) * math.pow(wj, 2.0)) + (x + (-2.0 * (wj * x))) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -9e-9) tmp = Float64(wj + (Float64(Float64(wj + 1.0) / Float64(Float64(x / exp(wj)) - wj)) ^ -1.0)); else tmp = Float64(Float64(Float64(1.0 - Float64(Float64(x * -4.0) + Float64(x * 1.5))) * (wj ^ 2.0)) + Float64(x + Float64(-2.0 * Float64(wj * x)))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -9e-9) tmp = wj + (((wj + 1.0) / ((x / exp(wj)) - wj)) ^ -1.0); else tmp = ((1.0 - ((x * -4.0) + (x * 1.5))) * (wj ^ 2.0)) + (x + (-2.0 * (wj * x))); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -9e-9], N[(wj + N[Power[N[(N[(wj + 1.0), $MachinePrecision] / N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[(N[(x * -4.0), $MachinePrecision] + N[(x * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[wj, 2.0], $MachinePrecision]), $MachinePrecision] + N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -9 \cdot 10^{-9}:\\
\;\;\;\;wj + {\left(\frac{wj + 1}{\frac{x}{e^{wj}} - wj}\right)}^{-1}\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \left(x \cdot -4 + x \cdot 1.5\right)\right) \cdot {wj}^{2} + \left(x + -2 \cdot \left(wj \cdot x\right)\right)\\
\end{array}
\end{array}
if wj < -8.99999999999999953e-9Initial program 71.9%
sub-neg71.9%
div-sub71.9%
sub-neg71.9%
+-commutative71.9%
distribute-neg-in71.9%
remove-double-neg71.9%
sub-neg71.9%
div-sub71.9%
distribute-rgt1-in94.1%
associate-/l/93.9%
Simplified93.9%
clear-num94.1%
inv-pow94.1%
Applied egg-rr94.1%
if -8.99999999999999953e-9 < wj Initial program 79.9%
sub-neg79.9%
div-sub79.9%
sub-neg79.9%
+-commutative79.9%
distribute-neg-in79.9%
remove-double-neg79.9%
sub-neg79.9%
div-sub79.9%
distribute-rgt1-in79.9%
associate-/l/79.9%
Simplified80.7%
Taylor expanded in wj around 0 98.6%
Final simplification98.4%
(FPCore (wj x)
:precision binary64
(if (<= wj -5.4e-9)
(+ (/ (/ x (exp wj)) (+ wj 1.0)) (- wj (/ wj (+ wj 1.0))))
(+
(* (- 1.0 (+ (* x -4.0) (* x 1.5))) (pow wj 2.0))
(+ x (* -2.0 (* wj x))))))
double code(double wj, double x) {
double tmp;
if (wj <= -5.4e-9) {
tmp = ((x / exp(wj)) / (wj + 1.0)) + (wj - (wj / (wj + 1.0)));
} else {
tmp = ((1.0 - ((x * -4.0) + (x * 1.5))) * pow(wj, 2.0)) + (x + (-2.0 * (wj * x)));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-5.4d-9)) then
tmp = ((x / exp(wj)) / (wj + 1.0d0)) + (wj - (wj / (wj + 1.0d0)))
else
tmp = ((1.0d0 - ((x * (-4.0d0)) + (x * 1.5d0))) * (wj ** 2.0d0)) + (x + ((-2.0d0) * (wj * x)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -5.4e-9) {
tmp = ((x / Math.exp(wj)) / (wj + 1.0)) + (wj - (wj / (wj + 1.0)));
} else {
tmp = ((1.0 - ((x * -4.0) + (x * 1.5))) * Math.pow(wj, 2.0)) + (x + (-2.0 * (wj * x)));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -5.4e-9: tmp = ((x / math.exp(wj)) / (wj + 1.0)) + (wj - (wj / (wj + 1.0))) else: tmp = ((1.0 - ((x * -4.0) + (x * 1.5))) * math.pow(wj, 2.0)) + (x + (-2.0 * (wj * x))) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -5.4e-9) tmp = Float64(Float64(Float64(x / exp(wj)) / Float64(wj + 1.0)) + Float64(wj - Float64(wj / Float64(wj + 1.0)))); else tmp = Float64(Float64(Float64(1.0 - Float64(Float64(x * -4.0) + Float64(x * 1.5))) * (wj ^ 2.0)) + Float64(x + Float64(-2.0 * Float64(wj * x)))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -5.4e-9) tmp = ((x / exp(wj)) / (wj + 1.0)) + (wj - (wj / (wj + 1.0))); else tmp = ((1.0 - ((x * -4.0) + (x * 1.5))) * (wj ^ 2.0)) + (x + (-2.0 * (wj * x))); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -5.4e-9], N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision] + N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[(N[(x * -4.0), $MachinePrecision] + N[(x * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[wj, 2.0], $MachinePrecision]), $MachinePrecision] + N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -5.4 \cdot 10^{-9}:\\
\;\;\;\;\frac{\frac{x}{e^{wj}}}{wj + 1} + \left(wj - \frac{wj}{wj + 1}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \left(x \cdot -4 + x \cdot 1.5\right)\right) \cdot {wj}^{2} + \left(x + -2 \cdot \left(wj \cdot x\right)\right)\\
\end{array}
\end{array}
if wj < -5.4000000000000004e-9Initial program 71.9%
sub-neg71.9%
div-sub71.9%
sub-neg71.9%
+-commutative71.9%
distribute-neg-in71.9%
remove-double-neg71.9%
sub-neg71.9%
div-sub71.9%
distribute-rgt1-in94.1%
associate-/l/93.9%
Simplified93.9%
add-cbrt-cube93.3%
pow1/348.6%
pow348.6%
Applied egg-rr48.6%
unpow1/393.3%
rem-cbrt-cube93.9%
+-commutative93.9%
div-sub93.9%
associate-+l-93.9%
+-commutative93.9%
+-commutative93.9%
Applied egg-rr93.9%
if -5.4000000000000004e-9 < wj Initial program 79.9%
sub-neg79.9%
div-sub79.9%
sub-neg79.9%
+-commutative79.9%
distribute-neg-in79.9%
remove-double-neg79.9%
sub-neg79.9%
div-sub79.9%
distribute-rgt1-in79.9%
associate-/l/79.9%
Simplified80.7%
Taylor expanded in wj around 0 98.6%
Final simplification98.4%
(FPCore (wj x) :precision binary64 (if (<= wj -5.4e-9) (+ (/ (/ x (exp wj)) (+ wj 1.0)) (- wj (/ wj (+ wj 1.0)))) (+ (+ x (* -2.0 (* wj x))) (* wj wj))))
double code(double wj, double x) {
double tmp;
if (wj <= -5.4e-9) {
tmp = ((x / exp(wj)) / (wj + 1.0)) + (wj - (wj / (wj + 1.0)));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-5.4d-9)) then
tmp = ((x / exp(wj)) / (wj + 1.0d0)) + (wj - (wj / (wj + 1.0d0)))
else
tmp = (x + ((-2.0d0) * (wj * x))) + (wj * wj)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -5.4e-9) {
tmp = ((x / Math.exp(wj)) / (wj + 1.0)) + (wj - (wj / (wj + 1.0)));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -5.4e-9: tmp = ((x / math.exp(wj)) / (wj + 1.0)) + (wj - (wj / (wj + 1.0))) else: tmp = (x + (-2.0 * (wj * x))) + (wj * wj) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -5.4e-9) tmp = Float64(Float64(Float64(x / exp(wj)) / Float64(wj + 1.0)) + Float64(wj - Float64(wj / Float64(wj + 1.0)))); else tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -5.4e-9) tmp = ((x / exp(wj)) / (wj + 1.0)) + (wj - (wj / (wj + 1.0))); else tmp = (x + (-2.0 * (wj * x))) + (wj * wj); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -5.4e-9], N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision] + N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -5.4 \cdot 10^{-9}:\\
\;\;\;\;\frac{\frac{x}{e^{wj}}}{wj + 1} + \left(wj - \frac{wj}{wj + 1}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\\
\end{array}
\end{array}
if wj < -5.4000000000000004e-9Initial program 71.9%
sub-neg71.9%
div-sub71.9%
sub-neg71.9%
+-commutative71.9%
distribute-neg-in71.9%
remove-double-neg71.9%
sub-neg71.9%
div-sub71.9%
distribute-rgt1-in94.1%
associate-/l/93.9%
Simplified93.9%
add-cbrt-cube93.3%
pow1/348.6%
pow348.6%
Applied egg-rr48.6%
unpow1/393.3%
rem-cbrt-cube93.9%
+-commutative93.9%
div-sub93.9%
associate-+l-93.9%
+-commutative93.9%
+-commutative93.9%
Applied egg-rr93.9%
if -5.4000000000000004e-9 < wj Initial program 79.9%
sub-neg79.9%
div-sub79.9%
sub-neg79.9%
+-commutative79.9%
distribute-neg-in79.9%
remove-double-neg79.9%
sub-neg79.9%
div-sub79.9%
distribute-rgt1-in79.9%
associate-/l/79.9%
Simplified80.7%
Taylor expanded in wj around 0 98.6%
Taylor expanded in x around 0 98.3%
unpow298.3%
Simplified98.3%
Final simplification98.1%
(FPCore (wj x) :precision binary64 (if (<= wj -1.05e-7) (- wj (/ (- wj (/ x (exp wj))) (+ wj 1.0))) (- (+ (+ x (* -2.0 (* wj x))) (* wj wj)) (pow wj 3.0))))
double code(double wj, double x) {
double tmp;
if (wj <= -1.05e-7) {
tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0));
} else {
tmp = ((x + (-2.0 * (wj * x))) + (wj * wj)) - pow(wj, 3.0);
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-1.05d-7)) then
tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0d0))
else
tmp = ((x + ((-2.0d0) * (wj * x))) + (wj * wj)) - (wj ** 3.0d0)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -1.05e-7) {
tmp = wj - ((wj - (x / Math.exp(wj))) / (wj + 1.0));
} else {
tmp = ((x + (-2.0 * (wj * x))) + (wj * wj)) - Math.pow(wj, 3.0);
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -1.05e-7: tmp = wj - ((wj - (x / math.exp(wj))) / (wj + 1.0)) else: tmp = ((x + (-2.0 * (wj * x))) + (wj * wj)) - math.pow(wj, 3.0) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -1.05e-7) tmp = Float64(wj - Float64(Float64(wj - Float64(x / exp(wj))) / Float64(wj + 1.0))); else tmp = Float64(Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)) - (wj ^ 3.0)); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -1.05e-7) tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0)); else tmp = ((x + (-2.0 * (wj * x))) + (wj * wj)) - (wj ^ 3.0); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -1.05e-7], N[(wj - N[(N[(wj - N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision] - N[Power[wj, 3.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -1.05 \cdot 10^{-7}:\\
\;\;\;\;wj - \frac{wj - \frac{x}{e^{wj}}}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\right) - {wj}^{3}\\
\end{array}
\end{array}
if wj < -1.05e-7Initial program 72.6%
sub-neg72.6%
div-sub72.6%
sub-neg72.6%
+-commutative72.6%
distribute-neg-in72.6%
remove-double-neg72.6%
sub-neg72.6%
div-sub72.6%
distribute-rgt1-in97.6%
associate-/l/97.7%
Simplified97.7%
if -1.05e-7 < wj Initial program 79.8%
sub-neg79.8%
div-sub79.8%
sub-neg79.8%
+-commutative79.8%
distribute-neg-in79.8%
remove-double-neg79.8%
sub-neg79.8%
div-sub79.8%
distribute-rgt1-in79.8%
associate-/l/79.8%
Simplified80.6%
Taylor expanded in wj around 0 98.8%
Taylor expanded in x around 0 98.4%
unpow298.1%
Simplified98.4%
Taylor expanded in x around 0 98.4%
Final simplification98.3%
(FPCore (wj x) :precision binary64 (if (<= wj -5.4e-9) (- wj (/ (- wj (/ x (exp wj))) (+ wj 1.0))) (+ (+ x (* -2.0 (* wj x))) (* wj wj))))
double code(double wj, double x) {
double tmp;
if (wj <= -5.4e-9) {
tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-5.4d-9)) then
tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0d0))
else
tmp = (x + ((-2.0d0) * (wj * x))) + (wj * wj)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -5.4e-9) {
tmp = wj - ((wj - (x / Math.exp(wj))) / (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -5.4e-9: tmp = wj - ((wj - (x / math.exp(wj))) / (wj + 1.0)) else: tmp = (x + (-2.0 * (wj * x))) + (wj * wj) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -5.4e-9) tmp = Float64(wj - Float64(Float64(wj - Float64(x / exp(wj))) / Float64(wj + 1.0))); else tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -5.4e-9) tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0)); else tmp = (x + (-2.0 * (wj * x))) + (wj * wj); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -5.4e-9], N[(wj - N[(N[(wj - N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -5.4 \cdot 10^{-9}:\\
\;\;\;\;wj - \frac{wj - \frac{x}{e^{wj}}}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\\
\end{array}
\end{array}
if wj < -5.4000000000000004e-9Initial program 71.9%
sub-neg71.9%
div-sub71.9%
sub-neg71.9%
+-commutative71.9%
distribute-neg-in71.9%
remove-double-neg71.9%
sub-neg71.9%
div-sub71.9%
distribute-rgt1-in94.1%
associate-/l/93.9%
Simplified93.9%
if -5.4000000000000004e-9 < wj Initial program 79.9%
sub-neg79.9%
div-sub79.9%
sub-neg79.9%
+-commutative79.9%
distribute-neg-in79.9%
remove-double-neg79.9%
sub-neg79.9%
div-sub79.9%
distribute-rgt1-in79.9%
associate-/l/79.9%
Simplified80.7%
Taylor expanded in wj around 0 98.6%
Taylor expanded in x around 0 98.3%
unpow298.3%
Simplified98.3%
Final simplification98.1%
(FPCore (wj x) :precision binary64 (if (<= wj -5.4e-9) (- wj (/ (+ wj (- (* wj x) x)) (+ wj 1.0))) (+ (+ x (* -2.0 (* wj x))) (* wj wj))))
double code(double wj, double x) {
double tmp;
if (wj <= -5.4e-9) {
tmp = wj - ((wj + ((wj * x) - x)) / (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-5.4d-9)) then
tmp = wj - ((wj + ((wj * x) - x)) / (wj + 1.0d0))
else
tmp = (x + ((-2.0d0) * (wj * x))) + (wj * wj)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -5.4e-9) {
tmp = wj - ((wj + ((wj * x) - x)) / (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -5.4e-9: tmp = wj - ((wj + ((wj * x) - x)) / (wj + 1.0)) else: tmp = (x + (-2.0 * (wj * x))) + (wj * wj) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -5.4e-9) tmp = Float64(wj - Float64(Float64(wj + Float64(Float64(wj * x) - x)) / Float64(wj + 1.0))); else tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -5.4e-9) tmp = wj - ((wj + ((wj * x) - x)) / (wj + 1.0)); else tmp = (x + (-2.0 * (wj * x))) + (wj * wj); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -5.4e-9], N[(wj - N[(N[(wj + N[(N[(wj * x), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -5.4 \cdot 10^{-9}:\\
\;\;\;\;wj - \frac{wj + \left(wj \cdot x - x\right)}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\\
\end{array}
\end{array}
if wj < -5.4000000000000004e-9Initial program 71.9%
sub-neg71.9%
div-sub71.9%
sub-neg71.9%
+-commutative71.9%
distribute-neg-in71.9%
remove-double-neg71.9%
sub-neg71.9%
div-sub71.9%
distribute-rgt1-in94.1%
associate-/l/93.9%
Simplified93.9%
Taylor expanded in wj around 0 72.1%
+-commutative72.1%
mul-1-neg72.1%
unsub-neg72.1%
*-commutative72.1%
Simplified72.1%
if -5.4000000000000004e-9 < wj Initial program 79.9%
sub-neg79.9%
div-sub79.9%
sub-neg79.9%
+-commutative79.9%
distribute-neg-in79.9%
remove-double-neg79.9%
sub-neg79.9%
div-sub79.9%
distribute-rgt1-in79.9%
associate-/l/79.9%
Simplified80.7%
Taylor expanded in wj around 0 98.6%
Taylor expanded in x around 0 98.3%
unpow298.3%
Simplified98.3%
Final simplification97.3%
(FPCore (wj x) :precision binary64 (if (<= wj -8.5e-5) (+ wj (/ -1.0 (/ (+ wj 1.0) wj))) (+ (+ x (* -2.0 (* wj x))) (* wj wj))))
double code(double wj, double x) {
double tmp;
if (wj <= -8.5e-5) {
tmp = wj + (-1.0 / ((wj + 1.0) / wj));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-8.5d-5)) then
tmp = wj + ((-1.0d0) / ((wj + 1.0d0) / wj))
else
tmp = (x + ((-2.0d0) * (wj * x))) + (wj * wj)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -8.5e-5) {
tmp = wj + (-1.0 / ((wj + 1.0) / wj));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -8.5e-5: tmp = wj + (-1.0 / ((wj + 1.0) / wj)) else: tmp = (x + (-2.0 * (wj * x))) + (wj * wj) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -8.5e-5) tmp = Float64(wj + Float64(-1.0 / Float64(Float64(wj + 1.0) / wj))); else tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -8.5e-5) tmp = wj + (-1.0 / ((wj + 1.0) / wj)); else tmp = (x + (-2.0 * (wj * x))) + (wj * wj); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -8.5e-5], N[(wj + N[(-1.0 / N[(N[(wj + 1.0), $MachinePrecision] / wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -8.5 \cdot 10^{-5}:\\
\;\;\;\;wj + \frac{-1}{\frac{wj + 1}{wj}}\\
\mathbf{else}:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\\
\end{array}
\end{array}
if wj < -8.500000000000001e-5Initial program 68.7%
sub-neg68.7%
div-sub68.7%
sub-neg68.7%
+-commutative68.7%
distribute-neg-in68.7%
remove-double-neg68.7%
sub-neg68.7%
div-sub68.7%
distribute-rgt1-in97.3%
associate-/l/97.4%
Simplified97.4%
Taylor expanded in x around 0 69.4%
+-commutative69.4%
Simplified69.4%
clear-num69.5%
inv-pow69.5%
Applied egg-rr69.5%
unpow-169.5%
Simplified69.5%
if -8.500000000000001e-5 < wj Initial program 79.9%
sub-neg79.9%
div-sub79.9%
sub-neg79.9%
+-commutative79.9%
distribute-neg-in79.9%
remove-double-neg79.9%
sub-neg79.9%
div-sub79.9%
distribute-rgt1-in79.9%
associate-/l/79.9%
Simplified80.7%
Taylor expanded in wj around 0 98.4%
Taylor expanded in x around 0 98.0%
unpow298.0%
Simplified98.0%
Final simplification97.2%
(FPCore (wj x) :precision binary64 (if (<= wj -1.1e-5) (+ wj (/ -1.0 (/ (+ wj 1.0) wj))) (/ x (+ 1.0 (* wj 2.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= -1.1e-5) {
tmp = wj + (-1.0 / ((wj + 1.0) / wj));
} else {
tmp = x / (1.0 + (wj * 2.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-1.1d-5)) then
tmp = wj + ((-1.0d0) / ((wj + 1.0d0) / wj))
else
tmp = x / (1.0d0 + (wj * 2.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -1.1e-5) {
tmp = wj + (-1.0 / ((wj + 1.0) / wj));
} else {
tmp = x / (1.0 + (wj * 2.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -1.1e-5: tmp = wj + (-1.0 / ((wj + 1.0) / wj)) else: tmp = x / (1.0 + (wj * 2.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -1.1e-5) tmp = Float64(wj + Float64(-1.0 / Float64(Float64(wj + 1.0) / wj))); else tmp = Float64(x / Float64(1.0 + Float64(wj * 2.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -1.1e-5) tmp = wj + (-1.0 / ((wj + 1.0) / wj)); else tmp = x / (1.0 + (wj * 2.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -1.1e-5], N[(wj + N[(-1.0 / N[(N[(wj + 1.0), $MachinePrecision] / wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(1.0 + N[(wj * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -1.1 \cdot 10^{-5}:\\
\;\;\;\;wj + \frac{-1}{\frac{wj + 1}{wj}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1 + wj \cdot 2}\\
\end{array}
\end{array}
if wj < -1.1e-5Initial program 68.7%
sub-neg68.7%
div-sub68.7%
sub-neg68.7%
+-commutative68.7%
distribute-neg-in68.7%
remove-double-neg68.7%
sub-neg68.7%
div-sub68.7%
distribute-rgt1-in97.3%
associate-/l/97.4%
Simplified97.4%
Taylor expanded in x around 0 69.4%
+-commutative69.4%
Simplified69.4%
clear-num69.5%
inv-pow69.5%
Applied egg-rr69.5%
unpow-169.5%
Simplified69.5%
if -1.1e-5 < wj Initial program 79.9%
sub-neg79.9%
div-sub79.9%
sub-neg79.9%
+-commutative79.9%
distribute-neg-in79.9%
remove-double-neg79.9%
sub-neg79.9%
div-sub79.9%
distribute-rgt1-in79.9%
associate-/l/79.9%
Simplified80.7%
Taylor expanded in x around inf 87.9%
Taylor expanded in wj around 0 87.4%
*-commutative87.4%
Simplified87.4%
Final simplification86.9%
(FPCore (wj x) :precision binary64 (if (<= wj -6e-6) (- wj (/ wj (+ wj 1.0))) (+ x (* -2.0 (* wj x)))))
double code(double wj, double x) {
double tmp;
if (wj <= -6e-6) {
tmp = wj - (wj / (wj + 1.0));
} else {
tmp = x + (-2.0 * (wj * x));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-6d-6)) then
tmp = wj - (wj / (wj + 1.0d0))
else
tmp = x + ((-2.0d0) * (wj * x))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -6e-6) {
tmp = wj - (wj / (wj + 1.0));
} else {
tmp = x + (-2.0 * (wj * x));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -6e-6: tmp = wj - (wj / (wj + 1.0)) else: tmp = x + (-2.0 * (wj * x)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -6e-6) tmp = Float64(wj - Float64(wj / Float64(wj + 1.0))); else tmp = Float64(x + Float64(-2.0 * Float64(wj * x))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -6e-6) tmp = wj - (wj / (wj + 1.0)); else tmp = x + (-2.0 * (wj * x)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -6e-6], N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -6 \cdot 10^{-6}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;x + -2 \cdot \left(wj \cdot x\right)\\
\end{array}
\end{array}
if wj < -6.0000000000000002e-6Initial program 68.7%
sub-neg68.7%
div-sub68.7%
sub-neg68.7%
+-commutative68.7%
distribute-neg-in68.7%
remove-double-neg68.7%
sub-neg68.7%
div-sub68.7%
distribute-rgt1-in97.3%
associate-/l/97.4%
Simplified97.4%
Taylor expanded in x around 0 69.4%
+-commutative69.4%
Simplified69.4%
if -6.0000000000000002e-6 < wj Initial program 79.9%
sub-neg79.9%
div-sub79.9%
sub-neg79.9%
+-commutative79.9%
distribute-neg-in79.9%
remove-double-neg79.9%
sub-neg79.9%
div-sub79.9%
distribute-rgt1-in79.9%
associate-/l/79.9%
Simplified80.7%
Taylor expanded in wj around 0 87.4%
Final simplification86.9%
(FPCore (wj x) :precision binary64 (if (<= wj -3.3e-5) (- wj (/ wj (+ wj 1.0))) (/ x (+ 1.0 (* wj 2.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= -3.3e-5) {
tmp = wj - (wj / (wj + 1.0));
} else {
tmp = x / (1.0 + (wj * 2.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-3.3d-5)) then
tmp = wj - (wj / (wj + 1.0d0))
else
tmp = x / (1.0d0 + (wj * 2.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -3.3e-5) {
tmp = wj - (wj / (wj + 1.0));
} else {
tmp = x / (1.0 + (wj * 2.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -3.3e-5: tmp = wj - (wj / (wj + 1.0)) else: tmp = x / (1.0 + (wj * 2.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -3.3e-5) tmp = Float64(wj - Float64(wj / Float64(wj + 1.0))); else tmp = Float64(x / Float64(1.0 + Float64(wj * 2.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -3.3e-5) tmp = wj - (wj / (wj + 1.0)); else tmp = x / (1.0 + (wj * 2.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -3.3e-5], N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(1.0 + N[(wj * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -3.3 \cdot 10^{-5}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1 + wj \cdot 2}\\
\end{array}
\end{array}
if wj < -3.3000000000000003e-5Initial program 68.7%
sub-neg68.7%
div-sub68.7%
sub-neg68.7%
+-commutative68.7%
distribute-neg-in68.7%
remove-double-neg68.7%
sub-neg68.7%
div-sub68.7%
distribute-rgt1-in97.3%
associate-/l/97.4%
Simplified97.4%
Taylor expanded in x around 0 69.4%
+-commutative69.4%
Simplified69.4%
if -3.3000000000000003e-5 < wj Initial program 79.9%
sub-neg79.9%
div-sub79.9%
sub-neg79.9%
+-commutative79.9%
distribute-neg-in79.9%
remove-double-neg79.9%
sub-neg79.9%
div-sub79.9%
distribute-rgt1-in79.9%
associate-/l/79.9%
Simplified80.7%
Taylor expanded in x around inf 87.9%
Taylor expanded in wj around 0 87.4%
*-commutative87.4%
Simplified87.4%
Final simplification86.9%
(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.6%
sub-neg79.6%
div-sub79.6%
sub-neg79.6%
+-commutative79.6%
distribute-neg-in79.6%
remove-double-neg79.6%
sub-neg79.6%
div-sub79.6%
distribute-rgt1-in80.4%
associate-/l/80.4%
Simplified81.1%
Taylor expanded in wj around 0 85.1%
Final simplification85.1%
(FPCore (wj x) :precision binary64 wj)
double code(double wj, double x) {
return wj;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = wj
end function
public static double code(double wj, double x) {
return wj;
}
def code(wj, x): return wj
function code(wj, x) return wj end
function tmp = code(wj, x) tmp = wj; end
code[wj_, x_] := wj
\begin{array}{l}
\\
wj
\end{array}
Initial program 79.6%
sub-neg79.6%
div-sub79.6%
sub-neg79.6%
+-commutative79.6%
distribute-neg-in79.6%
remove-double-neg79.6%
sub-neg79.6%
div-sub79.6%
distribute-rgt1-in80.4%
associate-/l/80.4%
Simplified81.1%
Taylor expanded in wj around inf 4.3%
Final simplification4.3%
(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.6%
sub-neg79.6%
div-sub79.6%
sub-neg79.6%
+-commutative79.6%
distribute-neg-in79.6%
remove-double-neg79.6%
sub-neg79.6%
div-sub79.6%
distribute-rgt1-in80.4%
associate-/l/80.4%
Simplified81.1%
Taylor expanded in wj around 0 84.1%
Final simplification84.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 2023257
(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))))))