
(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}
(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 72.0%
div-sub72.0%
+-rgt-identity72.0%
div-sub72.0%
Simplified72.0%
Taylor expanded in eps around inf 99.7%
mul-1-neg99.7%
*-commutative99.7%
mul-1-neg99.7%
exp-prod99.7%
+-commutative99.7%
remove-double-neg99.7%
mul-1-neg99.7%
sub-neg99.7%
exp-prod99.7%
mul-1-neg99.7%
*-commutative99.7%
sub-neg99.7%
mul-1-neg99.7%
remove-double-neg99.7%
distribute-rgt-neg-in99.7%
+-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (* x (- eps)))))
(if (<= x 7.2e+18)
(/ (+ (exp (* x eps)) t_0) 2.0)
(if (<= x 1.22e+84) 0.0 (/ (+ (exp (- (* x eps) x)) t_0) 2.0)))))
double code(double x, double eps) {
double t_0 = exp((x * -eps));
double tmp;
if (x <= 7.2e+18) {
tmp = (exp((x * eps)) + t_0) / 2.0;
} else if (x <= 1.22e+84) {
tmp = 0.0;
} else {
tmp = (exp(((x * eps) - x)) + 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 = exp((x * -eps))
if (x <= 7.2d+18) then
tmp = (exp((x * eps)) + t_0) / 2.0d0
else if (x <= 1.22d+84) then
tmp = 0.0d0
else
tmp = (exp(((x * eps) - x)) + t_0) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.exp((x * -eps));
double tmp;
if (x <= 7.2e+18) {
tmp = (Math.exp((x * eps)) + t_0) / 2.0;
} else if (x <= 1.22e+84) {
tmp = 0.0;
} else {
tmp = (Math.exp(((x * eps) - x)) + t_0) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = math.exp((x * -eps)) tmp = 0 if x <= 7.2e+18: tmp = (math.exp((x * eps)) + t_0) / 2.0 elif x <= 1.22e+84: tmp = 0.0 else: tmp = (math.exp(((x * eps) - x)) + t_0) / 2.0 return tmp
function code(x, eps) t_0 = exp(Float64(x * Float64(-eps))) tmp = 0.0 if (x <= 7.2e+18) tmp = Float64(Float64(exp(Float64(x * eps)) + t_0) / 2.0); elseif (x <= 1.22e+84) tmp = 0.0; else tmp = Float64(Float64(exp(Float64(Float64(x * eps) - x)) + t_0) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = exp((x * -eps)); tmp = 0.0; if (x <= 7.2e+18) tmp = (exp((x * eps)) + t_0) / 2.0; elseif (x <= 1.22e+84) tmp = 0.0; else tmp = (exp(((x * eps) - x)) + t_0) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 7.2e+18], N[(N[(N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.22e+84], 0.0, N[(N[(N[Exp[N[(N[(x * eps), $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(-\varepsilon\right)}\\
\mathbf{if}\;x \leq 7.2 \cdot 10^{+18}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon} + t_0}{2}\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{+84}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon - x} + t_0}{2}\\
\end{array}
\end{array}
if x < 7.2e18Initial program 62.1%
div-sub62.1%
+-rgt-identity62.1%
div-sub62.1%
Simplified62.1%
Taylor expanded in eps around inf 99.6%
mul-1-neg99.6%
*-commutative99.6%
mul-1-neg99.6%
exp-prod99.6%
+-commutative99.6%
remove-double-neg99.6%
mul-1-neg99.6%
sub-neg99.6%
exp-prod99.6%
mul-1-neg99.6%
*-commutative99.6%
sub-neg99.6%
mul-1-neg99.6%
remove-double-neg99.6%
distribute-rgt-neg-in99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in eps around inf 99.2%
associate-*r*99.2%
neg-mul-199.2%
Simplified99.2%
Taylor expanded in x around inf 99.2%
Taylor expanded in eps around inf 99.5%
*-commutative99.5%
Simplified99.5%
if 7.2e18 < x < 1.2200000000000001e84Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 80.3%
div-sub80.3%
rec-exp80.3%
mul-1-neg80.3%
+-inverses80.3%
Simplified80.3%
if 1.2200000000000001e84 < x Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
mul-1-neg100.0%
exp-prod100.0%
+-commutative100.0%
remove-double-neg100.0%
mul-1-neg100.0%
sub-neg100.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 64.7%
associate-*r*64.7%
neg-mul-164.7%
Simplified64.7%
Taylor expanded in x around inf 64.7%
Final simplification91.6%
(FPCore (x eps)
:precision binary64
(if (<= x 7.2e+17)
(/ (+ (exp (* x eps)) (exp (* x (- eps)))) 2.0)
(if (<= x 3e+84)
0.0
(if (<= x 3.3e+213) (/ (+ 1.0 (exp (- (* x eps) x))) 2.0) 0.0))))
double code(double x, double eps) {
double tmp;
if (x <= 7.2e+17) {
tmp = (exp((x * eps)) + exp((x * -eps))) / 2.0;
} else if (x <= 3e+84) {
tmp = 0.0;
} else if (x <= 3.3e+213) {
tmp = (1.0 + exp(((x * eps) - 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 <= 7.2d+17) then
tmp = (exp((x * eps)) + exp((x * -eps))) / 2.0d0
else if (x <= 3d+84) then
tmp = 0.0d0
else if (x <= 3.3d+213) then
tmp = (1.0d0 + exp(((x * eps) - 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 <= 7.2e+17) {
tmp = (Math.exp((x * eps)) + Math.exp((x * -eps))) / 2.0;
} else if (x <= 3e+84) {
tmp = 0.0;
} else if (x <= 3.3e+213) {
tmp = (1.0 + Math.exp(((x * eps) - x))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 7.2e+17: tmp = (math.exp((x * eps)) + math.exp((x * -eps))) / 2.0 elif x <= 3e+84: tmp = 0.0 elif x <= 3.3e+213: tmp = (1.0 + math.exp(((x * eps) - x))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 7.2e+17) tmp = Float64(Float64(exp(Float64(x * eps)) + exp(Float64(x * Float64(-eps)))) / 2.0); elseif (x <= 3e+84) tmp = 0.0; elseif (x <= 3.3e+213) tmp = Float64(Float64(1.0 + exp(Float64(Float64(x * eps) - x))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 7.2e+17) tmp = (exp((x * eps)) + exp((x * -eps))) / 2.0; elseif (x <= 3e+84) tmp = 0.0; elseif (x <= 3.3e+213) tmp = (1.0 + exp(((x * eps) - x))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 7.2e+17], N[(N[(N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3e+84], 0.0, If[LessEqual[x, 3.3e+213], N[(N[(1.0 + N[Exp[N[(N[(x * eps), $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.2 \cdot 10^{+17}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon} + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+84}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{+213}:\\
\;\;\;\;\frac{1 + e^{x \cdot \varepsilon - x}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 7.2e17Initial program 62.1%
div-sub62.1%
+-rgt-identity62.1%
div-sub62.1%
Simplified62.1%
Taylor expanded in eps around inf 99.6%
mul-1-neg99.6%
*-commutative99.6%
mul-1-neg99.6%
exp-prod99.6%
+-commutative99.6%
remove-double-neg99.6%
mul-1-neg99.6%
sub-neg99.6%
exp-prod99.6%
mul-1-neg99.6%
*-commutative99.6%
sub-neg99.6%
mul-1-neg99.6%
remove-double-neg99.6%
distribute-rgt-neg-in99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in eps around inf 99.2%
associate-*r*99.2%
neg-mul-199.2%
Simplified99.2%
Taylor expanded in x around inf 99.2%
Taylor expanded in eps around inf 99.5%
*-commutative99.5%
Simplified99.5%
if 7.2e17 < x < 2.99999999999999996e84 or 3.3000000000000001e213 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 70.7%
div-sub70.7%
rec-exp70.7%
mul-1-neg70.7%
+-inverses70.7%
Simplified70.7%
if 2.99999999999999996e84 < x < 3.3000000000000001e213Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 28.6%
Taylor expanded in eps around inf 29.0%
exp-prod29.0%
sub-neg29.0%
neg-mul-129.0%
exp-prod29.0%
+-commutative29.0%
neg-mul-129.0%
*-commutative29.0%
neg-mul-129.0%
sub-neg29.0%
distribute-rgt-neg-in29.0%
Simplified29.0%
Taylor expanded in x around 0 29.0%
sub-neg29.0%
metadata-eval29.0%
*-commutative29.0%
distribute-rgt-in29.0%
neg-mul-129.0%
sub-neg29.0%
Simplified29.0%
Final simplification87.1%
(FPCore (x eps)
:precision binary64
(if (<= x -400.0)
(/ (/ (expm1 (- x)) eps) 2.0)
(if (or (<= x 6.8e+18) (and (not (<= x 3.8e+84)) (<= x 1.4e+217)))
(/ (+ 1.0 (exp (- (* x eps) x))) 2.0)
0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -400.0) {
tmp = (expm1(-x) / eps) / 2.0;
} else if ((x <= 6.8e+18) || (!(x <= 3.8e+84) && (x <= 1.4e+217))) {
tmp = (1.0 + exp(((x * eps) - x))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
public static double code(double x, double eps) {
double tmp;
if (x <= -400.0) {
tmp = (Math.expm1(-x) / eps) / 2.0;
} else if ((x <= 6.8e+18) || (!(x <= 3.8e+84) && (x <= 1.4e+217))) {
tmp = (1.0 + Math.exp(((x * eps) - x))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -400.0: tmp = (math.expm1(-x) / eps) / 2.0 elif (x <= 6.8e+18) or (not (x <= 3.8e+84) and (x <= 1.4e+217)): tmp = (1.0 + math.exp(((x * eps) - x))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -400.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps) / 2.0); elseif ((x <= 6.8e+18) || (!(x <= 3.8e+84) && (x <= 1.4e+217))) tmp = Float64(Float64(1.0 + exp(Float64(Float64(x * eps) - x))) / 2.0); else tmp = 0.0; end return tmp end
code[x_, eps_] := If[LessEqual[x, -400.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 6.8e+18], And[N[Not[LessEqual[x, 3.8e+84]], $MachinePrecision], LessEqual[x, 1.4e+217]]], N[(N[(1.0 + N[Exp[N[(N[(x * eps), $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -400:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{\varepsilon}}{2}\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{+18} \lor \neg \left(x \leq 3.8 \cdot 10^{+84}\right) \land x \leq 1.4 \cdot 10^{+217}:\\
\;\;\;\;\frac{1 + e^{x \cdot \varepsilon - x}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -400Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 66.1%
Taylor expanded in eps around 0 35.0%
expm1-def35.0%
neg-mul-135.0%
Simplified35.0%
if -400 < x < 6.8e18 or 3.8000000000000001e84 < x < 1.39999999999999997e217Initial program 59.9%
div-sub59.9%
+-rgt-identity59.9%
div-sub59.9%
Simplified59.9%
Taylor expanded in x around 0 36.9%
Taylor expanded in eps around inf 77.1%
exp-prod77.1%
sub-neg77.1%
neg-mul-177.1%
exp-prod77.1%
+-commutative77.1%
neg-mul-177.1%
*-commutative77.1%
neg-mul-177.1%
sub-neg77.1%
distribute-rgt-neg-in77.1%
Simplified77.1%
Taylor expanded in x around 0 77.1%
sub-neg77.1%
metadata-eval77.1%
*-commutative77.1%
distribute-rgt-in77.1%
neg-mul-177.1%
sub-neg77.1%
Simplified77.1%
if 6.8e18 < x < 3.8000000000000001e84 or 1.39999999999999997e217 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 70.7%
div-sub70.7%
rec-exp70.7%
mul-1-neg70.7%
+-inverses70.7%
Simplified70.7%
Final simplification69.6%
(FPCore (x eps)
:precision binary64
(if (<= x -4e-307)
(/ (+ 1.0 (exp (* x (- eps)))) 2.0)
(if (or (<= x 2.5e+15) (and (not (<= x 3.65e+84)) (<= x 2.8e+215)))
(/ (+ 1.0 (exp (- (* x eps) x))) 2.0)
0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -4e-307) {
tmp = (1.0 + exp((x * -eps))) / 2.0;
} else if ((x <= 2.5e+15) || (!(x <= 3.65e+84) && (x <= 2.8e+215))) {
tmp = (1.0 + exp(((x * eps) - 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 <= (-4d-307)) then
tmp = (1.0d0 + exp((x * -eps))) / 2.0d0
else if ((x <= 2.5d+15) .or. (.not. (x <= 3.65d+84)) .and. (x <= 2.8d+215)) then
tmp = (1.0d0 + exp(((x * eps) - 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 <= -4e-307) {
tmp = (1.0 + Math.exp((x * -eps))) / 2.0;
} else if ((x <= 2.5e+15) || (!(x <= 3.65e+84) && (x <= 2.8e+215))) {
tmp = (1.0 + Math.exp(((x * eps) - x))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -4e-307: tmp = (1.0 + math.exp((x * -eps))) / 2.0 elif (x <= 2.5e+15) or (not (x <= 3.65e+84) and (x <= 2.8e+215)): tmp = (1.0 + math.exp(((x * eps) - x))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -4e-307) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps)))) / 2.0); elseif ((x <= 2.5e+15) || (!(x <= 3.65e+84) && (x <= 2.8e+215))) tmp = Float64(Float64(1.0 + exp(Float64(Float64(x * eps) - x))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -4e-307) tmp = (1.0 + exp((x * -eps))) / 2.0; elseif ((x <= 2.5e+15) || (~((x <= 3.65e+84)) && (x <= 2.8e+215))) tmp = (1.0 + exp(((x * eps) - x))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -4e-307], N[(N[(1.0 + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 2.5e+15], And[N[Not[LessEqual[x, 3.65e+84]], $MachinePrecision], LessEqual[x, 2.8e+215]]], N[(N[(1.0 + N[Exp[N[(N[(x * eps), $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-307}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+15} \lor \neg \left(x \leq 3.65 \cdot 10^{+84}\right) \land x \leq 2.8 \cdot 10^{+215}:\\
\;\;\;\;\frac{1 + e^{x \cdot \varepsilon - x}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -3.99999999999999964e-307Initial program 72.9%
div-sub72.9%
+-rgt-identity72.9%
div-sub72.9%
Simplified72.9%
Taylor expanded in eps around inf 99.8%
mul-1-neg99.8%
*-commutative99.8%
mul-1-neg99.8%
exp-prod99.8%
+-commutative99.8%
remove-double-neg99.8%
mul-1-neg99.8%
sub-neg99.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%
associate-*r*99.8%
neg-mul-199.8%
Simplified99.8%
Taylor expanded in x around inf 99.8%
Taylor expanded in x around 0 71.3%
if -3.99999999999999964e-307 < x < 2.5e15 or 3.65e84 < x < 2.8e215Initial program 62.5%
div-sub62.5%
+-rgt-identity62.5%
div-sub62.5%
Simplified62.5%
Taylor expanded in x around 0 34.9%
Taylor expanded in eps around inf 72.8%
exp-prod72.8%
sub-neg72.8%
neg-mul-172.8%
exp-prod72.8%
+-commutative72.8%
neg-mul-172.8%
*-commutative72.8%
neg-mul-172.8%
sub-neg72.8%
distribute-rgt-neg-in72.8%
Simplified72.8%
Taylor expanded in x around 0 72.8%
sub-neg72.8%
metadata-eval72.8%
*-commutative72.8%
distribute-rgt-in72.8%
neg-mul-172.8%
sub-neg72.8%
Simplified72.8%
if 2.5e15 < x < 3.65e84 or 2.8e215 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 70.7%
div-sub70.7%
rec-exp70.7%
mul-1-neg70.7%
+-inverses70.7%
Simplified70.7%
Final simplification71.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (- (* x eps) x))))
(if (<= x -1e-297)
(/ (+ 1.0 (exp (* x (- eps)))) 2.0)
(if (<= x 7.6e+19)
(/ (+ t_0 (- 1.0 (* x eps))) 2.0)
(if (<= x 6e+84) 0.0 (if (<= x 8.2e+216) (/ (+ 1.0 t_0) 2.0) 0.0))))))
double code(double x, double eps) {
double t_0 = exp(((x * eps) - x));
double tmp;
if (x <= -1e-297) {
tmp = (1.0 + exp((x * -eps))) / 2.0;
} else if (x <= 7.6e+19) {
tmp = (t_0 + (1.0 - (x * eps))) / 2.0;
} else if (x <= 6e+84) {
tmp = 0.0;
} else if (x <= 8.2e+216) {
tmp = (1.0 + t_0) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = exp(((x * eps) - x))
if (x <= (-1d-297)) then
tmp = (1.0d0 + exp((x * -eps))) / 2.0d0
else if (x <= 7.6d+19) then
tmp = (t_0 + (1.0d0 - (x * eps))) / 2.0d0
else if (x <= 6d+84) then
tmp = 0.0d0
else if (x <= 8.2d+216) then
tmp = (1.0d0 + t_0) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.exp(((x * eps) - x));
double tmp;
if (x <= -1e-297) {
tmp = (1.0 + Math.exp((x * -eps))) / 2.0;
} else if (x <= 7.6e+19) {
tmp = (t_0 + (1.0 - (x * eps))) / 2.0;
} else if (x <= 6e+84) {
tmp = 0.0;
} else if (x <= 8.2e+216) {
tmp = (1.0 + t_0) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): t_0 = math.exp(((x * eps) - x)) tmp = 0 if x <= -1e-297: tmp = (1.0 + math.exp((x * -eps))) / 2.0 elif x <= 7.6e+19: tmp = (t_0 + (1.0 - (x * eps))) / 2.0 elif x <= 6e+84: tmp = 0.0 elif x <= 8.2e+216: tmp = (1.0 + t_0) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) t_0 = exp(Float64(Float64(x * eps) - x)) tmp = 0.0 if (x <= -1e-297) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps)))) / 2.0); elseif (x <= 7.6e+19) tmp = Float64(Float64(t_0 + Float64(1.0 - Float64(x * eps))) / 2.0); elseif (x <= 6e+84) tmp = 0.0; elseif (x <= 8.2e+216) tmp = Float64(Float64(1.0 + t_0) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) t_0 = exp(((x * eps) - x)); tmp = 0.0; if (x <= -1e-297) tmp = (1.0 + exp((x * -eps))) / 2.0; elseif (x <= 7.6e+19) tmp = (t_0 + (1.0 - (x * eps))) / 2.0; elseif (x <= 6e+84) tmp = 0.0; elseif (x <= 8.2e+216) tmp = (1.0 + t_0) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Exp[N[(N[(x * eps), $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1e-297], N[(N[(1.0 + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.6e+19], N[(N[(t$95$0 + N[(1.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 6e+84], 0.0, If[LessEqual[x, 8.2e+216], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{x \cdot \varepsilon - x}\\
\mathbf{if}\;x \leq -1 \cdot 10^{-297}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 7.6 \cdot 10^{+19}:\\
\;\;\;\;\frac{t_0 + \left(1 - x \cdot \varepsilon\right)}{2}\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+84}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{+216}:\\
\;\;\;\;\frac{1 + t_0}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1.00000000000000004e-297Initial program 72.9%
div-sub72.9%
+-rgt-identity72.9%
div-sub72.9%
Simplified72.9%
Taylor expanded in eps around inf 99.8%
mul-1-neg99.8%
*-commutative99.8%
mul-1-neg99.8%
exp-prod99.8%
+-commutative99.8%
remove-double-neg99.8%
mul-1-neg99.8%
sub-neg99.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%
associate-*r*99.8%
neg-mul-199.8%
Simplified99.8%
Taylor expanded in x around inf 99.8%
Taylor expanded in x around 0 71.3%
if -1.00000000000000004e-297 < x < 7.6e19Initial program 49.9%
div-sub49.9%
+-rgt-identity49.9%
div-sub49.9%
Simplified49.9%
Taylor expanded in eps around inf 99.5%
mul-1-neg99.5%
*-commutative99.5%
mul-1-neg99.5%
exp-prod99.5%
+-commutative99.5%
remove-double-neg99.5%
mul-1-neg99.5%
sub-neg99.5%
exp-prod99.5%
mul-1-neg99.5%
*-commutative99.5%
sub-neg99.5%
mul-1-neg99.5%
remove-double-neg99.5%
distribute-rgt-neg-in99.5%
+-commutative99.5%
Simplified99.5%
Taylor expanded in eps around inf 98.5%
associate-*r*98.5%
neg-mul-198.5%
Simplified98.5%
Taylor expanded in x around inf 98.5%
Taylor expanded in eps around 0 88.5%
+-commutative88.5%
mul-1-neg88.5%
unsub-neg88.5%
Simplified88.5%
if 7.6e19 < x < 5.99999999999999992e84 or 8.1999999999999995e216 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 70.7%
div-sub70.7%
rec-exp70.7%
mul-1-neg70.7%
+-inverses70.7%
Simplified70.7%
if 5.99999999999999992e84 < x < 8.1999999999999995e216Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 28.6%
Taylor expanded in eps around inf 29.0%
exp-prod29.0%
sub-neg29.0%
neg-mul-129.0%
exp-prod29.0%
+-commutative29.0%
neg-mul-129.0%
*-commutative29.0%
neg-mul-129.0%
sub-neg29.0%
distribute-rgt-neg-in29.0%
Simplified29.0%
Taylor expanded in x around 0 29.0%
sub-neg29.0%
metadata-eval29.0%
*-commutative29.0%
distribute-rgt-in29.0%
neg-mul-129.0%
sub-neg29.0%
Simplified29.0%
Final simplification72.2%
(FPCore (x eps) :precision binary64 (if (<= x -480.0) (/ (/ (expm1 (- x)) eps) 2.0) (if (<= x 30000000.0) 1.0 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -480.0) {
tmp = (expm1(-x) / eps) / 2.0;
} else if (x <= 30000000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
public static double code(double x, double eps) {
double tmp;
if (x <= -480.0) {
tmp = (Math.expm1(-x) / eps) / 2.0;
} else if (x <= 30000000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -480.0: tmp = (math.expm1(-x) / eps) / 2.0 elif x <= 30000000.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -480.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps) / 2.0); elseif (x <= 30000000.0) tmp = 1.0; else tmp = 0.0; end return tmp end
code[x_, eps_] := If[LessEqual[x, -480.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 30000000.0], 1.0, 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -480:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{\varepsilon}}{2}\\
\mathbf{elif}\;x \leq 30000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -480Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 66.1%
Taylor expanded in eps around 0 35.0%
expm1-def35.0%
neg-mul-135.0%
Simplified35.0%
if -480 < x < 3e7Initial program 51.2%
div-sub51.2%
+-rgt-identity51.2%
div-sub51.2%
Simplified51.2%
Taylor expanded in x around 0 81.6%
if 3e7 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 58.6%
div-sub58.6%
rec-exp58.6%
mul-1-neg58.6%
+-inverses58.6%
Simplified58.6%
Final simplification68.1%
(FPCore (x eps) :precision binary64 (if (<= x 0.00145) (/ (- 2.0 (* x eps)) 2.0) 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 0.00145) {
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 <= 0.00145d0) 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 <= 0.00145) {
tmp = (2.0 - (x * eps)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 0.00145: tmp = (2.0 - (x * eps)) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 0.00145) 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 <= 0.00145) tmp = (2.0 - (x * eps)) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 0.00145], N[(N[(2.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.00145:\\
\;\;\;\;\frac{2 - x \cdot \varepsilon}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 0.00145Initial program 60.8%
div-sub60.8%
+-rgt-identity60.8%
div-sub60.8%
Simplified60.8%
Taylor expanded in x around 0 39.8%
Taylor expanded in x around 0 47.4%
sub-neg47.4%
metadata-eval47.4%
*-commutative47.4%
+-commutative47.4%
distribute-lft1-in47.4%
+-commutative47.4%
Simplified47.4%
Taylor expanded in eps around inf 69.7%
+-commutative69.7%
neg-mul-169.7%
*-rgt-identity69.7%
fma-udef69.7%
mul-1-neg69.7%
unsub-neg69.7%
fma-udef69.7%
*-rgt-identity69.7%
neg-mul-169.7%
distribute-lft1-in69.7%
metadata-eval69.7%
mul0-lft69.7%
neg-sub069.7%
unsub-neg69.7%
*-commutative69.7%
Simplified69.7%
if 0.00145 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 55.5%
div-sub55.5%
rec-exp55.5%
mul-1-neg55.5%
+-inverses55.5%
Simplified55.5%
Final simplification65.6%
(FPCore (x eps) :precision binary64 (if (<= x -1.0) (* x (/ eps -2.0)) (if (<= x 30000000.0) 1.0 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -1.0) {
tmp = x * (eps / -2.0);
} else if (x <= 30000000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = x * (eps / (-2.0d0))
else if (x <= 30000000.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -1.0) {
tmp = x * (eps / -2.0);
} else if (x <= 30000000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -1.0: tmp = x * (eps / -2.0) elif x <= 30000000.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -1.0) tmp = Float64(x * Float64(eps / -2.0)); elseif (x <= 30000000.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -1.0) tmp = x * (eps / -2.0); elseif (x <= 30000000.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -1.0], N[(x * N[(eps / -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 30000000.0], 1.0, 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;x \cdot \frac{\varepsilon}{-2}\\
\mathbf{elif}\;x \leq 30000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1Initial program 100.0%
div-sub100.0%
+-rgt-identity100.0%
div-sub100.0%
Simplified100.0%
Taylor expanded in x around 0 64.6%
Taylor expanded in x around 0 40.6%
Taylor expanded in eps around inf 40.6%
expm1-log1p-u40.6%
expm1-udef40.6%
frac-2neg40.6%
distribute-lft-neg-out40.6%
associate-/l*40.6%
add-sqr-sqrt40.6%
sqrt-unprod66.0%
sqr-neg66.0%
sqrt-unprod20.8%
add-sqr-sqrt20.8%
metadata-eval20.8%
Applied egg-rr20.8%
expm1-def20.8%
expm1-log1p20.9%
associate-/r/20.9%
Simplified20.9%
if -1 < x < 3e7Initial program 50.9%
div-sub50.9%
+-rgt-identity50.9%
div-sub50.9%
Simplified50.9%
Taylor expanded in x around 0 82.1%
if 3e7 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 58.6%
div-sub58.6%
rec-exp58.6%
mul-1-neg58.6%
+-inverses58.6%
Simplified58.6%
Final simplification66.0%
(FPCore (x eps) :precision binary64 (if (<= x 30000000.0) 1.0 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 30000000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 30000000.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 30000000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 30000000.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 30000000.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 30000000.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 30000000.0], 1.0, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 30000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 3e7Initial program 61.6%
div-sub61.6%
+-rgt-identity61.6%
div-sub61.6%
Simplified61.6%
Taylor expanded in x around 0 64.8%
if 3e7 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 58.6%
div-sub58.6%
rec-exp58.6%
mul-1-neg58.6%
+-inverses58.6%
Simplified58.6%
Final simplification63.2%
(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 72.0%
Simplified56.8%
Taylor expanded in eps around 0 17.4%
div-sub17.4%
rec-exp17.4%
mul-1-neg17.4%
+-inverses17.7%
Simplified17.7%
Final simplification17.7%
herbie shell --seed 2023229
(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))