
(FPCore (wj x) :precision binary64 (let* ((t_0 (* wj (exp wj)))) (- wj (/ (- t_0 x) (+ (exp wj) t_0)))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
return wj - ((t_0 - x) / (exp(wj) + t_0));
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
t_0 = wj * exp(wj)
code = wj - ((t_0 - x) / (exp(wj) + t_0))
end function
public static double code(double wj, double x) {
double t_0 = wj * Math.exp(wj);
return wj - ((t_0 - x) / (Math.exp(wj) + t_0));
}
def code(wj, x): t_0 = wj * math.exp(wj) return wj - ((t_0 - x) / (math.exp(wj) + t_0))
function code(wj, x) t_0 = Float64(wj * exp(wj)) return Float64(wj - Float64(Float64(t_0 - x) / Float64(exp(wj) + t_0))) end
function tmp = code(wj, x) t_0 = wj * exp(wj); tmp = wj - ((t_0 - x) / (exp(wj) + t_0)); end
code[wj_, x_] := Block[{t$95$0 = N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, N[(wj - N[(N[(t$95$0 - x), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := wj \cdot e^{wj}\\
wj - \frac{t\_0 - x}{e^{wj} + t\_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (wj x) :precision binary64 (let* ((t_0 (* wj (exp wj)))) (- wj (/ (- t_0 x) (+ (exp wj) t_0)))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
return wj - ((t_0 - x) / (exp(wj) + t_0));
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
t_0 = wj * exp(wj)
code = wj - ((t_0 - x) / (exp(wj) + t_0))
end function
public static double code(double wj, double x) {
double t_0 = wj * Math.exp(wj);
return wj - ((t_0 - x) / (Math.exp(wj) + t_0));
}
def code(wj, x): t_0 = wj * math.exp(wj) return wj - ((t_0 - x) / (math.exp(wj) + t_0))
function code(wj, x) t_0 = Float64(wj * exp(wj)) return Float64(wj - Float64(Float64(t_0 - x) / Float64(exp(wj) + t_0))) end
function tmp = code(wj, x) t_0 = wj * exp(wj); tmp = wj - ((t_0 - x) / (exp(wj) + t_0)); end
code[wj_, x_] := Block[{t$95$0 = N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, N[(wj - N[(N[(t$95$0 - x), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := wj \cdot e^{wj}\\
wj - \frac{t\_0 - x}{e^{wj} + t\_0}
\end{array}
\end{array}
(FPCore (wj x)
:precision binary64
(let* ((t_0 (+ (* x -4.0) (* x 1.5))))
(if (<= x -6.6e-14)
(+ wj (/ (- (* x (exp (- wj))) wj) (+ wj 1.0)))
(+
x
(+
(* -2.0 (* x wj))
(-
(* (pow wj 2.0) (- 1.0 t_0))
(*
(pow wj 3.0)
(+
1.0
(+ (* x -3.0) (+ (* -2.0 t_0) (* x 0.6666666666666666)))))))))))
double code(double wj, double x) {
double t_0 = (x * -4.0) + (x * 1.5);
double tmp;
if (x <= -6.6e-14) {
tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0));
} else {
tmp = x + ((-2.0 * (x * wj)) + ((pow(wj, 2.0) * (1.0 - t_0)) - (pow(wj, 3.0) * (1.0 + ((x * -3.0) + ((-2.0 * t_0) + (x * 0.6666666666666666)))))));
}
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 (x <= (-6.6d-14)) then
tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0d0))
else
tmp = x + (((-2.0d0) * (x * wj)) + (((wj ** 2.0d0) * (1.0d0 - t_0)) - ((wj ** 3.0d0) * (1.0d0 + ((x * (-3.0d0)) + (((-2.0d0) * t_0) + (x * 0.6666666666666666d0)))))))
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 (x <= -6.6e-14) {
tmp = wj + (((x * Math.exp(-wj)) - wj) / (wj + 1.0));
} else {
tmp = x + ((-2.0 * (x * wj)) + ((Math.pow(wj, 2.0) * (1.0 - t_0)) - (Math.pow(wj, 3.0) * (1.0 + ((x * -3.0) + ((-2.0 * t_0) + (x * 0.6666666666666666)))))));
}
return tmp;
}
def code(wj, x): t_0 = (x * -4.0) + (x * 1.5) tmp = 0 if x <= -6.6e-14: tmp = wj + (((x * math.exp(-wj)) - wj) / (wj + 1.0)) else: tmp = x + ((-2.0 * (x * wj)) + ((math.pow(wj, 2.0) * (1.0 - t_0)) - (math.pow(wj, 3.0) * (1.0 + ((x * -3.0) + ((-2.0 * t_0) + (x * 0.6666666666666666))))))) return tmp
function code(wj, x) t_0 = Float64(Float64(x * -4.0) + Float64(x * 1.5)) tmp = 0.0 if (x <= -6.6e-14) tmp = Float64(wj + Float64(Float64(Float64(x * exp(Float64(-wj))) - wj) / Float64(wj + 1.0))); else tmp = Float64(x + Float64(Float64(-2.0 * Float64(x * wj)) + Float64(Float64((wj ^ 2.0) * Float64(1.0 - t_0)) - Float64((wj ^ 3.0) * Float64(1.0 + Float64(Float64(x * -3.0) + Float64(Float64(-2.0 * t_0) + Float64(x * 0.6666666666666666)))))))); end return tmp end
function tmp_2 = code(wj, x) t_0 = (x * -4.0) + (x * 1.5); tmp = 0.0; if (x <= -6.6e-14) tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0)); else tmp = x + ((-2.0 * (x * wj)) + (((wj ^ 2.0) * (1.0 - t_0)) - ((wj ^ 3.0) * (1.0 + ((x * -3.0) + ((-2.0 * t_0) + (x * 0.6666666666666666))))))); 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[x, -6.6e-14], N[(wj + N[(N[(N[(x * N[Exp[(-wj)], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(-2.0 * N[(x * wj), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[wj, 2.0], $MachinePrecision] * N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision] - N[(N[Power[wj, 3.0], $MachinePrecision] * N[(1.0 + N[(N[(x * -3.0), $MachinePrecision] + N[(N[(-2.0 * t$95$0), $MachinePrecision] + N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot -4 + x \cdot 1.5\\
\mathbf{if}\;x \leq -6.6 \cdot 10^{-14}:\\
\;\;\;\;wj + \frac{x \cdot e^{-wj} - wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;x + \left(-2 \cdot \left(x \cdot wj\right) + \left({wj}^{2} \cdot \left(1 - t\_0\right) - {wj}^{3} \cdot \left(1 + \left(x \cdot -3 + \left(-2 \cdot t\_0 + x \cdot 0.6666666666666666\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if x < -6.5999999999999996e-14Initial program 97.2%
distribute-rgt1-in98.5%
associate-/l/98.5%
div-sub97.2%
associate-/l*97.2%
*-inverses99.9%
/-rgt-identity99.9%
Simplified99.9%
clear-num99.8%
associate-/r/99.8%
rec-exp99.9%
Applied egg-rr99.9%
if -6.5999999999999996e-14 < x Initial program 64.2%
distribute-rgt1-in64.2%
associate-/l/64.2%
div-sub64.2%
associate-/l*64.2%
*-inverses64.2%
/-rgt-identity64.2%
Simplified64.2%
Taylor expanded in wj around 0 97.9%
Final simplification98.5%
(FPCore (wj x)
:precision binary64
(if (<= x -2e-15)
(+ wj (/ (- (* x (exp (- wj))) wj) (+ wj 1.0)))
(+
x
(+
(* -2.0 (* x wj))
(- (* (pow wj 2.0) (- 1.0 (+ (* x -4.0) (* x 1.5)))) (pow wj 3.0))))))
double code(double wj, double x) {
double tmp;
if (x <= -2e-15) {
tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0));
} else {
tmp = x + ((-2.0 * (x * wj)) + ((pow(wj, 2.0) * (1.0 - ((x * -4.0) + (x * 1.5)))) - 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 (x <= (-2d-15)) then
tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0d0))
else
tmp = x + (((-2.0d0) * (x * wj)) + (((wj ** 2.0d0) * (1.0d0 - ((x * (-4.0d0)) + (x * 1.5d0)))) - (wj ** 3.0d0)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (x <= -2e-15) {
tmp = wj + (((x * Math.exp(-wj)) - wj) / (wj + 1.0));
} else {
tmp = x + ((-2.0 * (x * wj)) + ((Math.pow(wj, 2.0) * (1.0 - ((x * -4.0) + (x * 1.5)))) - Math.pow(wj, 3.0)));
}
return tmp;
}
def code(wj, x): tmp = 0 if x <= -2e-15: tmp = wj + (((x * math.exp(-wj)) - wj) / (wj + 1.0)) else: tmp = x + ((-2.0 * (x * wj)) + ((math.pow(wj, 2.0) * (1.0 - ((x * -4.0) + (x * 1.5)))) - math.pow(wj, 3.0))) return tmp
function code(wj, x) tmp = 0.0 if (x <= -2e-15) tmp = Float64(wj + Float64(Float64(Float64(x * exp(Float64(-wj))) - wj) / Float64(wj + 1.0))); else tmp = Float64(x + Float64(Float64(-2.0 * Float64(x * wj)) + Float64(Float64((wj ^ 2.0) * Float64(1.0 - Float64(Float64(x * -4.0) + Float64(x * 1.5)))) - (wj ^ 3.0)))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (x <= -2e-15) tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0)); else tmp = x + ((-2.0 * (x * wj)) + (((wj ^ 2.0) * (1.0 - ((x * -4.0) + (x * 1.5)))) - (wj ^ 3.0))); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[x, -2e-15], N[(wj + N[(N[(N[(x * N[Exp[(-wj)], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(-2.0 * N[(x * wj), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[wj, 2.0], $MachinePrecision] * N[(1.0 - N[(N[(x * -4.0), $MachinePrecision] + N[(x * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[wj, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-15}:\\
\;\;\;\;wj + \frac{x \cdot e^{-wj} - wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;x + \left(-2 \cdot \left(x \cdot wj\right) + \left({wj}^{2} \cdot \left(1 - \left(x \cdot -4 + x \cdot 1.5\right)\right) - {wj}^{3}\right)\right)\\
\end{array}
\end{array}
if x < -2.0000000000000002e-15Initial program 97.2%
distribute-rgt1-in98.5%
associate-/l/98.5%
div-sub97.2%
associate-/l*97.2%
*-inverses99.9%
/-rgt-identity99.9%
Simplified99.9%
clear-num99.8%
associate-/r/99.8%
rec-exp99.9%
Applied egg-rr99.9%
if -2.0000000000000002e-15 < x Initial program 64.2%
distribute-rgt1-in64.2%
associate-/l/64.2%
div-sub64.2%
associate-/l*64.2%
*-inverses64.2%
/-rgt-identity64.2%
Simplified64.2%
Taylor expanded in wj around 0 97.9%
Taylor expanded in x around 0 97.8%
Final simplification98.4%
(FPCore (wj x) :precision binary64 (if (<= wj 6e-9) (+ x (+ (* -2.0 (* x wj)) (- (pow wj 2.0) (pow wj 3.0)))) (+ wj (/ (- (* x (exp (- wj))) wj) (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 6e-9) {
tmp = x + ((-2.0 * (x * wj)) + (pow(wj, 2.0) - pow(wj, 3.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 (wj <= 6d-9) then
tmp = x + (((-2.0d0) * (x * wj)) + ((wj ** 2.0d0) - (wj ** 3.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 (wj <= 6e-9) {
tmp = x + ((-2.0 * (x * wj)) + (Math.pow(wj, 2.0) - Math.pow(wj, 3.0)));
} else {
tmp = wj + (((x * Math.exp(-wj)) - wj) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 6e-9: tmp = x + ((-2.0 * (x * wj)) + (math.pow(wj, 2.0) - math.pow(wj, 3.0))) else: tmp = wj + (((x * math.exp(-wj)) - wj) / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 6e-9) tmp = Float64(x + Float64(Float64(-2.0 * Float64(x * wj)) + Float64((wj ^ 2.0) - (wj ^ 3.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 (wj <= 6e-9) tmp = x + ((-2.0 * (x * wj)) + ((wj ^ 2.0) - (wj ^ 3.0))); else tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 6e-9], N[(x + N[(N[(-2.0 * N[(x * wj), $MachinePrecision]), $MachinePrecision] + N[(N[Power[wj, 2.0], $MachinePrecision] - N[Power[wj, 3.0], $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}\;wj \leq 6 \cdot 10^{-9}:\\
\;\;\;\;x + \left(-2 \cdot \left(x \cdot wj\right) + \left({wj}^{2} - {wj}^{3}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{x \cdot e^{-wj} - wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 5.99999999999999996e-9Initial program 73.5%
distribute-rgt1-in73.9%
associate-/l/73.9%
div-sub73.5%
associate-/l*73.5%
*-inverses73.9%
/-rgt-identity73.9%
Simplified73.9%
Taylor expanded in wj around 0 98.3%
Taylor expanded in x around 0 98.3%
Taylor expanded in x around 0 98.4%
if 5.99999999999999996e-9 < wj Initial program 83.9%
distribute-rgt1-in83.8%
associate-/l/85.0%
div-sub85.0%
associate-/l*85.0%
*-inverses96.1%
/-rgt-identity96.1%
Simplified96.1%
clear-num96.2%
associate-/r/96.3%
rec-exp96.7%
Applied egg-rr96.7%
Final simplification98.4%
(FPCore (wj x) :precision binary64 (if (<= wj 5.8e-9) (+ x (+ (* -2.0 (* x wj)) (pow wj 2.0))) (+ wj (/ (- (* x (exp (- wj))) wj) (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 5.8e-9) {
tmp = x + ((-2.0 * (x * wj)) + pow(wj, 2.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 (wj <= 5.8d-9) then
tmp = x + (((-2.0d0) * (x * wj)) + (wj ** 2.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 (wj <= 5.8e-9) {
tmp = x + ((-2.0 * (x * wj)) + Math.pow(wj, 2.0));
} else {
tmp = wj + (((x * Math.exp(-wj)) - wj) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 5.8e-9: tmp = x + ((-2.0 * (x * wj)) + math.pow(wj, 2.0)) else: tmp = wj + (((x * math.exp(-wj)) - wj) / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 5.8e-9) tmp = Float64(x + Float64(Float64(-2.0 * Float64(x * wj)) + (wj ^ 2.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 (wj <= 5.8e-9) tmp = x + ((-2.0 * (x * wj)) + (wj ^ 2.0)); else tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 5.8e-9], N[(x + N[(N[(-2.0 * N[(x * wj), $MachinePrecision]), $MachinePrecision] + N[Power[wj, 2.0], $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}\;wj \leq 5.8 \cdot 10^{-9}:\\
\;\;\;\;x + \left(-2 \cdot \left(x \cdot wj\right) + {wj}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{x \cdot e^{-wj} - wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 5.79999999999999982e-9Initial program 73.5%
distribute-rgt1-in73.9%
associate-/l/73.9%
div-sub73.5%
associate-/l*73.5%
*-inverses73.9%
/-rgt-identity73.9%
Simplified73.9%
Taylor expanded in wj around 0 98.3%
Taylor expanded in x around 0 98.3%
Taylor expanded in x around 0 98.4%
Taylor expanded in wj around 0 97.7%
if 5.79999999999999982e-9 < wj Initial program 83.9%
distribute-rgt1-in83.8%
associate-/l/85.0%
div-sub85.0%
associate-/l*85.0%
*-inverses96.1%
/-rgt-identity96.1%
Simplified96.1%
clear-num96.2%
associate-/r/96.3%
rec-exp96.7%
Applied egg-rr96.7%
Final simplification97.7%
(FPCore (wj x) :precision binary64 (if (<= wj 5.8e-9) (+ x (+ (* -2.0 (* x wj)) (pow wj 2.0))) (+ wj (/ (- (/ x (exp wj)) wj) (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 5.8e-9) {
tmp = x + ((-2.0 * (x * wj)) + pow(wj, 2.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 (wj <= 5.8d-9) then
tmp = x + (((-2.0d0) * (x * wj)) + (wj ** 2.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 (wj <= 5.8e-9) {
tmp = x + ((-2.0 * (x * wj)) + Math.pow(wj, 2.0));
} else {
tmp = wj + (((x / Math.exp(wj)) - wj) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 5.8e-9: tmp = x + ((-2.0 * (x * wj)) + math.pow(wj, 2.0)) else: tmp = wj + (((x / math.exp(wj)) - wj) / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 5.8e-9) tmp = Float64(x + Float64(Float64(-2.0 * Float64(x * wj)) + (wj ^ 2.0))); else tmp = Float64(wj + Float64(Float64(Float64(x / exp(wj)) - wj) / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 5.8e-9) tmp = x + ((-2.0 * (x * wj)) + (wj ^ 2.0)); else tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 5.8e-9], N[(x + N[(N[(-2.0 * N[(x * wj), $MachinePrecision]), $MachinePrecision] + N[Power[wj, 2.0], $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}\;wj \leq 5.8 \cdot 10^{-9}:\\
\;\;\;\;x + \left(-2 \cdot \left(x \cdot wj\right) + {wj}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 5.79999999999999982e-9Initial program 73.5%
distribute-rgt1-in73.9%
associate-/l/73.9%
div-sub73.5%
associate-/l*73.5%
*-inverses73.9%
/-rgt-identity73.9%
Simplified73.9%
Taylor expanded in wj around 0 98.3%
Taylor expanded in x around 0 98.3%
Taylor expanded in x around 0 98.4%
Taylor expanded in wj around 0 97.7%
if 5.79999999999999982e-9 < wj Initial program 83.9%
distribute-rgt1-in83.8%
associate-/l/85.0%
div-sub85.0%
associate-/l*85.0%
*-inverses96.1%
/-rgt-identity96.1%
Simplified96.1%
Final simplification97.7%
(FPCore (wj x)
:precision binary64
(if (<= wj 5.3e-39)
(* x (- (/ 1.0 (+ wj 1.0)) (/ wj (+ wj 1.0))))
(if (<= wj 1.9e-13)
(pow wj 2.0)
(+ wj (/ (- (- x (* x wj)) wj) (+ wj 1.0))))))
double code(double wj, double x) {
double tmp;
if (wj <= 5.3e-39) {
tmp = x * ((1.0 / (wj + 1.0)) - (wj / (wj + 1.0)));
} else if (wj <= 1.9e-13) {
tmp = pow(wj, 2.0);
} else {
tmp = wj + (((x - (x * 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 <= 5.3d-39) then
tmp = x * ((1.0d0 / (wj + 1.0d0)) - (wj / (wj + 1.0d0)))
else if (wj <= 1.9d-13) then
tmp = wj ** 2.0d0
else
tmp = wj + (((x - (x * wj)) - wj) / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 5.3e-39) {
tmp = x * ((1.0 / (wj + 1.0)) - (wj / (wj + 1.0)));
} else if (wj <= 1.9e-13) {
tmp = Math.pow(wj, 2.0);
} else {
tmp = wj + (((x - (x * wj)) - wj) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 5.3e-39: tmp = x * ((1.0 / (wj + 1.0)) - (wj / (wj + 1.0))) elif wj <= 1.9e-13: tmp = math.pow(wj, 2.0) else: tmp = wj + (((x - (x * wj)) - wj) / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 5.3e-39) tmp = Float64(x * Float64(Float64(1.0 / Float64(wj + 1.0)) - Float64(wj / Float64(wj + 1.0)))); elseif (wj <= 1.9e-13) tmp = wj ^ 2.0; else tmp = Float64(wj + Float64(Float64(Float64(x - Float64(x * wj)) - wj) / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 5.3e-39) tmp = x * ((1.0 / (wj + 1.0)) - (wj / (wj + 1.0))); elseif (wj <= 1.9e-13) tmp = wj ^ 2.0; else tmp = wj + (((x - (x * wj)) - wj) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 5.3e-39], N[(x * N[(N[(1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision] - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 1.9e-13], N[Power[wj, 2.0], $MachinePrecision], N[(wj + N[(N[(N[(x - N[(x * wj), $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 5.3 \cdot 10^{-39}:\\
\;\;\;\;x \cdot \left(\frac{1}{wj + 1} - \frac{wj}{wj + 1}\right)\\
\mathbf{elif}\;wj \leq 1.9 \cdot 10^{-13}:\\
\;\;\;\;{wj}^{2}\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{\left(x - x \cdot wj\right) - wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 5.30000000000000003e-39Initial program 76.3%
distribute-rgt1-in76.7%
associate-/l/76.8%
div-sub76.3%
associate-/l*76.3%
*-inverses76.8%
/-rgt-identity76.8%
Simplified76.8%
clear-num76.6%
inv-pow76.6%
Applied egg-rr76.6%
unpow-176.6%
Simplified76.6%
Taylor expanded in wj around 0 75.1%
mul-1-neg87.4%
unsub-neg87.4%
*-commutative87.4%
Simplified75.1%
Taylor expanded in x around inf 87.4%
+-commutative87.4%
+-commutative87.4%
Simplified87.4%
if 5.30000000000000003e-39 < wj < 1.9e-13Initial program 23.7%
distribute-rgt1-in23.7%
associate-/l/23.3%
div-sub23.3%
associate-/l*23.3%
*-inverses23.3%
/-rgt-identity23.3%
Simplified23.3%
clear-num24.1%
inv-pow24.1%
Applied egg-rr24.1%
unpow-124.1%
Simplified24.1%
Taylor expanded in x around 0 9.0%
+-commutative9.0%
Simplified9.0%
Taylor expanded in wj around 0 77.9%
if 1.9e-13 < wj Initial program 81.0%
distribute-rgt1-in80.9%
associate-/l/82.4%
div-sub82.4%
associate-/l*82.4%
*-inverses91.5%
/-rgt-identity91.5%
Simplified91.5%
Taylor expanded in wj around 0 75.6%
mul-1-neg35.6%
unsub-neg35.6%
*-commutative35.6%
Simplified75.6%
Final simplification86.4%
(FPCore (wj x)
:precision binary64
(if (<= wj 5.3e-39)
(/ x (* (+ wj 1.0) (exp wj)))
(if (<= wj 1.9e-13)
(pow wj 2.0)
(+ wj (/ (- (- x (* x wj)) wj) (+ wj 1.0))))))
double code(double wj, double x) {
double tmp;
if (wj <= 5.3e-39) {
tmp = x / ((wj + 1.0) * exp(wj));
} else if (wj <= 1.9e-13) {
tmp = pow(wj, 2.0);
} else {
tmp = wj + (((x - (x * 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 <= 5.3d-39) then
tmp = x / ((wj + 1.0d0) * exp(wj))
else if (wj <= 1.9d-13) then
tmp = wj ** 2.0d0
else
tmp = wj + (((x - (x * wj)) - wj) / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 5.3e-39) {
tmp = x / ((wj + 1.0) * Math.exp(wj));
} else if (wj <= 1.9e-13) {
tmp = Math.pow(wj, 2.0);
} else {
tmp = wj + (((x - (x * wj)) - wj) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 5.3e-39: tmp = x / ((wj + 1.0) * math.exp(wj)) elif wj <= 1.9e-13: tmp = math.pow(wj, 2.0) else: tmp = wj + (((x - (x * wj)) - wj) / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 5.3e-39) tmp = Float64(x / Float64(Float64(wj + 1.0) * exp(wj))); elseif (wj <= 1.9e-13) tmp = wj ^ 2.0; else tmp = Float64(wj + Float64(Float64(Float64(x - Float64(x * wj)) - wj) / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 5.3e-39) tmp = x / ((wj + 1.0) * exp(wj)); elseif (wj <= 1.9e-13) tmp = wj ^ 2.0; else tmp = wj + (((x - (x * wj)) - wj) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 5.3e-39], N[(x / N[(N[(wj + 1.0), $MachinePrecision] * N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 1.9e-13], N[Power[wj, 2.0], $MachinePrecision], N[(wj + N[(N[(N[(x - N[(x * wj), $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 5.3 \cdot 10^{-39}:\\
\;\;\;\;\frac{x}{\left(wj + 1\right) \cdot e^{wj}}\\
\mathbf{elif}\;wj \leq 1.9 \cdot 10^{-13}:\\
\;\;\;\;{wj}^{2}\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{\left(x - x \cdot wj\right) - wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 5.30000000000000003e-39Initial program 76.3%
distribute-rgt1-in76.7%
associate-/l/76.8%
div-sub76.3%
associate-/l*76.3%
*-inverses76.8%
/-rgt-identity76.8%
Simplified76.8%
Taylor expanded in x around inf 88.9%
if 5.30000000000000003e-39 < wj < 1.9e-13Initial program 23.7%
distribute-rgt1-in23.7%
associate-/l/23.3%
div-sub23.3%
associate-/l*23.3%
*-inverses23.3%
/-rgt-identity23.3%
Simplified23.3%
clear-num24.1%
inv-pow24.1%
Applied egg-rr24.1%
unpow-124.1%
Simplified24.1%
Taylor expanded in x around 0 9.0%
+-commutative9.0%
Simplified9.0%
Taylor expanded in wj around 0 77.9%
if 1.9e-13 < wj Initial program 81.0%
distribute-rgt1-in80.9%
associate-/l/82.4%
div-sub82.4%
associate-/l*82.4%
*-inverses91.5%
/-rgt-identity91.5%
Simplified91.5%
Taylor expanded in wj around 0 75.6%
mul-1-neg35.6%
unsub-neg35.6%
*-commutative35.6%
Simplified75.6%
Final simplification87.7%
(FPCore (wj x) :precision binary64 (+ x (+ (* -2.0 (* x wj)) (pow wj 2.0))))
double code(double wj, double x) {
return x + ((-2.0 * (x * wj)) + pow(wj, 2.0));
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = x + (((-2.0d0) * (x * wj)) + (wj ** 2.0d0))
end function
public static double code(double wj, double x) {
return x + ((-2.0 * (x * wj)) + Math.pow(wj, 2.0));
}
def code(wj, x): return x + ((-2.0 * (x * wj)) + math.pow(wj, 2.0))
function code(wj, x) return Float64(x + Float64(Float64(-2.0 * Float64(x * wj)) + (wj ^ 2.0))) end
function tmp = code(wj, x) tmp = x + ((-2.0 * (x * wj)) + (wj ^ 2.0)); end
code[wj_, x_] := N[(x + N[(N[(-2.0 * N[(x * wj), $MachinePrecision]), $MachinePrecision] + N[Power[wj, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(-2 \cdot \left(x \cdot wj\right) + {wj}^{2}\right)
\end{array}
Initial program 73.9%
distribute-rgt1-in74.2%
associate-/l/74.3%
div-sub73.9%
associate-/l*73.9%
*-inverses74.7%
/-rgt-identity74.7%
Simplified74.7%
Taylor expanded in wj around 0 96.5%
Taylor expanded in x around 0 96.5%
Taylor expanded in x around 0 96.5%
Taylor expanded in wj around 0 95.7%
Final simplification95.7%
(FPCore (wj x) :precision binary64 (if (<= wj 1.05e-21) (* x (- (/ 1.0 (+ wj 1.0)) (/ wj (+ wj 1.0)))) (+ wj (/ (- (- x (* x wj)) wj) (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 1.05e-21) {
tmp = x * ((1.0 / (wj + 1.0)) - (wj / (wj + 1.0)));
} else {
tmp = wj + (((x - (x * 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 <= 1.05d-21) then
tmp = x * ((1.0d0 / (wj + 1.0d0)) - (wj / (wj + 1.0d0)))
else
tmp = wj + (((x - (x * wj)) - wj) / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 1.05e-21) {
tmp = x * ((1.0 / (wj + 1.0)) - (wj / (wj + 1.0)));
} else {
tmp = wj + (((x - (x * wj)) - wj) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 1.05e-21: tmp = x * ((1.0 / (wj + 1.0)) - (wj / (wj + 1.0))) else: tmp = wj + (((x - (x * wj)) - wj) / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 1.05e-21) tmp = Float64(x * Float64(Float64(1.0 / Float64(wj + 1.0)) - Float64(wj / Float64(wj + 1.0)))); else tmp = Float64(wj + Float64(Float64(Float64(x - Float64(x * wj)) - wj) / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 1.05e-21) tmp = x * ((1.0 / (wj + 1.0)) - (wj / (wj + 1.0))); else tmp = wj + (((x - (x * wj)) - wj) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 1.05e-21], N[(x * N[(N[(1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision] - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(N[(N[(x - N[(x * wj), $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 1.05 \cdot 10^{-21}:\\
\;\;\;\;x \cdot \left(\frac{1}{wj + 1} - \frac{wj}{wj + 1}\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{\left(x - x \cdot wj\right) - wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 1.05000000000000006e-21Initial program 74.3%
distribute-rgt1-in74.7%
associate-/l/74.7%
div-sub74.3%
associate-/l*74.3%
*-inverses74.7%
/-rgt-identity74.7%
Simplified74.7%
clear-num74.6%
inv-pow74.6%
Applied egg-rr74.6%
unpow-174.6%
Simplified74.6%
Taylor expanded in wj around 0 73.1%
mul-1-neg85.0%
unsub-neg85.0%
*-commutative85.0%
Simplified73.1%
Taylor expanded in x around inf 85.0%
+-commutative85.0%
+-commutative85.0%
Simplified85.0%
if 1.05000000000000006e-21 < wj Initial program 67.1%
distribute-rgt1-in67.1%
associate-/l/67.7%
div-sub67.7%
associate-/l*67.7%
*-inverses74.0%
/-rgt-identity74.0%
Simplified74.0%
Taylor expanded in wj around 0 63.1%
mul-1-neg31.5%
unsub-neg31.5%
*-commutative31.5%
Simplified63.1%
Final simplification83.6%
(FPCore (wj x) :precision binary64 (if (<= wj 0.000155) (/ (- x (* x wj)) (+ wj 1.0)) (- wj (/ wj (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 0.000155) {
tmp = (x - (x * wj)) / (wj + 1.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 <= 0.000155d0) then
tmp = (x - (x * wj)) / (wj + 1.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 <= 0.000155) {
tmp = (x - (x * wj)) / (wj + 1.0);
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 0.000155: tmp = (x - (x * wj)) / (wj + 1.0) else: tmp = wj - (wj / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 0.000155) tmp = Float64(Float64(x - Float64(x * wj)) / Float64(wj + 1.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 <= 0.000155) tmp = (x - (x * wj)) / (wj + 1.0); else tmp = wj - (wj / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 0.000155], N[(N[(x - N[(x * wj), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision], N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 0.000155:\\
\;\;\;\;\frac{x - x \cdot wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 1.55e-4Initial program 73.8%
distribute-rgt1-in74.2%
associate-/l/74.2%
div-sub73.8%
associate-/l*73.8%
*-inverses74.2%
/-rgt-identity74.2%
Simplified74.2%
Taylor expanded in x around inf 85.1%
associate-/r*85.1%
+-commutative85.1%
Simplified85.1%
Taylor expanded in wj around 0 83.5%
mul-1-neg83.5%
unsub-neg83.5%
*-commutative83.5%
Simplified83.5%
if 1.55e-4 < wj Initial program 76.4%
distribute-rgt1-in76.4%
associate-/l/78.3%
div-sub78.3%
associate-/l*78.3%
*-inverses95.0%
/-rgt-identity95.0%
Simplified95.0%
Taylor expanded in x around 0 78.7%
+-commutative78.7%
Simplified78.7%
Final simplification83.4%
(FPCore (wj x) :precision binary64 (if (<= wj 0.000145) (+ x (* -2.0 (* x wj))) (- wj (/ wj (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 0.000145) {
tmp = x + (-2.0 * (x * 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 <= 0.000145d0) then
tmp = x + ((-2.0d0) * (x * 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 <= 0.000145) {
tmp = x + (-2.0 * (x * wj));
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 0.000145: tmp = x + (-2.0 * (x * wj)) else: tmp = wj - (wj / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 0.000145) tmp = Float64(x + Float64(-2.0 * Float64(x * 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 <= 0.000145) tmp = x + (-2.0 * (x * wj)); else tmp = wj - (wj / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 0.000145], N[(x + N[(-2.0 * N[(x * wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj - N[(wj / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 0.000145:\\
\;\;\;\;x + -2 \cdot \left(x \cdot wj\right)\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 1.45e-4Initial program 73.8%
distribute-rgt1-in74.2%
associate-/l/74.2%
div-sub73.8%
associate-/l*73.8%
*-inverses74.2%
/-rgt-identity74.2%
Simplified74.2%
Taylor expanded in wj around 0 83.4%
*-commutative83.4%
Simplified83.4%
if 1.45e-4 < wj Initial program 76.4%
distribute-rgt1-in76.4%
associate-/l/78.3%
div-sub78.3%
associate-/l*78.3%
*-inverses95.0%
/-rgt-identity95.0%
Simplified95.0%
Taylor expanded in x around 0 78.7%
+-commutative78.7%
Simplified78.7%
Final simplification83.3%
(FPCore (wj x) :precision binary64 (if (<= wj 0.00015) (/ x (+ 1.0 (* wj 2.0))) (- wj (/ wj (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 0.00015) {
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 <= 0.00015d0) 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 <= 0.00015) {
tmp = x / (1.0 + (wj * 2.0));
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 0.00015: 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 <= 0.00015) 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 <= 0.00015) 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, 0.00015], 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 0.00015:\\
\;\;\;\;\frac{x}{1 + wj \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 1.49999999999999987e-4Initial program 73.8%
distribute-rgt1-in74.2%
associate-/l/74.2%
div-sub73.8%
associate-/l*73.8%
*-inverses74.2%
/-rgt-identity74.2%
Simplified74.2%
Taylor expanded in x around inf 85.1%
Taylor expanded in wj around 0 83.5%
*-commutative83.5%
Simplified83.5%
if 1.49999999999999987e-4 < wj Initial program 76.4%
distribute-rgt1-in76.4%
associate-/l/78.3%
div-sub78.3%
associate-/l*78.3%
*-inverses95.0%
/-rgt-identity95.0%
Simplified95.0%
Taylor expanded in x around 0 78.7%
+-commutative78.7%
Simplified78.7%
Final simplification83.3%
(FPCore (wj x) :precision binary64 (+ x (* -2.0 (* x wj))))
double code(double wj, double x) {
return x + (-2.0 * (x * wj));
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = x + ((-2.0d0) * (x * wj))
end function
public static double code(double wj, double x) {
return x + (-2.0 * (x * wj));
}
def code(wj, x): return x + (-2.0 * (x * wj))
function code(wj, x) return Float64(x + Float64(-2.0 * Float64(x * wj))) end
function tmp = code(wj, x) tmp = x + (-2.0 * (x * wj)); end
code[wj_, x_] := N[(x + N[(-2.0 * N[(x * wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + -2 \cdot \left(x \cdot wj\right)
\end{array}
Initial program 73.9%
distribute-rgt1-in74.2%
associate-/l/74.3%
div-sub73.9%
associate-/l*73.9%
*-inverses74.7%
/-rgt-identity74.7%
Simplified74.7%
Taylor expanded in wj around 0 81.6%
*-commutative81.6%
Simplified81.6%
Final simplification81.6%
(FPCore (wj x) :precision binary64 wj)
double code(double wj, double x) {
return wj;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = wj
end function
public static double code(double wj, double x) {
return wj;
}
def code(wj, x): return wj
function code(wj, x) return wj end
function tmp = code(wj, x) tmp = wj; end
code[wj_, x_] := wj
\begin{array}{l}
\\
wj
\end{array}
Initial program 73.9%
distribute-rgt1-in74.2%
associate-/l/74.3%
div-sub73.9%
associate-/l*73.9%
*-inverses74.7%
/-rgt-identity74.7%
Simplified74.7%
Taylor expanded in wj around inf 4.1%
Final simplification4.1%
(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 73.9%
distribute-rgt1-in74.2%
associate-/l/74.3%
div-sub73.9%
associate-/l*73.9%
*-inverses74.7%
/-rgt-identity74.7%
Simplified74.7%
Taylor expanded in wj around 0 80.7%
Final simplification80.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 2024030
(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))))))