
(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 13 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}
(FPCore (x eps) :precision binary64 (/ (+ (exp (* x (+ -1.0 eps))) (exp (* x (- -1.0 eps)))) 2.0))
double code(double x, double eps) {
return (exp((x * (-1.0 + eps))) + exp((x * (-1.0 - eps)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (exp((x * ((-1.0d0) + eps))) + exp((x * ((-1.0d0) - eps)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (Math.exp((x * (-1.0 + eps))) + Math.exp((x * (-1.0 - eps)))) / 2.0;
}
def code(x, eps): return (math.exp((x * (-1.0 + eps))) + math.exp((x * (-1.0 - eps)))) / 2.0
function code(x, eps) return Float64(Float64(exp(Float64(x * Float64(-1.0 + eps))) + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0) end
function tmp = code(x, eps) tmp = (exp((x * (-1.0 + eps))) + exp((x * (-1.0 - eps)))) / 2.0; end
code[x_, eps_] := N[(N[(N[Exp[N[(x * N[(-1.0 + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{x \cdot \left(-1 + \varepsilon\right)} + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}
\end{array}
Initial program 78.6%
Simplified78.6%
Taylor expanded in eps around inf 99.4%
Final simplification99.4%
(FPCore (x eps) :precision binary64 (if (<= x -1e-298) (/ (+ 1.0 (exp (* x (- -1.0 eps)))) 2.0) (/ (+ (pow E (* x (+ -1.0 eps))) (exp (- x))) 2.0)))
double code(double x, double eps) {
double tmp;
if (x <= -1e-298) {
tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0;
} else {
tmp = (pow(((double) M_E), (x * (-1.0 + eps))) + exp(-x)) / 2.0;
}
return tmp;
}
public static double code(double x, double eps) {
double tmp;
if (x <= -1e-298) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps)))) / 2.0;
} else {
tmp = (Math.pow(Math.E, (x * (-1.0 + eps))) + Math.exp(-x)) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -1e-298: tmp = (1.0 + math.exp((x * (-1.0 - eps)))) / 2.0 else: tmp = (math.pow(math.e, (x * (-1.0 + eps))) + math.exp(-x)) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -1e-298) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0); else tmp = Float64(Float64((exp(1) ^ Float64(x * Float64(-1.0 + eps))) + exp(Float64(-x))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -1e-298) tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0; else tmp = ((2.71828182845904523536 ^ (x * (-1.0 + eps))) + exp(-x)) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -1e-298], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Power[E, N[(x * N[(-1.0 + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-298}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{{e}^{\left(x \cdot \left(-1 + \varepsilon\right)\right)} + e^{-x}}{2}\\
\end{array}
\end{array}
if x < -9.99999999999999912e-299Initial program 77.0%
Simplified77.0%
Taylor expanded in x around 0 48.7%
Taylor expanded in eps around inf 70.7%
mul-1-neg70.7%
neg-mul-170.7%
distribute-lft-neg-in70.7%
*-commutative70.7%
+-commutative70.7%
Simplified70.7%
if -9.99999999999999912e-299 < x Initial program 79.7%
Simplified79.7%
Taylor expanded in eps around inf 99.6%
Taylor expanded in eps around 0 77.6%
neg-mul-177.6%
Simplified77.6%
*-un-lft-identity77.6%
exp-prod77.6%
associate-*r*77.6%
neg-mul-177.6%
Applied egg-rr77.6%
exp-1-e77.6%
distribute-lft-neg-in77.6%
distribute-rgt-neg-in77.6%
sub-neg77.6%
neg-mul-177.6%
distribute-neg-in77.6%
metadata-eval77.6%
neg-mul-177.6%
remove-double-neg77.6%
Simplified77.6%
Final simplification74.6%
(FPCore (x eps) :precision binary64 (/ (+ (exp (* x (+ -1.0 eps))) (/ 1.0 (exp (+ x (* x eps))))) 2.0))
double code(double x, double eps) {
return (exp((x * (-1.0 + eps))) + (1.0 / exp((x + (x * eps))))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (exp((x * ((-1.0d0) + eps))) + (1.0d0 / exp((x + (x * eps))))) / 2.0d0
end function
public static double code(double x, double eps) {
return (Math.exp((x * (-1.0 + eps))) + (1.0 / Math.exp((x + (x * eps))))) / 2.0;
}
def code(x, eps): return (math.exp((x * (-1.0 + eps))) + (1.0 / math.exp((x + (x * eps))))) / 2.0
function code(x, eps) return Float64(Float64(exp(Float64(x * Float64(-1.0 + eps))) + Float64(1.0 / exp(Float64(x + Float64(x * eps))))) / 2.0) end
function tmp = code(x, eps) tmp = (exp((x * (-1.0 + eps))) + (1.0 / exp((x + (x * eps))))) / 2.0; end
code[x_, eps_] := N[(N[(N[Exp[N[(x * N[(-1.0 + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Exp[N[(x + N[(x * eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{x \cdot \left(-1 + \varepsilon\right)} + \frac{1}{e^{x + x \cdot \varepsilon}}}{2}
\end{array}
Initial program 78.6%
Simplified68.4%
Taylor expanded in eps around inf 99.4%
Final simplification99.4%
(FPCore (x eps)
:precision binary64
(if (<= eps 0.85)
(/ (exp (- (log 2.0) x)) 2.0)
(/
(+
(+
1.0
(-
(/ 1.0 eps)
(*
x
(+
(/ 1.0 eps)
(-
(* x (- 0.5 (- (* 0.5 (/ 1.0 eps)) (* eps (- 0.5 (* eps 0.5))))))
eps)))))
(* (exp (* x (- -1.0 eps))) (+ 1.0 (/ -1.0 eps))))
2.0)))
double code(double x, double eps) {
double tmp;
if (eps <= 0.85) {
tmp = exp((log(2.0) - x)) / 2.0;
} else {
tmp = ((1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps))))) + (exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= 0.85d0) then
tmp = exp((log(2.0d0) - x)) / 2.0d0
else
tmp = ((1.0d0 + ((1.0d0 / eps) - (x * ((1.0d0 / eps) + ((x * (0.5d0 - ((0.5d0 * (1.0d0 / eps)) - (eps * (0.5d0 - (eps * 0.5d0)))))) - eps))))) + (exp((x * ((-1.0d0) - eps))) * (1.0d0 + ((-1.0d0) / eps)))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= 0.85) {
tmp = Math.exp((Math.log(2.0) - x)) / 2.0;
} else {
tmp = ((1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps))))) + (Math.exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= 0.85: tmp = math.exp((math.log(2.0) - x)) / 2.0 else: tmp = ((1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps))))) + (math.exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (eps <= 0.85) tmp = Float64(exp(Float64(log(2.0) - x)) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(1.0 / eps) - Float64(x * Float64(Float64(1.0 / eps) + Float64(Float64(x * Float64(0.5 - Float64(Float64(0.5 * Float64(1.0 / eps)) - Float64(eps * Float64(0.5 - Float64(eps * 0.5)))))) - eps))))) + Float64(exp(Float64(x * Float64(-1.0 - eps))) * Float64(1.0 + Float64(-1.0 / eps)))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 0.85) tmp = exp((log(2.0) - x)) / 2.0; else tmp = ((1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps))))) + (exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, 0.85], N[(N[Exp[N[(N[Log[2.0], $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(1.0 / eps), $MachinePrecision] - N[(x * N[(N[(1.0 / eps), $MachinePrecision] + N[(N[(x * N[(0.5 - N[(N[(0.5 * N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] - N[(eps * N[(0.5 - N[(eps * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 0.85:\\
\;\;\;\;\frac{e^{\log 2 - x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(\frac{1}{\varepsilon} - x \cdot \left(\frac{1}{\varepsilon} + \left(x \cdot \left(0.5 - \left(0.5 \cdot \frac{1}{\varepsilon} - \varepsilon \cdot \left(0.5 - \varepsilon \cdot 0.5\right)\right)\right) - \varepsilon\right)\right)\right)\right) + e^{x \cdot \left(-1 - \varepsilon\right)} \cdot \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if eps < 0.849999999999999978Initial program 70.0%
Simplified70.0%
Taylor expanded in eps around inf 99.1%
Taylor expanded in eps around 0 81.0%
neg-mul-181.0%
Simplified81.0%
Taylor expanded in eps around 0 74.7%
cancel-sign-sub-inv74.7%
neg-mul-174.7%
metadata-eval74.7%
*-lft-identity74.7%
count-274.7%
Simplified74.7%
add-exp-log74.7%
*-commutative74.7%
log-prod74.7%
add-log-exp74.7%
Applied egg-rr74.7%
if 0.849999999999999978 < eps Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 48.1%
Taylor expanded in eps around 0 56.3%
Taylor expanded in x around 0 92.2%
Final simplification79.7%
(FPCore (x eps)
:precision binary64
(if (<= eps 0.85)
(exp (- x))
(/
(+
(+
1.0
(-
(/ 1.0 eps)
(*
x
(+
(/ 1.0 eps)
(-
(* x (- 0.5 (- (* 0.5 (/ 1.0 eps)) (* eps (- 0.5 (* eps 0.5))))))
eps)))))
(* (exp (* x (- -1.0 eps))) (+ 1.0 (/ -1.0 eps))))
2.0)))
double code(double x, double eps) {
double tmp;
if (eps <= 0.85) {
tmp = exp(-x);
} else {
tmp = ((1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps))))) + (exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= 0.85d0) then
tmp = exp(-x)
else
tmp = ((1.0d0 + ((1.0d0 / eps) - (x * ((1.0d0 / eps) + ((x * (0.5d0 - ((0.5d0 * (1.0d0 / eps)) - (eps * (0.5d0 - (eps * 0.5d0)))))) - eps))))) + (exp((x * ((-1.0d0) - eps))) * (1.0d0 + ((-1.0d0) / eps)))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= 0.85) {
tmp = Math.exp(-x);
} else {
tmp = ((1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps))))) + (Math.exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= 0.85: tmp = math.exp(-x) else: tmp = ((1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps))))) + (math.exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (eps <= 0.85) tmp = exp(Float64(-x)); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(1.0 / eps) - Float64(x * Float64(Float64(1.0 / eps) + Float64(Float64(x * Float64(0.5 - Float64(Float64(0.5 * Float64(1.0 / eps)) - Float64(eps * Float64(0.5 - Float64(eps * 0.5)))))) - eps))))) + Float64(exp(Float64(x * Float64(-1.0 - eps))) * Float64(1.0 + Float64(-1.0 / eps)))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 0.85) tmp = exp(-x); else tmp = ((1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps))))) + (exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, 0.85], N[Exp[(-x)], $MachinePrecision], N[(N[(N[(1.0 + N[(N[(1.0 / eps), $MachinePrecision] - N[(x * N[(N[(1.0 / eps), $MachinePrecision] + N[(N[(x * N[(0.5 - N[(N[(0.5 * N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] - N[(eps * N[(0.5 - N[(eps * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 0.85:\\
\;\;\;\;e^{-x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(\frac{1}{\varepsilon} - x \cdot \left(\frac{1}{\varepsilon} + \left(x \cdot \left(0.5 - \left(0.5 \cdot \frac{1}{\varepsilon} - \varepsilon \cdot \left(0.5 - \varepsilon \cdot 0.5\right)\right)\right) - \varepsilon\right)\right)\right)\right) + e^{x \cdot \left(-1 - \varepsilon\right)} \cdot \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if eps < 0.849999999999999978Initial program 70.0%
Simplified70.0%
Taylor expanded in eps around inf 99.1%
Taylor expanded in eps around 0 81.0%
neg-mul-181.0%
Simplified81.0%
*-un-lft-identity81.0%
exp-prod81.0%
associate-*r*81.0%
neg-mul-181.0%
Applied egg-rr81.0%
exp-1-e81.0%
distribute-lft-neg-in81.0%
distribute-rgt-neg-in81.0%
sub-neg81.0%
neg-mul-181.0%
distribute-neg-in81.0%
metadata-eval81.0%
neg-mul-181.0%
remove-double-neg81.0%
Simplified81.0%
Taylor expanded in eps around 0 74.7%
mul-1-neg74.7%
log-E74.7%
distribute-lft-neg-out74.7%
*-rgt-identity74.7%
*-lft-identity74.7%
distribute-rgt-out--74.7%
metadata-eval74.7%
*-commutative74.7%
associate-*l*74.7%
metadata-eval74.7%
*-rgt-identity74.7%
Simplified74.7%
if 0.849999999999999978 < eps Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 48.1%
Taylor expanded in eps around 0 56.3%
Taylor expanded in x around 0 92.2%
Final simplification79.7%
(FPCore (x eps)
:precision binary64
(if (<= eps 1000000000.0)
(exp (- x))
(/
(+
(exp (* x (- -1.0 eps)))
(+
1.0
(-
(/ 1.0 eps)
(*
x
(+
(/ 1.0 eps)
(-
(* x (- 0.5 (- (* 0.5 (/ 1.0 eps)) (* eps (- 0.5 (* eps 0.5))))))
eps))))))
2.0)))
double code(double x, double eps) {
double tmp;
if (eps <= 1000000000.0) {
tmp = exp(-x);
} else {
tmp = (exp((x * (-1.0 - eps))) + (1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps)))))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= 1000000000.0d0) then
tmp = exp(-x)
else
tmp = (exp((x * ((-1.0d0) - eps))) + (1.0d0 + ((1.0d0 / eps) - (x * ((1.0d0 / eps) + ((x * (0.5d0 - ((0.5d0 * (1.0d0 / eps)) - (eps * (0.5d0 - (eps * 0.5d0)))))) - eps)))))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= 1000000000.0) {
tmp = Math.exp(-x);
} else {
tmp = (Math.exp((x * (-1.0 - eps))) + (1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps)))))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= 1000000000.0: tmp = math.exp(-x) else: tmp = (math.exp((x * (-1.0 - eps))) + (1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps)))))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (eps <= 1000000000.0) tmp = exp(Float64(-x)); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 - eps))) + Float64(1.0 + Float64(Float64(1.0 / eps) - Float64(x * Float64(Float64(1.0 / eps) + Float64(Float64(x * Float64(0.5 - Float64(Float64(0.5 * Float64(1.0 / eps)) - Float64(eps * Float64(0.5 - Float64(eps * 0.5)))))) - eps)))))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 1000000000.0) tmp = exp(-x); else tmp = (exp((x * (-1.0 - eps))) + (1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps)))))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, 1000000000.0], N[Exp[(-x)], $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 + N[(N[(1.0 / eps), $MachinePrecision] - N[(x * N[(N[(1.0 / eps), $MachinePrecision] + N[(N[(x * N[(0.5 - N[(N[(0.5 * N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] - N[(eps * N[(0.5 - N[(eps * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 1000000000:\\
\;\;\;\;e^{-x}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 - \varepsilon\right)} + \left(1 + \left(\frac{1}{\varepsilon} - x \cdot \left(\frac{1}{\varepsilon} + \left(x \cdot \left(0.5 - \left(0.5 \cdot \frac{1}{\varepsilon} - \varepsilon \cdot \left(0.5 - \varepsilon \cdot 0.5\right)\right)\right) - \varepsilon\right)\right)\right)\right)}{2}\\
\end{array}
\end{array}
if eps < 1e9Initial program 71.0%
Simplified71.0%
Taylor expanded in eps around inf 99.2%
Taylor expanded in eps around 0 81.6%
neg-mul-181.6%
Simplified81.6%
*-un-lft-identity81.6%
exp-prod81.6%
associate-*r*81.6%
neg-mul-181.6%
Applied egg-rr81.6%
exp-1-e81.6%
distribute-lft-neg-in81.6%
distribute-rgt-neg-in81.6%
sub-neg81.6%
neg-mul-181.6%
distribute-neg-in81.6%
metadata-eval81.6%
neg-mul-181.6%
remove-double-neg81.6%
Simplified81.6%
Taylor expanded in eps around 0 75.0%
mul-1-neg75.0%
log-E75.0%
distribute-lft-neg-out75.0%
*-rgt-identity75.0%
*-lft-identity75.0%
distribute-rgt-out--75.0%
metadata-eval75.0%
*-commutative75.0%
associate-*l*75.0%
metadata-eval75.0%
*-rgt-identity75.0%
Simplified75.0%
if 1e9 < eps Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 46.5%
Taylor expanded in eps around 0 56.9%
Taylor expanded in x around 0 91.5%
Taylor expanded in eps around inf 91.5%
Final simplification79.3%
(FPCore (x eps)
:precision binary64
(if (<= eps 1.2e+23)
(exp (- x))
(/
(+
(+
1.0
(-
(/ 1.0 eps)
(*
x
(+
(/ 1.0 eps)
(-
(* x (- 0.5 (- (* 0.5 (/ 1.0 eps)) (* eps (- 0.5 (* eps 0.5))))))
eps)))))
(+ 1.0 (/ -1.0 eps)))
2.0)))
double code(double x, double eps) {
double tmp;
if (eps <= 1.2e+23) {
tmp = exp(-x);
} else {
tmp = ((1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps))))) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= 1.2d+23) then
tmp = exp(-x)
else
tmp = ((1.0d0 + ((1.0d0 / eps) - (x * ((1.0d0 / eps) + ((x * (0.5d0 - ((0.5d0 * (1.0d0 / eps)) - (eps * (0.5d0 - (eps * 0.5d0)))))) - eps))))) + (1.0d0 + ((-1.0d0) / eps))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= 1.2e+23) {
tmp = Math.exp(-x);
} else {
tmp = ((1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps))))) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= 1.2e+23: tmp = math.exp(-x) else: tmp = ((1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps))))) + (1.0 + (-1.0 / eps))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (eps <= 1.2e+23) tmp = exp(Float64(-x)); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(1.0 / eps) - Float64(x * Float64(Float64(1.0 / eps) + Float64(Float64(x * Float64(0.5 - Float64(Float64(0.5 * Float64(1.0 / eps)) - Float64(eps * Float64(0.5 - Float64(eps * 0.5)))))) - eps))))) + Float64(1.0 + Float64(-1.0 / eps))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 1.2e+23) tmp = exp(-x); else tmp = ((1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps))))) + (1.0 + (-1.0 / eps))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, 1.2e+23], N[Exp[(-x)], $MachinePrecision], N[(N[(N[(1.0 + N[(N[(1.0 / eps), $MachinePrecision] - N[(x * N[(N[(1.0 / eps), $MachinePrecision] + N[(N[(x * N[(0.5 - N[(N[(0.5 * N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] - N[(eps * N[(0.5 - N[(eps * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 1.2 \cdot 10^{+23}:\\
\;\;\;\;e^{-x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(\frac{1}{\varepsilon} - x \cdot \left(\frac{1}{\varepsilon} + \left(x \cdot \left(0.5 - \left(0.5 \cdot \frac{1}{\varepsilon} - \varepsilon \cdot \left(0.5 - \varepsilon \cdot 0.5\right)\right)\right) - \varepsilon\right)\right)\right)\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if eps < 1.2e23Initial program 71.4%
Simplified71.4%
Taylor expanded in eps around inf 99.2%
Taylor expanded in eps around 0 81.8%
neg-mul-181.8%
Simplified81.8%
*-un-lft-identity81.8%
exp-prod81.8%
associate-*r*81.8%
neg-mul-181.8%
Applied egg-rr81.8%
exp-1-e81.8%
distribute-lft-neg-in81.8%
distribute-rgt-neg-in81.8%
sub-neg81.8%
neg-mul-181.8%
distribute-neg-in81.8%
metadata-eval81.8%
neg-mul-181.8%
remove-double-neg81.8%
Simplified81.8%
Taylor expanded in eps around 0 75.4%
mul-1-neg75.4%
log-E75.4%
distribute-lft-neg-out75.4%
*-rgt-identity75.4%
*-lft-identity75.4%
distribute-rgt-out--75.4%
metadata-eval75.4%
*-commutative75.4%
associate-*l*75.4%
metadata-eval75.4%
*-rgt-identity75.4%
Simplified75.4%
if 1.2e23 < eps Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 47.1%
Taylor expanded in eps around 0 54.8%
Taylor expanded in x around 0 91.1%
Taylor expanded in x around 0 83.7%
Final simplification77.5%
(FPCore (x eps)
:precision binary64
(if (<= eps 4.6e+21)
(+ 1.0 (* x (+ -1.0 (* x (+ 0.5 (* x -0.16666666666666666))))))
(/
(+
(+
1.0
(-
(/ 1.0 eps)
(*
x
(+
(/ 1.0 eps)
(-
(* x (- 0.5 (- (* 0.5 (/ 1.0 eps)) (* eps (- 0.5 (* eps 0.5))))))
eps)))))
(+ 1.0 (/ -1.0 eps)))
2.0)))
double code(double x, double eps) {
double tmp;
if (eps <= 4.6e+21) {
tmp = 1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))));
} else {
tmp = ((1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps))))) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= 4.6d+21) then
tmp = 1.0d0 + (x * ((-1.0d0) + (x * (0.5d0 + (x * (-0.16666666666666666d0))))))
else
tmp = ((1.0d0 + ((1.0d0 / eps) - (x * ((1.0d0 / eps) + ((x * (0.5d0 - ((0.5d0 * (1.0d0 / eps)) - (eps * (0.5d0 - (eps * 0.5d0)))))) - eps))))) + (1.0d0 + ((-1.0d0) / eps))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= 4.6e+21) {
tmp = 1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))));
} else {
tmp = ((1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps))))) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= 4.6e+21: tmp = 1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666))))) else: tmp = ((1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps))))) + (1.0 + (-1.0 / eps))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (eps <= 4.6e+21) tmp = Float64(1.0 + Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * -0.16666666666666666)))))); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(1.0 / eps) - Float64(x * Float64(Float64(1.0 / eps) + Float64(Float64(x * Float64(0.5 - Float64(Float64(0.5 * Float64(1.0 / eps)) - Float64(eps * Float64(0.5 - Float64(eps * 0.5)))))) - eps))))) + Float64(1.0 + Float64(-1.0 / eps))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 4.6e+21) tmp = 1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666))))); else tmp = ((1.0 + ((1.0 / eps) - (x * ((1.0 / eps) + ((x * (0.5 - ((0.5 * (1.0 / eps)) - (eps * (0.5 - (eps * 0.5)))))) - eps))))) + (1.0 + (-1.0 / eps))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, 4.6e+21], N[(1.0 + N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(1.0 / eps), $MachinePrecision] - N[(x * N[(N[(1.0 / eps), $MachinePrecision] + N[(N[(x * N[(0.5 - N[(N[(0.5 * N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] - N[(eps * N[(0.5 - N[(eps * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 4.6 \cdot 10^{+21}:\\
\;\;\;\;1 + x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot -0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(\frac{1}{\varepsilon} - x \cdot \left(\frac{1}{\varepsilon} + \left(x \cdot \left(0.5 - \left(0.5 \cdot \frac{1}{\varepsilon} - \varepsilon \cdot \left(0.5 - \varepsilon \cdot 0.5\right)\right)\right) - \varepsilon\right)\right)\right)\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if eps < 4.6e21Initial program 71.4%
Simplified71.4%
Taylor expanded in eps around inf 99.2%
Taylor expanded in eps around 0 81.8%
neg-mul-181.8%
Simplified81.8%
Taylor expanded in eps around 0 75.4%
cancel-sign-sub-inv75.4%
neg-mul-175.4%
metadata-eval75.4%
*-lft-identity75.4%
count-275.4%
Simplified75.4%
Taylor expanded in x around 0 53.6%
if 4.6e21 < eps Initial program 99.9%
Simplified99.9%
Taylor expanded in x around 0 47.1%
Taylor expanded in eps around 0 54.8%
Taylor expanded in x around 0 91.1%
Taylor expanded in x around 0 83.7%
Final simplification61.2%
(FPCore (x eps) :precision binary64 (if (<= x 1.56) (+ 1.0 (* x (+ -1.0 (* x (+ 0.5 (* x -0.16666666666666666)))))) 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 1.56) {
tmp = 1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))));
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 1.56d0) then
tmp = 1.0d0 + (x * ((-1.0d0) + (x * (0.5d0 + (x * (-0.16666666666666666d0))))))
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 1.56) {
tmp = 1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))));
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.56: tmp = 1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666))))) else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 1.56) tmp = Float64(1.0 + Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * -0.16666666666666666)))))); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 1.56) tmp = 1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666))))); else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 1.56], N[(1.0 + N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.56:\\
\;\;\;\;1 + x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot -0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.5600000000000001Initial program 70.2%
Simplified70.2%
Taylor expanded in eps around inf 99.4%
Taylor expanded in eps around 0 88.3%
neg-mul-188.3%
Simplified88.3%
Taylor expanded in eps around 0 75.1%
cancel-sign-sub-inv75.1%
neg-mul-175.1%
metadata-eval75.1%
*-lft-identity75.1%
count-275.1%
Simplified75.1%
Taylor expanded in x around 0 69.4%
if 1.5600000000000001 < x Initial program 99.2%
Simplified99.2%
Taylor expanded in eps around 0 50.9%
Taylor expanded in x around 0 51.3%
Final simplification64.2%
(FPCore (x eps) :precision binary64 (if (<= x 550.0) (/ (+ 2.0 (* x (- x 2.0))) 2.0) 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 550.0) {
tmp = (2.0 + (x * (x - 2.0))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 550.0d0) then
tmp = (2.0d0 + (x * (x - 2.0d0))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 550.0) {
tmp = (2.0 + (x * (x - 2.0))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 550.0: tmp = (2.0 + (x * (x - 2.0))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 550.0) tmp = Float64(Float64(2.0 + Float64(x * Float64(x - 2.0))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 550.0) tmp = (2.0 + (x * (x - 2.0))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 550.0], N[(N[(2.0 + N[(x * N[(x - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 550:\\
\;\;\;\;\frac{2 + x \cdot \left(x - 2\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 550Initial program 70.3%
Simplified70.3%
Taylor expanded in eps around inf 99.4%
Taylor expanded in eps around 0 87.8%
neg-mul-187.8%
Simplified87.8%
Taylor expanded in eps around 0 74.7%
cancel-sign-sub-inv74.7%
neg-mul-174.7%
metadata-eval74.7%
*-lft-identity74.7%
count-274.7%
Simplified74.7%
Taylor expanded in x around 0 62.5%
if 550 < x Initial program 99.2%
Simplified99.2%
Taylor expanded in eps around 0 51.6%
Taylor expanded in x around 0 52.0%
(FPCore (x eps) :precision binary64 (if (<= x 1.0) (- 1.0 x) 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 1.0) {
tmp = 1.0 - x;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 1.0d0) then
tmp = 1.0d0 - x
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 1.0) {
tmp = 1.0 - x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.0: tmp = 1.0 - x else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 1.0) tmp = Float64(1.0 - x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 1.0) tmp = 1.0 - x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 1.0], N[(1.0 - x), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1Initial program 70.2%
Simplified70.2%
Taylor expanded in eps around inf 99.4%
Taylor expanded in eps around 0 88.3%
neg-mul-188.3%
Simplified88.3%
Taylor expanded in eps around 0 75.1%
cancel-sign-sub-inv75.1%
neg-mul-175.1%
metadata-eval75.1%
*-lft-identity75.1%
count-275.1%
Simplified75.1%
Taylor expanded in x around 0 52.2%
neg-mul-152.2%
unsub-neg52.2%
Simplified52.2%
if 1 < x Initial program 99.2%
Simplified99.2%
Taylor expanded in eps around 0 50.9%
Taylor expanded in x around 0 51.3%
(FPCore (x eps) :precision binary64 (if (<= x 550.0) 1.0 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 550.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 550.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 550.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 550.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 550.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 550.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 550.0], 1.0, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 550:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 550Initial program 70.3%
Simplified70.3%
Taylor expanded in eps around inf 99.4%
Taylor expanded in eps around 0 87.8%
neg-mul-187.8%
Simplified87.8%
*-un-lft-identity87.8%
exp-prod87.8%
associate-*r*87.8%
neg-mul-187.8%
Applied egg-rr87.8%
exp-1-e87.8%
distribute-lft-neg-in87.8%
distribute-rgt-neg-in87.8%
sub-neg87.8%
neg-mul-187.8%
distribute-neg-in87.8%
metadata-eval87.8%
neg-mul-187.8%
remove-double-neg87.8%
Simplified87.8%
Taylor expanded in x around 0 51.4%
if 550 < x Initial program 99.2%
Simplified99.2%
Taylor expanded in eps around 0 51.6%
Taylor expanded in x around 0 52.0%
(FPCore (x eps) :precision binary64 0.0)
double code(double x, double eps) {
return 0.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 0.0d0
end function
public static double code(double x, double eps) {
return 0.0;
}
def code(x, eps): return 0.0
function code(x, eps) return 0.0 end
function tmp = code(x, eps) tmp = 0.0; end
code[x_, eps_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 78.6%
Simplified68.4%
Taylor expanded in eps around 0 16.1%
Taylor expanded in x around 0 16.5%
herbie shell --seed 2024185
(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))