
(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 11 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
(let* ((t_0 (* (+ 1.0 x) (exp (- x)))))
(if (<= eps 0.032)
(/ (+ t_0 t_0) 2.0)
(/ (+ (exp (* eps x)) (exp (* x (- -1.0 eps)))) 2.0))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = (1.0 + x) * exp(-x);
double tmp;
if (eps <= 0.032) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (exp((eps * x)) + exp((x * (-1.0 - 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 + x) * exp(-x)
if (eps <= 0.032d0) then
tmp = (t_0 + t_0) / 2.0d0
else
tmp = (exp((eps * x)) + exp((x * ((-1.0d0) - 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 + x) * Math.exp(-x);
double tmp;
if (eps <= 0.032) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (Math.exp((eps * x)) + Math.exp((x * (-1.0 - eps)))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = (1.0 + x) * math.exp(-x) tmp = 0 if eps <= 0.032: tmp = (t_0 + t_0) / 2.0 else: tmp = (math.exp((eps * x)) + math.exp((x * (-1.0 - eps)))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = Float64(Float64(1.0 + x) * exp(Float64(-x))) tmp = 0.0 if (eps <= 0.032) tmp = Float64(Float64(t_0 + t_0) / 2.0); else tmp = Float64(Float64(exp(Float64(eps * x)) + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = (1.0 + x) * exp(-x); tmp = 0.0; if (eps <= 0.032) tmp = (t_0 + t_0) / 2.0; else tmp = (exp((eps * x)) + exp((x * (-1.0 - 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 + x), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, 0.032], N[(N[(t$95$0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(eps * x), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := \left(1 + x\right) \cdot e^{-x}\\
\mathbf{if}\;\varepsilon \leq 0.032:\\
\;\;\;\;\frac{t_0 + t_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\varepsilon \cdot x} + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}\\
\end{array}
\end{array}
if eps < 0.032000000000000001Initial program 61.4%
div-sub61.4%
+-rgt-identity61.4%
div-sub61.4%
Simplified61.4%
Taylor expanded in eps around 0 76.8%
*-commutative76.8%
distribute-lft1-in76.8%
neg-mul-176.8%
distribute-lft-out76.8%
mul-1-neg76.8%
*-commutative76.8%
distribute-lft1-in76.8%
neg-mul-176.8%
Simplified76.8%
if 0.032000000000000001 < eps Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around -inf 100.0%
associate-*r*100.0%
mul-1-neg100.0%
sub-neg100.0%
mul-1-neg100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
mul-1-neg100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
Final simplification84.1%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= eps 1.55e-13) (/ (* 2.0 (exp (- x))) 2.0) (/ (+ (exp (* eps x)) (exp (* x (- -1.0 eps)))) 2.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (eps <= 1.55e-13) {
tmp = (2.0 * exp(-x)) / 2.0;
} else {
tmp = (exp((eps * x)) + exp((x * (-1.0 - 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 (eps <= 1.55d-13) then
tmp = (2.0d0 * exp(-x)) / 2.0d0
else
tmp = (exp((eps * x)) + exp((x * ((-1.0d0) - eps)))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (eps <= 1.55e-13) {
tmp = (2.0 * Math.exp(-x)) / 2.0;
} else {
tmp = (Math.exp((eps * x)) + Math.exp((x * (-1.0 - eps)))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if eps <= 1.55e-13: tmp = (2.0 * math.exp(-x)) / 2.0 else: tmp = (math.exp((eps * x)) + math.exp((x * (-1.0 - eps)))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (eps <= 1.55e-13) tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(exp(Float64(eps * x)) + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 1.55e-13) tmp = (2.0 * exp(-x)) / 2.0; else tmp = (exp((eps * x)) + exp((x * (-1.0 - eps)))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[eps, 1.55e-13], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(eps * x), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 1.55 \cdot 10^{-13}:\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\varepsilon \cdot x} + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}\\
\end{array}
\end{array}
if eps < 1.55e-13Initial program 61.6%
div-sub61.6%
+-rgt-identity61.6%
div-sub61.6%
Simplified61.6%
Taylor expanded in eps around inf 99.1%
Taylor expanded in eps around 0 79.8%
cancel-sign-sub-inv79.8%
metadata-eval79.8%
distribute-rgt1-in79.8%
metadata-eval79.8%
neg-mul-179.8%
Simplified79.8%
if 1.55e-13 < eps Initial program 99.2%
div-sub99.2%
+-rgt-identity99.2%
div-sub99.2%
Simplified99.2%
Taylor expanded in eps around inf 98.8%
Taylor expanded in eps around -inf 98.8%
associate-*r*98.8%
mul-1-neg98.8%
sub-neg98.8%
mul-1-neg98.8%
distribute-lft-neg-in98.8%
distribute-rgt-neg-in98.8%
mul-1-neg98.8%
mul-1-neg98.8%
*-commutative98.8%
mul-1-neg98.8%
Simplified98.8%
Taylor expanded in eps around inf 98.8%
Taylor expanded in eps around inf 98.8%
Final simplification85.9%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (/ (+ (exp (* x (+ eps -1.0))) (exp (* x (- -1.0 eps)))) 2.0))
eps = abs(eps);
double code(double x, double eps) {
return (exp((x * (eps + -1.0))) + exp((x * (-1.0 - eps)))) / 2.0;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (exp((x * (eps + (-1.0d0)))) + exp((x * ((-1.0d0) - eps)))) / 2.0d0
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
return (Math.exp((x * (eps + -1.0))) + Math.exp((x * (-1.0 - eps)))) / 2.0;
}
eps = abs(eps) def code(x, eps): return (math.exp((x * (eps + -1.0))) + math.exp((x * (-1.0 - eps)))) / 2.0
eps = abs(eps) function code(x, eps) return Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0) end
eps = abs(eps) function tmp = code(x, eps) tmp = (exp((x * (eps + -1.0))) + exp((x * (-1.0 - eps)))) / 2.0; end
NOTE: eps should be positive before calling this function code[x_, eps_] := N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps = |eps|\\
\\
\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}
\end{array}
Initial program 73.6%
div-sub73.6%
+-rgt-identity73.6%
div-sub73.6%
Simplified73.6%
Taylor expanded in eps around inf 99.0%
Taylor expanded in eps around -inf 99.0%
associate-*r*99.0%
mul-1-neg99.0%
sub-neg99.0%
mul-1-neg99.0%
distribute-lft-neg-in99.0%
distribute-rgt-neg-in99.0%
mul-1-neg99.0%
mul-1-neg99.0%
*-commutative99.0%
mul-1-neg99.0%
Simplified99.0%
Final simplification99.0%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (- (exp (* x (+ eps -1.0))) -1.0) 2.0))
(t_1 (/ (* 2.0 (exp (- x))) 2.0)))
(if (<= x -2e-250)
(/ (+ 1.0 (exp (* x (- -1.0 eps)))) 2.0)
(if (<= x 190000000000.0)
(/ (- (exp (* eps x)) -1.0) 2.0)
(if (<= x 6e+95)
t_1
(if (<= x 1.1e+132)
t_0
(if (<= x 1.3e+157) 0.0 (if (<= x 5.5e+181) t_0 t_1))))))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = (exp((x * (eps + -1.0))) - -1.0) / 2.0;
double t_1 = (2.0 * exp(-x)) / 2.0;
double tmp;
if (x <= -2e-250) {
tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0;
} else if (x <= 190000000000.0) {
tmp = (exp((eps * x)) - -1.0) / 2.0;
} else if (x <= 6e+95) {
tmp = t_1;
} else if (x <= 1.1e+132) {
tmp = t_0;
} else if (x <= 1.3e+157) {
tmp = 0.0;
} else if (x <= 5.5e+181) {
tmp = t_0;
} else {
tmp = t_1;
}
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) :: tmp
t_0 = (exp((x * (eps + (-1.0d0)))) - (-1.0d0)) / 2.0d0
t_1 = (2.0d0 * exp(-x)) / 2.0d0
if (x <= (-2d-250)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps)))) / 2.0d0
else if (x <= 190000000000.0d0) then
tmp = (exp((eps * x)) - (-1.0d0)) / 2.0d0
else if (x <= 6d+95) then
tmp = t_1
else if (x <= 1.1d+132) then
tmp = t_0
else if (x <= 1.3d+157) then
tmp = 0.0d0
else if (x <= 5.5d+181) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = (Math.exp((x * (eps + -1.0))) - -1.0) / 2.0;
double t_1 = (2.0 * Math.exp(-x)) / 2.0;
double tmp;
if (x <= -2e-250) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps)))) / 2.0;
} else if (x <= 190000000000.0) {
tmp = (Math.exp((eps * x)) - -1.0) / 2.0;
} else if (x <= 6e+95) {
tmp = t_1;
} else if (x <= 1.1e+132) {
tmp = t_0;
} else if (x <= 1.3e+157) {
tmp = 0.0;
} else if (x <= 5.5e+181) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = (math.exp((x * (eps + -1.0))) - -1.0) / 2.0 t_1 = (2.0 * math.exp(-x)) / 2.0 tmp = 0 if x <= -2e-250: tmp = (1.0 + math.exp((x * (-1.0 - eps)))) / 2.0 elif x <= 190000000000.0: tmp = (math.exp((eps * x)) - -1.0) / 2.0 elif x <= 6e+95: tmp = t_1 elif x <= 1.1e+132: tmp = t_0 elif x <= 1.3e+157: tmp = 0.0 elif x <= 5.5e+181: tmp = t_0 else: tmp = t_1 return tmp
eps = abs(eps) function code(x, eps) t_0 = Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) - -1.0) / 2.0) t_1 = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0) tmp = 0.0 if (x <= -2e-250) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0); elseif (x <= 190000000000.0) tmp = Float64(Float64(exp(Float64(eps * x)) - -1.0) / 2.0); elseif (x <= 6e+95) tmp = t_1; elseif (x <= 1.1e+132) tmp = t_0; elseif (x <= 1.3e+157) tmp = 0.0; elseif (x <= 5.5e+181) tmp = t_0; else tmp = t_1; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = (exp((x * (eps + -1.0))) - -1.0) / 2.0; t_1 = (2.0 * exp(-x)) / 2.0; tmp = 0.0; if (x <= -2e-250) tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0; elseif (x <= 190000000000.0) tmp = (exp((eps * x)) - -1.0) / 2.0; elseif (x <= 6e+95) tmp = t_1; elseif (x <= 1.1e+132) tmp = t_0; elseif (x <= 1.3e+157) tmp = 0.0; elseif (x <= 5.5e+181) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -2e-250], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 190000000000.0], N[(N[(N[Exp[N[(eps * x), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 6e+95], t$95$1, If[LessEqual[x, 1.1e+132], t$95$0, If[LessEqual[x, 1.3e+157], 0.0, If[LessEqual[x, 5.5e+181], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := \frac{e^{x \cdot \left(\varepsilon + -1\right)} - -1}{2}\\
t_1 := \frac{2 \cdot e^{-x}}{2}\\
\mathbf{if}\;x \leq -2 \cdot 10^{-250}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 190000000000:\\
\;\;\;\;\frac{e^{\varepsilon \cdot x} - -1}{2}\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+95}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+132}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+157}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+181}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -2.0000000000000001e-250Initial program 74.4%
div-sub74.4%
+-rgt-identity74.4%
div-sub74.4%
Simplified74.4%
Taylor expanded in x around 0 54.8%
Taylor expanded in eps around inf 79.3%
mul-1-neg79.3%
exp-prod79.3%
+-commutative79.3%
remove-double-neg79.3%
mul-1-neg79.3%
sub-neg79.3%
exp-prod79.3%
associate-*r*79.3%
cancel-sign-sub-inv79.3%
metadata-eval79.3%
*-lft-identity79.3%
distribute-lft-in79.3%
metadata-eval79.3%
mul-1-neg79.3%
Simplified79.3%
if -2.0000000000000001e-250 < x < 1.9e11Initial program 53.1%
div-sub53.1%
+-rgt-identity53.1%
div-sub53.1%
Simplified53.1%
Taylor expanded in eps around inf 98.8%
Taylor expanded in eps around -inf 98.8%
associate-*r*98.8%
mul-1-neg98.8%
sub-neg98.8%
mul-1-neg98.8%
distribute-lft-neg-in98.8%
distribute-rgt-neg-in98.8%
mul-1-neg98.8%
mul-1-neg98.8%
*-commutative98.8%
mul-1-neg98.8%
Simplified98.8%
Taylor expanded in eps around inf 97.7%
Taylor expanded in x around 0 83.3%
if 1.9e11 < x < 5.99999999999999982e95 or 5.49999999999999991e181 < x Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 76.5%
cancel-sign-sub-inv76.5%
metadata-eval76.5%
distribute-rgt1-in76.5%
metadata-eval76.5%
neg-mul-176.5%
Simplified76.5%
if 5.99999999999999982e95 < x < 1.09999999999999994e132 or 1.30000000000000005e157 < x < 5.49999999999999991e181Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around -inf 100.0%
associate-*r*100.0%
mul-1-neg100.0%
sub-neg100.0%
mul-1-neg100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
mul-1-neg100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 35.4%
if 1.09999999999999994e132 < x < 1.30000000000000005e157Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
div-sub100.0%
rec-exp100.0%
neg-mul-1100.0%
+-inverses100.0%
Simplified100.0%
Final simplification78.0%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (- (exp (* eps x)) -1.0) 2.0))
(t_1 (/ (* 2.0 (exp (- x))) 2.0)))
(if (<= x -5e-250)
(/ (+ 1.0 (exp (* x (- -1.0 eps)))) 2.0)
(if (<= x 15500000000000.0)
t_0
(if (<= x 1.3e+96)
t_1
(if (<= x 4.4e+132)
t_0
(if (<= x 2.5e+157) 0.0 (if (<= x 7e+179) t_0 t_1))))))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = (exp((eps * x)) - -1.0) / 2.0;
double t_1 = (2.0 * exp(-x)) / 2.0;
double tmp;
if (x <= -5e-250) {
tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0;
} else if (x <= 15500000000000.0) {
tmp = t_0;
} else if (x <= 1.3e+96) {
tmp = t_1;
} else if (x <= 4.4e+132) {
tmp = t_0;
} else if (x <= 2.5e+157) {
tmp = 0.0;
} else if (x <= 7e+179) {
tmp = t_0;
} else {
tmp = t_1;
}
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) :: tmp
t_0 = (exp((eps * x)) - (-1.0d0)) / 2.0d0
t_1 = (2.0d0 * exp(-x)) / 2.0d0
if (x <= (-5d-250)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps)))) / 2.0d0
else if (x <= 15500000000000.0d0) then
tmp = t_0
else if (x <= 1.3d+96) then
tmp = t_1
else if (x <= 4.4d+132) then
tmp = t_0
else if (x <= 2.5d+157) then
tmp = 0.0d0
else if (x <= 7d+179) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = (Math.exp((eps * x)) - -1.0) / 2.0;
double t_1 = (2.0 * Math.exp(-x)) / 2.0;
double tmp;
if (x <= -5e-250) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps)))) / 2.0;
} else if (x <= 15500000000000.0) {
tmp = t_0;
} else if (x <= 1.3e+96) {
tmp = t_1;
} else if (x <= 4.4e+132) {
tmp = t_0;
} else if (x <= 2.5e+157) {
tmp = 0.0;
} else if (x <= 7e+179) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = (math.exp((eps * x)) - -1.0) / 2.0 t_1 = (2.0 * math.exp(-x)) / 2.0 tmp = 0 if x <= -5e-250: tmp = (1.0 + math.exp((x * (-1.0 - eps)))) / 2.0 elif x <= 15500000000000.0: tmp = t_0 elif x <= 1.3e+96: tmp = t_1 elif x <= 4.4e+132: tmp = t_0 elif x <= 2.5e+157: tmp = 0.0 elif x <= 7e+179: tmp = t_0 else: tmp = t_1 return tmp
eps = abs(eps) function code(x, eps) t_0 = Float64(Float64(exp(Float64(eps * x)) - -1.0) / 2.0) t_1 = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0) tmp = 0.0 if (x <= -5e-250) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0); elseif (x <= 15500000000000.0) tmp = t_0; elseif (x <= 1.3e+96) tmp = t_1; elseif (x <= 4.4e+132) tmp = t_0; elseif (x <= 2.5e+157) tmp = 0.0; elseif (x <= 7e+179) tmp = t_0; else tmp = t_1; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = (exp((eps * x)) - -1.0) / 2.0; t_1 = (2.0 * exp(-x)) / 2.0; tmp = 0.0; if (x <= -5e-250) tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0; elseif (x <= 15500000000000.0) tmp = t_0; elseif (x <= 1.3e+96) tmp = t_1; elseif (x <= 4.4e+132) tmp = t_0; elseif (x <= 2.5e+157) tmp = 0.0; elseif (x <= 7e+179) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[(N[(N[Exp[N[(eps * x), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -5e-250], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 15500000000000.0], t$95$0, If[LessEqual[x, 1.3e+96], t$95$1, If[LessEqual[x, 4.4e+132], t$95$0, If[LessEqual[x, 2.5e+157], 0.0, If[LessEqual[x, 7e+179], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := \frac{e^{\varepsilon \cdot x} - -1}{2}\\
t_1 := \frac{2 \cdot e^{-x}}{2}\\
\mathbf{if}\;x \leq -5 \cdot 10^{-250}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 15500000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+96}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{+132}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+157}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 7 \cdot 10^{+179}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -5.00000000000000027e-250Initial program 74.4%
div-sub74.4%
+-rgt-identity74.4%
div-sub74.4%
Simplified74.4%
Taylor expanded in x around 0 54.8%
Taylor expanded in eps around inf 79.3%
mul-1-neg79.3%
exp-prod79.3%
+-commutative79.3%
remove-double-neg79.3%
mul-1-neg79.3%
sub-neg79.3%
exp-prod79.3%
associate-*r*79.3%
cancel-sign-sub-inv79.3%
metadata-eval79.3%
*-lft-identity79.3%
distribute-lft-in79.3%
metadata-eval79.3%
mul-1-neg79.3%
Simplified79.3%
if -5.00000000000000027e-250 < x < 1.55e13 or 1.3e96 < x < 4.39999999999999977e132 or 2.49999999999999988e157 < x < 7.0000000000000003e179Initial program 59.1%
div-sub59.1%
+-rgt-identity59.1%
div-sub59.1%
Simplified59.1%
Taylor expanded in eps around inf 98.9%
Taylor expanded in eps around -inf 98.9%
associate-*r*98.9%
mul-1-neg98.9%
sub-neg98.9%
mul-1-neg98.9%
distribute-lft-neg-in98.9%
distribute-rgt-neg-in98.9%
mul-1-neg98.9%
mul-1-neg98.9%
*-commutative98.9%
mul-1-neg98.9%
Simplified98.9%
Taylor expanded in eps around inf 97.0%
Taylor expanded in x around 0 76.8%
if 1.55e13 < x < 1.3e96 or 7.0000000000000003e179 < x Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 75.4%
cancel-sign-sub-inv75.4%
metadata-eval75.4%
distribute-rgt1-in75.4%
metadata-eval75.4%
neg-mul-175.4%
Simplified75.4%
if 4.39999999999999977e132 < x < 2.49999999999999988e157Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
div-sub100.0%
rec-exp100.0%
neg-mul-1100.0%
+-inverses100.0%
Simplified100.0%
Final simplification78.0%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= eps 1.25e+74) (/ (* 2.0 (exp (- x))) 2.0) (/ (- (exp (* eps x)) -1.0) 2.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (eps <= 1.25e+74) {
tmp = (2.0 * exp(-x)) / 2.0;
} else {
tmp = (exp((eps * x)) - -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 (eps <= 1.25d+74) then
tmp = (2.0d0 * exp(-x)) / 2.0d0
else
tmp = (exp((eps * x)) - (-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 (eps <= 1.25e+74) {
tmp = (2.0 * Math.exp(-x)) / 2.0;
} else {
tmp = (Math.exp((eps * x)) - -1.0) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if eps <= 1.25e+74: tmp = (2.0 * math.exp(-x)) / 2.0 else: tmp = (math.exp((eps * x)) - -1.0) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (eps <= 1.25e+74) tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(exp(Float64(eps * x)) - -1.0) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 1.25e+74) tmp = (2.0 * exp(-x)) / 2.0; else tmp = (exp((eps * x)) - -1.0) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[eps, 1.25e+74], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(eps * x), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 1.25 \cdot 10^{+74}:\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\varepsilon \cdot x} - -1}{2}\\
\end{array}
\end{array}
if eps < 1.24999999999999991e74Initial program 66.1%
div-sub66.1%
+-rgt-identity66.1%
div-sub66.1%
Simplified66.1%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around 0 79.9%
cancel-sign-sub-inv79.9%
metadata-eval79.9%
distribute-rgt1-in79.9%
metadata-eval79.9%
neg-mul-179.9%
Simplified79.9%
if 1.24999999999999991e74 < eps Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around -inf 100.0%
associate-*r*100.0%
mul-1-neg100.0%
sub-neg100.0%
mul-1-neg100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
mul-1-neg100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 52.5%
Final simplification73.8%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (/ (* 2.0 (exp (- x))) 2.0))
eps = abs(eps);
double code(double x, double eps) {
return (2.0 * exp(-x)) / 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 * exp(-x)) / 2.0d0
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
return (2.0 * Math.exp(-x)) / 2.0;
}
eps = abs(eps) def code(x, eps): return (2.0 * math.exp(-x)) / 2.0
eps = abs(eps) function code(x, eps) return Float64(Float64(2.0 * exp(Float64(-x))) / 2.0) end
eps = abs(eps) function tmp = code(x, eps) tmp = (2.0 * exp(-x)) / 2.0; end
NOTE: eps should be positive before calling this function code[x_, eps_] := N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps = |eps|\\
\\
\frac{2 \cdot e^{-x}}{2}
\end{array}
Initial program 73.6%
div-sub73.6%
+-rgt-identity73.6%
div-sub73.6%
Simplified73.6%
Taylor expanded in eps around inf 99.0%
Taylor expanded in eps around 0 73.6%
cancel-sign-sub-inv73.6%
metadata-eval73.6%
distribute-rgt1-in73.6%
metadata-eval73.6%
neg-mul-173.6%
Simplified73.6%
Final simplification73.6%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ -1.0 (/ 1.0 eps))) (t_1 (* (* x (- -1.0 eps)) t_0)))
(if (<= x -6e+123)
(/ (- 2.0 (* eps x)) 2.0)
(if (<= x -3.55e-15)
(/ (/ (+ 4.0 (* (* (* x (+ 1.0 eps)) t_0) t_1)) (+ 2.0 t_1)) 2.0)
(if (<= x 10500.0) 1.0 0.0)))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = -1.0 + (1.0 / eps);
double t_1 = (x * (-1.0 - eps)) * t_0;
double tmp;
if (x <= -6e+123) {
tmp = (2.0 - (eps * x)) / 2.0;
} else if (x <= -3.55e-15) {
tmp = ((4.0 + (((x * (1.0 + eps)) * t_0) * t_1)) / (2.0 + t_1)) / 2.0;
} else if (x <= 10500.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-1.0d0) + (1.0d0 / eps)
t_1 = (x * ((-1.0d0) - eps)) * t_0
if (x <= (-6d+123)) then
tmp = (2.0d0 - (eps * x)) / 2.0d0
else if (x <= (-3.55d-15)) then
tmp = ((4.0d0 + (((x * (1.0d0 + eps)) * t_0) * t_1)) / (2.0d0 + t_1)) / 2.0d0
else if (x <= 10500.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = -1.0 + (1.0 / eps);
double t_1 = (x * (-1.0 - eps)) * t_0;
double tmp;
if (x <= -6e+123) {
tmp = (2.0 - (eps * x)) / 2.0;
} else if (x <= -3.55e-15) {
tmp = ((4.0 + (((x * (1.0 + eps)) * t_0) * t_1)) / (2.0 + t_1)) / 2.0;
} else if (x <= 10500.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = -1.0 + (1.0 / eps) t_1 = (x * (-1.0 - eps)) * t_0 tmp = 0 if x <= -6e+123: tmp = (2.0 - (eps * x)) / 2.0 elif x <= -3.55e-15: tmp = ((4.0 + (((x * (1.0 + eps)) * t_0) * t_1)) / (2.0 + t_1)) / 2.0 elif x <= 10500.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = Float64(-1.0 + Float64(1.0 / eps)) t_1 = Float64(Float64(x * Float64(-1.0 - eps)) * t_0) tmp = 0.0 if (x <= -6e+123) tmp = Float64(Float64(2.0 - Float64(eps * x)) / 2.0); elseif (x <= -3.55e-15) tmp = Float64(Float64(Float64(4.0 + Float64(Float64(Float64(x * Float64(1.0 + eps)) * t_0) * t_1)) / Float64(2.0 + t_1)) / 2.0); elseif (x <= 10500.0) tmp = 1.0; else tmp = 0.0; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = -1.0 + (1.0 / eps); t_1 = (x * (-1.0 - eps)) * t_0; tmp = 0.0; if (x <= -6e+123) tmp = (2.0 - (eps * x)) / 2.0; elseif (x <= -3.55e-15) tmp = ((4.0 + (((x * (1.0 + eps)) * t_0) * t_1)) / (2.0 + t_1)) / 2.0; elseif (x <= 10500.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[(-1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[x, -6e+123], N[(N[(2.0 - N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -3.55e-15], N[(N[(N[(4.0 + N[(N[(N[(x * N[(1.0 + eps), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(2.0 + t$95$1), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 10500.0], 1.0, 0.0]]]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := -1 + \frac{1}{\varepsilon}\\
t_1 := \left(x \cdot \left(-1 - \varepsilon\right)\right) \cdot t_0\\
\mathbf{if}\;x \leq -6 \cdot 10^{+123}:\\
\;\;\;\;\frac{2 - \varepsilon \cdot x}{2}\\
\mathbf{elif}\;x \leq -3.55 \cdot 10^{-15}:\\
\;\;\;\;\frac{\frac{4 + \left(\left(x \cdot \left(1 + \varepsilon\right)\right) \cdot t_0\right) \cdot t_1}{2 + t_1}}{2}\\
\mathbf{elif}\;x \leq 10500:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -6.00000000000000016e123Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 84.7%
Taylor expanded in x around 0 69.4%
Taylor expanded in eps around inf 69.4%
associate-+r+69.4%
metadata-eval69.4%
associate-*r*69.4%
neg-mul-169.4%
*-commutative69.4%
associate-+r+69.4%
+-commutative69.4%
distribute-lft1-in69.4%
metadata-eval69.4%
mul0-lft69.4%
Simplified69.4%
if -6.00000000000000016e123 < x < -3.5500000000000001e-15Initial program 92.0%
div-sub92.0%
+-rgt-identity92.0%
div-sub92.0%
Simplified92.0%
Taylor expanded in x around 0 61.5%
Taylor expanded in x around 0 9.0%
flip-+26.9%
metadata-eval26.9%
sub-neg26.9%
metadata-eval26.9%
*-commutative26.9%
*-commutative26.9%
+-commutative26.9%
sub-neg26.9%
metadata-eval26.9%
*-commutative26.9%
*-commutative26.9%
+-commutative26.9%
Applied egg-rr26.9%
if -3.5500000000000001e-15 < x < 10500Initial program 55.8%
div-sub55.8%
+-rgt-identity55.8%
div-sub55.8%
Simplified55.8%
Taylor expanded in x around 0 74.2%
if 10500 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 63.8%
div-sub63.8%
rec-exp63.8%
neg-mul-163.8%
+-inverses63.8%
Simplified63.8%
Final simplification67.4%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= x 235.0) (/ (- 2.0 (* eps x)) 2.0) 0.0))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 235.0) {
tmp = (2.0 - (eps * x)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 235.0d0) then
tmp = (2.0d0 - (eps * x)) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 235.0) {
tmp = (2.0 - (eps * x)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 235.0: tmp = (2.0 - (eps * x)) / 2.0 else: tmp = 0.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 235.0) tmp = Float64(Float64(2.0 - Float64(eps * x)) / 2.0); else tmp = 0.0; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 235.0) tmp = (2.0 - (eps * x)) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 235.0], N[(N[(2.0 - N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 235:\\
\;\;\;\;\frac{2 - \varepsilon \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 235Initial program 63.9%
div-sub63.9%
+-rgt-identity63.9%
div-sub63.9%
Simplified63.9%
Taylor expanded in x around 0 49.9%
Taylor expanded in x around 0 47.4%
Taylor expanded in eps around inf 67.0%
associate-+r+67.0%
metadata-eval67.0%
associate-*r*67.0%
neg-mul-167.0%
*-commutative67.0%
associate-+r+67.0%
+-commutative67.0%
distribute-lft1-in67.0%
metadata-eval67.0%
mul0-lft67.0%
Simplified67.0%
if 235 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 62.9%
div-sub62.9%
rec-exp62.9%
neg-mul-162.9%
+-inverses62.9%
Simplified62.9%
Final simplification65.9%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= x 10500.0) 1.0 0.0))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 10500.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 10500.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 10500.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 10500.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 10500.0) tmp = 1.0; else tmp = 0.0; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 10500.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 10500.0], 1.0, 0.0]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10500:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 10500Initial program 64.1%
div-sub64.1%
+-rgt-identity64.1%
div-sub64.1%
Simplified64.1%
Taylor expanded in x around 0 59.9%
if 10500 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 63.8%
div-sub63.8%
rec-exp63.8%
neg-mul-163.8%
+-inverses63.8%
Simplified63.8%
Final simplification61.0%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 0.0)
eps = abs(eps);
double code(double x, double eps) {
return 0.0;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 0.0d0
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
return 0.0;
}
eps = abs(eps) def code(x, eps): return 0.0
eps = abs(eps) function code(x, eps) return 0.0 end
eps = abs(eps) function tmp = code(x, eps) tmp = 0.0; end
NOTE: eps should be positive before calling this function code[x_, eps_] := 0.0
\begin{array}{l}
eps = |eps|\\
\\
0
\end{array}
Initial program 73.6%
Simplified67.0%
Taylor expanded in eps around 0 18.6%
div-sub18.6%
rec-exp18.6%
neg-mul-118.6%
+-inverses18.8%
Simplified18.8%
Final simplification18.8%
herbie shell --seed 2023257
(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))