
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (* x (+ eps -1.0))))
(t_1 (* (exp (* x (- -1.0 eps))) (- 1.0 (/ 1.0 eps)))))
(if (<= (- t_1 (* t_0 (+ -1.0 (/ -1.0 eps)))) 0.0)
(/ t_0 2.0)
(/ (+ (* (+ 1.0 (/ 1.0 eps)) (exp (* eps x))) t_1) 2.0))))
double code(double x, double eps) {
double t_0 = exp((x * (eps + -1.0)));
double t_1 = exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps));
double tmp;
if ((t_1 - (t_0 * (-1.0 + (-1.0 / eps)))) <= 0.0) {
tmp = t_0 / 2.0;
} else {
tmp = (((1.0 + (1.0 / eps)) * exp((eps * x))) + t_1) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp((x * (eps + (-1.0d0))))
t_1 = exp((x * ((-1.0d0) - eps))) * (1.0d0 - (1.0d0 / eps))
if ((t_1 - (t_0 * ((-1.0d0) + ((-1.0d0) / eps)))) <= 0.0d0) then
tmp = t_0 / 2.0d0
else
tmp = (((1.0d0 + (1.0d0 / eps)) * exp((eps * x))) + t_1) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.exp((x * (eps + -1.0)));
double t_1 = Math.exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps));
double tmp;
if ((t_1 - (t_0 * (-1.0 + (-1.0 / eps)))) <= 0.0) {
tmp = t_0 / 2.0;
} else {
tmp = (((1.0 + (1.0 / eps)) * Math.exp((eps * x))) + t_1) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = math.exp((x * (eps + -1.0))) t_1 = math.exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps)) tmp = 0 if (t_1 - (t_0 * (-1.0 + (-1.0 / eps)))) <= 0.0: tmp = t_0 / 2.0 else: tmp = (((1.0 + (1.0 / eps)) * math.exp((eps * x))) + t_1) / 2.0 return tmp
function code(x, eps) t_0 = exp(Float64(x * Float64(eps + -1.0))) t_1 = Float64(exp(Float64(x * Float64(-1.0 - eps))) * Float64(1.0 - Float64(1.0 / eps))) tmp = 0.0 if (Float64(t_1 - Float64(t_0 * Float64(-1.0 + Float64(-1.0 / eps)))) <= 0.0) tmp = Float64(t_0 / 2.0); else tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(eps * x))) + t_1) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = exp((x * (eps + -1.0))); t_1 = exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps)); tmp = 0.0; if ((t_1 - (t_0 * (-1.0 + (-1.0 / eps)))) <= 0.0) tmp = t_0 / 2.0; else tmp = (((1.0 + (1.0 / eps)) * exp((eps * x))) + t_1) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 - N[(t$95$0 * N[(-1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(t$95$0 / 2.0), $MachinePrecision], N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(eps * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(\varepsilon + -1\right)}\\
t_1 := e^{x \cdot \left(-1 - \varepsilon\right)} \cdot \left(1 - \frac{1}{\varepsilon}\right)\\
\mathbf{if}\;t\_1 - t\_0 \cdot \left(-1 + \frac{-1}{\varepsilon}\right) \leq 0:\\
\;\;\;\;\frac{t\_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\varepsilon \cdot x} + t\_1}{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 1 (/.f64 1 eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 1 eps) x)))) (*.f64 (-.f64 (/.f64 1 eps) 1) (exp.f64 (neg.f64 (*.f64 (+.f64 1 eps) x))))) < 0.0Initial program 36.0%
Simplified36.0%
Taylor expanded in eps around inf 12.0%
mul-1-neg12.0%
distribute-lft-neg-out12.0%
*-commutative12.0%
Simplified12.0%
Taylor expanded in eps around 0 2.8%
Taylor expanded in eps around inf 46.3%
mul-1-neg46.3%
distribute-rgt-neg-in46.3%
Simplified46.3%
if 0.0 < (-.f64 (*.f64 (+.f64 1 (/.f64 1 eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 1 eps) x)))) (*.f64 (-.f64 (/.f64 1 eps) 1) (exp.f64 (neg.f64 (*.f64 (+.f64 1 eps) x))))) Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification75.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (* x (+ eps -1.0)))) (t_1 (- 1.0 (/ 1.0 eps))))
(if (<= eps 6e-17)
(/ t_0 2.0)
(if (<= eps 2.45e+14)
(/ (+ (* (+ 1.0 (/ 1.0 eps)) t_0) (* (exp (- x)) t_1)) 2.0)
(/ (+ (exp (* eps x)) (* (exp (* x (- -1.0 eps))) t_1)) 2.0)))))
double code(double x, double eps) {
double t_0 = exp((x * (eps + -1.0)));
double t_1 = 1.0 - (1.0 / eps);
double tmp;
if (eps <= 6e-17) {
tmp = t_0 / 2.0;
} else if (eps <= 2.45e+14) {
tmp = (((1.0 + (1.0 / eps)) * t_0) + (exp(-x) * t_1)) / 2.0;
} else {
tmp = (exp((eps * x)) + (exp((x * (-1.0 - eps))) * t_1)) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp((x * (eps + (-1.0d0))))
t_1 = 1.0d0 - (1.0d0 / eps)
if (eps <= 6d-17) then
tmp = t_0 / 2.0d0
else if (eps <= 2.45d+14) then
tmp = (((1.0d0 + (1.0d0 / eps)) * t_0) + (exp(-x) * t_1)) / 2.0d0
else
tmp = (exp((eps * x)) + (exp((x * ((-1.0d0) - eps))) * t_1)) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.exp((x * (eps + -1.0)));
double t_1 = 1.0 - (1.0 / eps);
double tmp;
if (eps <= 6e-17) {
tmp = t_0 / 2.0;
} else if (eps <= 2.45e+14) {
tmp = (((1.0 + (1.0 / eps)) * t_0) + (Math.exp(-x) * t_1)) / 2.0;
} else {
tmp = (Math.exp((eps * x)) + (Math.exp((x * (-1.0 - eps))) * t_1)) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = math.exp((x * (eps + -1.0))) t_1 = 1.0 - (1.0 / eps) tmp = 0 if eps <= 6e-17: tmp = t_0 / 2.0 elif eps <= 2.45e+14: tmp = (((1.0 + (1.0 / eps)) * t_0) + (math.exp(-x) * t_1)) / 2.0 else: tmp = (math.exp((eps * x)) + (math.exp((x * (-1.0 - eps))) * t_1)) / 2.0 return tmp
function code(x, eps) t_0 = exp(Float64(x * Float64(eps + -1.0))) t_1 = Float64(1.0 - Float64(1.0 / eps)) tmp = 0.0 if (eps <= 6e-17) tmp = Float64(t_0 / 2.0); elseif (eps <= 2.45e+14) tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * t_0) + Float64(exp(Float64(-x)) * t_1)) / 2.0); else tmp = Float64(Float64(exp(Float64(eps * x)) + Float64(exp(Float64(x * Float64(-1.0 - eps))) * t_1)) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = exp((x * (eps + -1.0))); t_1 = 1.0 - (1.0 / eps); tmp = 0.0; if (eps <= 6e-17) tmp = t_0 / 2.0; elseif (eps <= 2.45e+14) tmp = (((1.0 + (1.0 / eps)) * t_0) + (exp(-x) * t_1)) / 2.0; else tmp = (exp((eps * x)) + (exp((x * (-1.0 - eps))) * t_1)) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, 6e-17], N[(t$95$0 / 2.0), $MachinePrecision], If[LessEqual[eps, 2.45e+14], N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(N[Exp[(-x)], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(eps * x), $MachinePrecision]], $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(\varepsilon + -1\right)}\\
t_1 := 1 - \frac{1}{\varepsilon}\\
\mathbf{if}\;\varepsilon \leq 6 \cdot 10^{-17}:\\
\;\;\;\;\frac{t\_0}{2}\\
\mathbf{elif}\;\varepsilon \leq 2.45 \cdot 10^{+14}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot t\_0 + e^{-x} \cdot t\_1}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\varepsilon \cdot x} + e^{x \cdot \left(-1 - \varepsilon\right)} \cdot t\_1}{2}\\
\end{array}
\end{array}
if eps < 6.00000000000000012e-17Initial program 58.9%
Simplified58.9%
Taylor expanded in eps around inf 43.5%
mul-1-neg43.5%
distribute-lft-neg-out43.5%
*-commutative43.5%
Simplified43.5%
Taylor expanded in eps around 0 18.9%
Taylor expanded in eps around inf 46.8%
mul-1-neg46.8%
distribute-rgt-neg-in46.8%
Simplified46.8%
if 6.00000000000000012e-17 < eps < 2.45e14Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
mul-1-neg100.0%
Simplified100.0%
if 2.45e14 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Final simplification62.8%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (* x (+ eps -1.0)))))
(if (<= eps 0.5)
(/ t_0 2.0)
(/ (+ (* (+ 1.0 (/ 1.0 eps)) t_0) (exp (* x (- eps)))) 2.0))))
double code(double x, double eps) {
double t_0 = exp((x * (eps + -1.0)));
double tmp;
if (eps <= 0.5) {
tmp = t_0 / 2.0;
} else {
tmp = (((1.0 + (1.0 / eps)) * t_0) + exp((x * -eps))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = exp((x * (eps + (-1.0d0))))
if (eps <= 0.5d0) then
tmp = t_0 / 2.0d0
else
tmp = (((1.0d0 + (1.0d0 / eps)) * t_0) + exp((x * -eps))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.exp((x * (eps + -1.0)));
double tmp;
if (eps <= 0.5) {
tmp = t_0 / 2.0;
} else {
tmp = (((1.0 + (1.0 / eps)) * t_0) + Math.exp((x * -eps))) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = math.exp((x * (eps + -1.0))) tmp = 0 if eps <= 0.5: tmp = t_0 / 2.0 else: tmp = (((1.0 + (1.0 / eps)) * t_0) + math.exp((x * -eps))) / 2.0 return tmp
function code(x, eps) t_0 = exp(Float64(x * Float64(eps + -1.0))) tmp = 0.0 if (eps <= 0.5) tmp = Float64(t_0 / 2.0); else tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * t_0) + exp(Float64(x * Float64(-eps)))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = exp((x * (eps + -1.0))); tmp = 0.0; if (eps <= 0.5) tmp = t_0 / 2.0; else tmp = (((1.0 + (1.0 / eps)) * t_0) + exp((x * -eps))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eps, 0.5], N[(t$95$0 / 2.0), $MachinePrecision], N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(\varepsilon + -1\right)}\\
\mathbf{if}\;\varepsilon \leq 0.5:\\
\;\;\;\;\frac{t\_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot t\_0 + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\end{array}
\end{array}
if eps < 0.5Initial program 59.5%
Simplified59.5%
Taylor expanded in eps around inf 44.4%
mul-1-neg44.4%
distribute-lft-neg-out44.4%
*-commutative44.4%
Simplified44.4%
Taylor expanded in eps around 0 18.9%
Taylor expanded in eps around inf 46.3%
mul-1-neg46.3%
distribute-rgt-neg-in46.3%
Simplified46.3%
if 0.5 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around inf 97.9%
mul-1-neg97.9%
mul-1-neg97.9%
Simplified97.9%
Final simplification61.2%
(FPCore (x eps)
:precision binary64
(if (<= eps 1.0)
(/ (exp (* x (+ eps -1.0))) 2.0)
(/
(+ (exp (* eps x)) (* (exp (* x (- -1.0 eps))) (- 1.0 (/ 1.0 eps))))
2.0)))
double code(double x, double eps) {
double tmp;
if (eps <= 1.0) {
tmp = exp((x * (eps + -1.0))) / 2.0;
} else {
tmp = (exp((eps * x)) + (exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps)))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= 1.0d0) then
tmp = exp((x * (eps + (-1.0d0)))) / 2.0d0
else
tmp = (exp((eps * x)) + (exp((x * ((-1.0d0) - eps))) * (1.0d0 - (1.0d0 / eps)))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= 1.0) {
tmp = Math.exp((x * (eps + -1.0))) / 2.0;
} else {
tmp = (Math.exp((eps * x)) + (Math.exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps)))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= 1.0: tmp = math.exp((x * (eps + -1.0))) / 2.0 else: tmp = (math.exp((eps * x)) + (math.exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps)))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (eps <= 1.0) tmp = Float64(exp(Float64(x * Float64(eps + -1.0))) / 2.0); else tmp = Float64(Float64(exp(Float64(eps * x)) + Float64(exp(Float64(x * Float64(-1.0 - eps))) * Float64(1.0 - Float64(1.0 / eps)))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 1.0) tmp = exp((x * (eps + -1.0))) / 2.0; else tmp = (exp((eps * x)) + (exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, 1.0], N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(eps * x), $MachinePrecision]], $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 1:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\varepsilon \cdot x} + e^{x \cdot \left(-1 - \varepsilon\right)} \cdot \left(1 - \frac{1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 59.5%
Simplified59.5%
Taylor expanded in eps around inf 44.4%
mul-1-neg44.4%
distribute-lft-neg-out44.4%
*-commutative44.4%
Simplified44.4%
Taylor expanded in eps around 0 18.9%
Taylor expanded in eps around inf 46.3%
mul-1-neg46.3%
distribute-rgt-neg-in46.3%
Simplified46.3%
if 1 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around inf 97.8%
Final simplification61.2%
(FPCore (x eps)
:precision binary64
(if (<= x 2.4e-176)
(/
(+ (+ 1.0 (/ 1.0 eps)) (* (exp (* x (- -1.0 eps))) (- 1.0 (/ 1.0 eps))))
2.0)
(/ (exp (* x (+ eps -1.0))) 2.0)))
double code(double x, double eps) {
double tmp;
if (x <= 2.4e-176) {
tmp = ((1.0 + (1.0 / eps)) + (exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps)))) / 2.0;
} else {
tmp = exp((x * (eps + -1.0))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 2.4d-176) then
tmp = ((1.0d0 + (1.0d0 / eps)) + (exp((x * ((-1.0d0) - eps))) * (1.0d0 - (1.0d0 / eps)))) / 2.0d0
else
tmp = exp((x * (eps + (-1.0d0)))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 2.4e-176) {
tmp = ((1.0 + (1.0 / eps)) + (Math.exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps)))) / 2.0;
} else {
tmp = Math.exp((x * (eps + -1.0))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 2.4e-176: tmp = ((1.0 + (1.0 / eps)) + (math.exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps)))) / 2.0 else: tmp = math.exp((x * (eps + -1.0))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 2.4e-176) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) + Float64(exp(Float64(x * Float64(-1.0 - eps))) * Float64(1.0 - Float64(1.0 / eps)))) / 2.0); else tmp = Float64(exp(Float64(x * Float64(eps + -1.0))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 2.4e-176) tmp = ((1.0 + (1.0 / eps)) + (exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps)))) / 2.0; else tmp = exp((x * (eps + -1.0))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 2.4e-176], N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.4 \cdot 10^{-176}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + e^{x \cdot \left(-1 - \varepsilon\right)} \cdot \left(1 - \frac{1}{\varepsilon}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\end{array}
\end{array}
if x < 2.40000000000000006e-176Initial program 63.8%
Simplified63.8%
Taylor expanded in eps around inf 63.7%
*-commutative63.7%
Simplified63.7%
Taylor expanded in x around 0 45.9%
if 2.40000000000000006e-176 < x Initial program 82.7%
Simplified82.7%
Taylor expanded in eps around inf 55.5%
mul-1-neg55.5%
distribute-lft-neg-out55.5%
*-commutative55.5%
Simplified55.5%
Taylor expanded in eps around 0 22.6%
Taylor expanded in eps around inf 63.0%
mul-1-neg63.0%
distribute-rgt-neg-in63.0%
Simplified63.0%
Final simplification52.6%
(FPCore (x eps)
:precision binary64
(if (<= x -4e-100)
(/ (/ (expm1 (- x)) eps) 2.0)
(if (<= x 1.55e-177)
(/ (fma (+ 1.0 (/ 1.0 eps)) 1.0 (- 1.0 (/ 1.0 eps))) 2.0)
(/ (exp (* x (+ eps -1.0))) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= -4e-100) {
tmp = (expm1(-x) / eps) / 2.0;
} else if (x <= 1.55e-177) {
tmp = fma((1.0 + (1.0 / eps)), 1.0, (1.0 - (1.0 / eps))) / 2.0;
} else {
tmp = exp((x * (eps + -1.0))) / 2.0;
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -4e-100) tmp = Float64(Float64(expm1(Float64(-x)) / eps) / 2.0); elseif (x <= 1.55e-177) tmp = Float64(fma(Float64(1.0 + Float64(1.0 / eps)), 1.0, Float64(1.0 - Float64(1.0 / eps))) / 2.0); else tmp = Float64(exp(Float64(x * Float64(eps + -1.0))) / 2.0); end return tmp end
code[x_, eps_] := If[LessEqual[x, -4e-100], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.55e-177], N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * 1.0 + N[(1.0 - N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-100}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{\varepsilon}}{2}\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-177}:\\
\;\;\;\;\frac{\mathsf{fma}\left(1 + \frac{1}{\varepsilon}, 1, 1 - \frac{1}{\varepsilon}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -4.0000000000000001e-100Initial program 77.6%
Simplified77.6%
Taylor expanded in eps around inf 77.6%
mul-1-neg77.6%
distribute-lft-neg-out77.6%
*-commutative77.6%
Simplified77.6%
Taylor expanded in eps around 0 36.5%
Taylor expanded in eps around 0 25.7%
expm1-define25.8%
mul-1-neg25.8%
Simplified25.8%
if -4.0000000000000001e-100 < x < 1.55000000000000009e-177Initial program 53.7%
Simplified47.7%
Taylor expanded in x around 0 47.7%
Taylor expanded in x around 0 41.7%
if 1.55000000000000009e-177 < x Initial program 82.7%
Simplified82.7%
Taylor expanded in eps around inf 55.5%
mul-1-neg55.5%
distribute-lft-neg-out55.5%
*-commutative55.5%
Simplified55.5%
Taylor expanded in eps around 0 22.6%
Taylor expanded in eps around inf 63.0%
mul-1-neg63.0%
distribute-rgt-neg-in63.0%
Simplified63.0%
Final simplification46.0%
(FPCore (x eps)
:precision binary64
(if (<= x -7.6e-224)
(/ (- (/ -1.0 eps) (* (exp (* (- 1.0 eps) x)) (+ -1.0 (/ -1.0 eps)))) 2.0)
(if (<= x 8.8e-175)
(/ (fma (+ 1.0 (/ 1.0 eps)) 1.0 (- 1.0 (/ 1.0 eps))) 2.0)
(/ (exp (* x (+ eps -1.0))) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= -7.6e-224) {
tmp = ((-1.0 / eps) - (exp(((1.0 - eps) * x)) * (-1.0 + (-1.0 / eps)))) / 2.0;
} else if (x <= 8.8e-175) {
tmp = fma((1.0 + (1.0 / eps)), 1.0, (1.0 - (1.0 / eps))) / 2.0;
} else {
tmp = exp((x * (eps + -1.0))) / 2.0;
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -7.6e-224) tmp = Float64(Float64(Float64(-1.0 / eps) - Float64(exp(Float64(Float64(1.0 - eps) * x)) * Float64(-1.0 + Float64(-1.0 / eps)))) / 2.0); elseif (x <= 8.8e-175) tmp = Float64(fma(Float64(1.0 + Float64(1.0 / eps)), 1.0, Float64(1.0 - Float64(1.0 / eps))) / 2.0); else tmp = Float64(exp(Float64(x * Float64(eps + -1.0))) / 2.0); end return tmp end
code[x_, eps_] := If[LessEqual[x, -7.6e-224], N[(N[(N[(-1.0 / eps), $MachinePrecision] - N[(N[Exp[N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] * N[(-1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8.8e-175], N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * 1.0 + N[(1.0 - N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{-224}:\\
\;\;\;\;\frac{\frac{-1}{\varepsilon} - e^{\left(1 - \varepsilon\right) \cdot x} \cdot \left(-1 + \frac{-1}{\varepsilon}\right)}{2}\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{-175}:\\
\;\;\;\;\frac{\mathsf{fma}\left(1 + \frac{1}{\varepsilon}, 1, 1 - \frac{1}{\varepsilon}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -7.60000000000000005e-224Initial program 67.4%
Simplified67.4%
Taylor expanded in eps around inf 67.3%
mul-1-neg67.3%
distribute-lft-neg-out67.3%
*-commutative67.3%
Simplified67.3%
Taylor expanded in eps around 0 30.6%
*-commutative30.6%
sub-neg30.6%
distribute-lft-in30.6%
*-commutative30.6%
*-un-lft-identity30.6%
add-sqr-sqrt30.6%
sqrt-unprod34.7%
sqr-neg34.7%
sqrt-unprod0.0%
add-sqr-sqrt30.6%
add-sqr-sqrt30.6%
sqrt-unprod29.7%
sqr-neg29.7%
sqrt-unprod0.0%
add-sqr-sqrt36.2%
Applied egg-rr36.2%
*-rgt-identity36.2%
distribute-lft-in36.2%
sub-neg36.2%
Simplified36.2%
if -7.60000000000000005e-224 < x < 8.8e-175Initial program 58.0%
Simplified55.4%
Taylor expanded in x around 0 55.4%
Taylor expanded in x around 0 54.5%
if 8.8e-175 < x Initial program 82.7%
Simplified82.7%
Taylor expanded in eps around inf 55.5%
mul-1-neg55.5%
distribute-lft-neg-out55.5%
*-commutative55.5%
Simplified55.5%
Taylor expanded in eps around 0 22.6%
Taylor expanded in eps around inf 63.0%
mul-1-neg63.0%
distribute-rgt-neg-in63.0%
Simplified63.0%
Final simplification51.0%
(FPCore (x eps) :precision binary64 (if (<= x -1.08) (/ (/ (expm1 (- x)) eps) 2.0) (/ (exp (* x (+ eps -1.0))) 2.0)))
double code(double x, double eps) {
double tmp;
if (x <= -1.08) {
tmp = (expm1(-x) / eps) / 2.0;
} else {
tmp = exp((x * (eps + -1.0))) / 2.0;
}
return tmp;
}
public static double code(double x, double eps) {
double tmp;
if (x <= -1.08) {
tmp = (Math.expm1(-x) / eps) / 2.0;
} else {
tmp = Math.exp((x * (eps + -1.0))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -1.08: tmp = (math.expm1(-x) / eps) / 2.0 else: tmp = math.exp((x * (eps + -1.0))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -1.08) tmp = Float64(Float64(expm1(Float64(-x)) / eps) / 2.0); else tmp = Float64(exp(Float64(x * Float64(eps + -1.0))) / 2.0); end return tmp end
code[x_, eps_] := If[LessEqual[x, -1.08], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.08:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -1.0800000000000001Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 54.8%
Taylor expanded in eps around 0 45.7%
expm1-define45.7%
mul-1-neg45.7%
Simplified45.7%
if -1.0800000000000001 < x Initial program 66.7%
Simplified66.7%
Taylor expanded in eps around inf 54.2%
mul-1-neg54.2%
distribute-lft-neg-out54.2%
*-commutative54.2%
Simplified54.2%
Taylor expanded in eps around 0 18.3%
Taylor expanded in eps around inf 41.0%
mul-1-neg41.0%
distribute-rgt-neg-in41.0%
Simplified41.0%
Final simplification41.6%
(FPCore (x eps)
:precision binary64
(if (<= x -470.0)
(/ (/ (expm1 (- x)) eps) 2.0)
(if (<= x 0.014)
0.5
(/ (+ 1.0 (* (- 1.0 eps) (* x (+ -1.0 (/ -1.0 eps))))) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= -470.0) {
tmp = (expm1(-x) / eps) / 2.0;
} else if (x <= 0.014) {
tmp = 0.5;
} else {
tmp = (1.0 + ((1.0 - eps) * (x * (-1.0 + (-1.0 / eps))))) / 2.0;
}
return tmp;
}
public static double code(double x, double eps) {
double tmp;
if (x <= -470.0) {
tmp = (Math.expm1(-x) / eps) / 2.0;
} else if (x <= 0.014) {
tmp = 0.5;
} else {
tmp = (1.0 + ((1.0 - eps) * (x * (-1.0 + (-1.0 / eps))))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -470.0: tmp = (math.expm1(-x) / eps) / 2.0 elif x <= 0.014: tmp = 0.5 else: tmp = (1.0 + ((1.0 - eps) * (x * (-1.0 + (-1.0 / eps))))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -470.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps) / 2.0); elseif (x <= 0.014) tmp = 0.5; else tmp = Float64(Float64(1.0 + Float64(Float64(1.0 - eps) * Float64(x * Float64(-1.0 + Float64(-1.0 / eps))))) / 2.0); end return tmp end
code[x_, eps_] := If[LessEqual[x, -470.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 0.014], 0.5, N[(N[(1.0 + N[(N[(1.0 - eps), $MachinePrecision] * N[(x * N[(-1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -470:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{\varepsilon}}{2}\\
\mathbf{elif}\;x \leq 0.014:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(1 - \varepsilon\right) \cdot \left(x \cdot \left(-1 + \frac{-1}{\varepsilon}\right)\right)}{2}\\
\end{array}
\end{array}
if x < -470Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 54.8%
Taylor expanded in eps around 0 45.7%
expm1-define45.7%
mul-1-neg45.7%
Simplified45.7%
if -470 < x < 0.0140000000000000003Initial program 51.6%
Simplified51.6%
Taylor expanded in eps around inf 51.5%
mul-1-neg51.5%
distribute-lft-neg-out51.5%
*-commutative51.5%
Simplified51.5%
Taylor expanded in eps around 0 16.0%
Taylor expanded in x around 0 15.2%
if 0.0140000000000000003 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 60.2%
mul-1-neg60.2%
distribute-lft-neg-out60.2%
*-commutative60.2%
Simplified60.2%
Taylor expanded in eps around 0 23.5%
Taylor expanded in x around 0 10.6%
mul-1-neg10.6%
unsub-neg10.6%
associate-*r*10.6%
Simplified10.6%
Final simplification18.1%
(FPCore (x eps) :precision binary64 (if (<= x 0.014) 0.5 (/ (+ 1.0 (* (- 1.0 eps) (* x (+ -1.0 (/ -1.0 eps))))) 2.0)))
double code(double x, double eps) {
double tmp;
if (x <= 0.014) {
tmp = 0.5;
} else {
tmp = (1.0 + ((1.0 - eps) * (x * (-1.0 + (-1.0 / eps))))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 0.014d0) then
tmp = 0.5d0
else
tmp = (1.0d0 + ((1.0d0 - eps) * (x * ((-1.0d0) + ((-1.0d0) / eps))))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 0.014) {
tmp = 0.5;
} else {
tmp = (1.0 + ((1.0 - eps) * (x * (-1.0 + (-1.0 / eps))))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 0.014: tmp = 0.5 else: tmp = (1.0 + ((1.0 - eps) * (x * (-1.0 + (-1.0 / eps))))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 0.014) tmp = 0.5; else tmp = Float64(Float64(1.0 + Float64(Float64(1.0 - eps) * Float64(x * Float64(-1.0 + Float64(-1.0 / eps))))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 0.014) tmp = 0.5; else tmp = (1.0 + ((1.0 - eps) * (x * (-1.0 + (-1.0 / eps))))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 0.014], 0.5, N[(N[(1.0 + N[(N[(1.0 - eps), $MachinePrecision] * N[(x * N[(-1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.014:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(1 - \varepsilon\right) \cdot \left(x \cdot \left(-1 + \frac{-1}{\varepsilon}\right)\right)}{2}\\
\end{array}
\end{array}
if x < 0.0140000000000000003Initial program 60.6%
Simplified60.6%
Taylor expanded in eps around inf 60.6%
mul-1-neg60.6%
distribute-lft-neg-out60.6%
*-commutative60.6%
Simplified60.6%
Taylor expanded in eps around 0 23.3%
Taylor expanded in x around 0 12.9%
if 0.0140000000000000003 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 60.2%
mul-1-neg60.2%
distribute-lft-neg-out60.2%
*-commutative60.2%
Simplified60.2%
Taylor expanded in eps around 0 23.5%
Taylor expanded in x around 0 10.6%
mul-1-neg10.6%
unsub-neg10.6%
associate-*r*10.6%
Simplified10.6%
Final simplification12.3%
(FPCore (x eps) :precision binary64 0.5)
double code(double x, double eps) {
return 0.5;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 0.5d0
end function
public static double code(double x, double eps) {
return 0.5;
}
def code(x, eps): return 0.5
function code(x, eps) return 0.5 end
function tmp = code(x, eps) tmp = 0.5; end
code[x_, eps_] := 0.5
\begin{array}{l}
\\
0.5
\end{array}
Initial program 71.2%
Simplified71.2%
Taylor expanded in eps around inf 60.5%
mul-1-neg60.5%
distribute-lft-neg-out60.5%
*-commutative60.5%
Simplified60.5%
Taylor expanded in eps around 0 23.3%
Taylor expanded in x around 0 10.3%
Final simplification10.3%
herbie shell --seed 2024046
(FPCore (x eps)
:name "NMSE Section 6.1 mentioned, A"
:precision binary64
(/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))