
(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 10 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}
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= x 4e-23) (/ (+ (exp (* x (+ eps -1.0))) (exp (* x (- eps)))) 2.0) (/ (+ (exp (- (* x eps) x)) (exp (- x))) 2.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 4e-23) {
tmp = (exp((x * (eps + -1.0))) + exp((x * -eps))) / 2.0;
} else {
tmp = (exp(((x * eps) - x)) + exp(-x)) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 4d-23) then
tmp = (exp((x * (eps + (-1.0d0)))) + exp((x * -eps))) / 2.0d0
else
tmp = (exp(((x * eps) - x)) + exp(-x)) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 4e-23) {
tmp = (Math.exp((x * (eps + -1.0))) + Math.exp((x * -eps))) / 2.0;
} else {
tmp = (Math.exp(((x * eps) - x)) + Math.exp(-x)) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 4e-23: tmp = (math.exp((x * (eps + -1.0))) + math.exp((x * -eps))) / 2.0 else: tmp = (math.exp(((x * eps) - x)) + math.exp(-x)) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 4e-23) tmp = Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(x * Float64(-eps)))) / 2.0); else tmp = Float64(Float64(exp(Float64(Float64(x * eps) - x)) + exp(Float64(-x))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 4e-23) tmp = (exp((x * (eps + -1.0))) + exp((x * -eps))) / 2.0; else tmp = (exp(((x * eps) - x)) + exp(-x)) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 4e-23], N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(N[(x * eps), $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4 \cdot 10^{-23}:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon - x} + e^{-x}}{2}\\
\end{array}
\end{array}
if x < 3.99999999999999984e-23Initial program 67.8%
div-sub67.8%
+-rgt-identity67.8%
div-sub67.8%
Simplified67.8%
Taylor expanded in eps around inf 97.9%
mul-1-neg97.9%
*-commutative97.9%
mul-1-neg97.9%
exp-prod97.9%
+-commutative97.9%
*-lft-identity97.9%
metadata-eval97.9%
cancel-sign-sub-inv97.9%
exp-prod97.9%
mul-1-neg97.9%
*-commutative97.9%
cancel-sign-sub-inv97.9%
metadata-eval97.9%
*-lft-identity97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in eps around inf 97.9%
if 3.99999999999999984e-23 < x Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
exp-prod100.0%
+-commutative100.0%
*-lft-identity100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
exp-prod100.0%
mul-1-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
*-lft-identity100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 73.5%
Taylor expanded in x around inf 73.5%
Final simplification90.5%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= eps 3.4e-20)
(/ (/ 2.0 (exp x)) 2.0)
(if (or (<= eps 7.2e+235) (not (<= eps 2e+270)))
(/ (+ t_0 (exp (* x eps))) 2.0)
(/ (* t_0 (+ 2.0 (* x (+ eps (* x (* eps (* eps 0.5))))))) 2.0)))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = exp(-x);
double tmp;
if (eps <= 3.4e-20) {
tmp = (2.0 / exp(x)) / 2.0;
} else if ((eps <= 7.2e+235) || !(eps <= 2e+270)) {
tmp = (t_0 + exp((x * eps))) / 2.0;
} else {
tmp = (t_0 * (2.0 + (x * (eps + (x * (eps * (eps * 0.5))))))) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-x)
if (eps <= 3.4d-20) then
tmp = (2.0d0 / exp(x)) / 2.0d0
else if ((eps <= 7.2d+235) .or. (.not. (eps <= 2d+270))) then
tmp = (t_0 + exp((x * eps))) / 2.0d0
else
tmp = (t_0 * (2.0d0 + (x * (eps + (x * (eps * (eps * 0.5d0))))))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = Math.exp(-x);
double tmp;
if (eps <= 3.4e-20) {
tmp = (2.0 / Math.exp(x)) / 2.0;
} else if ((eps <= 7.2e+235) || !(eps <= 2e+270)) {
tmp = (t_0 + Math.exp((x * eps))) / 2.0;
} else {
tmp = (t_0 * (2.0 + (x * (eps + (x * (eps * (eps * 0.5))))))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = math.exp(-x) tmp = 0 if eps <= 3.4e-20: tmp = (2.0 / math.exp(x)) / 2.0 elif (eps <= 7.2e+235) or not (eps <= 2e+270): tmp = (t_0 + math.exp((x * eps))) / 2.0 else: tmp = (t_0 * (2.0 + (x * (eps + (x * (eps * (eps * 0.5))))))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = exp(Float64(-x)) tmp = 0.0 if (eps <= 3.4e-20) tmp = Float64(Float64(2.0 / exp(x)) / 2.0); elseif ((eps <= 7.2e+235) || !(eps <= 2e+270)) tmp = Float64(Float64(t_0 + exp(Float64(x * eps))) / 2.0); else tmp = Float64(Float64(t_0 * Float64(2.0 + Float64(x * Float64(eps + Float64(x * Float64(eps * Float64(eps * 0.5))))))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = exp(-x); tmp = 0.0; if (eps <= 3.4e-20) tmp = (2.0 / exp(x)) / 2.0; elseif ((eps <= 7.2e+235) || ~((eps <= 2e+270))) tmp = (t_0 + exp((x * eps))) / 2.0; else tmp = (t_0 * (2.0 + (x * (eps + (x * (eps * (eps * 0.5))))))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[eps, 3.4e-20], N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[eps, 7.2e+235], N[Not[LessEqual[eps, 2e+270]], $MachinePrecision]], N[(N[(t$95$0 + N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(t$95$0 * N[(2.0 + N[(x * N[(eps + N[(x * N[(eps * N[(eps * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;\varepsilon \leq 3.4 \cdot 10^{-20}:\\
\;\;\;\;\frac{\frac{2}{e^{x}}}{2}\\
\mathbf{elif}\;\varepsilon \leq 7.2 \cdot 10^{+235} \lor \neg \left(\varepsilon \leq 2 \cdot 10^{+270}\right):\\
\;\;\;\;\frac{t_0 + e^{x \cdot \varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 \cdot \left(2 + x \cdot \left(\varepsilon + x \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot 0.5\right)\right)\right)\right)}{2}\\
\end{array}
\end{array}
if eps < 3.3999999999999997e-20Initial program 69.2%
div-sub69.2%
+-rgt-identity69.2%
div-sub69.2%
Simplified69.2%
Taylor expanded in eps around inf 98.0%
mul-1-neg98.0%
*-commutative98.0%
mul-1-neg98.0%
exp-prod98.0%
+-commutative98.0%
*-lft-identity98.0%
metadata-eval98.0%
cancel-sign-sub-inv98.0%
exp-prod98.0%
mul-1-neg98.0%
*-commutative98.0%
cancel-sign-sub-inv98.0%
metadata-eval98.0%
*-lft-identity98.0%
+-commutative98.0%
Simplified98.0%
Taylor expanded in eps around 0 80.7%
Taylor expanded in eps around 0 75.0%
exp-neg75.0%
associate-*r/75.0%
metadata-eval75.0%
Simplified75.0%
if 3.3999999999999997e-20 < eps < 7.19999999999999971e235 or 2.0000000000000001e270 < eps Initial program 98.6%
div-sub98.6%
+-rgt-identity98.6%
div-sub98.6%
Simplified98.6%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
exp-prod100.0%
+-commutative100.0%
*-lft-identity100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
exp-prod100.0%
mul-1-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
*-lft-identity100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 86.4%
Taylor expanded in x around inf 86.4%
Taylor expanded in eps around inf 86.4%
*-commutative86.4%
Simplified86.4%
if 7.19999999999999971e235 < eps < 2.0000000000000001e270Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
exp-prod100.0%
+-commutative100.0%
*-lft-identity100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
exp-prod100.0%
mul-1-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
*-lft-identity100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 46.2%
Taylor expanded in x around inf 46.2%
Taylor expanded in eps around 0 50.0%
associate-+r+50.0%
+-commutative50.0%
*-commutative50.0%
*-commutative50.0%
associate-*r*50.0%
associate-*r*50.0%
*-commutative50.0%
associate-*r*50.0%
distribute-rgt-out50.0%
distribute-lft-out50.0%
unpow250.0%
Simplified67.7%
Final simplification77.8%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (/ (+ (exp (* x (+ eps -1.0))) (exp (* x (- -1.0 eps)))) 2.0))
eps = abs(eps);
double code(double x, double eps) {
return (exp((x * (eps + -1.0))) + exp((x * (-1.0 - eps)))) / 2.0;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (exp((x * (eps + (-1.0d0)))) + exp((x * ((-1.0d0) - eps)))) / 2.0d0
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
return (Math.exp((x * (eps + -1.0))) + Math.exp((x * (-1.0 - eps)))) / 2.0;
}
eps = abs(eps) def code(x, eps): return (math.exp((x * (eps + -1.0))) + math.exp((x * (-1.0 - eps)))) / 2.0
eps = abs(eps) function code(x, eps) return Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0) end
eps = abs(eps) function tmp = code(x, eps) tmp = (exp((x * (eps + -1.0))) + exp((x * (-1.0 - eps)))) / 2.0; end
NOTE: eps should be positive before calling this function code[x_, eps_] := N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps = |eps|\\
\\
\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}
\end{array}
Initial program 77.6%
div-sub77.6%
+-rgt-identity77.6%
div-sub77.6%
Simplified77.6%
Taylor expanded in eps around inf 98.5%
mul-1-neg98.5%
*-commutative98.5%
mul-1-neg98.5%
exp-prod98.5%
+-commutative98.5%
*-lft-identity98.5%
metadata-eval98.5%
cancel-sign-sub-inv98.5%
exp-prod98.5%
mul-1-neg98.5%
*-commutative98.5%
cancel-sign-sub-inv98.5%
metadata-eval98.5%
*-lft-identity98.5%
+-commutative98.5%
Simplified98.5%
Final simplification98.5%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= x -1.6e-231)
(/ (* t_0 (+ 2.0 (* x (+ eps (* x (* eps (* eps 0.5))))))) 2.0)
(/ (+ (exp (- (* x eps) x)) t_0) 2.0))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = exp(-x);
double tmp;
if (x <= -1.6e-231) {
tmp = (t_0 * (2.0 + (x * (eps + (x * (eps * (eps * 0.5))))))) / 2.0;
} else {
tmp = (exp(((x * eps) - x)) + t_0) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-x)
if (x <= (-1.6d-231)) then
tmp = (t_0 * (2.0d0 + (x * (eps + (x * (eps * (eps * 0.5d0))))))) / 2.0d0
else
tmp = (exp(((x * eps) - x)) + t_0) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = Math.exp(-x);
double tmp;
if (x <= -1.6e-231) {
tmp = (t_0 * (2.0 + (x * (eps + (x * (eps * (eps * 0.5))))))) / 2.0;
} else {
tmp = (Math.exp(((x * eps) - x)) + t_0) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = math.exp(-x) tmp = 0 if x <= -1.6e-231: tmp = (t_0 * (2.0 + (x * (eps + (x * (eps * (eps * 0.5))))))) / 2.0 else: tmp = (math.exp(((x * eps) - x)) + t_0) / 2.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = exp(Float64(-x)) tmp = 0.0 if (x <= -1.6e-231) tmp = Float64(Float64(t_0 * Float64(2.0 + Float64(x * Float64(eps + Float64(x * Float64(eps * Float64(eps * 0.5))))))) / 2.0); else tmp = Float64(Float64(exp(Float64(Float64(x * eps) - x)) + t_0) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = exp(-x); tmp = 0.0; if (x <= -1.6e-231) tmp = (t_0 * (2.0 + (x * (eps + (x * (eps * (eps * 0.5))))))) / 2.0; else tmp = (exp(((x * eps) - x)) + t_0) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[x, -1.6e-231], N[(N[(t$95$0 * N[(2.0 + N[(x * N[(eps + N[(x * N[(eps * N[(eps * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(N[(x * eps), $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;x \leq -1.6 \cdot 10^{-231}:\\
\;\;\;\;\frac{t_0 \cdot \left(2 + x \cdot \left(\varepsilon + x \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot 0.5\right)\right)\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon - x} + t_0}{2}\\
\end{array}
\end{array}
if x < -1.60000000000000004e-231Initial program 73.5%
div-sub73.5%
+-rgt-identity73.5%
div-sub73.5%
Simplified73.5%
Taylor expanded in eps around inf 96.2%
mul-1-neg96.2%
*-commutative96.2%
mul-1-neg96.2%
exp-prod96.2%
+-commutative96.2%
*-lft-identity96.2%
metadata-eval96.2%
cancel-sign-sub-inv96.2%
exp-prod96.2%
mul-1-neg96.2%
*-commutative96.2%
cancel-sign-sub-inv96.2%
metadata-eval96.2%
*-lft-identity96.2%
+-commutative96.2%
Simplified96.2%
Taylor expanded in eps around 0 84.5%
Taylor expanded in x around inf 84.5%
Taylor expanded in eps around 0 66.2%
associate-+r+66.2%
+-commutative66.2%
*-commutative66.2%
*-commutative66.2%
associate-*r*66.2%
associate-*r*66.2%
*-commutative66.2%
associate-*r*66.2%
distribute-rgt-out74.3%
distribute-lft-out74.3%
unpow274.3%
Simplified89.5%
if -1.60000000000000004e-231 < x Initial program 80.3%
div-sub80.3%
+-rgt-identity80.3%
div-sub80.3%
Simplified80.3%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
exp-prod100.0%
+-commutative100.0%
*-lft-identity100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
exp-prod100.0%
mul-1-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
*-lft-identity100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 79.4%
Taylor expanded in x around inf 79.4%
Final simplification83.3%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (/ 2.0 (exp x)) 2.0)))
(if (<= eps 3700000000000.0)
t_0
(if (<= eps 1.1e+83)
(/ (+ 2.0 (* x (+ x -2.0))) 2.0)
(if (<= eps 9.2e+174)
t_0
(/
(* (exp (- x)) (+ 2.0 (* x (+ eps (* x (* eps (* eps 0.5)))))))
2.0))))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = (2.0 / exp(x)) / 2.0;
double tmp;
if (eps <= 3700000000000.0) {
tmp = t_0;
} else if (eps <= 1.1e+83) {
tmp = (2.0 + (x * (x + -2.0))) / 2.0;
} else if (eps <= 9.2e+174) {
tmp = t_0;
} else {
tmp = (exp(-x) * (2.0 + (x * (eps + (x * (eps * (eps * 0.5))))))) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = (2.0d0 / exp(x)) / 2.0d0
if (eps <= 3700000000000.0d0) then
tmp = t_0
else if (eps <= 1.1d+83) then
tmp = (2.0d0 + (x * (x + (-2.0d0)))) / 2.0d0
else if (eps <= 9.2d+174) then
tmp = t_0
else
tmp = (exp(-x) * (2.0d0 + (x * (eps + (x * (eps * (eps * 0.5d0))))))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = (2.0 / Math.exp(x)) / 2.0;
double tmp;
if (eps <= 3700000000000.0) {
tmp = t_0;
} else if (eps <= 1.1e+83) {
tmp = (2.0 + (x * (x + -2.0))) / 2.0;
} else if (eps <= 9.2e+174) {
tmp = t_0;
} else {
tmp = (Math.exp(-x) * (2.0 + (x * (eps + (x * (eps * (eps * 0.5))))))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = (2.0 / math.exp(x)) / 2.0 tmp = 0 if eps <= 3700000000000.0: tmp = t_0 elif eps <= 1.1e+83: tmp = (2.0 + (x * (x + -2.0))) / 2.0 elif eps <= 9.2e+174: tmp = t_0 else: tmp = (math.exp(-x) * (2.0 + (x * (eps + (x * (eps * (eps * 0.5))))))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = Float64(Float64(2.0 / exp(x)) / 2.0) tmp = 0.0 if (eps <= 3700000000000.0) tmp = t_0; elseif (eps <= 1.1e+83) tmp = Float64(Float64(2.0 + Float64(x * Float64(x + -2.0))) / 2.0); elseif (eps <= 9.2e+174) tmp = t_0; else tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * Float64(eps + Float64(x * Float64(eps * Float64(eps * 0.5))))))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = (2.0 / exp(x)) / 2.0; tmp = 0.0; if (eps <= 3700000000000.0) tmp = t_0; elseif (eps <= 1.1e+83) tmp = (2.0 + (x * (x + -2.0))) / 2.0; elseif (eps <= 9.2e+174) tmp = t_0; else tmp = (exp(-x) * (2.0 + (x * (eps + (x * (eps * (eps * 0.5))))))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[eps, 3700000000000.0], t$95$0, If[LessEqual[eps, 1.1e+83], N[(N[(2.0 + N[(x * N[(x + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 9.2e+174], t$95$0, N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * N[(eps + N[(x * N[(eps * N[(eps * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := \frac{\frac{2}{e^{x}}}{2}\\
\mathbf{if}\;\varepsilon \leq 3700000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\varepsilon \leq 1.1 \cdot 10^{+83}:\\
\;\;\;\;\frac{2 + x \cdot \left(x + -2\right)}{2}\\
\mathbf{elif}\;\varepsilon \leq 9.2 \cdot 10^{+174}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot \left(\varepsilon + x \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot 0.5\right)\right)\right)\right)}{2}\\
\end{array}
\end{array}
if eps < 3.7e12 or 1.09999999999999999e83 < eps < 9.1999999999999991e174Initial program 72.5%
div-sub72.5%
+-rgt-identity72.5%
div-sub72.5%
Simplified72.5%
Taylor expanded in eps around inf 98.2%
mul-1-neg98.2%
*-commutative98.2%
mul-1-neg98.2%
exp-prod98.2%
+-commutative98.2%
*-lft-identity98.2%
metadata-eval98.2%
cancel-sign-sub-inv98.2%
exp-prod98.2%
mul-1-neg98.2%
*-commutative98.2%
cancel-sign-sub-inv98.2%
metadata-eval98.2%
*-lft-identity98.2%
+-commutative98.2%
Simplified98.2%
Taylor expanded in eps around 0 81.2%
Taylor expanded in eps around 0 72.9%
exp-neg72.9%
associate-*r/72.9%
metadata-eval72.9%
Simplified72.9%
if 3.7e12 < eps < 1.09999999999999999e83Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
exp-prod100.0%
+-commutative100.0%
*-lft-identity100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
exp-prod100.0%
mul-1-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
*-lft-identity100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
Taylor expanded in eps around 0 67.3%
exp-neg67.3%
associate-*r/67.3%
metadata-eval67.3%
Simplified67.3%
Taylor expanded in x around 0 82.0%
unpow282.0%
distribute-rgt-out82.0%
+-commutative82.0%
Simplified82.0%
if 9.1999999999999991e174 < eps Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
exp-prod100.0%
+-commutative100.0%
*-lft-identity100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
exp-prod100.0%
mul-1-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
*-lft-identity100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 68.6%
Taylor expanded in x around inf 68.6%
Taylor expanded in eps around 0 29.6%
associate-+r+29.6%
+-commutative29.6%
*-commutative29.6%
*-commutative29.6%
associate-*r*29.6%
associate-*r*29.6%
*-commutative29.6%
associate-*r*29.6%
distribute-rgt-out33.3%
distribute-lft-out33.3%
unpow233.3%
Simplified74.5%
Final simplification73.8%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (or (<= eps 8200000000000.0) (not (<= eps 1.85e+82))) (/ (/ 2.0 (exp x)) 2.0) (/ (+ 2.0 (* x (+ x -2.0))) 2.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if ((eps <= 8200000000000.0) || !(eps <= 1.85e+82)) {
tmp = (2.0 / exp(x)) / 2.0;
} else {
tmp = (2.0 + (x * (x + -2.0))) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= 8200000000000.0d0) .or. (.not. (eps <= 1.85d+82))) then
tmp = (2.0d0 / exp(x)) / 2.0d0
else
tmp = (2.0d0 + (x * (x + (-2.0d0)))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if ((eps <= 8200000000000.0) || !(eps <= 1.85e+82)) {
tmp = (2.0 / Math.exp(x)) / 2.0;
} else {
tmp = (2.0 + (x * (x + -2.0))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if (eps <= 8200000000000.0) or not (eps <= 1.85e+82): tmp = (2.0 / math.exp(x)) / 2.0 else: tmp = (2.0 + (x * (x + -2.0))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if ((eps <= 8200000000000.0) || !(eps <= 1.85e+82)) tmp = Float64(Float64(2.0 / exp(x)) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(x + -2.0))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= 8200000000000.0) || ~((eps <= 1.85e+82))) tmp = (2.0 / exp(x)) / 2.0; else tmp = (2.0 + (x * (x + -2.0))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[Or[LessEqual[eps, 8200000000000.0], N[Not[LessEqual[eps, 1.85e+82]], $MachinePrecision]], N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(x + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 8200000000000 \lor \neg \left(\varepsilon \leq 1.85 \cdot 10^{+82}\right):\\
\;\;\;\;\frac{\frac{2}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(x + -2\right)}{2}\\
\end{array}
\end{array}
if eps < 8.2e12 or 1.8500000000000001e82 < eps Initial program 75.6%
div-sub75.6%
+-rgt-identity75.6%
div-sub75.6%
Simplified75.6%
Taylor expanded in eps around inf 98.4%
mul-1-neg98.4%
*-commutative98.4%
mul-1-neg98.4%
exp-prod98.4%
+-commutative98.4%
*-lft-identity98.4%
metadata-eval98.4%
cancel-sign-sub-inv98.4%
exp-prod98.4%
mul-1-neg98.4%
*-commutative98.4%
cancel-sign-sub-inv98.4%
metadata-eval98.4%
*-lft-identity98.4%
+-commutative98.4%
Simplified98.4%
Taylor expanded in eps around 0 79.7%
Taylor expanded in eps around 0 69.8%
exp-neg69.8%
associate-*r/69.8%
metadata-eval69.8%
Simplified69.8%
if 8.2e12 < eps < 1.8500000000000001e82Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
exp-prod100.0%
+-commutative100.0%
*-lft-identity100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
exp-prod100.0%
mul-1-neg100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
*-lft-identity100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
Taylor expanded in eps around 0 67.3%
exp-neg67.3%
associate-*r/67.3%
metadata-eval67.3%
Simplified67.3%
Taylor expanded in x around 0 82.0%
unpow282.0%
distribute-rgt-out82.0%
+-commutative82.0%
Simplified82.0%
Final simplification70.8%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (or (<= x 1150.0) (and (not (<= x 1.75e+260)) (<= x 8e+301))) (/ (+ 2.0 (* x (+ x -2.0))) 2.0) 0.0))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if ((x <= 1150.0) || (!(x <= 1.75e+260) && (x <= 8e+301))) {
tmp = (2.0 + (x * (x + -2.0))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((x <= 1150.0d0) .or. (.not. (x <= 1.75d+260)) .and. (x <= 8d+301)) then
tmp = (2.0d0 + (x * (x + (-2.0d0)))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if ((x <= 1150.0) || (!(x <= 1.75e+260) && (x <= 8e+301))) {
tmp = (2.0 + (x * (x + -2.0))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if (x <= 1150.0) or (not (x <= 1.75e+260) and (x <= 8e+301)): tmp = (2.0 + (x * (x + -2.0))) / 2.0 else: tmp = 0.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if ((x <= 1150.0) || (!(x <= 1.75e+260) && (x <= 8e+301))) tmp = Float64(Float64(2.0 + Float64(x * Float64(x + -2.0))) / 2.0); else tmp = 0.0; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if ((x <= 1150.0) || (~((x <= 1.75e+260)) && (x <= 8e+301))) tmp = (2.0 + (x * (x + -2.0))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[Or[LessEqual[x, 1150.0], And[N[Not[LessEqual[x, 1.75e+260]], $MachinePrecision], LessEqual[x, 8e+301]]], N[(N[(2.0 + N[(x * N[(x + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1150 \lor \neg \left(x \leq 1.75 \cdot 10^{+260}\right) \land x \leq 8 \cdot 10^{+301}:\\
\;\;\;\;\frac{2 + x \cdot \left(x + -2\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1150 or 1.7499999999999999e260 < x < 8.00000000000000042e301Initial program 70.0%
div-sub70.0%
+-rgt-identity70.0%
div-sub70.0%
Simplified70.0%
Taylor expanded in eps around inf 98.0%
mul-1-neg98.0%
*-commutative98.0%
mul-1-neg98.0%
exp-prod98.0%
+-commutative98.0%
*-lft-identity98.0%
metadata-eval98.0%
cancel-sign-sub-inv98.0%
exp-prod98.0%
mul-1-neg98.0%
*-commutative98.0%
cancel-sign-sub-inv98.0%
metadata-eval98.0%
*-lft-identity98.0%
+-commutative98.0%
Simplified98.0%
Taylor expanded in eps around 0 83.3%
Taylor expanded in eps around 0 73.1%
exp-neg73.1%
associate-*r/73.1%
metadata-eval73.1%
Simplified73.1%
Taylor expanded in x around 0 68.8%
unpow268.8%
distribute-rgt-out68.8%
+-commutative68.8%
Simplified68.8%
if 1150 < x < 1.7499999999999999e260 or 8.00000000000000042e301 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 59.1%
div-sub59.1%
rec-exp59.1%
mul-1-neg59.1%
+-inverses59.1%
Simplified59.1%
Final simplification66.3%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= x 1.0) (/ (+ 2.0 (* x -2.0)) 2.0) 0.0))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 1.0) {
tmp = (2.0 + (x * -2.0)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
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 = (2.0d0 + (x * (-2.0d0))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 1.0) {
tmp = (2.0 + (x * -2.0)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 1.0: tmp = (2.0 + (x * -2.0)) / 2.0 else: tmp = 0.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 1.0) tmp = Float64(Float64(2.0 + Float64(x * -2.0)) / 2.0); else tmp = 0.0; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 1.0) tmp = (2.0 + (x * -2.0)) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 1.0], N[(N[(2.0 + N[(x * -2.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{2 + x \cdot -2}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1Initial program 68.2%
div-sub68.2%
+-rgt-identity68.2%
div-sub68.2%
Simplified68.2%
Taylor expanded in eps around inf 97.9%
mul-1-neg97.9%
*-commutative97.9%
mul-1-neg97.9%
exp-prod97.9%
+-commutative97.9%
*-lft-identity97.9%
metadata-eval97.9%
cancel-sign-sub-inv97.9%
exp-prod97.9%
mul-1-neg97.9%
*-commutative97.9%
cancel-sign-sub-inv97.9%
metadata-eval97.9%
*-lft-identity97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in eps around 0 84.5%
Taylor expanded in eps around 0 76.4%
exp-neg76.4%
associate-*r/76.4%
metadata-eval76.4%
Simplified76.4%
Taylor expanded in x around 0 56.0%
*-commutative56.0%
Simplified56.0%
if 1 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.4%
div-sub53.4%
rec-exp53.4%
mul-1-neg53.4%
+-inverses53.4%
Simplified53.4%
Final simplification55.2%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= x 1150.0) 1.0 0.0))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 1150.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 1150.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 1150.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 1150.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 1150.0) tmp = 1.0; else tmp = 0.0; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 1150.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 1150.0], 1.0, 0.0]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1150:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1150Initial program 68.4%
div-sub68.4%
+-rgt-identity68.4%
div-sub68.4%
Simplified68.4%
Taylor expanded in x around 0 55.2%
if 1150 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 54.1%
div-sub54.1%
rec-exp54.1%
mul-1-neg54.1%
+-inverses54.1%
Simplified54.1%
Final simplification54.8%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 0.0)
eps = abs(eps);
double code(double x, double eps) {
return 0.0;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 0.0d0
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
return 0.0;
}
eps = abs(eps) def code(x, eps): return 0.0
eps = abs(eps) function code(x, eps) return 0.0 end
eps = abs(eps) function tmp = code(x, eps) tmp = 0.0; end
NOTE: eps should be positive before calling this function code[x_, eps_] := 0.0
\begin{array}{l}
eps = |eps|\\
\\
0
\end{array}
Initial program 77.6%
Simplified64.1%
Taylor expanded in eps around 0 17.3%
div-sub17.3%
rec-exp17.3%
mul-1-neg17.3%
+-inverses17.5%
Simplified17.5%
Final simplification17.5%
herbie shell --seed 2023250
(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))