
(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 15 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 (if (or (<= eps -1.0) (not (<= eps 6e-125))) (/ (+ (exp (* x (+ eps -1.0))) (exp (* x (- eps)))) 2.0) (/ (+ (/ (+ x 1.0) (exp x)) (* (+ x 1.0) (exp (- x)))) 2.0)))
double code(double x, double eps) {
double tmp;
if ((eps <= -1.0) || !(eps <= 6e-125)) {
tmp = (exp((x * (eps + -1.0))) + exp((x * -eps))) / 2.0;
} else {
tmp = (((x + 1.0) / exp(x)) + ((x + 1.0) * exp(-x))) / 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.0d0)) .or. (.not. (eps <= 6d-125))) then
tmp = (exp((x * (eps + (-1.0d0)))) + exp((x * -eps))) / 2.0d0
else
tmp = (((x + 1.0d0) / exp(x)) + ((x + 1.0d0) * exp(-x))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -1.0) || !(eps <= 6e-125)) {
tmp = (Math.exp((x * (eps + -1.0))) + Math.exp((x * -eps))) / 2.0;
} else {
tmp = (((x + 1.0) / Math.exp(x)) + ((x + 1.0) * Math.exp(-x))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -1.0) or not (eps <= 6e-125): tmp = (math.exp((x * (eps + -1.0))) + math.exp((x * -eps))) / 2.0 else: tmp = (((x + 1.0) / math.exp(x)) + ((x + 1.0) * math.exp(-x))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -1.0) || !(eps <= 6e-125)) tmp = Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(x * Float64(-eps)))) / 2.0); else tmp = Float64(Float64(Float64(Float64(x + 1.0) / exp(x)) + Float64(Float64(x + 1.0) * exp(Float64(-x)))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -1.0) || ~((eps <= 6e-125))) tmp = (exp((x * (eps + -1.0))) + exp((x * -eps))) / 2.0; else tmp = (((x + 1.0) / exp(x)) + ((x + 1.0) * exp(-x))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -1.0], N[Not[LessEqual[eps, 6e-125]], $MachinePrecision]], 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[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] + N[(N[(x + 1.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -1 \lor \neg \left(\varepsilon \leq 6 \cdot 10^{-125}\right):\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x + 1}{e^{x}} + \left(x + 1\right) \cdot e^{-x}}{2}\\
\end{array}
\end{array}
if eps < -1 or 5.99999999999999981e-125 < eps Initial program 90.3%
div-sub90.3%
+-rgt-identity90.3%
div-sub90.3%
Simplified90.3%
Taylor expanded in eps around inf 100.0%
neg-mul-1100.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%
sub-neg100.0%
mul-1-neg100.0%
remove-double-neg100.0%
distribute-rgt-neg-in100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
Simplified100.0%
if -1 < eps < 5.99999999999999981e-125Initial program 36.1%
div-sub36.1%
+-rgt-identity36.1%
div-sub36.1%
Simplified36.1%
Taylor expanded in eps around 0 98.9%
*-commutative98.9%
distribute-lft1-in98.9%
mul-1-neg98.9%
distribute-lft-out98.9%
mul-1-neg98.9%
*-commutative98.9%
distribute-lft1-in100.0%
mul-1-neg100.0%
Simplified100.0%
exp-neg100.0%
un-div-inv100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x eps) :precision binary64 (/ (+ (exp (- (pow (cbrt (* x (- 1.0 eps))) 3.0))) (exp (* x (- -1.0 eps)))) 2.0))
double code(double x, double eps) {
return (exp(-pow(cbrt((x * (1.0 - eps))), 3.0)) + exp((x * (-1.0 - eps)))) / 2.0;
}
public static double code(double x, double eps) {
return (Math.exp(-Math.pow(Math.cbrt((x * (1.0 - eps))), 3.0)) + Math.exp((x * (-1.0 - eps)))) / 2.0;
}
function code(x, eps) return Float64(Float64(exp(Float64(-(cbrt(Float64(x * Float64(1.0 - eps))) ^ 3.0))) + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0) end
code[x_, eps_] := N[(N[(N[Exp[(-N[Power[N[Power[N[(x * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision])], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{-{\left(\sqrt[3]{x \cdot \left(1 - \varepsilon\right)}\right)}^{3}} + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}
\end{array}
Initial program 71.7%
div-sub71.7%
+-rgt-identity71.7%
div-sub71.7%
Simplified71.7%
Taylor expanded in eps around inf 98.9%
neg-mul-198.9%
*-commutative98.9%
mul-1-neg98.9%
exp-prod98.9%
+-commutative98.9%
*-lft-identity98.9%
metadata-eval98.9%
cancel-sign-sub-inv98.9%
exp-prod98.9%
mul-1-neg98.9%
*-commutative98.9%
sub-neg98.9%
mul-1-neg98.9%
remove-double-neg98.9%
distribute-rgt-neg-in98.9%
+-commutative98.9%
Simplified98.9%
add-cube-cbrt98.9%
pow398.9%
Applied egg-rr98.9%
Final simplification98.9%
(FPCore (x eps) :precision binary64 (if (or (<= eps -5000000000000.0) (not (<= eps 6.5e-139))) (/ (+ (exp (* x (+ eps -1.0))) (exp (* x (- eps)))) 2.0) (/ (+ (exp (- x)) (exp (* x (- -1.0 eps)))) 2.0)))
double code(double x, double eps) {
double tmp;
if ((eps <= -5000000000000.0) || !(eps <= 6.5e-139)) {
tmp = (exp((x * (eps + -1.0))) + exp((x * -eps))) / 2.0;
} else {
tmp = (exp(-x) + exp((x * (-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 <= (-5000000000000.0d0)) .or. (.not. (eps <= 6.5d-139))) then
tmp = (exp((x * (eps + (-1.0d0)))) + exp((x * -eps))) / 2.0d0
else
tmp = (exp(-x) + exp((x * ((-1.0d0) - eps)))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -5000000000000.0) || !(eps <= 6.5e-139)) {
tmp = (Math.exp((x * (eps + -1.0))) + Math.exp((x * -eps))) / 2.0;
} else {
tmp = (Math.exp(-x) + Math.exp((x * (-1.0 - eps)))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -5000000000000.0) or not (eps <= 6.5e-139): tmp = (math.exp((x * (eps + -1.0))) + math.exp((x * -eps))) / 2.0 else: tmp = (math.exp(-x) + math.exp((x * (-1.0 - eps)))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -5000000000000.0) || !(eps <= 6.5e-139)) tmp = Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(x * Float64(-eps)))) / 2.0); else tmp = Float64(Float64(exp(Float64(-x)) + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -5000000000000.0) || ~((eps <= 6.5e-139))) tmp = (exp((x * (eps + -1.0))) + exp((x * -eps))) / 2.0; else tmp = (exp(-x) + exp((x * (-1.0 - eps)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -5000000000000.0], N[Not[LessEqual[eps, 6.5e-139]], $MachinePrecision]], 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[(-x)], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -5000000000000 \lor \neg \left(\varepsilon \leq 6.5 \cdot 10^{-139}\right):\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{-x} + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}\\
\end{array}
\end{array}
if eps < -5e12 or 6.5e-139 < eps Initial program 89.5%
div-sub89.5%
+-rgt-identity89.5%
div-sub89.5%
Simplified89.5%
Taylor expanded in eps around inf 99.8%
neg-mul-199.8%
*-commutative99.8%
mul-1-neg99.8%
exp-prod99.8%
+-commutative99.8%
*-lft-identity99.8%
metadata-eval99.8%
cancel-sign-sub-inv99.8%
exp-prod99.8%
mul-1-neg99.8%
*-commutative99.8%
sub-neg99.8%
mul-1-neg99.8%
remove-double-neg99.8%
distribute-rgt-neg-in99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in eps around inf 99.8%
mul-1-neg99.8%
distribute-lft-neg-out99.8%
*-commutative99.8%
Simplified99.8%
if -5e12 < eps < 6.5e-139Initial program 39.9%
div-sub39.9%
+-rgt-identity39.9%
div-sub39.9%
Simplified39.9%
Taylor expanded in eps around inf 97.4%
neg-mul-197.4%
*-commutative97.4%
mul-1-neg97.4%
exp-prod97.4%
+-commutative97.4%
*-lft-identity97.4%
metadata-eval97.4%
cancel-sign-sub-inv97.4%
exp-prod97.4%
mul-1-neg97.4%
*-commutative97.4%
sub-neg97.4%
mul-1-neg97.4%
remove-double-neg97.4%
distribute-rgt-neg-in97.4%
+-commutative97.4%
Simplified97.4%
Taylor expanded in eps around 0 97.4%
Final simplification98.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* x (- -1.0 eps))))
(if (or (<= x 4.8e-176) (not (<= x 8.2e+14)))
(/ (+ (exp (- x)) (exp t_0)) 2.0)
(/ (+ (exp (* x (+ eps -1.0))) (+ 1.0 t_0)) 2.0))))
double code(double x, double eps) {
double t_0 = x * (-1.0 - eps);
double tmp;
if ((x <= 4.8e-176) || !(x <= 8.2e+14)) {
tmp = (exp(-x) + exp(t_0)) / 2.0;
} else {
tmp = (exp((x * (eps + -1.0))) + (1.0 + t_0)) / 2.0;
}
return tmp;
}
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 = x * ((-1.0d0) - eps)
if ((x <= 4.8d-176) .or. (.not. (x <= 8.2d+14))) then
tmp = (exp(-x) + exp(t_0)) / 2.0d0
else
tmp = (exp((x * (eps + (-1.0d0)))) + (1.0d0 + t_0)) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = x * (-1.0 - eps);
double tmp;
if ((x <= 4.8e-176) || !(x <= 8.2e+14)) {
tmp = (Math.exp(-x) + Math.exp(t_0)) / 2.0;
} else {
tmp = (Math.exp((x * (eps + -1.0))) + (1.0 + t_0)) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = x * (-1.0 - eps) tmp = 0 if (x <= 4.8e-176) or not (x <= 8.2e+14): tmp = (math.exp(-x) + math.exp(t_0)) / 2.0 else: tmp = (math.exp((x * (eps + -1.0))) + (1.0 + t_0)) / 2.0 return tmp
function code(x, eps) t_0 = Float64(x * Float64(-1.0 - eps)) tmp = 0.0 if ((x <= 4.8e-176) || !(x <= 8.2e+14)) tmp = Float64(Float64(exp(Float64(-x)) + exp(t_0)) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + Float64(1.0 + t_0)) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = x * (-1.0 - eps); tmp = 0.0; if ((x <= 4.8e-176) || ~((x <= 8.2e+14))) tmp = (exp(-x) + exp(t_0)) / 2.0; else tmp = (exp((x * (eps + -1.0))) + (1.0 + t_0)) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, 4.8e-176], N[Not[LessEqual[x, 8.2e+14]], $MachinePrecision]], N[(N[(N[Exp[(-x)], $MachinePrecision] + N[Exp[t$95$0], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(-1 - \varepsilon\right)\\
\mathbf{if}\;x \leq 4.8 \cdot 10^{-176} \lor \neg \left(x \leq 8.2 \cdot 10^{+14}\right):\\
\;\;\;\;\frac{e^{-x} + e^{t_0}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)} + \left(1 + t_0\right)}{2}\\
\end{array}
\end{array}
if x < 4.80000000000000012e-176 or 8.2e14 < x Initial program 75.3%
div-sub75.3%
+-rgt-identity75.3%
div-sub75.3%
Simplified75.3%
Taylor expanded in eps around inf 99.0%
neg-mul-199.0%
*-commutative99.0%
mul-1-neg99.0%
exp-prod99.0%
+-commutative99.0%
*-lft-identity99.0%
metadata-eval99.0%
cancel-sign-sub-inv99.0%
exp-prod99.0%
mul-1-neg99.0%
*-commutative99.0%
sub-neg99.0%
mul-1-neg99.0%
remove-double-neg99.0%
distribute-rgt-neg-in99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in eps around 0 85.8%
if 4.80000000000000012e-176 < x < 8.2e14Initial program 52.0%
div-sub52.0%
+-rgt-identity52.0%
div-sub52.0%
Simplified52.0%
Taylor expanded in eps around inf 98.6%
neg-mul-198.6%
*-commutative98.6%
mul-1-neg98.6%
exp-prod98.6%
+-commutative98.6%
*-lft-identity98.6%
metadata-eval98.6%
cancel-sign-sub-inv98.6%
exp-prod98.6%
mul-1-neg98.6%
*-commutative98.6%
sub-neg98.6%
mul-1-neg98.6%
remove-double-neg98.6%
distribute-rgt-neg-in98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in x around 0 92.7%
Final simplification86.9%
(FPCore (x eps) :precision binary64 (/ (+ (exp (* x (+ eps -1.0))) (exp (* x (- -1.0 eps)))) 2.0))
double code(double x, double eps) {
return (exp((x * (eps + -1.0))) + 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 * (eps + (-1.0d0)))) + exp((x * ((-1.0d0) - eps)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (Math.exp((x * (eps + -1.0))) + Math.exp((x * (-1.0 - eps)))) / 2.0;
}
def code(x, eps): return (math.exp((x * (eps + -1.0))) + math.exp((x * (-1.0 - eps)))) / 2.0
function code(x, eps) return Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0) end
function tmp = code(x, eps) tmp = (exp((x * (eps + -1.0))) + exp((x * (-1.0 - eps)))) / 2.0; end
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}
\\
\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}
\end{array}
Initial program 71.7%
div-sub71.7%
+-rgt-identity71.7%
div-sub71.7%
Simplified71.7%
Taylor expanded in eps around inf 98.9%
neg-mul-198.9%
*-commutative98.9%
mul-1-neg98.9%
exp-prod98.9%
+-commutative98.9%
*-lft-identity98.9%
metadata-eval98.9%
cancel-sign-sub-inv98.9%
exp-prod98.9%
mul-1-neg98.9%
*-commutative98.9%
sub-neg98.9%
mul-1-neg98.9%
remove-double-neg98.9%
distribute-rgt-neg-in98.9%
+-commutative98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (+ 1.0 (exp (- (* x eps) x))) 2.0)))
(if (<= x -2.5e+17)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 2e-174)
(/ (+ 1.0 (exp (* x (- eps)))) 2.0)
(if (<= x 700.0)
t_0
(if (<= x 8.8e+151)
(/ (+ (+ 1.0 (* (* x x) -0.5)) (* (+ x 1.0) (exp x))) 2.0)
(if (<= x 5.2e+276) 0.0 t_0)))))))
double code(double x, double eps) {
double t_0 = (1.0 + exp(((x * eps) - x))) / 2.0;
double tmp;
if (x <= -2.5e+17) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 2e-174) {
tmp = (1.0 + exp((x * -eps))) / 2.0;
} else if (x <= 700.0) {
tmp = t_0;
} else if (x <= 8.8e+151) {
tmp = ((1.0 + ((x * x) * -0.5)) + ((x + 1.0) * exp(x))) / 2.0;
} else if (x <= 5.2e+276) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
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 + exp(((x * eps) - x))) / 2.0d0
if (x <= (-2.5d+17)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 2d-174) then
tmp = (1.0d0 + exp((x * -eps))) / 2.0d0
else if (x <= 700.0d0) then
tmp = t_0
else if (x <= 8.8d+151) then
tmp = ((1.0d0 + ((x * x) * (-0.5d0))) + ((x + 1.0d0) * exp(x))) / 2.0d0
else if (x <= 5.2d+276) then
tmp = 0.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = (1.0 + Math.exp(((x * eps) - x))) / 2.0;
double tmp;
if (x <= -2.5e+17) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 2e-174) {
tmp = (1.0 + Math.exp((x * -eps))) / 2.0;
} else if (x <= 700.0) {
tmp = t_0;
} else if (x <= 8.8e+151) {
tmp = ((1.0 + ((x * x) * -0.5)) + ((x + 1.0) * Math.exp(x))) / 2.0;
} else if (x <= 5.2e+276) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, eps): t_0 = (1.0 + math.exp(((x * eps) - x))) / 2.0 tmp = 0 if x <= -2.5e+17: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 2e-174: tmp = (1.0 + math.exp((x * -eps))) / 2.0 elif x <= 700.0: tmp = t_0 elif x <= 8.8e+151: tmp = ((1.0 + ((x * x) * -0.5)) + ((x + 1.0) * math.exp(x))) / 2.0 elif x <= 5.2e+276: tmp = 0.0 else: tmp = t_0 return tmp
function code(x, eps) t_0 = Float64(Float64(1.0 + exp(Float64(Float64(x * eps) - x))) / 2.0) tmp = 0.0 if (x <= -2.5e+17) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 2e-174) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps)))) / 2.0); elseif (x <= 700.0) tmp = t_0; elseif (x <= 8.8e+151) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(x * x) * -0.5)) + Float64(Float64(x + 1.0) * exp(x))) / 2.0); elseif (x <= 5.2e+276) tmp = 0.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, eps) t_0 = (1.0 + exp(((x * eps) - x))) / 2.0; tmp = 0.0; if (x <= -2.5e+17) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 2e-174) tmp = (1.0 + exp((x * -eps))) / 2.0; elseif (x <= 700.0) tmp = t_0; elseif (x <= 8.8e+151) tmp = ((1.0 + ((x * x) * -0.5)) + ((x + 1.0) * exp(x))) / 2.0; elseif (x <= 5.2e+276) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(1.0 + N[Exp[N[(N[(x * eps), $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -2.5e+17], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2e-174], N[(N[(1.0 + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 700.0], t$95$0, If[LessEqual[x, 8.8e+151], N[(N[(N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + N[(N[(x + 1.0), $MachinePrecision] * N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5.2e+276], 0.0, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 + e^{x \cdot \varepsilon - x}}{2}\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{+17}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-174}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 700:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{+151}:\\
\;\;\;\;\frac{\left(1 + \left(x \cdot x\right) \cdot -0.5\right) + \left(x + 1\right) \cdot e^{x}}{2}\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+276}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -2.5e17Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
neg-mul-1100.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%
sub-neg100.0%
mul-1-neg100.0%
remove-double-neg100.0%
distribute-rgt-neg-in100.0%
+-commutative100.0%
Simplified100.0%
add-cube-cbrt100.0%
pow3100.0%
Applied egg-rr100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
pow-base-1100.0%
*-lft-identity100.0%
Simplified100.0%
if -2.5e17 < x < 2e-174Initial program 48.2%
div-sub48.2%
+-rgt-identity48.2%
div-sub48.2%
Simplified48.2%
Taylor expanded in eps around inf 97.8%
neg-mul-197.8%
*-commutative97.8%
mul-1-neg97.8%
exp-prod97.8%
+-commutative97.8%
*-lft-identity97.8%
metadata-eval97.8%
cancel-sign-sub-inv97.8%
exp-prod97.8%
mul-1-neg97.8%
*-commutative97.8%
sub-neg97.8%
mul-1-neg97.8%
remove-double-neg97.8%
distribute-rgt-neg-in97.8%
+-commutative97.8%
Simplified97.8%
add-cube-cbrt97.9%
pow397.9%
Applied egg-rr97.9%
Taylor expanded in eps around inf 97.9%
mul-1-neg97.9%
distribute-lft-neg-out97.9%
*-commutative97.9%
Simplified97.9%
Taylor expanded in x around inf 90.7%
associate-*r*90.7%
mul-1-neg90.7%
Simplified90.7%
if 2e-174 < x < 700 or 5.19999999999999998e276 < x Initial program 59.1%
div-sub59.1%
+-rgt-identity59.1%
div-sub59.1%
Simplified59.1%
Taylor expanded in eps around inf 98.8%
neg-mul-198.8%
*-commutative98.8%
mul-1-neg98.8%
exp-prod98.8%
+-commutative98.8%
*-lft-identity98.8%
metadata-eval98.8%
cancel-sign-sub-inv98.8%
exp-prod98.8%
mul-1-neg98.8%
*-commutative98.8%
sub-neg98.8%
mul-1-neg98.8%
remove-double-neg98.8%
distribute-rgt-neg-in98.8%
+-commutative98.8%
Simplified98.8%
Taylor expanded in x around 0 85.2%
Taylor expanded in x around inf 85.2%
if 700 < x < 8.80000000000000027e151Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around 0 30.4%
*-commutative30.4%
distribute-lft1-in30.4%
mul-1-neg30.4%
distribute-lft-out30.4%
mul-1-neg30.4%
*-commutative30.4%
distribute-lft1-in30.4%
mul-1-neg30.4%
Simplified30.4%
Taylor expanded in x around 0 0.9%
*-commutative0.9%
unpow20.9%
Simplified0.9%
*-commutative0.9%
+-commutative0.9%
distribute-lft-in0.9%
*-commutative0.9%
*-un-lft-identity0.9%
add-sqr-sqrt0.0%
sqrt-unprod71.2%
sqr-neg71.2%
sqrt-unprod71.2%
add-sqr-sqrt71.2%
add-sqr-sqrt0.0%
sqrt-unprod71.2%
sqr-neg71.2%
sqrt-unprod71.2%
add-sqr-sqrt71.2%
Applied egg-rr71.2%
*-commutative71.2%
distribute-rgt1-in71.2%
+-commutative71.2%
Simplified71.2%
if 8.80000000000000027e151 < x < 5.19999999999999998e276Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.9%
div-sub53.9%
rec-exp53.9%
mul-1-neg53.9%
+-inverses53.9%
Simplified53.9%
Final simplification83.2%
(FPCore (x eps)
:precision binary64
(if (<= x -2.5e+17)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 2.15e-175)
(/ (+ 1.0 (exp (* x (- eps)))) 2.0)
(if (<= x 700.0)
(/ (+ (exp (* x (+ eps -1.0))) (+ 1.0 (* x (- -1.0 eps)))) 2.0)
(if (<= x 1e+152)
(/ (+ (+ 1.0 (* (* x x) -0.5)) (* (+ x 1.0) (exp x))) 2.0)
(if (<= x 2.1e+284) 0.0 (/ (+ 1.0 (exp (- (* x eps) x))) 2.0)))))))
double code(double x, double eps) {
double tmp;
if (x <= -2.5e+17) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 2.15e-175) {
tmp = (1.0 + exp((x * -eps))) / 2.0;
} else if (x <= 700.0) {
tmp = (exp((x * (eps + -1.0))) + (1.0 + (x * (-1.0 - eps)))) / 2.0;
} else if (x <= 1e+152) {
tmp = ((1.0 + ((x * x) * -0.5)) + ((x + 1.0) * exp(x))) / 2.0;
} else if (x <= 2.1e+284) {
tmp = 0.0;
} else {
tmp = (1.0 + exp(((x * eps) - x))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-2.5d+17)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 2.15d-175) then
tmp = (1.0d0 + exp((x * -eps))) / 2.0d0
else if (x <= 700.0d0) then
tmp = (exp((x * (eps + (-1.0d0)))) + (1.0d0 + (x * ((-1.0d0) - eps)))) / 2.0d0
else if (x <= 1d+152) then
tmp = ((1.0d0 + ((x * x) * (-0.5d0))) + ((x + 1.0d0) * exp(x))) / 2.0d0
else if (x <= 2.1d+284) then
tmp = 0.0d0
else
tmp = (1.0d0 + exp(((x * eps) - x))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -2.5e+17) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 2.15e-175) {
tmp = (1.0 + Math.exp((x * -eps))) / 2.0;
} else if (x <= 700.0) {
tmp = (Math.exp((x * (eps + -1.0))) + (1.0 + (x * (-1.0 - eps)))) / 2.0;
} else if (x <= 1e+152) {
tmp = ((1.0 + ((x * x) * -0.5)) + ((x + 1.0) * Math.exp(x))) / 2.0;
} else if (x <= 2.1e+284) {
tmp = 0.0;
} else {
tmp = (1.0 + Math.exp(((x * eps) - x))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -2.5e+17: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 2.15e-175: tmp = (1.0 + math.exp((x * -eps))) / 2.0 elif x <= 700.0: tmp = (math.exp((x * (eps + -1.0))) + (1.0 + (x * (-1.0 - eps)))) / 2.0 elif x <= 1e+152: tmp = ((1.0 + ((x * x) * -0.5)) + ((x + 1.0) * math.exp(x))) / 2.0 elif x <= 2.1e+284: tmp = 0.0 else: tmp = (1.0 + math.exp(((x * eps) - x))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -2.5e+17) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 2.15e-175) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps)))) / 2.0); elseif (x <= 700.0) tmp = Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + Float64(1.0 + Float64(x * Float64(-1.0 - eps)))) / 2.0); elseif (x <= 1e+152) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(x * x) * -0.5)) + Float64(Float64(x + 1.0) * exp(x))) / 2.0); elseif (x <= 2.1e+284) tmp = 0.0; else tmp = Float64(Float64(1.0 + exp(Float64(Float64(x * eps) - x))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -2.5e+17) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 2.15e-175) tmp = (1.0 + exp((x * -eps))) / 2.0; elseif (x <= 700.0) tmp = (exp((x * (eps + -1.0))) + (1.0 + (x * (-1.0 - eps)))) / 2.0; elseif (x <= 1e+152) tmp = ((1.0 + ((x * x) * -0.5)) + ((x + 1.0) * exp(x))) / 2.0; elseif (x <= 2.1e+284) tmp = 0.0; else tmp = (1.0 + exp(((x * eps) - x))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -2.5e+17], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.15e-175], N[(N[(1.0 + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 700.0], N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 + N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1e+152], N[(N[(N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + N[(N[(x + 1.0), $MachinePrecision] * N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.1e+284], 0.0, N[(N[(1.0 + N[Exp[N[(N[(x * eps), $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{+17}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{-175}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 700:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)} + \left(1 + x \cdot \left(-1 - \varepsilon\right)\right)}{2}\\
\mathbf{elif}\;x \leq 10^{+152}:\\
\;\;\;\;\frac{\left(1 + \left(x \cdot x\right) \cdot -0.5\right) + \left(x + 1\right) \cdot e^{x}}{2}\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{+284}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \varepsilon - x}}{2}\\
\end{array}
\end{array}
if x < -2.5e17Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
neg-mul-1100.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%
sub-neg100.0%
mul-1-neg100.0%
remove-double-neg100.0%
distribute-rgt-neg-in100.0%
+-commutative100.0%
Simplified100.0%
add-cube-cbrt100.0%
pow3100.0%
Applied egg-rr100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
pow-base-1100.0%
*-lft-identity100.0%
Simplified100.0%
if -2.5e17 < x < 2.14999999999999999e-175Initial program 48.2%
div-sub48.2%
+-rgt-identity48.2%
div-sub48.2%
Simplified48.2%
Taylor expanded in eps around inf 97.8%
neg-mul-197.8%
*-commutative97.8%
mul-1-neg97.8%
exp-prod97.8%
+-commutative97.8%
*-lft-identity97.8%
metadata-eval97.8%
cancel-sign-sub-inv97.8%
exp-prod97.8%
mul-1-neg97.8%
*-commutative97.8%
sub-neg97.8%
mul-1-neg97.8%
remove-double-neg97.8%
distribute-rgt-neg-in97.8%
+-commutative97.8%
Simplified97.8%
add-cube-cbrt97.9%
pow397.9%
Applied egg-rr97.9%
Taylor expanded in eps around inf 97.9%
mul-1-neg97.9%
distribute-lft-neg-out97.9%
*-commutative97.9%
Simplified97.9%
Taylor expanded in x around inf 90.7%
associate-*r*90.7%
mul-1-neg90.7%
Simplified90.7%
if 2.14999999999999999e-175 < x < 700Initial program 46.6%
div-sub46.6%
+-rgt-identity46.6%
div-sub46.6%
Simplified46.6%
Taylor expanded in eps around inf 98.5%
neg-mul-198.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%
sub-neg98.5%
mul-1-neg98.5%
remove-double-neg98.5%
distribute-rgt-neg-in98.5%
+-commutative98.5%
Simplified98.5%
Taylor expanded in x around 0 91.9%
if 700 < x < 1e152Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around 0 30.4%
*-commutative30.4%
distribute-lft1-in30.4%
mul-1-neg30.4%
distribute-lft-out30.4%
mul-1-neg30.4%
*-commutative30.4%
distribute-lft1-in30.4%
mul-1-neg30.4%
Simplified30.4%
Taylor expanded in x around 0 0.9%
*-commutative0.9%
unpow20.9%
Simplified0.9%
*-commutative0.9%
+-commutative0.9%
distribute-lft-in0.9%
*-commutative0.9%
*-un-lft-identity0.9%
add-sqr-sqrt0.0%
sqrt-unprod71.2%
sqr-neg71.2%
sqrt-unprod71.2%
add-sqr-sqrt71.2%
add-sqr-sqrt0.0%
sqrt-unprod71.2%
sqr-neg71.2%
sqrt-unprod71.2%
add-sqr-sqrt71.2%
Applied egg-rr71.2%
*-commutative71.2%
distribute-rgt1-in71.2%
+-commutative71.2%
Simplified71.2%
if 1e152 < x < 2.10000000000000005e284Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.9%
div-sub53.9%
rec-exp53.9%
mul-1-neg53.9%
+-inverses53.9%
Simplified53.9%
if 2.10000000000000005e284 < x Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
neg-mul-1100.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%
sub-neg100.0%
mul-1-neg100.0%
remove-double-neg100.0%
distribute-rgt-neg-in100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 64.8%
Taylor expanded in x around inf 64.8%
Final simplification83.2%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (+ 1.0 (exp (- (* x eps) x))) 2.0))
(t_1 (/ (+ 1.0 (exp (* x (- eps)))) 2.0)))
(if (<= x -2.5e+17)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 5e-176)
t_1
(if (<= x 4.2e+69)
t_0
(if (<= x 1.76e+158) t_1 (if (<= x 3.5e+284) 0.0 t_0)))))))
double code(double x, double eps) {
double t_0 = (1.0 + exp(((x * eps) - x))) / 2.0;
double t_1 = (1.0 + exp((x * -eps))) / 2.0;
double tmp;
if (x <= -2.5e+17) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 5e-176) {
tmp = t_1;
} else if (x <= 4.2e+69) {
tmp = t_0;
} else if (x <= 1.76e+158) {
tmp = t_1;
} else if (x <= 3.5e+284) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
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) :: tmp
t_0 = (1.0d0 + exp(((x * eps) - x))) / 2.0d0
t_1 = (1.0d0 + exp((x * -eps))) / 2.0d0
if (x <= (-2.5d+17)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 5d-176) then
tmp = t_1
else if (x <= 4.2d+69) then
tmp = t_0
else if (x <= 1.76d+158) then
tmp = t_1
else if (x <= 3.5d+284) then
tmp = 0.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = (1.0 + Math.exp(((x * eps) - x))) / 2.0;
double t_1 = (1.0 + Math.exp((x * -eps))) / 2.0;
double tmp;
if (x <= -2.5e+17) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 5e-176) {
tmp = t_1;
} else if (x <= 4.2e+69) {
tmp = t_0;
} else if (x <= 1.76e+158) {
tmp = t_1;
} else if (x <= 3.5e+284) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, eps): t_0 = (1.0 + math.exp(((x * eps) - x))) / 2.0 t_1 = (1.0 + math.exp((x * -eps))) / 2.0 tmp = 0 if x <= -2.5e+17: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 5e-176: tmp = t_1 elif x <= 4.2e+69: tmp = t_0 elif x <= 1.76e+158: tmp = t_1 elif x <= 3.5e+284: tmp = 0.0 else: tmp = t_0 return tmp
function code(x, eps) t_0 = Float64(Float64(1.0 + exp(Float64(Float64(x * eps) - x))) / 2.0) t_1 = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps)))) / 2.0) tmp = 0.0 if (x <= -2.5e+17) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 5e-176) tmp = t_1; elseif (x <= 4.2e+69) tmp = t_0; elseif (x <= 1.76e+158) tmp = t_1; elseif (x <= 3.5e+284) tmp = 0.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, eps) t_0 = (1.0 + exp(((x * eps) - x))) / 2.0; t_1 = (1.0 + exp((x * -eps))) / 2.0; tmp = 0.0; if (x <= -2.5e+17) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 5e-176) tmp = t_1; elseif (x <= 4.2e+69) tmp = t_0; elseif (x <= 1.76e+158) tmp = t_1; elseif (x <= 3.5e+284) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(1.0 + N[Exp[N[(N[(x * eps), $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -2.5e+17], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5e-176], t$95$1, If[LessEqual[x, 4.2e+69], t$95$0, If[LessEqual[x, 1.76e+158], t$95$1, If[LessEqual[x, 3.5e+284], 0.0, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1 + e^{x \cdot \varepsilon - x}}{2}\\
t_1 := \frac{1 + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{+17}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-176}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{+69}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.76 \cdot 10^{+158}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{+284}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -2.5e17Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
neg-mul-1100.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%
sub-neg100.0%
mul-1-neg100.0%
remove-double-neg100.0%
distribute-rgt-neg-in100.0%
+-commutative100.0%
Simplified100.0%
add-cube-cbrt100.0%
pow3100.0%
Applied egg-rr100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
pow-base-1100.0%
*-lft-identity100.0%
Simplified100.0%
if -2.5e17 < x < 5e-176 or 4.2000000000000003e69 < x < 1.7600000000000001e158Initial program 58.0%
div-sub58.0%
+-rgt-identity58.0%
div-sub58.0%
Simplified58.0%
Taylor expanded in eps around inf 98.3%
neg-mul-198.3%
*-commutative98.3%
mul-1-neg98.3%
exp-prod98.3%
+-commutative98.3%
*-lft-identity98.3%
metadata-eval98.3%
cancel-sign-sub-inv98.3%
exp-prod98.3%
mul-1-neg98.3%
*-commutative98.3%
sub-neg98.3%
mul-1-neg98.3%
remove-double-neg98.3%
distribute-rgt-neg-in98.3%
+-commutative98.3%
Simplified98.3%
add-cube-cbrt98.3%
pow398.3%
Applied egg-rr98.3%
Taylor expanded in eps around inf 93.0%
mul-1-neg92.9%
distribute-lft-neg-out92.9%
*-commutative92.9%
Simplified93.0%
Taylor expanded in x around inf 84.1%
associate-*r*84.1%
mul-1-neg84.1%
Simplified84.1%
if 5e-176 < x < 4.2000000000000003e69 or 3.50000000000000019e284 < x Initial program 71.3%
div-sub71.3%
+-rgt-identity71.3%
div-sub71.3%
Simplified71.3%
Taylor expanded in eps around inf 99.2%
neg-mul-199.2%
*-commutative99.2%
mul-1-neg99.2%
exp-prod99.2%
+-commutative99.2%
*-lft-identity99.2%
metadata-eval99.2%
cancel-sign-sub-inv99.2%
exp-prod99.2%
mul-1-neg99.2%
*-commutative99.2%
sub-neg99.2%
mul-1-neg99.2%
remove-double-neg99.2%
distribute-rgt-neg-in99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in x around 0 73.7%
Taylor expanded in x around inf 73.7%
if 1.7600000000000001e158 < x < 3.50000000000000019e284Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 55.9%
div-sub55.9%
rec-exp55.9%
mul-1-neg55.9%
+-inverses55.9%
Simplified55.9%
Final simplification80.2%
(FPCore (x eps) :precision binary64 (if (<= x -2.5e+17) (/ (+ 1.0 (exp (- x))) 2.0) (if (<= x 2.15e+158) (/ (+ 1.0 (exp (* x (- eps)))) 2.0) 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -2.5e+17) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 2.15e+158) {
tmp = (1.0 + exp((x * -eps))) / 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 <= (-2.5d+17)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 2.15d+158) then
tmp = (1.0d0 + exp((x * -eps))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -2.5e+17) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 2.15e+158) {
tmp = (1.0 + Math.exp((x * -eps))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -2.5e+17: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 2.15e+158: tmp = (1.0 + math.exp((x * -eps))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -2.5e+17) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 2.15e+158) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps)))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -2.5e+17) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 2.15e+158) tmp = (1.0 + exp((x * -eps))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -2.5e+17], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.15e+158], N[(N[(1.0 + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{+17}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{+158}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.5e17Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
neg-mul-1100.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%
sub-neg100.0%
mul-1-neg100.0%
remove-double-neg100.0%
distribute-rgt-neg-in100.0%
+-commutative100.0%
Simplified100.0%
add-cube-cbrt100.0%
pow3100.0%
Applied egg-rr100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
pow-base-1100.0%
*-lft-identity100.0%
Simplified100.0%
if -2.5e17 < x < 2.15e158Initial program 60.4%
div-sub60.4%
+-rgt-identity60.4%
div-sub60.4%
Simplified60.4%
Taylor expanded in eps around inf 98.5%
neg-mul-198.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%
sub-neg98.5%
mul-1-neg98.5%
remove-double-neg98.5%
distribute-rgt-neg-in98.5%
+-commutative98.5%
Simplified98.5%
add-cube-cbrt98.5%
pow398.5%
Applied egg-rr98.5%
Taylor expanded in eps around inf 91.7%
mul-1-neg91.6%
distribute-lft-neg-out91.6%
*-commutative91.6%
Simplified91.7%
Taylor expanded in x around inf 76.4%
associate-*r*76.4%
mul-1-neg76.4%
Simplified76.4%
if 2.15e158 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 48.3%
div-sub48.3%
rec-exp48.3%
mul-1-neg48.3%
+-inverses48.3%
Simplified48.3%
Final simplification75.1%
(FPCore (x eps) :precision binary64 (if (<= x 1.75e+15) (/ (+ 1.0 (exp (- x))) 2.0) 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 1.75e+15) {
tmp = (1.0 + exp(-x)) / 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 <= 1.75d+15) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 1.75e+15) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.75e+15: tmp = (1.0 + math.exp(-x)) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 1.75e+15) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 1.75e+15) tmp = (1.0 + exp(-x)) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 1.75e+15], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.75 \cdot 10^{+15}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.75e15Initial program 59.0%
div-sub59.0%
+-rgt-identity59.0%
div-sub59.0%
Simplified59.0%
Taylor expanded in eps around inf 98.4%
neg-mul-198.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%
sub-neg98.4%
mul-1-neg98.4%
remove-double-neg98.4%
distribute-rgt-neg-in98.4%
+-commutative98.4%
Simplified98.4%
add-cube-cbrt98.4%
pow398.4%
Applied egg-rr98.4%
Taylor expanded in eps around inf 98.5%
mul-1-neg98.5%
distribute-lft-neg-out98.5%
*-commutative98.5%
Simplified98.5%
Taylor expanded in eps around 0 77.0%
pow-base-177.0%
*-lft-identity77.0%
Simplified77.0%
if 1.75e15 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 41.4%
div-sub41.4%
rec-exp41.4%
mul-1-neg41.4%
+-inverses41.4%
Simplified41.4%
Final simplification66.0%
(FPCore (x eps) :precision binary64 (if (<= x 7.8e+14) (/ (+ 2.0 (* x eps)) 2.0) 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 7.8e+14) {
tmp = (2.0 + (x * eps)) / 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 <= 7.8d+14) then
tmp = (2.0d0 + (x * eps)) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 7.8e+14) {
tmp = (2.0 + (x * eps)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 7.8e+14: tmp = (2.0 + (x * eps)) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 7.8e+14) tmp = Float64(Float64(2.0 + Float64(x * eps)) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 7.8e+14) tmp = (2.0 + (x * eps)) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 7.8e+14], N[(N[(2.0 + N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.8 \cdot 10^{+14}:\\
\;\;\;\;\frac{2 + x \cdot \varepsilon}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 7.8e14Initial program 58.8%
Simplified45.7%
Taylor expanded in x around 0 59.2%
Taylor expanded in eps around 0 62.0%
Taylor expanded in eps around 0 62.0%
if 7.8e14 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 40.9%
div-sub40.9%
rec-exp40.9%
mul-1-neg40.9%
+-inverses40.9%
Simplified40.9%
Final simplification55.4%
(FPCore (x eps) :precision binary64 (if (<= x 2.5) (/ (- 2.0 (* x eps)) 2.0) 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 2.5) {
tmp = (2.0 - (x * eps)) / 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 <= 2.5d0) then
tmp = (2.0d0 - (x * eps)) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 2.5) {
tmp = (2.0 - (x * eps)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 2.5: tmp = (2.0 - (x * eps)) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 2.5) tmp = Float64(Float64(2.0 - Float64(x * eps)) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 2.5) tmp = (2.0 - (x * eps)) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 2.5], N[(N[(2.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.5:\\
\;\;\;\;\frac{2 - x \cdot \varepsilon}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.5Initial program 57.6%
div-sub57.6%
+-rgt-identity57.6%
div-sub57.6%
Simplified57.6%
Taylor expanded in eps around inf 98.4%
neg-mul-198.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%
sub-neg98.4%
mul-1-neg98.4%
remove-double-neg98.4%
distribute-rgt-neg-in98.4%
+-commutative98.4%
Simplified98.4%
add-cube-cbrt98.4%
pow398.4%
Applied egg-rr98.4%
Taylor expanded in eps around inf 98.4%
mul-1-neg98.4%
distribute-lft-neg-out98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in x around 0 65.4%
+-commutative65.4%
mul-1-neg65.4%
unsub-neg65.4%
Simplified65.4%
if 2.5 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 38.6%
div-sub38.6%
rec-exp38.6%
mul-1-neg38.6%
+-inverses38.6%
Simplified38.6%
Final simplification56.5%
(FPCore (x eps) :precision binary64 (if (<= x -7e+72) (/ (* x eps) 2.0) (if (<= x 1.75e+15) 1.0 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -7e+72) {
tmp = (x * eps) / 2.0;
} else if (x <= 1.75e+15) {
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 <= (-7d+72)) then
tmp = (x * eps) / 2.0d0
else if (x <= 1.75d+15) 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 <= -7e+72) {
tmp = (x * eps) / 2.0;
} else if (x <= 1.75e+15) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -7e+72: tmp = (x * eps) / 2.0 elif x <= 1.75e+15: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -7e+72) tmp = Float64(Float64(x * eps) / 2.0); elseif (x <= 1.75e+15) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -7e+72) tmp = (x * eps) / 2.0; elseif (x <= 1.75e+15) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -7e+72], N[(N[(x * eps), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.75e+15], 1.0, 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{+72}:\\
\;\;\;\;\frac{x \cdot \varepsilon}{2}\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{+15}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -7.0000000000000002e72Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.2%
Taylor expanded in eps around 0 23.0%
Taylor expanded in eps around inf 23.0%
if -7.0000000000000002e72 < x < 1.75e15Initial program 51.3%
div-sub51.3%
+-rgt-identity51.3%
div-sub51.3%
Simplified51.3%
Taylor expanded in x around 0 69.4%
if 1.75e15 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 41.4%
div-sub41.4%
rec-exp41.4%
mul-1-neg41.4%
+-inverses41.4%
Simplified41.4%
Final simplification55.7%
(FPCore (x eps) :precision binary64 (if (<= x 1.75e+15) 1.0 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 1.75e+15) {
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 <= 1.75d+15) 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 <= 1.75e+15) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.75e+15: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 1.75e+15) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 1.75e+15) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 1.75e+15], 1.0, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.75 \cdot 10^{+15}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.75e15Initial program 59.0%
div-sub59.0%
+-rgt-identity59.0%
div-sub59.0%
Simplified59.0%
Taylor expanded in x around 0 58.9%
if 1.75e15 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 41.4%
div-sub41.4%
rec-exp41.4%
mul-1-neg41.4%
+-inverses41.4%
Simplified41.4%
Final simplification53.5%
(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 71.7%
Simplified62.7%
Taylor expanded in eps around 0 14.3%
div-sub14.3%
rec-exp14.3%
mul-1-neg14.3%
+-inverses14.5%
Simplified14.5%
Final simplification14.5%
herbie shell --seed 2023171
(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))