
(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 12 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}
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* (+ x 1.0) (exp (- x)))))
(if (<= eps_m 2e-16)
(/ (+ t_0 t_0) 2.0)
(/
(+
(* (- 1.0 (/ -1.0 eps_m)) (exp (- (* eps_m x) x)))
(* (exp (* x (- -1.0 eps_m))) (+ 1.0 (/ -1.0 eps_m))))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = (x + 1.0) * exp(-x);
double tmp;
if (eps_m <= 2e-16) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (((1.0 - (-1.0 / eps_m)) * exp(((eps_m * x) - x))) + (exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = (x + 1.0d0) * exp(-x)
if (eps_m <= 2d-16) then
tmp = (t_0 + t_0) / 2.0d0
else
tmp = (((1.0d0 - ((-1.0d0) / eps_m)) * exp(((eps_m * x) - x))) + (exp((x * ((-1.0d0) - eps_m))) * (1.0d0 + ((-1.0d0) / eps_m)))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = (x + 1.0) * Math.exp(-x);
double tmp;
if (eps_m <= 2e-16) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (((1.0 - (-1.0 / eps_m)) * Math.exp(((eps_m * x) - x))) + (Math.exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = (x + 1.0) * math.exp(-x) tmp = 0 if eps_m <= 2e-16: tmp = (t_0 + t_0) / 2.0 else: tmp = (((1.0 - (-1.0 / eps_m)) * math.exp(((eps_m * x) - x))) + (math.exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(x + 1.0) * exp(Float64(-x))) tmp = 0.0 if (eps_m <= 2e-16) tmp = Float64(Float64(t_0 + t_0) / 2.0); else tmp = Float64(Float64(Float64(Float64(1.0 - Float64(-1.0 / eps_m)) * exp(Float64(Float64(eps_m * x) - x))) + Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(1.0 + Float64(-1.0 / eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = (x + 1.0) * exp(-x); tmp = 0.0; if (eps_m <= 2e-16) tmp = (t_0 + t_0) / 2.0; else tmp = (((1.0 - (-1.0 / eps_m)) * exp(((eps_m * x) - x))) + (exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(x + 1.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps$95$m, 2e-16], N[(N[(t$95$0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(eps$95$m * x), $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \left(x + 1\right) \cdot e^{-x}\\
\mathbf{if}\;eps_m \leq 2 \cdot 10^{-16}:\\
\;\;\;\;\frac{t_0 + t_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{-1}{eps_m}\right) \cdot e^{eps_m \cdot x - x} + e^{x \cdot \left(-1 - eps_m\right)} \cdot \left(1 + \frac{-1}{eps_m}\right)}{2}\\
\end{array}
\end{array}
if eps < 2e-16Initial program 61.6%
Simplified61.6%
Taylor expanded in eps around 0 70.2%
Simplified71.3%
if 2e-16 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
Final simplification79.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* (+ x 1.0) (exp (- x)))))
(if (<= eps_m 5e-17)
(/ (+ t_0 t_0) 2.0)
(/
(+
(* (- 1.0 (/ -1.0 eps_m)) (exp (* x (+ eps_m -1.0))))
(* (exp (* x (- -1.0 eps_m))) (+ 1.0 (/ -1.0 eps_m))))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = (x + 1.0) * exp(-x);
double tmp;
if (eps_m <= 5e-17) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (((1.0 - (-1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = (x + 1.0d0) * exp(-x)
if (eps_m <= 5d-17) then
tmp = (t_0 + t_0) / 2.0d0
else
tmp = (((1.0d0 - ((-1.0d0) / eps_m)) * exp((x * (eps_m + (-1.0d0))))) + (exp((x * ((-1.0d0) - eps_m))) * (1.0d0 + ((-1.0d0) / eps_m)))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = (x + 1.0) * Math.exp(-x);
double tmp;
if (eps_m <= 5e-17) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (((1.0 - (-1.0 / eps_m)) * Math.exp((x * (eps_m + -1.0)))) + (Math.exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = (x + 1.0) * math.exp(-x) tmp = 0 if eps_m <= 5e-17: tmp = (t_0 + t_0) / 2.0 else: tmp = (((1.0 - (-1.0 / eps_m)) * math.exp((x * (eps_m + -1.0)))) + (math.exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(x + 1.0) * exp(Float64(-x))) tmp = 0.0 if (eps_m <= 5e-17) tmp = Float64(Float64(t_0 + t_0) / 2.0); else tmp = Float64(Float64(Float64(Float64(1.0 - Float64(-1.0 / eps_m)) * exp(Float64(x * Float64(eps_m + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(1.0 + Float64(-1.0 / eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = (x + 1.0) * exp(-x); tmp = 0.0; if (eps_m <= 5e-17) tmp = (t_0 + t_0) / 2.0; else tmp = (((1.0 - (-1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(x + 1.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps$95$m, 5e-17], N[(N[(t$95$0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \left(x + 1\right) \cdot e^{-x}\\
\mathbf{if}\;eps_m \leq 5 \cdot 10^{-17}:\\
\;\;\;\;\frac{t_0 + t_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{-1}{eps_m}\right) \cdot e^{x \cdot \left(eps_m + -1\right)} + e^{x \cdot \left(-1 - eps_m\right)} \cdot \left(1 + \frac{-1}{eps_m}\right)}{2}\\
\end{array}
\end{array}
if eps < 4.9999999999999999e-17Initial program 61.6%
Simplified61.6%
Taylor expanded in eps around 0 70.2%
Simplified71.3%
if 4.9999999999999999e-17 < eps Initial program 100.0%
Final simplification79.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* (+ x 1.0) (exp (- x)))))
(if (<= eps_m 0.0054)
(/ (+ t_0 t_0) 2.0)
(/ (+ (exp (* eps_m x)) (exp (* x (- -1.0 eps_m)))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = (x + 1.0) * exp(-x);
double tmp;
if (eps_m <= 0.0054) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (exp((eps_m * x)) + exp((x * (-1.0 - eps_m)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = (x + 1.0d0) * exp(-x)
if (eps_m <= 0.0054d0) then
tmp = (t_0 + t_0) / 2.0d0
else
tmp = (exp((eps_m * x)) + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = (x + 1.0) * Math.exp(-x);
double tmp;
if (eps_m <= 0.0054) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (Math.exp((eps_m * x)) + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = (x + 1.0) * math.exp(-x) tmp = 0 if eps_m <= 0.0054: tmp = (t_0 + t_0) / 2.0 else: tmp = (math.exp((eps_m * x)) + math.exp((x * (-1.0 - eps_m)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(x + 1.0) * exp(Float64(-x))) tmp = 0.0 if (eps_m <= 0.0054) tmp = Float64(Float64(t_0 + t_0) / 2.0); else tmp = Float64(Float64(exp(Float64(eps_m * x)) + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = (x + 1.0) * exp(-x); tmp = 0.0; if (eps_m <= 0.0054) tmp = (t_0 + t_0) / 2.0; else tmp = (exp((eps_m * x)) + exp((x * (-1.0 - eps_m)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(x + 1.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps$95$m, 0.0054], N[(N[(t$95$0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \left(x + 1\right) \cdot e^{-x}\\
\mathbf{if}\;eps_m \leq 0.0054:\\
\;\;\;\;\frac{t_0 + t_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{eps_m \cdot x} + e^{x \cdot \left(-1 - eps_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 0.0054000000000000003Initial program 62.3%
Simplified62.3%
Taylor expanded in eps around 0 70.7%
Simplified71.7%
if 0.0054000000000000003 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 99.4%
Taylor expanded in eps around inf 99.5%
mul-1-neg99.5%
*-commutative99.5%
distribute-lft-neg-in99.5%
Simplified99.5%
Taylor expanded in x around inf 99.5%
Final simplification79.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 1.1e+154) (/ (+ (exp (* eps_m x)) (exp (* eps_m (- x)))) 2.0) (/ (/ 0.0 eps_m) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.1e+154) {
tmp = (exp((eps_m * x)) + exp((eps_m * -x))) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 1.1d+154) then
tmp = (exp((eps_m * x)) + exp((eps_m * -x))) / 2.0d0
else
tmp = (0.0d0 / eps_m) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 1.1e+154) {
tmp = (Math.exp((eps_m * x)) + Math.exp((eps_m * -x))) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.1e+154: tmp = (math.exp((eps_m * x)) + math.exp((eps_m * -x))) / 2.0 else: tmp = (0.0 / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.1e+154) tmp = Float64(Float64(exp(Float64(eps_m * x)) + exp(Float64(eps_m * Float64(-x)))) / 2.0); else tmp = Float64(Float64(0.0 / eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1.1e+154) tmp = (exp((eps_m * x)) + exp((eps_m * -x))) / 2.0; else tmp = (0.0 / eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.1e+154], N[(N[(N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(0.0 / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.1 \cdot 10^{+154}:\\
\;\;\;\;\frac{e^{eps_m \cdot x} + e^{eps_m \cdot \left(-x\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0}{eps_m}}{2}\\
\end{array}
\end{array}
if x < 1.1000000000000001e154Initial program 69.4%
Simplified69.4%
Taylor expanded in eps around inf 97.9%
Taylor expanded in eps around inf 90.7%
*-commutative90.7%
Simplified90.7%
Taylor expanded in x around inf 90.7%
cancel-sign-sub-inv90.7%
metadata-eval90.7%
*-lft-identity90.7%
+-commutative90.7%
mul-1-neg90.7%
distribute-rgt-neg-in90.7%
mul-1-neg90.7%
distribute-rgt-neg-in90.7%
sub-neg90.7%
mul-1-neg90.7%
distribute-neg-in90.7%
metadata-eval90.7%
mul-1-neg90.7%
remove-double-neg90.7%
Simplified90.7%
Taylor expanded in eps around inf 90.7%
*-commutative90.7%
Simplified90.7%
if 1.1000000000000001e154 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 75.4%
Taylor expanded in x around 0 75.4%
Final simplification89.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* eps_m (- x))) (exp (* x (+ eps_m -1.0)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((eps_m * -x)) + exp((x * (eps_m + -1.0)))) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = (exp((eps_m * -x)) + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((eps_m * -x)) + Math.exp((x * (eps_m + -1.0)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((eps_m * -x)) + math.exp((x * (eps_m + -1.0)))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(eps_m * Float64(-x))) + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((eps_m * -x)) + exp((x * (eps_m + -1.0)))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{eps_m \cdot \left(-x\right)} + e^{x \cdot \left(eps_m + -1\right)}}{2}
\end{array}
Initial program 72.7%
Simplified72.7%
Taylor expanded in eps around inf 98.2%
Taylor expanded in eps around inf 87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in x around inf 87.2%
cancel-sign-sub-inv87.2%
metadata-eval87.2%
*-lft-identity87.2%
+-commutative87.2%
mul-1-neg87.2%
distribute-rgt-neg-in87.2%
mul-1-neg87.2%
distribute-rgt-neg-in87.2%
sub-neg87.2%
mul-1-neg87.2%
distribute-neg-in87.2%
metadata-eval87.2%
mul-1-neg87.2%
remove-double-neg87.2%
Simplified87.2%
Final simplification87.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -85000000.0)
(/ (/ (expm1 (- x)) eps_m) 2.0)
(if (<= x 1.1e+154)
(/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0)
(/ (/ 0.0 eps_m) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -85000000.0) {
tmp = (expm1(-x) / eps_m) / 2.0;
} else if (x <= 1.1e+154) {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -85000000.0) {
tmp = (Math.expm1(-x) / eps_m) / 2.0;
} else if (x <= 1.1e+154) {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -85000000.0: tmp = (math.expm1(-x) / eps_m) / 2.0 elif x <= 1.1e+154: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 else: tmp = (0.0 / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -85000000.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps_m) / 2.0); elseif (x <= 1.1e+154) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); else tmp = Float64(Float64(0.0 / eps_m) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -85000000.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.1e+154], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(0.0 / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -85000000:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{eps_m}}{2}\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+154}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps_m + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0}{eps_m}}{2}\\
\end{array}
\end{array}
if x < -8.5e7Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 66.9%
Taylor expanded in eps around 0 34.2%
expm1-def34.2%
mul-1-neg34.2%
Simplified34.2%
if -8.5e7 < x < 1.1000000000000001e154Initial program 63.2%
Simplified63.2%
Taylor expanded in x around 0 42.3%
Taylor expanded in eps around inf 75.9%
mul-1-neg75.9%
distribute-rgt-neg-in75.9%
sub-neg75.9%
mul-1-neg75.9%
distribute-neg-in75.9%
metadata-eval75.9%
mul-1-neg75.9%
remove-double-neg75.9%
Simplified75.9%
if 1.1000000000000001e154 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 75.4%
Taylor expanded in x around 0 75.4%
Final simplification69.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -4e-257)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(if (<= x 3.3e+152)
(/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0)
(/ (/ 0.0 eps_m) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -4e-257) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 3.3e+152) {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-4d-257)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if (x <= 3.3d+152) then
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
else
tmp = (0.0d0 / eps_m) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -4e-257) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 3.3e+152) {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -4e-257: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif x <= 3.3e+152: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 else: tmp = (0.0 / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -4e-257) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif (x <= 3.3e+152) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); else tmp = Float64(Float64(0.0 / eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -4e-257) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif (x <= 3.3e+152) tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; else tmp = (0.0 / eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -4e-257], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3.3e+152], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(0.0 / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-257}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps_m\right)}}{2}\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{+152}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps_m + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0}{eps_m}}{2}\\
\end{array}
\end{array}
if x < -3.9999999999999999e-257Initial program 69.5%
Simplified69.5%
Taylor expanded in x around 0 35.4%
Taylor expanded in eps around inf 62.2%
Taylor expanded in eps around -inf 62.2%
sub-neg62.2%
mul-1-neg62.2%
remove-double-neg62.2%
mul-1-neg62.2%
distribute-rgt-neg-in62.2%
sub-neg62.2%
neg-mul-162.2%
remove-double-neg62.2%
distribute-neg-in62.2%
metadata-eval62.2%
sub-neg62.2%
Simplified62.2%
if -3.9999999999999999e-257 < x < 3.3000000000000001e152Initial program 69.3%
Simplified69.3%
Taylor expanded in x around 0 42.5%
Taylor expanded in eps around inf 73.0%
mul-1-neg73.0%
distribute-rgt-neg-in73.0%
sub-neg73.0%
mul-1-neg73.0%
distribute-neg-in73.0%
metadata-eval73.0%
mul-1-neg73.0%
remove-double-neg73.0%
Simplified73.0%
if 3.3000000000000001e152 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 75.4%
Taylor expanded in x around 0 75.4%
Final simplification68.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -85000000.0)
(/ (/ (expm1 (- x)) eps_m) 2.0)
(if (<= x 60000000000.0)
1.0
(if (<= x 5e+153) (/ (/ (expm1 x) eps_m) 2.0) (/ (/ 0.0 eps_m) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -85000000.0) {
tmp = (expm1(-x) / eps_m) / 2.0;
} else if (x <= 60000000000.0) {
tmp = 1.0;
} else if (x <= 5e+153) {
tmp = (expm1(x) / eps_m) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -85000000.0) {
tmp = (Math.expm1(-x) / eps_m) / 2.0;
} else if (x <= 60000000000.0) {
tmp = 1.0;
} else if (x <= 5e+153) {
tmp = (Math.expm1(x) / eps_m) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -85000000.0: tmp = (math.expm1(-x) / eps_m) / 2.0 elif x <= 60000000000.0: tmp = 1.0 elif x <= 5e+153: tmp = (math.expm1(x) / eps_m) / 2.0 else: tmp = (0.0 / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -85000000.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps_m) / 2.0); elseif (x <= 60000000000.0) tmp = 1.0; elseif (x <= 5e+153) tmp = Float64(Float64(expm1(x) / eps_m) / 2.0); else tmp = Float64(Float64(0.0 / eps_m) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -85000000.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 60000000000.0], 1.0, If[LessEqual[x, 5e+153], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(0.0 / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -85000000:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{eps_m}}{2}\\
\mathbf{elif}\;x \leq 60000000000:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+153}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{eps_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0}{eps_m}}{2}\\
\end{array}
\end{array}
if x < -8.5e7Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 66.9%
Taylor expanded in eps around 0 34.2%
expm1-def34.2%
mul-1-neg34.2%
Simplified34.2%
if -8.5e7 < x < 6e10Initial program 53.1%
Simplified53.1%
Taylor expanded in x around 0 73.2%
if 6e10 < x < 5.00000000000000018e153Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 40.0%
Taylor expanded in x around 0 1.7%
sub-neg1.7%
neg-mul-11.7%
add-sqr-sqrt0.0%
sqrt-unprod42.1%
sqr-neg42.1%
sqrt-unprod42.1%
add-sqr-sqrt42.1%
metadata-eval42.1%
Applied egg-rr42.1%
rem-square-sqrt42.1%
fma-udef42.1%
metadata-eval42.1%
fma-neg42.1%
rem-square-sqrt42.1%
expm1-def42.1%
Simplified42.1%
if 5.00000000000000018e153 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 75.4%
Taylor expanded in x around 0 75.4%
Final simplification62.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 9e-8) (/ (+ 2.0 (* x (- -1.0 eps_m))) 2.0) (if (<= x 2e+150) (/ (/ (expm1 x) eps_m) 2.0) (/ (/ 0.0 eps_m) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 9e-8) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else if (x <= 2e+150) {
tmp = (expm1(x) / eps_m) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 9e-8) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else if (x <= 2e+150) {
tmp = (Math.expm1(x) / eps_m) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 9e-8: tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0 elif x <= 2e+150: tmp = (math.expm1(x) / eps_m) / 2.0 else: tmp = (0.0 / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 9e-8) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 - eps_m))) / 2.0); elseif (x <= 2e+150) tmp = Float64(Float64(expm1(x) / eps_m) / 2.0); else tmp = Float64(Float64(0.0 / eps_m) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 9e-8], N[(N[(2.0 + N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2e+150], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(0.0 / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9 \cdot 10^{-8}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 - eps_m\right)}{2}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+150}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{eps_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0}{eps_m}}{2}\\
\end{array}
\end{array}
if x < 8.99999999999999986e-8Initial program 61.8%
Simplified61.8%
Taylor expanded in x around 0 37.1%
Taylor expanded in eps around inf 72.9%
Taylor expanded in x around 0 62.8%
mul-1-neg62.8%
+-commutative62.8%
Simplified62.8%
if 8.99999999999999986e-8 < x < 1.99999999999999996e150Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 40.9%
Taylor expanded in x around 0 1.7%
sub-neg1.7%
neg-mul-11.7%
add-sqr-sqrt0.0%
sqrt-unprod38.5%
sqr-neg38.5%
sqrt-unprod38.5%
add-sqr-sqrt38.5%
metadata-eval38.5%
Applied egg-rr38.5%
rem-square-sqrt38.5%
fma-udef38.5%
metadata-eval38.5%
fma-neg38.5%
rem-square-sqrt38.5%
expm1-def38.5%
Simplified38.5%
if 1.99999999999999996e150 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 75.4%
Taylor expanded in x around 0 75.4%
Final simplification59.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 9e-8) (/ (+ 2.0 (* x (- -1.0 eps_m))) 2.0) (/ (/ 0.0 eps_m) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 9e-8) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 9d-8) then
tmp = (2.0d0 + (x * ((-1.0d0) - eps_m))) / 2.0d0
else
tmp = (0.0d0 / eps_m) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 9e-8) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 9e-8: tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0 else: tmp = (0.0 / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 9e-8) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 - eps_m))) / 2.0); else tmp = Float64(Float64(0.0 / eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 9e-8) tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0; else tmp = (0.0 / eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 9e-8], N[(N[(2.0 + N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(0.0 / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9 \cdot 10^{-8}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 - eps_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0}{eps_m}}{2}\\
\end{array}
\end{array}
if x < 8.99999999999999986e-8Initial program 61.8%
Simplified61.8%
Taylor expanded in x around 0 37.1%
Taylor expanded in eps around inf 72.9%
Taylor expanded in x around 0 62.8%
mul-1-neg62.8%
+-commutative62.8%
Simplified62.8%
if 8.99999999999999986e-8 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 54.1%
Taylor expanded in x around 0 54.2%
Final simplification60.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.0) (/ (- 2.0 x) 2.0) (/ (/ 0.0 eps_m) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 - x) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 2.0d0) then
tmp = (2.0d0 - x) / 2.0d0
else
tmp = (0.0d0 / eps_m) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 - x) / 2.0;
} else {
tmp = (0.0 / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.0: tmp = (2.0 - x) / 2.0 else: tmp = (0.0 / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.0) tmp = Float64(Float64(2.0 - x) / 2.0); else tmp = Float64(Float64(0.0 / eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 2.0) tmp = (2.0 - x) / 2.0; else tmp = (0.0 / eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 2.0], N[(N[(2.0 - x), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(0.0 / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{2 - x}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{0}{eps_m}}{2}\\
\end{array}
\end{array}
if x < 2Initial program 62.3%
Simplified62.3%
Taylor expanded in eps around inf 97.5%
Taylor expanded in eps around inf 97.5%
mul-1-neg97.5%
*-commutative97.5%
distribute-lft-neg-in97.5%
Simplified97.5%
Taylor expanded in x around 0 59.7%
mul-1-neg59.7%
unsub-neg59.7%
Simplified59.7%
if 2 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 55.6%
Taylor expanded in x around 0 55.6%
Final simplification58.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 1.0)
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 1.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = 1.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 1.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return 1.0
eps_m = abs(eps) function code(x, eps_m) return 1.0 end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 1.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 1.0
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
1
\end{array}
Initial program 72.7%
Simplified72.7%
Taylor expanded in x around 0 43.9%
Final simplification43.9%
herbie shell --seed 2023315
(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))