
(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 19 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 -2.9e-7)
(+ wj (/ (- (/ x (exp wj)) wj) (+ wj 1.0)))
(+
(* (pow wj 2.0) (+ x (+ x 1.0)))
(- (+ x (* (- (- -1.0 x) x) (pow wj 3.0))) (* wj (+ x x))))))
double code(double wj, double x) {
double tmp;
if (wj <= -2.9e-7) {
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = (pow(wj, 2.0) * (x + (x + 1.0))) + ((x + (((-1.0 - x) - x) * pow(wj, 3.0))) - (wj * (x + x)));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-2.9d-7)) then
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0d0))
else
tmp = ((wj ** 2.0d0) * (x + (x + 1.0d0))) + ((x + ((((-1.0d0) - x) - x) * (wj ** 3.0d0))) - (wj * (x + x)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -2.9e-7) {
tmp = wj + (((x / Math.exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = (Math.pow(wj, 2.0) * (x + (x + 1.0))) + ((x + (((-1.0 - x) - x) * Math.pow(wj, 3.0))) - (wj * (x + x)));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -2.9e-7: tmp = wj + (((x / math.exp(wj)) - wj) / (wj + 1.0)) else: tmp = (math.pow(wj, 2.0) * (x + (x + 1.0))) + ((x + (((-1.0 - x) - x) * math.pow(wj, 3.0))) - (wj * (x + x))) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -2.9e-7) tmp = Float64(wj + Float64(Float64(Float64(x / exp(wj)) - wj) / Float64(wj + 1.0))); else tmp = Float64(Float64((wj ^ 2.0) * Float64(x + Float64(x + 1.0))) + Float64(Float64(x + Float64(Float64(Float64(-1.0 - x) - x) * (wj ^ 3.0))) - Float64(wj * Float64(x + x)))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -2.9e-7) tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0)); else tmp = ((wj ^ 2.0) * (x + (x + 1.0))) + ((x + (((-1.0 - x) - x) * (wj ^ 3.0))) - (wj * (x + x))); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -2.9e-7], N[(wj + N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[wj, 2.0], $MachinePrecision] * N[(x + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x + N[(N[(N[(-1.0 - x), $MachinePrecision] - x), $MachinePrecision] * N[Power[wj, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(wj * N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -2.9 \cdot 10^{-7}:\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;{wj}^{2} \cdot \left(x + \left(x + 1\right)\right) + \left(\left(x + \left(\left(-1 - x\right) - x\right) \cdot {wj}^{3}\right) - wj \cdot \left(x + x\right)\right)\\
\end{array}
\end{array}
if wj < -2.8999999999999998e-7Initial program 2.3%
sub-neg2.3%
div-sub2.3%
sub-neg2.3%
+-commutative2.3%
distribute-neg-in2.3%
remove-double-neg2.3%
sub-neg2.3%
div-sub2.3%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
if -2.8999999999999998e-7 < wj Initial program 81.0%
sub-neg81.0%
div-sub81.0%
sub-neg81.0%
+-commutative81.0%
distribute-neg-in81.0%
remove-double-neg81.0%
sub-neg81.0%
div-sub81.0%
distribute-rgt1-in81.0%
associate-/l/81.0%
Simplified81.6%
Taylor expanded in wj around 0 80.4%
Taylor expanded in wj around 0 98.8%
Final simplification99.2%
(FPCore (wj x)
:precision binary64
(if (<= wj -6.6e-9)
(+ wj (/ (- (/ x (exp wj)) wj) (+ wj 1.0)))
(+
(* (pow wj 2.0) (- 1.0 (+ (* x -4.0) (* x 1.5))))
(+ x (* -2.0 (* wj x))))))
double code(double wj, double x) {
double tmp;
if (wj <= -6.6e-9) {
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = (pow(wj, 2.0) * (1.0 - ((x * -4.0) + (x * 1.5)))) + (x + (-2.0 * (wj * x)));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-6.6d-9)) then
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0d0))
else
tmp = ((wj ** 2.0d0) * (1.0d0 - ((x * (-4.0d0)) + (x * 1.5d0)))) + (x + ((-2.0d0) * (wj * x)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -6.6e-9) {
tmp = wj + (((x / Math.exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = (Math.pow(wj, 2.0) * (1.0 - ((x * -4.0) + (x * 1.5)))) + (x + (-2.0 * (wj * x)));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -6.6e-9: tmp = wj + (((x / math.exp(wj)) - wj) / (wj + 1.0)) else: tmp = (math.pow(wj, 2.0) * (1.0 - ((x * -4.0) + (x * 1.5)))) + (x + (-2.0 * (wj * x))) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -6.6e-9) tmp = Float64(wj + Float64(Float64(Float64(x / exp(wj)) - wj) / Float64(wj + 1.0))); else tmp = Float64(Float64((wj ^ 2.0) * Float64(1.0 - Float64(Float64(x * -4.0) + Float64(x * 1.5)))) + Float64(x + Float64(-2.0 * Float64(wj * x)))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -6.6e-9) tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0)); else tmp = ((wj ^ 2.0) * (1.0 - ((x * -4.0) + (x * 1.5)))) + (x + (-2.0 * (wj * x))); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -6.6e-9], N[(wj + N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $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[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -6.6 \cdot 10^{-9}:\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;{wj}^{2} \cdot \left(1 - \left(x \cdot -4 + x \cdot 1.5\right)\right) + \left(x + -2 \cdot \left(wj \cdot x\right)\right)\\
\end{array}
\end{array}
if wj < -6.60000000000000037e-9Initial program 2.3%
sub-neg2.3%
div-sub2.3%
sub-neg2.3%
+-commutative2.3%
distribute-neg-in2.3%
remove-double-neg2.3%
sub-neg2.3%
div-sub2.3%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
if -6.60000000000000037e-9 < wj Initial program 81.0%
sub-neg81.0%
div-sub81.0%
sub-neg81.0%
+-commutative81.0%
distribute-neg-in81.0%
remove-double-neg81.0%
sub-neg81.0%
div-sub81.0%
distribute-rgt1-in81.0%
associate-/l/81.0%
Simplified81.6%
Taylor expanded in wj around 0 98.6%
Final simplification99.1%
(FPCore (wj x) :precision binary64 (if (<= wj -3.5e-9) (+ wj (/ (- (/ x (exp wj)) wj) (+ wj 1.0))) (+ (+ x (* -2.0 (* wj x))) (* (pow wj 2.0) (- 1.0 (* x -4.0))))))
double code(double wj, double x) {
double tmp;
if (wj <= -3.5e-9) {
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (pow(wj, 2.0) * (1.0 - (x * -4.0)));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-3.5d-9)) then
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0d0))
else
tmp = (x + ((-2.0d0) * (wj * x))) + ((wj ** 2.0d0) * (1.0d0 - (x * (-4.0d0))))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -3.5e-9) {
tmp = wj + (((x / Math.exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (Math.pow(wj, 2.0) * (1.0 - (x * -4.0)));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -3.5e-9: tmp = wj + (((x / math.exp(wj)) - wj) / (wj + 1.0)) else: tmp = (x + (-2.0 * (wj * x))) + (math.pow(wj, 2.0) * (1.0 - (x * -4.0))) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -3.5e-9) tmp = Float64(wj + Float64(Float64(Float64(x / exp(wj)) - wj) / Float64(wj + 1.0))); else tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64((wj ^ 2.0) * Float64(1.0 - Float64(x * -4.0)))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -3.5e-9) tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0)); else tmp = (x + (-2.0 * (wj * x))) + ((wj ^ 2.0) * (1.0 - (x * -4.0))); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -3.5e-9], N[(wj + N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[wj, 2.0], $MachinePrecision] * N[(1.0 - N[(x * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -3.5 \cdot 10^{-9}:\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + {wj}^{2} \cdot \left(1 - x \cdot -4\right)\\
\end{array}
\end{array}
if wj < -3.4999999999999999e-9Initial program 2.3%
sub-neg2.3%
div-sub2.3%
sub-neg2.3%
+-commutative2.3%
distribute-neg-in2.3%
remove-double-neg2.3%
sub-neg2.3%
div-sub2.3%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
if -3.4999999999999999e-9 < wj Initial program 81.0%
distribute-rgt1-in81.0%
Simplified81.0%
Taylor expanded in wj around 0 80.5%
*-commutative80.5%
Simplified80.5%
Taylor expanded in wj around 0 98.6%
Final simplification99.1%
(FPCore (wj x) :precision binary64 (if (<= wj -3.5e-9) (+ wj (/ (- (/ x (exp wj)) wj) (+ wj 1.0))) (+ (+ x (* -2.0 (* wj x))) (* wj wj))))
double code(double wj, double x) {
double tmp;
if (wj <= -3.5e-9) {
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-3.5d-9)) then
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0d0))
else
tmp = (x + ((-2.0d0) * (wj * x))) + (wj * wj)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -3.5e-9) {
tmp = wj + (((x / Math.exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -3.5e-9: tmp = wj + (((x / math.exp(wj)) - wj) / (wj + 1.0)) else: tmp = (x + (-2.0 * (wj * x))) + (wj * wj) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -3.5e-9) tmp = Float64(wj + Float64(Float64(Float64(x / exp(wj)) - wj) / Float64(wj + 1.0))); else tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -3.5e-9) tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0)); else tmp = (x + (-2.0 * (wj * x))) + (wj * wj); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -3.5e-9], N[(wj + N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -3.5 \cdot 10^{-9}:\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\\
\end{array}
\end{array}
if wj < -3.4999999999999999e-9Initial program 2.3%
sub-neg2.3%
div-sub2.3%
sub-neg2.3%
+-commutative2.3%
distribute-neg-in2.3%
remove-double-neg2.3%
sub-neg2.3%
div-sub2.3%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
if -3.4999999999999999e-9 < wj Initial program 81.0%
distribute-rgt1-in81.0%
Simplified81.0%
Taylor expanded in wj around 0 80.5%
*-commutative80.5%
Simplified80.5%
Taylor expanded in wj around 0 98.6%
Taylor expanded in x around 0 98.6%
unpow298.6%
Simplified98.6%
Final simplification99.1%
(FPCore (wj x) :precision binary64 (if (<= wj -1.7e-5) (+ wj (/ (/ x (exp wj)) (+ wj 1.0))) (+ (+ x (* -2.0 (* wj x))) (* wj wj))))
double code(double wj, double x) {
double tmp;
if (wj <= -1.7e-5) {
tmp = wj + ((x / exp(wj)) / (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-1.7d-5)) then
tmp = wj + ((x / exp(wj)) / (wj + 1.0d0))
else
tmp = (x + ((-2.0d0) * (wj * x))) + (wj * wj)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -1.7e-5) {
tmp = wj + ((x / Math.exp(wj)) / (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -1.7e-5: tmp = wj + ((x / math.exp(wj)) / (wj + 1.0)) else: tmp = (x + (-2.0 * (wj * x))) + (wj * wj) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -1.7e-5) tmp = Float64(wj + Float64(Float64(x / exp(wj)) / Float64(wj + 1.0))); else tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -1.7e-5) tmp = wj + ((x / exp(wj)) / (wj + 1.0)); else tmp = (x + (-2.0 * (wj * x))) + (wj * wj); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -1.7e-5], N[(wj + N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -1.7 \cdot 10^{-5}:\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}}}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\\
\end{array}
\end{array}
if wj < -1.7e-5Initial program 2.3%
distribute-rgt1-in100.0%
Simplified100.0%
Taylor expanded in x around inf 99.2%
associate-*r/99.2%
+-commutative99.2%
neg-mul-199.2%
associate-/r*99.2%
Simplified99.2%
if -1.7e-5 < wj Initial program 81.0%
distribute-rgt1-in81.0%
Simplified81.0%
Taylor expanded in wj around 0 80.5%
*-commutative80.5%
Simplified80.5%
Taylor expanded in wj around 0 98.6%
Taylor expanded in x around 0 98.6%
unpow298.6%
Simplified98.6%
Final simplification98.8%
(FPCore (wj x) :precision binary64 (if (<= wj -8.5e-6) (/ x (* (exp wj) (+ wj 1.0))) (+ (+ x (* -2.0 (* wj x))) (* wj wj))))
double code(double wj, double x) {
double tmp;
if (wj <= -8.5e-6) {
tmp = x / (exp(wj) * (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-8.5d-6)) then
tmp = x / (exp(wj) * (wj + 1.0d0))
else
tmp = (x + ((-2.0d0) * (wj * x))) + (wj * wj)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -8.5e-6) {
tmp = x / (Math.exp(wj) * (wj + 1.0));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -8.5e-6: tmp = x / (math.exp(wj) * (wj + 1.0)) else: tmp = (x + (-2.0 * (wj * x))) + (wj * wj) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -8.5e-6) tmp = Float64(x / Float64(exp(wj) * Float64(wj + 1.0))); else tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -8.5e-6) tmp = x / (exp(wj) * (wj + 1.0)); else tmp = (x + (-2.0 * (wj * x))) + (wj * wj); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -8.5e-6], N[(x / N[(N[Exp[wj], $MachinePrecision] * N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -8.5 \cdot 10^{-6}:\\
\;\;\;\;\frac{x}{e^{wj} \cdot \left(wj + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\\
\end{array}
\end{array}
if wj < -8.4999999999999999e-6Initial program 2.3%
sub-neg2.3%
div-sub2.3%
sub-neg2.3%
+-commutative2.3%
distribute-neg-in2.3%
remove-double-neg2.3%
sub-neg2.3%
div-sub2.3%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in x around inf 98.9%
if -8.4999999999999999e-6 < wj Initial program 81.0%
distribute-rgt1-in81.0%
Simplified81.0%
Taylor expanded in wj around 0 80.5%
*-commutative80.5%
Simplified80.5%
Taylor expanded in wj around 0 98.6%
Taylor expanded in x around 0 98.6%
unpow298.6%
Simplified98.6%
Final simplification98.7%
(FPCore (wj x) :precision binary64 (if (<= wj -1.0) (/ x (* wj (exp wj))) (+ (+ x (* -2.0 (* wj x))) (* wj wj))))
double code(double wj, double x) {
double tmp;
if (wj <= -1.0) {
tmp = x / (wj * exp(wj));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-1.0d0)) then
tmp = x / (wj * exp(wj))
else
tmp = (x + ((-2.0d0) * (wj * x))) + (wj * wj)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -1.0) {
tmp = x / (wj * Math.exp(wj));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -1.0: tmp = x / (wj * math.exp(wj)) else: tmp = (x + (-2.0 * (wj * x))) + (wj * wj) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -1.0) tmp = Float64(x / Float64(wj * exp(wj))); else tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -1.0) tmp = x / (wj * exp(wj)); else tmp = (x + (-2.0 * (wj * x))) + (wj * wj); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -1.0], N[(x / N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -1:\\
\;\;\;\;\frac{x}{wj \cdot e^{wj}}\\
\mathbf{else}:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\\
\end{array}
\end{array}
if wj < -1Initial program 1.2%
sub-neg1.2%
div-sub1.1%
sub-neg1.1%
+-commutative1.1%
distribute-neg-in1.1%
remove-double-neg1.1%
sub-neg1.1%
div-sub1.2%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in x around inf 98.9%
Taylor expanded in wj around inf 98.9%
if -1 < wj Initial program 81.1%
distribute-rgt1-in81.1%
Simplified81.1%
Taylor expanded in wj around 0 80.0%
*-commutative80.0%
Simplified80.0%
Taylor expanded in wj around 0 98.1%
Taylor expanded in x around 0 98.1%
unpow298.1%
Simplified98.1%
Final simplification98.4%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (+ wj (/ (* x (- 1.0 wj)) wj))))
(if (<= wj -1.9e+266)
t_0
(if (<= wj -4.8e+193)
(* wj wj)
(if (<= wj -1.0) t_0 (+ (+ x (* -2.0 (* wj x))) (* wj wj)))))))
double code(double wj, double x) {
double t_0 = wj + ((x * (1.0 - wj)) / wj);
double tmp;
if (wj <= -1.9e+266) {
tmp = t_0;
} else if (wj <= -4.8e+193) {
tmp = wj * wj;
} else if (wj <= -1.0) {
tmp = t_0;
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = wj + ((x * (1.0d0 - wj)) / wj)
if (wj <= (-1.9d+266)) then
tmp = t_0
else if (wj <= (-4.8d+193)) then
tmp = wj * wj
else if (wj <= (-1.0d0)) then
tmp = t_0
else
tmp = (x + ((-2.0d0) * (wj * x))) + (wj * wj)
end if
code = tmp
end function
public static double code(double wj, double x) {
double t_0 = wj + ((x * (1.0 - wj)) / wj);
double tmp;
if (wj <= -1.9e+266) {
tmp = t_0;
} else if (wj <= -4.8e+193) {
tmp = wj * wj;
} else if (wj <= -1.0) {
tmp = t_0;
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
def code(wj, x): t_0 = wj + ((x * (1.0 - wj)) / wj) tmp = 0 if wj <= -1.9e+266: tmp = t_0 elif wj <= -4.8e+193: tmp = wj * wj elif wj <= -1.0: tmp = t_0 else: tmp = (x + (-2.0 * (wj * x))) + (wj * wj) return tmp
function code(wj, x) t_0 = Float64(wj + Float64(Float64(x * Float64(1.0 - wj)) / wj)) tmp = 0.0 if (wj <= -1.9e+266) tmp = t_0; elseif (wj <= -4.8e+193) tmp = Float64(wj * wj); elseif (wj <= -1.0) tmp = t_0; else tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)); end return tmp end
function tmp_2 = code(wj, x) t_0 = wj + ((x * (1.0 - wj)) / wj); tmp = 0.0; if (wj <= -1.9e+266) tmp = t_0; elseif (wj <= -4.8e+193) tmp = wj * wj; elseif (wj <= -1.0) tmp = t_0; else tmp = (x + (-2.0 * (wj * x))) + (wj * wj); end tmp_2 = tmp; end
code[wj_, x_] := Block[{t$95$0 = N[(wj + N[(N[(x * N[(1.0 - wj), $MachinePrecision]), $MachinePrecision] / wj), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[wj, -1.9e+266], t$95$0, If[LessEqual[wj, -4.8e+193], N[(wj * wj), $MachinePrecision], If[LessEqual[wj, -1.0], t$95$0, N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := wj + \frac{x \cdot \left(1 - wj\right)}{wj}\\
\mathbf{if}\;wj \leq -1.9 \cdot 10^{+266}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;wj \leq -4.8 \cdot 10^{+193}:\\
\;\;\;\;wj \cdot wj\\
\mathbf{elif}\;wj \leq -1:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\\
\end{array}
\end{array}
if wj < -1.8999999999999999e266 or -4.8e193 < wj < -1Initial program 1.7%
sub-neg1.7%
div-sub1.7%
sub-neg1.7%
+-commutative1.7%
distribute-neg-in1.7%
remove-double-neg1.7%
sub-neg1.7%
div-sub1.7%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in wj around 0 37.7%
Taylor expanded in x around inf 36.5%
associate-/l*5.0%
mul-1-neg5.0%
Simplified5.0%
Taylor expanded in wj around inf 5.0%
Taylor expanded in x around 0 36.5%
if -1.8999999999999999e266 < wj < -4.8e193Initial program 0.0%
sub-neg0.0%
div-sub0.0%
sub-neg0.0%
+-commutative0.0%
distribute-neg-in0.0%
remove-double-neg0.0%
sub-neg0.0%
div-sub0.0%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in x around 0 2.5%
+-commutative2.5%
Simplified2.5%
Taylor expanded in wj around 0 60.7%
unpow260.7%
Simplified60.7%
if -1 < wj Initial program 81.1%
distribute-rgt1-in81.1%
Simplified81.1%
Taylor expanded in wj around 0 80.0%
*-commutative80.0%
Simplified80.0%
Taylor expanded in wj around 0 98.1%
Taylor expanded in x around 0 98.1%
unpow298.1%
Simplified98.1%
Final simplification79.8%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (- x (* wj x))))
(if (<= x -7.6e+153)
(/ t_0 (+ wj 1.0))
(if (<= x 7.6e-127)
(+ (+ x (* -2.0 (* wj x))) (* wj wj))
(+ wj (/ (- t_0 wj) (+ wj 1.0)))))))
double code(double wj, double x) {
double t_0 = x - (wj * x);
double tmp;
if (x <= -7.6e+153) {
tmp = t_0 / (wj + 1.0);
} else if (x <= 7.6e-127) {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
} else {
tmp = wj + ((t_0 - wj) / (wj + 1.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = x - (wj * x)
if (x <= (-7.6d+153)) then
tmp = t_0 / (wj + 1.0d0)
else if (x <= 7.6d-127) then
tmp = (x + ((-2.0d0) * (wj * x))) + (wj * wj)
else
tmp = wj + ((t_0 - wj) / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double t_0 = x - (wj * x);
double tmp;
if (x <= -7.6e+153) {
tmp = t_0 / (wj + 1.0);
} else if (x <= 7.6e-127) {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
} else {
tmp = wj + ((t_0 - wj) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): t_0 = x - (wj * x) tmp = 0 if x <= -7.6e+153: tmp = t_0 / (wj + 1.0) elif x <= 7.6e-127: tmp = (x + (-2.0 * (wj * x))) + (wj * wj) else: tmp = wj + ((t_0 - wj) / (wj + 1.0)) return tmp
function code(wj, x) t_0 = Float64(x - Float64(wj * x)) tmp = 0.0 if (x <= -7.6e+153) tmp = Float64(t_0 / Float64(wj + 1.0)); elseif (x <= 7.6e-127) tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)); else tmp = Float64(wj + Float64(Float64(t_0 - wj) / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) t_0 = x - (wj * x); tmp = 0.0; if (x <= -7.6e+153) tmp = t_0 / (wj + 1.0); elseif (x <= 7.6e-127) tmp = (x + (-2.0 * (wj * x))) + (wj * wj); else tmp = wj + ((t_0 - wj) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := Block[{t$95$0 = N[(x - N[(wj * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.6e+153], N[(t$95$0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.6e-127], N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision], N[(wj + N[(N[(t$95$0 - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x - wj \cdot x\\
\mathbf{if}\;x \leq -7.6 \cdot 10^{+153}:\\
\;\;\;\;\frac{t_0}{wj + 1}\\
\mathbf{elif}\;x \leq 7.6 \cdot 10^{-127}:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{t_0 - wj}{wj + 1}\\
\end{array}
\end{array}
if x < -7.59999999999999933e153Initial program 62.5%
sub-neg62.5%
div-sub62.5%
sub-neg62.5%
+-commutative62.5%
distribute-neg-in62.5%
remove-double-neg62.5%
sub-neg62.5%
div-sub62.5%
distribute-rgt1-in96.8%
associate-/l/96.9%
Simplified100.0%
Taylor expanded in x around inf 96.9%
*-un-lft-identity96.9%
+-commutative96.9%
times-frac96.9%
+-commutative96.9%
Applied egg-rr96.9%
associate-*l/97.0%
*-lft-identity97.0%
Simplified97.0%
Taylor expanded in wj around 0 90.9%
if -7.59999999999999933e153 < x < 7.60000000000000005e-127Initial program 46.9%
distribute-rgt1-in76.4%
Simplified76.4%
Taylor expanded in wj around 0 46.8%
*-commutative46.8%
Simplified46.8%
Taylor expanded in wj around 0 79.2%
Taylor expanded in x around 0 84.0%
unpow284.0%
Simplified84.0%
if 7.60000000000000005e-127 < x Initial program 60.6%
sub-neg60.6%
div-sub60.6%
sub-neg60.6%
+-commutative60.6%
distribute-neg-in60.6%
remove-double-neg60.6%
sub-neg60.6%
div-sub60.6%
distribute-rgt1-in99.6%
associate-/l/99.5%
Simplified99.5%
Taylor expanded in wj around 0 77.7%
Final simplification82.5%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (+ wj (/ (* x (- 1.0 wj)) wj))))
(if (<= wj -2.9e+266)
t_0
(if (<= wj -5.1e+191)
(* wj wj)
(if (<= wj -1.0) t_0 (+ x (* -2.0 (* wj x))))))))
double code(double wj, double x) {
double t_0 = wj + ((x * (1.0 - wj)) / wj);
double tmp;
if (wj <= -2.9e+266) {
tmp = t_0;
} else if (wj <= -5.1e+191) {
tmp = wj * wj;
} else if (wj <= -1.0) {
tmp = t_0;
} else {
tmp = x + (-2.0 * (wj * x));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = wj + ((x * (1.0d0 - wj)) / wj)
if (wj <= (-2.9d+266)) then
tmp = t_0
else if (wj <= (-5.1d+191)) then
tmp = wj * wj
else if (wj <= (-1.0d0)) then
tmp = t_0
else
tmp = x + ((-2.0d0) * (wj * x))
end if
code = tmp
end function
public static double code(double wj, double x) {
double t_0 = wj + ((x * (1.0 - wj)) / wj);
double tmp;
if (wj <= -2.9e+266) {
tmp = t_0;
} else if (wj <= -5.1e+191) {
tmp = wj * wj;
} else if (wj <= -1.0) {
tmp = t_0;
} else {
tmp = x + (-2.0 * (wj * x));
}
return tmp;
}
def code(wj, x): t_0 = wj + ((x * (1.0 - wj)) / wj) tmp = 0 if wj <= -2.9e+266: tmp = t_0 elif wj <= -5.1e+191: tmp = wj * wj elif wj <= -1.0: tmp = t_0 else: tmp = x + (-2.0 * (wj * x)) return tmp
function code(wj, x) t_0 = Float64(wj + Float64(Float64(x * Float64(1.0 - wj)) / wj)) tmp = 0.0 if (wj <= -2.9e+266) tmp = t_0; elseif (wj <= -5.1e+191) tmp = Float64(wj * wj); elseif (wj <= -1.0) tmp = t_0; else tmp = Float64(x + Float64(-2.0 * Float64(wj * x))); end return tmp end
function tmp_2 = code(wj, x) t_0 = wj + ((x * (1.0 - wj)) / wj); tmp = 0.0; if (wj <= -2.9e+266) tmp = t_0; elseif (wj <= -5.1e+191) tmp = wj * wj; elseif (wj <= -1.0) tmp = t_0; else tmp = x + (-2.0 * (wj * x)); end tmp_2 = tmp; end
code[wj_, x_] := Block[{t$95$0 = N[(wj + N[(N[(x * N[(1.0 - wj), $MachinePrecision]), $MachinePrecision] / wj), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[wj, -2.9e+266], t$95$0, If[LessEqual[wj, -5.1e+191], N[(wj * wj), $MachinePrecision], If[LessEqual[wj, -1.0], t$95$0, N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := wj + \frac{x \cdot \left(1 - wj\right)}{wj}\\
\mathbf{if}\;wj \leq -2.9 \cdot 10^{+266}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;wj \leq -5.1 \cdot 10^{+191}:\\
\;\;\;\;wj \cdot wj\\
\mathbf{elif}\;wj \leq -1:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x + -2 \cdot \left(wj \cdot x\right)\\
\end{array}
\end{array}
if wj < -2.90000000000000017e266 or -5.09999999999999982e191 < wj < -1Initial program 1.7%
sub-neg1.7%
div-sub1.7%
sub-neg1.7%
+-commutative1.7%
distribute-neg-in1.7%
remove-double-neg1.7%
sub-neg1.7%
div-sub1.7%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in wj around 0 37.7%
Taylor expanded in x around inf 36.5%
associate-/l*5.0%
mul-1-neg5.0%
Simplified5.0%
Taylor expanded in wj around inf 5.0%
Taylor expanded in x around 0 36.5%
if -2.90000000000000017e266 < wj < -5.09999999999999982e191Initial program 0.0%
sub-neg0.0%
div-sub0.0%
sub-neg0.0%
+-commutative0.0%
distribute-neg-in0.0%
remove-double-neg0.0%
sub-neg0.0%
div-sub0.0%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in x around 0 2.5%
+-commutative2.5%
Simplified2.5%
Taylor expanded in wj around 0 60.7%
unpow260.7%
Simplified60.7%
if -1 < wj Initial program 81.1%
sub-neg81.1%
div-sub81.1%
sub-neg81.1%
+-commutative81.1%
distribute-neg-in81.1%
remove-double-neg81.1%
sub-neg81.1%
div-sub81.1%
distribute-rgt1-in81.1%
associate-/l/81.1%
Simplified81.7%
Taylor expanded in wj around 0 87.6%
Final simplification72.9%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (+ wj (/ (* x (- 1.0 wj)) wj))))
(if (<= wj -5.2e+265)
t_0
(if (<= wj -5.2e+191)
(* wj wj)
(if (<= wj -1.0) t_0 (* x (/ (- 1.0 wj) (+ wj 1.0))))))))
double code(double wj, double x) {
double t_0 = wj + ((x * (1.0 - wj)) / wj);
double tmp;
if (wj <= -5.2e+265) {
tmp = t_0;
} else if (wj <= -5.2e+191) {
tmp = wj * wj;
} else if (wj <= -1.0) {
tmp = t_0;
} else {
tmp = x * ((1.0 - wj) / (wj + 1.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = wj + ((x * (1.0d0 - wj)) / wj)
if (wj <= (-5.2d+265)) then
tmp = t_0
else if (wj <= (-5.2d+191)) then
tmp = wj * wj
else if (wj <= (-1.0d0)) then
tmp = t_0
else
tmp = x * ((1.0d0 - wj) / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double t_0 = wj + ((x * (1.0 - wj)) / wj);
double tmp;
if (wj <= -5.2e+265) {
tmp = t_0;
} else if (wj <= -5.2e+191) {
tmp = wj * wj;
} else if (wj <= -1.0) {
tmp = t_0;
} else {
tmp = x * ((1.0 - wj) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): t_0 = wj + ((x * (1.0 - wj)) / wj) tmp = 0 if wj <= -5.2e+265: tmp = t_0 elif wj <= -5.2e+191: tmp = wj * wj elif wj <= -1.0: tmp = t_0 else: tmp = x * ((1.0 - wj) / (wj + 1.0)) return tmp
function code(wj, x) t_0 = Float64(wj + Float64(Float64(x * Float64(1.0 - wj)) / wj)) tmp = 0.0 if (wj <= -5.2e+265) tmp = t_0; elseif (wj <= -5.2e+191) tmp = Float64(wj * wj); elseif (wj <= -1.0) tmp = t_0; else tmp = Float64(x * Float64(Float64(1.0 - wj) / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) t_0 = wj + ((x * (1.0 - wj)) / wj); tmp = 0.0; if (wj <= -5.2e+265) tmp = t_0; elseif (wj <= -5.2e+191) tmp = wj * wj; elseif (wj <= -1.0) tmp = t_0; else tmp = x * ((1.0 - wj) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := Block[{t$95$0 = N[(wj + N[(N[(x * N[(1.0 - wj), $MachinePrecision]), $MachinePrecision] / wj), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[wj, -5.2e+265], t$95$0, If[LessEqual[wj, -5.2e+191], N[(wj * wj), $MachinePrecision], If[LessEqual[wj, -1.0], t$95$0, N[(x * N[(N[(1.0 - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := wj + \frac{x \cdot \left(1 - wj\right)}{wj}\\
\mathbf{if}\;wj \leq -5.2 \cdot 10^{+265}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;wj \leq -5.2 \cdot 10^{+191}:\\
\;\;\;\;wj \cdot wj\\
\mathbf{elif}\;wj \leq -1:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{1 - wj}{wj + 1}\\
\end{array}
\end{array}
if wj < -5.2000000000000003e265 or -5.2000000000000001e191 < wj < -1Initial program 1.7%
sub-neg1.7%
div-sub1.7%
sub-neg1.7%
+-commutative1.7%
distribute-neg-in1.7%
remove-double-neg1.7%
sub-neg1.7%
div-sub1.7%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in wj around 0 37.7%
Taylor expanded in x around inf 36.5%
associate-/l*5.0%
mul-1-neg5.0%
Simplified5.0%
Taylor expanded in wj around inf 5.0%
Taylor expanded in x around 0 36.5%
if -5.2000000000000003e265 < wj < -5.2000000000000001e191Initial program 0.0%
sub-neg0.0%
div-sub0.0%
sub-neg0.0%
+-commutative0.0%
distribute-neg-in0.0%
remove-double-neg0.0%
sub-neg0.0%
div-sub0.0%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in x around 0 2.5%
+-commutative2.5%
Simplified2.5%
Taylor expanded in wj around 0 60.7%
unpow260.7%
Simplified60.7%
if -1 < wj Initial program 81.1%
sub-neg81.1%
div-sub81.1%
sub-neg81.1%
+-commutative81.1%
distribute-neg-in81.1%
remove-double-neg81.1%
sub-neg81.1%
div-sub81.1%
distribute-rgt1-in81.1%
associate-/l/81.1%
Simplified81.7%
Taylor expanded in wj around 0 80.1%
Taylor expanded in x around -inf 87.6%
mul-1-neg87.6%
*-commutative87.6%
distribute-lft-neg-in87.6%
sub-neg87.6%
*-rgt-identity87.6%
associate-*r/87.6%
neg-mul-187.6%
distribute-rgt-out87.6%
Simplified87.6%
distribute-lft-in87.6%
+-commutative87.6%
+-commutative87.6%
Applied egg-rr87.6%
distribute-lft-out87.6%
associate-*l/87.6%
*-lft-identity87.6%
Simplified87.6%
Final simplification72.9%
(FPCore (wj x) :precision binary64 (if (or (<= x -7.6e+153) (not (<= x 5.2e-21))) (/ (- x (* wj x)) (+ wj 1.0)) (+ (+ x (* -2.0 (* wj x))) (* wj wj))))
double code(double wj, double x) {
double tmp;
if ((x <= -7.6e+153) || !(x <= 5.2e-21)) {
tmp = (x - (wj * x)) / (wj + 1.0);
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if ((x <= (-7.6d+153)) .or. (.not. (x <= 5.2d-21))) then
tmp = (x - (wj * x)) / (wj + 1.0d0)
else
tmp = (x + ((-2.0d0) * (wj * x))) + (wj * wj)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if ((x <= -7.6e+153) || !(x <= 5.2e-21)) {
tmp = (x - (wj * x)) / (wj + 1.0);
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
def code(wj, x): tmp = 0 if (x <= -7.6e+153) or not (x <= 5.2e-21): tmp = (x - (wj * x)) / (wj + 1.0) else: tmp = (x + (-2.0 * (wj * x))) + (wj * wj) return tmp
function code(wj, x) tmp = 0.0 if ((x <= -7.6e+153) || !(x <= 5.2e-21)) tmp = Float64(Float64(x - Float64(wj * x)) / Float64(wj + 1.0)); else tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if ((x <= -7.6e+153) || ~((x <= 5.2e-21))) tmp = (x - (wj * x)) / (wj + 1.0); else tmp = (x + (-2.0 * (wj * x))) + (wj * wj); end tmp_2 = tmp; end
code[wj_, x_] := If[Or[LessEqual[x, -7.6e+153], N[Not[LessEqual[x, 5.2e-21]], $MachinePrecision]], N[(N[(x - N[(wj * x), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{+153} \lor \neg \left(x \leq 5.2 \cdot 10^{-21}\right):\\
\;\;\;\;\frac{x - wj \cdot x}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\\
\end{array}
\end{array}
if x < -7.59999999999999933e153 or 5.20000000000000035e-21 < x Initial program 61.8%
sub-neg61.8%
div-sub61.8%
sub-neg61.8%
+-commutative61.8%
distribute-neg-in61.8%
remove-double-neg61.8%
sub-neg61.8%
div-sub61.8%
distribute-rgt1-in99.1%
associate-/l/99.1%
Simplified100.0%
Taylor expanded in x around inf 99.1%
*-un-lft-identity99.1%
+-commutative99.1%
times-frac99.1%
+-commutative99.1%
Applied egg-rr99.1%
associate-*l/99.1%
*-lft-identity99.1%
Simplified99.1%
Taylor expanded in wj around 0 84.5%
if -7.59999999999999933e153 < x < 5.20000000000000035e-21Initial program 48.0%
distribute-rgt1-in78.9%
Simplified78.9%
Taylor expanded in wj around 0 48.1%
*-commutative48.1%
Simplified48.1%
Taylor expanded in wj around 0 76.6%
Taylor expanded in x around 0 80.8%
unpow280.8%
Simplified80.8%
Final simplification82.4%
(FPCore (wj x)
:precision binary64
(if (<= wj -2.25e+266)
(+ wj (/ (* x (- 1.0 wj)) wj))
(if (<= wj -215.0)
(- wj (+ wj (* (* wj wj) (+ wj -1.0))))
(+ (+ x (* -2.0 (* wj x))) (* wj wj)))))
double code(double wj, double x) {
double tmp;
if (wj <= -2.25e+266) {
tmp = wj + ((x * (1.0 - wj)) / wj);
} else if (wj <= -215.0) {
tmp = wj - (wj + ((wj * wj) * (wj + -1.0)));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-2.25d+266)) then
tmp = wj + ((x * (1.0d0 - wj)) / wj)
else if (wj <= (-215.0d0)) then
tmp = wj - (wj + ((wj * wj) * (wj + (-1.0d0))))
else
tmp = (x + ((-2.0d0) * (wj * x))) + (wj * wj)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -2.25e+266) {
tmp = wj + ((x * (1.0 - wj)) / wj);
} else if (wj <= -215.0) {
tmp = wj - (wj + ((wj * wj) * (wj + -1.0)));
} else {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -2.25e+266: tmp = wj + ((x * (1.0 - wj)) / wj) elif wj <= -215.0: tmp = wj - (wj + ((wj * wj) * (wj + -1.0))) else: tmp = (x + (-2.0 * (wj * x))) + (wj * wj) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -2.25e+266) tmp = Float64(wj + Float64(Float64(x * Float64(1.0 - wj)) / wj)); elseif (wj <= -215.0) tmp = Float64(wj - Float64(wj + Float64(Float64(wj * wj) * Float64(wj + -1.0)))); else tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -2.25e+266) tmp = wj + ((x * (1.0 - wj)) / wj); elseif (wj <= -215.0) tmp = wj - (wj + ((wj * wj) * (wj + -1.0))); else tmp = (x + (-2.0 * (wj * x))) + (wj * wj); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -2.25e+266], N[(wj + N[(N[(x * N[(1.0 - wj), $MachinePrecision]), $MachinePrecision] / wj), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, -215.0], N[(wj - N[(wj + N[(N[(wj * wj), $MachinePrecision] * N[(wj + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -2.25 \cdot 10^{+266}:\\
\;\;\;\;wj + \frac{x \cdot \left(1 - wj\right)}{wj}\\
\mathbf{elif}\;wj \leq -215:\\
\;\;\;\;wj - \left(wj + \left(wj \cdot wj\right) \cdot \left(wj + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\\
\end{array}
\end{array}
if wj < -2.25e266Initial program 0.0%
sub-neg0.0%
div-sub0.0%
sub-neg0.0%
+-commutative0.0%
distribute-neg-in0.0%
remove-double-neg0.0%
sub-neg0.0%
div-sub0.0%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in wj around 0 73.4%
Taylor expanded in x around inf 73.4%
associate-/l*5.7%
mul-1-neg5.7%
Simplified5.7%
Taylor expanded in wj around inf 5.7%
Taylor expanded in x around 0 73.4%
if -2.25e266 < wj < -215Initial program 0.0%
sub-neg0.0%
div-sub0.0%
sub-neg0.0%
+-commutative0.0%
distribute-neg-in0.0%
remove-double-neg0.0%
sub-neg0.0%
div-sub0.0%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in x around 0 2.6%
+-commutative2.6%
Simplified2.6%
Taylor expanded in wj around 0 36.7%
associate-+r+36.7%
+-commutative36.7%
cube-mult36.7%
unpow236.7%
distribute-rgt-out36.7%
unpow236.7%
+-commutative36.7%
Simplified36.7%
if -215 < wj Initial program 81.3%
distribute-rgt1-in81.3%
Simplified81.3%
Taylor expanded in wj around 0 79.7%
*-commutative79.7%
Simplified79.7%
Taylor expanded in wj around 0 97.6%
Taylor expanded in x around 0 97.5%
unpow297.5%
Simplified97.5%
Final simplification78.7%
(FPCore (wj x)
:precision binary64
(if (<= x -7.6e+153)
(/ (- x (* wj x)) (+ wj 1.0))
(if (<= x 1.85e-18)
(+ (+ x (* -2.0 (* wj x))) (* wj wj))
(+ wj (/ (* x (- 1.0 wj)) (+ wj 1.0))))))
double code(double wj, double x) {
double tmp;
if (x <= -7.6e+153) {
tmp = (x - (wj * x)) / (wj + 1.0);
} else if (x <= 1.85e-18) {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
} else {
tmp = wj + ((x * (1.0 - wj)) / (wj + 1.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-7.6d+153)) then
tmp = (x - (wj * x)) / (wj + 1.0d0)
else if (x <= 1.85d-18) then
tmp = (x + ((-2.0d0) * (wj * x))) + (wj * wj)
else
tmp = wj + ((x * (1.0d0 - wj)) / (wj + 1.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (x <= -7.6e+153) {
tmp = (x - (wj * x)) / (wj + 1.0);
} else if (x <= 1.85e-18) {
tmp = (x + (-2.0 * (wj * x))) + (wj * wj);
} else {
tmp = wj + ((x * (1.0 - wj)) / (wj + 1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if x <= -7.6e+153: tmp = (x - (wj * x)) / (wj + 1.0) elif x <= 1.85e-18: tmp = (x + (-2.0 * (wj * x))) + (wj * wj) else: tmp = wj + ((x * (1.0 - wj)) / (wj + 1.0)) return tmp
function code(wj, x) tmp = 0.0 if (x <= -7.6e+153) tmp = Float64(Float64(x - Float64(wj * x)) / Float64(wj + 1.0)); elseif (x <= 1.85e-18) tmp = Float64(Float64(x + Float64(-2.0 * Float64(wj * x))) + Float64(wj * wj)); else tmp = Float64(wj + Float64(Float64(x * Float64(1.0 - wj)) / Float64(wj + 1.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (x <= -7.6e+153) tmp = (x - (wj * x)) / (wj + 1.0); elseif (x <= 1.85e-18) tmp = (x + (-2.0 * (wj * x))) + (wj * wj); else tmp = wj + ((x * (1.0 - wj)) / (wj + 1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[x, -7.6e+153], N[(N[(x - N[(wj * x), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.85e-18], N[(N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(wj * wj), $MachinePrecision]), $MachinePrecision], N[(wj + N[(N[(x * N[(1.0 - wj), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{+153}:\\
\;\;\;\;\frac{x - wj \cdot x}{wj + 1}\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-18}:\\
\;\;\;\;\left(x + -2 \cdot \left(wj \cdot x\right)\right) + wj \cdot wj\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{x \cdot \left(1 - wj\right)}{wj + 1}\\
\end{array}
\end{array}
if x < -7.59999999999999933e153Initial program 62.5%
sub-neg62.5%
div-sub62.5%
sub-neg62.5%
+-commutative62.5%
distribute-neg-in62.5%
remove-double-neg62.5%
sub-neg62.5%
div-sub62.5%
distribute-rgt1-in96.8%
associate-/l/96.9%
Simplified100.0%
Taylor expanded in x around inf 96.9%
*-un-lft-identity96.9%
+-commutative96.9%
times-frac96.9%
+-commutative96.9%
Applied egg-rr96.9%
associate-*l/97.0%
*-lft-identity97.0%
Simplified97.0%
Taylor expanded in wj around 0 90.9%
if -7.59999999999999933e153 < x < 1.8500000000000002e-18Initial program 48.0%
distribute-rgt1-in78.9%
Simplified78.9%
Taylor expanded in wj around 0 48.1%
*-commutative48.1%
Simplified48.1%
Taylor expanded in wj around 0 76.6%
Taylor expanded in x around 0 80.8%
unpow280.8%
Simplified80.8%
if 1.8500000000000002e-18 < x Initial program 61.5%
sub-neg61.5%
div-sub61.5%
sub-neg61.5%
+-commutative61.5%
distribute-neg-in61.5%
remove-double-neg61.5%
sub-neg61.5%
div-sub61.5%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in wj around 0 82.0%
Taylor expanded in x around -inf 82.0%
associate-*r/82.0%
*-commutative82.0%
associate-*r*82.0%
mul-1-neg82.0%
sub-neg82.0%
metadata-eval82.0%
Simplified82.0%
Final simplification82.4%
(FPCore (wj x) :precision binary64 (if (<= wj -215.0) (* wj wj) (+ x (* -2.0 (* wj x)))))
double code(double wj, double x) {
double tmp;
if (wj <= -215.0) {
tmp = wj * wj;
} else {
tmp = x + (-2.0 * (wj * x));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-215.0d0)) then
tmp = wj * wj
else
tmp = x + ((-2.0d0) * (wj * x))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -215.0) {
tmp = wj * wj;
} else {
tmp = x + (-2.0 * (wj * x));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -215.0: tmp = wj * wj else: tmp = x + (-2.0 * (wj * x)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -215.0) tmp = Float64(wj * wj); else tmp = Float64(x + Float64(-2.0 * Float64(wj * x))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -215.0) tmp = wj * wj; else tmp = x + (-2.0 * (wj * x)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -215.0], N[(wj * wj), $MachinePrecision], N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -215:\\
\;\;\;\;wj \cdot wj\\
\mathbf{else}:\\
\;\;\;\;x + -2 \cdot \left(wj \cdot x\right)\\
\end{array}
\end{array}
if wj < -215Initial program 0.0%
sub-neg0.0%
div-sub0.0%
sub-neg0.0%
+-commutative0.0%
distribute-neg-in0.0%
remove-double-neg0.0%
sub-neg0.0%
div-sub0.0%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in x around 0 3.0%
+-commutative3.0%
Simplified3.0%
Taylor expanded in wj around 0 31.2%
unpow231.2%
Simplified31.2%
if -215 < wj Initial program 81.3%
sub-neg81.3%
div-sub81.3%
sub-neg81.3%
+-commutative81.3%
distribute-neg-in81.3%
remove-double-neg81.3%
sub-neg81.3%
div-sub81.3%
distribute-rgt1-in81.3%
associate-/l/81.2%
Simplified81.8%
Taylor expanded in wj around 0 87.1%
Final simplification68.3%
(FPCore (wj x) :precision binary64 (if (<= wj -3e+98) (* wj wj) (/ x (+ 1.0 (* wj 2.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= -3e+98) {
tmp = wj * wj;
} else {
tmp = x / (1.0 + (wj * 2.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= (-3d+98)) then
tmp = wj * wj
else
tmp = x / (1.0d0 + (wj * 2.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -3e+98) {
tmp = wj * wj;
} else {
tmp = x / (1.0 + (wj * 2.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -3e+98: tmp = wj * wj else: tmp = x / (1.0 + (wj * 2.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -3e+98) tmp = Float64(wj * wj); else tmp = Float64(x / Float64(1.0 + Float64(wj * 2.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -3e+98) tmp = wj * wj; else tmp = x / (1.0 + (wj * 2.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -3e+98], N[(wj * wj), $MachinePrecision], N[(x / N[(1.0 + N[(wj * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -3 \cdot 10^{+98}:\\
\;\;\;\;wj \cdot wj\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{1 + wj \cdot 2}\\
\end{array}
\end{array}
if wj < -3.0000000000000001e98Initial program 0.0%
sub-neg0.0%
div-sub0.0%
sub-neg0.0%
+-commutative0.0%
distribute-neg-in0.0%
remove-double-neg0.0%
sub-neg0.0%
div-sub0.0%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in x around 0 3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in wj around 0 42.0%
unpow242.0%
Simplified42.0%
if -3.0000000000000001e98 < wj Initial program 71.6%
sub-neg71.6%
div-sub71.6%
sub-neg71.6%
+-commutative71.6%
distribute-neg-in71.6%
remove-double-neg71.6%
sub-neg71.6%
div-sub71.6%
distribute-rgt1-in83.5%
associate-/l/83.4%
Simplified83.9%
Taylor expanded in x around inf 89.6%
Taylor expanded in wj around 0 77.1%
Final simplification68.5%
(FPCore (wj x) :precision binary64 (if (<= wj -215.0) (* wj wj) x))
double code(double wj, double x) {
double tmp;
if (wj <= -215.0) {
tmp = wj * wj;
} 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 (wj <= (-215.0d0)) then
tmp = wj * wj
else
tmp = x
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -215.0) {
tmp = wj * wj;
} else {
tmp = x;
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -215.0: tmp = wj * wj else: tmp = x return tmp
function code(wj, x) tmp = 0.0 if (wj <= -215.0) tmp = Float64(wj * wj); else tmp = x; end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -215.0) tmp = wj * wj; else tmp = x; end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -215.0], N[(wj * wj), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -215:\\
\;\;\;\;wj \cdot wj\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if wj < -215Initial program 0.0%
sub-neg0.0%
div-sub0.0%
sub-neg0.0%
+-commutative0.0%
distribute-neg-in0.0%
remove-double-neg0.0%
sub-neg0.0%
div-sub0.0%
distribute-rgt1-in100.0%
associate-/l/100.0%
Simplified100.0%
Taylor expanded in x around 0 3.0%
+-commutative3.0%
Simplified3.0%
Taylor expanded in wj around 0 31.2%
unpow231.2%
Simplified31.2%
if -215 < wj Initial program 81.3%
sub-neg81.3%
div-sub81.3%
sub-neg81.3%
+-commutative81.3%
distribute-neg-in81.3%
remove-double-neg81.3%
sub-neg81.3%
div-sub81.3%
distribute-rgt1-in81.3%
associate-/l/81.2%
Simplified81.8%
Taylor expanded in wj around 0 86.7%
Final simplification68.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 54.0%
sub-neg54.0%
div-sub54.0%
sub-neg54.0%
+-commutative54.0%
distribute-neg-in54.0%
remove-double-neg54.0%
sub-neg54.0%
div-sub54.0%
distribute-rgt1-in87.5%
associate-/l/87.5%
Simplified87.9%
Taylor expanded in wj around inf 3.7%
Final simplification3.7%
(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 54.0%
sub-neg54.0%
div-sub54.0%
sub-neg54.0%
+-commutative54.0%
distribute-neg-in54.0%
remove-double-neg54.0%
sub-neg54.0%
div-sub54.0%
distribute-rgt1-in87.5%
associate-/l/87.5%
Simplified87.9%
Taylor expanded in wj around 0 57.8%
Final simplification57.8%
(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 2023278
(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))))))