
(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 16 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 -4e-5)
(- wj (/ (- x (* wj (exp wj))) (* (exp wj) (- -1.0 wj))))
(if (<= wj 0.0017)
(+
x
(*
wj
(-
(*
x
(+ (/ (* wj (- 1.0 wj)) x) (* wj (+ 2.5 (* wj -2.6666666666666665)))))
(* x 2.0))))
(+ wj (/ wj (- -1.0 wj))))))
double code(double wj, double x) {
double tmp;
if (wj <= -4e-5) {
tmp = wj - ((x - (wj * exp(wj))) / (exp(wj) * (-1.0 - wj)));
} else if (wj <= 0.0017) {
tmp = x + (wj * ((x * (((wj * (1.0 - wj)) / x) + (wj * (2.5 + (wj * -2.6666666666666665))))) - (x * 2.0)));
} else {
tmp = wj + (wj / (-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 (wj <= (-4d-5)) then
tmp = wj - ((x - (wj * exp(wj))) / (exp(wj) * ((-1.0d0) - wj)))
else if (wj <= 0.0017d0) then
tmp = x + (wj * ((x * (((wj * (1.0d0 - wj)) / x) + (wj * (2.5d0 + (wj * (-2.6666666666666665d0)))))) - (x * 2.0d0)))
else
tmp = wj + (wj / ((-1.0d0) - wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -4e-5) {
tmp = wj - ((x - (wj * Math.exp(wj))) / (Math.exp(wj) * (-1.0 - wj)));
} else if (wj <= 0.0017) {
tmp = x + (wj * ((x * (((wj * (1.0 - wj)) / x) + (wj * (2.5 + (wj * -2.6666666666666665))))) - (x * 2.0)));
} else {
tmp = wj + (wj / (-1.0 - wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -4e-5: tmp = wj - ((x - (wj * math.exp(wj))) / (math.exp(wj) * (-1.0 - wj))) elif wj <= 0.0017: tmp = x + (wj * ((x * (((wj * (1.0 - wj)) / x) + (wj * (2.5 + (wj * -2.6666666666666665))))) - (x * 2.0))) else: tmp = wj + (wj / (-1.0 - wj)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -4e-5) tmp = Float64(wj - Float64(Float64(x - Float64(wj * exp(wj))) / Float64(exp(wj) * Float64(-1.0 - wj)))); elseif (wj <= 0.0017) tmp = Float64(x + Float64(wj * Float64(Float64(x * Float64(Float64(Float64(wj * Float64(1.0 - wj)) / x) + Float64(wj * Float64(2.5 + Float64(wj * -2.6666666666666665))))) - Float64(x * 2.0)))); else tmp = Float64(wj + Float64(wj / Float64(-1.0 - wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -4e-5) tmp = wj - ((x - (wj * exp(wj))) / (exp(wj) * (-1.0 - wj))); elseif (wj <= 0.0017) tmp = x + (wj * ((x * (((wj * (1.0 - wj)) / x) + (wj * (2.5 + (wj * -2.6666666666666665))))) - (x * 2.0))); else tmp = wj + (wj / (-1.0 - wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -4e-5], N[(wj - N[(N[(x - N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] * N[(-1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 0.0017], N[(x + N[(wj * N[(N[(x * N[(N[(N[(wj * N[(1.0 - wj), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(wj * N[(2.5 + N[(wj * -2.6666666666666665), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(wj / N[(-1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -4 \cdot 10^{-5}:\\
\;\;\;\;wj - \frac{x - wj \cdot e^{wj}}{e^{wj} \cdot \left(-1 - wj\right)}\\
\mathbf{elif}\;wj \leq 0.0017:\\
\;\;\;\;x + wj \cdot \left(x \cdot \left(\frac{wj \cdot \left(1 - wj\right)}{x} + wj \cdot \left(2.5 + wj \cdot -2.6666666666666665\right)\right) - x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{wj}{-1 - wj}\\
\end{array}
\end{array}
if wj < -4.00000000000000033e-5Initial program 60.4%
distribute-rgt1-in94.2%
*-commutative94.2%
Simplified94.2%
if -4.00000000000000033e-5 < wj < 0.00169999999999999991Initial program 75.2%
distribute-rgt1-in75.2%
*-commutative75.2%
associate-/r*75.2%
div-sub75.2%
associate-/l*75.2%
*-inverses75.2%
*-rgt-identity75.2%
Simplified75.2%
Taylor expanded in wj around 0 99.9%
Taylor expanded in x around inf 99.9%
if 0.00169999999999999991 < wj Initial program 20.0%
distribute-rgt1-in20.0%
*-commutative20.0%
associate-/r*20.0%
div-sub20.0%
associate-/l*20.0%
*-inverses100.0%
*-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
Simplified100.0%
Final simplification99.7%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (* wj (exp wj))))
(if (<= (+ wj (/ (- x t_0) (+ (exp wj) t_0))) 1e-11)
(+ x (* wj (- (* x (+ (* wj 2.5) (/ (* wj (- 1.0 wj)) x))) (* x 2.0))))
(*
x
(+ (exp (- (- (log1p wj)) wj)) (+ (/ wj x) (/ (/ wj x) (- -1.0 wj))))))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
double tmp;
if ((wj + ((x - t_0) / (exp(wj) + t_0))) <= 1e-11) {
tmp = x + (wj * ((x * ((wj * 2.5) + ((wj * (1.0 - wj)) / x))) - (x * 2.0)));
} else {
tmp = x * (exp((-log1p(wj) - wj)) + ((wj / x) + ((wj / x) / (-1.0 - wj))));
}
return tmp;
}
public static double code(double wj, double x) {
double t_0 = wj * Math.exp(wj);
double tmp;
if ((wj + ((x - t_0) / (Math.exp(wj) + t_0))) <= 1e-11) {
tmp = x + (wj * ((x * ((wj * 2.5) + ((wj * (1.0 - wj)) / x))) - (x * 2.0)));
} else {
tmp = x * (Math.exp((-Math.log1p(wj) - wj)) + ((wj / x) + ((wj / x) / (-1.0 - wj))));
}
return tmp;
}
def code(wj, x): t_0 = wj * math.exp(wj) tmp = 0 if (wj + ((x - t_0) / (math.exp(wj) + t_0))) <= 1e-11: tmp = x + (wj * ((x * ((wj * 2.5) + ((wj * (1.0 - wj)) / x))) - (x * 2.0))) else: tmp = x * (math.exp((-math.log1p(wj) - wj)) + ((wj / x) + ((wj / x) / (-1.0 - wj)))) return tmp
function code(wj, x) t_0 = Float64(wj * exp(wj)) tmp = 0.0 if (Float64(wj + Float64(Float64(x - t_0) / Float64(exp(wj) + t_0))) <= 1e-11) tmp = Float64(x + Float64(wj * Float64(Float64(x * Float64(Float64(wj * 2.5) + Float64(Float64(wj * Float64(1.0 - wj)) / x))) - Float64(x * 2.0)))); else tmp = Float64(x * Float64(exp(Float64(Float64(-log1p(wj)) - wj)) + Float64(Float64(wj / x) + Float64(Float64(wj / x) / Float64(-1.0 - wj))))); end return tmp end
code[wj_, x_] := Block[{t$95$0 = N[(wj * N[Exp[wj], $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[(wj * N[(N[(x * N[(N[(wj * 2.5), $MachinePrecision] + N[(N[(wj * N[(1.0 - wj), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[Exp[N[((-N[Log[1 + wj], $MachinePrecision]) - wj), $MachinePrecision]], $MachinePrecision] + N[(N[(wj / x), $MachinePrecision] + N[(N[(wj / x), $MachinePrecision] / N[(-1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := wj \cdot e^{wj}\\
\mathbf{if}\;wj + \frac{x - t\_0}{e^{wj} + t\_0} \leq 10^{-11}:\\
\;\;\;\;x + wj \cdot \left(x \cdot \left(wj \cdot 2.5 + \frac{wj \cdot \left(1 - wj\right)}{x}\right) - x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(e^{\left(-\mathsf{log1p}\left(wj\right)\right) - wj} + \left(\frac{wj}{x} + \frac{\frac{wj}{x}}{-1 - wj}\right)\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))))) < 9.99999999999999939e-12Initial program 66.8%
distribute-rgt1-in67.9%
*-commutative67.9%
associate-/r*67.9%
div-sub66.8%
associate-/l*66.8%
*-inverses67.9%
*-rgt-identity67.9%
Simplified67.9%
Taylor expanded in wj around 0 98.2%
Taylor expanded in x around inf 98.2%
Taylor expanded in wj around 0 98.2%
*-commutative98.2%
Simplified98.2%
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 93.4%
distribute-rgt1-in93.5%
*-commutative93.5%
associate-/r*93.4%
div-sub93.4%
associate-/l*93.4%
*-inverses99.3%
*-rgt-identity99.3%
Simplified99.3%
Taylor expanded in x around inf 99.3%
associate--l+99.3%
+-commutative99.3%
rem-exp-log99.3%
+-commutative99.3%
log1p-undefine99.3%
exp-sum99.3%
exp-neg99.3%
distribute-neg-in99.3%
unsub-neg99.3%
sub-neg99.3%
associate-/r*99.4%
+-commutative99.4%
distribute-neg-frac299.4%
distribute-neg-in99.4%
metadata-eval99.4%
+-commutative99.4%
unsub-neg99.4%
Simplified99.4%
Final simplification98.6%
(FPCore (wj x)
:precision binary64
(if (<= wj -4e-5)
(+ wj (/ (- wj (/ x (exp wj))) (- -1.0 wj)))
(if (<= wj 0.0118)
(+
x
(*
wj
(-
(*
x
(+ (/ (* wj (- 1.0 wj)) x) (* wj (+ 2.5 (* wj -2.6666666666666665)))))
(* x 2.0))))
(+ wj (/ wj (- -1.0 wj))))))
double code(double wj, double x) {
double tmp;
if (wj <= -4e-5) {
tmp = wj + ((wj - (x / exp(wj))) / (-1.0 - wj));
} else if (wj <= 0.0118) {
tmp = x + (wj * ((x * (((wj * (1.0 - wj)) / x) + (wj * (2.5 + (wj * -2.6666666666666665))))) - (x * 2.0)));
} else {
tmp = wj + (wj / (-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 (wj <= (-4d-5)) then
tmp = wj + ((wj - (x / exp(wj))) / ((-1.0d0) - wj))
else if (wj <= 0.0118d0) then
tmp = x + (wj * ((x * (((wj * (1.0d0 - wj)) / x) + (wj * (2.5d0 + (wj * (-2.6666666666666665d0)))))) - (x * 2.0d0)))
else
tmp = wj + (wj / ((-1.0d0) - wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -4e-5) {
tmp = wj + ((wj - (x / Math.exp(wj))) / (-1.0 - wj));
} else if (wj <= 0.0118) {
tmp = x + (wj * ((x * (((wj * (1.0 - wj)) / x) + (wj * (2.5 + (wj * -2.6666666666666665))))) - (x * 2.0)));
} else {
tmp = wj + (wj / (-1.0 - wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -4e-5: tmp = wj + ((wj - (x / math.exp(wj))) / (-1.0 - wj)) elif wj <= 0.0118: tmp = x + (wj * ((x * (((wj * (1.0 - wj)) / x) + (wj * (2.5 + (wj * -2.6666666666666665))))) - (x * 2.0))) else: tmp = wj + (wj / (-1.0 - wj)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -4e-5) tmp = Float64(wj + Float64(Float64(wj - Float64(x / exp(wj))) / Float64(-1.0 - wj))); elseif (wj <= 0.0118) tmp = Float64(x + Float64(wj * Float64(Float64(x * Float64(Float64(Float64(wj * Float64(1.0 - wj)) / x) + Float64(wj * Float64(2.5 + Float64(wj * -2.6666666666666665))))) - Float64(x * 2.0)))); else tmp = Float64(wj + Float64(wj / Float64(-1.0 - wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -4e-5) tmp = wj + ((wj - (x / exp(wj))) / (-1.0 - wj)); elseif (wj <= 0.0118) tmp = x + (wj * ((x * (((wj * (1.0 - wj)) / x) + (wj * (2.5 + (wj * -2.6666666666666665))))) - (x * 2.0))); else tmp = wj + (wj / (-1.0 - wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -4e-5], N[(wj + N[(N[(wj - N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 0.0118], N[(x + N[(wj * N[(N[(x * N[(N[(N[(wj * N[(1.0 - wj), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(wj * N[(2.5 + N[(wj * -2.6666666666666665), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(wj / N[(-1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -4 \cdot 10^{-5}:\\
\;\;\;\;wj + \frac{wj - \frac{x}{e^{wj}}}{-1 - wj}\\
\mathbf{elif}\;wj \leq 0.0118:\\
\;\;\;\;x + wj \cdot \left(x \cdot \left(\frac{wj \cdot \left(1 - wj\right)}{x} + wj \cdot \left(2.5 + wj \cdot -2.6666666666666665\right)\right) - x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{wj}{-1 - wj}\\
\end{array}
\end{array}
if wj < -4.00000000000000033e-5Initial program 60.4%
distribute-rgt1-in94.2%
*-commutative94.2%
associate-/r*94.2%
div-sub60.8%
associate-/l*60.4%
*-inverses93.7%
*-rgt-identity93.7%
Simplified93.7%
if -4.00000000000000033e-5 < wj < 0.0117999999999999997Initial program 75.2%
distribute-rgt1-in75.2%
*-commutative75.2%
associate-/r*75.2%
div-sub75.2%
associate-/l*75.2%
*-inverses75.2%
*-rgt-identity75.2%
Simplified75.2%
Taylor expanded in wj around 0 99.9%
Taylor expanded in x around inf 99.9%
if 0.0117999999999999997 < wj Initial program 20.0%
distribute-rgt1-in20.0%
*-commutative20.0%
associate-/r*20.0%
div-sub20.0%
associate-/l*20.0%
*-inverses100.0%
*-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
Simplified100.0%
Final simplification99.7%
(FPCore (wj x)
:precision binary64
(if (<= wj 0.31)
(+
x
(*
wj
(-
(*
x
(+ (/ (* wj (- 1.0 wj)) x) (* wj (+ 2.5 (* wj -2.6666666666666665)))))
(* x 2.0))))
(+ wj (/ wj (- -1.0 wj)))))
double code(double wj, double x) {
double tmp;
if (wj <= 0.31) {
tmp = x + (wj * ((x * (((wj * (1.0 - wj)) / x) + (wj * (2.5 + (wj * -2.6666666666666665))))) - (x * 2.0)));
} else {
tmp = wj + (wj / (-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 (wj <= 0.31d0) then
tmp = x + (wj * ((x * (((wj * (1.0d0 - wj)) / x) + (wj * (2.5d0 + (wj * (-2.6666666666666665d0)))))) - (x * 2.0d0)))
else
tmp = wj + (wj / ((-1.0d0) - wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 0.31) {
tmp = x + (wj * ((x * (((wj * (1.0 - wj)) / x) + (wj * (2.5 + (wj * -2.6666666666666665))))) - (x * 2.0)));
} else {
tmp = wj + (wj / (-1.0 - wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 0.31: tmp = x + (wj * ((x * (((wj * (1.0 - wj)) / x) + (wj * (2.5 + (wj * -2.6666666666666665))))) - (x * 2.0))) else: tmp = wj + (wj / (-1.0 - wj)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 0.31) tmp = Float64(x + Float64(wj * Float64(Float64(x * Float64(Float64(Float64(wj * Float64(1.0 - wj)) / x) + Float64(wj * Float64(2.5 + Float64(wj * -2.6666666666666665))))) - Float64(x * 2.0)))); else tmp = Float64(wj + Float64(wj / Float64(-1.0 - wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 0.31) tmp = x + (wj * ((x * (((wj * (1.0 - wj)) / x) + (wj * (2.5 + (wj * -2.6666666666666665))))) - (x * 2.0))); else tmp = wj + (wj / (-1.0 - wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 0.31], N[(x + N[(wj * N[(N[(x * N[(N[(N[(wj * N[(1.0 - wj), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(wj * N[(2.5 + N[(wj * -2.6666666666666665), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(wj / N[(-1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 0.31:\\
\;\;\;\;x + wj \cdot \left(x \cdot \left(\frac{wj \cdot \left(1 - wj\right)}{x} + wj \cdot \left(2.5 + wj \cdot -2.6666666666666665\right)\right) - x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{wj}{-1 - wj}\\
\end{array}
\end{array}
if wj < 0.309999999999999998Initial program 74.8%
distribute-rgt1-in75.6%
*-commutative75.6%
associate-/r*75.7%
div-sub74.9%
associate-/l*74.8%
*-inverses75.6%
*-rgt-identity75.6%
Simplified75.6%
Taylor expanded in wj around 0 98.0%
Taylor expanded in x around inf 98.1%
if 0.309999999999999998 < wj Initial program 20.0%
distribute-rgt1-in20.0%
*-commutative20.0%
associate-/r*20.0%
div-sub20.0%
associate-/l*20.0%
*-inverses100.0%
*-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
Simplified100.0%
Final simplification98.1%
(FPCore (wj x)
:precision binary64
(if (<= wj 0.0067)
(+
x
(*
wj
(-
(* wj (+ (* x (+ 2.5 (* wj -2.6666666666666665))) (- 1.0 wj)))
(* x 2.0))))
(+ wj (/ wj (- -1.0 wj)))))
double code(double wj, double x) {
double tmp;
if (wj <= 0.0067) {
tmp = x + (wj * ((wj * ((x * (2.5 + (wj * -2.6666666666666665))) + (1.0 - wj))) - (x * 2.0)));
} else {
tmp = wj + (wj / (-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 (wj <= 0.0067d0) then
tmp = x + (wj * ((wj * ((x * (2.5d0 + (wj * (-2.6666666666666665d0)))) + (1.0d0 - wj))) - (x * 2.0d0)))
else
tmp = wj + (wj / ((-1.0d0) - wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 0.0067) {
tmp = x + (wj * ((wj * ((x * (2.5 + (wj * -2.6666666666666665))) + (1.0 - wj))) - (x * 2.0)));
} else {
tmp = wj + (wj / (-1.0 - wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 0.0067: tmp = x + (wj * ((wj * ((x * (2.5 + (wj * -2.6666666666666665))) + (1.0 - wj))) - (x * 2.0))) else: tmp = wj + (wj / (-1.0 - wj)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 0.0067) tmp = Float64(x + Float64(wj * Float64(Float64(wj * Float64(Float64(x * Float64(2.5 + Float64(wj * -2.6666666666666665))) + Float64(1.0 - wj))) - Float64(x * 2.0)))); else tmp = Float64(wj + Float64(wj / Float64(-1.0 - wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 0.0067) tmp = x + (wj * ((wj * ((x * (2.5 + (wj * -2.6666666666666665))) + (1.0 - wj))) - (x * 2.0))); else tmp = wj + (wj / (-1.0 - wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 0.0067], N[(x + N[(wj * N[(N[(wj * N[(N[(x * N[(2.5 + N[(wj * -2.6666666666666665), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(wj / N[(-1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 0.0067:\\
\;\;\;\;x + wj \cdot \left(wj \cdot \left(x \cdot \left(2.5 + wj \cdot -2.6666666666666665\right) + \left(1 - wj\right)\right) - x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{wj}{-1 - wj}\\
\end{array}
\end{array}
if wj < 0.00670000000000000023Initial program 74.8%
distribute-rgt1-in75.6%
*-commutative75.6%
associate-/r*75.7%
div-sub74.9%
associate-/l*74.8%
*-inverses75.6%
*-rgt-identity75.6%
Simplified75.6%
Taylor expanded in wj around 0 98.0%
Taylor expanded in x around 0 98.0%
distribute-lft-out98.0%
+-commutative98.0%
*-commutative98.0%
mul-1-neg98.0%
sub-neg98.0%
Simplified98.0%
if 0.00670000000000000023 < wj Initial program 20.0%
distribute-rgt1-in20.0%
*-commutative20.0%
associate-/r*20.0%
div-sub20.0%
associate-/l*20.0%
*-inverses100.0%
*-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
Simplified100.0%
Final simplification98.1%
(FPCore (wj x) :precision binary64 (if (<= wj 0.016) (+ x (* wj (- (* wj (- 1.0 wj)) (* x 2.0)))) (+ wj (/ wj (- -1.0 wj)))))
double code(double wj, double x) {
double tmp;
if (wj <= 0.016) {
tmp = x + (wj * ((wj * (1.0 - wj)) - (x * 2.0)));
} else {
tmp = wj + (wj / (-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 (wj <= 0.016d0) then
tmp = x + (wj * ((wj * (1.0d0 - wj)) - (x * 2.0d0)))
else
tmp = wj + (wj / ((-1.0d0) - wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 0.016) {
tmp = x + (wj * ((wj * (1.0 - wj)) - (x * 2.0)));
} else {
tmp = wj + (wj / (-1.0 - wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 0.016: tmp = x + (wj * ((wj * (1.0 - wj)) - (x * 2.0))) else: tmp = wj + (wj / (-1.0 - wj)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 0.016) tmp = Float64(x + Float64(wj * Float64(Float64(wj * Float64(1.0 - wj)) - Float64(x * 2.0)))); else tmp = Float64(wj + Float64(wj / Float64(-1.0 - wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 0.016) tmp = x + (wj * ((wj * (1.0 - wj)) - (x * 2.0))); else tmp = wj + (wj / (-1.0 - wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 0.016], N[(x + N[(wj * N[(N[(wj * N[(1.0 - wj), $MachinePrecision]), $MachinePrecision] - N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(wj / N[(-1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 0.016:\\
\;\;\;\;x + wj \cdot \left(wj \cdot \left(1 - wj\right) - x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{wj}{-1 - wj}\\
\end{array}
\end{array}
if wj < 0.016Initial program 74.8%
distribute-rgt1-in75.6%
*-commutative75.6%
associate-/r*75.7%
div-sub74.9%
associate-/l*74.8%
*-inverses75.6%
*-rgt-identity75.6%
Simplified75.6%
Taylor expanded in wj around 0 98.0%
Taylor expanded in x around 0 98.0%
distribute-lft-out98.0%
+-commutative98.0%
*-commutative98.0%
mul-1-neg98.0%
sub-neg98.0%
Simplified98.0%
Taylor expanded in x around 0 97.8%
if 0.016 < wj Initial program 20.0%
distribute-rgt1-in20.0%
*-commutative20.0%
associate-/r*20.0%
div-sub20.0%
associate-/l*20.0%
*-inverses100.0%
*-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
Simplified100.0%
Final simplification97.8%
(FPCore (wj x) :precision binary64 (if (<= wj 0.00068) (+ x (* wj (+ wj (* x (- (* wj 2.5) 2.0))))) (+ wj (/ wj (- -1.0 wj)))))
double code(double wj, double x) {
double tmp;
if (wj <= 0.00068) {
tmp = x + (wj * (wj + (x * ((wj * 2.5) - 2.0))));
} else {
tmp = wj + (wj / (-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 (wj <= 0.00068d0) then
tmp = x + (wj * (wj + (x * ((wj * 2.5d0) - 2.0d0))))
else
tmp = wj + (wj / ((-1.0d0) - wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 0.00068) {
tmp = x + (wj * (wj + (x * ((wj * 2.5) - 2.0))));
} else {
tmp = wj + (wj / (-1.0 - wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 0.00068: tmp = x + (wj * (wj + (x * ((wj * 2.5) - 2.0)))) else: tmp = wj + (wj / (-1.0 - wj)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 0.00068) tmp = Float64(x + Float64(wj * Float64(wj + Float64(x * Float64(Float64(wj * 2.5) - 2.0))))); else tmp = Float64(wj + Float64(wj / Float64(-1.0 - wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 0.00068) tmp = x + (wj * (wj + (x * ((wj * 2.5) - 2.0)))); else tmp = wj + (wj / (-1.0 - wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 0.00068], N[(x + N[(wj * N[(wj + N[(x * N[(N[(wj * 2.5), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(wj / N[(-1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 0.00068:\\
\;\;\;\;x + wj \cdot \left(wj + x \cdot \left(wj \cdot 2.5 - 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{wj}{-1 - wj}\\
\end{array}
\end{array}
if wj < 6.8e-4Initial program 74.8%
distribute-rgt1-in75.6%
*-commutative75.6%
associate-/r*75.7%
div-sub74.9%
associate-/l*74.8%
*-inverses75.6%
*-rgt-identity75.6%
Simplified75.6%
Taylor expanded in wj around 0 96.9%
cancel-sign-sub-inv96.9%
metadata-eval96.9%
distribute-rgt-out96.9%
metadata-eval96.9%
*-commutative96.9%
Simplified96.9%
Taylor expanded in x around 0 96.9%
if 6.8e-4 < wj Initial program 20.0%
distribute-rgt1-in20.0%
*-commutative20.0%
associate-/r*20.0%
div-sub20.0%
associate-/l*20.0%
*-inverses100.0%
*-rgt-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
Simplified100.0%
Final simplification96.9%
(FPCore (wj x) :precision binary64 (if (<= wj 6.5e-10) (+ x (* wj (* x (- (* wj 2.5) 2.0)))) (+ wj (/ wj (- -1.0 wj)))))
double code(double wj, double x) {
double tmp;
if (wj <= 6.5e-10) {
tmp = x + (wj * (x * ((wj * 2.5) - 2.0)));
} else {
tmp = wj + (wj / (-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 (wj <= 6.5d-10) then
tmp = x + (wj * (x * ((wj * 2.5d0) - 2.0d0)))
else
tmp = wj + (wj / ((-1.0d0) - wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 6.5e-10) {
tmp = x + (wj * (x * ((wj * 2.5) - 2.0)));
} else {
tmp = wj + (wj / (-1.0 - wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 6.5e-10: tmp = x + (wj * (x * ((wj * 2.5) - 2.0))) else: tmp = wj + (wj / (-1.0 - wj)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 6.5e-10) tmp = Float64(x + Float64(wj * Float64(x * Float64(Float64(wj * 2.5) - 2.0)))); else tmp = Float64(wj + Float64(wj / Float64(-1.0 - wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 6.5e-10) tmp = x + (wj * (x * ((wj * 2.5) - 2.0))); else tmp = wj + (wj / (-1.0 - wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 6.5e-10], N[(x + N[(wj * N[(x * N[(N[(wj * 2.5), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(wj / N[(-1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 6.5 \cdot 10^{-10}:\\
\;\;\;\;x + wj \cdot \left(x \cdot \left(wj \cdot 2.5 - 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{wj}{-1 - wj}\\
\end{array}
\end{array}
if wj < 6.5000000000000003e-10Initial program 74.9%
distribute-rgt1-in75.7%
*-commutative75.7%
associate-/r*75.7%
div-sub74.9%
associate-/l*74.9%
*-inverses75.7%
*-rgt-identity75.7%
Simplified75.7%
Taylor expanded in wj around 0 97.0%
cancel-sign-sub-inv97.0%
metadata-eval97.0%
distribute-rgt-out97.0%
metadata-eval97.0%
*-commutative97.0%
Simplified97.0%
Taylor expanded in x around inf 85.5%
if 6.5000000000000003e-10 < wj Initial program 25.8%
distribute-rgt1-in25.8%
*-commutative25.8%
associate-/r*25.8%
div-sub25.8%
associate-/l*25.8%
*-inverses92.5%
*-rgt-identity92.5%
Simplified92.5%
Taylor expanded in x around 0 92.5%
+-commutative92.5%
Simplified92.5%
Final simplification85.7%
(FPCore (wj x) :precision binary64 (if (<= wj 2.4e-10) (* x (- 1.0 (* wj (- 2.0 (* wj 2.5))))) (+ wj (/ wj (- -1.0 wj)))))
double code(double wj, double x) {
double tmp;
if (wj <= 2.4e-10) {
tmp = x * (1.0 - (wj * (2.0 - (wj * 2.5))));
} else {
tmp = wj + (wj / (-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 (wj <= 2.4d-10) then
tmp = x * (1.0d0 - (wj * (2.0d0 - (wj * 2.5d0))))
else
tmp = wj + (wj / ((-1.0d0) - wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 2.4e-10) {
tmp = x * (1.0 - (wj * (2.0 - (wj * 2.5))));
} else {
tmp = wj + (wj / (-1.0 - wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 2.4e-10: tmp = x * (1.0 - (wj * (2.0 - (wj * 2.5)))) else: tmp = wj + (wj / (-1.0 - wj)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 2.4e-10) tmp = Float64(x * Float64(1.0 - Float64(wj * Float64(2.0 - Float64(wj * 2.5))))); else tmp = Float64(wj + Float64(wj / Float64(-1.0 - wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 2.4e-10) tmp = x * (1.0 - (wj * (2.0 - (wj * 2.5)))); else tmp = wj + (wj / (-1.0 - wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 2.4e-10], N[(x * N[(1.0 - N[(wj * N[(2.0 - N[(wj * 2.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(wj / N[(-1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 2.4 \cdot 10^{-10}:\\
\;\;\;\;x \cdot \left(1 - wj \cdot \left(2 - wj \cdot 2.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{wj}{-1 - wj}\\
\end{array}
\end{array}
if wj < 2.4e-10Initial program 74.9%
distribute-rgt1-in75.7%
*-commutative75.7%
associate-/r*75.7%
div-sub74.9%
associate-/l*74.9%
*-inverses75.7%
*-rgt-identity75.7%
Simplified75.7%
Taylor expanded in wj around 0 97.0%
cancel-sign-sub-inv97.0%
metadata-eval97.0%
distribute-rgt-out97.0%
metadata-eval97.0%
*-commutative97.0%
Simplified97.0%
Taylor expanded in x around inf 85.5%
Taylor expanded in x around 0 85.5%
if 2.4e-10 < wj Initial program 25.8%
distribute-rgt1-in25.8%
*-commutative25.8%
associate-/r*25.8%
div-sub25.8%
associate-/l*25.8%
*-inverses92.5%
*-rgt-identity92.5%
Simplified92.5%
Taylor expanded in x around 0 92.5%
+-commutative92.5%
Simplified92.5%
Final simplification85.7%
(FPCore (wj x) :precision binary64 (if (<= wj 1.38e-11) (/ (- x (* wj x)) (+ wj 1.0)) (+ wj (/ wj (- -1.0 wj)))))
double code(double wj, double x) {
double tmp;
if (wj <= 1.38e-11) {
tmp = (x - (wj * x)) / (wj + 1.0);
} else {
tmp = wj + (wj / (-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 (wj <= 1.38d-11) then
tmp = (x - (wj * x)) / (wj + 1.0d0)
else
tmp = wj + (wj / ((-1.0d0) - wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 1.38e-11) {
tmp = (x - (wj * x)) / (wj + 1.0);
} else {
tmp = wj + (wj / (-1.0 - wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 1.38e-11: tmp = (x - (wj * x)) / (wj + 1.0) else: tmp = wj + (wj / (-1.0 - wj)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 1.38e-11) tmp = Float64(Float64(x - Float64(wj * x)) / Float64(wj + 1.0)); else tmp = Float64(wj + Float64(wj / Float64(-1.0 - wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 1.38e-11) tmp = (x - (wj * x)) / (wj + 1.0); else tmp = wj + (wj / (-1.0 - wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 1.38e-11], N[(N[(x - N[(wj * x), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision], N[(wj + N[(wj / N[(-1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 1.38 \cdot 10^{-11}:\\
\;\;\;\;\frac{x - wj \cdot x}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{wj}{-1 - wj}\\
\end{array}
\end{array}
if wj < 1.38e-11Initial program 74.9%
distribute-rgt1-in75.7%
*-commutative75.7%
associate-/r*75.7%
div-sub74.9%
associate-/l*74.9%
*-inverses75.7%
*-rgt-identity75.7%
Simplified75.7%
Taylor expanded in x around inf 86.8%
associate-/r*86.8%
+-commutative86.8%
Simplified86.8%
Taylor expanded in wj around 0 85.4%
mul-1-neg85.4%
unsub-neg85.4%
*-commutative85.4%
Simplified85.4%
if 1.38e-11 < wj Initial program 25.8%
distribute-rgt1-in25.8%
*-commutative25.8%
associate-/r*25.8%
div-sub25.8%
associate-/l*25.8%
*-inverses92.5%
*-rgt-identity92.5%
Simplified92.5%
Taylor expanded in x around 0 92.5%
+-commutative92.5%
Simplified92.5%
Final simplification85.6%
(FPCore (wj x) :precision binary64 (if (<= wj 5.8e-10) (/ (* x (- 1.0 wj)) (+ wj 1.0)) (+ wj (/ wj (- -1.0 wj)))))
double code(double wj, double x) {
double tmp;
if (wj <= 5.8e-10) {
tmp = (x * (1.0 - wj)) / (wj + 1.0);
} else {
tmp = wj + (wj / (-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 (wj <= 5.8d-10) then
tmp = (x * (1.0d0 - wj)) / (wj + 1.0d0)
else
tmp = wj + (wj / ((-1.0d0) - wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 5.8e-10) {
tmp = (x * (1.0 - wj)) / (wj + 1.0);
} else {
tmp = wj + (wj / (-1.0 - wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 5.8e-10: tmp = (x * (1.0 - wj)) / (wj + 1.0) else: tmp = wj + (wj / (-1.0 - wj)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 5.8e-10) tmp = Float64(Float64(x * Float64(1.0 - wj)) / Float64(wj + 1.0)); else tmp = Float64(wj + Float64(wj / Float64(-1.0 - wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 5.8e-10) tmp = (x * (1.0 - wj)) / (wj + 1.0); else tmp = wj + (wj / (-1.0 - wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 5.8e-10], N[(N[(x * N[(1.0 - wj), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision], N[(wj + N[(wj / N[(-1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 5.8 \cdot 10^{-10}:\\
\;\;\;\;\frac{x \cdot \left(1 - wj\right)}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{wj}{-1 - wj}\\
\end{array}
\end{array}
if wj < 5.79999999999999962e-10Initial program 74.9%
distribute-rgt1-in75.7%
*-commutative75.7%
associate-/r*75.7%
div-sub74.9%
associate-/l*74.9%
*-inverses75.7%
*-rgt-identity75.7%
Simplified75.7%
Taylor expanded in x around inf 86.8%
associate-/r*86.8%
+-commutative86.8%
Simplified86.8%
Taylor expanded in wj around 0 85.6%
*-commutative85.6%
Simplified85.6%
Taylor expanded in wj around 0 85.4%
associate-*r*85.4%
neg-mul-185.4%
distribute-rgt1-in85.4%
+-commutative85.4%
sub-neg85.4%
Simplified85.4%
if 5.79999999999999962e-10 < wj Initial program 25.8%
distribute-rgt1-in25.8%
*-commutative25.8%
associate-/r*25.8%
div-sub25.8%
associate-/l*25.8%
*-inverses92.5%
*-rgt-identity92.5%
Simplified92.5%
Taylor expanded in x around 0 92.5%
+-commutative92.5%
Simplified92.5%
Final simplification85.6%
(FPCore (wj x) :precision binary64 (if (<= wj 5.8e-10) (+ x (* (* wj x) -2.0)) (+ wj (/ wj (- -1.0 wj)))))
double code(double wj, double x) {
double tmp;
if (wj <= 5.8e-10) {
tmp = x + ((wj * x) * -2.0);
} else {
tmp = wj + (wj / (-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 (wj <= 5.8d-10) then
tmp = x + ((wj * x) * (-2.0d0))
else
tmp = wj + (wj / ((-1.0d0) - wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 5.8e-10) {
tmp = x + ((wj * x) * -2.0);
} else {
tmp = wj + (wj / (-1.0 - wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 5.8e-10: tmp = x + ((wj * x) * -2.0) else: tmp = wj + (wj / (-1.0 - wj)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 5.8e-10) tmp = Float64(x + Float64(Float64(wj * x) * -2.0)); else tmp = Float64(wj + Float64(wj / Float64(-1.0 - wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 5.8e-10) tmp = x + ((wj * x) * -2.0); else tmp = wj + (wj / (-1.0 - wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 5.8e-10], N[(x + N[(N[(wj * x), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision], N[(wj + N[(wj / N[(-1.0 - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq 5.8 \cdot 10^{-10}:\\
\;\;\;\;x + \left(wj \cdot x\right) \cdot -2\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{wj}{-1 - wj}\\
\end{array}
\end{array}
if wj < 5.79999999999999962e-10Initial program 74.9%
distribute-rgt1-in75.7%
*-commutative75.7%
associate-/r*75.7%
div-sub74.9%
associate-/l*74.9%
*-inverses75.7%
*-rgt-identity75.7%
Simplified75.7%
Taylor expanded in wj around 0 85.3%
*-commutative85.3%
Simplified85.3%
if 5.79999999999999962e-10 < wj Initial program 25.8%
distribute-rgt1-in25.8%
*-commutative25.8%
associate-/r*25.8%
div-sub25.8%
associate-/l*25.8%
*-inverses92.5%
*-rgt-identity92.5%
Simplified92.5%
Taylor expanded in x around 0 92.5%
+-commutative92.5%
Simplified92.5%
Final simplification85.5%
(FPCore (wj x) :precision binary64 (+ x (* (* wj x) -2.0)))
double code(double wj, double x) {
return x + ((wj * x) * -2.0);
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = x + ((wj * x) * (-2.0d0))
end function
public static double code(double wj, double x) {
return x + ((wj * x) * -2.0);
}
def code(wj, x): return x + ((wj * x) * -2.0)
function code(wj, x) return Float64(x + Float64(Float64(wj * x) * -2.0)) end
function tmp = code(wj, x) tmp = x + ((wj * x) * -2.0); end
code[wj_, x_] := N[(x + N[(N[(wj * x), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(wj \cdot x\right) \cdot -2
\end{array}
Initial program 73.8%
distribute-rgt1-in74.6%
*-commutative74.6%
associate-/r*74.6%
div-sub73.8%
associate-/l*73.8%
*-inverses76.1%
*-rgt-identity76.1%
Simplified76.1%
Taylor expanded in wj around 0 83.4%
*-commutative83.4%
Simplified83.4%
Final simplification83.4%
(FPCore (wj x) :precision binary64 x)
double code(double wj, double x) {
return x;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = x
end function
public static double code(double wj, double x) {
return x;
}
def code(wj, x): return x
function code(wj, x) return x end
function tmp = code(wj, x) tmp = x; end
code[wj_, x_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 73.8%
distribute-rgt1-in74.6%
*-commutative74.6%
associate-/r*74.6%
div-sub73.8%
associate-/l*73.8%
*-inverses76.1%
*-rgt-identity76.1%
Simplified76.1%
Taylor expanded in wj around 0 82.8%
(FPCore (wj x) :precision binary64 wj)
double code(double wj, double x) {
return wj;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = wj
end function
public static double code(double wj, double x) {
return wj;
}
def code(wj, x): return wj
function code(wj, x) return wj end
function tmp = code(wj, x) tmp = wj; end
code[wj_, x_] := wj
\begin{array}{l}
\\
wj
\end{array}
Initial program 73.8%
distribute-rgt1-in74.6%
*-commutative74.6%
associate-/r*74.6%
div-sub73.8%
associate-/l*73.8%
*-inverses76.1%
*-rgt-identity76.1%
Simplified76.1%
Taylor expanded in wj around inf 4.5%
(FPCore (wj x) :precision binary64 -1.0)
double code(double wj, double x) {
return -1.0;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = -1.0d0
end function
public static double code(double wj, double x) {
return -1.0;
}
def code(wj, x): return -1.0
function code(wj, x) return -1.0 end
function tmp = code(wj, x) tmp = -1.0; end
code[wj_, x_] := -1.0
\begin{array}{l}
\\
-1
\end{array}
Initial program 73.8%
distribute-rgt1-in74.6%
*-commutative74.6%
associate-/r*74.6%
div-sub73.8%
associate-/l*73.8%
*-inverses76.1%
*-rgt-identity76.1%
Simplified76.1%
Taylor expanded in wj around inf 4.5%
Taylor expanded in wj around 0 3.3%
(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 2024139
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:precision binary64
:alt
(! :herbie-platform default (let ((ew (exp wj))) (- wj (- (/ wj (+ wj 1)) (/ x (+ ew (* wj ew)))))))
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))