
(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 12 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-8)
(- wj (/ (- (* wj (exp wj)) x) (* (exp wj) (+ wj 1.0))))
(if (<= wj 4.5e-7)
(+ x (- (fma wj wj (- (pow wj 3.0))) (* wj (+ x x))))
(+ wj (* (/ 1.0 (+ wj 1.0)) (- (/ x (exp wj)) wj))))))
double code(double wj, double x) {
double tmp;
if (wj <= -4e-8) {
tmp = wj - (((wj * exp(wj)) - x) / (exp(wj) * (wj + 1.0)));
} else if (wj <= 4.5e-7) {
tmp = x + (fma(wj, wj, -pow(wj, 3.0)) - (wj * (x + x)));
} else {
tmp = wj + ((1.0 / (wj + 1.0)) * ((x / exp(wj)) - wj));
}
return tmp;
}
function code(wj, x) tmp = 0.0 if (wj <= -4e-8) tmp = Float64(wj - Float64(Float64(Float64(wj * exp(wj)) - x) / Float64(exp(wj) * Float64(wj + 1.0)))); elseif (wj <= 4.5e-7) tmp = Float64(x + Float64(fma(wj, wj, Float64(-(wj ^ 3.0))) - Float64(wj * Float64(x + x)))); else tmp = Float64(wj + Float64(Float64(1.0 / Float64(wj + 1.0)) * Float64(Float64(x / exp(wj)) - wj))); end return tmp end
code[wj_, x_] := If[LessEqual[wj, -4e-8], N[(wj - N[(N[(N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] * N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 4.5e-7], N[(x + N[(N[(wj * wj + (-N[Power[wj, 3.0], $MachinePrecision])), $MachinePrecision] - N[(wj * N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(N[(1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -4 \cdot 10^{-8}:\\
\;\;\;\;wj - \frac{wj \cdot e^{wj} - x}{e^{wj} \cdot \left(wj + 1\right)}\\
\mathbf{elif}\;wj \leq 4.5 \cdot 10^{-7}:\\
\;\;\;\;x + \left(\mathsf{fma}\left(wj, wj, -{wj}^{3}\right) - wj \cdot \left(x + x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{1}{wj + 1} \cdot \left(\frac{x}{e^{wj}} - wj\right)\\
\end{array}
\end{array}
if wj < -4.0000000000000001e-8Initial program 74.3%
distribute-rgt1-in99.3%
Simplified99.3%
if -4.0000000000000001e-8 < wj < 4.4999999999999998e-7Initial program 79.9%
div-sub79.9%
associate-/l*80.0%
distribute-rgt1-in80.0%
associate-/l*80.0%
*-inverses80.0%
/-rgt-identity80.0%
distribute-rgt1-in80.0%
associate-/l/79.9%
div-sub79.9%
Simplified79.9%
Taylor expanded in wj around 0 79.9%
associate-*r*79.9%
neg-mul-179.9%
distribute-rgt1-in79.9%
+-commutative79.9%
sub-neg79.9%
Simplified79.9%
Taylor expanded in wj around 0 100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
unpow2100.0%
Simplified100.0%
fma-neg100.0%
Applied egg-rr100.0%
if 4.4999999999999998e-7 < wj Initial program 56.9%
div-sub56.9%
associate-/l*56.9%
distribute-rgt1-in56.9%
associate-/l*56.9%
*-inverses99.8%
/-rgt-identity99.8%
distribute-rgt1-in99.8%
associate-/l/99.8%
div-sub99.8%
Simplified99.8%
clear-num99.8%
associate-/r/100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (* wj (exp wj))))
(if (<= (+ wj (/ (- x t_0) (+ (exp wj) t_0))) 1e-15)
(+
x
(-
(+ (* (pow wj 2.0) (+ x (- x -1.0))) (* (pow wj 3.0) (- (- -1.0 x) x)))
(* wj (+ x x))))
(+ wj (* (/ 1.0 (+ wj 1.0)) (- (/ x (exp wj)) 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-15) {
tmp = x + (((pow(wj, 2.0) * (x + (x - -1.0))) + (pow(wj, 3.0) * ((-1.0 - x) - x))) - (wj * (x + x)));
} else {
tmp = wj + ((1.0 / (wj + 1.0)) * ((x / exp(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 * exp(wj)
if ((wj + ((x - t_0) / (exp(wj) + t_0))) <= 1d-15) then
tmp = x + ((((wj ** 2.0d0) * (x + (x - (-1.0d0)))) + ((wj ** 3.0d0) * (((-1.0d0) - x) - x))) - (wj * (x + x)))
else
tmp = wj + ((1.0d0 / (wj + 1.0d0)) * ((x / exp(wj)) - wj))
end if
code = tmp
end function
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-15) {
tmp = x + (((Math.pow(wj, 2.0) * (x + (x - -1.0))) + (Math.pow(wj, 3.0) * ((-1.0 - x) - x))) - (wj * (x + x)));
} else {
tmp = wj + ((1.0 / (wj + 1.0)) * ((x / Math.exp(wj)) - 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-15: tmp = x + (((math.pow(wj, 2.0) * (x + (x - -1.0))) + (math.pow(wj, 3.0) * ((-1.0 - x) - x))) - (wj * (x + x))) else: tmp = wj + ((1.0 / (wj + 1.0)) * ((x / math.exp(wj)) - 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-15) tmp = Float64(x + Float64(Float64(Float64((wj ^ 2.0) * Float64(x + Float64(x - -1.0))) + Float64((wj ^ 3.0) * Float64(Float64(-1.0 - x) - x))) - Float64(wj * Float64(x + x)))); else tmp = Float64(wj + Float64(Float64(1.0 / Float64(wj + 1.0)) * Float64(Float64(x / exp(wj)) - wj))); end return tmp end
function tmp_2 = code(wj, x) t_0 = wj * exp(wj); tmp = 0.0; if ((wj + ((x - t_0) / (exp(wj) + t_0))) <= 1e-15) tmp = x + ((((wj ^ 2.0) * (x + (x - -1.0))) + ((wj ^ 3.0) * ((-1.0 - x) - x))) - (wj * (x + x))); else tmp = wj + ((1.0 / (wj + 1.0)) * ((x / exp(wj)) - wj)); end tmp_2 = 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-15], N[(x + N[(N[(N[(N[Power[wj, 2.0], $MachinePrecision] * N[(x + N[(x - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[wj, 3.0], $MachinePrecision] * N[(N[(-1.0 - x), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(wj * N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(N[(1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $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^{-15}:\\
\;\;\;\;x + \left(\left({wj}^{2} \cdot \left(x + \left(x - -1\right)\right) + {wj}^{3} \cdot \left(\left(-1 - x\right) - x\right)\right) - wj \cdot \left(x + x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{1}{wj + 1} \cdot \left(\frac{x}{e^{wj}} - wj\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))))) < 1.0000000000000001e-15Initial program 74.0%
div-sub74.0%
associate-/l*74.0%
distribute-rgt1-in74.0%
associate-/l*74.0%
*-inverses74.0%
/-rgt-identity74.0%
distribute-rgt1-in74.0%
associate-/l/74.0%
div-sub74.0%
Simplified74.0%
Taylor expanded in wj around 0 72.7%
associate-*r*72.7%
neg-mul-172.7%
distribute-rgt1-in72.7%
+-commutative72.7%
sub-neg72.7%
Simplified72.7%
Taylor expanded in wj around 0 98.0%
if 1.0000000000000001e-15 < (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) Initial program 92.8%
div-sub92.8%
associate-/l*92.8%
distribute-rgt1-in92.8%
associate-/l*92.8%
*-inverses97.1%
/-rgt-identity97.1%
distribute-rgt1-in99.9%
associate-/l/99.9%
div-sub99.9%
Simplified99.9%
clear-num99.7%
associate-/r/99.9%
Applied egg-rr99.9%
Final simplification98.5%
(FPCore (wj x)
:precision binary64
(if (<= wj -4e-8)
(- wj (/ (- (* wj (exp wj)) x) (* (exp wj) (+ wj 1.0))))
(if (<= wj 3.75e-7)
(+ x (- (- (* wj wj) (pow wj 3.0)) (* wj (+ x x))))
(+ wj (* (/ 1.0 (+ wj 1.0)) (- (/ x (exp wj)) wj))))))
double code(double wj, double x) {
double tmp;
if (wj <= -4e-8) {
tmp = wj - (((wj * exp(wj)) - x) / (exp(wj) * (wj + 1.0)));
} else if (wj <= 3.75e-7) {
tmp = x + (((wj * wj) - pow(wj, 3.0)) - (wj * (x + x)));
} else {
tmp = wj + ((1.0 / (wj + 1.0)) * ((x / exp(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 <= (-4d-8)) then
tmp = wj - (((wj * exp(wj)) - x) / (exp(wj) * (wj + 1.0d0)))
else if (wj <= 3.75d-7) then
tmp = x + (((wj * wj) - (wj ** 3.0d0)) - (wj * (x + x)))
else
tmp = wj + ((1.0d0 / (wj + 1.0d0)) * ((x / exp(wj)) - wj))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -4e-8) {
tmp = wj - (((wj * Math.exp(wj)) - x) / (Math.exp(wj) * (wj + 1.0)));
} else if (wj <= 3.75e-7) {
tmp = x + (((wj * wj) - Math.pow(wj, 3.0)) - (wj * (x + x)));
} else {
tmp = wj + ((1.0 / (wj + 1.0)) * ((x / Math.exp(wj)) - wj));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -4e-8: tmp = wj - (((wj * math.exp(wj)) - x) / (math.exp(wj) * (wj + 1.0))) elif wj <= 3.75e-7: tmp = x + (((wj * wj) - math.pow(wj, 3.0)) - (wj * (x + x))) else: tmp = wj + ((1.0 / (wj + 1.0)) * ((x / math.exp(wj)) - wj)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -4e-8) tmp = Float64(wj - Float64(Float64(Float64(wj * exp(wj)) - x) / Float64(exp(wj) * Float64(wj + 1.0)))); elseif (wj <= 3.75e-7) tmp = Float64(x + Float64(Float64(Float64(wj * wj) - (wj ^ 3.0)) - Float64(wj * Float64(x + x)))); else tmp = Float64(wj + Float64(Float64(1.0 / Float64(wj + 1.0)) * Float64(Float64(x / exp(wj)) - wj))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -4e-8) tmp = wj - (((wj * exp(wj)) - x) / (exp(wj) * (wj + 1.0))); elseif (wj <= 3.75e-7) tmp = x + (((wj * wj) - (wj ^ 3.0)) - (wj * (x + x))); else tmp = wj + ((1.0 / (wj + 1.0)) * ((x / exp(wj)) - wj)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -4e-8], N[(wj - N[(N[(N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] * N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 3.75e-7], N[(x + N[(N[(N[(wj * wj), $MachinePrecision] - N[Power[wj, 3.0], $MachinePrecision]), $MachinePrecision] - N[(wj * N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(N[(1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -4 \cdot 10^{-8}:\\
\;\;\;\;wj - \frac{wj \cdot e^{wj} - x}{e^{wj} \cdot \left(wj + 1\right)}\\
\mathbf{elif}\;wj \leq 3.75 \cdot 10^{-7}:\\
\;\;\;\;x + \left(\left(wj \cdot wj - {wj}^{3}\right) - wj \cdot \left(x + x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{1}{wj + 1} \cdot \left(\frac{x}{e^{wj}} - wj\right)\\
\end{array}
\end{array}
if wj < -4.0000000000000001e-8Initial program 74.3%
distribute-rgt1-in99.3%
Simplified99.3%
if -4.0000000000000001e-8 < wj < 3.7500000000000001e-7Initial program 79.9%
div-sub79.9%
associate-/l*80.0%
distribute-rgt1-in80.0%
associate-/l*80.0%
*-inverses80.0%
/-rgt-identity80.0%
distribute-rgt1-in80.0%
associate-/l/79.9%
div-sub79.9%
Simplified79.9%
Taylor expanded in wj around 0 79.9%
associate-*r*79.9%
neg-mul-179.9%
distribute-rgt1-in79.9%
+-commutative79.9%
sub-neg79.9%
Simplified79.9%
Taylor expanded in wj around 0 100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
unpow2100.0%
Simplified100.0%
if 3.7500000000000001e-7 < wj Initial program 56.9%
div-sub56.9%
associate-/l*56.9%
distribute-rgt1-in56.9%
associate-/l*56.9%
*-inverses99.8%
/-rgt-identity99.8%
distribute-rgt1-in99.8%
associate-/l/99.8%
div-sub99.8%
Simplified99.8%
clear-num99.8%
associate-/r/100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (- (/ x (exp wj)) wj)))
(if (<= wj -4e-8)
(+ wj (/ t_0 (+ wj 1.0)))
(if (<= wj 3e-7)
(+ x (- (- (* wj wj) (pow wj 3.0)) (* wj (+ x x))))
(+ wj (* (/ 1.0 (+ wj 1.0)) t_0))))))
double code(double wj, double x) {
double t_0 = (x / exp(wj)) - wj;
double tmp;
if (wj <= -4e-8) {
tmp = wj + (t_0 / (wj + 1.0));
} else if (wj <= 3e-7) {
tmp = x + (((wj * wj) - pow(wj, 3.0)) - (wj * (x + x)));
} else {
tmp = wj + ((1.0 / (wj + 1.0)) * t_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 / exp(wj)) - wj
if (wj <= (-4d-8)) then
tmp = wj + (t_0 / (wj + 1.0d0))
else if (wj <= 3d-7) then
tmp = x + (((wj * wj) - (wj ** 3.0d0)) - (wj * (x + x)))
else
tmp = wj + ((1.0d0 / (wj + 1.0d0)) * t_0)
end if
code = tmp
end function
public static double code(double wj, double x) {
double t_0 = (x / Math.exp(wj)) - wj;
double tmp;
if (wj <= -4e-8) {
tmp = wj + (t_0 / (wj + 1.0));
} else if (wj <= 3e-7) {
tmp = x + (((wj * wj) - Math.pow(wj, 3.0)) - (wj * (x + x)));
} else {
tmp = wj + ((1.0 / (wj + 1.0)) * t_0);
}
return tmp;
}
def code(wj, x): t_0 = (x / math.exp(wj)) - wj tmp = 0 if wj <= -4e-8: tmp = wj + (t_0 / (wj + 1.0)) elif wj <= 3e-7: tmp = x + (((wj * wj) - math.pow(wj, 3.0)) - (wj * (x + x))) else: tmp = wj + ((1.0 / (wj + 1.0)) * t_0) return tmp
function code(wj, x) t_0 = Float64(Float64(x / exp(wj)) - wj) tmp = 0.0 if (wj <= -4e-8) tmp = Float64(wj + Float64(t_0 / Float64(wj + 1.0))); elseif (wj <= 3e-7) tmp = Float64(x + Float64(Float64(Float64(wj * wj) - (wj ^ 3.0)) - Float64(wj * Float64(x + x)))); else tmp = Float64(wj + Float64(Float64(1.0 / Float64(wj + 1.0)) * t_0)); end return tmp end
function tmp_2 = code(wj, x) t_0 = (x / exp(wj)) - wj; tmp = 0.0; if (wj <= -4e-8) tmp = wj + (t_0 / (wj + 1.0)); elseif (wj <= 3e-7) tmp = x + (((wj * wj) - (wj ^ 3.0)) - (wj * (x + x))); else tmp = wj + ((1.0 / (wj + 1.0)) * t_0); end tmp_2 = tmp; end
code[wj_, x_] := Block[{t$95$0 = N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision]}, If[LessEqual[wj, -4e-8], N[(wj + N[(t$95$0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 3e-7], N[(x + N[(N[(N[(wj * wj), $MachinePrecision] - N[Power[wj, 3.0], $MachinePrecision]), $MachinePrecision] - N[(wj * N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(N[(1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{e^{wj}} - wj\\
\mathbf{if}\;wj \leq -4 \cdot 10^{-8}:\\
\;\;\;\;wj + \frac{t_0}{wj + 1}\\
\mathbf{elif}\;wj \leq 3 \cdot 10^{-7}:\\
\;\;\;\;x + \left(\left(wj \cdot wj - {wj}^{3}\right) - wj \cdot \left(x + x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{1}{wj + 1} \cdot t_0\\
\end{array}
\end{array}
if wj < -4.0000000000000001e-8Initial program 74.3%
div-sub74.3%
associate-/l*74.3%
distribute-rgt1-in74.3%
associate-/l*74.3%
*-inverses74.3%
/-rgt-identity74.3%
distribute-rgt1-in99.3%
associate-/l/99.1%
div-sub99.1%
Simplified99.1%
if -4.0000000000000001e-8 < wj < 2.9999999999999999e-7Initial program 79.9%
div-sub79.9%
associate-/l*80.0%
distribute-rgt1-in80.0%
associate-/l*80.0%
*-inverses80.0%
/-rgt-identity80.0%
distribute-rgt1-in80.0%
associate-/l/79.9%
div-sub79.9%
Simplified79.9%
Taylor expanded in wj around 0 79.9%
associate-*r*79.9%
neg-mul-179.9%
distribute-rgt1-in79.9%
+-commutative79.9%
sub-neg79.9%
Simplified79.9%
Taylor expanded in wj around 0 100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
unpow2100.0%
Simplified100.0%
if 2.9999999999999999e-7 < wj Initial program 56.9%
div-sub56.9%
associate-/l*56.9%
distribute-rgt1-in56.9%
associate-/l*56.9%
*-inverses99.8%
/-rgt-identity99.8%
distribute-rgt1-in99.8%
associate-/l/99.8%
div-sub99.8%
Simplified99.8%
clear-num99.8%
associate-/r/100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (- (/ x (exp wj)) wj)))
(if (<= wj -8e-14)
(+ wj (/ t_0 (+ wj 1.0)))
(if (<= wj 1.8e-9)
(+ x (- (* wj (+ wj (+ x x))) (pow wj 3.0)))
(+ wj (* (/ 1.0 (+ wj 1.0)) t_0))))))
double code(double wj, double x) {
double t_0 = (x / exp(wj)) - wj;
double tmp;
if (wj <= -8e-14) {
tmp = wj + (t_0 / (wj + 1.0));
} else if (wj <= 1.8e-9) {
tmp = x + ((wj * (wj + (x + x))) - pow(wj, 3.0));
} else {
tmp = wj + ((1.0 / (wj + 1.0)) * t_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 / exp(wj)) - wj
if (wj <= (-8d-14)) then
tmp = wj + (t_0 / (wj + 1.0d0))
else if (wj <= 1.8d-9) then
tmp = x + ((wj * (wj + (x + x))) - (wj ** 3.0d0))
else
tmp = wj + ((1.0d0 / (wj + 1.0d0)) * t_0)
end if
code = tmp
end function
public static double code(double wj, double x) {
double t_0 = (x / Math.exp(wj)) - wj;
double tmp;
if (wj <= -8e-14) {
tmp = wj + (t_0 / (wj + 1.0));
} else if (wj <= 1.8e-9) {
tmp = x + ((wj * (wj + (x + x))) - Math.pow(wj, 3.0));
} else {
tmp = wj + ((1.0 / (wj + 1.0)) * t_0);
}
return tmp;
}
def code(wj, x): t_0 = (x / math.exp(wj)) - wj tmp = 0 if wj <= -8e-14: tmp = wj + (t_0 / (wj + 1.0)) elif wj <= 1.8e-9: tmp = x + ((wj * (wj + (x + x))) - math.pow(wj, 3.0)) else: tmp = wj + ((1.0 / (wj + 1.0)) * t_0) return tmp
function code(wj, x) t_0 = Float64(Float64(x / exp(wj)) - wj) tmp = 0.0 if (wj <= -8e-14) tmp = Float64(wj + Float64(t_0 / Float64(wj + 1.0))); elseif (wj <= 1.8e-9) tmp = Float64(x + Float64(Float64(wj * Float64(wj + Float64(x + x))) - (wj ^ 3.0))); else tmp = Float64(wj + Float64(Float64(1.0 / Float64(wj + 1.0)) * t_0)); end return tmp end
function tmp_2 = code(wj, x) t_0 = (x / exp(wj)) - wj; tmp = 0.0; if (wj <= -8e-14) tmp = wj + (t_0 / (wj + 1.0)); elseif (wj <= 1.8e-9) tmp = x + ((wj * (wj + (x + x))) - (wj ^ 3.0)); else tmp = wj + ((1.0 / (wj + 1.0)) * t_0); end tmp_2 = tmp; end
code[wj_, x_] := Block[{t$95$0 = N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision]}, If[LessEqual[wj, -8e-14], N[(wj + N[(t$95$0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[wj, 1.8e-9], N[(x + N[(N[(wj * N[(wj + N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[wj, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj + N[(N[(1.0 / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{e^{wj}} - wj\\
\mathbf{if}\;wj \leq -8 \cdot 10^{-14}:\\
\;\;\;\;wj + \frac{t_0}{wj + 1}\\
\mathbf{elif}\;wj \leq 1.8 \cdot 10^{-9}:\\
\;\;\;\;x + \left(wj \cdot \left(wj + \left(x + x\right)\right) - {wj}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;wj + \frac{1}{wj + 1} \cdot t_0\\
\end{array}
\end{array}
if wj < -7.99999999999999999e-14Initial program 81.2%
div-sub81.2%
associate-/l*81.7%
distribute-rgt1-in81.7%
associate-/l*81.7%
*-inverses81.7%
/-rgt-identity81.7%
distribute-rgt1-in97.0%
associate-/l/96.6%
div-sub96.6%
Simplified96.6%
if -7.99999999999999999e-14 < wj < 1.8e-9Initial program 79.7%
div-sub79.7%
associate-/l*79.7%
distribute-rgt1-in79.7%
associate-/l*79.7%
*-inverses79.7%
/-rgt-identity79.7%
distribute-rgt1-in79.7%
associate-/l/79.7%
div-sub79.7%
Simplified79.7%
Taylor expanded in wj around 0 79.7%
associate-*r*79.7%
neg-mul-179.7%
distribute-rgt1-in79.7%
+-commutative79.7%
sub-neg79.7%
Simplified79.7%
Taylor expanded in wj around 0 100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
unpow2100.0%
Simplified100.0%
associate-+r-100.0%
fma-def100.0%
sub-neg100.0%
add-sqr-sqrt47.0%
sqrt-unprod75.0%
mul-1-neg75.0%
mul-1-neg75.0%
sqr-neg75.0%
sqrt-prod53.0%
add-sqr-sqrt100.0%
mul-1-neg100.0%
add-sqr-sqrt47.0%
sqrt-unprod75.0%
mul-1-neg75.0%
mul-1-neg75.0%
sqr-neg75.0%
sqrt-prod53.0%
add-sqr-sqrt100.0%
Applied egg-rr100.0%
fma-udef100.0%
distribute-lft-out100.0%
Simplified100.0%
if 1.8e-9 < wj Initial program 56.9%
div-sub56.9%
associate-/l*56.9%
distribute-rgt1-in56.9%
associate-/l*56.9%
*-inverses99.8%
/-rgt-identity99.8%
distribute-rgt1-in99.8%
associate-/l/99.8%
div-sub99.8%
Simplified99.8%
clear-num99.8%
associate-/r/100.0%
Applied egg-rr100.0%
Final simplification99.8%
(FPCore (wj x) :precision binary64 (if (or (<= wj -8e-14) (not (<= wj 2.45e-8))) (+ wj (/ (- (/ x (exp wj)) wj) (+ wj 1.0))) (+ x (- (* wj (+ wj (+ x x))) (pow wj 3.0)))))
double code(double wj, double x) {
double tmp;
if ((wj <= -8e-14) || !(wj <= 2.45e-8)) {
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = x + ((wj * (wj + (x + x))) - pow(wj, 3.0));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if ((wj <= (-8d-14)) .or. (.not. (wj <= 2.45d-8))) then
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0d0))
else
tmp = x + ((wj * (wj + (x + x))) - (wj ** 3.0d0))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if ((wj <= -8e-14) || !(wj <= 2.45e-8)) {
tmp = wj + (((x / Math.exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = x + ((wj * (wj + (x + x))) - Math.pow(wj, 3.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if (wj <= -8e-14) or not (wj <= 2.45e-8): tmp = wj + (((x / math.exp(wj)) - wj) / (wj + 1.0)) else: tmp = x + ((wj * (wj + (x + x))) - math.pow(wj, 3.0)) return tmp
function code(wj, x) tmp = 0.0 if ((wj <= -8e-14) || !(wj <= 2.45e-8)) tmp = Float64(wj + Float64(Float64(Float64(x / exp(wj)) - wj) / Float64(wj + 1.0))); else tmp = Float64(x + Float64(Float64(wj * Float64(wj + Float64(x + x))) - (wj ^ 3.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if ((wj <= -8e-14) || ~((wj <= 2.45e-8))) tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0)); else tmp = x + ((wj * (wj + (x + x))) - (wj ^ 3.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[Or[LessEqual[wj, -8e-14], N[Not[LessEqual[wj, 2.45e-8]], $MachinePrecision]], N[(wj + N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(wj * N[(wj + N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[wj, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -8 \cdot 10^{-14} \lor \neg \left(wj \leq 2.45 \cdot 10^{-8}\right):\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;x + \left(wj \cdot \left(wj + \left(x + x\right)\right) - {wj}^{3}\right)\\
\end{array}
\end{array}
if wj < -7.99999999999999999e-14 or 2.4500000000000001e-8 < wj Initial program 72.7%
div-sub72.7%
associate-/l*73.0%
distribute-rgt1-in73.0%
associate-/l*73.0%
*-inverses88.0%
/-rgt-identity88.0%
distribute-rgt1-in98.0%
associate-/l/97.7%
div-sub97.7%
Simplified97.7%
if -7.99999999999999999e-14 < wj < 2.4500000000000001e-8Initial program 79.7%
div-sub79.7%
associate-/l*79.7%
distribute-rgt1-in79.7%
associate-/l*79.7%
*-inverses79.7%
/-rgt-identity79.7%
distribute-rgt1-in79.7%
associate-/l/79.7%
div-sub79.7%
Simplified79.7%
Taylor expanded in wj around 0 79.7%
associate-*r*79.7%
neg-mul-179.7%
distribute-rgt1-in79.7%
+-commutative79.7%
sub-neg79.7%
Simplified79.7%
Taylor expanded in wj around 0 100.0%
Taylor expanded in x around 0 100.0%
+-commutative100.0%
mul-1-neg100.0%
unsub-neg100.0%
unpow2100.0%
Simplified100.0%
associate-+r-100.0%
fma-def100.0%
sub-neg100.0%
add-sqr-sqrt47.0%
sqrt-unprod75.0%
mul-1-neg75.0%
mul-1-neg75.0%
sqr-neg75.0%
sqrt-prod53.0%
add-sqr-sqrt100.0%
mul-1-neg100.0%
add-sqr-sqrt47.0%
sqrt-unprod75.0%
mul-1-neg75.0%
mul-1-neg75.0%
sqr-neg75.0%
sqrt-prod53.0%
add-sqr-sqrt100.0%
Applied egg-rr100.0%
fma-udef100.0%
distribute-lft-out100.0%
Simplified100.0%
Final simplification99.8%
(FPCore (wj x) :precision binary64 (if (or (<= wj -7.3e-9) (not (<= wj 1.02e-8))) (+ wj (/ (- (/ x (exp wj)) wj) (+ wj 1.0))) (- x (- (* wj (+ x x)) (* (* wj wj) (+ x (- x -1.0)))))))
double code(double wj, double x) {
double tmp;
if ((wj <= -7.3e-9) || !(wj <= 1.02e-8)) {
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = x - ((wj * (x + x)) - ((wj * wj) * (x + (x - -1.0))));
}
return tmp;
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if ((wj <= (-7.3d-9)) .or. (.not. (wj <= 1.02d-8))) then
tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0d0))
else
tmp = x - ((wj * (x + x)) - ((wj * wj) * (x + (x - (-1.0d0)))))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if ((wj <= -7.3e-9) || !(wj <= 1.02e-8)) {
tmp = wj + (((x / Math.exp(wj)) - wj) / (wj + 1.0));
} else {
tmp = x - ((wj * (x + x)) - ((wj * wj) * (x + (x - -1.0))));
}
return tmp;
}
def code(wj, x): tmp = 0 if (wj <= -7.3e-9) or not (wj <= 1.02e-8): tmp = wj + (((x / math.exp(wj)) - wj) / (wj + 1.0)) else: tmp = x - ((wj * (x + x)) - ((wj * wj) * (x + (x - -1.0)))) return tmp
function code(wj, x) tmp = 0.0 if ((wj <= -7.3e-9) || !(wj <= 1.02e-8)) tmp = Float64(wj + Float64(Float64(Float64(x / exp(wj)) - wj) / Float64(wj + 1.0))); else tmp = Float64(x - Float64(Float64(wj * Float64(x + x)) - Float64(Float64(wj * wj) * Float64(x + Float64(x - -1.0))))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if ((wj <= -7.3e-9) || ~((wj <= 1.02e-8))) tmp = wj + (((x / exp(wj)) - wj) / (wj + 1.0)); else tmp = x - ((wj * (x + x)) - ((wj * wj) * (x + (x - -1.0)))); end tmp_2 = tmp; end
code[wj_, x_] := If[Or[LessEqual[wj, -7.3e-9], N[Not[LessEqual[wj, 1.02e-8]], $MachinePrecision]], N[(wj + N[(N[(N[(x / N[Exp[wj], $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(wj * N[(x + x), $MachinePrecision]), $MachinePrecision] - N[(N[(wj * wj), $MachinePrecision] * N[(x + N[(x - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -7.3 \cdot 10^{-9} \lor \neg \left(wj \leq 1.02 \cdot 10^{-8}\right):\\
\;\;\;\;wj + \frac{\frac{x}{e^{wj}} - wj}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;x - \left(wj \cdot \left(x + x\right) - \left(wj \cdot wj\right) \cdot \left(x + \left(x - -1\right)\right)\right)\\
\end{array}
\end{array}
if wj < -7.30000000000000002e-9 or 1.02000000000000003e-8 < wj Initial program 65.9%
div-sub65.9%
associate-/l*66.2%
distribute-rgt1-in66.2%
associate-/l*66.2%
*-inverses85.0%
/-rgt-identity85.0%
distribute-rgt1-in97.5%
associate-/l/97.4%
div-sub97.4%
Simplified97.4%
if -7.30000000000000002e-9 < wj < 1.02000000000000003e-8Initial program 80.0%
div-sub80.0%
associate-/l*80.0%
distribute-rgt1-in80.0%
associate-/l*80.0%
*-inverses80.0%
/-rgt-identity80.0%
distribute-rgt1-in80.0%
associate-/l/80.0%
div-sub80.0%
Simplified80.0%
Taylor expanded in wj around 0 80.0%
associate-*r*80.0%
neg-mul-180.0%
distribute-rgt1-in80.0%
+-commutative80.0%
sub-neg80.0%
Simplified80.0%
Taylor expanded in wj around 0 100.0%
Taylor expanded in wj around 0 99.8%
unpow299.8%
sub-neg99.8%
neg-mul-199.8%
remove-double-neg99.8%
+-commutative99.8%
+-commutative99.8%
Simplified99.8%
Final simplification99.7%
(FPCore (wj x) :precision binary64 (- x (- (* wj (+ x x)) (* (* wj wj) (+ x (- x -1.0))))))
double code(double wj, double x) {
return x - ((wj * (x + x)) - ((wj * wj) * (x + (x - -1.0))));
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = x - ((wj * (x + x)) - ((wj * wj) * (x + (x - (-1.0d0)))))
end function
public static double code(double wj, double x) {
return x - ((wj * (x + x)) - ((wj * wj) * (x + (x - -1.0))));
}
def code(wj, x): return x - ((wj * (x + x)) - ((wj * wj) * (x + (x - -1.0))))
function code(wj, x) return Float64(x - Float64(Float64(wj * Float64(x + x)) - Float64(Float64(wj * wj) * Float64(x + Float64(x - -1.0))))) end
function tmp = code(wj, x) tmp = x - ((wj * (x + x)) - ((wj * wj) * (x + (x - -1.0)))); end
code[wj_, x_] := N[(x - N[(N[(wj * N[(x + x), $MachinePrecision]), $MachinePrecision] - N[(N[(wj * wj), $MachinePrecision] * N[(x + N[(x - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(wj \cdot \left(x + x\right) - \left(wj \cdot wj\right) \cdot \left(x + \left(x - -1\right)\right)\right)
\end{array}
Initial program 79.1%
div-sub79.1%
associate-/l*79.1%
distribute-rgt1-in79.1%
associate-/l*79.1%
*-inverses80.3%
/-rgt-identity80.3%
distribute-rgt1-in81.1%
associate-/l/81.1%
div-sub81.1%
Simplified81.1%
Taylor expanded in wj around 0 78.9%
associate-*r*78.9%
neg-mul-178.9%
distribute-rgt1-in78.9%
+-commutative78.9%
sub-neg78.9%
Simplified78.9%
Taylor expanded in wj around 0 95.5%
Taylor expanded in wj around 0 95.4%
unpow295.4%
sub-neg95.4%
neg-mul-195.4%
remove-double-neg95.4%
+-commutative95.4%
+-commutative95.4%
Simplified95.4%
Final simplification95.4%
(FPCore (wj x) :precision binary64 (if (<= wj -8e-14) (- wj (/ (+ wj (* x (+ wj -1.0))) (+ wj 1.0))) (+ x (* wj wj))))
double code(double wj, double x) {
double tmp;
if (wj <= -8e-14) {
tmp = wj - ((wj + (x * (wj + -1.0))) / (wj + 1.0));
} else {
tmp = 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 <= (-8d-14)) then
tmp = wj - ((wj + (x * (wj + (-1.0d0)))) / (wj + 1.0d0))
else
tmp = x + (wj * wj)
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= -8e-14) {
tmp = wj - ((wj + (x * (wj + -1.0))) / (wj + 1.0));
} else {
tmp = x + (wj * wj);
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= -8e-14: tmp = wj - ((wj + (x * (wj + -1.0))) / (wj + 1.0)) else: tmp = x + (wj * wj) return tmp
function code(wj, x) tmp = 0.0 if (wj <= -8e-14) tmp = Float64(wj - Float64(Float64(wj + Float64(x * Float64(wj + -1.0))) / Float64(wj + 1.0))); else tmp = Float64(x + Float64(wj * wj)); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= -8e-14) tmp = wj - ((wj + (x * (wj + -1.0))) / (wj + 1.0)); else tmp = x + (wj * wj); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, -8e-14], N[(wj - N[(N[(wj + N[(x * N[(wj + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(wj + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(wj * wj), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;wj \leq -8 \cdot 10^{-14}:\\
\;\;\;\;wj - \frac{wj + x \cdot \left(wj + -1\right)}{wj + 1}\\
\mathbf{else}:\\
\;\;\;\;x + wj \cdot wj\\
\end{array}
\end{array}
if wj < -7.99999999999999999e-14Initial program 81.2%
div-sub81.2%
associate-/l*81.7%
distribute-rgt1-in81.7%
associate-/l*81.7%
*-inverses81.7%
/-rgt-identity81.7%
distribute-rgt1-in97.0%
associate-/l/96.6%
div-sub96.6%
Simplified96.6%
Taylor expanded in wj around 0 67.9%
associate-*r*67.9%
neg-mul-167.9%
distribute-rgt1-in67.8%
+-commutative67.8%
sub-neg67.8%
Simplified67.8%
if -7.99999999999999999e-14 < wj Initial program 79.0%
div-sub79.0%
associate-/l*79.0%
distribute-rgt1-in79.0%
associate-/l*79.0%
*-inverses80.2%
/-rgt-identity80.2%
distribute-rgt1-in80.2%
associate-/l/80.2%
div-sub80.2%
Simplified80.2%
Taylor expanded in wj around 0 97.5%
+-commutative97.5%
fma-def97.5%
unpow297.5%
sub-neg97.5%
distribute-rgt-out97.9%
distribute-rgt-neg-in97.9%
metadata-eval97.9%
metadata-eval97.9%
associate-*r*97.9%
*-commutative97.9%
Simplified97.9%
Taylor expanded in x around 0 97.5%
unpow297.5%
Simplified97.5%
Final simplification96.0%
(FPCore (wj x) :precision binary64 (+ x (* wj wj)))
double code(double wj, double x) {
return x + (wj * wj);
}
real(8) function code(wj, x)
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = x + (wj * wj)
end function
public static double code(double wj, double x) {
return x + (wj * wj);
}
def code(wj, x): return x + (wj * wj)
function code(wj, x) return Float64(x + Float64(wj * wj)) end
function tmp = code(wj, x) tmp = x + (wj * wj); end
code[wj_, x_] := N[(x + N[(wj * wj), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + wj \cdot wj
\end{array}
Initial program 79.1%
div-sub79.1%
associate-/l*79.1%
distribute-rgt1-in79.1%
associate-/l*79.1%
*-inverses80.3%
/-rgt-identity80.3%
distribute-rgt1-in81.1%
associate-/l/81.1%
div-sub81.1%
Simplified81.1%
Taylor expanded in wj around 0 95.2%
+-commutative95.2%
fma-def95.2%
unpow295.2%
sub-neg95.2%
distribute-rgt-out95.6%
distribute-rgt-neg-in95.6%
metadata-eval95.6%
metadata-eval95.6%
associate-*r*95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in x around 0 94.5%
unpow294.5%
Simplified94.5%
Final simplification94.5%
(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 79.1%
div-sub79.1%
associate-/l*79.1%
distribute-rgt1-in79.1%
associate-/l*79.1%
*-inverses80.3%
/-rgt-identity80.3%
distribute-rgt1-in81.1%
associate-/l/81.1%
div-sub81.1%
Simplified81.1%
Taylor expanded in wj around inf 4.3%
Final simplification4.3%
(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 79.1%
div-sub79.1%
associate-/l*79.1%
distribute-rgt1-in79.1%
associate-/l*79.1%
*-inverses80.3%
/-rgt-identity80.3%
distribute-rgt1-in81.1%
associate-/l/81.1%
div-sub81.1%
Simplified81.1%
Taylor expanded in wj around 0 84.9%
Final simplification84.9%
(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 2023287
(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))))))