
(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 18 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 0.002) (/ (/ (* eps_m (* (exp (- x)) (+ 2.0 (* x 2.0)))) eps_m) 2.0) (/ (+ (exp (* x (+ eps_m -1.0))) (exp (* x (- eps_m)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.002) {
tmp = ((eps_m * (exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0;
} else {
tmp = (exp((x * (eps_m + -1.0))) + exp((x * -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 (eps_m <= 0.002d0) then
tmp = ((eps_m * (exp(-x) * (2.0d0 + (x * 2.0d0)))) / eps_m) / 2.0d0
else
tmp = (exp((x * (eps_m + (-1.0d0)))) + exp((x * -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 (eps_m <= 0.002) {
tmp = ((eps_m * (Math.exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0;
} else {
tmp = (Math.exp((x * (eps_m + -1.0))) + Math.exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 0.002: tmp = ((eps_m * (math.exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0 else: tmp = (math.exp((x * (eps_m + -1.0))) + math.exp((x * -eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 0.002) tmp = Float64(Float64(Float64(eps_m * Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0)))) / eps_m) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + exp(Float64(x * Float64(-eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 0.002) tmp = ((eps_m * (exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0; else tmp = (exp((x * (eps_m + -1.0))) + exp((x * -eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 0.002], N[(N[(N[(eps$95$m * N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 0.002:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(e^{-x} \cdot \left(2 + x \cdot 2\right)\right)}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 2e-3Initial program 64.1%
Simplified53.2%
Taylor expanded in eps around 0 33.1%
Simplified69.7%
if 2e-3 < eps Initial program 100.0%
Simplified93.1%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around -inf 100.0%
rec-exp100.0%
distribute-rgt-out--100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
remove-double-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
distribute-rgt-neg-in100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
*-lft-identity100.0%
distribute-neg-in100.0%
metadata-eval100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
Simplified100.0%
Final simplification77.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (exp (+ x (* x eps_m))))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (x * eps_m))))) / 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((x * (eps_m + (-1.0d0)))) + (1.0d0 / exp((x + (x * eps_m))))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (eps_m + -1.0))) + (1.0 / Math.exp((x + (x * eps_m))))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (eps_m + -1.0))) + (1.0 / math.exp((x + (x * eps_m))))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / exp(Float64(x + Float64(x * eps_m))))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (x * eps_m))))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{e^{x + x \cdot eps\_m}}}{2}
\end{array}
Initial program 73.5%
Simplified69.2%
Taylor expanded in eps around inf 98.4%
Final simplification98.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ eps_m -1.0))) (exp (* x (- -1.0 eps_m)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (eps_m + -1.0))) + exp((x * (-1.0 - eps_m)))) / 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((x * (eps_m + (-1.0d0)))) + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (eps_m + -1.0))) + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (eps_m + -1.0))) + math.exp((x * (-1.0 - eps_m)))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (eps_m + -1.0))) + exp((x * (-1.0 - eps_m)))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $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|
\\
\frac{e^{x \cdot \left(eps\_m + -1\right)} + e^{x \cdot \left(-1 - eps\_m\right)}}{2}
\end{array}
Initial program 73.5%
Simplified69.2%
Taylor expanded in eps around inf 98.4%
Taylor expanded in x around -inf 98.4%
rec-exp98.4%
distribute-rgt-out--98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
remove-double-neg98.4%
mul-1-neg98.4%
sub-neg98.4%
distribute-rgt-neg-in98.4%
cancel-sign-sub-inv98.4%
metadata-eval98.4%
*-lft-identity98.4%
distribute-neg-in98.4%
metadata-eval98.4%
unsub-neg98.4%
Simplified98.4%
Final simplification98.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ eps_m -1.0)))))
(if (<= eps_m 1.0)
(/ (/ (* eps_m (* (exp (- x)) (+ 2.0 (* x 2.0)))) eps_m) 2.0)
(if (<= eps_m 1e+40)
(/ (+ 1.0 t_0) 2.0)
(if (<= eps_m 1.55e+63)
(/
(-
(+ 1.0 (/ 1.0 eps_m))
(* (+ -1.0 (/ 1.0 eps_m)) (exp (* x (- -1.0 eps_m)))))
2.0)
(if (<= eps_m 1.35e+245)
(/ (* eps_m (- (+ (/ 1.0 eps_m) (/ t_0 eps_m)) x)) 2.0)
(/
(+ 2.0 (* x (+ -1.0 (* 0.5 (* x (pow (+ eps_m -1.0) 2.0))))))
2.0)))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double tmp;
if (eps_m <= 1.0) {
tmp = ((eps_m * (exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0;
} else if (eps_m <= 1e+40) {
tmp = (1.0 + t_0) / 2.0;
} else if (eps_m <= 1.55e+63) {
tmp = ((1.0 + (1.0 / eps_m)) - ((-1.0 + (1.0 / eps_m)) * exp((x * (-1.0 - eps_m))))) / 2.0;
} else if (eps_m <= 1.35e+245) {
tmp = (eps_m * (((1.0 / eps_m) + (t_0 / eps_m)) - x)) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + (0.5 * (x * pow((eps_m + -1.0), 2.0)))))) / 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 = exp((x * (eps_m + (-1.0d0))))
if (eps_m <= 1.0d0) then
tmp = ((eps_m * (exp(-x) * (2.0d0 + (x * 2.0d0)))) / eps_m) / 2.0d0
else if (eps_m <= 1d+40) then
tmp = (1.0d0 + t_0) / 2.0d0
else if (eps_m <= 1.55d+63) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) - (((-1.0d0) + (1.0d0 / eps_m)) * exp((x * ((-1.0d0) - eps_m))))) / 2.0d0
else if (eps_m <= 1.35d+245) then
tmp = (eps_m * (((1.0d0 / eps_m) + (t_0 / eps_m)) - x)) / 2.0d0
else
tmp = (2.0d0 + (x * ((-1.0d0) + (0.5d0 * (x * ((eps_m + (-1.0d0)) ** 2.0d0)))))) / 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 = Math.exp((x * (eps_m + -1.0)));
double tmp;
if (eps_m <= 1.0) {
tmp = ((eps_m * (Math.exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0;
} else if (eps_m <= 1e+40) {
tmp = (1.0 + t_0) / 2.0;
} else if (eps_m <= 1.55e+63) {
tmp = ((1.0 + (1.0 / eps_m)) - ((-1.0 + (1.0 / eps_m)) * Math.exp((x * (-1.0 - eps_m))))) / 2.0;
} else if (eps_m <= 1.35e+245) {
tmp = (eps_m * (((1.0 / eps_m) + (t_0 / eps_m)) - x)) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + (0.5 * (x * Math.pow((eps_m + -1.0), 2.0)))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (eps_m + -1.0))) tmp = 0 if eps_m <= 1.0: tmp = ((eps_m * (math.exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0 elif eps_m <= 1e+40: tmp = (1.0 + t_0) / 2.0 elif eps_m <= 1.55e+63: tmp = ((1.0 + (1.0 / eps_m)) - ((-1.0 + (1.0 / eps_m)) * math.exp((x * (-1.0 - eps_m))))) / 2.0 elif eps_m <= 1.35e+245: tmp = (eps_m * (((1.0 / eps_m) + (t_0 / eps_m)) - x)) / 2.0 else: tmp = (2.0 + (x * (-1.0 + (0.5 * (x * math.pow((eps_m + -1.0), 2.0)))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) tmp = 0.0 if (eps_m <= 1.0) tmp = Float64(Float64(Float64(eps_m * Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0)))) / eps_m) / 2.0); elseif (eps_m <= 1e+40) tmp = Float64(Float64(1.0 + t_0) / 2.0); elseif (eps_m <= 1.55e+63) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) - Float64(Float64(-1.0 + Float64(1.0 / eps_m)) * exp(Float64(x * Float64(-1.0 - eps_m))))) / 2.0); elseif (eps_m <= 1.35e+245) tmp = Float64(Float64(eps_m * Float64(Float64(Float64(1.0 / eps_m) + Float64(t_0 / eps_m)) - x)) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(0.5 * Float64(x * (Float64(eps_m + -1.0) ^ 2.0)))))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (eps_m + -1.0))); tmp = 0.0; if (eps_m <= 1.0) tmp = ((eps_m * (exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0; elseif (eps_m <= 1e+40) tmp = (1.0 + t_0) / 2.0; elseif (eps_m <= 1.55e+63) tmp = ((1.0 + (1.0 / eps_m)) - ((-1.0 + (1.0 / eps_m)) * exp((x * (-1.0 - eps_m))))) / 2.0; elseif (eps_m <= 1.35e+245) tmp = (eps_m * (((1.0 / eps_m) + (t_0 / eps_m)) - x)) / 2.0; else tmp = (2.0 + (x * (-1.0 + (0.5 * (x * ((eps_m + -1.0) ^ 2.0)))))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[eps$95$m, 1.0], N[(N[(N[(eps$95$m * N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps$95$m, 1e+40], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps$95$m, 1.55e+63], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - N[(N[(-1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps$95$m, 1.35e+245], N[(N[(eps$95$m * N[(N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(t$95$0 / eps$95$m), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(-1.0 + N[(0.5 * N[(x * N[Power[N[(eps$95$m + -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps\_m + -1\right)}\\
\mathbf{if}\;eps\_m \leq 1:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(e^{-x} \cdot \left(2 + x \cdot 2\right)\right)}{eps\_m}}{2}\\
\mathbf{elif}\;eps\_m \leq 10^{+40}:\\
\;\;\;\;\frac{1 + t\_0}{2}\\
\mathbf{elif}\;eps\_m \leq 1.55 \cdot 10^{+63}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) - \left(-1 + \frac{1}{eps\_m}\right) \cdot e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;eps\_m \leq 1.35 \cdot 10^{+245}:\\
\;\;\;\;\frac{eps\_m \cdot \left(\left(\frac{1}{eps\_m} + \frac{t\_0}{eps\_m}\right) - x\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + 0.5 \cdot \left(x \cdot {\left(eps\_m + -1\right)}^{2}\right)\right)}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 64.1%
Simplified53.2%
Taylor expanded in eps around 0 33.1%
Simplified69.7%
if 1 < eps < 1.00000000000000003e40Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 100.0%
if 1.00000000000000003e40 < eps < 1.55e63Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
if 1.55e63 < eps < 1.34999999999999996e245Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 72.1%
Taylor expanded in eps around inf 84.6%
Taylor expanded in eps around -inf 84.6%
associate-*r*84.6%
neg-mul-184.6%
sub-neg84.6%
*-commutative84.6%
associate-*l*84.6%
sub-neg84.6%
distribute-lft-in84.6%
metadata-eval84.6%
mul-1-neg84.6%
remove-double-neg84.6%
Simplified84.6%
if 1.34999999999999996e245 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 40.8%
Taylor expanded in eps around inf 74.1%
Taylor expanded in eps around inf 74.1%
mul-1-neg74.1%
distribute-rgt-neg-in74.1%
mul-1-neg74.1%
sub-neg74.1%
distribute-lft-in74.1%
metadata-eval74.1%
mul-1-neg74.1%
remove-double-neg74.1%
Simplified74.1%
Taylor expanded in x around 0 94.6%
Final simplification74.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 1.0)
(/ (/ (* eps_m (* (exp (- x)) (+ 2.0 (* x 2.0)))) eps_m) 2.0)
(if (<= eps_m 1.35e+245)
(/
(* eps_m (- (+ (/ 1.0 eps_m) (/ (exp (* x (+ eps_m -1.0))) eps_m)) x))
2.0)
(/ (+ 2.0 (* x (+ -1.0 (* 0.5 (* x (pow (+ eps_m -1.0) 2.0)))))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.0) {
tmp = ((eps_m * (exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0;
} else if (eps_m <= 1.35e+245) {
tmp = (eps_m * (((1.0 / eps_m) + (exp((x * (eps_m + -1.0))) / eps_m)) - x)) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + (0.5 * (x * pow((eps_m + -1.0), 2.0)))))) / 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 (eps_m <= 1.0d0) then
tmp = ((eps_m * (exp(-x) * (2.0d0 + (x * 2.0d0)))) / eps_m) / 2.0d0
else if (eps_m <= 1.35d+245) then
tmp = (eps_m * (((1.0d0 / eps_m) + (exp((x * (eps_m + (-1.0d0)))) / eps_m)) - x)) / 2.0d0
else
tmp = (2.0d0 + (x * ((-1.0d0) + (0.5d0 * (x * ((eps_m + (-1.0d0)) ** 2.0d0)))))) / 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 (eps_m <= 1.0) {
tmp = ((eps_m * (Math.exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0;
} else if (eps_m <= 1.35e+245) {
tmp = (eps_m * (((1.0 / eps_m) + (Math.exp((x * (eps_m + -1.0))) / eps_m)) - x)) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + (0.5 * (x * Math.pow((eps_m + -1.0), 2.0)))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.0: tmp = ((eps_m * (math.exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0 elif eps_m <= 1.35e+245: tmp = (eps_m * (((1.0 / eps_m) + (math.exp((x * (eps_m + -1.0))) / eps_m)) - x)) / 2.0 else: tmp = (2.0 + (x * (-1.0 + (0.5 * (x * math.pow((eps_m + -1.0), 2.0)))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.0) tmp = Float64(Float64(Float64(eps_m * Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0)))) / eps_m) / 2.0); elseif (eps_m <= 1.35e+245) tmp = Float64(Float64(eps_m * Float64(Float64(Float64(1.0 / eps_m) + Float64(exp(Float64(x * Float64(eps_m + -1.0))) / eps_m)) - x)) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(0.5 * Float64(x * (Float64(eps_m + -1.0) ^ 2.0)))))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 1.0) tmp = ((eps_m * (exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0; elseif (eps_m <= 1.35e+245) tmp = (eps_m * (((1.0 / eps_m) + (exp((x * (eps_m + -1.0))) / eps_m)) - x)) / 2.0; else tmp = (2.0 + (x * (-1.0 + (0.5 * (x * ((eps_m + -1.0) ^ 2.0)))))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 1.0], N[(N[(N[(eps$95$m * N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps$95$m, 1.35e+245], N[(N[(eps$95$m * N[(N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(-1.0 + N[(0.5 * N[(x * N[Power[N[(eps$95$m + -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 1:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(e^{-x} \cdot \left(2 + x \cdot 2\right)\right)}{eps\_m}}{2}\\
\mathbf{elif}\;eps\_m \leq 1.35 \cdot 10^{+245}:\\
\;\;\;\;\frac{eps\_m \cdot \left(\left(\frac{1}{eps\_m} + \frac{e^{x \cdot \left(eps\_m + -1\right)}}{eps\_m}\right) - x\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + 0.5 \cdot \left(x \cdot {\left(eps\_m + -1\right)}^{2}\right)\right)}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 64.1%
Simplified53.2%
Taylor expanded in eps around 0 33.1%
Simplified69.7%
if 1 < eps < 1.34999999999999996e245Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 69.4%
Taylor expanded in eps around inf 79.6%
Taylor expanded in eps around -inf 79.6%
associate-*r*79.6%
neg-mul-179.6%
sub-neg79.6%
*-commutative79.6%
associate-*l*79.6%
sub-neg79.6%
distribute-lft-in79.6%
metadata-eval79.6%
mul-1-neg79.6%
remove-double-neg79.6%
Simplified79.6%
if 1.34999999999999996e245 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 40.8%
Taylor expanded in eps around inf 74.1%
Taylor expanded in eps around inf 74.1%
mul-1-neg74.1%
distribute-rgt-neg-in74.1%
mul-1-neg74.1%
sub-neg74.1%
distribute-lft-in74.1%
metadata-eval74.1%
mul-1-neg74.1%
remove-double-neg74.1%
Simplified74.1%
Taylor expanded in x around 0 94.6%
Final simplification73.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 1.0)
(/ (/ (* eps_m (* (exp (- x)) (+ 2.0 (* x 2.0)))) eps_m) 2.0)
(if (<= eps_m 1.2e+245)
(/ (* eps_m (- (/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) eps_m) x)) 2.0)
(/ (+ 2.0 (* x (+ -1.0 (* 0.5 (* x (pow (+ eps_m -1.0) 2.0)))))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.0) {
tmp = ((eps_m * (exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0;
} else if (eps_m <= 1.2e+245) {
tmp = (eps_m * (((1.0 + exp((x * (eps_m + -1.0)))) / eps_m) - x)) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + (0.5 * (x * pow((eps_m + -1.0), 2.0)))))) / 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 (eps_m <= 1.0d0) then
tmp = ((eps_m * (exp(-x) * (2.0d0 + (x * 2.0d0)))) / eps_m) / 2.0d0
else if (eps_m <= 1.2d+245) then
tmp = (eps_m * (((1.0d0 + exp((x * (eps_m + (-1.0d0))))) / eps_m) - x)) / 2.0d0
else
tmp = (2.0d0 + (x * ((-1.0d0) + (0.5d0 * (x * ((eps_m + (-1.0d0)) ** 2.0d0)))))) / 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 (eps_m <= 1.0) {
tmp = ((eps_m * (Math.exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0;
} else if (eps_m <= 1.2e+245) {
tmp = (eps_m * (((1.0 + Math.exp((x * (eps_m + -1.0)))) / eps_m) - x)) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + (0.5 * (x * Math.pow((eps_m + -1.0), 2.0)))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.0: tmp = ((eps_m * (math.exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0 elif eps_m <= 1.2e+245: tmp = (eps_m * (((1.0 + math.exp((x * (eps_m + -1.0)))) / eps_m) - x)) / 2.0 else: tmp = (2.0 + (x * (-1.0 + (0.5 * (x * math.pow((eps_m + -1.0), 2.0)))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.0) tmp = Float64(Float64(Float64(eps_m * Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0)))) / eps_m) / 2.0); elseif (eps_m <= 1.2e+245) tmp = Float64(Float64(eps_m * Float64(Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / eps_m) - x)) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(0.5 * Float64(x * (Float64(eps_m + -1.0) ^ 2.0)))))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 1.0) tmp = ((eps_m * (exp(-x) * (2.0 + (x * 2.0)))) / eps_m) / 2.0; elseif (eps_m <= 1.2e+245) tmp = (eps_m * (((1.0 + exp((x * (eps_m + -1.0)))) / eps_m) - x)) / 2.0; else tmp = (2.0 + (x * (-1.0 + (0.5 * (x * ((eps_m + -1.0) ^ 2.0)))))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 1.0], N[(N[(N[(eps$95$m * N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps$95$m, 1.2e+245], N[(N[(eps$95$m * N[(N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(-1.0 + N[(0.5 * N[(x * N[Power[N[(eps$95$m + -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 1:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(e^{-x} \cdot \left(2 + x \cdot 2\right)\right)}{eps\_m}}{2}\\
\mathbf{elif}\;eps\_m \leq 1.2 \cdot 10^{+245}:\\
\;\;\;\;\frac{eps\_m \cdot \left(\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{eps\_m} - x\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + 0.5 \cdot \left(x \cdot {\left(eps\_m + -1\right)}^{2}\right)\right)}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 64.1%
Simplified53.2%
Taylor expanded in eps around 0 33.1%
Simplified69.7%
if 1 < eps < 1.1999999999999999e245Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 69.4%
Taylor expanded in eps around inf 79.6%
Taylor expanded in eps around inf 79.6%
mul-1-neg79.6%
distribute-rgt-neg-in79.6%
mul-1-neg79.6%
sub-neg79.6%
distribute-lft-in79.6%
metadata-eval79.6%
mul-1-neg79.6%
remove-double-neg79.6%
Simplified79.6%
if 1.1999999999999999e245 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 40.8%
Taylor expanded in eps around inf 74.1%
Taylor expanded in eps around inf 74.1%
mul-1-neg74.1%
distribute-rgt-neg-in74.1%
mul-1-neg74.1%
sub-neg74.1%
distribute-lft-in74.1%
metadata-eval74.1%
mul-1-neg74.1%
remove-double-neg74.1%
Simplified74.1%
Taylor expanded in x around 0 94.6%
Final simplification73.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ 1.0 (exp (* x (+ eps_m -1.0))))))
(if (<= x -410.0)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 1.85e+158)
(/ (* eps_m (- (/ t_0 eps_m) x)) 2.0)
(if (<= x 9.2e+253) 0.0 (/ t_0 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = 1.0 + exp((x * (eps_m + -1.0)));
double tmp;
if (x <= -410.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 1.85e+158) {
tmp = (eps_m * ((t_0 / eps_m) - x)) / 2.0;
} else if (x <= 9.2e+253) {
tmp = 0.0;
} else {
tmp = t_0 / 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 = 1.0d0 + exp((x * (eps_m + (-1.0d0))))
if (x <= (-410.0d0)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 1.85d+158) then
tmp = (eps_m * ((t_0 / eps_m) - x)) / 2.0d0
else if (x <= 9.2d+253) then
tmp = 0.0d0
else
tmp = t_0 / 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 = 1.0 + Math.exp((x * (eps_m + -1.0)));
double tmp;
if (x <= -410.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 1.85e+158) {
tmp = (eps_m * ((t_0 / eps_m) - x)) / 2.0;
} else if (x <= 9.2e+253) {
tmp = 0.0;
} else {
tmp = t_0 / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = 1.0 + math.exp((x * (eps_m + -1.0))) tmp = 0 if x <= -410.0: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 1.85e+158: tmp = (eps_m * ((t_0 / eps_m) - x)) / 2.0 elif x <= 9.2e+253: tmp = 0.0 else: tmp = t_0 / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) tmp = 0.0 if (x <= -410.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 1.85e+158) tmp = Float64(Float64(eps_m * Float64(Float64(t_0 / eps_m) - x)) / 2.0); elseif (x <= 9.2e+253) tmp = 0.0; else tmp = Float64(t_0 / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = 1.0 + exp((x * (eps_m + -1.0))); tmp = 0.0; if (x <= -410.0) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 1.85e+158) tmp = (eps_m * ((t_0 / eps_m) - x)) / 2.0; elseif (x <= 9.2e+253) tmp = 0.0; else tmp = t_0 / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -410.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.85e+158], N[(N[(eps$95$m * N[(N[(t$95$0 / eps$95$m), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 9.2e+253], 0.0, N[(t$95$0 / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := 1 + e^{x \cdot \left(eps\_m + -1\right)}\\
\mathbf{if}\;x \leq -410:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{+158}:\\
\;\;\;\;\frac{eps\_m \cdot \left(\frac{t\_0}{eps\_m} - x\right)}{2}\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{+253}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{2}\\
\end{array}
\end{array}
if x < -410Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 59.1%
Taylor expanded in eps around inf 85.4%
Taylor expanded in eps around 0 100.0%
neg-mul-1100.0%
Simplified100.0%
if -410 < x < 1.85000000000000005e158Initial program 62.7%
Simplified62.7%
Taylor expanded in x around 0 35.1%
Taylor expanded in eps around inf 72.1%
Taylor expanded in eps around inf 72.1%
mul-1-neg72.1%
distribute-rgt-neg-in72.1%
mul-1-neg72.1%
sub-neg72.1%
distribute-lft-in72.1%
metadata-eval72.1%
mul-1-neg72.1%
remove-double-neg72.1%
Simplified72.1%
if 1.85000000000000005e158 < x < 9.1999999999999999e253Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 65.8%
mul-1-neg65.8%
mul-1-neg65.8%
rec-exp65.8%
sub-neg65.8%
div-sub65.8%
mul-1-neg65.8%
rec-exp65.8%
+-inverses65.8%
Simplified65.8%
if 9.1999999999999999e253 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 47.8%
Final simplification74.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ 1.0 (exp (* x (+ eps_m -1.0))))))
(if (<= x -2.15e-232)
(/ (+ 2.0 (* x (+ -1.0 (* 0.5 (* x (pow (+ eps_m -1.0) 2.0)))))) 2.0)
(if (<= x 5.2e+157)
(/ (* eps_m (- (/ t_0 eps_m) x)) 2.0)
(if (<= x 5.7e+255) 0.0 (/ t_0 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = 1.0 + exp((x * (eps_m + -1.0)));
double tmp;
if (x <= -2.15e-232) {
tmp = (2.0 + (x * (-1.0 + (0.5 * (x * pow((eps_m + -1.0), 2.0)))))) / 2.0;
} else if (x <= 5.2e+157) {
tmp = (eps_m * ((t_0 / eps_m) - x)) / 2.0;
} else if (x <= 5.7e+255) {
tmp = 0.0;
} else {
tmp = t_0 / 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 = 1.0d0 + exp((x * (eps_m + (-1.0d0))))
if (x <= (-2.15d-232)) then
tmp = (2.0d0 + (x * ((-1.0d0) + (0.5d0 * (x * ((eps_m + (-1.0d0)) ** 2.0d0)))))) / 2.0d0
else if (x <= 5.2d+157) then
tmp = (eps_m * ((t_0 / eps_m) - x)) / 2.0d0
else if (x <= 5.7d+255) then
tmp = 0.0d0
else
tmp = t_0 / 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 = 1.0 + Math.exp((x * (eps_m + -1.0)));
double tmp;
if (x <= -2.15e-232) {
tmp = (2.0 + (x * (-1.0 + (0.5 * (x * Math.pow((eps_m + -1.0), 2.0)))))) / 2.0;
} else if (x <= 5.2e+157) {
tmp = (eps_m * ((t_0 / eps_m) - x)) / 2.0;
} else if (x <= 5.7e+255) {
tmp = 0.0;
} else {
tmp = t_0 / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = 1.0 + math.exp((x * (eps_m + -1.0))) tmp = 0 if x <= -2.15e-232: tmp = (2.0 + (x * (-1.0 + (0.5 * (x * math.pow((eps_m + -1.0), 2.0)))))) / 2.0 elif x <= 5.2e+157: tmp = (eps_m * ((t_0 / eps_m) - x)) / 2.0 elif x <= 5.7e+255: tmp = 0.0 else: tmp = t_0 / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) tmp = 0.0 if (x <= -2.15e-232) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(0.5 * Float64(x * (Float64(eps_m + -1.0) ^ 2.0)))))) / 2.0); elseif (x <= 5.2e+157) tmp = Float64(Float64(eps_m * Float64(Float64(t_0 / eps_m) - x)) / 2.0); elseif (x <= 5.7e+255) tmp = 0.0; else tmp = Float64(t_0 / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = 1.0 + exp((x * (eps_m + -1.0))); tmp = 0.0; if (x <= -2.15e-232) tmp = (2.0 + (x * (-1.0 + (0.5 * (x * ((eps_m + -1.0) ^ 2.0)))))) / 2.0; elseif (x <= 5.2e+157) tmp = (eps_m * ((t_0 / eps_m) - x)) / 2.0; elseif (x <= 5.7e+255) tmp = 0.0; else tmp = t_0 / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.15e-232], N[(N[(2.0 + N[(x * N[(-1.0 + N[(0.5 * N[(x * N[Power[N[(eps$95$m + -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5.2e+157], N[(N[(eps$95$m * N[(N[(t$95$0 / eps$95$m), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5.7e+255], 0.0, N[(t$95$0 / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := 1 + e^{x \cdot \left(eps\_m + -1\right)}\\
\mathbf{if}\;x \leq -2.15 \cdot 10^{-232}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + 0.5 \cdot \left(x \cdot {\left(eps\_m + -1\right)}^{2}\right)\right)}{2}\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+157}:\\
\;\;\;\;\frac{eps\_m \cdot \left(\frac{t\_0}{eps\_m} - x\right)}{2}\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{+255}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{2}\\
\end{array}
\end{array}
if x < -2.1499999999999998e-232Initial program 72.5%
Simplified72.5%
Taylor expanded in x around 0 44.7%
Taylor expanded in eps around inf 82.4%
Taylor expanded in eps around inf 82.3%
mul-1-neg82.3%
distribute-rgt-neg-in82.3%
mul-1-neg82.3%
sub-neg82.3%
distribute-lft-in82.3%
metadata-eval82.3%
mul-1-neg82.3%
remove-double-neg82.3%
Simplified82.3%
Taylor expanded in x around 0 88.0%
if -2.1499999999999998e-232 < x < 5.20000000000000022e157Initial program 66.9%
Simplified66.9%
Taylor expanded in x around 0 35.6%
Taylor expanded in eps around inf 69.1%
Taylor expanded in eps around inf 69.1%
mul-1-neg69.1%
distribute-rgt-neg-in69.1%
mul-1-neg69.1%
sub-neg69.1%
distribute-lft-in69.1%
metadata-eval69.1%
mul-1-neg69.1%
remove-double-neg69.1%
Simplified69.1%
if 5.20000000000000022e157 < x < 5.69999999999999987e255Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 65.8%
mul-1-neg65.8%
mul-1-neg65.8%
rec-exp65.8%
sub-neg65.8%
div-sub65.8%
mul-1-neg65.8%
rec-exp65.8%
+-inverses65.8%
Simplified65.8%
if 5.69999999999999987e255 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 47.8%
Final simplification74.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 4e-247)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (or (<= x 7.2e+155) (not (<= x 1.1e+258)))
(/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0)
0.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 4e-247) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if ((x <= 7.2e+155) || !(x <= 1.1e+258)) {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
} else {
tmp = 0.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-247) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if ((x <= 7.2d+155) .or. (.not. (x <= 1.1d+258))) then
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
else
tmp = 0.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-247) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if ((x <= 7.2e+155) || !(x <= 1.1e+258)) {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 4e-247: tmp = (1.0 + math.exp(-x)) / 2.0 elif (x <= 7.2e+155) or not (x <= 1.1e+258): tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 4e-247) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif ((x <= 7.2e+155) || !(x <= 1.1e+258)) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 4e-247) tmp = (1.0 + exp(-x)) / 2.0; elseif ((x <= 7.2e+155) || ~((x <= 1.1e+258))) tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 4e-247], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 7.2e+155], N[Not[LessEqual[x, 1.1e+258]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4 \cdot 10^{-247}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{+155} \lor \neg \left(x \leq 1.1 \cdot 10^{+258}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 4.0000000000000001e-247Initial program 70.1%
Simplified70.1%
Taylor expanded in x around 0 49.8%
Taylor expanded in eps around inf 86.9%
Taylor expanded in eps around 0 85.9%
neg-mul-185.9%
Simplified85.9%
if 4.0000000000000001e-247 < x < 7.20000000000000015e155 or 1.09999999999999991e258 < x Initial program 71.7%
Simplified67.5%
Taylor expanded in eps around inf 97.2%
Taylor expanded in x around 0 55.1%
if 7.20000000000000015e155 < x < 1.09999999999999991e258Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 65.8%
mul-1-neg65.8%
mul-1-neg65.8%
rec-exp65.8%
sub-neg65.8%
div-sub65.8%
mul-1-neg65.8%
rec-exp65.8%
+-inverses65.8%
Simplified65.8%
Final simplification70.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0
(*
x
(+
(/
(*
x
(+ 0.25 (* x (- (* x 0.020833333333333332) 0.08333333333333333))))
eps_m)
(* 0.5 (/ -1.0 eps_m))))))
(if (<= x -2.4e+101)
t_0
(if (<= x 122.0)
(/ (* eps_m (- (/ 2.0 eps_m) x)) 2.0)
(if (<= x 2e+157)
(/ 0.5 (/ eps_m (expm1 x)))
(if (<= x 2e+255) 0.0 t_0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = x * (((x * (0.25 + (x * ((x * 0.020833333333333332) - 0.08333333333333333)))) / eps_m) + (0.5 * (-1.0 / eps_m)));
double tmp;
if (x <= -2.4e+101) {
tmp = t_0;
} else if (x <= 122.0) {
tmp = (eps_m * ((2.0 / eps_m) - x)) / 2.0;
} else if (x <= 2e+157) {
tmp = 0.5 / (eps_m / expm1(x));
} else if (x <= 2e+255) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = x * (((x * (0.25 + (x * ((x * 0.020833333333333332) - 0.08333333333333333)))) / eps_m) + (0.5 * (-1.0 / eps_m)));
double tmp;
if (x <= -2.4e+101) {
tmp = t_0;
} else if (x <= 122.0) {
tmp = (eps_m * ((2.0 / eps_m) - x)) / 2.0;
} else if (x <= 2e+157) {
tmp = 0.5 / (eps_m / Math.expm1(x));
} else if (x <= 2e+255) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = x * (((x * (0.25 + (x * ((x * 0.020833333333333332) - 0.08333333333333333)))) / eps_m) + (0.5 * (-1.0 / eps_m))) tmp = 0 if x <= -2.4e+101: tmp = t_0 elif x <= 122.0: tmp = (eps_m * ((2.0 / eps_m) - x)) / 2.0 elif x <= 2e+157: tmp = 0.5 / (eps_m / math.expm1(x)) elif x <= 2e+255: tmp = 0.0 else: tmp = t_0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(x * Float64(Float64(Float64(x * Float64(0.25 + Float64(x * Float64(Float64(x * 0.020833333333333332) - 0.08333333333333333)))) / eps_m) + Float64(0.5 * Float64(-1.0 / eps_m)))) tmp = 0.0 if (x <= -2.4e+101) tmp = t_0; elseif (x <= 122.0) tmp = Float64(Float64(eps_m * Float64(Float64(2.0 / eps_m) - x)) / 2.0); elseif (x <= 2e+157) tmp = Float64(0.5 / Float64(eps_m / expm1(x))); elseif (x <= 2e+255) tmp = 0.0; else tmp = t_0; end return tmp end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(x * N[(N[(N[(x * N[(0.25 + N[(x * N[(N[(x * 0.020833333333333332), $MachinePrecision] - 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] + N[(0.5 * N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.4e+101], t$95$0, If[LessEqual[x, 122.0], N[(N[(eps$95$m * N[(N[(2.0 / eps$95$m), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2e+157], N[(0.5 / N[(eps$95$m / N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2e+255], 0.0, t$95$0]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := x \cdot \left(\frac{x \cdot \left(0.25 + x \cdot \left(x \cdot 0.020833333333333332 - 0.08333333333333333\right)\right)}{eps\_m} + 0.5 \cdot \frac{-1}{eps\_m}\right)\\
\mathbf{if}\;x \leq -2.4 \cdot 10^{+101}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 122:\\
\;\;\;\;\frac{eps\_m \cdot \left(\frac{2}{eps\_m} - x\right)}{2}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+157}:\\
\;\;\;\;\frac{0.5}{\frac{eps\_m}{\mathsf{expm1}\left(x\right)}}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+255}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.39999999999999988e101 or 1.99999999999999998e255 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 42.8%
Taylor expanded in eps around 0 41.6%
expm1-define41.6%
mul-1-neg41.6%
Simplified41.6%
Taylor expanded in x around 0 51.8%
Taylor expanded in eps around 0 56.6%
if -2.39999999999999988e101 < x < 122Initial program 57.0%
Simplified57.0%
Taylor expanded in x around 0 38.2%
Taylor expanded in eps around inf 80.6%
Taylor expanded in x around 0 68.0%
if 122 < x < 1.99999999999999997e157Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 29.6%
Taylor expanded in eps around 0 1.9%
expm1-define1.9%
mul-1-neg1.9%
Simplified1.9%
clear-num1.9%
inv-pow1.9%
div-inv1.9%
clear-num1.9%
add-sqr-sqrt0.0%
sqrt-unprod28.4%
sqr-neg28.4%
sqrt-unprod28.4%
add-sqr-sqrt28.4%
Applied egg-rr28.4%
unpow-128.4%
associate-/r*28.4%
metadata-eval28.4%
Simplified28.4%
if 1.99999999999999997e157 < x < 1.99999999999999998e255Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 65.8%
mul-1-neg65.8%
mul-1-neg65.8%
rec-exp65.8%
sub-neg65.8%
div-sub65.8%
mul-1-neg65.8%
rec-exp65.8%
+-inverses65.8%
Simplified65.8%
Final simplification60.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 660.0)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 2e+156)
(/ 0.5 (/ eps_m (expm1 x)))
(if (<= x 1e+254)
0.0
(*
x
(+
(/
(*
x
(+ 0.25 (* x (- (* x 0.020833333333333332) 0.08333333333333333))))
eps_m)
(* 0.5 (/ -1.0 eps_m))))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 660.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 2e+156) {
tmp = 0.5 / (eps_m / expm1(x));
} else if (x <= 1e+254) {
tmp = 0.0;
} else {
tmp = x * (((x * (0.25 + (x * ((x * 0.020833333333333332) - 0.08333333333333333)))) / eps_m) + (0.5 * (-1.0 / eps_m)));
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 660.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 2e+156) {
tmp = 0.5 / (eps_m / Math.expm1(x));
} else if (x <= 1e+254) {
tmp = 0.0;
} else {
tmp = x * (((x * (0.25 + (x * ((x * 0.020833333333333332) - 0.08333333333333333)))) / eps_m) + (0.5 * (-1.0 / eps_m)));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 660.0: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 2e+156: tmp = 0.5 / (eps_m / math.expm1(x)) elif x <= 1e+254: tmp = 0.0 else: tmp = x * (((x * (0.25 + (x * ((x * 0.020833333333333332) - 0.08333333333333333)))) / eps_m) + (0.5 * (-1.0 / eps_m))) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 660.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 2e+156) tmp = Float64(0.5 / Float64(eps_m / expm1(x))); elseif (x <= 1e+254) tmp = 0.0; else tmp = Float64(x * Float64(Float64(Float64(x * Float64(0.25 + Float64(x * Float64(Float64(x * 0.020833333333333332) - 0.08333333333333333)))) / eps_m) + Float64(0.5 * Float64(-1.0 / eps_m)))); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 660.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2e+156], N[(0.5 / N[(eps$95$m / N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1e+254], 0.0, N[(x * N[(N[(N[(x * N[(0.25 + N[(x * N[(N[(x * 0.020833333333333332), $MachinePrecision] - 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] + N[(0.5 * N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 660:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+156}:\\
\;\;\;\;\frac{0.5}{\frac{eps\_m}{\mathsf{expm1}\left(x\right)}}\\
\mathbf{elif}\;x \leq 10^{+254}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{x \cdot \left(0.25 + x \cdot \left(x \cdot 0.020833333333333332 - 0.08333333333333333\right)\right)}{eps\_m} + 0.5 \cdot \frac{-1}{eps\_m}\right)\\
\end{array}
\end{array}
if x < 660Initial program 63.1%
Simplified63.1%
Taylor expanded in x around 0 41.6%
Taylor expanded in eps around inf 81.9%
Taylor expanded in eps around 0 78.5%
neg-mul-178.5%
Simplified78.5%
if 660 < x < 2e156Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 29.6%
Taylor expanded in eps around 0 1.9%
expm1-define1.9%
mul-1-neg1.9%
Simplified1.9%
clear-num1.9%
inv-pow1.9%
div-inv1.9%
clear-num1.9%
add-sqr-sqrt0.0%
sqrt-unprod28.4%
sqr-neg28.4%
sqrt-unprod28.4%
add-sqr-sqrt28.4%
Applied egg-rr28.4%
unpow-128.4%
associate-/r*28.4%
metadata-eval28.4%
Simplified28.4%
if 2e156 < x < 9.9999999999999994e253Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 65.8%
mul-1-neg65.8%
mul-1-neg65.8%
rec-exp65.8%
sub-neg65.8%
div-sub65.8%
mul-1-neg65.8%
rec-exp65.8%
+-inverses65.8%
Simplified65.8%
if 9.9999999999999994e253 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 47.5%
Taylor expanded in eps around 0 1.8%
expm1-define1.8%
mul-1-neg1.8%
Simplified1.8%
Taylor expanded in x around 0 46.6%
Taylor expanded in eps around 0 46.6%
Final simplification68.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0
(*
x
(+
(/
(*
x
(+ 0.25 (* x (- (* x 0.020833333333333332) 0.08333333333333333))))
eps_m)
(* 0.5 (/ -1.0 eps_m))))))
(if (<= x -2.7e+97)
t_0
(if (<= x 210.0)
(/ (* eps_m (- (/ 2.0 eps_m) x)) 2.0)
(if (<= x 1e+105)
0.0
(if (or (<= x 1.05e+156) (not (<= x 3.5e+254))) t_0 0.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = x * (((x * (0.25 + (x * ((x * 0.020833333333333332) - 0.08333333333333333)))) / eps_m) + (0.5 * (-1.0 / eps_m)));
double tmp;
if (x <= -2.7e+97) {
tmp = t_0;
} else if (x <= 210.0) {
tmp = (eps_m * ((2.0 / eps_m) - x)) / 2.0;
} else if (x <= 1e+105) {
tmp = 0.0;
} else if ((x <= 1.05e+156) || !(x <= 3.5e+254)) {
tmp = t_0;
} else {
tmp = 0.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 * (((x * (0.25d0 + (x * ((x * 0.020833333333333332d0) - 0.08333333333333333d0)))) / eps_m) + (0.5d0 * ((-1.0d0) / eps_m)))
if (x <= (-2.7d+97)) then
tmp = t_0
else if (x <= 210.0d0) then
tmp = (eps_m * ((2.0d0 / eps_m) - x)) / 2.0d0
else if (x <= 1d+105) then
tmp = 0.0d0
else if ((x <= 1.05d+156) .or. (.not. (x <= 3.5d+254))) then
tmp = t_0
else
tmp = 0.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 * (((x * (0.25 + (x * ((x * 0.020833333333333332) - 0.08333333333333333)))) / eps_m) + (0.5 * (-1.0 / eps_m)));
double tmp;
if (x <= -2.7e+97) {
tmp = t_0;
} else if (x <= 210.0) {
tmp = (eps_m * ((2.0 / eps_m) - x)) / 2.0;
} else if (x <= 1e+105) {
tmp = 0.0;
} else if ((x <= 1.05e+156) || !(x <= 3.5e+254)) {
tmp = t_0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = x * (((x * (0.25 + (x * ((x * 0.020833333333333332) - 0.08333333333333333)))) / eps_m) + (0.5 * (-1.0 / eps_m))) tmp = 0 if x <= -2.7e+97: tmp = t_0 elif x <= 210.0: tmp = (eps_m * ((2.0 / eps_m) - x)) / 2.0 elif x <= 1e+105: tmp = 0.0 elif (x <= 1.05e+156) or not (x <= 3.5e+254): tmp = t_0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(x * Float64(Float64(Float64(x * Float64(0.25 + Float64(x * Float64(Float64(x * 0.020833333333333332) - 0.08333333333333333)))) / eps_m) + Float64(0.5 * Float64(-1.0 / eps_m)))) tmp = 0.0 if (x <= -2.7e+97) tmp = t_0; elseif (x <= 210.0) tmp = Float64(Float64(eps_m * Float64(Float64(2.0 / eps_m) - x)) / 2.0); elseif (x <= 1e+105) tmp = 0.0; elseif ((x <= 1.05e+156) || !(x <= 3.5e+254)) tmp = t_0; else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = x * (((x * (0.25 + (x * ((x * 0.020833333333333332) - 0.08333333333333333)))) / eps_m) + (0.5 * (-1.0 / eps_m))); tmp = 0.0; if (x <= -2.7e+97) tmp = t_0; elseif (x <= 210.0) tmp = (eps_m * ((2.0 / eps_m) - x)) / 2.0; elseif (x <= 1e+105) tmp = 0.0; elseif ((x <= 1.05e+156) || ~((x <= 3.5e+254))) tmp = t_0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(x * N[(N[(N[(x * N[(0.25 + N[(x * N[(N[(x * 0.020833333333333332), $MachinePrecision] - 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] + N[(0.5 * N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.7e+97], t$95$0, If[LessEqual[x, 210.0], N[(N[(eps$95$m * N[(N[(2.0 / eps$95$m), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1e+105], 0.0, If[Or[LessEqual[x, 1.05e+156], N[Not[LessEqual[x, 3.5e+254]], $MachinePrecision]], t$95$0, 0.0]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := x \cdot \left(\frac{x \cdot \left(0.25 + x \cdot \left(x \cdot 0.020833333333333332 - 0.08333333333333333\right)\right)}{eps\_m} + 0.5 \cdot \frac{-1}{eps\_m}\right)\\
\mathbf{if}\;x \leq -2.7 \cdot 10^{+97}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 210:\\
\;\;\;\;\frac{eps\_m \cdot \left(\frac{2}{eps\_m} - x\right)}{2}\\
\mathbf{elif}\;x \leq 10^{+105}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+156} \lor \neg \left(x \leq 3.5 \cdot 10^{+254}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.69999999999999993e97 or 9.9999999999999994e104 < x < 1.04999999999999991e156 or 3.50000000000000017e254 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 42.4%
Taylor expanded in eps around 0 30.6%
expm1-define30.6%
mul-1-neg30.6%
Simplified30.6%
Taylor expanded in x around 0 46.9%
Taylor expanded in eps around 0 52.1%
if -2.69999999999999993e97 < x < 210Initial program 57.0%
Simplified57.0%
Taylor expanded in x around 0 38.2%
Taylor expanded in eps around inf 80.6%
Taylor expanded in x around 0 68.0%
if 210 < x < 9.9999999999999994e104 or 1.04999999999999991e156 < x < 3.50000000000000017e254Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 57.5%
mul-1-neg57.5%
mul-1-neg57.5%
rec-exp57.5%
sub-neg57.5%
div-sub57.5%
mul-1-neg57.5%
rec-exp57.5%
+-inverses57.5%
Simplified57.5%
Final simplification62.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 260.0)
(/ (* eps_m (- (/ 2.0 eps_m) x)) 2.0)
(if (<= x 2.4e+257)
0.0
(/ (+ 2.0 (* 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 tmp;
if (x <= 260.0) {
tmp = (eps_m * ((2.0 / eps_m) - x)) / 2.0;
} else if (x <= 2.4e+257) {
tmp = 0.0;
} else {
tmp = (2.0 + (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) :: tmp
if (x <= 260.0d0) then
tmp = (eps_m * ((2.0d0 / eps_m) - x)) / 2.0d0
else if (x <= 2.4d+257) then
tmp = 0.0d0
else
tmp = (2.0d0 + (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 tmp;
if (x <= 260.0) {
tmp = (eps_m * ((2.0 / eps_m) - x)) / 2.0;
} else if (x <= 2.4e+257) {
tmp = 0.0;
} else {
tmp = (2.0 + (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): tmp = 0 if x <= 260.0: tmp = (eps_m * ((2.0 / eps_m) - x)) / 2.0 elif x <= 2.4e+257: tmp = 0.0 else: tmp = (2.0 + (x * ((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 <= 260.0) tmp = Float64(Float64(eps_m * Float64(Float64(2.0 / eps_m) - x)) / 2.0); elseif (x <= 2.4e+257) tmp = 0.0; else tmp = Float64(Float64(2.0 + Float64(x * 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 <= 260.0) tmp = (eps_m * ((2.0 / eps_m) - x)) / 2.0; elseif (x <= 2.4e+257) tmp = 0.0; else tmp = (2.0 + (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_] := If[LessEqual[x, 260.0], N[(N[(eps$95$m * N[(N[(2.0 / eps$95$m), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.4e+257], 0.0, N[(N[(2.0 + N[(x * 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 260:\\
\;\;\;\;\frac{eps\_m \cdot \left(\frac{2}{eps\_m} - x\right)}{2}\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+257}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(1 - eps\_m\right) \cdot \left(-1 + \frac{-1}{eps\_m}\right)\right)}{2}\\
\end{array}
\end{array}
if x < 260Initial program 63.1%
Simplified63.1%
Taylor expanded in x around 0 41.6%
Taylor expanded in eps around inf 81.9%
Taylor expanded in x around 0 65.6%
if 260 < x < 2.4000000000000001e257Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 51.6%
mul-1-neg51.6%
mul-1-neg51.6%
rec-exp51.6%
sub-neg51.6%
div-sub51.6%
mul-1-neg51.6%
rec-exp51.6%
+-inverses51.6%
Simplified51.6%
if 2.4000000000000001e257 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 47.5%
Taylor expanded in x around 0 46.6%
mul-1-neg46.6%
distribute-rgt-neg-in46.6%
*-commutative46.6%
distribute-rgt-neg-in46.6%
mul-1-neg46.6%
distribute-lft-in46.6%
metadata-eval46.6%
neg-mul-146.6%
distribute-neg-frac46.6%
metadata-eval46.6%
Simplified46.6%
Final simplification61.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 255.0) (/ (* eps_m (- (/ 2.0 eps_m) x)) 2.0) 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 255.0) {
tmp = (eps_m * ((2.0 / eps_m) - x)) / 2.0;
} else {
tmp = 0.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 <= 255.0d0) then
tmp = (eps_m * ((2.0d0 / eps_m) - x)) / 2.0d0
else
tmp = 0.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 <= 255.0) {
tmp = (eps_m * ((2.0 / eps_m) - x)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 255.0: tmp = (eps_m * ((2.0 / eps_m) - x)) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 255.0) tmp = Float64(Float64(eps_m * Float64(Float64(2.0 / eps_m) - x)) / 2.0); else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 255.0) tmp = (eps_m * ((2.0 / eps_m) - x)) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 255.0], N[(N[(eps$95$m * N[(N[(2.0 / eps$95$m), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 255:\\
\;\;\;\;\frac{eps\_m \cdot \left(\frac{2}{eps\_m} - x\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 255Initial program 63.1%
Simplified63.1%
Taylor expanded in x around 0 41.6%
Taylor expanded in eps around inf 81.9%
Taylor expanded in x around 0 65.6%
if 255 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 48.0%
mul-1-neg48.0%
mul-1-neg48.0%
rec-exp48.0%
sub-neg48.0%
div-sub48.0%
mul-1-neg48.0%
rec-exp48.0%
+-inverses48.0%
Simplified48.0%
Final simplification60.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.0) (/ (* x eps_m) (- 2.0)) (if (<= x 1200000.0) 1.0 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.0) {
tmp = (x * eps_m) / -2.0;
} else if (x <= 1200000.0) {
tmp = 1.0;
} else {
tmp = 0.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.0d0)) then
tmp = (x * eps_m) / -2.0d0
else if (x <= 1200000.0d0) then
tmp = 1.0d0
else
tmp = 0.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.0) {
tmp = (x * eps_m) / -2.0;
} else if (x <= 1200000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.0: tmp = (x * eps_m) / -2.0 elif x <= 1200000.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(x * eps_m) / Float64(-2.0)); elseif (x <= 1200000.0) tmp = 1.0; else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.0) tmp = (x * eps_m) / -2.0; elseif (x <= 1200000.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.0], N[(N[(x * eps$95$m), $MachinePrecision] / (-2.0)), $MachinePrecision], If[LessEqual[x, 1200000.0], 1.0, 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{x \cdot eps\_m}{-2}\\
\mathbf{elif}\;x \leq 1200000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 57.7%
Taylor expanded in eps around inf 37.3%
associate-*r*37.3%
mul-1-neg37.3%
Simplified37.3%
if -1 < x < 1.2e6Initial program 53.5%
Simplified53.5%
Taylor expanded in x around 0 73.4%
if 1.2e6 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 48.7%
mul-1-neg48.7%
mul-1-neg48.7%
rec-exp48.7%
sub-neg48.7%
div-sub48.7%
mul-1-neg48.7%
rec-exp48.7%
+-inverses48.7%
Simplified48.7%
Final simplification61.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.0) (/ (- 2.0 x) 2.0) 0.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;
}
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
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;
}
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 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 = 0.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; 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], 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{2 - x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2Initial program 63.4%
Simplified63.4%
Taylor expanded in x around 0 41.8%
Taylor expanded in eps around inf 82.2%
Taylor expanded in eps around inf 82.2%
mul-1-neg82.2%
distribute-rgt-neg-in82.2%
mul-1-neg82.2%
sub-neg82.2%
distribute-lft-in82.2%
metadata-eval82.2%
mul-1-neg82.2%
remove-double-neg82.2%
Simplified82.2%
Taylor expanded in x around 0 59.2%
neg-mul-159.2%
unsub-neg59.2%
Simplified59.2%
if 2 < x Initial program 98.7%
Simplified98.6%
Taylor expanded in eps around 0 47.4%
mul-1-neg47.4%
mul-1-neg47.4%
rec-exp47.4%
sub-neg47.4%
div-sub47.4%
mul-1-neg47.4%
rec-exp47.4%
+-inverses47.4%
Simplified47.4%
Final simplification55.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 1200000.0) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1200000.0) {
tmp = 1.0;
} else {
tmp = 0.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 <= 1200000.0d0) then
tmp = 1.0d0
else
tmp = 0.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 <= 1200000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1200000.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1200000.0) tmp = 1.0; else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1200000.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1200000.0], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1200000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.2e6Initial program 63.3%
Simplified63.3%
Taylor expanded in x around 0 58.6%
if 1.2e6 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 48.7%
mul-1-neg48.7%
mul-1-neg48.7%
rec-exp48.7%
sub-neg48.7%
div-sub48.7%
mul-1-neg48.7%
rec-exp48.7%
+-inverses48.7%
Simplified48.7%
Final simplification55.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 0.0)
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 0.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.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 0.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return 0.0
eps_m = abs(eps) function code(x, eps_m) return 0.0 end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 0.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 0.0
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
0
\end{array}
Initial program 73.5%
Simplified61.0%
Taylor expanded in eps around 0 15.1%
mul-1-neg15.1%
mul-1-neg15.1%
rec-exp15.1%
sub-neg15.1%
div-sub15.1%
mul-1-neg15.1%
rec-exp15.1%
+-inverses15.3%
Simplified15.3%
Final simplification15.3%
herbie shell --seed 2024074
(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))