
(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 14 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 (if (<= eps_m 2e-89) (* 0.5 (/ (* eps_m (* 2.0 (/ (+ x 1.0) (exp x)))) eps_m)) (* 0.5 (+ (exp (* x (+ -1.0 eps_m))) (exp (* eps_m (- x)))))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 2e-89) {
tmp = 0.5 * ((eps_m * (2.0 * ((x + 1.0) / exp(x)))) / eps_m);
} else {
tmp = 0.5 * (exp((x * (-1.0 + eps_m))) + exp((eps_m * -x)));
}
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 (eps_m <= 2d-89) then
tmp = 0.5d0 * ((eps_m * (2.0d0 * ((x + 1.0d0) / exp(x)))) / eps_m)
else
tmp = 0.5d0 * (exp((x * ((-1.0d0) + eps_m))) + exp((eps_m * -x)))
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 2e-89) {
tmp = 0.5 * ((eps_m * (2.0 * ((x + 1.0) / Math.exp(x)))) / eps_m);
} else {
tmp = 0.5 * (Math.exp((x * (-1.0 + eps_m))) + Math.exp((eps_m * -x)));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 2e-89: tmp = 0.5 * ((eps_m * (2.0 * ((x + 1.0) / math.exp(x)))) / eps_m) else: tmp = 0.5 * (math.exp((x * (-1.0 + eps_m))) + math.exp((eps_m * -x))) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 2e-89) tmp = Float64(0.5 * Float64(Float64(eps_m * Float64(2.0 * Float64(Float64(x + 1.0) / exp(x)))) / eps_m)); else tmp = Float64(0.5 * Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + exp(Float64(eps_m * Float64(-x))))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 2e-89) tmp = 0.5 * ((eps_m * (2.0 * ((x + 1.0) / exp(x)))) / eps_m); else tmp = 0.5 * (exp((x * (-1.0 + eps_m))) + exp((eps_m * -x))); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 2e-89], N[(0.5 * N[(N[(eps$95$m * N[(2.0 * N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 2 \cdot 10^{-89}:\\
\;\;\;\;0.5 \cdot \frac{eps\_m \cdot \left(2 \cdot \frac{x + 1}{e^{x}}\right)}{eps\_m}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(e^{x \cdot \left(-1 + eps\_m\right)} + e^{eps\_m \cdot \left(-x\right)}\right)\\
\end{array}
\end{array}
if eps < 2.00000000000000008e-89Initial program 59.3%
Simplified44.5%
Taylor expanded in eps around 0 27.6%
Simplified68.6%
if 2.00000000000000008e-89 < eps Initial program 93.6%
Simplified68.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification81.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (* (+ (pow (pow (exp (* x (- -1.0 eps_m))) 3.0) 0.3333333333333333) (exp (* x (+ -1.0 eps_m)))) 0.5))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (pow(pow(exp((x * (-1.0 - eps_m))), 3.0), 0.3333333333333333) + exp((x * (-1.0 + eps_m)))) * 0.5;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = (((exp((x * ((-1.0d0) - eps_m))) ** 3.0d0) ** 0.3333333333333333d0) + exp((x * ((-1.0d0) + eps_m)))) * 0.5d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.pow(Math.pow(Math.exp((x * (-1.0 - eps_m))), 3.0), 0.3333333333333333) + Math.exp((x * (-1.0 + eps_m)))) * 0.5;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.pow(math.pow(math.exp((x * (-1.0 - eps_m))), 3.0), 0.3333333333333333) + math.exp((x * (-1.0 + eps_m)))) * 0.5
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(((exp(Float64(x * Float64(-1.0 - eps_m))) ^ 3.0) ^ 0.3333333333333333) + exp(Float64(x * Float64(-1.0 + eps_m)))) * 0.5) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (((exp((x * (-1.0 - eps_m))) ^ 3.0) ^ 0.3333333333333333) + exp((x * (-1.0 + eps_m)))) * 0.5; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Power[N[Power[N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\left({\left({\left(e^{x \cdot \left(-1 - eps\_m\right)}\right)}^{3}\right)}^{0.3333333333333333} + e^{x \cdot \left(-1 + eps\_m\right)}\right) \cdot 0.5
\end{array}
Initial program 73.5%
Simplified54.2%
Taylor expanded in eps around inf 99.2%
exp-prod99.2%
Applied egg-rr99.2%
add-cbrt-cube99.2%
pow1/399.2%
pow399.2%
pow-exp99.2%
*-commutative99.2%
associate-*r*99.2%
distribute-lft-in99.2%
metadata-eval99.2%
neg-mul-199.2%
Applied egg-rr99.2%
Final simplification99.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (* 0.5 (+ (exp (* x (+ -1.0 eps_m))) (pow (exp -1.0) (* x (+ eps_m 1.0))))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 0.5 * (exp((x * (-1.0 + eps_m))) + pow(exp(-1.0), (x * (eps_m + 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 = 0.5d0 * (exp((x * ((-1.0d0) + eps_m))) + (exp((-1.0d0)) ** (x * (eps_m + 1.0d0))))
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 0.5 * (Math.exp((x * (-1.0 + eps_m))) + Math.pow(Math.exp(-1.0), (x * (eps_m + 1.0))));
}
eps_m = math.fabs(eps) def code(x, eps_m): return 0.5 * (math.exp((x * (-1.0 + eps_m))) + math.pow(math.exp(-1.0), (x * (eps_m + 1.0))))
eps_m = abs(eps) function code(x, eps_m) return Float64(0.5 * Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + (exp(-1.0) ^ Float64(x * Float64(eps_m + 1.0))))) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 0.5 * (exp((x * (-1.0 + eps_m))) + (exp(-1.0) ^ (x * (eps_m + 1.0)))); end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(0.5 * N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Power[N[Exp[-1.0], $MachinePrecision], N[(x * N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
0.5 \cdot \left(e^{x \cdot \left(-1 + eps\_m\right)} + {\left(e^{-1}\right)}^{\left(x \cdot \left(eps\_m + 1\right)\right)}\right)
\end{array}
Initial program 73.5%
Simplified54.2%
Taylor expanded in eps around inf 99.2%
exp-prod99.2%
Applied egg-rr99.2%
Final simplification99.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (* 0.5 (+ (exp (* x (+ -1.0 eps_m))) (exp (* x (- -1.0 eps_m))))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 0.5 * (exp((x * (-1.0 + eps_m))) + exp((x * (-1.0 - eps_m))));
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = 0.5d0 * (exp((x * ((-1.0d0) + eps_m))) + exp((x * ((-1.0d0) - eps_m))))
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 0.5 * (Math.exp((x * (-1.0 + eps_m))) + Math.exp((x * (-1.0 - eps_m))));
}
eps_m = math.fabs(eps) def code(x, eps_m): return 0.5 * (math.exp((x * (-1.0 + eps_m))) + math.exp((x * (-1.0 - eps_m))))
eps_m = abs(eps) function code(x, eps_m) return Float64(0.5 * Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + exp(Float64(x * Float64(-1.0 - eps_m))))) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 0.5 * (exp((x * (-1.0 + eps_m))) + exp((x * (-1.0 - eps_m)))); end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(0.5 * N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
0.5 \cdot \left(e^{x \cdot \left(-1 + eps\_m\right)} + e^{x \cdot \left(-1 - eps\_m\right)}\right)
\end{array}
Initial program 73.5%
Simplified54.2%
Taylor expanded in eps around inf 99.2%
Final simplification99.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.7e-282)
(/ (+ 1.0 (exp (* eps_m (- x)))) 2.0)
(if (<= x 8.4e+70)
(* 0.5 (+ 1.0 (exp (* x (+ -1.0 eps_m)))))
(/
(* x (+ (/ 1.0 eps_m) (* (+ -1.0 eps_m) (+ 1.0 (/ 1.0 eps_m)))))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.7e-282) {
tmp = (1.0 + exp((eps_m * -x))) / 2.0;
} else if (x <= 8.4e+70) {
tmp = 0.5 * (1.0 + exp((x * (-1.0 + eps_m))));
} else {
tmp = (x * ((1.0 / eps_m) + ((-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) :: tmp
if (x <= (-1.7d-282)) then
tmp = (1.0d0 + exp((eps_m * -x))) / 2.0d0
else if (x <= 8.4d+70) then
tmp = 0.5d0 * (1.0d0 + exp((x * ((-1.0d0) + eps_m))))
else
tmp = (x * ((1.0d0 / eps_m) + (((-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 tmp;
if (x <= -1.7e-282) {
tmp = (1.0 + Math.exp((eps_m * -x))) / 2.0;
} else if (x <= 8.4e+70) {
tmp = 0.5 * (1.0 + Math.exp((x * (-1.0 + eps_m))));
} else {
tmp = (x * ((1.0 / eps_m) + ((-1.0 + eps_m) * (1.0 + (1.0 / eps_m))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.7e-282: tmp = (1.0 + math.exp((eps_m * -x))) / 2.0 elif x <= 8.4e+70: tmp = 0.5 * (1.0 + math.exp((x * (-1.0 + eps_m)))) else: tmp = (x * ((1.0 / eps_m) + ((-1.0 + eps_m) * (1.0 + (1.0 / eps_m))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.7e-282) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * Float64(-x)))) / 2.0); elseif (x <= 8.4e+70) tmp = Float64(0.5 * Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m))))); else tmp = Float64(Float64(x * Float64(Float64(1.0 / eps_m) + Float64(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) tmp = 0.0; if (x <= -1.7e-282) tmp = (1.0 + exp((eps_m * -x))) / 2.0; elseif (x <= 8.4e+70) tmp = 0.5 * (1.0 + exp((x * (-1.0 + eps_m)))); else tmp = (x * ((1.0 / eps_m) + ((-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_] := If[LessEqual[x, -1.7e-282], N[(N[(1.0 + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8.4e+70], N[(0.5 * N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(-1.0 + eps$95$m), $MachinePrecision] * N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{-282}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\mathbf{elif}\;x \leq 8.4 \cdot 10^{+70}:\\
\;\;\;\;0.5 \cdot \left(1 + e^{x \cdot \left(-1 + eps\_m\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(\frac{1}{eps\_m} + \left(-1 + eps\_m\right) \cdot \left(1 + \frac{1}{eps\_m}\right)\right)}{2}\\
\end{array}
\end{array}
if x < -1.69999999999999999e-282Initial program 71.6%
Taylor expanded in x around 0 49.2%
Taylor expanded in eps around inf 77.4%
Taylor expanded in eps around inf 77.6%
*-commutative99.8%
Simplified77.6%
if -1.69999999999999999e-282 < x < 8.4000000000000003e70Initial program 57.3%
Simplified27.1%
Taylor expanded in eps around inf 98.1%
Taylor expanded in x around 0 84.0%
if 8.4000000000000003e70 < x Initial program 100.0%
Taylor expanded in x around 0 3.2%
Taylor expanded in eps around 0 22.5%
Taylor expanded in x around inf 67.9%
Final simplification77.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 2.4e-258)
(* 0.5 (+ 1.0 (exp (- x))))
(if (<= x 5.1e+70)
(* 0.5 (+ 1.0 (exp (* x (+ -1.0 eps_m)))))
(/
(* x (+ (/ 1.0 eps_m) (* (+ -1.0 eps_m) (+ 1.0 (/ 1.0 eps_m)))))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.4e-258) {
tmp = 0.5 * (1.0 + exp(-x));
} else if (x <= 5.1e+70) {
tmp = 0.5 * (1.0 + exp((x * (-1.0 + eps_m))));
} else {
tmp = (x * ((1.0 / eps_m) + ((-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) :: tmp
if (x <= 2.4d-258) then
tmp = 0.5d0 * (1.0d0 + exp(-x))
else if (x <= 5.1d+70) then
tmp = 0.5d0 * (1.0d0 + exp((x * ((-1.0d0) + eps_m))))
else
tmp = (x * ((1.0d0 / eps_m) + (((-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 tmp;
if (x <= 2.4e-258) {
tmp = 0.5 * (1.0 + Math.exp(-x));
} else if (x <= 5.1e+70) {
tmp = 0.5 * (1.0 + Math.exp((x * (-1.0 + eps_m))));
} else {
tmp = (x * ((1.0 / eps_m) + ((-1.0 + eps_m) * (1.0 + (1.0 / eps_m))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.4e-258: tmp = 0.5 * (1.0 + math.exp(-x)) elif x <= 5.1e+70: tmp = 0.5 * (1.0 + math.exp((x * (-1.0 + eps_m)))) else: tmp = (x * ((1.0 / eps_m) + ((-1.0 + eps_m) * (1.0 + (1.0 / eps_m))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.4e-258) tmp = Float64(0.5 * Float64(1.0 + exp(Float64(-x)))); elseif (x <= 5.1e+70) tmp = Float64(0.5 * Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m))))); else tmp = Float64(Float64(x * Float64(Float64(1.0 / eps_m) + Float64(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) tmp = 0.0; if (x <= 2.4e-258) tmp = 0.5 * (1.0 + exp(-x)); elseif (x <= 5.1e+70) tmp = 0.5 * (1.0 + exp((x * (-1.0 + eps_m)))); else tmp = (x * ((1.0 / eps_m) + ((-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_] := If[LessEqual[x, 2.4e-258], N[(0.5 * N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.1e+70], N[(0.5 * N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(-1.0 + eps$95$m), $MachinePrecision] * N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.4 \cdot 10^{-258}:\\
\;\;\;\;0.5 \cdot \left(1 + e^{-x}\right)\\
\mathbf{elif}\;x \leq 5.1 \cdot 10^{+70}:\\
\;\;\;\;0.5 \cdot \left(1 + e^{x \cdot \left(-1 + eps\_m\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(\frac{1}{eps\_m} + \left(-1 + eps\_m\right) \cdot \left(1 + \frac{1}{eps\_m}\right)\right)}{2}\\
\end{array}
\end{array}
if x < 2.4000000000000002e-258Initial program 66.8%
Simplified44.0%
Taylor expanded in eps around inf 99.8%
Taylor expanded in x around 0 73.5%
Taylor expanded in eps around 0 83.4%
mul-1-neg83.4%
Simplified83.4%
if 2.4000000000000002e-258 < x < 5.10000000000000014e70Initial program 61.3%
Simplified30.9%
Taylor expanded in eps around inf 97.6%
Taylor expanded in x around 0 80.4%
if 5.10000000000000014e70 < x Initial program 100.0%
Taylor expanded in x around 0 3.2%
Taylor expanded in eps around 0 22.5%
Taylor expanded in x around inf 67.9%
Final simplification78.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 7.0) (* 0.5 (+ 1.0 (exp (- x)))) (/ (* x (+ (/ 1.0 eps_m) (* (+ -1.0 eps_m) (+ 1.0 (/ 1.0 eps_m))))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 7.0) {
tmp = 0.5 * (1.0 + exp(-x));
} else {
tmp = (x * ((1.0 / eps_m) + ((-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) :: tmp
if (x <= 7.0d0) then
tmp = 0.5d0 * (1.0d0 + exp(-x))
else
tmp = (x * ((1.0d0 / eps_m) + (((-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 tmp;
if (x <= 7.0) {
tmp = 0.5 * (1.0 + Math.exp(-x));
} else {
tmp = (x * ((1.0 / eps_m) + ((-1.0 + eps_m) * (1.0 + (1.0 / eps_m))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 7.0: tmp = 0.5 * (1.0 + math.exp(-x)) else: tmp = (x * ((1.0 / eps_m) + ((-1.0 + eps_m) * (1.0 + (1.0 / eps_m))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 7.0) tmp = Float64(0.5 * Float64(1.0 + exp(Float64(-x)))); else tmp = Float64(Float64(x * Float64(Float64(1.0 / eps_m) + Float64(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) tmp = 0.0; if (x <= 7.0) tmp = 0.5 * (1.0 + exp(-x)); else tmp = (x * ((1.0 / eps_m) + ((-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_] := If[LessEqual[x, 7.0], N[(0.5 * N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(-1.0 + eps$95$m), $MachinePrecision] * N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7:\\
\;\;\;\;0.5 \cdot \left(1 + e^{-x}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(\frac{1}{eps\_m} + \left(-1 + eps\_m\right) \cdot \left(1 + \frac{1}{eps\_m}\right)\right)}{2}\\
\end{array}
\end{array}
if x < 7Initial program 62.5%
Simplified35.2%
Taylor expanded in eps around inf 98.9%
Taylor expanded in x around 0 77.9%
Taylor expanded in eps around 0 79.2%
mul-1-neg79.2%
Simplified79.2%
if 7 < x Initial program 100.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in eps around 0 19.6%
Taylor expanded in x around inf 59.7%
Final simplification73.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.0)
(/ (* eps_m x) -2.0)
(if (<= x 4.9e+33)
1.0
(if (or (<= x 5.2e+185) (not (<= x 1.25e+261)))
(* 0.5 (/ 0.0 eps_m))
(/ 1.0 (/ 2.0 (* eps_m x)))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (eps_m * x) / -2.0;
} else if (x <= 4.9e+33) {
tmp = 1.0;
} else if ((x <= 5.2e+185) || !(x <= 1.25e+261)) {
tmp = 0.5 * (0.0 / eps_m);
} else {
tmp = 1.0 / (2.0 / (eps_m * x));
}
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.0d0)) then
tmp = (eps_m * x) / (-2.0d0)
else if (x <= 4.9d+33) then
tmp = 1.0d0
else if ((x <= 5.2d+185) .or. (.not. (x <= 1.25d+261))) then
tmp = 0.5d0 * (0.0d0 / eps_m)
else
tmp = 1.0d0 / (2.0d0 / (eps_m * x))
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.0) {
tmp = (eps_m * x) / -2.0;
} else if (x <= 4.9e+33) {
tmp = 1.0;
} else if ((x <= 5.2e+185) || !(x <= 1.25e+261)) {
tmp = 0.5 * (0.0 / eps_m);
} else {
tmp = 1.0 / (2.0 / (eps_m * x));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.0: tmp = (eps_m * x) / -2.0 elif x <= 4.9e+33: tmp = 1.0 elif (x <= 5.2e+185) or not (x <= 1.25e+261): tmp = 0.5 * (0.0 / eps_m) else: tmp = 1.0 / (2.0 / (eps_m * x)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(eps_m * x) / -2.0); elseif (x <= 4.9e+33) tmp = 1.0; elseif ((x <= 5.2e+185) || !(x <= 1.25e+261)) tmp = Float64(0.5 * Float64(0.0 / eps_m)); else tmp = Float64(1.0 / Float64(2.0 / Float64(eps_m * x))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.0) tmp = (eps_m * x) / -2.0; elseif (x <= 4.9e+33) tmp = 1.0; elseif ((x <= 5.2e+185) || ~((x <= 1.25e+261))) tmp = 0.5 * (0.0 / eps_m); else tmp = 1.0 / (2.0 / (eps_m * x)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.0], N[(N[(eps$95$m * x), $MachinePrecision] / -2.0), $MachinePrecision], If[LessEqual[x, 4.9e+33], 1.0, If[Or[LessEqual[x, 5.2e+185], N[Not[LessEqual[x, 1.25e+261]], $MachinePrecision]], N[(0.5 * N[(0.0 / eps$95$m), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(2.0 / N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{eps\_m \cdot x}{-2}\\
\mathbf{elif}\;x \leq 4.9 \cdot 10^{+33}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+185} \lor \neg \left(x \leq 1.25 \cdot 10^{+261}\right):\\
\;\;\;\;0.5 \cdot \frac{0}{eps\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{2}{eps\_m \cdot x}}\\
\end{array}
\end{array}
if x < -1Initial program 100.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in eps around 0 13.2%
Taylor expanded in eps around inf 13.2%
*-commutative13.2%
Simplified13.2%
frac-2neg13.2%
distribute-rgt-neg-in13.2%
add-sqr-sqrt13.2%
sqrt-unprod72.3%
sqr-neg72.3%
sqrt-unprod40.2%
add-sqr-sqrt40.2%
*-commutative40.2%
metadata-eval40.2%
Applied egg-rr40.2%
if -1 < x < 4.90000000000000014e33Initial program 55.1%
Simplified22.3%
Taylor expanded in x around 0 73.1%
if 4.90000000000000014e33 < x < 5.20000000000000001e185 or 1.25e261 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 50.8%
distribute-rgt1-in50.8%
metadata-eval50.8%
neg-mul-150.8%
mul0-lft50.8%
Simplified50.8%
if 5.20000000000000001e185 < x < 1.25e261Initial program 100.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in eps around 0 30.1%
Taylor expanded in eps around inf 30.0%
*-commutative30.0%
Simplified30.0%
clear-num30.0%
*-commutative30.0%
Applied egg-rr30.0%
Final simplification60.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -0.85)
(/ (* eps_m x) -2.0)
(if (<= x 4.9e+33)
1.0
(if (or (<= x 9.5e+182) (not (<= x 3.5e+263)))
(* 0.5 (/ 0.0 eps_m))
(/ (* eps_m x) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.85) {
tmp = (eps_m * x) / -2.0;
} else if (x <= 4.9e+33) {
tmp = 1.0;
} else if ((x <= 9.5e+182) || !(x <= 3.5e+263)) {
tmp = 0.5 * (0.0 / eps_m);
} else {
tmp = (eps_m * x) / 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 <= (-0.85d0)) then
tmp = (eps_m * x) / (-2.0d0)
else if (x <= 4.9d+33) then
tmp = 1.0d0
else if ((x <= 9.5d+182) .or. (.not. (x <= 3.5d+263))) then
tmp = 0.5d0 * (0.0d0 / eps_m)
else
tmp = (eps_m * x) / 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 <= -0.85) {
tmp = (eps_m * x) / -2.0;
} else if (x <= 4.9e+33) {
tmp = 1.0;
} else if ((x <= 9.5e+182) || !(x <= 3.5e+263)) {
tmp = 0.5 * (0.0 / eps_m);
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.85: tmp = (eps_m * x) / -2.0 elif x <= 4.9e+33: tmp = 1.0 elif (x <= 9.5e+182) or not (x <= 3.5e+263): tmp = 0.5 * (0.0 / eps_m) else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.85) tmp = Float64(Float64(eps_m * x) / -2.0); elseif (x <= 4.9e+33) tmp = 1.0; elseif ((x <= 9.5e+182) || !(x <= 3.5e+263)) tmp = Float64(0.5 * Float64(0.0 / eps_m)); else tmp = Float64(Float64(eps_m * x) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -0.85) tmp = (eps_m * x) / -2.0; elseif (x <= 4.9e+33) tmp = 1.0; elseif ((x <= 9.5e+182) || ~((x <= 3.5e+263))) tmp = 0.5 * (0.0 / eps_m); else tmp = (eps_m * x) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.85], N[(N[(eps$95$m * x), $MachinePrecision] / -2.0), $MachinePrecision], If[LessEqual[x, 4.9e+33], 1.0, If[Or[LessEqual[x, 9.5e+182], N[Not[LessEqual[x, 3.5e+263]], $MachinePrecision]], N[(0.5 * N[(0.0 / eps$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(eps$95$m * x), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.85:\\
\;\;\;\;\frac{eps\_m \cdot x}{-2}\\
\mathbf{elif}\;x \leq 4.9 \cdot 10^{+33}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+182} \lor \neg \left(x \leq 3.5 \cdot 10^{+263}\right):\\
\;\;\;\;0.5 \cdot \frac{0}{eps\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < -0.849999999999999978Initial program 100.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in eps around 0 13.2%
Taylor expanded in eps around inf 13.2%
*-commutative13.2%
Simplified13.2%
frac-2neg13.2%
distribute-rgt-neg-in13.2%
add-sqr-sqrt13.2%
sqrt-unprod72.3%
sqr-neg72.3%
sqrt-unprod40.2%
add-sqr-sqrt40.2%
*-commutative40.2%
metadata-eval40.2%
Applied egg-rr40.2%
if -0.849999999999999978 < x < 4.90000000000000014e33Initial program 55.1%
Simplified22.3%
Taylor expanded in x around 0 73.1%
if 4.90000000000000014e33 < x < 9.50000000000000002e182 or 3.49999999999999999e263 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 50.8%
distribute-rgt1-in50.8%
metadata-eval50.8%
neg-mul-150.8%
mul0-lft50.8%
Simplified50.8%
if 9.50000000000000002e182 < x < 3.49999999999999999e263Initial program 100.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in eps around 0 30.1%
Taylor expanded in eps around inf 30.0%
*-commutative30.0%
Simplified30.0%
Final simplification60.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 2.0)
(/ (+ (* x (- -1.0 eps_m)) 2.0) 2.0)
(if (or (<= x 1.4e+184) (not (<= x 3.5e+266)))
(* 0.5 (/ 0.0 eps_m))
(/ 1.0 (/ 2.0 (* eps_m x))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.0) {
tmp = ((x * (-1.0 - eps_m)) + 2.0) / 2.0;
} else if ((x <= 1.4e+184) || !(x <= 3.5e+266)) {
tmp = 0.5 * (0.0 / eps_m);
} else {
tmp = 1.0 / (2.0 / (eps_m * x));
}
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 = ((x * ((-1.0d0) - eps_m)) + 2.0d0) / 2.0d0
else if ((x <= 1.4d+184) .or. (.not. (x <= 3.5d+266))) then
tmp = 0.5d0 * (0.0d0 / eps_m)
else
tmp = 1.0d0 / (2.0d0 / (eps_m * x))
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 = ((x * (-1.0 - eps_m)) + 2.0) / 2.0;
} else if ((x <= 1.4e+184) || !(x <= 3.5e+266)) {
tmp = 0.5 * (0.0 / eps_m);
} else {
tmp = 1.0 / (2.0 / (eps_m * x));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.0: tmp = ((x * (-1.0 - eps_m)) + 2.0) / 2.0 elif (x <= 1.4e+184) or not (x <= 3.5e+266): tmp = 0.5 * (0.0 / eps_m) else: tmp = 1.0 / (2.0 / (eps_m * x)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.0) tmp = Float64(Float64(Float64(x * Float64(-1.0 - eps_m)) + 2.0) / 2.0); elseif ((x <= 1.4e+184) || !(x <= 3.5e+266)) tmp = Float64(0.5 * Float64(0.0 / eps_m)); else tmp = Float64(1.0 / Float64(2.0 / Float64(eps_m * x))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 2.0) tmp = ((x * (-1.0 - eps_m)) + 2.0) / 2.0; elseif ((x <= 1.4e+184) || ~((x <= 3.5e+266))) tmp = 0.5 * (0.0 / eps_m); else tmp = 1.0 / (2.0 / (eps_m * x)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 2.0], N[(N[(N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.4e+184], N[Not[LessEqual[x, 3.5e+266]], $MachinePrecision]], N[(0.5 * N[(0.0 / eps$95$m), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(2.0 / N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{x \cdot \left(-1 - eps\_m\right) + 2}{2}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+184} \lor \neg \left(x \leq 3.5 \cdot 10^{+266}\right):\\
\;\;\;\;0.5 \cdot \frac{0}{eps\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{2}{eps\_m \cdot x}}\\
\end{array}
\end{array}
if x < 2Initial program 62.5%
Taylor expanded in x around 0 44.5%
Taylor expanded in eps around inf 81.0%
Taylor expanded in x around 0 67.4%
mul-1-neg67.4%
unsub-neg67.4%
+-commutative67.4%
Simplified67.4%
if 2 < x < 1.39999999999999995e184 or 3.50000000000000025e266 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 47.1%
distribute-rgt1-in47.1%
metadata-eval47.1%
neg-mul-147.1%
mul0-lft47.1%
Simplified47.1%
if 1.39999999999999995e184 < x < 3.50000000000000025e266Initial program 100.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in eps around 0 30.1%
Taylor expanded in eps around inf 30.0%
*-commutative30.0%
Simplified30.0%
clear-num30.0%
*-commutative30.0%
Applied egg-rr30.0%
Final simplification60.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 1.12) (/ (+ (* x (- -1.0 eps_m)) 2.0) 2.0) (/ (* x (+ (/ 1.0 eps_m) (* (+ -1.0 eps_m) (+ 1.0 (/ 1.0 eps_m))))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.12) {
tmp = ((x * (-1.0 - eps_m)) + 2.0) / 2.0;
} else {
tmp = (x * ((1.0 / eps_m) + ((-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) :: tmp
if (x <= 1.12d0) then
tmp = ((x * ((-1.0d0) - eps_m)) + 2.0d0) / 2.0d0
else
tmp = (x * ((1.0d0 / eps_m) + (((-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 tmp;
if (x <= 1.12) {
tmp = ((x * (-1.0 - eps_m)) + 2.0) / 2.0;
} else {
tmp = (x * ((1.0 / eps_m) + ((-1.0 + eps_m) * (1.0 + (1.0 / eps_m))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.12: tmp = ((x * (-1.0 - eps_m)) + 2.0) / 2.0 else: tmp = (x * ((1.0 / eps_m) + ((-1.0 + eps_m) * (1.0 + (1.0 / eps_m))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.12) tmp = Float64(Float64(Float64(x * Float64(-1.0 - eps_m)) + 2.0) / 2.0); else tmp = Float64(Float64(x * Float64(Float64(1.0 / eps_m) + Float64(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) tmp = 0.0; if (x <= 1.12) tmp = ((x * (-1.0 - eps_m)) + 2.0) / 2.0; else tmp = (x * ((1.0 / eps_m) + ((-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_] := If[LessEqual[x, 1.12], N[(N[(N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(-1.0 + eps$95$m), $MachinePrecision] * N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.12:\\
\;\;\;\;\frac{x \cdot \left(-1 - eps\_m\right) + 2}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(\frac{1}{eps\_m} + \left(-1 + eps\_m\right) \cdot \left(1 + \frac{1}{eps\_m}\right)\right)}{2}\\
\end{array}
\end{array}
if x < 1.1200000000000001Initial program 62.5%
Taylor expanded in x around 0 44.5%
Taylor expanded in eps around inf 81.0%
Taylor expanded in x around 0 67.4%
mul-1-neg67.4%
unsub-neg67.4%
+-commutative67.4%
Simplified67.4%
if 1.1200000000000001 < x Initial program 100.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in eps around 0 19.6%
Taylor expanded in x around inf 59.7%
Final simplification65.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -0.47) (/ (* eps_m x) -2.0) (if (<= x 4.9e+33) 1.0 (* 0.5 (/ 0.0 eps_m)))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.47) {
tmp = (eps_m * x) / -2.0;
} else if (x <= 4.9e+33) {
tmp = 1.0;
} else {
tmp = 0.5 * (0.0 / eps_m);
}
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 <= (-0.47d0)) then
tmp = (eps_m * x) / (-2.0d0)
else if (x <= 4.9d+33) then
tmp = 1.0d0
else
tmp = 0.5d0 * (0.0d0 / eps_m)
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -0.47) {
tmp = (eps_m * x) / -2.0;
} else if (x <= 4.9e+33) {
tmp = 1.0;
} else {
tmp = 0.5 * (0.0 / eps_m);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.47: tmp = (eps_m * x) / -2.0 elif x <= 4.9e+33: tmp = 1.0 else: tmp = 0.5 * (0.0 / eps_m) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.47) tmp = Float64(Float64(eps_m * x) / -2.0); elseif (x <= 4.9e+33) tmp = 1.0; else tmp = Float64(0.5 * Float64(0.0 / eps_m)); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -0.47) tmp = (eps_m * x) / -2.0; elseif (x <= 4.9e+33) tmp = 1.0; else tmp = 0.5 * (0.0 / eps_m); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.47], N[(N[(eps$95$m * x), $MachinePrecision] / -2.0), $MachinePrecision], If[LessEqual[x, 4.9e+33], 1.0, N[(0.5 * N[(0.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.47:\\
\;\;\;\;\frac{eps\_m \cdot x}{-2}\\
\mathbf{elif}\;x \leq 4.9 \cdot 10^{+33}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{0}{eps\_m}\\
\end{array}
\end{array}
if x < -0.46999999999999997Initial program 100.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in eps around 0 13.2%
Taylor expanded in eps around inf 13.2%
*-commutative13.2%
Simplified13.2%
frac-2neg13.2%
distribute-rgt-neg-in13.2%
add-sqr-sqrt13.2%
sqrt-unprod72.3%
sqr-neg72.3%
sqrt-unprod40.2%
add-sqr-sqrt40.2%
*-commutative40.2%
metadata-eval40.2%
Applied egg-rr40.2%
if -0.46999999999999997 < x < 4.90000000000000014e33Initial program 55.1%
Simplified22.3%
Taylor expanded in x around 0 73.1%
if 4.90000000000000014e33 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 44.5%
distribute-rgt1-in44.5%
metadata-eval44.5%
neg-mul-144.5%
mul0-lft44.5%
Simplified44.5%
Final simplification60.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 4.9e+33) 1.0 (* 0.5 (/ 0.0 eps_m))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 4.9e+33) {
tmp = 1.0;
} else {
tmp = 0.5 * (0.0 / eps_m);
}
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 <= 4.9d+33) then
tmp = 1.0d0
else
tmp = 0.5d0 * (0.0d0 / eps_m)
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 4.9e+33) {
tmp = 1.0;
} else {
tmp = 0.5 * (0.0 / eps_m);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 4.9e+33: tmp = 1.0 else: tmp = 0.5 * (0.0 / eps_m) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 4.9e+33) tmp = 1.0; else tmp = Float64(0.5 * Float64(0.0 / eps_m)); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 4.9e+33) tmp = 1.0; else tmp = 0.5 * (0.0 / eps_m); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 4.9e+33], 1.0, N[(0.5 * N[(0.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.9 \cdot 10^{+33}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{0}{eps\_m}\\
\end{array}
\end{array}
if x < 4.90000000000000014e33Initial program 63.3%
Simplified36.6%
Taylor expanded in x around 0 60.2%
if 4.90000000000000014e33 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 44.5%
distribute-rgt1-in44.5%
metadata-eval44.5%
neg-mul-144.5%
mul0-lft44.5%
Simplified44.5%
Final simplification55.9%
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 73.5%
Simplified54.2%
Taylor expanded in x around 0 44.4%
Final simplification44.4%
herbie shell --seed 2024096
(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))