
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (wj x) :precision binary64 (let* ((t_0 (* wj (exp wj)))) (- wj (/ (- t_0 x) (+ (exp wj) t_0)))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
return wj - ((t_0 - x) / (exp(wj) + t_0));
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
t_0 = wj * exp(wj)
code = wj - ((t_0 - x) / (exp(wj) + t_0))
end function
public static double code(double wj, double x) {
double t_0 = wj * Math.exp(wj);
return wj - ((t_0 - x) / (Math.exp(wj) + t_0));
}
def code(wj, x): t_0 = wj * math.exp(wj) return wj - ((t_0 - x) / (math.exp(wj) + t_0))
function code(wj, x) t_0 = Float64(wj * exp(wj)) return Float64(wj - Float64(Float64(t_0 - x) / Float64(exp(wj) + t_0))) end
function tmp = code(wj, x) t_0 = wj * exp(wj); tmp = wj - ((t_0 - x) / (exp(wj) + t_0)); end
code[wj_, x_] := Block[{t$95$0 = N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, N[(wj - N[(N[(t$95$0 - x), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := wj \cdot e^{wj}\\
wj - \frac{t_0 - x}{e^{wj} + t_0}
\end{array}
\end{array}
(FPCore (wj x)
:precision binary64
(if (<= wj -8.8e-9)
(+ wj (/ (- x (* wj (exp wj))) (* (exp wj) (+ wj 1.0))))
(if (<= wj 5e-9)
(+ x (- (pow wj 2.0) (* wj (+ x x))))
(+ wj (* wj (/ -1.0 (+ wj 1.0)))))))
double code(double wj, double x) {
double tmp;
if (wj <= -8.8e-9) {
tmp = wj + ((x - (wj * exp(wj))) / (exp(wj) * (wj + 1.0)));
} else if (wj <= 5e-9) {
tmp = x + (pow(wj, 2.0) - (wj * (x + x)));
} else {
tmp = wj + (wj * (-1.0 / (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 <= (-8.8d-9)) then
tmp = wj + ((x - (wj * exp(wj))) / (exp(wj) * (wj + 1.0d0)))
else if (wj <= 5d-9) then
tmp = x + ((wj ** 2.0d0) - (wj * (x + x)))
else
tmp = wj + (wj * ((-1.0d0) / (wj + 1.0d0)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -8.8e-9) {
tmp = wj + ((x - (wj * Math.exp(wj))) / (Math.exp(wj) * (wj + 1.0)));
} else if (wj <= 5e-9) {
tmp = x + (Math.pow(wj, 2.0) - (wj * (x + x)));
} else {
tmp = wj + (wj * (-1.0 / (wj + 1.0)));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -8.8e-9: tmp = wj + ((x - (wj * math.exp(wj))) / (math.exp(wj) * (wj + 1.0))) elif wj <= 5e-9: tmp = x + (math.pow(wj, 2.0) - (wj * (x + x))) else: tmp = wj + (wj * (-1.0 / (wj + 1.0))) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -8.8e-9) tmp = Float64(wj + Float64(Float64(x - Float64(wj * exp(wj))) / Float64(exp(wj) * Float64(wj + 1.0)))); elseif (wj <= 5e-9) tmp = Float64(x + Float64((wj ^ 2.0) - Float64(wj * Float64(x + x)))); else tmp = Float64(wj + Float64(wj * Float64(-1.0 / Float64(wj + 1.0)))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -8.8e-9) tmp = wj + ((x - (wj * exp(wj))) / (exp(wj) * (wj + 1.0))); elseif (wj <= 5e-9) tmp = x + ((wj ^ 2.0) - (wj * (x + x))); else tmp = wj + (wj * (-1.0 / (wj + 1.0))); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -8.8e-9], N[(wj + N[(N[(x - N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] * N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 5e-9], N[(x + N[(N[Power[wj, 2.0], $MachinePrecision] - N[(wj * N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(wj * N[(-1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -8.8 \cdot 10^{-9}:\\
\;\;\;\;wj + \frac{x - wj \cdot e^{wj}}{e^{wj} \cdot \left(wj + 1\right)}\\
\mathbf{elif}\;wj \leq 5 \cdot 10^{-9}:\\
\;\;\;\;x + \left({wj}^{2} - wj \cdot \left(x + x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj + wj \cdot \frac{-1}{wj + 1}\\
\end{array}
\end{array}
if wj < -8.7999999999999994e-9Initial program 67.3%
distribute-rgt1-in97.3%
*-commutative97.3%
Simplified97.3%
if -8.7999999999999994e-9 < wj < 5.0000000000000001e-9Initial program 78.3%
distribute-rgt1-in78.3%
associate-/l/78.3%
div-sub78.3%
associate-/l*78.3%
*-inverses78.3%
/-rgt-identity78.3%
Simplified78.3%
Taylor expanded in wj around 0 78.3%
associate-*r*78.3%
neg-mul-178.3%
distribute-rgt1-in78.3%
+-commutative78.3%
sub-neg78.3%
Simplified78.3%
Taylor expanded in wj around 0 99.7%
Taylor expanded in x around 0 99.7%
if 5.0000000000000001e-9 < wj Initial program 31.9%
distribute-rgt1-in31.9%
associate-/l/31.9%
div-sub31.9%
associate-/l*31.9%
*-inverses87.5%
/-rgt-identity87.5%
Simplified87.5%
Taylor expanded in x around 0 87.5%
+-commutative87.5%
Simplified87.5%
div-inv87.6%
Applied egg-rr87.6%
Final simplification99.2%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (* wj (exp wj))) (t_1 (+ (* x -4.0) (* x 1.5))))
(if (<= (- wj (/ (- t_0 x) (+ (exp wj) t_0))) 4e-15)
(+
x
(+
(* -2.0 (* wj x))
(-
(* (pow wj 2.0) (- 1.0 t_1))
(*
(pow wj 3.0)
(+ 1.0 (+ (* x -3.0) (+ (* -2.0 t_1) (* x 0.6666666666666666))))))))
(- wj (/ (- wj (/ x (exp wj))) (+ wj 1.0))))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
double t_1 = (x * -4.0) + (x * 1.5);
double tmp;
if ((wj - ((t_0 - x) / (exp(wj) + t_0))) <= 4e-15) {
tmp = x + ((-2.0 * (wj * x)) + ((pow(wj, 2.0) * (1.0 - t_1)) - (pow(wj, 3.0) * (1.0 + ((x * -3.0) + ((-2.0 * t_1) + (x * 0.6666666666666666)))))));
} else {
tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = wj * exp(wj)
t_1 = (x * (-4.0d0)) + (x * 1.5d0)
if ((wj - ((t_0 - x) / (exp(wj) + t_0))) <= 4d-15) then
tmp = x + (((-2.0d0) * (wj * x)) + (((wj ** 2.0d0) * (1.0d0 - t_1)) - ((wj ** 3.0d0) * (1.0d0 + ((x * (-3.0d0)) + (((-2.0d0) * t_1) + (x * 0.6666666666666666d0)))))))
else
tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double t_0 = wj * Math.exp(wj);
double t_1 = (x * -4.0) + (x * 1.5);
double tmp;
if ((wj - ((t_0 - x) / (Math.exp(wj) + t_0))) <= 4e-15) {
tmp = x + ((-2.0 * (wj * x)) + ((Math.pow(wj, 2.0) * (1.0 - t_1)) - (Math.pow(wj, 3.0) * (1.0 + ((x * -3.0) + ((-2.0 * t_1) + (x * 0.6666666666666666)))))));
} else {
tmp = wj - ((wj - (x / Math.exp(wj))) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): t_0 = wj * math.exp(wj) t_1 = (x * -4.0) + (x * 1.5) tmp = 0 if (wj - ((t_0 - x) / (math.exp(wj) + t_0))) <= 4e-15: tmp = x + ((-2.0 * (wj * x)) + ((math.pow(wj, 2.0) * (1.0 - t_1)) - (math.pow(wj, 3.0) * (1.0 + ((x * -3.0) + ((-2.0 * t_1) + (x * 0.6666666666666666))))))) else: tmp = wj - ((wj - (x / math.exp(wj))) / (wj + 1.0)) return tmp
function code(wj, x) t_0 = Float64(wj * exp(wj)) t_1 = Float64(Float64(x * -4.0) + Float64(x * 1.5)) tmp = 0.0 if (Float64(wj - Float64(Float64(t_0 - x) / Float64(exp(wj) + t_0))) <= 4e-15) tmp = Float64(x + Float64(Float64(-2.0 * Float64(wj * x)) + Float64(Float64((wj ^ 2.0) * Float64(1.0 - t_1)) - Float64((wj ^ 3.0) * Float64(1.0 + Float64(Float64(x * -3.0) + Float64(Float64(-2.0 * t_1) + Float64(x * 0.6666666666666666)))))))); else tmp = Float64(wj - Float64(Float64(wj - Float64(x / exp(wj))) / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) t_0 = wj * exp(wj); t_1 = (x * -4.0) + (x * 1.5); tmp = 0.0; if ((wj - ((t_0 - x) / (exp(wj) + t_0))) <= 4e-15) tmp = x + ((-2.0 * (wj * x)) + (((wj ^ 2.0) * (1.0 - t_1)) - ((wj ^ 3.0) * (1.0 + ((x * -3.0) + ((-2.0 * t_1) + (x * 0.6666666666666666))))))); else tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := Block[{t$95$0 = N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * -4.0), $MachinePrecision] + N[(x * 1.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(wj - N[(N[(t$95$0 - x), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4e-15], N[(x + N[(N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[wj, 2.0], $MachinePrecision] * N[(1.0 - t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[Power[wj, 3.0], $MachinePrecision] * N[(1.0 + N[(N[(x * -3.0), $MachinePrecision] + N[(N[(-2.0 * t$95$1), $MachinePrecision] + N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj - N[(N[(wj - N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := wj \cdot e^{wj}\\
t_1 := x \cdot -4 + x \cdot 1.5\\
\mathbf{if}\;wj - \frac{t_0 - x}{e^{wj} + t_0} \leq 4 \cdot 10^{-15}:\\
\;\;\;\;x + \left(-2 \cdot \left(wj \cdot x\right) + \left({wj}^{2} \cdot \left(1 - t_1\right) - {wj}^{3} \cdot \left(1 + \left(x \cdot -3 + \left(-2 \cdot t_1 + x \cdot 0.6666666666666666\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj - \frac{x}{e^{wj}}}{wj + 1}\\
\end{array}
\end{array}
if (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) < 4.0000000000000003e-15Initial program 71.5%
distribute-rgt1-in73.1%
associate-/l/73.1%
div-sub71.5%
associate-/l*71.5%
*-inverses73.1%
/-rgt-identity73.1%
Simplified73.1%
Taylor expanded in wj around 0 97.9%
if 4.0000000000000003e-15 < (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) Initial program 91.4%
distribute-rgt1-in91.4%
associate-/l/91.3%
div-sub91.3%
associate-/l*91.3%
*-inverses99.5%
/-rgt-identity99.5%
Simplified99.5%
Final simplification98.3%
(FPCore (wj x) :precision binary64 (if (or (<= wj -1.15e-9) (not (<= wj 1.95e-13))) (- wj (/ (- wj (/ x (exp wj))) (+ wj 1.0))) (+ x (* wj (+ wj (* x 2.0))))))
double code(double wj, double x) {
double tmp;
if ((wj <= -1.15e-9) || !(wj <= 1.95e-13)) {
tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0));
} else {
tmp = x + (wj * (wj + (x * 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.15d-9)) .or. (.not. (wj <= 1.95d-13))) then
tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0d0))
else
tmp = x + (wj * (wj + (x * 2.0d0)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if ((wj <= -1.15e-9) || !(wj <= 1.95e-13)) {
tmp = wj - ((wj - (x / Math.exp(wj))) / (wj + 1.0));
} else {
tmp = x + (wj * (wj + (x * 2.0)));
}
return tmp;
}
def code(wj, x): tmp = 0 if (wj <= -1.15e-9) or not (wj <= 1.95e-13): tmp = wj - ((wj - (x / math.exp(wj))) / (wj + 1.0)) else: tmp = x + (wj * (wj + (x * 2.0))) return tmp
function code(wj, x) tmp = 0.0 if ((wj <= -1.15e-9) || !(wj <= 1.95e-13)) tmp = Float64(wj - Float64(Float64(wj - Float64(x / exp(wj))) / Float64(wj + 1.0))); else tmp = Float64(x + Float64(wj * Float64(wj + Float64(x * 2.0)))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if ((wj <= -1.15e-9) || ~((wj <= 1.95e-13))) tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0)); else tmp = x + (wj * (wj + (x * 2.0))); end tmp_2 = tmp; end
code[wj_, x_] := If[Or[LessEqual[wj, -1.15e-9], N[Not[LessEqual[wj, 1.95e-13]], $MachinePrecision]], N[(wj - N[(N[(wj - N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(wj * N[(wj + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -1.15 \cdot 10^{-9} \lor \neg \left(wj \leq 1.95 \cdot 10^{-13}\right):\\
\;\;\;\;wj - \frac{wj - \frac{x}{e^{wj}}}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;x + wj \cdot \left(wj + x \cdot 2\right)\\
\end{array}
\end{array}
if wj < -1.15e-9 or 1.95000000000000002e-13 < wj Initial program 52.9%
distribute-rgt1-in67.9%
associate-/l/67.8%
div-sub52.8%
associate-/l*52.8%
*-inverses92.8%
/-rgt-identity92.8%
Simplified92.8%
if -1.15e-9 < wj < 1.95000000000000002e-13Initial program 78.2%
distribute-rgt1-in78.2%
associate-/l/78.2%
div-sub78.2%
associate-/l*78.2%
*-inverses78.2%
/-rgt-identity78.2%
Simplified78.2%
Taylor expanded in wj around 0 78.2%
associate-*r*78.2%
neg-mul-178.2%
distribute-rgt1-in78.2%
+-commutative78.2%
sub-neg78.2%
Simplified78.2%
Taylor expanded in wj around 0 99.7%
Taylor expanded in x around 0 99.7%
unpow299.7%
distribute-lft-out99.7%
sub-neg99.7%
*-un-lft-identity99.7%
mul-1-neg99.7%
*-un-lft-identity99.7%
distribute-rgt-out99.7%
add-sqr-sqrt54.1%
sqrt-unprod75.0%
mul-1-neg75.0%
mul-1-neg75.0%
sqr-neg75.0%
sqrt-unprod45.5%
add-sqr-sqrt99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Final simplification99.1%
(FPCore (wj x)
:precision binary64
(if (<= wj -8.8e-9)
(- wj (/ (- wj (/ x (exp wj))) (+ wj 1.0)))
(if (<= wj 5e-9)
(+ x (- (pow wj 2.0) (* wj (+ x x))))
(+ wj (* wj (/ -1.0 (+ wj 1.0)))))))
double code(double wj, double x) {
double tmp;
if (wj <= -8.8e-9) {
tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0));
} else if (wj <= 5e-9) {
tmp = x + (pow(wj, 2.0) - (wj * (x + x)));
} else {
tmp = wj + (wj * (-1.0 / (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 <= (-8.8d-9)) then
tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0d0))
else if (wj <= 5d-9) then
tmp = x + ((wj ** 2.0d0) - (wj * (x + x)))
else
tmp = wj + (wj * ((-1.0d0) / (wj + 1.0d0)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -8.8e-9) {
tmp = wj - ((wj - (x / Math.exp(wj))) / (wj + 1.0));
} else if (wj <= 5e-9) {
tmp = x + (Math.pow(wj, 2.0) - (wj * (x + x)));
} else {
tmp = wj + (wj * (-1.0 / (wj + 1.0)));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -8.8e-9: tmp = wj - ((wj - (x / math.exp(wj))) / (wj + 1.0)) elif wj <= 5e-9: tmp = x + (math.pow(wj, 2.0) - (wj * (x + x))) else: tmp = wj + (wj * (-1.0 / (wj + 1.0))) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -8.8e-9) tmp = Float64(wj - Float64(Float64(wj - Float64(x / exp(wj))) / Float64(wj + 1.0))); elseif (wj <= 5e-9) tmp = Float64(x + Float64((wj ^ 2.0) - Float64(wj * Float64(x + x)))); else tmp = Float64(wj + Float64(wj * Float64(-1.0 / Float64(wj + 1.0)))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -8.8e-9) tmp = wj - ((wj - (x / exp(wj))) / (wj + 1.0)); elseif (wj <= 5e-9) tmp = x + ((wj ^ 2.0) - (wj * (x + x))); else tmp = wj + (wj * (-1.0 / (wj + 1.0))); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -8.8e-9], N[(wj - N[(N[(wj - N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 5e-9], N[(x + N[(N[Power[wj, 2.0], $MachinePrecision] - N[(wj * N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(wj * N[(-1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -8.8 \cdot 10^{-9}:\\
\;\;\;\;wj - \frac{wj - \frac{x}{e^{wj}}}{wj + 1}\\
\mathbf{elif}\;wj \leq 5 \cdot 10^{-9}:\\
\;\;\;\;x + \left({wj}^{2} - wj \cdot \left(x + x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj + wj \cdot \frac{-1}{wj + 1}\\
\end{array}
\end{array}
if wj < -8.7999999999999994e-9Initial program 67.3%
distribute-rgt1-in97.3%
associate-/l/97.2%
div-sub67.2%
associate-/l*67.2%
*-inverses97.2%
/-rgt-identity97.2%
Simplified97.2%
if -8.7999999999999994e-9 < wj < 5.0000000000000001e-9Initial program 78.3%
distribute-rgt1-in78.3%
associate-/l/78.3%
div-sub78.3%
associate-/l*78.3%
*-inverses78.3%
/-rgt-identity78.3%
Simplified78.3%
Taylor expanded in wj around 0 78.3%
associate-*r*78.3%
neg-mul-178.3%
distribute-rgt1-in78.3%
+-commutative78.3%
sub-neg78.3%
Simplified78.3%
Taylor expanded in wj around 0 99.7%
Taylor expanded in x around 0 99.7%
if 5.0000000000000001e-9 < wj Initial program 31.9%
distribute-rgt1-in31.9%
associate-/l/31.9%
div-sub31.9%
associate-/l*31.9%
*-inverses87.5%
/-rgt-identity87.5%
Simplified87.5%
Taylor expanded in x around 0 87.5%
+-commutative87.5%
Simplified87.5%
div-inv87.6%
Applied egg-rr87.6%
Final simplification99.2%
(FPCore (wj x)
:precision binary64
(if (<= wj -2.8e-8)
(/ x (* (exp wj) (+ wj 1.0)))
(if (<= wj 5e-9)
(+ x (* wj (+ wj (* x 2.0))))
(+ wj (* wj (/ -1.0 (+ wj 1.0)))))))
double code(double wj, double x) {
double tmp;
if (wj <= -2.8e-8) {
tmp = x / (exp(wj) * (wj + 1.0));
} else if (wj <= 5e-9) {
tmp = x + (wj * (wj + (x * 2.0)));
} else {
tmp = wj + (wj * (-1.0 / (wj + 1.0)));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-2.8d-8)) then
tmp = x / (exp(wj) * (wj + 1.0d0))
else if (wj <= 5d-9) then
tmp = x + (wj * (wj + (x * 2.0d0)))
else
tmp = wj + (wj * ((-1.0d0) / (wj + 1.0d0)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -2.8e-8) {
tmp = x / (Math.exp(wj) * (wj + 1.0));
} else if (wj <= 5e-9) {
tmp = x + (wj * (wj + (x * 2.0)));
} else {
tmp = wj + (wj * (-1.0 / (wj + 1.0)));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -2.8e-8: tmp = x / (math.exp(wj) * (wj + 1.0)) elif wj <= 5e-9: tmp = x + (wj * (wj + (x * 2.0))) else: tmp = wj + (wj * (-1.0 / (wj + 1.0))) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -2.8e-8) tmp = Float64(x / Float64(exp(wj) * Float64(wj + 1.0))); elseif (wj <= 5e-9) tmp = Float64(x + Float64(wj * Float64(wj + Float64(x * 2.0)))); else tmp = Float64(wj + Float64(wj * Float64(-1.0 / Float64(wj + 1.0)))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -2.8e-8) tmp = x / (exp(wj) * (wj + 1.0)); elseif (wj <= 5e-9) tmp = x + (wj * (wj + (x * 2.0))); else tmp = wj + (wj * (-1.0 / (wj + 1.0))); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -2.8e-8], N[(x / N[(N[Exp[wj], $MachinePrecision] * N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 5e-9], N[(x + N[(wj * N[(wj + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(wj * N[(-1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -2.8 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{e^{wj} \cdot \left(wj + 1\right)}\\
\mathbf{elif}\;wj \leq 5 \cdot 10^{-9}:\\
\;\;\;\;x + wj \cdot \left(wj + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;wj + wj \cdot \frac{-1}{wj + 1}\\
\end{array}
\end{array}
if wj < -2.7999999999999999e-8Initial program 67.3%
distribute-rgt1-in97.3%
associate-/l/97.2%
div-sub67.2%
associate-/l*67.2%
*-inverses97.2%
/-rgt-identity97.2%
Simplified97.2%
Taylor expanded in x around inf 80.3%
+-commutative80.3%
Simplified80.3%
if -2.7999999999999999e-8 < wj < 5.0000000000000001e-9Initial program 78.3%
distribute-rgt1-in78.3%
associate-/l/78.3%
div-sub78.3%
associate-/l*78.3%
*-inverses78.3%
/-rgt-identity78.3%
Simplified78.3%
Taylor expanded in wj around 0 78.3%
associate-*r*78.3%
neg-mul-178.3%
distribute-rgt1-in78.3%
+-commutative78.3%
sub-neg78.3%
Simplified78.3%
Taylor expanded in wj around 0 99.7%
Taylor expanded in x around 0 99.7%
unpow299.7%
distribute-lft-out99.7%
sub-neg99.7%
*-un-lft-identity99.7%
mul-1-neg99.7%
*-un-lft-identity99.7%
distribute-rgt-out99.7%
add-sqr-sqrt54.3%
sqrt-unprod75.1%
mul-1-neg75.1%
mul-1-neg75.1%
sqr-neg75.1%
sqrt-unprod45.3%
add-sqr-sqrt99.5%
metadata-eval99.5%
Applied egg-rr99.5%
if 5.0000000000000001e-9 < wj Initial program 31.9%
distribute-rgt1-in31.9%
associate-/l/31.9%
div-sub31.9%
associate-/l*31.9%
*-inverses87.5%
/-rgt-identity87.5%
Simplified87.5%
Taylor expanded in x around 0 87.5%
+-commutative87.5%
Simplified87.5%
div-inv87.6%
Applied egg-rr87.6%
Final simplification98.3%
(FPCore (wj x) :precision binary64 (if (<= wj 5e-9) (* (/ x (+ wj 1.0)) (- 1.0 wj)) (- wj (/ wj (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 5e-9) {
tmp = (x / (wj + 1.0)) * (1.0 - wj);
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= 5d-9) then
tmp = (x / (wj + 1.0d0)) * (1.0d0 - wj)
else
tmp = wj - (wj / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 5e-9) {
tmp = (x / (wj + 1.0)) * (1.0 - wj);
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 5e-9: tmp = (x / (wj + 1.0)) * (1.0 - wj) else: tmp = wj - (wj / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 5e-9) tmp = Float64(Float64(x / Float64(wj + 1.0)) * Float64(1.0 - wj)); else tmp = Float64(wj - Float64(wj / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 5e-9) tmp = (x / (wj + 1.0)) * (1.0 - wj); else tmp = wj - (wj / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 5e-9], N[(N[(x / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 - wj), $MachinePrecision]), $MachinePrecision], N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\frac{x}{wj + 1} \cdot \left(1 - wj\right)\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 5.0000000000000001e-9Initial program 77.9%
distribute-rgt1-in79.1%
associate-/l/79.1%
div-sub77.9%
associate-/l*77.9%
*-inverses79.1%
/-rgt-identity79.1%
Simplified79.1%
Taylor expanded in wj around 0 76.9%
associate-*r*76.9%
neg-mul-176.9%
distribute-rgt1-in76.9%
+-commutative76.9%
sub-neg76.9%
Simplified76.9%
Taylor expanded in x around -inf 84.1%
associate-/l*84.1%
+-commutative84.1%
associate-/r/84.1%
Simplified84.1%
if 5.0000000000000001e-9 < wj Initial program 31.9%
distribute-rgt1-in31.9%
associate-/l/31.9%
div-sub31.9%
associate-/l*31.9%
*-inverses87.5%
/-rgt-identity87.5%
Simplified87.5%
Taylor expanded in x around 0 87.5%
+-commutative87.5%
Simplified87.5%
Final simplification84.2%
(FPCore (wj x) :precision binary64 (if (<= wj 5e-9) (+ x (* wj (+ wj (* x 2.0)))) (- wj (/ wj (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 5e-9) {
tmp = x + (wj * (wj + (x * 2.0)));
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= 5d-9) then
tmp = x + (wj * (wj + (x * 2.0d0)))
else
tmp = wj - (wj / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 5e-9) {
tmp = x + (wj * (wj + (x * 2.0)));
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 5e-9: tmp = x + (wj * (wj + (x * 2.0))) else: tmp = wj - (wj / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 5e-9) tmp = Float64(x + Float64(wj * Float64(wj + Float64(x * 2.0)))); else tmp = Float64(wj - Float64(wj / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 5e-9) tmp = x + (wj * (wj + (x * 2.0))); else tmp = wj - (wj / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 5e-9], N[(x + N[(wj * N[(wj + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 5 \cdot 10^{-9}:\\
\;\;\;\;x + wj \cdot \left(wj + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 5.0000000000000001e-9Initial program 77.9%
distribute-rgt1-in79.1%
associate-/l/79.1%
div-sub77.9%
associate-/l*77.9%
*-inverses79.1%
/-rgt-identity79.1%
Simplified79.1%
Taylor expanded in wj around 0 76.9%
associate-*r*76.9%
neg-mul-176.9%
distribute-rgt1-in76.9%
+-commutative76.9%
sub-neg76.9%
Simplified76.9%
Taylor expanded in wj around 0 97.0%
Taylor expanded in x around 0 96.9%
unpow296.9%
distribute-lft-out96.9%
sub-neg96.9%
*-un-lft-identity96.9%
mul-1-neg96.9%
*-un-lft-identity96.9%
distribute-rgt-out96.9%
add-sqr-sqrt52.8%
sqrt-unprod72.9%
mul-1-neg72.9%
mul-1-neg72.9%
sqr-neg72.9%
sqrt-unprod43.9%
add-sqr-sqrt96.4%
metadata-eval96.4%
Applied egg-rr96.4%
if 5.0000000000000001e-9 < wj Initial program 31.9%
distribute-rgt1-in31.9%
associate-/l/31.9%
div-sub31.9%
associate-/l*31.9%
*-inverses87.5%
/-rgt-identity87.5%
Simplified87.5%
Taylor expanded in x around 0 87.5%
+-commutative87.5%
Simplified87.5%
Final simplification96.1%
(FPCore (wj x) :precision binary64 (if (<= wj 5e-9) (+ x (* wj (+ wj (* x 2.0)))) (+ wj (* wj (/ -1.0 (+ wj 1.0))))))
double code(double wj, double x) {
double tmp;
if (wj <= 5e-9) {
tmp = x + (wj * (wj + (x * 2.0)));
} else {
tmp = wj + (wj * (-1.0 / (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 <= 5d-9) then
tmp = x + (wj * (wj + (x * 2.0d0)))
else
tmp = wj + (wj * ((-1.0d0) / (wj + 1.0d0)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 5e-9) {
tmp = x + (wj * (wj + (x * 2.0)));
} else {
tmp = wj + (wj * (-1.0 / (wj + 1.0)));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 5e-9: tmp = x + (wj * (wj + (x * 2.0))) else: tmp = wj + (wj * (-1.0 / (wj + 1.0))) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 5e-9) tmp = Float64(x + Float64(wj * Float64(wj + Float64(x * 2.0)))); else tmp = Float64(wj + Float64(wj * Float64(-1.0 / Float64(wj + 1.0)))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 5e-9) tmp = x + (wj * (wj + (x * 2.0))); else tmp = wj + (wj * (-1.0 / (wj + 1.0))); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 5e-9], N[(x + N[(wj * N[(wj + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(wj * N[(-1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 5 \cdot 10^{-9}:\\
\;\;\;\;x + wj \cdot \left(wj + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;wj + wj \cdot \frac{-1}{wj + 1}\\
\end{array}
\end{array}
if wj < 5.0000000000000001e-9Initial program 77.9%
distribute-rgt1-in79.1%
associate-/l/79.1%
div-sub77.9%
associate-/l*77.9%
*-inverses79.1%
/-rgt-identity79.1%
Simplified79.1%
Taylor expanded in wj around 0 76.9%
associate-*r*76.9%
neg-mul-176.9%
distribute-rgt1-in76.9%
+-commutative76.9%
sub-neg76.9%
Simplified76.9%
Taylor expanded in wj around 0 97.0%
Taylor expanded in x around 0 96.9%
unpow296.9%
distribute-lft-out96.9%
sub-neg96.9%
*-un-lft-identity96.9%
mul-1-neg96.9%
*-un-lft-identity96.9%
distribute-rgt-out96.9%
add-sqr-sqrt52.8%
sqrt-unprod72.9%
mul-1-neg72.9%
mul-1-neg72.9%
sqr-neg72.9%
sqrt-unprod43.9%
add-sqr-sqrt96.4%
metadata-eval96.4%
Applied egg-rr96.4%
if 5.0000000000000001e-9 < wj Initial program 31.9%
distribute-rgt1-in31.9%
associate-/l/31.9%
div-sub31.9%
associate-/l*31.9%
*-inverses87.5%
/-rgt-identity87.5%
Simplified87.5%
Taylor expanded in x around 0 87.5%
+-commutative87.5%
Simplified87.5%
div-inv87.6%
Applied egg-rr87.6%
Final simplification96.1%
(FPCore (wj x) :precision binary64 (if (<= wj 3.3e-9) (+ x (* -2.0 (* wj x))) (- wj (/ wj (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 3.3e-9) {
tmp = x + (-2.0 * (wj * x));
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= 3.3d-9) then
tmp = x + ((-2.0d0) * (wj * x))
else
tmp = wj - (wj / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 3.3e-9) {
tmp = x + (-2.0 * (wj * x));
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 3.3e-9: tmp = x + (-2.0 * (wj * x)) else: tmp = wj - (wj / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 3.3e-9) tmp = Float64(x + Float64(-2.0 * Float64(wj * x))); else tmp = Float64(wj - Float64(wj / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 3.3e-9) tmp = x + (-2.0 * (wj * x)); else tmp = wj - (wj / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 3.3e-9], N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 3.3 \cdot 10^{-9}:\\
\;\;\;\;x + -2 \cdot \left(wj \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 3.30000000000000018e-9Initial program 77.9%
distribute-rgt1-in79.1%
associate-/l/79.1%
div-sub77.9%
associate-/l*77.9%
*-inverses79.1%
/-rgt-identity79.1%
Simplified79.1%
Taylor expanded in wj around 0 83.9%
*-commutative83.9%
Simplified83.9%
if 3.30000000000000018e-9 < wj Initial program 31.9%
distribute-rgt1-in31.9%
associate-/l/31.9%
div-sub31.9%
associate-/l*31.9%
*-inverses87.5%
/-rgt-identity87.5%
Simplified87.5%
Taylor expanded in x around 0 87.5%
+-commutative87.5%
Simplified87.5%
Final simplification84.1%
(FPCore (wj x) :precision binary64 (if (<= wj 5e-9) (/ x (+ 1.0 (* wj 2.0))) (- wj (/ wj (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 5e-9) {
tmp = x / (1.0 + (wj * 2.0));
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= 5d-9) then
tmp = x / (1.0d0 + (wj * 2.0d0))
else
tmp = wj - (wj / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 5e-9) {
tmp = x / (1.0 + (wj * 2.0));
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 5e-9: tmp = x / (1.0 + (wj * 2.0)) else: tmp = wj - (wj / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 5e-9) tmp = Float64(x / Float64(1.0 + Float64(wj * 2.0))); else tmp = Float64(wj - Float64(wj / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 5e-9) tmp = x / (1.0 + (wj * 2.0)); else tmp = wj - (wj / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 5e-9], N[(x / N[(1.0 + N[(wj * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 5 \cdot 10^{-9}:\\
\;\;\;\;\frac{x}{1 + wj \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 5.0000000000000001e-9Initial program 77.9%
distribute-rgt1-in79.1%
associate-/l/79.1%
div-sub77.9%
associate-/l*77.9%
*-inverses79.1%
/-rgt-identity79.1%
Simplified79.1%
Taylor expanded in x around inf 86.2%
+-commutative86.2%
Simplified86.2%
Taylor expanded in wj around 0 84.1%
*-commutative84.1%
Simplified84.1%
if 5.0000000000000001e-9 < wj Initial program 31.9%
distribute-rgt1-in31.9%
associate-/l/31.9%
div-sub31.9%
associate-/l*31.9%
*-inverses87.5%
/-rgt-identity87.5%
Simplified87.5%
Taylor expanded in x around 0 87.5%
+-commutative87.5%
Simplified87.5%
Final simplification84.2%
(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 76.2%
distribute-rgt1-in77.4%
associate-/l/77.4%
div-sub76.2%
associate-/l*76.2%
*-inverses79.4%
/-rgt-identity79.4%
Simplified79.4%
Taylor expanded in wj around 0 81.1%
*-commutative81.1%
Simplified81.1%
Final simplification81.1%
(FPCore (wj x) :precision binary64 wj)
double code(double wj, double x) {
return wj;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = wj
end function
public static double code(double wj, double x) {
return wj;
}
def code(wj, x): return wj
function code(wj, x) return wj end
function tmp = code(wj, x) tmp = wj; end
code[wj_, x_] := wj
\begin{array}{l}
\\
wj
\end{array}
Initial program 76.2%
distribute-rgt1-in77.4%
associate-/l/77.4%
div-sub76.2%
associate-/l*76.2%
*-inverses79.4%
/-rgt-identity79.4%
Simplified79.4%
Taylor expanded in wj around inf 4.8%
Final simplification4.8%
(FPCore (wj x) :precision binary64 x)
double code(double wj, double x) {
return x;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = x
end function
public static double code(double wj, double x) {
return x;
}
def code(wj, x): return x
function code(wj, x) return x end
function tmp = code(wj, x) tmp = x; end
code[wj_, x_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 76.2%
distribute-rgt1-in77.4%
associate-/l/77.4%
div-sub76.2%
associate-/l*76.2%
*-inverses79.4%
/-rgt-identity79.4%
Simplified79.4%
Taylor expanded in wj around 0 80.6%
Final simplification80.6%
(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 2024013
(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))))))