
(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 25 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (- -1.0 eps_m)))))
(if (<=
(+
(* (- 1.0 (/ -1.0 eps_m)) (exp (* x (+ eps_m -1.0))))
(* t_0 (+ 1.0 (/ -1.0 eps_m))))
0.0)
(/ (+ (/ (+ 1.0 x) (exp x)) (* (+ 1.0 x) (exp (- x)))) 2.0)
(/ (+ (cbrt (pow (exp (fma eps_m x x)) 3.0)) t_0) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (-1.0 - eps_m)));
double tmp;
if ((((1.0 - (-1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (t_0 * (1.0 + (-1.0 / eps_m)))) <= 0.0) {
tmp = (((1.0 + x) / exp(x)) + ((1.0 + x) * exp(-x))) / 2.0;
} else {
tmp = (cbrt(pow(exp(fma(eps_m, x, x)), 3.0)) + t_0) / 2.0;
}
return tmp;
}
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(-1.0 - eps_m))) tmp = 0.0 if (Float64(Float64(Float64(1.0 - Float64(-1.0 / eps_m)) * exp(Float64(x * Float64(eps_m + -1.0)))) + Float64(t_0 * Float64(1.0 + Float64(-1.0 / eps_m)))) <= 0.0) tmp = Float64(Float64(Float64(Float64(1.0 + x) / exp(x)) + Float64(Float64(1.0 + x) * exp(Float64(-x)))) / 2.0); else tmp = Float64(Float64(cbrt((exp(fma(eps_m, x, x)) ^ 3.0)) + t_0) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(N[(N[(1.0 + x), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + x), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Power[N[Power[N[Exp[N[(eps$95$m * x + x), $MachinePrecision]], $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision] + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(-1 - eps\_m\right)}\\
\mathbf{if}\;\left(1 - \frac{-1}{eps\_m}\right) \cdot e^{x \cdot \left(eps\_m + -1\right)} + t\_0 \cdot \left(1 + \frac{-1}{eps\_m}\right) \leq 0:\\
\;\;\;\;\frac{\frac{1 + x}{e^{x}} + \left(1 + x\right) \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{{\left(e^{\mathsf{fma}\left(eps\_m, x, x\right)}\right)}^{3}} + t\_0}{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) < 0.0Initial program 35.4%
Simplified35.4%
Taylor expanded in eps around 0 100.0%
Simplified100.0%
exp-neg100.0%
un-div-inv100.0%
Applied egg-rr100.0%
if 0.0 < (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) Initial program 100.0%
Simplified88.4%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around -inf 100.0%
rec-exp100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
distribute-rgt-in100.0%
+-commutative100.0%
distribute-rgt-neg-in100.0%
distribute-neg-in100.0%
metadata-eval100.0%
unsub-neg100.0%
Simplified100.0%
add-cube-cbrt100.0%
pow3100.0%
sub-neg100.0%
metadata-eval100.0%
Applied egg-rr100.0%
rem-cube-cbrt100.0%
add-cbrt-cube100.0%
pow3100.0%
distribute-rgt-in100.0%
neg-mul-1100.0%
fma-define100.0%
add-sqr-sqrt48.7%
sqrt-unprod100.0%
sqr-neg100.0%
sqrt-unprod51.2%
add-sqr-sqrt100.0%
Applied egg-rr100.0%
Final simplification100.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (- -1.0 eps_m)))))
(if (<=
(+
(* (- 1.0 (/ -1.0 eps_m)) (exp (* x (+ eps_m -1.0))))
(* t_0 (+ 1.0 (/ -1.0 eps_m))))
0.0)
(/ (+ (/ (+ 1.0 x) (exp x)) (* (+ 1.0 x) (exp (- x)))) 2.0)
(/ (+ t_0 (exp (* eps_m x))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (-1.0 - eps_m)));
double tmp;
if ((((1.0 - (-1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (t_0 * (1.0 + (-1.0 / eps_m)))) <= 0.0) {
tmp = (((1.0 + x) / exp(x)) + ((1.0 + x) * exp(-x))) / 2.0;
} else {
tmp = (t_0 + exp((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) :: t_0
real(8) :: tmp
t_0 = exp((x * ((-1.0d0) - eps_m)))
if ((((1.0d0 - ((-1.0d0) / eps_m)) * exp((x * (eps_m + (-1.0d0))))) + (t_0 * (1.0d0 + ((-1.0d0) / eps_m)))) <= 0.0d0) then
tmp = (((1.0d0 + x) / exp(x)) + ((1.0d0 + x) * exp(-x))) / 2.0d0
else
tmp = (t_0 + exp((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 t_0 = Math.exp((x * (-1.0 - eps_m)));
double tmp;
if ((((1.0 - (-1.0 / eps_m)) * Math.exp((x * (eps_m + -1.0)))) + (t_0 * (1.0 + (-1.0 / eps_m)))) <= 0.0) {
tmp = (((1.0 + x) / Math.exp(x)) + ((1.0 + x) * Math.exp(-x))) / 2.0;
} else {
tmp = (t_0 + Math.exp((eps_m * x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (-1.0 - eps_m))) tmp = 0 if (((1.0 - (-1.0 / eps_m)) * math.exp((x * (eps_m + -1.0)))) + (t_0 * (1.0 + (-1.0 / eps_m)))) <= 0.0: tmp = (((1.0 + x) / math.exp(x)) + ((1.0 + x) * math.exp(-x))) / 2.0 else: tmp = (t_0 + math.exp((eps_m * x))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(-1.0 - eps_m))) tmp = 0.0 if (Float64(Float64(Float64(1.0 - Float64(-1.0 / eps_m)) * exp(Float64(x * Float64(eps_m + -1.0)))) + Float64(t_0 * Float64(1.0 + Float64(-1.0 / eps_m)))) <= 0.0) tmp = Float64(Float64(Float64(Float64(1.0 + x) / exp(x)) + Float64(Float64(1.0 + x) * exp(Float64(-x)))) / 2.0); else tmp = Float64(Float64(t_0 + exp(Float64(eps_m * x))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (-1.0 - eps_m))); tmp = 0.0; if ((((1.0 - (-1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (t_0 * (1.0 + (-1.0 / eps_m)))) <= 0.0) tmp = (((1.0 + x) / exp(x)) + ((1.0 + x) * exp(-x))) / 2.0; else tmp = (t_0 + exp((eps_m * x))) / 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[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(N[(N[(1.0 + x), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + x), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(t$95$0 + N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(-1 - eps\_m\right)}\\
\mathbf{if}\;\left(1 - \frac{-1}{eps\_m}\right) \cdot e^{x \cdot \left(eps\_m + -1\right)} + t\_0 \cdot \left(1 + \frac{-1}{eps\_m}\right) \leq 0:\\
\;\;\;\;\frac{\frac{1 + x}{e^{x}} + \left(1 + x\right) \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 + e^{eps\_m \cdot x}}{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) < 0.0Initial program 35.4%
Simplified35.4%
Taylor expanded in eps around 0 100.0%
Simplified100.0%
exp-neg100.0%
un-div-inv100.0%
Applied egg-rr100.0%
if 0.0 < (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) Initial program 100.0%
Simplified88.4%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around -inf 100.0%
rec-exp100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
distribute-rgt-in100.0%
+-commutative100.0%
distribute-rgt-neg-in100.0%
distribute-neg-in100.0%
metadata-eval100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification100.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (- -1.0 eps_m))) (exp (* x (+ eps_m -1.0)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (-1.0 - eps_m))) + exp((x * (eps_m + -1.0)))) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = (exp((x * ((-1.0d0) - eps_m))) + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (-1.0 - eps_m))) + Math.exp((x * (eps_m + -1.0)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (-1.0 - eps_m))) + math.exp((x * (eps_m + -1.0)))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(-1.0 - eps_m))) + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (-1.0 - eps_m))) + exp((x * (eps_m + -1.0)))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(-1 - eps\_m\right)} + e^{x \cdot \left(eps\_m + -1\right)}}{2}
\end{array}
Initial program 75.8%
Simplified68.5%
Taylor expanded in eps around inf 98.2%
Taylor expanded in x around -inf 98.2%
rec-exp98.2%
cancel-sign-sub-inv98.2%
metadata-eval98.2%
distribute-rgt-in98.2%
+-commutative98.2%
distribute-rgt-neg-in98.2%
distribute-neg-in98.2%
metadata-eval98.2%
unsub-neg98.2%
Simplified98.2%
Final simplification98.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (- -1.0 eps_m))) (exp (* eps_m x))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (-1.0 - eps_m))) + exp((eps_m * x))) / 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 * ((-1.0d0) - eps_m))) + exp((eps_m * x))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (-1.0 - eps_m))) + Math.exp((eps_m * x))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (-1.0 - eps_m))) + math.exp((eps_m * x))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(-1.0 - eps_m))) + exp(Float64(eps_m * x))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (-1.0 - eps_m))) + exp((eps_m * x))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(-1 - eps\_m\right)} + e^{eps\_m \cdot x}}{2}
\end{array}
Initial program 75.8%
Simplified68.5%
Taylor expanded in eps around inf 98.2%
Taylor expanded in x around -inf 98.2%
rec-exp98.2%
cancel-sign-sub-inv98.2%
metadata-eval98.2%
distribute-rgt-in98.2%
+-commutative98.2%
distribute-rgt-neg-in98.2%
distribute-neg-in98.2%
metadata-eval98.2%
unsub-neg98.2%
Simplified98.2%
Taylor expanded in eps around inf 89.9%
*-commutative89.9%
Simplified89.9%
Final simplification89.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -4.4e-234)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(if (or (<= x 9e+210) (not (<= x 8.2e+239)))
(/ (+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (+ 1.0 (* x (+ 1.0 eps_m))))) 2.0)
(/ (+ (- 1.0 (/ -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 <= -4.4e-234) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if ((x <= 9e+210) || !(x <= 8.2e+239)) {
tmp = (exp((x * (eps_m + -1.0))) + (1.0 / (1.0 + (x * (1.0 + eps_m))))) / 2.0;
} else {
tmp = ((1.0 - (-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 <= (-4.4d-234)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if ((x <= 9d+210) .or. (.not. (x <= 8.2d+239))) then
tmp = (exp((x * (eps_m + (-1.0d0)))) + (1.0d0 / (1.0d0 + (x * (1.0d0 + eps_m))))) / 2.0d0
else
tmp = ((1.0d0 - ((-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 <= -4.4e-234) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if ((x <= 9e+210) || !(x <= 8.2e+239)) {
tmp = (Math.exp((x * (eps_m + -1.0))) + (1.0 / (1.0 + (x * (1.0 + eps_m))))) / 2.0;
} else {
tmp = ((1.0 - (-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 <= -4.4e-234: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif (x <= 9e+210) or not (x <= 8.2e+239): tmp = (math.exp((x * (eps_m + -1.0))) + (1.0 / (1.0 + (x * (1.0 + eps_m))))) / 2.0 else: tmp = ((1.0 - (-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 <= -4.4e-234) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif ((x <= 9e+210) || !(x <= 8.2e+239)) tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / Float64(1.0 + Float64(x * Float64(1.0 + eps_m))))) / 2.0); else tmp = Float64(Float64(Float64(1.0 - 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 <= -4.4e-234) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif ((x <= 9e+210) || ~((x <= 8.2e+239))) tmp = (exp((x * (eps_m + -1.0))) + (1.0 / (1.0 + (x * (1.0 + eps_m))))) / 2.0; else tmp = ((1.0 - (-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, -4.4e-234], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 9e+210], N[Not[LessEqual[x, 8.2e+239]], $MachinePrecision]], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[(1.0 + N[(x * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{-234}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+210} \lor \neg \left(x \leq 8.2 \cdot 10^{+239}\right):\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{1 + x \cdot \left(1 + eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{-1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < -4.3999999999999998e-234Initial program 69.1%
Simplified69.1%
Taylor expanded in x around 0 39.3%
Taylor expanded in eps around inf 67.0%
sub-neg67.0%
mul-1-neg67.0%
remove-double-neg67.0%
mul-1-neg67.0%
distribute-rgt-neg-in67.0%
distribute-neg-in67.0%
metadata-eval67.0%
unsub-neg67.0%
Simplified67.0%
if -4.3999999999999998e-234 < x < 9.00000000000000007e210 or 8.2000000000000002e239 < x Initial program 78.9%
Simplified72.5%
Taylor expanded in eps around inf 98.9%
Taylor expanded in x around 0 61.3%
if 9.00000000000000007e210 < x < 8.2000000000000002e239Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 2.2%
Taylor expanded in x around 0 100.0%
Final simplification64.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -3.3e-252)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(if (or (<= x 1.9e+211) (not (<= x 9.5e+241)))
(/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0)
(/ (+ (- 1.0 (/ -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 <= -3.3e-252) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if ((x <= 1.9e+211) || !(x <= 9.5e+241)) {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
} else {
tmp = ((1.0 - (-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 <= (-3.3d-252)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if ((x <= 1.9d+211) .or. (.not. (x <= 9.5d+241))) then
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
else
tmp = ((1.0d0 - ((-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 <= -3.3e-252) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if ((x <= 1.9e+211) || !(x <= 9.5e+241)) {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
} else {
tmp = ((1.0 - (-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 <= -3.3e-252: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif (x <= 1.9e+211) or not (x <= 9.5e+241): tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 else: tmp = ((1.0 - (-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 <= -3.3e-252) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif ((x <= 1.9e+211) || !(x <= 9.5e+241)) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); else tmp = Float64(Float64(Float64(1.0 - 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 <= -3.3e-252) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif ((x <= 1.9e+211) || ~((x <= 9.5e+241))) tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; else tmp = ((1.0 - (-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, -3.3e-252], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.9e+211], N[Not[LessEqual[x, 9.5e+241]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{-252}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+211} \lor \neg \left(x \leq 9.5 \cdot 10^{+241}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{-1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < -3.30000000000000009e-252Initial program 70.0%
Simplified70.0%
Taylor expanded in x around 0 41.4%
Taylor expanded in eps around inf 68.5%
sub-neg68.5%
mul-1-neg68.5%
remove-double-neg68.5%
mul-1-neg68.5%
distribute-rgt-neg-in68.5%
distribute-neg-in68.5%
metadata-eval68.5%
unsub-neg68.5%
Simplified68.5%
if -3.30000000000000009e-252 < x < 1.90000000000000008e211 or 9.50000000000000019e241 < x Initial program 78.7%
Simplified72.4%
Taylor expanded in eps around inf 98.9%
Taylor expanded in x around 0 60.1%
if 1.90000000000000008e211 < x < 9.50000000000000019e241Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 2.2%
Taylor expanded in x around 0 100.0%
Final simplification64.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* x (+ eps_m -1.0))))
(if (<= x 5e-285)
(/ (* eps_m (+ x (/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) eps_m))) 2.0)
(if (<= x 1.9e+211)
(/ (+ 1.0 (pow E t_0)) 2.0)
(if (<= x 8.2e+239)
(/ (+ (- 1.0 (/ -1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/ (+ 1.0 (exp t_0)) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = x * (eps_m + -1.0);
double tmp;
if (x <= 5e-285) {
tmp = (eps_m * (x + ((1.0 + exp((x * (-1.0 - eps_m)))) / eps_m))) / 2.0;
} else if (x <= 1.9e+211) {
tmp = (1.0 + pow(((double) M_E), t_0)) / 2.0;
} else if (x <= 8.2e+239) {
tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (1.0 + exp(t_0)) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = x * (eps_m + -1.0);
double tmp;
if (x <= 5e-285) {
tmp = (eps_m * (x + ((1.0 + Math.exp((x * (-1.0 - eps_m)))) / eps_m))) / 2.0;
} else if (x <= 1.9e+211) {
tmp = (1.0 + Math.pow(Math.E, t_0)) / 2.0;
} else if (x <= 8.2e+239) {
tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (1.0 + Math.exp(t_0)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = x * (eps_m + -1.0) tmp = 0 if x <= 5e-285: tmp = (eps_m * (x + ((1.0 + math.exp((x * (-1.0 - eps_m)))) / eps_m))) / 2.0 elif x <= 1.9e+211: tmp = (1.0 + math.pow(math.e, t_0)) / 2.0 elif x <= 8.2e+239: tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (1.0 + math.exp(t_0)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(x * Float64(eps_m + -1.0)) tmp = 0.0 if (x <= 5e-285) tmp = Float64(Float64(eps_m * Float64(x + Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / eps_m))) / 2.0); elseif (x <= 1.9e+211) tmp = Float64(Float64(1.0 + (exp(1) ^ t_0)) / 2.0); elseif (x <= 8.2e+239) tmp = Float64(Float64(Float64(1.0 - Float64(-1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(1.0 + exp(t_0)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = x * (eps_m + -1.0); tmp = 0.0; if (x <= 5e-285) tmp = (eps_m * (x + ((1.0 + exp((x * (-1.0 - eps_m)))) / eps_m))) / 2.0; elseif (x <= 1.9e+211) tmp = (1.0 + (2.71828182845904523536 ^ t_0)) / 2.0; elseif (x <= 8.2e+239) tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (1.0 + exp(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[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 5e-285], N[(N[(eps$95$m * N[(x + N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.9e+211], N[(N[(1.0 + N[Power[E, t$95$0], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8.2e+239], N[(N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[t$95$0], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := x \cdot \left(eps\_m + -1\right)\\
\mathbf{if}\;x \leq 5 \cdot 10^{-285}:\\
\;\;\;\;\frac{eps\_m \cdot \left(x + \frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{eps\_m}\right)}{2}\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+211}:\\
\;\;\;\;\frac{1 + {e}^{t\_0}}{2}\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{+239}:\\
\;\;\;\;\frac{\left(1 - \frac{-1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{t\_0}}{2}\\
\end{array}
\end{array}
if x < 5.00000000000000018e-285Initial program 71.4%
Simplified71.4%
Taylor expanded in x around 0 46.9%
Taylor expanded in eps around inf 81.1%
associate--l+81.1%
associate-*r/81.1%
div-sub81.1%
sub-neg81.1%
mul-1-neg81.1%
remove-double-neg81.1%
mul-1-neg81.1%
distribute-rgt-neg-in81.1%
distribute-neg-in81.1%
metadata-eval81.1%
unsub-neg81.1%
Simplified81.1%
if 5.00000000000000018e-285 < x < 1.90000000000000008e211Initial program 76.8%
Simplified68.9%
Taylor expanded in eps around inf 98.6%
Taylor expanded in x around 0 54.8%
*-un-lft-identity54.8%
exp-prod54.8%
sub-neg54.8%
metadata-eval54.8%
Applied egg-rr54.8%
exp-1-e54.8%
+-commutative54.8%
Simplified54.8%
if 1.90000000000000008e211 < x < 8.2000000000000002e239Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 2.2%
Taylor expanded in x around 0 100.0%
if 8.2000000000000002e239 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 38.4%
Final simplification67.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* x (+ eps_m -1.0))))
(if (<= x -4e-252)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(if (<= x 1.46e+211)
(/ (+ 1.0 (pow E t_0)) 2.0)
(if (<= x 2.7e+240)
(/ (+ (- 1.0 (/ -1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/ (+ 1.0 (exp t_0)) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = x * (eps_m + -1.0);
double tmp;
if (x <= -4e-252) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 1.46e+211) {
tmp = (1.0 + pow(((double) M_E), t_0)) / 2.0;
} else if (x <= 2.7e+240) {
tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (1.0 + exp(t_0)) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = x * (eps_m + -1.0);
double tmp;
if (x <= -4e-252) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 1.46e+211) {
tmp = (1.0 + Math.pow(Math.E, t_0)) / 2.0;
} else if (x <= 2.7e+240) {
tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (1.0 + Math.exp(t_0)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = x * (eps_m + -1.0) tmp = 0 if x <= -4e-252: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif x <= 1.46e+211: tmp = (1.0 + math.pow(math.e, t_0)) / 2.0 elif x <= 2.7e+240: tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (1.0 + math.exp(t_0)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(x * Float64(eps_m + -1.0)) tmp = 0.0 if (x <= -4e-252) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif (x <= 1.46e+211) tmp = Float64(Float64(1.0 + (exp(1) ^ t_0)) / 2.0); elseif (x <= 2.7e+240) tmp = Float64(Float64(Float64(1.0 - Float64(-1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(1.0 + exp(t_0)) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = x * (eps_m + -1.0); tmp = 0.0; if (x <= -4e-252) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif (x <= 1.46e+211) tmp = (1.0 + (2.71828182845904523536 ^ t_0)) / 2.0; elseif (x <= 2.7e+240) tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (1.0 + exp(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[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4e-252], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.46e+211], N[(N[(1.0 + N[Power[E, t$95$0], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.7e+240], N[(N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[t$95$0], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := x \cdot \left(eps\_m + -1\right)\\
\mathbf{if}\;x \leq -4 \cdot 10^{-252}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 1.46 \cdot 10^{+211}:\\
\;\;\;\;\frac{1 + {e}^{t\_0}}{2}\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{+240}:\\
\;\;\;\;\frac{\left(1 - \frac{-1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{t\_0}}{2}\\
\end{array}
\end{array}
if x < -3.99999999999999977e-252Initial program 70.0%
Simplified70.0%
Taylor expanded in x around 0 41.4%
Taylor expanded in eps around inf 68.5%
sub-neg68.5%
mul-1-neg68.5%
remove-double-neg68.5%
mul-1-neg68.5%
distribute-rgt-neg-in68.5%
distribute-neg-in68.5%
metadata-eval68.5%
unsub-neg68.5%
Simplified68.5%
if -3.99999999999999977e-252 < x < 1.4599999999999999e211Initial program 77.0%
Simplified70.2%
Taylor expanded in eps around inf 98.8%
Taylor expanded in x around 0 61.8%
*-un-lft-identity61.8%
exp-prod61.8%
sub-neg61.8%
metadata-eval61.8%
Applied egg-rr61.8%
exp-1-e61.8%
+-commutative61.8%
Simplified61.8%
if 1.4599999999999999e211 < x < 2.6999999999999999e240Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 2.2%
Taylor expanded in x around 0 100.0%
if 2.6999999999999999e240 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 38.4%
Final simplification64.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -3.3e-252)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(if (or (<= x 4.3e+208) (not (<= x 2.1e+243)))
(/ (+ 1.0 (exp (* eps_m x))) 2.0)
(/ (+ (- 1.0 (/ -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 <= -3.3e-252) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if ((x <= 4.3e+208) || !(x <= 2.1e+243)) {
tmp = (1.0 + exp((eps_m * x))) / 2.0;
} else {
tmp = ((1.0 - (-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 <= (-3.3d-252)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if ((x <= 4.3d+208) .or. (.not. (x <= 2.1d+243))) then
tmp = (1.0d0 + exp((eps_m * x))) / 2.0d0
else
tmp = ((1.0d0 - ((-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 <= -3.3e-252) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if ((x <= 4.3e+208) || !(x <= 2.1e+243)) {
tmp = (1.0 + Math.exp((eps_m * x))) / 2.0;
} else {
tmp = ((1.0 - (-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 <= -3.3e-252: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif (x <= 4.3e+208) or not (x <= 2.1e+243): tmp = (1.0 + math.exp((eps_m * x))) / 2.0 else: tmp = ((1.0 - (-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 <= -3.3e-252) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif ((x <= 4.3e+208) || !(x <= 2.1e+243)) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * x))) / 2.0); else tmp = Float64(Float64(Float64(1.0 - 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 <= -3.3e-252) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif ((x <= 4.3e+208) || ~((x <= 2.1e+243))) tmp = (1.0 + exp((eps_m * x))) / 2.0; else tmp = ((1.0 - (-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, -3.3e-252], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 4.3e+208], N[Not[LessEqual[x, 2.1e+243]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{-252}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{+208} \lor \neg \left(x \leq 2.1 \cdot 10^{+243}\right):\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{-1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < -3.30000000000000009e-252Initial program 70.0%
Simplified70.0%
Taylor expanded in x around 0 41.4%
Taylor expanded in eps around inf 68.5%
sub-neg68.5%
mul-1-neg68.5%
remove-double-neg68.5%
mul-1-neg68.5%
distribute-rgt-neg-in68.5%
distribute-neg-in68.5%
metadata-eval68.5%
unsub-neg68.5%
Simplified68.5%
if -3.30000000000000009e-252 < x < 4.30000000000000042e208 or 2.0999999999999999e243 < x Initial program 78.7%
Simplified72.4%
Taylor expanded in eps around inf 98.9%
Taylor expanded in x around 0 60.1%
Taylor expanded in eps around inf 60.1%
*-commutative86.6%
Simplified60.1%
if 4.30000000000000042e208 < x < 2.0999999999999999e243Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 2.2%
Taylor expanded in x around 0 100.0%
Final simplification64.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 5e-285)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (or (<= x 1.45e+211) (not (<= x 1e+240)))
(/ (+ 1.0 (exp (* eps_m x))) 2.0)
(/ (+ (- 1.0 (/ -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 <= 5e-285) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if ((x <= 1.45e+211) || !(x <= 1e+240)) {
tmp = (1.0 + exp((eps_m * x))) / 2.0;
} else {
tmp = ((1.0 - (-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 <= 5d-285) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if ((x <= 1.45d+211) .or. (.not. (x <= 1d+240))) then
tmp = (1.0d0 + exp((eps_m * x))) / 2.0d0
else
tmp = ((1.0d0 - ((-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 <= 5e-285) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if ((x <= 1.45e+211) || !(x <= 1e+240)) {
tmp = (1.0 + Math.exp((eps_m * x))) / 2.0;
} else {
tmp = ((1.0 - (-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 <= 5e-285: tmp = (1.0 + math.exp(-x)) / 2.0 elif (x <= 1.45e+211) or not (x <= 1e+240): tmp = (1.0 + math.exp((eps_m * x))) / 2.0 else: tmp = ((1.0 - (-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 <= 5e-285) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif ((x <= 1.45e+211) || !(x <= 1e+240)) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * x))) / 2.0); else tmp = Float64(Float64(Float64(1.0 - 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 <= 5e-285) tmp = (1.0 + exp(-x)) / 2.0; elseif ((x <= 1.45e+211) || ~((x <= 1e+240))) tmp = (1.0 + exp((eps_m * x))) / 2.0; else tmp = ((1.0 - (-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, 5e-285], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.45e+211], N[Not[LessEqual[x, 1e+240]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{-285}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+211} \lor \neg \left(x \leq 10^{+240}\right):\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 - \frac{-1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < 5.00000000000000018e-285Initial program 71.4%
Simplified63.8%
Taylor expanded in eps around inf 97.5%
Taylor expanded in x around 0 77.2%
Taylor expanded in eps around 0 83.9%
mul-1-neg83.9%
Simplified83.9%
if 5.00000000000000018e-285 < x < 1.45e211 or 1.00000000000000001e240 < x Initial program 78.8%
Simplified71.6%
Taylor expanded in eps around inf 98.7%
Taylor expanded in x around 0 53.4%
Taylor expanded in eps around inf 53.4%
*-commutative84.3%
Simplified53.4%
if 1.45e211 < x < 1.00000000000000001e240Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 2.2%
Taylor expanded in x around 0 100.0%
Final simplification69.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 7.2e+37)
(/ (+ 1.0 (exp x)) 2.0)
(if (<= eps_m 1.4e+154)
(/
(+
2.0
(*
x
(/
(-
1.0
(-
(*
eps_m
(- (* eps_m (- 1.0 (+ (* x 0.5) (* 0.5 (* eps_m x))))) (* x -0.5)))
(* x -0.5)))
eps_m)))
2.0)
(if (<= eps_m 2.4e+199)
(/ (+ 1.0 (exp (- x))) 2.0)
(/
(+
2.0
(*
x
(-
(* (- -1.0 (/ -1.0 eps_m)) (+ 1.0 eps_m))
(* -0.5 (* x (/ (+ -1.0 (* eps_m (+ eps_m -1.0))) eps_m))))))
2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 7.2e+37) {
tmp = (1.0 + exp(x)) / 2.0;
} else if (eps_m <= 1.4e+154) {
tmp = (2.0 + (x * ((1.0 - ((eps_m * ((eps_m * (1.0 - ((x * 0.5) + (0.5 * (eps_m * x))))) - (x * -0.5))) - (x * -0.5))) / eps_m))) / 2.0;
} else if (eps_m <= 2.4e+199) {
tmp = (1.0 + exp(-x)) / 2.0;
} else {
tmp = (2.0 + (x * (((-1.0 - (-1.0 / eps_m)) * (1.0 + eps_m)) - (-0.5 * (x * ((-1.0 + (eps_m * (eps_m + -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 (eps_m <= 7.2d+37) then
tmp = (1.0d0 + exp(x)) / 2.0d0
else if (eps_m <= 1.4d+154) then
tmp = (2.0d0 + (x * ((1.0d0 - ((eps_m * ((eps_m * (1.0d0 - ((x * 0.5d0) + (0.5d0 * (eps_m * x))))) - (x * (-0.5d0)))) - (x * (-0.5d0)))) / eps_m))) / 2.0d0
else if (eps_m <= 2.4d+199) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else
tmp = (2.0d0 + (x * ((((-1.0d0) - ((-1.0d0) / eps_m)) * (1.0d0 + eps_m)) - ((-0.5d0) * (x * (((-1.0d0) + (eps_m * (eps_m + (-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 (eps_m <= 7.2e+37) {
tmp = (1.0 + Math.exp(x)) / 2.0;
} else if (eps_m <= 1.4e+154) {
tmp = (2.0 + (x * ((1.0 - ((eps_m * ((eps_m * (1.0 - ((x * 0.5) + (0.5 * (eps_m * x))))) - (x * -0.5))) - (x * -0.5))) / eps_m))) / 2.0;
} else if (eps_m <= 2.4e+199) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else {
tmp = (2.0 + (x * (((-1.0 - (-1.0 / eps_m)) * (1.0 + eps_m)) - (-0.5 * (x * ((-1.0 + (eps_m * (eps_m + -1.0))) / eps_m)))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 7.2e+37: tmp = (1.0 + math.exp(x)) / 2.0 elif eps_m <= 1.4e+154: tmp = (2.0 + (x * ((1.0 - ((eps_m * ((eps_m * (1.0 - ((x * 0.5) + (0.5 * (eps_m * x))))) - (x * -0.5))) - (x * -0.5))) / eps_m))) / 2.0 elif eps_m <= 2.4e+199: tmp = (1.0 + math.exp(-x)) / 2.0 else: tmp = (2.0 + (x * (((-1.0 - (-1.0 / eps_m)) * (1.0 + eps_m)) - (-0.5 * (x * ((-1.0 + (eps_m * (eps_m + -1.0))) / eps_m)))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 7.2e+37) tmp = Float64(Float64(1.0 + exp(x)) / 2.0); elseif (eps_m <= 1.4e+154) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 - Float64(Float64(eps_m * Float64(Float64(eps_m * Float64(1.0 - Float64(Float64(x * 0.5) + Float64(0.5 * Float64(eps_m * x))))) - Float64(x * -0.5))) - Float64(x * -0.5))) / eps_m))) / 2.0); elseif (eps_m <= 2.4e+199) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(-1.0 - Float64(-1.0 / eps_m)) * Float64(1.0 + eps_m)) - Float64(-0.5 * Float64(x * Float64(Float64(-1.0 + Float64(eps_m * Float64(eps_m + -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 (eps_m <= 7.2e+37) tmp = (1.0 + exp(x)) / 2.0; elseif (eps_m <= 1.4e+154) tmp = (2.0 + (x * ((1.0 - ((eps_m * ((eps_m * (1.0 - ((x * 0.5) + (0.5 * (eps_m * x))))) - (x * -0.5))) - (x * -0.5))) / eps_m))) / 2.0; elseif (eps_m <= 2.4e+199) tmp = (1.0 + exp(-x)) / 2.0; else tmp = (2.0 + (x * (((-1.0 - (-1.0 / eps_m)) * (1.0 + eps_m)) - (-0.5 * (x * ((-1.0 + (eps_m * (eps_m + -1.0))) / 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, 7.2e+37], N[(N[(1.0 + N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps$95$m, 1.4e+154], N[(N[(2.0 + N[(x * N[(N[(1.0 - N[(N[(eps$95$m * N[(N[(eps$95$m * N[(1.0 - N[(N[(x * 0.5), $MachinePrecision] + N[(0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps$95$m, 2.4e+199], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(N[(N[(-1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(x * N[(N[(-1.0 + N[(eps$95$m * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $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 7.2 \cdot 10^{+37}:\\
\;\;\;\;\frac{1 + e^{x}}{2}\\
\mathbf{elif}\;eps\_m \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;\frac{2 + x \cdot \frac{1 - \left(eps\_m \cdot \left(eps\_m \cdot \left(1 - \left(x \cdot 0.5 + 0.5 \cdot \left(eps\_m \cdot x\right)\right)\right) - x \cdot -0.5\right) - x \cdot -0.5\right)}{eps\_m}}{2}\\
\mathbf{elif}\;eps\_m \leq 2.4 \cdot 10^{+199}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(-1 - \frac{-1}{eps\_m}\right) \cdot \left(1 + eps\_m\right) - -0.5 \cdot \left(x \cdot \frac{-1 + eps\_m \cdot \left(eps\_m + -1\right)}{eps\_m}\right)\right)}{2}\\
\end{array}
\end{array}
if eps < 7.19999999999999995e37Initial program 67.7%
Simplified62.6%
Taylor expanded in eps around inf 97.5%
Taylor expanded in x around 0 63.1%
Taylor expanded in eps around 0 57.2%
mul-1-neg57.2%
Simplified57.2%
*-un-lft-identity57.2%
+-commutative57.2%
add-sqr-sqrt35.5%
sqrt-unprod70.6%
sqr-neg70.6%
sqrt-unprod35.0%
add-sqr-sqrt61.0%
Applied egg-rr61.0%
*-lft-identity61.0%
Simplified61.0%
if 7.19999999999999995e37 < eps < 1.4e154Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 68.9%
Taylor expanded in x around 0 72.8%
sub-neg72.8%
metadata-eval72.8%
+-commutative72.8%
associate-*r*72.8%
distribute-lft-in72.8%
metadata-eval72.8%
neg-mul-172.8%
sub-neg72.8%
metadata-eval72.8%
+-commutative72.8%
Simplified72.8%
Taylor expanded in eps around 0 79.5%
if 1.4e154 < eps < 2.40000000000000015e199Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 63.7%
Taylor expanded in eps around 0 87.9%
mul-1-neg87.9%
Simplified87.9%
if 2.40000000000000015e199 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 55.0%
Taylor expanded in x around 0 89.6%
sub-neg89.6%
metadata-eval89.6%
+-commutative89.6%
associate-*r*89.6%
distribute-lft-in89.6%
metadata-eval89.6%
neg-mul-189.6%
sub-neg89.6%
metadata-eval89.6%
+-commutative89.6%
Simplified89.6%
Taylor expanded in eps around 0 89.6%
mul-1-neg89.6%
sub-neg89.6%
Simplified89.6%
Final simplification67.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 1.8e+37)
(/ (+ 1.0 (exp x)) 2.0)
(/
(+
2.0
(*
x
(/
(-
1.0
(-
(*
eps_m
(- (* eps_m (- 1.0 (+ (* x 0.5) (* 0.5 (* eps_m x))))) (* x -0.5)))
(* x -0.5)))
eps_m)))
2.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.8e+37) {
tmp = (1.0 + exp(x)) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 - ((eps_m * ((eps_m * (1.0 - ((x * 0.5) + (0.5 * (eps_m * x))))) - (x * -0.5))) - (x * -0.5))) / 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 <= 1.8d+37) then
tmp = (1.0d0 + exp(x)) / 2.0d0
else
tmp = (2.0d0 + (x * ((1.0d0 - ((eps_m * ((eps_m * (1.0d0 - ((x * 0.5d0) + (0.5d0 * (eps_m * x))))) - (x * (-0.5d0)))) - (x * (-0.5d0)))) / 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 <= 1.8e+37) {
tmp = (1.0 + Math.exp(x)) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 - ((eps_m * ((eps_m * (1.0 - ((x * 0.5) + (0.5 * (eps_m * x))))) - (x * -0.5))) - (x * -0.5))) / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.8e+37: tmp = (1.0 + math.exp(x)) / 2.0 else: tmp = (2.0 + (x * ((1.0 - ((eps_m * ((eps_m * (1.0 - ((x * 0.5) + (0.5 * (eps_m * x))))) - (x * -0.5))) - (x * -0.5))) / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.8e+37) tmp = Float64(Float64(1.0 + exp(x)) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 - Float64(Float64(eps_m * Float64(Float64(eps_m * Float64(1.0 - Float64(Float64(x * 0.5) + Float64(0.5 * Float64(eps_m * x))))) - Float64(x * -0.5))) - Float64(x * -0.5))) / 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 <= 1.8e+37) tmp = (1.0 + exp(x)) / 2.0; else tmp = (2.0 + (x * ((1.0 - ((eps_m * ((eps_m * (1.0 - ((x * 0.5) + (0.5 * (eps_m * x))))) - (x * -0.5))) - (x * -0.5))) / 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, 1.8e+37], N[(N[(1.0 + N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(N[(1.0 - N[(N[(eps$95$m * N[(N[(eps$95$m * N[(1.0 - N[(N[(x * 0.5), $MachinePrecision] + N[(0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 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 1.8 \cdot 10^{+37}:\\
\;\;\;\;\frac{1 + e^{x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \frac{1 - \left(eps\_m \cdot \left(eps\_m \cdot \left(1 - \left(x \cdot 0.5 + 0.5 \cdot \left(eps\_m \cdot x\right)\right)\right) - x \cdot -0.5\right) - x \cdot -0.5\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if eps < 1.79999999999999999e37Initial program 67.7%
Simplified62.6%
Taylor expanded in eps around inf 97.5%
Taylor expanded in x around 0 63.1%
Taylor expanded in eps around 0 57.2%
mul-1-neg57.2%
Simplified57.2%
*-un-lft-identity57.2%
+-commutative57.2%
add-sqr-sqrt35.5%
sqrt-unprod70.6%
sqr-neg70.6%
sqrt-unprod35.0%
add-sqr-sqrt61.0%
Applied egg-rr61.0%
*-lft-identity61.0%
Simplified61.0%
if 1.79999999999999999e37 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 66.7%
Taylor expanded in x around 0 76.0%
sub-neg76.0%
metadata-eval76.0%
+-commutative76.0%
associate-*r*76.0%
distribute-lft-in76.0%
metadata-eval76.0%
neg-mul-176.0%
sub-neg76.0%
metadata-eval76.0%
+-commutative76.0%
Simplified76.0%
Taylor expanded in eps around 0 78.8%
Final simplification65.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 7.2e-10)
1.0
(if (<= eps_m 1.4e+154)
(/
(-
2.0
(*
x
(/
(+
-1.0
(- (* eps_m (- (* eps_m (- 1.0 (* x 0.5))) (* x -0.5))) (* x -0.5)))
eps_m)))
2.0)
(if (<= eps_m 8.5e+202)
(/ (+ (* x 0.5) (* eps_m (+ 1.0 (* -0.5 (* eps_m x))))) eps_m)
(/
(+
2.0
(*
x
(-
(* (- -1.0 (/ -1.0 eps_m)) (+ 1.0 eps_m))
(* -0.5 (* x (/ (+ -1.0 (* eps_m (+ eps_m -1.0))) eps_m))))))
2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 7.2e-10) {
tmp = 1.0;
} else if (eps_m <= 1.4e+154) {
tmp = (2.0 - (x * ((-1.0 + ((eps_m * ((eps_m * (1.0 - (x * 0.5))) - (x * -0.5))) - (x * -0.5))) / eps_m))) / 2.0;
} else if (eps_m <= 8.5e+202) {
tmp = ((x * 0.5) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m;
} else {
tmp = (2.0 + (x * (((-1.0 - (-1.0 / eps_m)) * (1.0 + eps_m)) - (-0.5 * (x * ((-1.0 + (eps_m * (eps_m + -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 (eps_m <= 7.2d-10) then
tmp = 1.0d0
else if (eps_m <= 1.4d+154) then
tmp = (2.0d0 - (x * (((-1.0d0) + ((eps_m * ((eps_m * (1.0d0 - (x * 0.5d0))) - (x * (-0.5d0)))) - (x * (-0.5d0)))) / eps_m))) / 2.0d0
else if (eps_m <= 8.5d+202) then
tmp = ((x * 0.5d0) + (eps_m * (1.0d0 + ((-0.5d0) * (eps_m * x))))) / eps_m
else
tmp = (2.0d0 + (x * ((((-1.0d0) - ((-1.0d0) / eps_m)) * (1.0d0 + eps_m)) - ((-0.5d0) * (x * (((-1.0d0) + (eps_m * (eps_m + (-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 (eps_m <= 7.2e-10) {
tmp = 1.0;
} else if (eps_m <= 1.4e+154) {
tmp = (2.0 - (x * ((-1.0 + ((eps_m * ((eps_m * (1.0 - (x * 0.5))) - (x * -0.5))) - (x * -0.5))) / eps_m))) / 2.0;
} else if (eps_m <= 8.5e+202) {
tmp = ((x * 0.5) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m;
} else {
tmp = (2.0 + (x * (((-1.0 - (-1.0 / eps_m)) * (1.0 + eps_m)) - (-0.5 * (x * ((-1.0 + (eps_m * (eps_m + -1.0))) / eps_m)))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 7.2e-10: tmp = 1.0 elif eps_m <= 1.4e+154: tmp = (2.0 - (x * ((-1.0 + ((eps_m * ((eps_m * (1.0 - (x * 0.5))) - (x * -0.5))) - (x * -0.5))) / eps_m))) / 2.0 elif eps_m <= 8.5e+202: tmp = ((x * 0.5) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m else: tmp = (2.0 + (x * (((-1.0 - (-1.0 / eps_m)) * (1.0 + eps_m)) - (-0.5 * (x * ((-1.0 + (eps_m * (eps_m + -1.0))) / eps_m)))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 7.2e-10) tmp = 1.0; elseif (eps_m <= 1.4e+154) tmp = Float64(Float64(2.0 - Float64(x * Float64(Float64(-1.0 + Float64(Float64(eps_m * Float64(Float64(eps_m * Float64(1.0 - Float64(x * 0.5))) - Float64(x * -0.5))) - Float64(x * -0.5))) / eps_m))) / 2.0); elseif (eps_m <= 8.5e+202) tmp = Float64(Float64(Float64(x * 0.5) + Float64(eps_m * Float64(1.0 + Float64(-0.5 * Float64(eps_m * x))))) / eps_m); else tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(-1.0 - Float64(-1.0 / eps_m)) * Float64(1.0 + eps_m)) - Float64(-0.5 * Float64(x * Float64(Float64(-1.0 + Float64(eps_m * Float64(eps_m + -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 (eps_m <= 7.2e-10) tmp = 1.0; elseif (eps_m <= 1.4e+154) tmp = (2.0 - (x * ((-1.0 + ((eps_m * ((eps_m * (1.0 - (x * 0.5))) - (x * -0.5))) - (x * -0.5))) / eps_m))) / 2.0; elseif (eps_m <= 8.5e+202) tmp = ((x * 0.5) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m; else tmp = (2.0 + (x * (((-1.0 - (-1.0 / eps_m)) * (1.0 + eps_m)) - (-0.5 * (x * ((-1.0 + (eps_m * (eps_m + -1.0))) / 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, 7.2e-10], 1.0, If[LessEqual[eps$95$m, 1.4e+154], N[(N[(2.0 - N[(x * N[(N[(-1.0 + N[(N[(eps$95$m * N[(N[(eps$95$m * N[(1.0 - N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps$95$m, 8.5e+202], N[(N[(N[(x * 0.5), $MachinePrecision] + N[(eps$95$m * N[(1.0 + N[(-0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision], N[(N[(2.0 + N[(x * N[(N[(N[(-1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision] - N[(-0.5 * N[(x * N[(N[(-1.0 + N[(eps$95$m * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $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 7.2 \cdot 10^{-10}:\\
\;\;\;\;1\\
\mathbf{elif}\;eps\_m \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;\frac{2 - x \cdot \frac{-1 + \left(eps\_m \cdot \left(eps\_m \cdot \left(1 - x \cdot 0.5\right) - x \cdot -0.5\right) - x \cdot -0.5\right)}{eps\_m}}{2}\\
\mathbf{elif}\;eps\_m \leq 8.5 \cdot 10^{+202}:\\
\;\;\;\;\frac{x \cdot 0.5 + eps\_m \cdot \left(1 + -0.5 \cdot \left(eps\_m \cdot x\right)\right)}{eps\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(-1 - \frac{-1}{eps\_m}\right) \cdot \left(1 + eps\_m\right) - -0.5 \cdot \left(x \cdot \frac{-1 + eps\_m \cdot \left(eps\_m + -1\right)}{eps\_m}\right)\right)}{2}\\
\end{array}
\end{array}
if eps < 7.2e-10Initial program 65.3%
Simplified65.3%
Taylor expanded in x around 0 46.2%
if 7.2e-10 < eps < 1.4e154Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 71.6%
Taylor expanded in x around 0 74.5%
sub-neg74.5%
metadata-eval74.5%
+-commutative74.5%
associate-*r*74.5%
distribute-lft-in74.5%
metadata-eval74.5%
neg-mul-174.5%
sub-neg74.5%
metadata-eval74.5%
+-commutative74.5%
Simplified74.5%
Taylor expanded in eps around 0 71.8%
if 1.4e154 < eps < 8.5000000000000003e202Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in x around 0 64.4%
Taylor expanded in x around inf 64.4%
Taylor expanded in eps around 0 88.0%
if 8.5000000000000003e202 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 55.0%
Taylor expanded in x around 0 89.6%
sub-neg89.6%
metadata-eval89.6%
+-commutative89.6%
associate-*r*89.6%
distribute-lft-in89.6%
metadata-eval89.6%
neg-mul-189.6%
sub-neg89.6%
metadata-eval89.6%
+-commutative89.6%
Simplified89.6%
Taylor expanded in eps around 0 89.6%
mul-1-neg89.6%
sub-neg89.6%
Simplified89.6%
Final simplification56.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 1.7e-214)
(* eps_m (+ (/ 1.0 eps_m) (* x -0.5)))
(if (<= x 3.8e-155)
(* x (/ (+ 0.5 (/ eps_m x)) eps_m))
(if (<= x 360.0)
1.0
(if (or (<= x 1.35e+164) (and (not (<= x 1.32e+211)) (<= x 3.2e+241)))
(/ (+ (- 1.0 (/ -1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/ (+ 2.0 (* x (+ -1.0 (* x 0.5)))) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.7e-214) {
tmp = eps_m * ((1.0 / eps_m) + (x * -0.5));
} else if (x <= 3.8e-155) {
tmp = x * ((0.5 + (eps_m / x)) / eps_m);
} else if (x <= 360.0) {
tmp = 1.0;
} else if ((x <= 1.35e+164) || (!(x <= 1.32e+211) && (x <= 3.2e+241))) {
tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 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-214) then
tmp = eps_m * ((1.0d0 / eps_m) + (x * (-0.5d0)))
else if (x <= 3.8d-155) then
tmp = x * ((0.5d0 + (eps_m / x)) / eps_m)
else if (x <= 360.0d0) then
tmp = 1.0d0
else if ((x <= 1.35d+164) .or. (.not. (x <= 1.32d+211)) .and. (x <= 3.2d+241)) then
tmp = ((1.0d0 - ((-1.0d0) / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = (2.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))) / 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-214) {
tmp = eps_m * ((1.0 / eps_m) + (x * -0.5));
} else if (x <= 3.8e-155) {
tmp = x * ((0.5 + (eps_m / x)) / eps_m);
} else if (x <= 360.0) {
tmp = 1.0;
} else if ((x <= 1.35e+164) || (!(x <= 1.32e+211) && (x <= 3.2e+241))) {
tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.7e-214: tmp = eps_m * ((1.0 / eps_m) + (x * -0.5)) elif x <= 3.8e-155: tmp = x * ((0.5 + (eps_m / x)) / eps_m) elif x <= 360.0: tmp = 1.0 elif (x <= 1.35e+164) or (not (x <= 1.32e+211) and (x <= 3.2e+241)): tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.7e-214) tmp = Float64(eps_m * Float64(Float64(1.0 / eps_m) + Float64(x * -0.5))); elseif (x <= 3.8e-155) tmp = Float64(x * Float64(Float64(0.5 + Float64(eps_m / x)) / eps_m)); elseif (x <= 360.0) tmp = 1.0; elseif ((x <= 1.35e+164) || (!(x <= 1.32e+211) && (x <= 3.2e+241))) tmp = Float64(Float64(Float64(1.0 - Float64(-1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1.7e-214) tmp = eps_m * ((1.0 / eps_m) + (x * -0.5)); elseif (x <= 3.8e-155) tmp = x * ((0.5 + (eps_m / x)) / eps_m); elseif (x <= 360.0) tmp = 1.0; elseif ((x <= 1.35e+164) || (~((x <= 1.32e+211)) && (x <= 3.2e+241))) tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.7e-214], N[(eps$95$m * N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.8e-155], N[(x * N[(N[(0.5 + N[(eps$95$m / x), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 360.0], 1.0, If[Or[LessEqual[x, 1.35e+164], And[N[Not[LessEqual[x, 1.32e+211]], $MachinePrecision], LessEqual[x, 3.2e+241]]], N[(N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * 0.5), $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^{-214}:\\
\;\;\;\;eps\_m \cdot \left(\frac{1}{eps\_m} + x \cdot -0.5\right)\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-155}:\\
\;\;\;\;x \cdot \frac{0.5 + \frac{eps\_m}{x}}{eps\_m}\\
\mathbf{elif}\;x \leq 360:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+164} \lor \neg \left(x \leq 1.32 \cdot 10^{+211}\right) \land x \leq 3.2 \cdot 10^{+241}:\\
\;\;\;\;\frac{\left(1 - \frac{-1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot 0.5\right)}{2}\\
\end{array}
\end{array}
if x < 1.7e-214Initial program 68.6%
Simplified68.6%
Taylor expanded in x around 0 46.6%
Taylor expanded in x around 0 35.7%
Taylor expanded in x around inf 49.1%
Taylor expanded in eps around inf 65.0%
if 1.7e-214 < x < 3.7999999999999998e-155Initial program 61.3%
Simplified61.3%
Taylor expanded in x around 0 48.3%
Taylor expanded in x around 0 22.2%
Taylor expanded in x around inf 48.0%
Taylor expanded in eps around 0 87.0%
if 3.7999999999999998e-155 < x < 360Initial program 58.0%
Simplified58.0%
Taylor expanded in x around 0 62.7%
if 360 < x < 1.35000000000000003e164 or 1.31999999999999998e211 < x < 3.20000000000000004e241Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 29.6%
Taylor expanded in x around 0 51.6%
if 1.35000000000000003e164 < x < 1.31999999999999998e211 or 3.20000000000000004e241 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 35.4%
Taylor expanded in eps around 0 3.1%
mul-1-neg3.1%
Simplified3.1%
Taylor expanded in x around 0 83.6%
Final simplification64.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.55e-8)
(/
(-
2.0
(*
x
(/
(+
-1.0
(- (* eps_m (- (* eps_m (- 1.0 (* x 0.5))) (* x -0.5))) (* x -0.5)))
eps_m)))
2.0)
(if (<= x 360.0)
1.0
(if (or (<= x 1.25e+164) (and (not (<= x 3.6e+210)) (<= x 5.2e+240)))
(/ (+ (- 1.0 (/ -1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/ (+ 2.0 (* x (+ -1.0 (* x 0.5)))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.55e-8) {
tmp = (2.0 - (x * ((-1.0 + ((eps_m * ((eps_m * (1.0 - (x * 0.5))) - (x * -0.5))) - (x * -0.5))) / eps_m))) / 2.0;
} else if (x <= 360.0) {
tmp = 1.0;
} else if ((x <= 1.25e+164) || (!(x <= 3.6e+210) && (x <= 5.2e+240))) {
tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 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.55d-8)) then
tmp = (2.0d0 - (x * (((-1.0d0) + ((eps_m * ((eps_m * (1.0d0 - (x * 0.5d0))) - (x * (-0.5d0)))) - (x * (-0.5d0)))) / eps_m))) / 2.0d0
else if (x <= 360.0d0) then
tmp = 1.0d0
else if ((x <= 1.25d+164) .or. (.not. (x <= 3.6d+210)) .and. (x <= 5.2d+240)) then
tmp = ((1.0d0 - ((-1.0d0) / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = (2.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))) / 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.55e-8) {
tmp = (2.0 - (x * ((-1.0 + ((eps_m * ((eps_m * (1.0 - (x * 0.5))) - (x * -0.5))) - (x * -0.5))) / eps_m))) / 2.0;
} else if (x <= 360.0) {
tmp = 1.0;
} else if ((x <= 1.25e+164) || (!(x <= 3.6e+210) && (x <= 5.2e+240))) {
tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.55e-8: tmp = (2.0 - (x * ((-1.0 + ((eps_m * ((eps_m * (1.0 - (x * 0.5))) - (x * -0.5))) - (x * -0.5))) / eps_m))) / 2.0 elif x <= 360.0: tmp = 1.0 elif (x <= 1.25e+164) or (not (x <= 3.6e+210) and (x <= 5.2e+240)): tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.55e-8) tmp = Float64(Float64(2.0 - Float64(x * Float64(Float64(-1.0 + Float64(Float64(eps_m * Float64(Float64(eps_m * Float64(1.0 - Float64(x * 0.5))) - Float64(x * -0.5))) - Float64(x * -0.5))) / eps_m))) / 2.0); elseif (x <= 360.0) tmp = 1.0; elseif ((x <= 1.25e+164) || (!(x <= 3.6e+210) && (x <= 5.2e+240))) tmp = Float64(Float64(Float64(1.0 - Float64(-1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.55e-8) tmp = (2.0 - (x * ((-1.0 + ((eps_m * ((eps_m * (1.0 - (x * 0.5))) - (x * -0.5))) - (x * -0.5))) / eps_m))) / 2.0; elseif (x <= 360.0) tmp = 1.0; elseif ((x <= 1.25e+164) || (~((x <= 3.6e+210)) && (x <= 5.2e+240))) tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.55e-8], N[(N[(2.0 - N[(x * N[(N[(-1.0 + N[(N[(eps$95$m * N[(N[(eps$95$m * N[(1.0 - N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 360.0], 1.0, If[Or[LessEqual[x, 1.25e+164], And[N[Not[LessEqual[x, 3.6e+210]], $MachinePrecision], LessEqual[x, 5.2e+240]]], N[(N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{-8}:\\
\;\;\;\;\frac{2 - x \cdot \frac{-1 + \left(eps\_m \cdot \left(eps\_m \cdot \left(1 - x \cdot 0.5\right) - x \cdot -0.5\right) - x \cdot -0.5\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 360:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{+164} \lor \neg \left(x \leq 3.6 \cdot 10^{+210}\right) \land x \leq 5.2 \cdot 10^{+240}:\\
\;\;\;\;\frac{\left(1 - \frac{-1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot 0.5\right)}{2}\\
\end{array}
\end{array}
if x < -1.55e-8Initial program 92.9%
Simplified92.9%
Taylor expanded in x around 0 47.8%
Taylor expanded in x around 0 81.2%
sub-neg81.2%
metadata-eval81.2%
+-commutative81.2%
associate-*r*81.2%
distribute-lft-in81.2%
metadata-eval81.2%
neg-mul-181.2%
sub-neg81.2%
metadata-eval81.2%
+-commutative81.2%
Simplified81.2%
Taylor expanded in eps around 0 39.4%
if -1.55e-8 < x < 360Initial program 58.7%
Simplified58.7%
Taylor expanded in x around 0 75.8%
if 360 < x < 1.24999999999999987e164 or 3.6000000000000003e210 < x < 5.2e240Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 29.6%
Taylor expanded in x around 0 51.6%
if 1.24999999999999987e164 < x < 3.6000000000000003e210 or 5.2e240 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 35.4%
Taylor expanded in eps around 0 3.1%
mul-1-neg3.1%
Simplified3.1%
Taylor expanded in x around 0 83.6%
Final simplification65.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -3.7e-9)
(/ (+ (* x 0.5) (* eps_m (+ 1.0 (* -0.5 (* eps_m x))))) eps_m)
(if (<= x 360.0)
1.0
(if (or (<= x 1.3e+162) (and (not (<= x 1.9e+211)) (<= x 1.25e+241)))
(/ (+ (- 1.0 (/ -1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/ (+ 2.0 (* x (+ -1.0 (* x 0.5)))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -3.7e-9) {
tmp = ((x * 0.5) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m;
} else if (x <= 360.0) {
tmp = 1.0;
} else if ((x <= 1.3e+162) || (!(x <= 1.9e+211) && (x <= 1.25e+241))) {
tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 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 <= (-3.7d-9)) then
tmp = ((x * 0.5d0) + (eps_m * (1.0d0 + ((-0.5d0) * (eps_m * x))))) / eps_m
else if (x <= 360.0d0) then
tmp = 1.0d0
else if ((x <= 1.3d+162) .or. (.not. (x <= 1.9d+211)) .and. (x <= 1.25d+241)) then
tmp = ((1.0d0 - ((-1.0d0) / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = (2.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))) / 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 <= -3.7e-9) {
tmp = ((x * 0.5) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m;
} else if (x <= 360.0) {
tmp = 1.0;
} else if ((x <= 1.3e+162) || (!(x <= 1.9e+211) && (x <= 1.25e+241))) {
tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -3.7e-9: tmp = ((x * 0.5) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m elif x <= 360.0: tmp = 1.0 elif (x <= 1.3e+162) or (not (x <= 1.9e+211) and (x <= 1.25e+241)): tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -3.7e-9) tmp = Float64(Float64(Float64(x * 0.5) + Float64(eps_m * Float64(1.0 + Float64(-0.5 * Float64(eps_m * x))))) / eps_m); elseif (x <= 360.0) tmp = 1.0; elseif ((x <= 1.3e+162) || (!(x <= 1.9e+211) && (x <= 1.25e+241))) tmp = Float64(Float64(Float64(1.0 - Float64(-1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -3.7e-9) tmp = ((x * 0.5) + (eps_m * (1.0 + (-0.5 * (eps_m * x))))) / eps_m; elseif (x <= 360.0) tmp = 1.0; elseif ((x <= 1.3e+162) || (~((x <= 1.9e+211)) && (x <= 1.25e+241))) tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -3.7e-9], N[(N[(N[(x * 0.5), $MachinePrecision] + N[(eps$95$m * N[(1.0 + N[(-0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision], If[LessEqual[x, 360.0], 1.0, If[Or[LessEqual[x, 1.3e+162], And[N[Not[LessEqual[x, 1.9e+211]], $MachinePrecision], LessEqual[x, 1.25e+241]]], N[(N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{-9}:\\
\;\;\;\;\frac{x \cdot 0.5 + eps\_m \cdot \left(1 + -0.5 \cdot \left(eps\_m \cdot x\right)\right)}{eps\_m}\\
\mathbf{elif}\;x \leq 360:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+162} \lor \neg \left(x \leq 1.9 \cdot 10^{+211}\right) \land x \leq 1.25 \cdot 10^{+241}:\\
\;\;\;\;\frac{\left(1 - \frac{-1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot 0.5\right)}{2}\\
\end{array}
\end{array}
if x < -3.7e-9Initial program 92.9%
Simplified92.9%
Taylor expanded in x around 0 47.8%
Taylor expanded in x around 0 25.8%
Taylor expanded in x around inf 25.8%
Taylor expanded in eps around 0 39.4%
if -3.7e-9 < x < 360Initial program 58.7%
Simplified58.7%
Taylor expanded in x around 0 75.8%
if 360 < x < 1.3e162 or 1.90000000000000008e211 < x < 1.25000000000000006e241Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 29.6%
Taylor expanded in x around 0 51.6%
if 1.3e162 < x < 1.90000000000000008e211 or 1.25000000000000006e241 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 35.4%
Taylor expanded in eps around 0 3.1%
mul-1-neg3.1%
Simplified3.1%
Taylor expanded in x around 0 83.6%
Final simplification65.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -2.9e-7)
(* x (/ (- 0.5 (* eps_m (- (/ -1.0 x) (* eps_m -0.5)))) eps_m))
(if (<= x 360.0)
1.0
(if (or (<= x 2.3e+161) (and (not (<= x 9e+210)) (<= x 6.5e+242)))
(/ (+ (- 1.0 (/ -1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/ (+ 2.0 (* x (+ -1.0 (* x 0.5)))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2.9e-7) {
tmp = x * ((0.5 - (eps_m * ((-1.0 / x) - (eps_m * -0.5)))) / eps_m);
} else if (x <= 360.0) {
tmp = 1.0;
} else if ((x <= 2.3e+161) || (!(x <= 9e+210) && (x <= 6.5e+242))) {
tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 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.9d-7)) then
tmp = x * ((0.5d0 - (eps_m * (((-1.0d0) / x) - (eps_m * (-0.5d0))))) / eps_m)
else if (x <= 360.0d0) then
tmp = 1.0d0
else if ((x <= 2.3d+161) .or. (.not. (x <= 9d+210)) .and. (x <= 6.5d+242)) then
tmp = ((1.0d0 - ((-1.0d0) / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = (2.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))) / 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.9e-7) {
tmp = x * ((0.5 - (eps_m * ((-1.0 / x) - (eps_m * -0.5)))) / eps_m);
} else if (x <= 360.0) {
tmp = 1.0;
} else if ((x <= 2.3e+161) || (!(x <= 9e+210) && (x <= 6.5e+242))) {
tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2.9e-7: tmp = x * ((0.5 - (eps_m * ((-1.0 / x) - (eps_m * -0.5)))) / eps_m) elif x <= 360.0: tmp = 1.0 elif (x <= 2.3e+161) or (not (x <= 9e+210) and (x <= 6.5e+242)): tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2.9e-7) tmp = Float64(x * Float64(Float64(0.5 - Float64(eps_m * Float64(Float64(-1.0 / x) - Float64(eps_m * -0.5)))) / eps_m)); elseif (x <= 360.0) tmp = 1.0; elseif ((x <= 2.3e+161) || (!(x <= 9e+210) && (x <= 6.5e+242))) tmp = Float64(Float64(Float64(1.0 - Float64(-1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -2.9e-7) tmp = x * ((0.5 - (eps_m * ((-1.0 / x) - (eps_m * -0.5)))) / eps_m); elseif (x <= 360.0) tmp = 1.0; elseif ((x <= 2.3e+161) || (~((x <= 9e+210)) && (x <= 6.5e+242))) tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2.9e-7], N[(x * N[(N[(0.5 - N[(eps$95$m * N[(N[(-1.0 / x), $MachinePrecision] - N[(eps$95$m * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 360.0], 1.0, If[Or[LessEqual[x, 2.3e+161], And[N[Not[LessEqual[x, 9e+210]], $MachinePrecision], LessEqual[x, 6.5e+242]]], N[(N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{-7}:\\
\;\;\;\;x \cdot \frac{0.5 - eps\_m \cdot \left(\frac{-1}{x} - eps\_m \cdot -0.5\right)}{eps\_m}\\
\mathbf{elif}\;x \leq 360:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+161} \lor \neg \left(x \leq 9 \cdot 10^{+210}\right) \land x \leq 6.5 \cdot 10^{+242}:\\
\;\;\;\;\frac{\left(1 - \frac{-1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot 0.5\right)}{2}\\
\end{array}
\end{array}
if x < -2.8999999999999998e-7Initial program 92.9%
Simplified92.9%
Taylor expanded in x around 0 47.8%
Taylor expanded in x around 0 25.8%
Taylor expanded in x around inf 25.8%
Taylor expanded in eps around 0 34.9%
if -2.8999999999999998e-7 < x < 360Initial program 58.7%
Simplified58.7%
Taylor expanded in x around 0 75.8%
if 360 < x < 2.2999999999999999e161 or 9.00000000000000007e210 < x < 6.49999999999999992e242Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 29.6%
Taylor expanded in x around 0 51.6%
if 2.2999999999999999e161 < x < 9.00000000000000007e210 or 6.49999999999999992e242 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 35.4%
Taylor expanded in eps around 0 3.1%
mul-1-neg3.1%
Simplified3.1%
Taylor expanded in x around 0 83.6%
Final simplification64.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 1.05e-7)
1.0
(/
(+
2.0
(*
x
(/
(-
1.0
(-
(*
eps_m
(- (* eps_m (- 1.0 (+ (* x 0.5) (* 0.5 (* eps_m x))))) (* x -0.5)))
(* x -0.5)))
eps_m)))
2.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.05e-7) {
tmp = 1.0;
} else {
tmp = (2.0 + (x * ((1.0 - ((eps_m * ((eps_m * (1.0 - ((x * 0.5) + (0.5 * (eps_m * x))))) - (x * -0.5))) - (x * -0.5))) / 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 <= 1.05d-7) then
tmp = 1.0d0
else
tmp = (2.0d0 + (x * ((1.0d0 - ((eps_m * ((eps_m * (1.0d0 - ((x * 0.5d0) + (0.5d0 * (eps_m * x))))) - (x * (-0.5d0)))) - (x * (-0.5d0)))) / 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 <= 1.05e-7) {
tmp = 1.0;
} else {
tmp = (2.0 + (x * ((1.0 - ((eps_m * ((eps_m * (1.0 - ((x * 0.5) + (0.5 * (eps_m * x))))) - (x * -0.5))) - (x * -0.5))) / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.05e-7: tmp = 1.0 else: tmp = (2.0 + (x * ((1.0 - ((eps_m * ((eps_m * (1.0 - ((x * 0.5) + (0.5 * (eps_m * x))))) - (x * -0.5))) - (x * -0.5))) / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.05e-7) tmp = 1.0; else tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 - Float64(Float64(eps_m * Float64(Float64(eps_m * Float64(1.0 - Float64(Float64(x * 0.5) + Float64(0.5 * Float64(eps_m * x))))) - Float64(x * -0.5))) - Float64(x * -0.5))) / 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 <= 1.05e-7) tmp = 1.0; else tmp = (2.0 + (x * ((1.0 - ((eps_m * ((eps_m * (1.0 - ((x * 0.5) + (0.5 * (eps_m * x))))) - (x * -0.5))) - (x * -0.5))) / 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, 1.05e-7], 1.0, N[(N[(2.0 + N[(x * N[(N[(1.0 - N[(N[(eps$95$m * N[(N[(eps$95$m * N[(1.0 - N[(N[(x * 0.5), $MachinePrecision] + N[(0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 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 1.05 \cdot 10^{-7}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \frac{1 - \left(eps\_m \cdot \left(eps\_m \cdot \left(1 - \left(x \cdot 0.5 + 0.5 \cdot \left(eps\_m \cdot x\right)\right)\right) - x \cdot -0.5\right) - x \cdot -0.5\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if eps < 1.05e-7Initial program 65.3%
Simplified65.3%
Taylor expanded in x around 0 46.2%
if 1.05e-7 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 68.5%
Taylor expanded in x around 0 76.4%
sub-neg76.4%
metadata-eval76.4%
+-commutative76.4%
associate-*r*76.4%
distribute-lft-in76.4%
metadata-eval76.4%
neg-mul-176.4%
sub-neg76.4%
metadata-eval76.4%
+-commutative76.4%
Simplified76.4%
Taylor expanded in eps around 0 78.7%
Final simplification56.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -2.95e+79)
(/ (+ 2.0 (* x (+ -1.0 (* x (+ 0.5 (* x -0.16666666666666666)))))) 2.0)
(if (<= x -1.46e-8)
(* x (/ (- 0.5 (* eps_m (- (/ -1.0 x) (* eps_m -0.5)))) eps_m))
(if (<= x 360.0)
1.0
(if (<= x 9.5e+241)
(/ (+ (- 1.0 (/ -1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/ (+ 2.0 (* x (+ -1.0 (* x 0.5)))) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2.95e+79) {
tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0;
} else if (x <= -1.46e-8) {
tmp = x * ((0.5 - (eps_m * ((-1.0 / x) - (eps_m * -0.5)))) / eps_m);
} else if (x <= 360.0) {
tmp = 1.0;
} else if (x <= 9.5e+241) {
tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 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.95d+79)) then
tmp = (2.0d0 + (x * ((-1.0d0) + (x * (0.5d0 + (x * (-0.16666666666666666d0))))))) / 2.0d0
else if (x <= (-1.46d-8)) then
tmp = x * ((0.5d0 - (eps_m * (((-1.0d0) / x) - (eps_m * (-0.5d0))))) / eps_m)
else if (x <= 360.0d0) then
tmp = 1.0d0
else if (x <= 9.5d+241) then
tmp = ((1.0d0 - ((-1.0d0) / eps_m)) + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = (2.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))) / 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.95e+79) {
tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0;
} else if (x <= -1.46e-8) {
tmp = x * ((0.5 - (eps_m * ((-1.0 / x) - (eps_m * -0.5)))) / eps_m);
} else if (x <= 360.0) {
tmp = 1.0;
} else if (x <= 9.5e+241) {
tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2.95e+79: tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0 elif x <= -1.46e-8: tmp = x * ((0.5 - (eps_m * ((-1.0 / x) - (eps_m * -0.5)))) / eps_m) elif x <= 360.0: tmp = 1.0 elif x <= 9.5e+241: tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2.95e+79) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * -0.16666666666666666)))))) / 2.0); elseif (x <= -1.46e-8) tmp = Float64(x * Float64(Float64(0.5 - Float64(eps_m * Float64(Float64(-1.0 / x) - Float64(eps_m * -0.5)))) / eps_m)); elseif (x <= 360.0) tmp = 1.0; elseif (x <= 9.5e+241) tmp = Float64(Float64(Float64(1.0 - Float64(-1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -2.95e+79) tmp = (2.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))))) / 2.0; elseif (x <= -1.46e-8) tmp = x * ((0.5 - (eps_m * ((-1.0 / x) - (eps_m * -0.5)))) / eps_m); elseif (x <= 360.0) tmp = 1.0; elseif (x <= 9.5e+241) tmp = ((1.0 - (-1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2.95e+79], N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -1.46e-8], N[(x * N[(N[(0.5 - N[(eps$95$m * N[(N[(-1.0 / x), $MachinePrecision] - N[(eps$95$m * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 360.0], 1.0, If[LessEqual[x, 9.5e+241], N[(N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.95 \cdot 10^{+79}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot -0.16666666666666666\right)\right)}{2}\\
\mathbf{elif}\;x \leq -1.46 \cdot 10^{-8}:\\
\;\;\;\;x \cdot \frac{0.5 - eps\_m \cdot \left(\frac{-1}{x} - eps\_m \cdot -0.5\right)}{eps\_m}\\
\mathbf{elif}\;x \leq 360:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+241}:\\
\;\;\;\;\frac{\left(1 - \frac{-1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot 0.5\right)}{2}\\
\end{array}
\end{array}
if x < -2.95e79Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 61.2%
Taylor expanded in eps around 0 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 96.3%
if -2.95e79 < x < -1.46e-8Initial program 81.8%
Simplified81.8%
Taylor expanded in x around 0 57.2%
Taylor expanded in x around 0 15.2%
Taylor expanded in x around inf 15.2%
Taylor expanded in eps around 0 38.5%
if -1.46e-8 < x < 360Initial program 58.7%
Simplified58.7%
Taylor expanded in x around 0 75.8%
if 360 < x < 9.50000000000000019e241Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 32.9%
Taylor expanded in x around 0 47.6%
if 9.50000000000000019e241 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 38.4%
Taylor expanded in eps around 0 3.1%
mul-1-neg3.1%
Simplified3.1%
Taylor expanded in x around 0 82.1%
Final simplification69.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 2e-216)
(* eps_m (+ (/ 1.0 eps_m) (* x -0.5)))
(if (<= x 6e-155)
(* x (/ (+ 0.5 (/ eps_m x)) eps_m))
(if (<= x 4.9) 1.0 (* 0.5 (* eps_m x))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2e-216) {
tmp = eps_m * ((1.0 / eps_m) + (x * -0.5));
} else if (x <= 6e-155) {
tmp = x * ((0.5 + (eps_m / x)) / eps_m);
} else if (x <= 4.9) {
tmp = 1.0;
} else {
tmp = 0.5 * (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 <= 2d-216) then
tmp = eps_m * ((1.0d0 / eps_m) + (x * (-0.5d0)))
else if (x <= 6d-155) then
tmp = x * ((0.5d0 + (eps_m / x)) / eps_m)
else if (x <= 4.9d0) then
tmp = 1.0d0
else
tmp = 0.5d0 * (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 <= 2e-216) {
tmp = eps_m * ((1.0 / eps_m) + (x * -0.5));
} else if (x <= 6e-155) {
tmp = x * ((0.5 + (eps_m / x)) / eps_m);
} else if (x <= 4.9) {
tmp = 1.0;
} else {
tmp = 0.5 * (eps_m * x);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2e-216: tmp = eps_m * ((1.0 / eps_m) + (x * -0.5)) elif x <= 6e-155: tmp = x * ((0.5 + (eps_m / x)) / eps_m) elif x <= 4.9: tmp = 1.0 else: tmp = 0.5 * (eps_m * x) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2e-216) tmp = Float64(eps_m * Float64(Float64(1.0 / eps_m) + Float64(x * -0.5))); elseif (x <= 6e-155) tmp = Float64(x * Float64(Float64(0.5 + Float64(eps_m / x)) / eps_m)); elseif (x <= 4.9) tmp = 1.0; else tmp = Float64(0.5 * Float64(eps_m * x)); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 2e-216) tmp = eps_m * ((1.0 / eps_m) + (x * -0.5)); elseif (x <= 6e-155) tmp = x * ((0.5 + (eps_m / x)) / eps_m); elseif (x <= 4.9) tmp = 1.0; else tmp = 0.5 * (eps_m * x); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 2e-216], N[(eps$95$m * N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6e-155], N[(x * N[(N[(0.5 + N[(eps$95$m / x), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.9], 1.0, N[(0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{-216}:\\
\;\;\;\;eps\_m \cdot \left(\frac{1}{eps\_m} + x \cdot -0.5\right)\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-155}:\\
\;\;\;\;x \cdot \frac{0.5 + \frac{eps\_m}{x}}{eps\_m}\\
\mathbf{elif}\;x \leq 4.9:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(eps\_m \cdot x\right)\\
\end{array}
\end{array}
if x < 2.0000000000000001e-216Initial program 68.6%
Simplified68.6%
Taylor expanded in x around 0 46.6%
Taylor expanded in x around 0 35.7%
Taylor expanded in x around inf 49.1%
Taylor expanded in eps around inf 65.0%
if 2.0000000000000001e-216 < x < 5.99999999999999967e-155Initial program 61.3%
Simplified61.3%
Taylor expanded in x around 0 48.3%
Taylor expanded in x around 0 22.2%
Taylor expanded in x around inf 48.0%
Taylor expanded in eps around 0 87.0%
if 5.99999999999999967e-155 < x < 4.9000000000000004Initial program 58.0%
Simplified58.0%
Taylor expanded in x around 0 62.7%
if 4.9000000000000004 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 32.0%
Taylor expanded in eps around inf 13.4%
Final simplification51.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -0.78) (* x (* eps_m -0.5)) (if (<= x 56.0) 1.0 (* 0.5 (* eps_m x)))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.78) {
tmp = x * (eps_m * -0.5);
} else if (x <= 56.0) {
tmp = 1.0;
} else {
tmp = 0.5 * (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 <= (-0.78d0)) then
tmp = x * (eps_m * (-0.5d0))
else if (x <= 56.0d0) then
tmp = 1.0d0
else
tmp = 0.5d0 * (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 <= -0.78) {
tmp = x * (eps_m * -0.5);
} else if (x <= 56.0) {
tmp = 1.0;
} else {
tmp = 0.5 * (eps_m * x);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.78: tmp = x * (eps_m * -0.5) elif x <= 56.0: tmp = 1.0 else: tmp = 0.5 * (eps_m * x) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.78) tmp = Float64(x * Float64(eps_m * -0.5)); elseif (x <= 56.0) tmp = 1.0; else tmp = Float64(0.5 * Float64(eps_m * x)); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -0.78) tmp = x * (eps_m * -0.5); elseif (x <= 56.0) tmp = 1.0; else tmp = 0.5 * (eps_m * x); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.78], N[(x * N[(eps$95$m * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 56.0], 1.0, N[(0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.78:\\
\;\;\;\;x \cdot \left(eps\_m \cdot -0.5\right)\\
\mathbf{elif}\;x \leq 56:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(eps\_m \cdot x\right)\\
\end{array}
\end{array}
if x < -0.78000000000000003Initial program 94.9%
Simplified94.9%
Taylor expanded in x around 0 48.9%
Taylor expanded in x around 0 27.6%
Taylor expanded in eps around inf 27.7%
*-commutative27.7%
*-commutative27.7%
associate-*l*27.7%
Simplified27.7%
if -0.78000000000000003 < x < 56Initial program 58.8%
Simplified58.8%
Taylor expanded in x around 0 74.6%
if 56 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 32.0%
Taylor expanded in eps around inf 13.4%
Final simplification50.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 27.0) (* eps_m (+ (/ 1.0 eps_m) (* x -0.5))) (* 0.5 (* eps_m x))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 27.0) {
tmp = eps_m * ((1.0 / eps_m) + (x * -0.5));
} else {
tmp = 0.5 * (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 <= 27.0d0) then
tmp = eps_m * ((1.0d0 / eps_m) + (x * (-0.5d0)))
else
tmp = 0.5d0 * (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 <= 27.0) {
tmp = eps_m * ((1.0 / eps_m) + (x * -0.5));
} else {
tmp = 0.5 * (eps_m * x);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 27.0: tmp = eps_m * ((1.0 / eps_m) + (x * -0.5)) else: tmp = 0.5 * (eps_m * x) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 27.0) tmp = Float64(eps_m * Float64(Float64(1.0 / eps_m) + Float64(x * -0.5))); else tmp = Float64(0.5 * Float64(eps_m * x)); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 27.0) tmp = eps_m * ((1.0 / eps_m) + (x * -0.5)); else tmp = 0.5 * (eps_m * x); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 27.0], N[(eps$95$m * N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 27:\\
\;\;\;\;eps\_m \cdot \left(\frac{1}{eps\_m} + x \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(eps\_m \cdot x\right)\\
\end{array}
\end{array}
if x < 27Initial program 66.3%
Simplified66.3%
Taylor expanded in x around 0 45.7%
Taylor expanded in x around 0 33.0%
Taylor expanded in x around inf 45.8%
Taylor expanded in eps around inf 64.3%
if 27 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 32.0%
Taylor expanded in eps around inf 13.4%
Final simplification50.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ 2.0 (* x (+ -1.0 (* x 0.5)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (2.0 + (x * (-1.0 + (x * 0.5)))) / 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 = (2.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{2 + x \cdot \left(-1 + x \cdot 0.5\right)}{2}
\end{array}
Initial program 75.8%
Simplified68.5%
Taylor expanded in eps around inf 98.2%
Taylor expanded in x around 0 63.6%
Taylor expanded in eps around 0 57.3%
mul-1-neg57.3%
Simplified57.3%
Taylor expanded in x around 0 56.0%
Final simplification56.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 38.0) 1.0 (* 0.5 (* eps_m x))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 38.0) {
tmp = 1.0;
} else {
tmp = 0.5 * (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 <= 38.0d0) then
tmp = 1.0d0
else
tmp = 0.5d0 * (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 <= 38.0) {
tmp = 1.0;
} else {
tmp = 0.5 * (eps_m * x);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 38.0: tmp = 1.0 else: tmp = 0.5 * (eps_m * x) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 38.0) tmp = 1.0; else tmp = Float64(0.5 * Float64(eps_m * x)); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 38.0) tmp = 1.0; else tmp = 0.5 * (eps_m * x); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 38.0], 1.0, N[(0.5 * N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 38:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(eps\_m \cdot x\right)\\
\end{array}
\end{array}
if x < 38Initial program 66.3%
Simplified66.3%
Taylor expanded in x around 0 59.8%
if 38 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 32.0%
Taylor expanded in eps around inf 13.4%
Final simplification46.7%
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 75.8%
Simplified75.8%
Taylor expanded in x around 0 43.9%
Final simplification43.9%
herbie shell --seed 2024084
(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))