
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 1.0 eps_m)))
(t_1 (exp (- x)))
(t_2 (+ t_1 (* x t_1)))
(t_3 (* (exp (* x (- -1.0 eps_m))) (+ 1.0 (/ -1.0 eps_m)))))
(if (<= (+ (* t_0 (exp (* x (+ eps_m -1.0)))) t_3) 2.0)
(/ (+ t_2 t_2) 2.0)
(/ (+ (* t_0 (exp (* eps_m x))) t_3) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = 1.0 + (1.0 / eps_m);
double t_1 = exp(-x);
double t_2 = t_1 + (x * t_1);
double t_3 = exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m));
double tmp;
if (((t_0 * exp((x * (eps_m + -1.0)))) + t_3) <= 2.0) {
tmp = (t_2 + t_2) / 2.0;
} else {
tmp = ((t_0 * exp((eps_m * x))) + t_3) / 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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = 1.0d0 + (1.0d0 / eps_m)
t_1 = exp(-x)
t_2 = t_1 + (x * t_1)
t_3 = exp((x * ((-1.0d0) - eps_m))) * (1.0d0 + ((-1.0d0) / eps_m))
if (((t_0 * exp((x * (eps_m + (-1.0d0))))) + t_3) <= 2.0d0) then
tmp = (t_2 + t_2) / 2.0d0
else
tmp = ((t_0 * exp((eps_m * x))) + t_3) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = 1.0 + (1.0 / eps_m);
double t_1 = Math.exp(-x);
double t_2 = t_1 + (x * t_1);
double t_3 = Math.exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m));
double tmp;
if (((t_0 * Math.exp((x * (eps_m + -1.0)))) + t_3) <= 2.0) {
tmp = (t_2 + t_2) / 2.0;
} else {
tmp = ((t_0 * Math.exp((eps_m * x))) + t_3) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = 1.0 + (1.0 / eps_m) t_1 = math.exp(-x) t_2 = t_1 + (x * t_1) t_3 = math.exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)) tmp = 0 if ((t_0 * math.exp((x * (eps_m + -1.0)))) + t_3) <= 2.0: tmp = (t_2 + t_2) / 2.0 else: tmp = ((t_0 * math.exp((eps_m * x))) + t_3) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(1.0 + Float64(1.0 / eps_m)) t_1 = exp(Float64(-x)) t_2 = Float64(t_1 + Float64(x * t_1)) t_3 = Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(1.0 + Float64(-1.0 / eps_m))) tmp = 0.0 if (Float64(Float64(t_0 * exp(Float64(x * Float64(eps_m + -1.0)))) + t_3) <= 2.0) tmp = Float64(Float64(t_2 + t_2) / 2.0); else tmp = Float64(Float64(Float64(t_0 * exp(Float64(eps_m * x))) + t_3) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = 1.0 + (1.0 / eps_m); t_1 = exp(-x); t_2 = t_1 + (x * t_1); t_3 = exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)); tmp = 0.0; if (((t_0 * exp((x * (eps_m + -1.0)))) + t_3) <= 2.0) tmp = (t_2 + t_2) / 2.0; else tmp = ((t_0 * exp((eps_m * x))) + t_3) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[(-x)], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[(x * t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$0 * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision], 2.0], N[(N[(t$95$2 + t$95$2), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(t$95$0 * N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := 1 + \frac{1}{eps\_m}\\
t_1 := e^{-x}\\
t_2 := t\_1 + x \cdot t\_1\\
t_3 := e^{x \cdot \left(-1 - eps\_m\right)} \cdot \left(1 + \frac{-1}{eps\_m}\right)\\
\mathbf{if}\;t\_0 \cdot e^{x \cdot \left(eps\_m + -1\right)} + t\_3 \leq 2:\\
\;\;\;\;\frac{t\_2 + t\_2}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot e^{eps\_m \cdot x} + t\_3}{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))))) < 2Initial program 50.6%
Simplified50.6%
Taylor expanded in eps around 0 100.0%
if 2 < (-.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 96.4%
Simplified96.4%
Taylor expanded in eps around inf 97.3%
Final simplification98.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 1.0 eps_m)))
(t_1 (* 2.0 (exp (- x))))
(t_2 (* (exp (* x (- -1.0 eps_m))) (+ 1.0 (/ -1.0 eps_m)))))
(if (<= (+ (* t_0 (exp (* x (+ eps_m -1.0)))) t_2) 2.0)
(* x (* 0.5 (+ t_1 (/ t_1 x))))
(/ (+ (* t_0 (exp (* eps_m x))) t_2) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = 1.0 + (1.0 / eps_m);
double t_1 = 2.0 * exp(-x);
double t_2 = exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m));
double tmp;
if (((t_0 * exp((x * (eps_m + -1.0)))) + t_2) <= 2.0) {
tmp = x * (0.5 * (t_1 + (t_1 / x)));
} else {
tmp = ((t_0 * exp((eps_m * x))) + t_2) / 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 1.0d0 + (1.0d0 / eps_m)
t_1 = 2.0d0 * exp(-x)
t_2 = exp((x * ((-1.0d0) - eps_m))) * (1.0d0 + ((-1.0d0) / eps_m))
if (((t_0 * exp((x * (eps_m + (-1.0d0))))) + t_2) <= 2.0d0) then
tmp = x * (0.5d0 * (t_1 + (t_1 / x)))
else
tmp = ((t_0 * exp((eps_m * x))) + t_2) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = 1.0 + (1.0 / eps_m);
double t_1 = 2.0 * Math.exp(-x);
double t_2 = Math.exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m));
double tmp;
if (((t_0 * Math.exp((x * (eps_m + -1.0)))) + t_2) <= 2.0) {
tmp = x * (0.5 * (t_1 + (t_1 / x)));
} else {
tmp = ((t_0 * Math.exp((eps_m * x))) + t_2) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = 1.0 + (1.0 / eps_m) t_1 = 2.0 * math.exp(-x) t_2 = math.exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)) tmp = 0 if ((t_0 * math.exp((x * (eps_m + -1.0)))) + t_2) <= 2.0: tmp = x * (0.5 * (t_1 + (t_1 / x))) else: tmp = ((t_0 * math.exp((eps_m * x))) + t_2) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(1.0 + Float64(1.0 / eps_m)) t_1 = Float64(2.0 * exp(Float64(-x))) t_2 = Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(1.0 + Float64(-1.0 / eps_m))) tmp = 0.0 if (Float64(Float64(t_0 * exp(Float64(x * Float64(eps_m + -1.0)))) + t_2) <= 2.0) tmp = Float64(x * Float64(0.5 * Float64(t_1 + Float64(t_1 / x)))); else tmp = Float64(Float64(Float64(t_0 * exp(Float64(eps_m * x))) + t_2) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = 1.0 + (1.0 / eps_m); t_1 = 2.0 * exp(-x); t_2 = exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)); tmp = 0.0; if (((t_0 * exp((x * (eps_m + -1.0)))) + t_2) <= 2.0) tmp = x * (0.5 * (t_1 + (t_1 / x))); else tmp = ((t_0 * exp((eps_m * x))) + t_2) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$0 * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], 2.0], N[(x * N[(0.5 * N[(t$95$1 + N[(t$95$1 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$0 * N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := 1 + \frac{1}{eps\_m}\\
t_1 := 2 \cdot e^{-x}\\
t_2 := e^{x \cdot \left(-1 - eps\_m\right)} \cdot \left(1 + \frac{-1}{eps\_m}\right)\\
\mathbf{if}\;t\_0 \cdot e^{x \cdot \left(eps\_m + -1\right)} + t\_2 \leq 2:\\
\;\;\;\;x \cdot \left(0.5 \cdot \left(t\_1 + \frac{t\_1}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot e^{eps\_m \cdot x} + t\_2}{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))))) < 2Initial program 50.6%
Simplified50.6%
Taylor expanded in eps around 0 100.0%
Taylor expanded in x around inf 99.9%
+-commutative99.9%
distribute-lft-out99.9%
cancel-sign-sub-inv99.9%
neg-mul-199.9%
metadata-eval99.9%
neg-mul-199.9%
distribute-rgt1-in99.9%
metadata-eval99.9%
cancel-sign-sub-inv99.9%
neg-mul-199.9%
Simplified99.9%
if 2 < (-.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 96.4%
Simplified96.4%
Taylor expanded in eps around inf 97.3%
Final simplification98.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* 2.0 (exp (- x)))))
(if (<= eps_m 9.5e-12)
(* x (* 0.5 (+ t_0 (/ t_0 x))))
(/ (* 2.0 (cosh (* eps_m x))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = 2.0 * exp(-x);
double tmp;
if (eps_m <= 9.5e-12) {
tmp = x * (0.5 * (t_0 + (t_0 / x)));
} else {
tmp = (2.0 * cosh((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 = 2.0d0 * exp(-x)
if (eps_m <= 9.5d-12) then
tmp = x * (0.5d0 * (t_0 + (t_0 / x)))
else
tmp = (2.0d0 * cosh((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 = 2.0 * Math.exp(-x);
double tmp;
if (eps_m <= 9.5e-12) {
tmp = x * (0.5 * (t_0 + (t_0 / x)));
} else {
tmp = (2.0 * Math.cosh((eps_m * x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = 2.0 * math.exp(-x) tmp = 0 if eps_m <= 9.5e-12: tmp = x * (0.5 * (t_0 + (t_0 / x))) else: tmp = (2.0 * math.cosh((eps_m * x))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(2.0 * exp(Float64(-x))) tmp = 0.0 if (eps_m <= 9.5e-12) tmp = Float64(x * Float64(0.5 * Float64(t_0 + Float64(t_0 / x)))); else tmp = Float64(Float64(2.0 * cosh(Float64(eps_m * x))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = 2.0 * exp(-x); tmp = 0.0; if (eps_m <= 9.5e-12) tmp = x * (0.5 * (t_0 + (t_0 / x))); else tmp = (2.0 * cosh((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[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps$95$m, 9.5e-12], N[(x * N[(0.5 * N[(t$95$0 + N[(t$95$0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[Cosh[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := 2 \cdot e^{-x}\\
\mathbf{if}\;eps\_m \leq 9.5 \cdot 10^{-12}:\\
\;\;\;\;x \cdot \left(0.5 \cdot \left(t\_0 + \frac{t\_0}{x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \cosh \left(eps\_m \cdot x\right)}{2}\\
\end{array}
\end{array}
if eps < 9.4999999999999995e-12Initial program 61.7%
Simplified61.7%
Taylor expanded in eps around 0 66.1%
Taylor expanded in x around inf 66.0%
+-commutative66.0%
distribute-lft-out66.0%
cancel-sign-sub-inv66.0%
neg-mul-166.0%
metadata-eval66.0%
neg-mul-166.0%
distribute-rgt1-in66.0%
metadata-eval66.0%
cancel-sign-sub-inv66.0%
neg-mul-166.0%
Simplified66.0%
if 9.4999999999999995e-12 < eps Initial program 99.8%
Simplified79.4%
Taylor expanded in eps around inf 99.8%
Taylor expanded in eps around inf 99.8%
associate-*r*99.8%
neg-mul-199.8%
Simplified99.8%
Taylor expanded in eps around inf 99.8%
*-commutative99.8%
Simplified99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
*-commutative99.8%
cosh-undef99.9%
Applied egg-rr99.9%
Final simplification74.6%
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 71.4%
Simplified61.2%
Taylor expanded in eps around inf 96.9%
Final simplification96.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ eps_m -1.0))) (exp (* eps_m (- x)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (eps_m + -1.0))) + 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 * (eps_m + (-1.0d0)))) + 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 * (eps_m + -1.0))) + Math.exp((eps_m * -x))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (eps_m + -1.0))) + math.exp((eps_m * -x))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + exp(Float64(eps_m * Float64(-x)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (eps_m + -1.0))) + 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[(eps$95$m + -1.0), $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(eps\_m + -1\right)} + e^{eps\_m \cdot \left(-x\right)}}{2}
\end{array}
Initial program 71.4%
Simplified61.2%
Taylor expanded in eps around inf 96.9%
Taylor expanded in eps around inf 85.9%
associate-*r*85.9%
neg-mul-185.9%
Simplified85.9%
Final simplification85.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 470.0) (/ (+ 1.0 (exp (- x))) 2.0) (if (<= x 5e+199) 0.0 (+ 1.0 (* (* x x) (* x 0.3333333333333333))))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 470.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 5e+199) {
tmp = 0.0;
} else {
tmp = 1.0 + ((x * x) * (x * 0.3333333333333333));
}
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 <= 470.0d0) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 5d+199) then
tmp = 0.0d0
else
tmp = 1.0d0 + ((x * x) * (x * 0.3333333333333333d0))
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 470.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 5e+199) {
tmp = 0.0;
} else {
tmp = 1.0 + ((x * x) * (x * 0.3333333333333333));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 470.0: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 5e+199: tmp = 0.0 else: tmp = 1.0 + ((x * x) * (x * 0.3333333333333333)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 470.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 5e+199) tmp = 0.0; else tmp = Float64(1.0 + Float64(Float64(x * x) * Float64(x * 0.3333333333333333))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 470.0) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 5e+199) tmp = 0.0; else tmp = 1.0 + ((x * x) * (x * 0.3333333333333333)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 470.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5e+199], 0.0, N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 470:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+199}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x \cdot x\right) \cdot \left(x \cdot 0.3333333333333333\right)\\
\end{array}
\end{array}
if x < 470Initial program 59.1%
Simplified44.5%
Taylor expanded in eps around inf 95.6%
Taylor expanded in eps around inf 95.6%
associate-*r*95.6%
neg-mul-195.6%
Simplified95.6%
Taylor expanded in eps around 0 72.7%
mul-1-neg72.7%
Simplified72.7%
if 470 < x < 4.9999999999999998e199Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 53.2%
associate-*r*53.2%
neg-mul-153.2%
Simplified53.2%
Taylor expanded in eps around inf 47.3%
*-commutative47.3%
Simplified47.3%
flip-+0.1%
div-sub0.1%
Applied egg-rr0.0%
+-inverses54.7%
Simplified54.7%
if 4.9999999999999998e199 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 38.0%
Taylor expanded in x around 0 63.5%
unpow263.5%
Applied egg-rr63.5%
Taylor expanded in x around inf 63.5%
*-commutative63.5%
Simplified63.5%
Final simplification68.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (* 2.0 (cosh (* eps_m x))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (2.0 * cosh((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 = (2.0d0 * cosh((eps_m * x))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (2.0 * Math.cosh((eps_m * x))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (2.0 * math.cosh((eps_m * x))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(2.0 * cosh(Float64(eps_m * x))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (2.0 * cosh((eps_m * x))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(2.0 * N[Cosh[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{2 \cdot \cosh \left(eps\_m \cdot x\right)}{2}
\end{array}
Initial program 71.4%
Simplified61.2%
Taylor expanded in eps around inf 96.9%
Taylor expanded in eps around inf 85.9%
associate-*r*85.9%
neg-mul-185.9%
Simplified85.9%
Taylor expanded in eps around inf 83.3%
*-commutative83.3%
Simplified83.3%
+-commutative83.3%
distribute-lft-neg-out83.3%
*-commutative83.3%
cosh-undef83.3%
Applied egg-rr83.3%
Final simplification83.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 1.8) (- 1.0 (* (* x x) (- 0.5 (* x (+ 0.3333333333333333 (* x -0.125)))))) (if (<= x 5e+199) 0.0 (+ 1.0 (* (* x x) (* x 0.3333333333333333))))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.8) {
tmp = 1.0 - ((x * x) * (0.5 - (x * (0.3333333333333333 + (x * -0.125)))));
} else if (x <= 5e+199) {
tmp = 0.0;
} else {
tmp = 1.0 + ((x * x) * (x * 0.3333333333333333));
}
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.8d0) then
tmp = 1.0d0 - ((x * x) * (0.5d0 - (x * (0.3333333333333333d0 + (x * (-0.125d0))))))
else if (x <= 5d+199) then
tmp = 0.0d0
else
tmp = 1.0d0 + ((x * x) * (x * 0.3333333333333333d0))
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.8) {
tmp = 1.0 - ((x * x) * (0.5 - (x * (0.3333333333333333 + (x * -0.125)))));
} else if (x <= 5e+199) {
tmp = 0.0;
} else {
tmp = 1.0 + ((x * x) * (x * 0.3333333333333333));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.8: tmp = 1.0 - ((x * x) * (0.5 - (x * (0.3333333333333333 + (x * -0.125))))) elif x <= 5e+199: tmp = 0.0 else: tmp = 1.0 + ((x * x) * (x * 0.3333333333333333)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.8) tmp = Float64(1.0 - Float64(Float64(x * x) * Float64(0.5 - Float64(x * Float64(0.3333333333333333 + Float64(x * -0.125)))))); elseif (x <= 5e+199) tmp = 0.0; else tmp = Float64(1.0 + Float64(Float64(x * x) * Float64(x * 0.3333333333333333))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1.8) tmp = 1.0 - ((x * x) * (0.5 - (x * (0.3333333333333333 + (x * -0.125))))); elseif (x <= 5e+199) tmp = 0.0; else tmp = 1.0 + ((x * x) * (x * 0.3333333333333333)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.8], N[(1.0 - N[(N[(x * x), $MachinePrecision] * N[(0.5 - N[(x * N[(0.3333333333333333 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5e+199], 0.0, N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.8:\\
\;\;\;\;1 - \left(x \cdot x\right) \cdot \left(0.5 - x \cdot \left(0.3333333333333333 + x \cdot -0.125\right)\right)\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+199}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x \cdot x\right) \cdot \left(x \cdot 0.3333333333333333\right)\\
\end{array}
\end{array}
if x < 1.80000000000000004Initial program 59.1%
Simplified59.1%
Taylor expanded in eps around 0 59.1%
Taylor expanded in x around 0 58.7%
unpow258.7%
Applied egg-rr58.7%
if 1.80000000000000004 < x < 4.9999999999999998e199Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 53.2%
associate-*r*53.2%
neg-mul-153.2%
Simplified53.2%
Taylor expanded in eps around inf 47.3%
*-commutative47.3%
Simplified47.3%
flip-+0.1%
div-sub0.1%
Applied egg-rr0.0%
+-inverses54.7%
Simplified54.7%
if 4.9999999999999998e199 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 38.0%
Taylor expanded in x around 0 63.5%
unpow263.5%
Applied egg-rr63.5%
Taylor expanded in x around inf 63.5%
*-commutative63.5%
Simplified63.5%
Final simplification58.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 490.0) (+ 1.0 (* (* x x) (- (* x 0.3333333333333333) 0.5))) (if (<= x 3.7e+199) 0.0 (+ 1.0 (* (* x x) (* x 0.3333333333333333))))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 490.0) {
tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 0.5));
} else if (x <= 3.7e+199) {
tmp = 0.0;
} else {
tmp = 1.0 + ((x * x) * (x * 0.3333333333333333));
}
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 <= 490.0d0) then
tmp = 1.0d0 + ((x * x) * ((x * 0.3333333333333333d0) - 0.5d0))
else if (x <= 3.7d+199) then
tmp = 0.0d0
else
tmp = 1.0d0 + ((x * x) * (x * 0.3333333333333333d0))
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 490.0) {
tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 0.5));
} else if (x <= 3.7e+199) {
tmp = 0.0;
} else {
tmp = 1.0 + ((x * x) * (x * 0.3333333333333333));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 490.0: tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 0.5)) elif x <= 3.7e+199: tmp = 0.0 else: tmp = 1.0 + ((x * x) * (x * 0.3333333333333333)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 490.0) tmp = Float64(1.0 + Float64(Float64(x * x) * Float64(Float64(x * 0.3333333333333333) - 0.5))); elseif (x <= 3.7e+199) tmp = 0.0; else tmp = Float64(1.0 + Float64(Float64(x * x) * Float64(x * 0.3333333333333333))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 490.0) tmp = 1.0 + ((x * x) * ((x * 0.3333333333333333) - 0.5)); elseif (x <= 3.7e+199) tmp = 0.0; else tmp = 1.0 + ((x * x) * (x * 0.3333333333333333)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 490.0], N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(N[(x * 0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.7e+199], 0.0, N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 490:\\
\;\;\;\;1 + \left(x \cdot x\right) \cdot \left(x \cdot 0.3333333333333333 - 0.5\right)\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{+199}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x \cdot x\right) \cdot \left(x \cdot 0.3333333333333333\right)\\
\end{array}
\end{array}
if x < 490Initial program 59.1%
Simplified59.1%
Taylor expanded in eps around 0 59.1%
Taylor expanded in x around 0 58.7%
unpow258.7%
Applied egg-rr58.7%
if 490 < x < 3.70000000000000021e199Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 53.2%
associate-*r*53.2%
neg-mul-153.2%
Simplified53.2%
Taylor expanded in eps around inf 47.3%
*-commutative47.3%
Simplified47.3%
flip-+0.1%
div-sub0.1%
Applied egg-rr0.0%
+-inverses54.7%
Simplified54.7%
if 3.70000000000000021e199 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 38.0%
Taylor expanded in x around 0 63.5%
unpow263.5%
Applied egg-rr63.5%
Taylor expanded in x around inf 63.5%
*-commutative63.5%
Simplified63.5%
Final simplification58.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 1.42) (/ (- 2.0 (* x x)) 2.0) (if (<= x 4e+199) 0.0 (+ 1.0 (* (* x x) (* x 0.3333333333333333))))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.42) {
tmp = (2.0 - (x * x)) / 2.0;
} else if (x <= 4e+199) {
tmp = 0.0;
} else {
tmp = 1.0 + ((x * x) * (x * 0.3333333333333333));
}
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.42d0) then
tmp = (2.0d0 - (x * x)) / 2.0d0
else if (x <= 4d+199) then
tmp = 0.0d0
else
tmp = 1.0d0 + ((x * x) * (x * 0.3333333333333333d0))
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.42) {
tmp = (2.0 - (x * x)) / 2.0;
} else if (x <= 4e+199) {
tmp = 0.0;
} else {
tmp = 1.0 + ((x * x) * (x * 0.3333333333333333));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.42: tmp = (2.0 - (x * x)) / 2.0 elif x <= 4e+199: tmp = 0.0 else: tmp = 1.0 + ((x * x) * (x * 0.3333333333333333)) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.42) tmp = Float64(Float64(2.0 - Float64(x * x)) / 2.0); elseif (x <= 4e+199) tmp = 0.0; else tmp = Float64(1.0 + Float64(Float64(x * x) * Float64(x * 0.3333333333333333))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1.42) tmp = (2.0 - (x * x)) / 2.0; elseif (x <= 4e+199) tmp = 0.0; else tmp = 1.0 + ((x * x) * (x * 0.3333333333333333)); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.42], N[(N[(2.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4e+199], 0.0, N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(x * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.42:\\
\;\;\;\;\frac{2 - x \cdot x}{2}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+199}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x \cdot x\right) \cdot \left(x \cdot 0.3333333333333333\right)\\
\end{array}
\end{array}
if x < 1.4199999999999999Initial program 59.1%
Simplified59.1%
Taylor expanded in eps around 0 59.1%
Taylor expanded in x around 0 58.5%
mul-1-neg58.5%
unsub-neg58.5%
Simplified58.5%
unpow258.7%
Applied egg-rr58.5%
if 1.4199999999999999 < x < 4.00000000000000039e199Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 53.2%
associate-*r*53.2%
neg-mul-153.2%
Simplified53.2%
Taylor expanded in eps around inf 47.3%
*-commutative47.3%
Simplified47.3%
flip-+0.1%
div-sub0.1%
Applied egg-rr0.0%
+-inverses54.7%
Simplified54.7%
if 4.00000000000000039e199 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 38.0%
Taylor expanded in x around 0 63.5%
unpow263.5%
Applied egg-rr63.5%
Taylor expanded in x around inf 63.5%
*-commutative63.5%
Simplified63.5%
Final simplification58.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 1.42) (/ (- 2.0 (* x x)) 2.0) (if (<= x 4e+199) 0.0 (/ (* eps_m x) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.42) {
tmp = (2.0 - (x * x)) / 2.0;
} else if (x <= 4e+199) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 1.42d0) then
tmp = (2.0d0 - (x * x)) / 2.0d0
else if (x <= 4d+199) then
tmp = 0.0d0
else
tmp = (eps_m * x) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 1.42) {
tmp = (2.0 - (x * x)) / 2.0;
} else if (x <= 4e+199) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.42: tmp = (2.0 - (x * x)) / 2.0 elif x <= 4e+199: tmp = 0.0 else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.42) tmp = Float64(Float64(2.0 - Float64(x * x)) / 2.0); elseif (x <= 4e+199) tmp = 0.0; else tmp = Float64(Float64(eps_m * x) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1.42) tmp = (2.0 - (x * x)) / 2.0; elseif (x <= 4e+199) tmp = 0.0; else tmp = (eps_m * x) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.42], N[(N[(2.0 - N[(x * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4e+199], 0.0, N[(N[(eps$95$m * x), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.42:\\
\;\;\;\;\frac{2 - x \cdot x}{2}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+199}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < 1.4199999999999999Initial program 59.1%
Simplified59.1%
Taylor expanded in eps around 0 59.1%
Taylor expanded in x around 0 58.5%
mul-1-neg58.5%
unsub-neg58.5%
Simplified58.5%
unpow258.7%
Applied egg-rr58.5%
if 1.4199999999999999 < x < 4.00000000000000039e199Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 53.2%
associate-*r*53.2%
neg-mul-153.2%
Simplified53.2%
Taylor expanded in eps around inf 47.3%
*-commutative47.3%
Simplified47.3%
flip-+0.1%
div-sub0.1%
Applied egg-rr0.0%
+-inverses54.7%
Simplified54.7%
if 4.00000000000000039e199 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 38.0%
Taylor expanded in eps around inf 34.5%
Final simplification55.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 480.0) 1.0 (if (<= x 3.7e+199) 0.0 (/ (* eps_m x) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 480.0) {
tmp = 1.0;
} else if (x <= 3.7e+199) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 480.0d0) then
tmp = 1.0d0
else if (x <= 3.7d+199) then
tmp = 0.0d0
else
tmp = (eps_m * x) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 480.0) {
tmp = 1.0;
} else if (x <= 3.7e+199) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 480.0: tmp = 1.0 elif x <= 3.7e+199: tmp = 0.0 else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 480.0) tmp = 1.0; elseif (x <= 3.7e+199) tmp = 0.0; else tmp = Float64(Float64(eps_m * x) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 480.0) tmp = 1.0; elseif (x <= 3.7e+199) tmp = 0.0; else tmp = (eps_m * x) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 480.0], 1.0, If[LessEqual[x, 3.7e+199], 0.0, N[(N[(eps$95$m * x), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 480:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{+199}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < 480Initial program 59.1%
Simplified59.1%
Taylor expanded in eps around inf 56.2%
Taylor expanded in x around 0 18.2%
Taylor expanded in eps around inf 58.3%
if 480 < x < 3.70000000000000021e199Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 53.2%
associate-*r*53.2%
neg-mul-153.2%
Simplified53.2%
Taylor expanded in eps around inf 47.3%
*-commutative47.3%
Simplified47.3%
flip-+0.1%
div-sub0.1%
Applied egg-rr0.0%
+-inverses54.7%
Simplified54.7%
if 3.70000000000000021e199 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 38.0%
Taylor expanded in eps around inf 34.5%
Final simplification55.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 490.0) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 490.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 490.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 490.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 490.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 490.0) tmp = 1.0; else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 490.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 490.0], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 490:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 490Initial program 59.1%
Simplified59.1%
Taylor expanded in eps around inf 56.2%
Taylor expanded in x around 0 18.2%
Taylor expanded in eps around inf 58.3%
if 490 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 63.3%
associate-*r*63.3%
neg-mul-163.3%
Simplified63.3%
Taylor expanded in eps around inf 53.0%
*-commutative53.0%
Simplified53.0%
flip-+0.1%
div-sub0.1%
Applied egg-rr0.0%
+-inverses48.9%
Simplified48.9%
Final simplification55.4%
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 71.4%
Simplified71.4%
Taylor expanded in eps around inf 69.4%
Taylor expanded in x around 0 13.6%
Taylor expanded in eps around inf 41.7%
herbie shell --seed 2024165
(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))