
(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 22 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 -1.2e-6)
(+ wj (* (- wj (/ x (exp wj))) (/ -1.0 (+ wj 1.0))))
(if (<= wj 3e-6)
(+
x
(+
(* -2.0 (* wj x))
(- (* (pow wj 2.0) (- 1.0 (+ (* x -4.0) (* x 1.5)))) (pow wj 3.0))))
(/ 1.0 (+ (/ 1.0 wj) (/ (/ 1.0 wj) wj))))))
double code(double wj, double x) {
double tmp;
if (wj <= -1.2e-6) {
tmp = wj + ((wj - (x / exp(wj))) * (-1.0 / (wj + 1.0)));
} else if (wj <= 3e-6) {
tmp = x + ((-2.0 * (wj * x)) + ((pow(wj, 2.0) * (1.0 - ((x * -4.0) + (x * 1.5)))) - pow(wj, 3.0)));
} else {
tmp = 1.0 / ((1.0 / wj) + ((1.0 / 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 <= (-1.2d-6)) then
tmp = wj + ((wj - (x / exp(wj))) * ((-1.0d0) / (wj + 1.0d0)))
else if (wj <= 3d-6) then
tmp = x + (((-2.0d0) * (wj * x)) + (((wj ** 2.0d0) * (1.0d0 - ((x * (-4.0d0)) + (x * 1.5d0)))) - (wj ** 3.0d0)))
else
tmp = 1.0d0 / ((1.0d0 / wj) + ((1.0d0 / wj) / wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -1.2e-6) {
tmp = wj + ((wj - (x / Math.exp(wj))) * (-1.0 / (wj + 1.0)));
} else if (wj <= 3e-6) {
tmp = x + ((-2.0 * (wj * x)) + ((Math.pow(wj, 2.0) * (1.0 - ((x * -4.0) + (x * 1.5)))) - Math.pow(wj, 3.0)));
} else {
tmp = 1.0 / ((1.0 / wj) + ((1.0 / wj) / wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -1.2e-6: tmp = wj + ((wj - (x / math.exp(wj))) * (-1.0 / (wj + 1.0))) elif wj <= 3e-6: tmp = x + ((-2.0 * (wj * x)) + ((math.pow(wj, 2.0) * (1.0 - ((x * -4.0) + (x * 1.5)))) - math.pow(wj, 3.0))) else: tmp = 1.0 / ((1.0 / wj) + ((1.0 / wj) / wj)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -1.2e-6) tmp = Float64(wj + Float64(Float64(wj - Float64(x / exp(wj))) * Float64(-1.0 / Float64(wj + 1.0)))); elseif (wj <= 3e-6) tmp = Float64(x + Float64(Float64(-2.0 * Float64(wj * x)) + Float64(Float64((wj ^ 2.0) * Float64(1.0 - Float64(Float64(x * -4.0) + Float64(x * 1.5)))) - (wj ^ 3.0)))); else tmp = Float64(1.0 / Float64(Float64(1.0 / wj) + Float64(Float64(1.0 / wj) / wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -1.2e-6) tmp = wj + ((wj - (x / exp(wj))) * (-1.0 / (wj + 1.0))); elseif (wj <= 3e-6) tmp = x + ((-2.0 * (wj * x)) + (((wj ^ 2.0) * (1.0 - ((x * -4.0) + (x * 1.5)))) - (wj ^ 3.0))); else tmp = 1.0 / ((1.0 / wj) + ((1.0 / wj) / wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -1.2e-6], N[(wj + N[(N[(wj - N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 3e-6], N[(x + N[(N[(-2.0 * N[(wj * x), $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], N[(1.0 / N[(N[(1.0 / wj), $MachinePrecision] + N[(N[(1.0 / wj), $MachinePrecision] / wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -1.2 \cdot 10^{-6}:\\
\;\;\;\;wj + \left(wj - \frac{x}{e^{wj}}\right) \cdot \frac{-1}{wj + 1}\\
\mathbf{elif}\;wj \leq 3 \cdot 10^{-6}:\\
\;\;\;\;x + \left(-2 \cdot \left(wj \cdot x\right) + \left({wj}^{2} \cdot \left(1 - \left(x \cdot -4 + x \cdot 1.5\right)\right) - {wj}^{3}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{wj} + \frac{\frac{1}{wj}}{wj}}\\
\end{array}
\end{array}
if wj < -1.1999999999999999e-6Initial program 84.3%
distribute-rgt1-in94.1%
associate-/l/94.5%
div-sub84.5%
associate-/l*84.5%
*-inverses94.5%
/-rgt-identity94.5%
Simplified94.5%
clear-num93.8%
associate-/r/94.6%
Applied egg-rr94.6%
if -1.1999999999999999e-6 < wj < 3.0000000000000001e-6Initial program 76.6%
distribute-rgt1-in76.7%
associate-/l/76.7%
div-sub76.7%
associate-/l*76.7%
*-inverses76.7%
/-rgt-identity76.7%
Simplified76.7%
Taylor expanded in wj around 0 100.0%
Taylor expanded in x around 0 100.0%
if 3.0000000000000001e-6 < wj Initial program 23.5%
distribute-rgt1-in23.5%
associate-/l/23.9%
div-sub23.9%
associate-/l*23.9%
*-inverses95.3%
/-rgt-identity95.3%
Simplified95.3%
flip--95.5%
clear-num95.3%
pow295.3%
pow295.3%
Applied egg-rr95.3%
Taylor expanded in wj around inf 99.3%
inv-pow99.3%
unpow299.3%
pow-prod-down99.0%
inv-pow99.0%
inv-pow99.0%
Applied egg-rr99.0%
un-div-inv99.3%
Applied egg-rr99.3%
Final simplification99.8%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (* wj (exp wj)))
(t_1 (+ (* x -4.0) (* x 1.5)))
(t_2 (/ x (exp wj)))
(t_3 (- wj t_2)))
(if (<= (+ wj (/ (- x t_0) (+ (exp wj) t_0))) 5e-18)
(+
x
(+
(* -2.0 (* wj x))
(+
(*
(pow wj 3.0)
(- -1.0 (+ (* x -3.0) (+ (* -2.0 t_1) (* x 0.6666666666666666)))))
(* (pow wj 2.0) (- 1.0 t_1)))))
(+
(+ wj (/ (- t_2 wj) (+ wj 1.0)))
(fma (/ -1.0 (+ wj 1.0)) t_3 (/ t_3 (+ 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 t_2 = x / exp(wj);
double t_3 = wj - t_2;
double tmp;
if ((wj + ((x - t_0) / (exp(wj) + t_0))) <= 5e-18) {
tmp = x + ((-2.0 * (wj * x)) + ((pow(wj, 3.0) * (-1.0 - ((x * -3.0) + ((-2.0 * t_1) + (x * 0.6666666666666666))))) + (pow(wj, 2.0) * (1.0 - t_1))));
} else {
tmp = (wj + ((t_2 - wj) / (wj + 1.0))) + fma((-1.0 / (wj + 1.0)), t_3, (t_3 / (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)) t_2 = Float64(x / exp(wj)) t_3 = Float64(wj - t_2) tmp = 0.0 if (Float64(wj + Float64(Float64(x - t_0) / Float64(exp(wj) + t_0))) <= 5e-18) tmp = Float64(x + Float64(Float64(-2.0 * Float64(wj * x)) + Float64(Float64((wj ^ 3.0) * Float64(-1.0 - Float64(Float64(x * -3.0) + Float64(Float64(-2.0 * t_1) + Float64(x * 0.6666666666666666))))) + Float64((wj ^ 2.0) * Float64(1.0 - t_1))))); else tmp = Float64(Float64(wj + Float64(Float64(t_2 - wj) / Float64(wj + 1.0))) + fma(Float64(-1.0 / Float64(wj + 1.0)), t_3, Float64(t_3 / Float64(wj + 1.0)))); end return 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]}, Block[{t$95$2 = N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(wj - t$95$2), $MachinePrecision]}, If[LessEqual[N[(wj + N[(N[(x - t$95$0), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-18], N[(x + N[(N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[wj, 3.0], $MachinePrecision] * N[(-1.0 - N[(N[(x * -3.0), $MachinePrecision] + N[(N[(-2.0 * t$95$1), $MachinePrecision] + N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[wj, 2.0], $MachinePrecision] * N[(1.0 - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(wj + N[(N[(t$95$2 - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision] * t$95$3 + N[(t$95$3 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := wj \cdot e^{wj}\\
t_1 := x \cdot -4 + x \cdot 1.5\\
t_2 := \frac{x}{e^{wj}}\\
t_3 := wj - t_2\\
\mathbf{if}\;wj + \frac{x - t_0}{e^{wj} + t_0} \leq 5 \cdot 10^{-18}:\\
\;\;\;\;x + \left(-2 \cdot \left(wj \cdot x\right) + \left({wj}^{3} \cdot \left(-1 - \left(x \cdot -3 + \left(-2 \cdot t_1 + x \cdot 0.6666666666666666\right)\right)\right) + {wj}^{2} \cdot \left(1 - t_1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(wj + \frac{t_2 - wj}{wj + 1}\right) + \mathsf{fma}\left(\frac{-1}{wj + 1}, t_3, \frac{t_3}{wj + 1}\right)\\
\end{array}
\end{array}
if (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) < 5.00000000000000036e-18Initial program 69.9%
distribute-rgt1-in70.5%
associate-/l/70.5%
div-sub70.0%
associate-/l*70.0%
*-inverses70.5%
/-rgt-identity70.5%
Simplified70.5%
Taylor expanded in wj around 0 99.1%
if 5.00000000000000036e-18 < (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) Initial program 91.2%
distribute-rgt1-in91.1%
associate-/l/91.2%
div-sub91.2%
associate-/l*91.2%
*-inverses98.7%
/-rgt-identity98.7%
Simplified98.7%
*-un-lft-identity98.7%
div-inv98.7%
prod-diff98.8%
associate-/r/98.4%
clear-num98.7%
fma-neg98.7%
*-un-lft-identity98.7%
associate-/r/98.4%
clear-num98.8%
Applied egg-rr98.8%
distribute-neg-frac98.8%
metadata-eval98.8%
Simplified98.8%
Final simplification99.0%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (* wj (exp wj))) (t_1 (+ (* x -4.0) (* x 1.5))))
(if (<= (+ wj (/ (- x t_0) (+ (exp wj) t_0))) 1e-11)
(+
x
(+
(* -2.0 (* wj x))
(+
(*
(pow wj 3.0)
(- -1.0 (+ (* x -3.0) (+ (* -2.0 t_1) (* x 0.6666666666666666)))))
(* (pow wj 2.0) (- 1.0 t_1)))))
(+ wj (/ (- (/ x (exp wj)) wj) (+ wj 1.0))))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
double t_1 = (x * -4.0) + (x * 1.5);
double tmp;
if ((wj + ((x - t_0) / (exp(wj) + t_0))) <= 1e-11) {
tmp = x + ((-2.0 * (wj * x)) + ((pow(wj, 3.0) * (-1.0 - ((x * -3.0) + ((-2.0 * t_1) + (x * 0.6666666666666666))))) + (pow(wj, 2.0) * (1.0 - t_1))));
} else {
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = wj * exp(wj)
t_1 = (x * (-4.0d0)) + (x * 1.5d0)
if ((wj + ((x - t_0) / (exp(wj) + t_0))) <= 1d-11) then
tmp = x + (((-2.0d0) * (wj * x)) + (((wj ** 3.0d0) * ((-1.0d0) - ((x * (-3.0d0)) + (((-2.0d0) * t_1) + (x * 0.6666666666666666d0))))) + ((wj ** 2.0d0) * (1.0d0 - t_1))))
else
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double t_0 = wj * Math.exp(wj);
double t_1 = (x * -4.0) + (x * 1.5);
double tmp;
if ((wj + ((x - t_0) / (Math.exp(wj) + t_0))) <= 1e-11) {
tmp = x + ((-2.0 * (wj * x)) + ((Math.pow(wj, 3.0) * (-1.0 - ((x * -3.0) + ((-2.0 * t_1) + (x * 0.6666666666666666))))) + (Math.pow(wj, 2.0) * (1.0 - t_1))));
} else {
tmp = wj + (((x / Math.exp(wj)) - wj) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): t_0 = wj * math.exp(wj) t_1 = (x * -4.0) + (x * 1.5) tmp = 0 if (wj + ((x - t_0) / (math.exp(wj) + t_0))) <= 1e-11: tmp = x + ((-2.0 * (wj * x)) + ((math.pow(wj, 3.0) * (-1.0 - ((x * -3.0) + ((-2.0 * t_1) + (x * 0.6666666666666666))))) + (math.pow(wj, 2.0) * (1.0 - t_1)))) else: tmp = wj + (((x / math.exp(wj)) - wj) / (wj + 1.0)) return tmp
function code(wj, x) t_0 = Float64(wj * exp(wj)) t_1 = Float64(Float64(x * -4.0) + Float64(x * 1.5)) tmp = 0.0 if (Float64(wj + Float64(Float64(x - t_0) / Float64(exp(wj) + t_0))) <= 1e-11) tmp = Float64(x + Float64(Float64(-2.0 * Float64(wj * x)) + Float64(Float64((wj ^ 3.0) * Float64(-1.0 - Float64(Float64(x * -3.0) + Float64(Float64(-2.0 * t_1) + Float64(x * 0.6666666666666666))))) + Float64((wj ^ 2.0) * Float64(1.0 - t_1))))); else tmp = Float64(wj + Float64(Float64(Float64(x / exp(wj)) - wj) / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) t_0 = wj * exp(wj); t_1 = (x * -4.0) + (x * 1.5); tmp = 0.0; if ((wj + ((x - t_0) / (exp(wj) + t_0))) <= 1e-11) tmp = x + ((-2.0 * (wj * x)) + (((wj ^ 3.0) * (-1.0 - ((x * -3.0) + ((-2.0 * t_1) + (x * 0.6666666666666666))))) + ((wj ^ 2.0) * (1.0 - t_1)))); else tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := Block[{t$95$0 = N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * -4.0), $MachinePrecision] + N[(x * 1.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(wj + N[(N[(x - t$95$0), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e-11], N[(x + N[(N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[wj, 3.0], $MachinePrecision] * N[(-1.0 - N[(N[(x * -3.0), $MachinePrecision] + N[(N[(-2.0 * t$95$1), $MachinePrecision] + N[(x * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[wj, 2.0], $MachinePrecision] * N[(1.0 - t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := wj \cdot e^{wj}\\
t_1 := x \cdot -4 + x \cdot 1.5\\
\mathbf{if}\;wj + \frac{x - t_0}{e^{wj} + t_0} \leq 10^{-11}:\\
\;\;\;\;x + \left(-2 \cdot \left(wj \cdot x\right) + \left({wj}^{3} \cdot \left(-1 - \left(x \cdot -3 + \left(-2 \cdot t_1 + x \cdot 0.6666666666666666\right)\right)\right) + {wj}^{2} \cdot \left(1 - t_1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\
\end{array}
\end{array}
if (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) < 9.99999999999999939e-12Initial program 70.1%
distribute-rgt1-in70.6%
associate-/l/70.7%
div-sub70.1%
associate-/l*70.1%
*-inverses70.7%
/-rgt-identity70.7%
Simplified70.7%
Taylor expanded in wj around 0 99.0%
if 9.99999999999999939e-12 < (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) Initial program 91.3%
distribute-rgt1-in91.3%
associate-/l/91.3%
div-sub91.3%
associate-/l*91.3%
*-inverses99.0%
/-rgt-identity99.0%
Simplified99.0%
Final simplification99.0%
(FPCore (wj x)
:precision binary64
(if (<= wj -1e-8)
(+ wj (* (- wj (/ x (exp wj))) (/ -1.0 (+ wj 1.0))))
(if (<= wj 1.3e-8)
(+ x (- (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 <= -1e-8) {
tmp = wj + ((wj - (x / exp(wj))) * (-1.0 / (wj + 1.0)));
} else if (wj <= 1.3e-8) {
tmp = x + (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 <= (-1d-8)) then
tmp = wj + ((wj - (x / exp(wj))) * ((-1.0d0) / (wj + 1.0d0)))
else if (wj <= 1.3d-8) then
tmp = x + ((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 <= -1e-8) {
tmp = wj + ((wj - (x / Math.exp(wj))) * (-1.0 / (wj + 1.0)));
} else if (wj <= 1.3e-8) {
tmp = x + (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 <= -1e-8: tmp = wj + ((wj - (x / math.exp(wj))) * (-1.0 / (wj + 1.0))) elif wj <= 1.3e-8: tmp = x + (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 <= -1e-8) tmp = Float64(wj + Float64(Float64(wj - Float64(x / exp(wj))) * Float64(-1.0 / Float64(wj + 1.0)))); elseif (wj <= 1.3e-8) tmp = Float64(x + 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 <= -1e-8) tmp = wj + ((wj - (x / exp(wj))) * (-1.0 / (wj + 1.0))); elseif (wj <= 1.3e-8) tmp = x + ((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, -1e-8], N[(wj + N[(N[(wj - N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 1.3e-8], N[(x + N[(N[Power[wj, 2.0], $MachinePrecision] - N[Power[wj, 3.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 -1 \cdot 10^{-8}:\\
\;\;\;\;wj + \left(wj - \frac{x}{e^{wj}}\right) \cdot \frac{-1}{wj + 1}\\
\mathbf{elif}\;wj \leq 1.3 \cdot 10^{-8}:\\
\;\;\;\;x + \left({wj}^{2} - {wj}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{x \cdot e^{-wj} - wj}{wj + 1}\\
\end{array}
\end{array}
if wj < -1e-8Initial program 86.9%
distribute-rgt1-in95.1%
associate-/l/95.3%
div-sub87.0%
associate-/l*87.0%
*-inverses95.3%
/-rgt-identity95.3%
Simplified95.3%
clear-num94.7%
associate-/r/95.4%
Applied egg-rr95.4%
if -1e-8 < wj < 1.3000000000000001e-8Initial program 76.2%
distribute-rgt1-in76.2%
associate-/l/76.2%
div-sub76.2%
associate-/l*76.2%
*-inverses76.2%
/-rgt-identity76.2%
Simplified76.2%
Taylor expanded in wj around 0 100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in x around 0 99.7%
+-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
if 1.3000000000000001e-8 < wj Initial program 46.3%
distribute-rgt1-in46.5%
associate-/l/46.4%
div-sub46.4%
associate-/l*46.4%
*-inverses96.4%
/-rgt-identity96.4%
Simplified96.4%
clear-num96.6%
associate-/r/96.4%
rec-exp96.6%
Applied egg-rr96.6%
Final simplification99.4%
(FPCore (wj x)
:precision binary64
(if (<= wj -5.8e-9)
(+ wj (/ (- (/ x (exp wj)) wj) (+ wj 1.0)))
(if (<= wj 3.7e-9)
(+ x (+ (* -2.0 (* wj x)) (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 = wj + (((x / exp(wj)) - wj) / (wj + 1.0));
} else if (wj <= 3.7e-9) {
tmp = x + ((-2.0 * (wj * x)) + 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 = wj + (((x / exp(wj)) - wj) / (wj + 1.0d0))
else if (wj <= 3.7d-9) then
tmp = x + (((-2.0d0) * (wj * x)) + (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 = wj + (((x / Math.exp(wj)) - wj) / (wj + 1.0));
} else if (wj <= 3.7e-9) {
tmp = x + ((-2.0 * (wj * x)) + 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 = wj + (((x / math.exp(wj)) - wj) / (wj + 1.0)) elif wj <= 3.7e-9: tmp = x + ((-2.0 * (wj * x)) + 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(wj + Float64(Float64(Float64(x / exp(wj)) - wj) / Float64(wj + 1.0))); elseif (wj <= 3.7e-9) tmp = Float64(x + Float64(Float64(-2.0 * Float64(wj * x)) + (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 = wj + (((x / exp(wj)) - wj) / (wj + 1.0)); elseif (wj <= 3.7e-9) tmp = x + ((-2.0 * (wj * x)) + (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[(wj + N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 3.7e-9], N[(x + N[(N[(-2.0 * N[(wj * x), $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}:\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\
\mathbf{elif}\;wj \leq 3.7 \cdot 10^{-9}:\\
\;\;\;\;x + \left(-2 \cdot \left(wj \cdot x\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 86.9%
distribute-rgt1-in95.1%
associate-/l/95.3%
div-sub87.0%
associate-/l*87.0%
*-inverses95.3%
/-rgt-identity95.3%
Simplified95.3%
if -5.79999999999999982e-9 < wj < 3.7e-9Initial program 76.2%
distribute-rgt1-in76.2%
associate-/l/76.2%
div-sub76.2%
associate-/l*76.2%
*-inverses76.2%
/-rgt-identity76.2%
Simplified76.2%
Taylor expanded in wj around 0 99.3%
Taylor expanded in x around 0 99.3%
if 3.7e-9 < wj Initial program 46.3%
distribute-rgt1-in46.5%
associate-/l/46.4%
div-sub46.4%
associate-/l*46.4%
*-inverses96.4%
/-rgt-identity96.4%
Simplified96.4%
clear-num96.6%
associate-/r/96.4%
rec-exp96.6%
Applied egg-rr96.6%
Final simplification99.0%
(FPCore (wj x)
:precision binary64
(if (<= wj -1.85e-8)
(+ wj (/ (- (/ x (exp wj)) wj) (+ wj 1.0)))
(if (<= wj 5.2e-9)
(+ x (* (pow wj 2.0) (- (+ 1.0 (* x 2.5)) wj)))
(+ wj (/ (- (* x (exp (- wj))) wj) (+ wj 1.0))))))
double code(double wj, double x) {
double tmp;
if (wj <= -1.85e-8) {
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0));
} else if (wj <= 5.2e-9) {
tmp = x + (pow(wj, 2.0) * ((1.0 + (x * 2.5)) - wj));
} 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 <= (-1.85d-8)) then
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0d0))
else if (wj <= 5.2d-9) then
tmp = x + ((wj ** 2.0d0) * ((1.0d0 + (x * 2.5d0)) - wj))
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 <= -1.85e-8) {
tmp = wj + (((x / Math.exp(wj)) - wj) / (wj + 1.0));
} else if (wj <= 5.2e-9) {
tmp = x + (Math.pow(wj, 2.0) * ((1.0 + (x * 2.5)) - wj));
} else {
tmp = wj + (((x * Math.exp(-wj)) - wj) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -1.85e-8: tmp = wj + (((x / math.exp(wj)) - wj) / (wj + 1.0)) elif wj <= 5.2e-9: tmp = x + (math.pow(wj, 2.0) * ((1.0 + (x * 2.5)) - wj)) else: tmp = wj + (((x * math.exp(-wj)) - wj) / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -1.85e-8) tmp = Float64(wj + Float64(Float64(Float64(x / exp(wj)) - wj) / Float64(wj + 1.0))); elseif (wj <= 5.2e-9) tmp = Float64(x + Float64((wj ^ 2.0) * Float64(Float64(1.0 + Float64(x * 2.5)) - wj))); 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 <= -1.85e-8) tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0)); elseif (wj <= 5.2e-9) tmp = x + ((wj ^ 2.0) * ((1.0 + (x * 2.5)) - wj)); else tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -1.85e-8], N[(wj + N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 5.2e-9], N[(x + N[(N[Power[wj, 2.0], $MachinePrecision] * N[(N[(1.0 + N[(x * 2.5), $MachinePrecision]), $MachinePrecision] - wj), $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 -1.85 \cdot 10^{-8}:\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\
\mathbf{elif}\;wj \leq 5.2 \cdot 10^{-9}:\\
\;\;\;\;x + {wj}^{2} \cdot \left(\left(1 + x \cdot 2.5\right) - wj\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{x \cdot e^{-wj} - wj}{wj + 1}\\
\end{array}
\end{array}
if wj < -1.85e-8Initial program 86.9%
distribute-rgt1-in95.1%
associate-/l/95.3%
div-sub87.0%
associate-/l*87.0%
*-inverses95.3%
/-rgt-identity95.3%
Simplified95.3%
if -1.85e-8 < wj < 5.2000000000000002e-9Initial program 76.2%
distribute-rgt1-in76.2%
associate-/l/76.2%
div-sub76.2%
associate-/l*76.2%
*-inverses76.2%
/-rgt-identity76.2%
Simplified76.2%
Taylor expanded in wj around 0 100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in wj around inf 99.7%
mul-1-neg99.7%
cube-mult99.7%
unpow299.7%
distribute-lft-neg-out99.7%
*-commutative99.7%
distribute-rgt-out99.7%
metadata-eval99.7%
distribute-rgt-out99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
if 5.2000000000000002e-9 < wj Initial program 46.3%
distribute-rgt1-in46.5%
associate-/l/46.4%
div-sub46.4%
associate-/l*46.4%
*-inverses96.4%
/-rgt-identity96.4%
Simplified96.4%
clear-num96.6%
associate-/r/96.4%
rec-exp96.6%
Applied egg-rr96.6%
Final simplification99.3%
(FPCore (wj x)
:precision binary64
(if (<= wj -6.8e-9)
(+ wj (* (- wj (/ x (exp wj))) (/ -1.0 (+ wj 1.0))))
(if (<= wj 8.6e-9)
(+ x (* (pow wj 2.0) (- (+ 1.0 (* x 2.5)) wj)))
(+ wj (/ (- (* x (exp (- wj))) wj) (+ wj 1.0))))))
double code(double wj, double x) {
double tmp;
if (wj <= -6.8e-9) {
tmp = wj + ((wj - (x / exp(wj))) * (-1.0 / (wj + 1.0)));
} else if (wj <= 8.6e-9) {
tmp = x + (pow(wj, 2.0) * ((1.0 + (x * 2.5)) - wj));
} 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 <= (-6.8d-9)) then
tmp = wj + ((wj - (x / exp(wj))) * ((-1.0d0) / (wj + 1.0d0)))
else if (wj <= 8.6d-9) then
tmp = x + ((wj ** 2.0d0) * ((1.0d0 + (x * 2.5d0)) - wj))
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 <= -6.8e-9) {
tmp = wj + ((wj - (x / Math.exp(wj))) * (-1.0 / (wj + 1.0)));
} else if (wj <= 8.6e-9) {
tmp = x + (Math.pow(wj, 2.0) * ((1.0 + (x * 2.5)) - wj));
} else {
tmp = wj + (((x * Math.exp(-wj)) - wj) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -6.8e-9: tmp = wj + ((wj - (x / math.exp(wj))) * (-1.0 / (wj + 1.0))) elif wj <= 8.6e-9: tmp = x + (math.pow(wj, 2.0) * ((1.0 + (x * 2.5)) - wj)) else: tmp = wj + (((x * math.exp(-wj)) - wj) / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -6.8e-9) tmp = Float64(wj + Float64(Float64(wj - Float64(x / exp(wj))) * Float64(-1.0 / Float64(wj + 1.0)))); elseif (wj <= 8.6e-9) tmp = Float64(x + Float64((wj ^ 2.0) * Float64(Float64(1.0 + Float64(x * 2.5)) - wj))); 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 <= -6.8e-9) tmp = wj + ((wj - (x / exp(wj))) * (-1.0 / (wj + 1.0))); elseif (wj <= 8.6e-9) tmp = x + ((wj ^ 2.0) * ((1.0 + (x * 2.5)) - wj)); else tmp = wj + (((x * exp(-wj)) - wj) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -6.8e-9], N[(wj + N[(N[(wj - N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 8.6e-9], N[(x + N[(N[Power[wj, 2.0], $MachinePrecision] * N[(N[(1.0 + N[(x * 2.5), $MachinePrecision]), $MachinePrecision] - wj), $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.8 \cdot 10^{-9}:\\
\;\;\;\;wj + \left(wj - \frac{x}{e^{wj}}\right) \cdot \frac{-1}{wj + 1}\\
\mathbf{elif}\;wj \leq 8.6 \cdot 10^{-9}:\\
\;\;\;\;x + {wj}^{2} \cdot \left(\left(1 + x \cdot 2.5\right) - wj\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{x \cdot e^{-wj} - wj}{wj + 1}\\
\end{array}
\end{array}
if wj < -6.7999999999999997e-9Initial program 86.9%
distribute-rgt1-in95.1%
associate-/l/95.3%
div-sub87.0%
associate-/l*87.0%
*-inverses95.3%
/-rgt-identity95.3%
Simplified95.3%
clear-num94.7%
associate-/r/95.4%
Applied egg-rr95.4%
if -6.7999999999999997e-9 < wj < 8.59999999999999925e-9Initial program 76.2%
distribute-rgt1-in76.2%
associate-/l/76.2%
div-sub76.2%
associate-/l*76.2%
*-inverses76.2%
/-rgt-identity76.2%
Simplified76.2%
Taylor expanded in wj around 0 100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in wj around inf 99.7%
mul-1-neg99.7%
cube-mult99.7%
unpow299.7%
distribute-lft-neg-out99.7%
*-commutative99.7%
distribute-rgt-out99.7%
metadata-eval99.7%
distribute-rgt-out99.7%
sub-neg99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
if 8.59999999999999925e-9 < wj Initial program 46.3%
distribute-rgt1-in46.5%
associate-/l/46.4%
div-sub46.4%
associate-/l*46.4%
*-inverses96.4%
/-rgt-identity96.4%
Simplified96.4%
clear-num96.6%
associate-/r/96.4%
rec-exp96.6%
Applied egg-rr96.6%
Final simplification99.3%
(FPCore (wj x) :precision binary64 (if (or (<= wj -5.8e-9) (not (<= wj 6e-9))) (+ wj (/ (- (/ x (exp wj)) wj) (+ wj 1.0))) (+ x (+ (* -2.0 (* wj x)) (pow wj 2.0)))))
double code(double wj, double x) {
double tmp;
if ((wj <= -5.8e-9) || !(wj <= 6e-9)) {
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = x + ((-2.0 * (wj * x)) + pow(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 <= (-5.8d-9)) .or. (.not. (wj <= 6d-9))) then
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0d0))
else
tmp = x + (((-2.0d0) * (wj * x)) + (wj ** 2.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if ((wj <= -5.8e-9) || !(wj <= 6e-9)) {
tmp = wj + (((x / Math.exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = x + ((-2.0 * (wj * x)) + Math.pow(wj, 2.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if (wj <= -5.8e-9) or not (wj <= 6e-9): tmp = wj + (((x / math.exp(wj)) - wj) / (wj + 1.0)) else: tmp = x + ((-2.0 * (wj * x)) + math.pow(wj, 2.0)) return tmp
function code(wj, x) tmp = 0.0 if ((wj <= -5.8e-9) || !(wj <= 6e-9)) tmp = Float64(wj + Float64(Float64(Float64(x / exp(wj)) - wj) / Float64(wj + 1.0))); else tmp = Float64(x + Float64(Float64(-2.0 * Float64(wj * x)) + (wj ^ 2.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if ((wj <= -5.8e-9) || ~((wj <= 6e-9))) tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0)); else tmp = x + ((-2.0 * (wj * x)) + (wj ^ 2.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[Or[LessEqual[wj, -5.8e-9], N[Not[LessEqual[wj, 6e-9]], $MachinePrecision]], N[(wj + N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision] + N[Power[wj, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -5.8 \cdot 10^{-9} \lor \neg \left(wj \leq 6 \cdot 10^{-9}\right):\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;x + \left(-2 \cdot \left(wj \cdot x\right) + {wj}^{2}\right)\\
\end{array}
\end{array}
if wj < -5.79999999999999982e-9 or 5.99999999999999996e-9 < wj Initial program 68.5%
distribute-rgt1-in73.0%
associate-/l/73.1%
div-sub68.5%
associate-/l*68.5%
*-inverses95.8%
/-rgt-identity95.8%
Simplified95.8%
if -5.79999999999999982e-9 < wj < 5.99999999999999996e-9Initial program 76.2%
distribute-rgt1-in76.2%
associate-/l/76.2%
div-sub76.2%
associate-/l*76.2%
*-inverses76.2%
/-rgt-identity76.2%
Simplified76.2%
Taylor expanded in wj around 0 99.3%
Taylor expanded in x around 0 99.3%
Final simplification99.0%
(FPCore (wj x) :precision binary64 (if (<= wj 2.2e-6) (+ x (+ (* -2.0 (* wj x)) (pow wj 2.0))) (/ 1.0 (+ (/ 1.0 wj) (/ (/ 1.0 wj) wj)))))
double code(double wj, double x) {
double tmp;
if (wj <= 2.2e-6) {
tmp = x + ((-2.0 * (wj * x)) + pow(wj, 2.0));
} else {
tmp = 1.0 / ((1.0 / wj) + ((1.0 / 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 <= 2.2d-6) then
tmp = x + (((-2.0d0) * (wj * x)) + (wj ** 2.0d0))
else
tmp = 1.0d0 / ((1.0d0 / wj) + ((1.0d0 / wj) / wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 2.2e-6) {
tmp = x + ((-2.0 * (wj * x)) + Math.pow(wj, 2.0));
} else {
tmp = 1.0 / ((1.0 / wj) + ((1.0 / wj) / wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 2.2e-6: tmp = x + ((-2.0 * (wj * x)) + math.pow(wj, 2.0)) else: tmp = 1.0 / ((1.0 / wj) + ((1.0 / wj) / wj)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 2.2e-6) tmp = Float64(x + Float64(Float64(-2.0 * Float64(wj * x)) + (wj ^ 2.0))); else tmp = Float64(1.0 / Float64(Float64(1.0 / wj) + Float64(Float64(1.0 / wj) / wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 2.2e-6) tmp = x + ((-2.0 * (wj * x)) + (wj ^ 2.0)); else tmp = 1.0 / ((1.0 / wj) + ((1.0 / wj) / wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 2.2e-6], N[(x + N[(N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision] + N[Power[wj, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(1.0 / wj), $MachinePrecision] + N[(N[(1.0 / wj), $MachinePrecision] / wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 2.2 \cdot 10^{-6}:\\
\;\;\;\;x + \left(-2 \cdot \left(wj \cdot x\right) + {wj}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{wj} + \frac{\frac{1}{wj}}{wj}}\\
\end{array}
\end{array}
if wj < 2.2000000000000001e-6Initial program 77.0%
distribute-rgt1-in77.4%
associate-/l/77.4%
div-sub77.0%
associate-/l*77.0%
*-inverses77.4%
/-rgt-identity77.4%
Simplified77.4%
Taylor expanded in wj around 0 97.0%
Taylor expanded in x around 0 96.5%
if 2.2000000000000001e-6 < wj Initial program 23.5%
distribute-rgt1-in23.5%
associate-/l/23.9%
div-sub23.9%
associate-/l*23.9%
*-inverses95.3%
/-rgt-identity95.3%
Simplified95.3%
flip--95.5%
clear-num95.3%
pow295.3%
pow295.3%
Applied egg-rr95.3%
Taylor expanded in wj around inf 99.3%
inv-pow99.3%
unpow299.3%
pow-prod-down99.0%
inv-pow99.0%
inv-pow99.0%
Applied egg-rr99.0%
un-div-inv99.3%
Applied egg-rr99.3%
Final simplification96.6%
(FPCore (wj x)
:precision binary64
(if (<= wj -3.1e-10)
(+ wj (/ (- (* x (- 1.0 wj)) wj) (+ wj 1.0)))
(if (<= wj 1.75e-6)
(+ x (pow wj 2.0))
(/ 1.0 (+ (/ 1.0 wj) (/ (/ 1.0 wj) wj))))))
double code(double wj, double x) {
double tmp;
if (wj <= -3.1e-10) {
tmp = wj + (((x * (1.0 - wj)) - wj) / (wj + 1.0));
} else if (wj <= 1.75e-6) {
tmp = x + pow(wj, 2.0);
} else {
tmp = 1.0 / ((1.0 / wj) + ((1.0 / 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 <= (-3.1d-10)) then
tmp = wj + (((x * (1.0d0 - wj)) - wj) / (wj + 1.0d0))
else if (wj <= 1.75d-6) then
tmp = x + (wj ** 2.0d0)
else
tmp = 1.0d0 / ((1.0d0 / wj) + ((1.0d0 / wj) / wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -3.1e-10) {
tmp = wj + (((x * (1.0 - wj)) - wj) / (wj + 1.0));
} else if (wj <= 1.75e-6) {
tmp = x + Math.pow(wj, 2.0);
} else {
tmp = 1.0 / ((1.0 / wj) + ((1.0 / wj) / wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -3.1e-10: tmp = wj + (((x * (1.0 - wj)) - wj) / (wj + 1.0)) elif wj <= 1.75e-6: tmp = x + math.pow(wj, 2.0) else: tmp = 1.0 / ((1.0 / wj) + ((1.0 / wj) / wj)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -3.1e-10) tmp = Float64(wj + Float64(Float64(Float64(x * Float64(1.0 - wj)) - wj) / Float64(wj + 1.0))); elseif (wj <= 1.75e-6) tmp = Float64(x + (wj ^ 2.0)); else tmp = Float64(1.0 / Float64(Float64(1.0 / wj) + Float64(Float64(1.0 / wj) / wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -3.1e-10) tmp = wj + (((x * (1.0 - wj)) - wj) / (wj + 1.0)); elseif (wj <= 1.75e-6) tmp = x + (wj ^ 2.0); else tmp = 1.0 / ((1.0 / wj) + ((1.0 / wj) / wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -3.1e-10], N[(wj + N[(N[(N[(x * N[(1.0 - wj), $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 1.75e-6], N[(x + N[Power[wj, 2.0], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(1.0 / wj), $MachinePrecision] + N[(N[(1.0 / wj), $MachinePrecision] / wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -3.1 \cdot 10^{-10}:\\
\;\;\;\;wj + \frac{x \cdot \left(1 - wj\right) - wj}{wj + 1}\\
\mathbf{elif}\;wj \leq 1.75 \cdot 10^{-6}:\\
\;\;\;\;x + {wj}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{wj} + \frac{\frac{1}{wj}}{wj}}\\
\end{array}
\end{array}
if wj < -3.10000000000000015e-10Initial program 85.8%
distribute-rgt1-in92.8%
associate-/l/93.1%
div-sub86.0%
associate-/l*86.0%
*-inverses93.1%
/-rgt-identity93.1%
Simplified93.1%
Taylor expanded in wj around 0 72.5%
associate-*r*72.5%
neg-mul-172.5%
distribute-rgt1-in72.5%
+-commutative72.5%
sub-neg72.5%
Simplified72.5%
if -3.10000000000000015e-10 < wj < 1.74999999999999997e-6Initial program 76.4%
distribute-rgt1-in76.4%
associate-/l/76.4%
div-sub76.4%
associate-/l*76.4%
*-inverses76.4%
/-rgt-identity76.4%
Simplified76.4%
Taylor expanded in wj around 0 99.4%
Taylor expanded in x around 0 99.3%
Taylor expanded in wj around inf 98.7%
if 1.74999999999999997e-6 < wj Initial program 23.5%
distribute-rgt1-in23.5%
associate-/l/23.9%
div-sub23.9%
associate-/l*23.9%
*-inverses95.3%
/-rgt-identity95.3%
Simplified95.3%
flip--95.5%
clear-num95.3%
pow295.3%
pow295.3%
Applied egg-rr95.3%
Taylor expanded in wj around inf 99.3%
inv-pow99.3%
unpow299.3%
pow-prod-down99.0%
inv-pow99.0%
inv-pow99.0%
Applied egg-rr99.0%
un-div-inv99.3%
Applied egg-rr99.3%
Final simplification97.2%
(FPCore (wj x)
:precision binary64
(if (<= x -6.5e-153)
(+ wj (/ (- 1.0 wj) (/ (+ wj 1.0) x)))
(if (<= x 6.6e-230)
(/ 1.0 (+ (/ 1.0 wj) (/ -1.0 (* wj (- wj)))))
(/ x (/ (+ wj 1.0) (- 1.0 wj))))))
double code(double wj, double x) {
double tmp;
if (x <= -6.5e-153) {
tmp = wj + ((1.0 - wj) / ((wj + 1.0) / x));
} else if (x <= 6.6e-230) {
tmp = 1.0 / ((1.0 / wj) + (-1.0 / (wj * -wj)));
} else {
tmp = x / ((wj + 1.0) / (1.0 - wj));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-6.5d-153)) then
tmp = wj + ((1.0d0 - wj) / ((wj + 1.0d0) / x))
else if (x <= 6.6d-230) then
tmp = 1.0d0 / ((1.0d0 / wj) + ((-1.0d0) / (wj * -wj)))
else
tmp = x / ((wj + 1.0d0) / (1.0d0 - wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (x <= -6.5e-153) {
tmp = wj + ((1.0 - wj) / ((wj + 1.0) / x));
} else if (x <= 6.6e-230) {
tmp = 1.0 / ((1.0 / wj) + (-1.0 / (wj * -wj)));
} else {
tmp = x / ((wj + 1.0) / (1.0 - wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if x <= -6.5e-153: tmp = wj + ((1.0 - wj) / ((wj + 1.0) / x)) elif x <= 6.6e-230: tmp = 1.0 / ((1.0 / wj) + (-1.0 / (wj * -wj))) else: tmp = x / ((wj + 1.0) / (1.0 - wj)) return tmp
function code(wj, x) tmp = 0.0 if (x <= -6.5e-153) tmp = Float64(wj + Float64(Float64(1.0 - wj) / Float64(Float64(wj + 1.0) / x))); elseif (x <= 6.6e-230) tmp = Float64(1.0 / Float64(Float64(1.0 / wj) + Float64(-1.0 / Float64(wj * Float64(-wj))))); else tmp = Float64(x / Float64(Float64(wj + 1.0) / Float64(1.0 - wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (x <= -6.5e-153) tmp = wj + ((1.0 - wj) / ((wj + 1.0) / x)); elseif (x <= 6.6e-230) tmp = 1.0 / ((1.0 / wj) + (-1.0 / (wj * -wj))); else tmp = x / ((wj + 1.0) / (1.0 - wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[x, -6.5e-153], N[(wj + N[(N[(1.0 - wj), $MachinePrecision] / N[(N[(wj + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.6e-230], N[(1.0 / N[(N[(1.0 / wj), $MachinePrecision] + N[(-1.0 / N[(wj * (-wj)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(wj + 1.0), $MachinePrecision] / N[(1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{-153}:\\
\;\;\;\;wj + \frac{1 - wj}{\frac{wj + 1}{x}}\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{-230}:\\
\;\;\;\;\frac{1}{\frac{1}{wj} + \frac{-1}{wj \cdot \left(-wj\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{wj + 1}{1 - wj}}\\
\end{array}
\end{array}
if x < -6.50000000000000032e-153Initial program 94.0%
distribute-rgt1-in93.9%
associate-/l/94.0%
div-sub94.0%
associate-/l*94.0%
*-inverses98.3%
/-rgt-identity98.3%
Simplified98.3%
Taylor expanded in wj around 0 94.6%
associate-*r*94.6%
neg-mul-194.6%
Simplified94.6%
Taylor expanded in x around inf 92.0%
mul-1-neg92.0%
neg-mul-192.0%
sub-neg92.0%
*-commutative92.0%
sub-neg92.0%
+-commutative92.0%
neg-mul-192.0%
fma-udef92.0%
+-commutative92.0%
associate-/l*91.6%
fma-udef91.6%
neg-mul-191.6%
+-commutative91.6%
sub-neg91.6%
Simplified91.6%
if -6.50000000000000032e-153 < x < 6.59999999999999987e-230Initial program 31.9%
distribute-rgt1-in33.7%
associate-/l/33.7%
div-sub31.9%
associate-/l*31.9%
*-inverses35.6%
/-rgt-identity35.6%
Simplified35.6%
flip--21.3%
clear-num21.3%
pow221.3%
pow221.3%
Applied egg-rr21.3%
Taylor expanded in wj around inf 63.9%
inv-pow63.9%
unpow263.9%
pow-prod-down63.5%
inv-pow63.5%
inv-pow63.5%
Applied egg-rr63.5%
frac-2neg63.5%
metadata-eval63.5%
frac-times63.9%
metadata-eval63.9%
Applied egg-rr63.9%
if 6.59999999999999987e-230 < x Initial program 81.4%
distribute-rgt1-in81.4%
associate-/l/81.4%
div-sub81.4%
associate-/l*81.4%
*-inverses81.4%
/-rgt-identity81.4%
Simplified81.4%
Taylor expanded in wj around 0 80.8%
associate-*r*80.8%
neg-mul-180.8%
Simplified80.8%
clear-num80.6%
inv-pow80.6%
distribute-rgt1-in80.6%
neg-mul-180.6%
fma-def80.6%
Applied egg-rr80.6%
unpow-180.6%
fma-udef80.6%
neg-mul-180.6%
+-commutative80.6%
sub-neg80.6%
*-commutative80.6%
Simplified80.6%
Taylor expanded in x around -inf 90.7%
associate-/l*90.7%
+-commutative90.7%
Simplified90.7%
Final simplification85.4%
(FPCore (wj x)
:precision binary64
(if (<= x -3.9e-153)
(+ wj (/ (- (* x (- 1.0 wj)) wj) (+ wj 1.0)))
(if (<= x 5.6e-230)
(/ 1.0 (+ (/ 1.0 wj) (/ -1.0 (* wj (- wj)))))
(/ x (/ (+ wj 1.0) (- 1.0 wj))))))
double code(double wj, double x) {
double tmp;
if (x <= -3.9e-153) {
tmp = wj + (((x * (1.0 - wj)) - wj) / (wj + 1.0));
} else if (x <= 5.6e-230) {
tmp = 1.0 / ((1.0 / wj) + (-1.0 / (wj * -wj)));
} else {
tmp = x / ((wj + 1.0) / (1.0 - wj));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-3.9d-153)) then
tmp = wj + (((x * (1.0d0 - wj)) - wj) / (wj + 1.0d0))
else if (x <= 5.6d-230) then
tmp = 1.0d0 / ((1.0d0 / wj) + ((-1.0d0) / (wj * -wj)))
else
tmp = x / ((wj + 1.0d0) / (1.0d0 - wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (x <= -3.9e-153) {
tmp = wj + (((x * (1.0 - wj)) - wj) / (wj + 1.0));
} else if (x <= 5.6e-230) {
tmp = 1.0 / ((1.0 / wj) + (-1.0 / (wj * -wj)));
} else {
tmp = x / ((wj + 1.0) / (1.0 - wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if x <= -3.9e-153: tmp = wj + (((x * (1.0 - wj)) - wj) / (wj + 1.0)) elif x <= 5.6e-230: tmp = 1.0 / ((1.0 / wj) + (-1.0 / (wj * -wj))) else: tmp = x / ((wj + 1.0) / (1.0 - wj)) return tmp
function code(wj, x) tmp = 0.0 if (x <= -3.9e-153) tmp = Float64(wj + Float64(Float64(Float64(x * Float64(1.0 - wj)) - wj) / Float64(wj + 1.0))); elseif (x <= 5.6e-230) tmp = Float64(1.0 / Float64(Float64(1.0 / wj) + Float64(-1.0 / Float64(wj * Float64(-wj))))); else tmp = Float64(x / Float64(Float64(wj + 1.0) / Float64(1.0 - wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (x <= -3.9e-153) tmp = wj + (((x * (1.0 - wj)) - wj) / (wj + 1.0)); elseif (x <= 5.6e-230) tmp = 1.0 / ((1.0 / wj) + (-1.0 / (wj * -wj))); else tmp = x / ((wj + 1.0) / (1.0 - wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[x, -3.9e-153], N[(wj + N[(N[(N[(x * N[(1.0 - wj), $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.6e-230], N[(1.0 / N[(N[(1.0 / wj), $MachinePrecision] + N[(-1.0 / N[(wj * (-wj)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(wj + 1.0), $MachinePrecision] / N[(1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{-153}:\\
\;\;\;\;wj + \frac{x \cdot \left(1 - wj\right) - wj}{wj + 1}\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{-230}:\\
\;\;\;\;\frac{1}{\frac{1}{wj} + \frac{-1}{wj \cdot \left(-wj\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{wj + 1}{1 - wj}}\\
\end{array}
\end{array}
if x < -3.9000000000000002e-153Initial program 94.0%
distribute-rgt1-in93.9%
associate-/l/94.0%
div-sub94.0%
associate-/l*94.0%
*-inverses98.3%
/-rgt-identity98.3%
Simplified98.3%
Taylor expanded in wj around 0 94.6%
associate-*r*94.6%
neg-mul-194.6%
distribute-rgt1-in94.6%
+-commutative94.6%
sub-neg94.6%
Simplified94.6%
if -3.9000000000000002e-153 < x < 5.6000000000000002e-230Initial program 31.9%
distribute-rgt1-in33.7%
associate-/l/33.7%
div-sub31.9%
associate-/l*31.9%
*-inverses35.6%
/-rgt-identity35.6%
Simplified35.6%
flip--21.3%
clear-num21.3%
pow221.3%
pow221.3%
Applied egg-rr21.3%
Taylor expanded in wj around inf 63.9%
inv-pow63.9%
unpow263.9%
pow-prod-down63.5%
inv-pow63.5%
inv-pow63.5%
Applied egg-rr63.5%
frac-2neg63.5%
metadata-eval63.5%
frac-times63.9%
metadata-eval63.9%
Applied egg-rr63.9%
if 5.6000000000000002e-230 < x Initial program 81.4%
distribute-rgt1-in81.4%
associate-/l/81.4%
div-sub81.4%
associate-/l*81.4%
*-inverses81.4%
/-rgt-identity81.4%
Simplified81.4%
Taylor expanded in wj around 0 80.8%
associate-*r*80.8%
neg-mul-180.8%
Simplified80.8%
clear-num80.6%
inv-pow80.6%
distribute-rgt1-in80.6%
neg-mul-180.6%
fma-def80.6%
Applied egg-rr80.6%
unpow-180.6%
fma-udef80.6%
neg-mul-180.6%
+-commutative80.6%
sub-neg80.6%
*-commutative80.6%
Simplified80.6%
Taylor expanded in x around -inf 90.7%
associate-/l*90.7%
+-commutative90.7%
Simplified90.7%
Final simplification86.5%
(FPCore (wj x) :precision binary64 (if (or (<= x -3.9e-153) (not (<= x 6e-228))) (/ x (/ (+ wj 1.0) (- 1.0 wj))) (* wj (/ 1.0 (+ 1.0 (/ 1.0 wj))))))
double code(double wj, double x) {
double tmp;
if ((x <= -3.9e-153) || !(x <= 6e-228)) {
tmp = x / ((wj + 1.0) / (1.0 - wj));
} else {
tmp = wj * (1.0 / (1.0 + (1.0 / wj)));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-3.9d-153)) .or. (.not. (x <= 6d-228))) then
tmp = x / ((wj + 1.0d0) / (1.0d0 - wj))
else
tmp = wj * (1.0d0 / (1.0d0 + (1.0d0 / wj)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if ((x <= -3.9e-153) || !(x <= 6e-228)) {
tmp = x / ((wj + 1.0) / (1.0 - wj));
} else {
tmp = wj * (1.0 / (1.0 + (1.0 / wj)));
}
return tmp;
}
def code(wj, x): tmp = 0 if (x <= -3.9e-153) or not (x <= 6e-228): tmp = x / ((wj + 1.0) / (1.0 - wj)) else: tmp = wj * (1.0 / (1.0 + (1.0 / wj))) return tmp
function code(wj, x) tmp = 0.0 if ((x <= -3.9e-153) || !(x <= 6e-228)) tmp = Float64(x / Float64(Float64(wj + 1.0) / Float64(1.0 - wj))); else tmp = Float64(wj * Float64(1.0 / Float64(1.0 + Float64(1.0 / wj)))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if ((x <= -3.9e-153) || ~((x <= 6e-228))) tmp = x / ((wj + 1.0) / (1.0 - wj)); else tmp = wj * (1.0 / (1.0 + (1.0 / wj))); end tmp_2 = tmp; end
code[wj_, x_] := If[Or[LessEqual[x, -3.9e-153], N[Not[LessEqual[x, 6e-228]], $MachinePrecision]], N[(x / N[(N[(wj + 1.0), $MachinePrecision] / N[(1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj * N[(1.0 / N[(1.0 + N[(1.0 / wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{-153} \lor \neg \left(x \leq 6 \cdot 10^{-228}\right):\\
\;\;\;\;\frac{x}{\frac{wj + 1}{1 - wj}}\\
\mathbf{else}:\\
\;\;\;\;wj \cdot \frac{1}{1 + \frac{1}{wj}}\\
\end{array}
\end{array}
if x < -3.9000000000000002e-153 or 5.9999999999999999e-228 < x Initial program 87.2%
distribute-rgt1-in87.2%
associate-/l/87.2%
div-sub87.2%
associate-/l*87.2%
*-inverses89.2%
/-rgt-identity89.2%
Simplified89.2%
Taylor expanded in wj around 0 87.2%
associate-*r*87.2%
neg-mul-187.2%
Simplified87.2%
clear-num86.8%
inv-pow86.8%
distribute-rgt1-in86.8%
neg-mul-186.8%
fma-def86.8%
Applied egg-rr86.8%
unpow-186.8%
fma-udef86.8%
neg-mul-186.8%
+-commutative86.8%
sub-neg86.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in x around -inf 90.9%
associate-/l*90.9%
+-commutative90.9%
Simplified90.9%
if -3.9000000000000002e-153 < x < 5.9999999999999999e-228Initial program 31.9%
distribute-rgt1-in33.7%
associate-/l/33.7%
div-sub31.9%
associate-/l*31.9%
*-inverses35.6%
/-rgt-identity35.6%
Simplified35.6%
flip--21.3%
clear-num21.3%
pow221.3%
pow221.3%
Applied egg-rr21.3%
Taylor expanded in wj around inf 63.9%
inv-pow63.9%
unpow263.9%
pow-prod-down63.5%
inv-pow63.5%
inv-pow63.5%
Applied egg-rr63.5%
inv-pow63.5%
distribute-rgt1-in63.5%
unpow-prod-down63.7%
+-commutative63.7%
Applied egg-rr63.7%
unpow-163.7%
remove-double-div63.8%
*-commutative63.8%
unpow-163.8%
Simplified63.8%
Final simplification85.2%
(FPCore (wj x)
:precision binary64
(if (<= x -3.9e-153)
(+ x (* -2.0 (* wj x)))
(if (<= x 1.55e-227)
(* wj (/ 1.0 (+ 1.0 (/ 1.0 wj))))
(/ x (+ 1.0 (* wj 2.0))))))
double code(double wj, double x) {
double tmp;
if (x <= -3.9e-153) {
tmp = x + (-2.0 * (wj * x));
} else if (x <= 1.55e-227) {
tmp = wj * (1.0 / (1.0 + (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 (x <= (-3.9d-153)) then
tmp = x + ((-2.0d0) * (wj * x))
else if (x <= 1.55d-227) then
tmp = wj * (1.0d0 / (1.0d0 + (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 (x <= -3.9e-153) {
tmp = x + (-2.0 * (wj * x));
} else if (x <= 1.55e-227) {
tmp = wj * (1.0 / (1.0 + (1.0 / wj)));
} else {
tmp = x / (1.0 + (wj * 2.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if x <= -3.9e-153: tmp = x + (-2.0 * (wj * x)) elif x <= 1.55e-227: tmp = wj * (1.0 / (1.0 + (1.0 / wj))) else: tmp = x / (1.0 + (wj * 2.0)) return tmp
function code(wj, x) tmp = 0.0 if (x <= -3.9e-153) tmp = Float64(x + Float64(-2.0 * Float64(wj * x))); elseif (x <= 1.55e-227) tmp = Float64(wj * Float64(1.0 / Float64(1.0 + Float64(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 (x <= -3.9e-153) tmp = x + (-2.0 * (wj * x)); elseif (x <= 1.55e-227) tmp = wj * (1.0 / (1.0 + (1.0 / wj))); else tmp = x / (1.0 + (wj * 2.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[x, -3.9e-153], N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.55e-227], N[(wj * N[(1.0 / N[(1.0 + N[(1.0 / wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(1.0 + N[(wj * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{-153}:\\
\;\;\;\;x + -2 \cdot \left(wj \cdot x\right)\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-227}:\\
\;\;\;\;wj \cdot \frac{1}{1 + \frac{1}{wj}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1 + wj \cdot 2}\\
\end{array}
\end{array}
if x < -3.9000000000000002e-153Initial program 94.0%
distribute-rgt1-in93.9%
associate-/l/94.0%
div-sub94.0%
associate-/l*94.0%
*-inverses98.3%
/-rgt-identity98.3%
Simplified98.3%
Taylor expanded in wj around 0 91.0%
*-commutative91.0%
Simplified91.0%
if -3.9000000000000002e-153 < x < 1.5499999999999999e-227Initial program 31.9%
distribute-rgt1-in33.7%
associate-/l/33.7%
div-sub31.9%
associate-/l*31.9%
*-inverses35.6%
/-rgt-identity35.6%
Simplified35.6%
flip--21.3%
clear-num21.3%
pow221.3%
pow221.3%
Applied egg-rr21.3%
Taylor expanded in wj around inf 63.9%
inv-pow63.9%
unpow263.9%
pow-prod-down63.5%
inv-pow63.5%
inv-pow63.5%
Applied egg-rr63.5%
inv-pow63.5%
distribute-rgt1-in63.5%
unpow-prod-down63.7%
+-commutative63.7%
Applied egg-rr63.7%
unpow-163.7%
remove-double-div63.8%
*-commutative63.8%
unpow-163.8%
Simplified63.8%
if 1.5499999999999999e-227 < x Initial program 81.4%
distribute-rgt1-in81.4%
associate-/l/81.4%
div-sub81.4%
associate-/l*81.4%
*-inverses81.4%
/-rgt-identity81.4%
Simplified81.4%
flip--55.5%
clear-num55.4%
pow255.4%
pow255.4%
Applied egg-rr55.4%
Taylor expanded in x around inf 91.3%
*-commutative91.3%
+-commutative91.3%
Simplified91.3%
Taylor expanded in wj around 0 90.6%
*-commutative90.6%
Simplified90.6%
Final simplification85.1%
(FPCore (wj x)
:precision binary64
(if (<= x -3.7e-152)
(+ wj (/ (- 1.0 wj) (/ (+ wj 1.0) x)))
(if (<= x 6.2e-230)
(* wj (/ 1.0 (+ 1.0 (/ 1.0 wj))))
(/ x (/ (+ wj 1.0) (- 1.0 wj))))))
double code(double wj, double x) {
double tmp;
if (x <= -3.7e-152) {
tmp = wj + ((1.0 - wj) / ((wj + 1.0) / x));
} else if (x <= 6.2e-230) {
tmp = wj * (1.0 / (1.0 + (1.0 / wj)));
} else {
tmp = x / ((wj + 1.0) / (1.0 - wj));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-3.7d-152)) then
tmp = wj + ((1.0d0 - wj) / ((wj + 1.0d0) / x))
else if (x <= 6.2d-230) then
tmp = wj * (1.0d0 / (1.0d0 + (1.0d0 / wj)))
else
tmp = x / ((wj + 1.0d0) / (1.0d0 - wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (x <= -3.7e-152) {
tmp = wj + ((1.0 - wj) / ((wj + 1.0) / x));
} else if (x <= 6.2e-230) {
tmp = wj * (1.0 / (1.0 + (1.0 / wj)));
} else {
tmp = x / ((wj + 1.0) / (1.0 - wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if x <= -3.7e-152: tmp = wj + ((1.0 - wj) / ((wj + 1.0) / x)) elif x <= 6.2e-230: tmp = wj * (1.0 / (1.0 + (1.0 / wj))) else: tmp = x / ((wj + 1.0) / (1.0 - wj)) return tmp
function code(wj, x) tmp = 0.0 if (x <= -3.7e-152) tmp = Float64(wj + Float64(Float64(1.0 - wj) / Float64(Float64(wj + 1.0) / x))); elseif (x <= 6.2e-230) tmp = Float64(wj * Float64(1.0 / Float64(1.0 + Float64(1.0 / wj)))); else tmp = Float64(x / Float64(Float64(wj + 1.0) / Float64(1.0 - wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (x <= -3.7e-152) tmp = wj + ((1.0 - wj) / ((wj + 1.0) / x)); elseif (x <= 6.2e-230) tmp = wj * (1.0 / (1.0 + (1.0 / wj))); else tmp = x / ((wj + 1.0) / (1.0 - wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[x, -3.7e-152], N[(wj + N[(N[(1.0 - wj), $MachinePrecision] / N[(N[(wj + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.2e-230], N[(wj * N[(1.0 / N[(1.0 + N[(1.0 / wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(wj + 1.0), $MachinePrecision] / N[(1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{-152}:\\
\;\;\;\;wj + \frac{1 - wj}{\frac{wj + 1}{x}}\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{-230}:\\
\;\;\;\;wj \cdot \frac{1}{1 + \frac{1}{wj}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{wj + 1}{1 - wj}}\\
\end{array}
\end{array}
if x < -3.6999999999999998e-152Initial program 94.0%
distribute-rgt1-in93.9%
associate-/l/94.0%
div-sub94.0%
associate-/l*94.0%
*-inverses98.3%
/-rgt-identity98.3%
Simplified98.3%
Taylor expanded in wj around 0 94.6%
associate-*r*94.6%
neg-mul-194.6%
Simplified94.6%
Taylor expanded in x around inf 92.0%
mul-1-neg92.0%
neg-mul-192.0%
sub-neg92.0%
*-commutative92.0%
sub-neg92.0%
+-commutative92.0%
neg-mul-192.0%
fma-udef92.0%
+-commutative92.0%
associate-/l*91.6%
fma-udef91.6%
neg-mul-191.6%
+-commutative91.6%
sub-neg91.6%
Simplified91.6%
if -3.6999999999999998e-152 < x < 6.19999999999999999e-230Initial program 31.9%
distribute-rgt1-in33.7%
associate-/l/33.7%
div-sub31.9%
associate-/l*31.9%
*-inverses35.6%
/-rgt-identity35.6%
Simplified35.6%
flip--21.3%
clear-num21.3%
pow221.3%
pow221.3%
Applied egg-rr21.3%
Taylor expanded in wj around inf 63.9%
inv-pow63.9%
unpow263.9%
pow-prod-down63.5%
inv-pow63.5%
inv-pow63.5%
Applied egg-rr63.5%
inv-pow63.5%
distribute-rgt1-in63.5%
unpow-prod-down63.7%
+-commutative63.7%
Applied egg-rr63.7%
unpow-163.7%
remove-double-div63.8%
*-commutative63.8%
unpow-163.8%
Simplified63.8%
if 6.19999999999999999e-230 < x Initial program 81.4%
distribute-rgt1-in81.4%
associate-/l/81.4%
div-sub81.4%
associate-/l*81.4%
*-inverses81.4%
/-rgt-identity81.4%
Simplified81.4%
Taylor expanded in wj around 0 80.8%
associate-*r*80.8%
neg-mul-180.8%
Simplified80.8%
clear-num80.6%
inv-pow80.6%
distribute-rgt1-in80.6%
neg-mul-180.6%
fma-def80.6%
Applied egg-rr80.6%
unpow-180.6%
fma-udef80.6%
neg-mul-180.6%
+-commutative80.6%
sub-neg80.6%
*-commutative80.6%
Simplified80.6%
Taylor expanded in x around -inf 90.7%
associate-/l*90.7%
+-commutative90.7%
Simplified90.7%
Final simplification85.4%
(FPCore (wj x) :precision binary64 (if (or (<= x -1.05e-203) (not (<= x 5.6e-247))) (+ x (* -2.0 (* wj x))) (* wj (+ wj (* x -2.0)))))
double code(double wj, double x) {
double tmp;
if ((x <= -1.05e-203) || !(x <= 5.6e-247)) {
tmp = x + (-2.0 * (wj * x));
} else {
tmp = 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 ((x <= (-1.05d-203)) .or. (.not. (x <= 5.6d-247))) then
tmp = x + ((-2.0d0) * (wj * x))
else
tmp = wj * (wj + (x * (-2.0d0)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if ((x <= -1.05e-203) || !(x <= 5.6e-247)) {
tmp = x + (-2.0 * (wj * x));
} else {
tmp = wj * (wj + (x * -2.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if (x <= -1.05e-203) or not (x <= 5.6e-247): tmp = x + (-2.0 * (wj * x)) else: tmp = wj * (wj + (x * -2.0)) return tmp
function code(wj, x) tmp = 0.0 if ((x <= -1.05e-203) || !(x <= 5.6e-247)) tmp = Float64(x + Float64(-2.0 * Float64(wj * x))); else tmp = Float64(wj * Float64(wj + Float64(x * -2.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if ((x <= -1.05e-203) || ~((x <= 5.6e-247))) tmp = x + (-2.0 * (wj * x)); else tmp = wj * (wj + (x * -2.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[Or[LessEqual[x, -1.05e-203], N[Not[LessEqual[x, 5.6e-247]], $MachinePrecision]], N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj * N[(wj + N[(x * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{-203} \lor \neg \left(x \leq 5.6 \cdot 10^{-247}\right):\\
\;\;\;\;x + -2 \cdot \left(wj \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;wj \cdot \left(wj + x \cdot -2\right)\\
\end{array}
\end{array}
if x < -1.05000000000000001e-203 or 5.59999999999999973e-247 < x Initial program 83.8%
distribute-rgt1-in83.8%
associate-/l/83.8%
div-sub83.8%
associate-/l*83.8%
*-inverses86.1%
/-rgt-identity86.1%
Simplified86.1%
Taylor expanded in wj around 0 87.4%
*-commutative87.4%
Simplified87.4%
if -1.05000000000000001e-203 < x < 5.59999999999999973e-247Initial program 24.7%
distribute-rgt1-in27.4%
associate-/l/27.6%
div-sub24.8%
associate-/l*24.8%
*-inverses27.6%
/-rgt-identity27.6%
Simplified27.6%
Taylor expanded in wj around 0 87.5%
Taylor expanded in x around 0 87.5%
Taylor expanded in wj around inf 60.0%
+-commutative60.0%
unpow260.0%
*-commutative60.0%
associate-*r*60.0%
distribute-lft-out60.0%
*-commutative60.0%
Simplified60.0%
Final simplification83.5%
(FPCore (wj x) :precision binary64 (if (<= x -9.5e-205) x (if (<= x 3.1e-248) (* wj (+ wj (* x -2.0))) x)))
double code(double wj, double x) {
double tmp;
if (x <= -9.5e-205) {
tmp = x;
} else if (x <= 3.1e-248) {
tmp = wj * (wj + (x * -2.0));
} else {
tmp = x;
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-9.5d-205)) then
tmp = x
else if (x <= 3.1d-248) then
tmp = wj * (wj + (x * (-2.0d0)))
else
tmp = x
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (x <= -9.5e-205) {
tmp = x;
} else if (x <= 3.1e-248) {
tmp = wj * (wj + (x * -2.0));
} else {
tmp = x;
}
return tmp;
}
def code(wj, x): tmp = 0 if x <= -9.5e-205: tmp = x elif x <= 3.1e-248: tmp = wj * (wj + (x * -2.0)) else: tmp = x return tmp
function code(wj, x) tmp = 0.0 if (x <= -9.5e-205) tmp = x; elseif (x <= 3.1e-248) tmp = Float64(wj * Float64(wj + Float64(x * -2.0))); else tmp = x; end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (x <= -9.5e-205) tmp = x; elseif (x <= 3.1e-248) tmp = wj * (wj + (x * -2.0)); else tmp = x; end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[x, -9.5e-205], x, If[LessEqual[x, 3.1e-248], N[(wj * N[(wj + N[(x * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-205}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{-248}:\\
\;\;\;\;wj \cdot \left(wj + x \cdot -2\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -9.49999999999999957e-205 or 3.1000000000000002e-248 < x Initial program 83.8%
distribute-rgt1-in83.8%
associate-/l/83.8%
div-sub83.8%
associate-/l*83.8%
*-inverses86.1%
/-rgt-identity86.1%
Simplified86.1%
Taylor expanded in wj around 0 85.8%
if -9.49999999999999957e-205 < x < 3.1000000000000002e-248Initial program 24.7%
distribute-rgt1-in27.4%
associate-/l/27.6%
div-sub24.8%
associate-/l*24.8%
*-inverses27.6%
/-rgt-identity27.6%
Simplified27.6%
Taylor expanded in wj around 0 87.5%
Taylor expanded in x around 0 87.5%
Taylor expanded in wj around inf 60.0%
+-commutative60.0%
unpow260.0%
*-commutative60.0%
associate-*r*60.0%
distribute-lft-out60.0%
*-commutative60.0%
Simplified60.0%
Final simplification82.2%
(FPCore (wj x) :precision binary64 (if (<= wj 1.75e-6) (+ x (* -2.0 (* wj x))) (- wj (/ wj (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 1.75e-6) {
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 <= 1.75d-6) 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 <= 1.75e-6) {
tmp = x + (-2.0 * (wj * x));
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 1.75e-6: tmp = x + (-2.0 * (wj * x)) else: tmp = wj - (wj / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 1.75e-6) 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 <= 1.75e-6) tmp = x + (-2.0 * (wj * x)); else tmp = wj - (wj / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 1.75e-6], 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 1.75 \cdot 10^{-6}:\\
\;\;\;\;x + -2 \cdot \left(wj \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 1.74999999999999997e-6Initial program 77.0%
distribute-rgt1-in77.4%
associate-/l/77.4%
div-sub77.0%
associate-/l*77.0%
*-inverses77.4%
/-rgt-identity77.4%
Simplified77.4%
Taylor expanded in wj around 0 81.9%
*-commutative81.9%
Simplified81.9%
if 1.74999999999999997e-6 < wj Initial program 23.5%
distribute-rgt1-in23.5%
associate-/l/23.9%
div-sub23.9%
associate-/l*23.9%
*-inverses95.3%
/-rgt-identity95.3%
Simplified95.3%
Taylor expanded in x around 0 95.3%
+-commutative95.3%
Simplified95.3%
Final simplification82.2%
(FPCore (wj x) :precision binary64 (if (<= wj 2.1e-6) (/ x (+ 1.0 (* wj 2.0))) (- wj (/ wj (+ wj 1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 2.1e-6) {
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 <= 2.1d-6) 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 <= 2.1e-6) {
tmp = x / (1.0 + (wj * 2.0));
} else {
tmp = wj - (wj / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 2.1e-6: 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 <= 2.1e-6) 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 <= 2.1e-6) 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, 2.1e-6], 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 2.1 \cdot 10^{-6}:\\
\;\;\;\;\frac{x}{1 + wj \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj + 1}\\
\end{array}
\end{array}
if wj < 2.0999999999999998e-6Initial program 77.0%
distribute-rgt1-in77.4%
associate-/l/77.4%
div-sub77.0%
associate-/l*77.0%
*-inverses77.4%
/-rgt-identity77.4%
Simplified77.4%
flip--52.8%
clear-num52.7%
pow252.7%
pow252.7%
Applied egg-rr52.7%
Taylor expanded in x around inf 83.2%
*-commutative83.2%
+-commutative83.2%
Simplified83.2%
Taylor expanded in wj around 0 81.9%
*-commutative81.9%
Simplified81.9%
if 2.0999999999999998e-6 < wj Initial program 23.5%
distribute-rgt1-in23.5%
associate-/l/23.9%
div-sub23.9%
associate-/l*23.9%
*-inverses95.3%
/-rgt-identity95.3%
Simplified95.3%
Taylor expanded in x around 0 95.3%
+-commutative95.3%
Simplified95.3%
Final simplification82.3%
(FPCore (wj x) :precision binary64 (if (<= wj 1.75) x (+ wj -1.0)))
double code(double wj, double x) {
double tmp;
if (wj <= 1.75) {
tmp = x;
} else {
tmp = 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.75d0) then
tmp = x
else
tmp = wj + (-1.0d0)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 1.75) {
tmp = x;
} else {
tmp = wj + -1.0;
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 1.75: tmp = x else: tmp = wj + -1.0 return tmp
function code(wj, x) tmp = 0.0 if (wj <= 1.75) tmp = x; else tmp = Float64(wj + -1.0); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 1.75) tmp = x; else tmp = wj + -1.0; end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 1.75], x, N[(wj + -1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 1.75:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;wj + -1\\
\end{array}
\end{array}
if wj < 1.75Initial program 77.0%
distribute-rgt1-in77.4%
associate-/l/77.4%
div-sub77.0%
associate-/l*77.0%
*-inverses77.4%
/-rgt-identity77.4%
Simplified77.4%
Taylor expanded in wj around 0 80.0%
if 1.75 < wj Initial program 0.0%
distribute-rgt1-in0.0%
associate-/l/0.0%
div-sub0.0%
associate-/l*0.0%
*-inverses100.0%
/-rgt-identity100.0%
Simplified100.0%
Taylor expanded in wj around inf 87.3%
Final simplification80.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 75.5%
distribute-rgt1-in75.9%
associate-/l/75.9%
div-sub75.5%
associate-/l*75.5%
*-inverses77.9%
/-rgt-identity77.9%
Simplified77.9%
Taylor expanded in wj around inf 4.6%
Final simplification4.6%
(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 75.5%
distribute-rgt1-in75.9%
associate-/l/75.9%
div-sub75.5%
associate-/l*75.5%
*-inverses77.9%
/-rgt-identity77.9%
Simplified77.9%
Taylor expanded in wj around 0 78.4%
Final simplification78.4%
(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 2024010
(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))))))