
(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}
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= eps 4e-81) (/ (/ (fma x 2.0 2.0) (exp x)) 2.0) (/ (+ (exp (* x (+ -1.0 eps))) (exp (* x (- eps)))) 2.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (eps <= 4e-81) {
tmp = (fma(x, 2.0, 2.0) / exp(x)) / 2.0;
} else {
tmp = (exp((x * (-1.0 + eps))) + exp((x * -eps))) / 2.0;
}
return tmp;
}
eps = abs(eps) function code(x, eps) tmp = 0.0 if (eps <= 4e-81) tmp = Float64(Float64(fma(x, 2.0, 2.0) / exp(x)) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + eps))) + exp(Float64(x * Float64(-eps)))) / 2.0); end return tmp end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[eps, 4e-81], N[(N[(N[(x * 2.0 + 2.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 4 \cdot 10^{-81}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x, 2, 2\right)}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + \varepsilon\right)} + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\end{array}
\end{array}
if eps < 3.9999999999999998e-81Initial program 64.5%
Simplified64.5%
Taylor expanded in eps around 0 68.1%
associate--r+68.1%
associate-*r*68.1%
mul-1-neg68.1%
cancel-sign-sub68.1%
distribute-rgt1-in68.1%
distribute-rgt-out--68.1%
mul-1-neg68.1%
mul-1-neg68.1%
Simplified68.1%
Taylor expanded in x around inf 68.1%
associate-*r*68.1%
distribute-rgt-out68.1%
Simplified68.1%
*-commutative68.1%
exp-neg68.1%
un-div-inv68.1%
+-commutative68.1%
*-commutative68.1%
fma-def68.1%
Applied egg-rr68.1%
if 3.9999999999999998e-81 < eps Initial program 94.9%
Simplified94.9%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
*-commutative100.0%
sub-neg100.0%
mul-1-neg100.0%
*-commutative100.0%
associate-*r*100.0%
mul-1-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
mul-1-neg100.0%
associate-*r*100.0%
mul-1-neg100.0%
Simplified100.0%
Final simplification77.6%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (/ (+ (exp (* x (+ -1.0 eps))) (exp (* x (- -1.0 eps)))) 2.0))
eps = abs(eps);
double code(double x, double eps) {
return (exp((x * (-1.0 + eps))) + 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 * ((-1.0d0) + eps))) + 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 * (-1.0 + eps))) + Math.exp((x * (-1.0 - eps)))) / 2.0;
}
eps = abs(eps) def code(x, eps): return (math.exp((x * (-1.0 + eps))) + math.exp((x * (-1.0 - eps)))) / 2.0
eps = abs(eps) function code(x, eps) return Float64(Float64(exp(Float64(x * Float64(-1.0 + eps))) + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0) end
eps = abs(eps) function tmp = code(x, eps) tmp = (exp((x * (-1.0 + eps))) + 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[(-1.0 + eps), $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(-1 + \varepsilon\right)} + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}
\end{array}
Initial program 73.5%
Simplified73.5%
Taylor expanded in eps around inf 99.7%
Final simplification99.7%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= eps 1.0) (/ (/ (fma x 2.0 2.0) (exp x)) 2.0) (/ (+ (exp (* x eps)) (exp (- x))) 2.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (eps <= 1.0) {
tmp = (fma(x, 2.0, 2.0) / exp(x)) / 2.0;
} else {
tmp = (exp((x * eps)) + exp(-x)) / 2.0;
}
return tmp;
}
eps = abs(eps) function code(x, eps) tmp = 0.0 if (eps <= 1.0) tmp = Float64(Float64(fma(x, 2.0, 2.0) / exp(x)) / 2.0); else tmp = Float64(Float64(exp(Float64(x * eps)) + exp(Float64(-x))) / 2.0); end return tmp end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[eps, 1.0], N[(N[(N[(x * 2.0 + 2.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 1:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x, 2, 2\right)}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon} + e^{-x}}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 64.9%
Simplified64.9%
Taylor expanded in eps around 0 70.3%
associate--r+70.2%
associate-*r*70.2%
mul-1-neg70.2%
cancel-sign-sub70.2%
distribute-rgt1-in70.2%
distribute-rgt-out--70.2%
mul-1-neg70.2%
mul-1-neg70.2%
Simplified70.2%
Taylor expanded in x around inf 70.3%
associate-*r*70.3%
distribute-rgt-out70.2%
Simplified70.2%
*-commutative70.2%
exp-neg70.2%
un-div-inv70.3%
+-commutative70.3%
*-commutative70.3%
fma-def70.3%
Applied egg-rr70.3%
if 1 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 93.2%
Taylor expanded in eps around inf 93.2%
mul-1-neg93.2%
distribute-lft-neg-out93.2%
*-commutative93.2%
Simplified93.2%
Final simplification75.9%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ -1.0 (/ -1.0 eps))) (t_1 (+ (- -1.0 eps) t_0)))
(if (<= eps 1.0)
(/ (/ (fma x 2.0 2.0) (exp x)) 2.0)
(if (<= eps 3.2e+139)
(/ (+ (exp (- x)) 1.0) 2.0)
(if (<= eps 2.15e+279)
(/
(+ 2.0 (/ (* x (pow (+ eps (* (- 1.0 eps) t_0)) 2.0)) (* eps 2.0)))
2.0)
(if (<= eps 1.22e+294)
(/ (+ 2.0 (* x (+ eps (/ (* (- (/ 1.0 eps) eps) t_1) t_1)))) 2.0)
(/ (+ 2.0 (* 2.0 (* x eps))) 2.0)))))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = -1.0 + (-1.0 / eps);
double t_1 = (-1.0 - eps) + t_0;
double tmp;
if (eps <= 1.0) {
tmp = (fma(x, 2.0, 2.0) / exp(x)) / 2.0;
} else if (eps <= 3.2e+139) {
tmp = (exp(-x) + 1.0) / 2.0;
} else if (eps <= 2.15e+279) {
tmp = (2.0 + ((x * pow((eps + ((1.0 - eps) * t_0)), 2.0)) / (eps * 2.0))) / 2.0;
} else if (eps <= 1.22e+294) {
tmp = (2.0 + (x * (eps + ((((1.0 / eps) - eps) * t_1) / t_1)))) / 2.0;
} else {
tmp = (2.0 + (2.0 * (x * eps))) / 2.0;
}
return tmp;
}
eps = abs(eps) function code(x, eps) t_0 = Float64(-1.0 + Float64(-1.0 / eps)) t_1 = Float64(Float64(-1.0 - eps) + t_0) tmp = 0.0 if (eps <= 1.0) tmp = Float64(Float64(fma(x, 2.0, 2.0) / exp(x)) / 2.0); elseif (eps <= 3.2e+139) tmp = Float64(Float64(exp(Float64(-x)) + 1.0) / 2.0); elseif (eps <= 2.15e+279) tmp = Float64(Float64(2.0 + Float64(Float64(x * (Float64(eps + Float64(Float64(1.0 - eps) * t_0)) ^ 2.0)) / Float64(eps * 2.0))) / 2.0); elseif (eps <= 1.22e+294) tmp = Float64(Float64(2.0 + Float64(x * Float64(eps + Float64(Float64(Float64(Float64(1.0 / eps) - eps) * t_1) / t_1)))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(2.0 * Float64(x * eps))) / 2.0); end return tmp end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[(-1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(-1.0 - eps), $MachinePrecision] + t$95$0), $MachinePrecision]}, If[LessEqual[eps, 1.0], N[(N[(N[(x * 2.0 + 2.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 3.2e+139], N[(N[(N[Exp[(-x)], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 2.15e+279], N[(N[(2.0 + N[(N[(x * N[Power[N[(eps + N[(N[(1.0 - eps), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(eps * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 1.22e+294], N[(N[(2.0 + N[(x * N[(eps + N[(N[(N[(N[(1.0 / eps), $MachinePrecision] - eps), $MachinePrecision] * t$95$1), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(2.0 * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := -1 + \frac{-1}{\varepsilon}\\
t_1 := \left(-1 - \varepsilon\right) + t_0\\
\mathbf{if}\;\varepsilon \leq 1:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x, 2, 2\right)}{e^{x}}}{2}\\
\mathbf{elif}\;\varepsilon \leq 3.2 \cdot 10^{+139}:\\
\;\;\;\;\frac{e^{-x} + 1}{2}\\
\mathbf{elif}\;\varepsilon \leq 2.15 \cdot 10^{+279}:\\
\;\;\;\;\frac{2 + \frac{x \cdot {\left(\varepsilon + \left(1 - \varepsilon\right) \cdot t_0\right)}^{2}}{\varepsilon \cdot 2}}{2}\\
\mathbf{elif}\;\varepsilon \leq 1.22 \cdot 10^{+294}:\\
\;\;\;\;\frac{2 + x \cdot \left(\varepsilon + \frac{\left(\frac{1}{\varepsilon} - \varepsilon\right) \cdot t_1}{t_1}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + 2 \cdot \left(x \cdot \varepsilon\right)}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 64.9%
Simplified64.9%
Taylor expanded in eps around 0 70.3%
associate--r+70.2%
associate-*r*70.2%
mul-1-neg70.2%
cancel-sign-sub70.2%
distribute-rgt1-in70.2%
distribute-rgt-out--70.2%
mul-1-neg70.2%
mul-1-neg70.2%
Simplified70.2%
Taylor expanded in x around inf 70.3%
associate-*r*70.3%
distribute-rgt-out70.2%
Simplified70.2%
*-commutative70.2%
exp-neg70.2%
un-div-inv70.3%
+-commutative70.3%
*-commutative70.3%
fma-def70.3%
Applied egg-rr70.3%
if 1 < eps < 3.2000000000000001e139Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 72.2%
mul-1-neg72.2%
Simplified72.2%
if 3.2000000000000001e139 < eps < 2.1499999999999999e279Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 20.7%
associate-*r*20.7%
neg-mul-120.7%
distribute-neg-in20.7%
metadata-eval20.7%
sub-neg20.7%
mul-1-neg20.7%
+-commutative20.7%
sub-neg20.7%
metadata-eval20.7%
+-commutative20.7%
Simplified20.7%
Taylor expanded in eps around inf 20.7%
Applied egg-rr77.6%
Taylor expanded in eps around inf 77.6%
if 2.1499999999999999e279 < eps < 1.2199999999999999e294Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.1%
associate-*r*3.1%
neg-mul-13.1%
distribute-neg-in3.1%
metadata-eval3.1%
sub-neg3.1%
mul-1-neg3.1%
+-commutative3.1%
sub-neg3.1%
metadata-eval3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in eps around inf 3.1%
distribute-lft-in3.1%
flip-+75.0%
+-commutative75.0%
+-commutative75.0%
un-div-inv75.0%
+-commutative75.0%
un-div-inv75.0%
+-commutative75.0%
+-commutative75.0%
un-div-inv75.0%
+-commutative75.0%
Applied egg-rr75.0%
Simplified75.0%
if 1.2199999999999999e294 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.1%
associate-*r*3.1%
neg-mul-13.1%
distribute-neg-in3.1%
metadata-eval3.1%
sub-neg3.1%
mul-1-neg3.1%
+-commutative3.1%
sub-neg3.1%
metadata-eval3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in eps around inf 3.1%
Applied egg-rr100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification71.5%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (- x)))
(t_1 (+ -1.0 (/ -1.0 eps)))
(t_2 (+ (- -1.0 eps) t_1)))
(if (<= eps 1.0)
(/ (* t_0 (+ 2.0 (* x 2.0))) 2.0)
(if (<= eps 3.4e+139)
(/ (+ t_0 1.0) 2.0)
(if (<= eps 2.15e+279)
(/
(+ 2.0 (/ (* x (pow (+ eps (* (- 1.0 eps) t_1)) 2.0)) (* eps 2.0)))
2.0)
(if (<= eps 2.9e+293)
(/ (+ 2.0 (* x (+ eps (/ (* (- (/ 1.0 eps) eps) t_2) t_2)))) 2.0)
(/ (+ 2.0 (* 2.0 (* x eps))) 2.0)))))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = exp(-x);
double t_1 = -1.0 + (-1.0 / eps);
double t_2 = (-1.0 - eps) + t_1;
double tmp;
if (eps <= 1.0) {
tmp = (t_0 * (2.0 + (x * 2.0))) / 2.0;
} else if (eps <= 3.4e+139) {
tmp = (t_0 + 1.0) / 2.0;
} else if (eps <= 2.15e+279) {
tmp = (2.0 + ((x * pow((eps + ((1.0 - eps) * t_1)), 2.0)) / (eps * 2.0))) / 2.0;
} else if (eps <= 2.9e+293) {
tmp = (2.0 + (x * (eps + ((((1.0 / eps) - eps) * t_2) / t_2)))) / 2.0;
} else {
tmp = (2.0 + (2.0 * (x * eps))) / 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = exp(-x)
t_1 = (-1.0d0) + ((-1.0d0) / eps)
t_2 = ((-1.0d0) - eps) + t_1
if (eps <= 1.0d0) then
tmp = (t_0 * (2.0d0 + (x * 2.0d0))) / 2.0d0
else if (eps <= 3.4d+139) then
tmp = (t_0 + 1.0d0) / 2.0d0
else if (eps <= 2.15d+279) then
tmp = (2.0d0 + ((x * ((eps + ((1.0d0 - eps) * t_1)) ** 2.0d0)) / (eps * 2.0d0))) / 2.0d0
else if (eps <= 2.9d+293) then
tmp = (2.0d0 + (x * (eps + ((((1.0d0 / eps) - eps) * t_2) / t_2)))) / 2.0d0
else
tmp = (2.0d0 + (2.0d0 * (x * eps))) / 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 t_1 = -1.0 + (-1.0 / eps);
double t_2 = (-1.0 - eps) + t_1;
double tmp;
if (eps <= 1.0) {
tmp = (t_0 * (2.0 + (x * 2.0))) / 2.0;
} else if (eps <= 3.4e+139) {
tmp = (t_0 + 1.0) / 2.0;
} else if (eps <= 2.15e+279) {
tmp = (2.0 + ((x * Math.pow((eps + ((1.0 - eps) * t_1)), 2.0)) / (eps * 2.0))) / 2.0;
} else if (eps <= 2.9e+293) {
tmp = (2.0 + (x * (eps + ((((1.0 / eps) - eps) * t_2) / t_2)))) / 2.0;
} else {
tmp = (2.0 + (2.0 * (x * eps))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = math.exp(-x) t_1 = -1.0 + (-1.0 / eps) t_2 = (-1.0 - eps) + t_1 tmp = 0 if eps <= 1.0: tmp = (t_0 * (2.0 + (x * 2.0))) / 2.0 elif eps <= 3.4e+139: tmp = (t_0 + 1.0) / 2.0 elif eps <= 2.15e+279: tmp = (2.0 + ((x * math.pow((eps + ((1.0 - eps) * t_1)), 2.0)) / (eps * 2.0))) / 2.0 elif eps <= 2.9e+293: tmp = (2.0 + (x * (eps + ((((1.0 / eps) - eps) * t_2) / t_2)))) / 2.0 else: tmp = (2.0 + (2.0 * (x * eps))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = exp(Float64(-x)) t_1 = Float64(-1.0 + Float64(-1.0 / eps)) t_2 = Float64(Float64(-1.0 - eps) + t_1) tmp = 0.0 if (eps <= 1.0) tmp = Float64(Float64(t_0 * Float64(2.0 + Float64(x * 2.0))) / 2.0); elseif (eps <= 3.4e+139) tmp = Float64(Float64(t_0 + 1.0) / 2.0); elseif (eps <= 2.15e+279) tmp = Float64(Float64(2.0 + Float64(Float64(x * (Float64(eps + Float64(Float64(1.0 - eps) * t_1)) ^ 2.0)) / Float64(eps * 2.0))) / 2.0); elseif (eps <= 2.9e+293) tmp = Float64(Float64(2.0 + Float64(x * Float64(eps + Float64(Float64(Float64(Float64(1.0 / eps) - eps) * t_2) / t_2)))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(2.0 * Float64(x * eps))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = exp(-x); t_1 = -1.0 + (-1.0 / eps); t_2 = (-1.0 - eps) + t_1; tmp = 0.0; if (eps <= 1.0) tmp = (t_0 * (2.0 + (x * 2.0))) / 2.0; elseif (eps <= 3.4e+139) tmp = (t_0 + 1.0) / 2.0; elseif (eps <= 2.15e+279) tmp = (2.0 + ((x * ((eps + ((1.0 - eps) * t_1)) ^ 2.0)) / (eps * 2.0))) / 2.0; elseif (eps <= 2.9e+293) tmp = (2.0 + (x * (eps + ((((1.0 / eps) - eps) * t_2) / t_2)))) / 2.0; else tmp = (2.0 + (2.0 * (x * eps))) / 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]}, Block[{t$95$1 = N[(-1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(-1.0 - eps), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[LessEqual[eps, 1.0], N[(N[(t$95$0 * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 3.4e+139], N[(N[(t$95$0 + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 2.15e+279], N[(N[(2.0 + N[(N[(x * N[Power[N[(eps + N[(N[(1.0 - eps), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(eps * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 2.9e+293], N[(N[(2.0 + N[(x * N[(eps + N[(N[(N[(N[(1.0 / eps), $MachinePrecision] - eps), $MachinePrecision] * t$95$2), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(2.0 * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := e^{-x}\\
t_1 := -1 + \frac{-1}{\varepsilon}\\
t_2 := \left(-1 - \varepsilon\right) + t_1\\
\mathbf{if}\;\varepsilon \leq 1:\\
\;\;\;\;\frac{t_0 \cdot \left(2 + x \cdot 2\right)}{2}\\
\mathbf{elif}\;\varepsilon \leq 3.4 \cdot 10^{+139}:\\
\;\;\;\;\frac{t_0 + 1}{2}\\
\mathbf{elif}\;\varepsilon \leq 2.15 \cdot 10^{+279}:\\
\;\;\;\;\frac{2 + \frac{x \cdot {\left(\varepsilon + \left(1 - \varepsilon\right) \cdot t_1\right)}^{2}}{\varepsilon \cdot 2}}{2}\\
\mathbf{elif}\;\varepsilon \leq 2.9 \cdot 10^{+293}:\\
\;\;\;\;\frac{2 + x \cdot \left(\varepsilon + \frac{\left(\frac{1}{\varepsilon} - \varepsilon\right) \cdot t_2}{t_2}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + 2 \cdot \left(x \cdot \varepsilon\right)}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 64.9%
Simplified64.9%
Taylor expanded in eps around 0 70.3%
associate--r+70.2%
associate-*r*70.2%
mul-1-neg70.2%
cancel-sign-sub70.2%
distribute-rgt1-in70.2%
distribute-rgt-out--70.2%
mul-1-neg70.2%
mul-1-neg70.2%
Simplified70.2%
Taylor expanded in x around inf 70.3%
associate-*r*70.3%
distribute-rgt-out70.2%
Simplified70.2%
if 1 < eps < 3.4000000000000002e139Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 72.2%
mul-1-neg72.2%
Simplified72.2%
if 3.4000000000000002e139 < eps < 2.1499999999999999e279Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 20.7%
associate-*r*20.7%
neg-mul-120.7%
distribute-neg-in20.7%
metadata-eval20.7%
sub-neg20.7%
mul-1-neg20.7%
+-commutative20.7%
sub-neg20.7%
metadata-eval20.7%
+-commutative20.7%
Simplified20.7%
Taylor expanded in eps around inf 20.7%
Applied egg-rr77.6%
Taylor expanded in eps around inf 77.6%
if 2.1499999999999999e279 < eps < 2.89999999999999999e293Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.1%
associate-*r*3.1%
neg-mul-13.1%
distribute-neg-in3.1%
metadata-eval3.1%
sub-neg3.1%
mul-1-neg3.1%
+-commutative3.1%
sub-neg3.1%
metadata-eval3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in eps around inf 3.1%
distribute-lft-in3.1%
flip-+75.0%
+-commutative75.0%
+-commutative75.0%
un-div-inv75.0%
+-commutative75.0%
un-div-inv75.0%
+-commutative75.0%
+-commutative75.0%
un-div-inv75.0%
+-commutative75.0%
Applied egg-rr75.0%
Simplified75.0%
if 2.89999999999999999e293 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.1%
associate-*r*3.1%
neg-mul-13.1%
distribute-neg-in3.1%
metadata-eval3.1%
sub-neg3.1%
mul-1-neg3.1%
+-commutative3.1%
sub-neg3.1%
metadata-eval3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in eps around inf 3.1%
Applied egg-rr100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification71.5%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(if (<= x 11500.0)
(/ (+ (exp (- x)) 1.0) 2.0)
(if (or (<= x 4e+67) (and (not (<= x 5e+90)) (<= x 3.6e+205)))
(/ (* (exp x) (+ 2.0 (+ x x))) 2.0)
(/ (/ (* x 2.0) (exp x)) 2.0))))eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 11500.0) {
tmp = (exp(-x) + 1.0) / 2.0;
} else if ((x <= 4e+67) || (!(x <= 5e+90) && (x <= 3.6e+205))) {
tmp = (exp(x) * (2.0 + (x + x))) / 2.0;
} else {
tmp = ((x * 2.0) / 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 <= 11500.0d0) then
tmp = (exp(-x) + 1.0d0) / 2.0d0
else if ((x <= 4d+67) .or. (.not. (x <= 5d+90)) .and. (x <= 3.6d+205)) then
tmp = (exp(x) * (2.0d0 + (x + x))) / 2.0d0
else
tmp = ((x * 2.0d0) / 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 <= 11500.0) {
tmp = (Math.exp(-x) + 1.0) / 2.0;
} else if ((x <= 4e+67) || (!(x <= 5e+90) && (x <= 3.6e+205))) {
tmp = (Math.exp(x) * (2.0 + (x + x))) / 2.0;
} else {
tmp = ((x * 2.0) / Math.exp(x)) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 11500.0: tmp = (math.exp(-x) + 1.0) / 2.0 elif (x <= 4e+67) or (not (x <= 5e+90) and (x <= 3.6e+205)): tmp = (math.exp(x) * (2.0 + (x + x))) / 2.0 else: tmp = ((x * 2.0) / math.exp(x)) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 11500.0) tmp = Float64(Float64(exp(Float64(-x)) + 1.0) / 2.0); elseif ((x <= 4e+67) || (!(x <= 5e+90) && (x <= 3.6e+205))) tmp = Float64(Float64(exp(x) * Float64(2.0 + Float64(x + x))) / 2.0); else tmp = Float64(Float64(Float64(x * 2.0) / exp(x)) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 11500.0) tmp = (exp(-x) + 1.0) / 2.0; elseif ((x <= 4e+67) || (~((x <= 5e+90)) && (x <= 3.6e+205))) tmp = (exp(x) * (2.0 + (x + x))) / 2.0; else tmp = ((x * 2.0) / exp(x)) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 11500.0], N[(N[(N[Exp[(-x)], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 4e+67], And[N[Not[LessEqual[x, 5e+90]], $MachinePrecision], LessEqual[x, 3.6e+205]]], N[(N[(N[Exp[x], $MachinePrecision] * N[(2.0 + N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 11500:\\
\;\;\;\;\frac{e^{-x} + 1}{2}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+67} \lor \neg \left(x \leq 5 \cdot 10^{+90}\right) \land x \leq 3.6 \cdot 10^{+205}:\\
\;\;\;\;\frac{e^{x} \cdot \left(2 + \left(x + x\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot 2}{e^{x}}}{2}\\
\end{array}
\end{array}
if x < 11500Initial program 61.0%
Simplified61.0%
Taylor expanded in eps around inf 99.5%
Taylor expanded in eps around inf 99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in eps around 0 80.9%
mul-1-neg80.9%
Simplified80.9%
if 11500 < x < 3.99999999999999993e67 or 5.0000000000000004e90 < x < 3.60000000000000002e205Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 35.8%
associate--r+35.8%
associate-*r*35.8%
mul-1-neg35.8%
cancel-sign-sub35.8%
distribute-rgt1-in35.8%
distribute-rgt-out--35.8%
mul-1-neg35.8%
mul-1-neg35.8%
Simplified35.8%
expm1-log1p-u35.8%
expm1-udef35.8%
Applied egg-rr65.8%
expm1-def65.8%
expm1-log1p65.8%
+-commutative65.8%
associate-+r+65.8%
Simplified65.8%
if 3.99999999999999993e67 < x < 5.0000000000000004e90 or 3.60000000000000002e205 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 67.2%
associate--r+67.2%
associate-*r*67.2%
mul-1-neg67.2%
cancel-sign-sub67.2%
distribute-rgt1-in67.2%
distribute-rgt-out--67.2%
mul-1-neg67.2%
mul-1-neg67.2%
Simplified67.2%
Taylor expanded in x around inf 67.2%
*-commutative67.2%
associate-*l*67.2%
*-commutative67.2%
Simplified67.2%
associate-*r*67.2%
*-commutative67.2%
exp-neg67.2%
un-div-inv67.2%
*-commutative67.2%
Applied egg-rr67.2%
Final simplification76.3%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(if (<= x 11500.0)
(/ (+ (exp (- x)) 1.0) 2.0)
(if (or (<= x 1.8e+65) (and (not (<= x 5e+90)) (<= x 5e+204)))
(/ (* (exp x) (* x 2.0)) 2.0)
(/ (/ (* x 2.0) (exp x)) 2.0))))eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 11500.0) {
tmp = (exp(-x) + 1.0) / 2.0;
} else if ((x <= 1.8e+65) || (!(x <= 5e+90) && (x <= 5e+204))) {
tmp = (exp(x) * (x * 2.0)) / 2.0;
} else {
tmp = ((x * 2.0) / 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 <= 11500.0d0) then
tmp = (exp(-x) + 1.0d0) / 2.0d0
else if ((x <= 1.8d+65) .or. (.not. (x <= 5d+90)) .and. (x <= 5d+204)) then
tmp = (exp(x) * (x * 2.0d0)) / 2.0d0
else
tmp = ((x * 2.0d0) / 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 <= 11500.0) {
tmp = (Math.exp(-x) + 1.0) / 2.0;
} else if ((x <= 1.8e+65) || (!(x <= 5e+90) && (x <= 5e+204))) {
tmp = (Math.exp(x) * (x * 2.0)) / 2.0;
} else {
tmp = ((x * 2.0) / Math.exp(x)) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 11500.0: tmp = (math.exp(-x) + 1.0) / 2.0 elif (x <= 1.8e+65) or (not (x <= 5e+90) and (x <= 5e+204)): tmp = (math.exp(x) * (x * 2.0)) / 2.0 else: tmp = ((x * 2.0) / math.exp(x)) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 11500.0) tmp = Float64(Float64(exp(Float64(-x)) + 1.0) / 2.0); elseif ((x <= 1.8e+65) || (!(x <= 5e+90) && (x <= 5e+204))) tmp = Float64(Float64(exp(x) * Float64(x * 2.0)) / 2.0); else tmp = Float64(Float64(Float64(x * 2.0) / exp(x)) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 11500.0) tmp = (exp(-x) + 1.0) / 2.0; elseif ((x <= 1.8e+65) || (~((x <= 5e+90)) && (x <= 5e+204))) tmp = (exp(x) * (x * 2.0)) / 2.0; else tmp = ((x * 2.0) / exp(x)) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 11500.0], N[(N[(N[Exp[(-x)], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.8e+65], And[N[Not[LessEqual[x, 5e+90]], $MachinePrecision], LessEqual[x, 5e+204]]], N[(N[(N[Exp[x], $MachinePrecision] * N[(x * 2.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 11500:\\
\;\;\;\;\frac{e^{-x} + 1}{2}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{+65} \lor \neg \left(x \leq 5 \cdot 10^{+90}\right) \land x \leq 5 \cdot 10^{+204}:\\
\;\;\;\;\frac{e^{x} \cdot \left(x \cdot 2\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot 2}{e^{x}}}{2}\\
\end{array}
\end{array}
if x < 11500Initial program 61.0%
Simplified61.0%
Taylor expanded in eps around inf 99.5%
Taylor expanded in eps around inf 99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in eps around 0 80.9%
mul-1-neg80.9%
Simplified80.9%
if 11500 < x < 1.79999999999999989e65 or 5.0000000000000004e90 < x < 5.00000000000000008e204Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 35.8%
associate--r+35.8%
associate-*r*35.8%
mul-1-neg35.8%
cancel-sign-sub35.8%
distribute-rgt1-in35.8%
distribute-rgt-out--35.8%
mul-1-neg35.8%
mul-1-neg35.8%
Simplified35.8%
Taylor expanded in x around inf 35.8%
*-commutative35.8%
associate-*l*35.8%
*-commutative35.8%
Simplified35.8%
expm1-log1p-u35.8%
expm1-udef35.8%
associate-*r*35.8%
*-commutative35.8%
associate-*l*35.8%
add-sqr-sqrt0.0%
sqrt-unprod65.8%
sqr-neg65.8%
sqrt-unprod65.8%
add-sqr-sqrt65.8%
Applied egg-rr65.8%
expm1-def65.8%
expm1-log1p65.8%
associate-*r*65.8%
*-commutative65.8%
Simplified65.8%
if 1.79999999999999989e65 < x < 5.0000000000000004e90 or 5.00000000000000008e204 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 67.2%
associate--r+67.2%
associate-*r*67.2%
mul-1-neg67.2%
cancel-sign-sub67.2%
distribute-rgt1-in67.2%
distribute-rgt-out--67.2%
mul-1-neg67.2%
mul-1-neg67.2%
Simplified67.2%
Taylor expanded in x around inf 67.2%
*-commutative67.2%
associate-*l*67.2%
*-commutative67.2%
Simplified67.2%
associate-*r*67.2%
*-commutative67.2%
exp-neg67.2%
un-div-inv67.2%
*-commutative67.2%
Applied egg-rr67.2%
Final simplification76.3%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (- -1.0 eps) (+ -1.0 (/ -1.0 eps)))))
(if (<= eps 1.0)
(/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0)
(if (<= eps 5e+277)
(/ (* (exp x) (+ 2.0 (+ x x))) 2.0)
(if (<= eps 1.1e+295)
(/ (+ 2.0 (* x (+ eps (/ (* (- (/ 1.0 eps) eps) t_0) t_0)))) 2.0)
(/ (+ 2.0 (* 2.0 (* x eps))) 2.0))))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = (-1.0 - eps) + (-1.0 + (-1.0 / eps));
double tmp;
if (eps <= 1.0) {
tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else if (eps <= 5e+277) {
tmp = (exp(x) * (2.0 + (x + x))) / 2.0;
} else if (eps <= 1.1e+295) {
tmp = (2.0 + (x * (eps + ((((1.0 / eps) - eps) * t_0) / t_0)))) / 2.0;
} else {
tmp = (2.0 + (2.0 * (x * eps))) / 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 = ((-1.0d0) - eps) + ((-1.0d0) + ((-1.0d0) / eps))
if (eps <= 1.0d0) then
tmp = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
else if (eps <= 5d+277) then
tmp = (exp(x) * (2.0d0 + (x + x))) / 2.0d0
else if (eps <= 1.1d+295) then
tmp = (2.0d0 + (x * (eps + ((((1.0d0 / eps) - eps) * t_0) / t_0)))) / 2.0d0
else
tmp = (2.0d0 + (2.0d0 * (x * eps))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = (-1.0 - eps) + (-1.0 + (-1.0 / eps));
double tmp;
if (eps <= 1.0) {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else if (eps <= 5e+277) {
tmp = (Math.exp(x) * (2.0 + (x + x))) / 2.0;
} else if (eps <= 1.1e+295) {
tmp = (2.0 + (x * (eps + ((((1.0 / eps) - eps) * t_0) / t_0)))) / 2.0;
} else {
tmp = (2.0 + (2.0 * (x * eps))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = (-1.0 - eps) + (-1.0 + (-1.0 / eps)) tmp = 0 if eps <= 1.0: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 elif eps <= 5e+277: tmp = (math.exp(x) * (2.0 + (x + x))) / 2.0 elif eps <= 1.1e+295: tmp = (2.0 + (x * (eps + ((((1.0 / eps) - eps) * t_0) / t_0)))) / 2.0 else: tmp = (2.0 + (2.0 * (x * eps))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = Float64(Float64(-1.0 - eps) + Float64(-1.0 + Float64(-1.0 / eps))) tmp = 0.0 if (eps <= 1.0) tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); elseif (eps <= 5e+277) tmp = Float64(Float64(exp(x) * Float64(2.0 + Float64(x + x))) / 2.0); elseif (eps <= 1.1e+295) tmp = Float64(Float64(2.0 + Float64(x * Float64(eps + Float64(Float64(Float64(Float64(1.0 / eps) - eps) * t_0) / t_0)))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(2.0 * Float64(x * eps))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = (-1.0 - eps) + (-1.0 + (-1.0 / eps)); tmp = 0.0; if (eps <= 1.0) tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; elseif (eps <= 5e+277) tmp = (exp(x) * (2.0 + (x + x))) / 2.0; elseif (eps <= 1.1e+295) tmp = (2.0 + (x * (eps + ((((1.0 / eps) - eps) * t_0) / t_0)))) / 2.0; else tmp = (2.0 + (2.0 * (x * eps))) / 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[(-1.0 - eps), $MachinePrecision] + N[(-1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, 1.0], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 5e+277], N[(N[(N[Exp[x], $MachinePrecision] * N[(2.0 + N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 1.1e+295], N[(N[(2.0 + N[(x * N[(eps + N[(N[(N[(N[(1.0 / eps), $MachinePrecision] - eps), $MachinePrecision] * t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(2.0 * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := \left(-1 - \varepsilon\right) + \left(-1 + \frac{-1}{\varepsilon}\right)\\
\mathbf{if}\;\varepsilon \leq 1:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\mathbf{elif}\;\varepsilon \leq 5 \cdot 10^{+277}:\\
\;\;\;\;\frac{e^{x} \cdot \left(2 + \left(x + x\right)\right)}{2}\\
\mathbf{elif}\;\varepsilon \leq 1.1 \cdot 10^{+295}:\\
\;\;\;\;\frac{2 + x \cdot \left(\varepsilon + \frac{\left(\frac{1}{\varepsilon} - \varepsilon\right) \cdot t_0}{t_0}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + 2 \cdot \left(x \cdot \varepsilon\right)}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 64.9%
Simplified64.9%
Taylor expanded in eps around 0 70.3%
associate--r+70.2%
associate-*r*70.2%
mul-1-neg70.2%
cancel-sign-sub70.2%
distribute-rgt1-in70.2%
distribute-rgt-out--70.2%
mul-1-neg70.2%
mul-1-neg70.2%
Simplified70.2%
Taylor expanded in x around inf 70.3%
associate-*r*70.3%
distribute-rgt-out70.2%
Simplified70.2%
if 1 < eps < 4.99999999999999982e277Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 37.8%
associate--r+37.8%
associate-*r*37.8%
mul-1-neg37.8%
cancel-sign-sub37.8%
distribute-rgt1-in37.8%
distribute-rgt-out--37.8%
mul-1-neg37.8%
mul-1-neg37.8%
Simplified37.8%
expm1-log1p-u36.9%
expm1-udef36.9%
Applied egg-rr64.8%
expm1-def64.8%
expm1-log1p65.7%
+-commutative65.7%
associate-+r+65.7%
Simplified65.7%
if 4.99999999999999982e277 < eps < 1.0999999999999999e295Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.1%
associate-*r*3.1%
neg-mul-13.1%
distribute-neg-in3.1%
metadata-eval3.1%
sub-neg3.1%
mul-1-neg3.1%
+-commutative3.1%
sub-neg3.1%
metadata-eval3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in eps around inf 3.1%
distribute-lft-in3.1%
flip-+75.0%
+-commutative75.0%
+-commutative75.0%
un-div-inv75.0%
+-commutative75.0%
un-div-inv75.0%
+-commutative75.0%
+-commutative75.0%
un-div-inv75.0%
+-commutative75.0%
Applied egg-rr75.0%
Simplified75.0%
if 1.0999999999999999e295 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.1%
associate-*r*3.1%
neg-mul-13.1%
distribute-neg-in3.1%
metadata-eval3.1%
sub-neg3.1%
mul-1-neg3.1%
+-commutative3.1%
sub-neg3.1%
metadata-eval3.1%
+-commutative3.1%
Simplified3.1%
Taylor expanded in eps around inf 3.1%
Applied egg-rr100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification69.5%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= x 11500.0) (/ (+ (exp (- x)) 1.0) 2.0) (/ (* (exp x) (* x 2.0)) 2.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 11500.0) {
tmp = (exp(-x) + 1.0) / 2.0;
} else {
tmp = (exp(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 (x <= 11500.0d0) then
tmp = (exp(-x) + 1.0d0) / 2.0d0
else
tmp = (exp(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 (x <= 11500.0) {
tmp = (Math.exp(-x) + 1.0) / 2.0;
} else {
tmp = (Math.exp(x) * (x * 2.0)) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 11500.0: tmp = (math.exp(-x) + 1.0) / 2.0 else: tmp = (math.exp(x) * (x * 2.0)) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 11500.0) tmp = Float64(Float64(exp(Float64(-x)) + 1.0) / 2.0); else tmp = Float64(Float64(exp(x) * Float64(x * 2.0)) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 11500.0) tmp = (exp(-x) + 1.0) / 2.0; else tmp = (exp(x) * (x * 2.0)) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 11500.0], N[(N[(N[Exp[(-x)], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[x], $MachinePrecision] * N[(x * 2.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 11500:\\
\;\;\;\;\frac{e^{-x} + 1}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x} \cdot \left(x \cdot 2\right)}{2}\\
\end{array}
\end{array}
if x < 11500Initial program 61.0%
Simplified61.0%
Taylor expanded in eps around inf 99.5%
Taylor expanded in eps around inf 99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in eps around 0 80.9%
mul-1-neg80.9%
Simplified80.9%
if 11500 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 49.6%
associate--r+49.6%
associate-*r*49.6%
mul-1-neg49.6%
cancel-sign-sub49.6%
distribute-rgt1-in49.6%
distribute-rgt-out--49.6%
mul-1-neg49.6%
mul-1-neg49.6%
Simplified49.6%
Taylor expanded in x around inf 49.6%
*-commutative49.6%
associate-*l*49.6%
*-commutative49.6%
Simplified49.6%
expm1-log1p-u49.6%
expm1-udef49.6%
associate-*r*49.6%
*-commutative49.6%
associate-*l*49.6%
add-sqr-sqrt0.0%
sqrt-unprod52.0%
sqr-neg52.0%
sqrt-unprod52.0%
add-sqr-sqrt52.0%
Applied egg-rr52.0%
expm1-def52.0%
expm1-log1p52.0%
associate-*r*52.0%
*-commutative52.0%
Simplified52.0%
Final simplification71.6%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= x 7.9e-140) (/ (+ (exp (- x)) 1.0) 2.0) (/ (+ 2.0 (* x (+ (/ 1.0 eps) (* (+ -1.0 eps) (+ (/ 1.0 eps) 1.0))))) 2.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 7.9e-140) {
tmp = (exp(-x) + 1.0) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 / eps) + ((-1.0 + eps) * ((1.0 / eps) + 1.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 (x <= 7.9d-140) then
tmp = (exp(-x) + 1.0d0) / 2.0d0
else
tmp = (2.0d0 + (x * ((1.0d0 / eps) + (((-1.0d0) + eps) * ((1.0d0 / eps) + 1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 7.9e-140) {
tmp = (Math.exp(-x) + 1.0) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 / eps) + ((-1.0 + eps) * ((1.0 / eps) + 1.0))))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 7.9e-140: tmp = (math.exp(-x) + 1.0) / 2.0 else: tmp = (2.0 + (x * ((1.0 / eps) + ((-1.0 + eps) * ((1.0 / eps) + 1.0))))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 7.9e-140) tmp = Float64(Float64(exp(Float64(-x)) + 1.0) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 / eps) + Float64(Float64(-1.0 + eps) * Float64(Float64(1.0 / eps) + 1.0))))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 7.9e-140) tmp = (exp(-x) + 1.0) / 2.0; else tmp = (2.0 + (x * ((1.0 / eps) + ((-1.0 + eps) * ((1.0 / eps) + 1.0))))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 7.9e-140], N[(N[(N[Exp[(-x)], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(N[(1.0 / eps), $MachinePrecision] + N[(N[(-1.0 + eps), $MachinePrecision] * N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.9 \cdot 10^{-140}:\\
\;\;\;\;\frac{e^{-x} + 1}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{1}{\varepsilon} + \left(-1 + \varepsilon\right) \cdot \left(\frac{1}{\varepsilon} + 1\right)\right)}{2}\\
\end{array}
\end{array}
if x < 7.89999999999999966e-140Initial program 61.9%
Simplified61.9%
Taylor expanded in eps around inf 99.3%
Taylor expanded in eps around inf 99.4%
*-commutative99.4%
Simplified99.4%
Taylor expanded in eps around 0 86.8%
mul-1-neg86.8%
Simplified86.8%
if 7.89999999999999966e-140 < x Initial program 85.0%
Simplified85.0%
Taylor expanded in x around 0 25.6%
associate-*r*25.6%
neg-mul-125.6%
distribute-neg-in25.6%
metadata-eval25.6%
sub-neg25.6%
mul-1-neg25.6%
+-commutative25.6%
sub-neg25.6%
metadata-eval25.6%
+-commutative25.6%
Simplified25.6%
Taylor expanded in eps around 0 32.6%
Final simplification59.5%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= x -2e-279) (/ (- 2.0 (* x eps)) 2.0) (/ (+ 2.0 (* x (+ (/ 1.0 eps) (* (+ -1.0 eps) (+ (/ 1.0 eps) 1.0))))) 2.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= -2e-279) {
tmp = (2.0 - (x * eps)) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 / eps) + ((-1.0 + eps) * ((1.0 / eps) + 1.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 (x <= (-2d-279)) then
tmp = (2.0d0 - (x * eps)) / 2.0d0
else
tmp = (2.0d0 + (x * ((1.0d0 / eps) + (((-1.0d0) + eps) * ((1.0d0 / eps) + 1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= -2e-279) {
tmp = (2.0 - (x * eps)) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 / eps) + ((-1.0 + eps) * ((1.0 / eps) + 1.0))))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= -2e-279: tmp = (2.0 - (x * eps)) / 2.0 else: tmp = (2.0 + (x * ((1.0 / eps) + ((-1.0 + eps) * ((1.0 / eps) + 1.0))))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= -2e-279) tmp = Float64(Float64(2.0 - Float64(x * eps)) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 / eps) + Float64(Float64(-1.0 + eps) * Float64(Float64(1.0 / eps) + 1.0))))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -2e-279) tmp = (2.0 - (x * eps)) / 2.0; else tmp = (2.0 + (x * ((1.0 / eps) + ((-1.0 + eps) * ((1.0 / eps) + 1.0))))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, -2e-279], N[(N[(2.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(N[(1.0 / eps), $MachinePrecision] + N[(N[(-1.0 + eps), $MachinePrecision] * N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-279}:\\
\;\;\;\;\frac{2 - x \cdot \varepsilon}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{1}{\varepsilon} + \left(-1 + \varepsilon\right) \cdot \left(\frac{1}{\varepsilon} + 1\right)\right)}{2}\\
\end{array}
\end{array}
if x < -2.00000000000000011e-279Initial program 65.3%
Simplified65.3%
Taylor expanded in x around 0 54.3%
associate-*r*54.3%
neg-mul-154.3%
distribute-neg-in54.3%
metadata-eval54.3%
sub-neg54.3%
mul-1-neg54.3%
+-commutative54.3%
sub-neg54.3%
metadata-eval54.3%
+-commutative54.3%
Simplified54.3%
Taylor expanded in eps around 0 57.1%
Taylor expanded in eps around 0 57.1%
mul-1-neg57.1%
Simplified57.1%
if -2.00000000000000011e-279 < x Initial program 77.3%
Simplified77.3%
Taylor expanded in x around 0 42.4%
associate-*r*42.4%
neg-mul-142.4%
distribute-neg-in42.4%
metadata-eval42.4%
sub-neg42.4%
mul-1-neg42.4%
+-commutative42.4%
sub-neg42.4%
metadata-eval42.4%
+-commutative42.4%
Simplified42.4%
Taylor expanded in eps around 0 47.3%
Final simplification50.4%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= x -2e-279) (/ (- 2.0 (* x eps)) 2.0) (/ (+ 2.0 (* 2.0 (* x eps))) 2.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= -2e-279) {
tmp = (2.0 - (x * eps)) / 2.0;
} else {
tmp = (2.0 + (2.0 * (x * eps))) / 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 <= (-2d-279)) then
tmp = (2.0d0 - (x * eps)) / 2.0d0
else
tmp = (2.0d0 + (2.0d0 * (x * eps))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= -2e-279) {
tmp = (2.0 - (x * eps)) / 2.0;
} else {
tmp = (2.0 + (2.0 * (x * eps))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= -2e-279: tmp = (2.0 - (x * eps)) / 2.0 else: tmp = (2.0 + (2.0 * (x * eps))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= -2e-279) tmp = Float64(Float64(2.0 - Float64(x * eps)) / 2.0); else tmp = Float64(Float64(2.0 + Float64(2.0 * Float64(x * eps))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -2e-279) tmp = (2.0 - (x * eps)) / 2.0; else tmp = (2.0 + (2.0 * (x * eps))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, -2e-279], N[(N[(2.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(2.0 * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-279}:\\
\;\;\;\;\frac{2 - x \cdot \varepsilon}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + 2 \cdot \left(x \cdot \varepsilon\right)}{2}\\
\end{array}
\end{array}
if x < -2.00000000000000011e-279Initial program 65.3%
Simplified65.3%
Taylor expanded in x around 0 54.3%
associate-*r*54.3%
neg-mul-154.3%
distribute-neg-in54.3%
metadata-eval54.3%
sub-neg54.3%
mul-1-neg54.3%
+-commutative54.3%
sub-neg54.3%
metadata-eval54.3%
+-commutative54.3%
Simplified54.3%
Taylor expanded in eps around 0 57.1%
Taylor expanded in eps around 0 57.1%
mul-1-neg57.1%
Simplified57.1%
if -2.00000000000000011e-279 < x Initial program 77.3%
Simplified77.3%
Taylor expanded in x around 0 42.4%
associate-*r*42.4%
neg-mul-142.4%
distribute-neg-in42.4%
metadata-eval42.4%
sub-neg42.4%
mul-1-neg42.4%
+-commutative42.4%
sub-neg42.4%
metadata-eval42.4%
+-commutative42.4%
Simplified42.4%
Taylor expanded in eps around inf 27.9%
Applied egg-rr31.8%
Taylor expanded in eps around inf 47.2%
*-commutative47.2%
Simplified47.2%
Final simplification50.3%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (/ (- 2.0 (* x eps)) 2.0))
eps = abs(eps);
double code(double x, double eps) {
return (2.0 - (x * 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 = (2.0d0 - (x * eps)) / 2.0d0
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
return (2.0 - (x * eps)) / 2.0;
}
eps = abs(eps) def code(x, eps): return (2.0 - (x * eps)) / 2.0
eps = abs(eps) function code(x, eps) return Float64(Float64(2.0 - Float64(x * eps)) / 2.0) end
eps = abs(eps) function tmp = code(x, eps) tmp = (2.0 - (x * eps)) / 2.0; end
NOTE: eps should be positive before calling this function code[x_, eps_] := N[(N[(2.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps = |eps|\\
\\
\frac{2 - x \cdot \varepsilon}{2}
\end{array}
Initial program 73.5%
Simplified73.5%
Taylor expanded in x around 0 46.2%
associate-*r*46.2%
neg-mul-146.2%
distribute-neg-in46.2%
metadata-eval46.2%
sub-neg46.2%
mul-1-neg46.2%
+-commutative46.2%
sub-neg46.2%
metadata-eval46.2%
+-commutative46.2%
Simplified46.2%
Taylor expanded in eps around 0 52.0%
Taylor expanded in eps around 0 52.0%
mul-1-neg52.0%
Simplified52.0%
Final simplification52.0%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 1.0)
eps = abs(eps);
double code(double x, double eps) {
return 1.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 = 1.0d0
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
return 1.0;
}
eps = abs(eps) def code(x, eps): return 1.0
eps = abs(eps) function code(x, eps) return 1.0 end
eps = abs(eps) function tmp = code(x, eps) tmp = 1.0; end
NOTE: eps should be positive before calling this function code[x_, eps_] := 1.0
\begin{array}{l}
eps = |eps|\\
\\
1
\end{array}
Initial program 73.5%
Simplified73.5%
Taylor expanded in eps around 0 61.4%
associate--r+61.4%
associate-*r*61.4%
mul-1-neg61.4%
cancel-sign-sub61.4%
distribute-rgt1-in61.4%
distribute-rgt-out--61.4%
mul-1-neg61.4%
mul-1-neg61.4%
Simplified61.4%
Taylor expanded in x around 0 45.2%
mul-1-neg45.2%
unsub-neg45.2%
Simplified45.2%
Taylor expanded in x around 0 46.2%
Final simplification46.2%
herbie shell --seed 2023306
(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))