
(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 16 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 (/ (+ (/ 1.0 (exp (fma eps x x))) (exp (* x (+ eps -1.0)))) 2.0))
double code(double x, double eps) {
return ((1.0 / exp(fma(eps, x, x))) + exp((x * (eps + -1.0)))) / 2.0;
}
function code(x, eps) return Float64(Float64(Float64(1.0 / exp(fma(eps, x, x))) + exp(Float64(x * Float64(eps + -1.0)))) / 2.0) end
code[x_, eps_] := N[(N[(N[(1.0 / N[Exp[N[(eps * x + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{e^{\mathsf{fma}\left(\varepsilon, x, x\right)}} + e^{x \cdot \left(\varepsilon + -1\right)}}{2}
\end{array}
Initial program 75.0%
Simplified67.1%
Taylor expanded in eps around inf 99.2%
Final simplification99.2%
(FPCore (x eps) :precision binary64 (if (<= eps 1e-37) (/ (* 2.0 (exp (- x))) 2.0) (/ (+ (exp (* x (+ eps -1.0))) (exp (* eps (- x)))) 2.0)))
double code(double x, double eps) {
double tmp;
if (eps <= 1e-37) {
tmp = (2.0 * exp(-x)) / 2.0;
} else {
tmp = (exp((x * (eps + -1.0))) + exp((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 (eps <= 1d-37) then
tmp = (2.0d0 * exp(-x)) / 2.0d0
else
tmp = (exp((x * (eps + (-1.0d0)))) + exp((eps * -x))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= 1e-37) {
tmp = (2.0 * Math.exp(-x)) / 2.0;
} else {
tmp = (Math.exp((x * (eps + -1.0))) + Math.exp((eps * -x))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= 1e-37: tmp = (2.0 * math.exp(-x)) / 2.0 else: tmp = (math.exp((x * (eps + -1.0))) + math.exp((eps * -x))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (eps <= 1e-37) tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(eps * Float64(-x)))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 1e-37) tmp = (2.0 * exp(-x)) / 2.0; else tmp = (exp((x * (eps + -1.0))) + exp((eps * -x))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, 1e-37], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(eps * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 10^{-37}:\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{\varepsilon \cdot \left(-x\right)}}{2}\\
\end{array}
\end{array}
if eps < 1.00000000000000007e-37Initial program 63.9%
Simplified57.6%
Taylor expanded in eps around inf 98.8%
Taylor expanded in eps around 0 75.0%
rec-exp75.0%
neg-mul-175.0%
count-275.0%
neg-mul-175.0%
Simplified75.0%
if 1.00000000000000007e-37 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around -inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
mul-1-neg100.0%
sub-neg100.0%
mul-1-neg100.0%
associate-*r*100.0%
neg-mul-1100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
*-commutative100.0%
mul-1-neg100.0%
Simplified100.0%
Final simplification82.7%
(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 75.0%
Simplified75.0%
Taylor expanded in eps around inf 99.2%
Taylor expanded in eps around -inf 99.2%
associate-*r*99.2%
neg-mul-199.2%
mul-1-neg99.2%
sub-neg99.2%
mul-1-neg99.2%
associate-*r*99.2%
neg-mul-199.2%
mul-1-neg99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x eps)
:precision binary64
(if (<= x -7.5e-134)
(/
(+ (* (+ 1.0 (/ 1.0 eps)) (exp (* x (- 1.0 eps)))) (+ 1.0 (/ -1.0 eps)))
2.0)
(/ (+ 1.0 (exp (* x (+ eps -1.0)))) 2.0)))
double code(double x, double eps) {
double tmp;
if (x <= -7.5e-134) {
tmp = (((1.0 + (1.0 / eps)) * exp((x * (1.0 - eps)))) + (1.0 + (-1.0 / eps))) / 2.0;
} else {
tmp = (1.0 + exp((x * (eps + -1.0)))) / 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 <= (-7.5d-134)) then
tmp = (((1.0d0 + (1.0d0 / eps)) * exp((x * (1.0d0 - eps)))) + (1.0d0 + ((-1.0d0) / eps))) / 2.0d0
else
tmp = (1.0d0 + exp((x * (eps + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -7.5e-134) {
tmp = (((1.0 + (1.0 / eps)) * Math.exp((x * (1.0 - eps)))) + (1.0 + (-1.0 / eps))) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (eps + -1.0)))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -7.5e-134: tmp = (((1.0 + (1.0 / eps)) * math.exp((x * (1.0 - eps)))) + (1.0 + (-1.0 / eps))) / 2.0 else: tmp = (1.0 + math.exp((x * (eps + -1.0)))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -7.5e-134) tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(x * Float64(1.0 - eps)))) + Float64(1.0 + Float64(-1.0 / eps))) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps + -1.0)))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -7.5e-134) tmp = (((1.0 + (1.0 / eps)) * exp((x * (1.0 - eps)))) + (1.0 + (-1.0 / eps))) / 2.0; else tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -7.5e-134], N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{-134}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{x \cdot \left(1 - \varepsilon\right)} + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -7.50000000000000048e-134Initial program 82.8%
Simplified82.8%
Taylor expanded in x around 0 54.7%
add-log-exp54.7%
*-un-lft-identity54.7%
log-prod54.7%
metadata-eval54.7%
add-log-exp54.7%
*-commutative54.7%
add-sqr-sqrt54.7%
sqrt-unprod54.7%
sqr-neg54.7%
sqrt-unprod0.0%
add-sqr-sqrt37.5%
Applied egg-rr37.5%
+-lft-identity37.5%
Simplified37.5%
if -7.50000000000000048e-134 < x Initial program 72.5%
Simplified66.1%
Taylor expanded in eps around inf 99.5%
Taylor expanded in x around 0 66.1%
Final simplification59.1%
(FPCore (x eps)
:precision binary64
(if (<= x -4.4e-132)
(/
(+ (+ 1.0 (/ 1.0 eps)) (* (exp (* x (- -1.0 eps))) (+ 1.0 (/ -1.0 eps))))
2.0)
(/ (+ 1.0 (exp (* x (+ eps -1.0)))) 2.0)))
double code(double x, double eps) {
double tmp;
if (x <= -4.4e-132) {
tmp = ((1.0 + (1.0 / eps)) + (exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) / 2.0;
} else {
tmp = (1.0 + exp((x * (eps + -1.0)))) / 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 <= (-4.4d-132)) then
tmp = ((1.0d0 + (1.0d0 / eps)) + (exp((x * ((-1.0d0) - eps))) * (1.0d0 + ((-1.0d0) / eps)))) / 2.0d0
else
tmp = (1.0d0 + exp((x * (eps + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -4.4e-132) {
tmp = ((1.0 + (1.0 / eps)) + (Math.exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (eps + -1.0)))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -4.4e-132: tmp = ((1.0 + (1.0 / eps)) + (math.exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) / 2.0 else: tmp = (1.0 + math.exp((x * (eps + -1.0)))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -4.4e-132) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) + Float64(exp(Float64(x * Float64(-1.0 - eps))) * Float64(1.0 + Float64(-1.0 / eps)))) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps + -1.0)))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -4.4e-132) tmp = ((1.0 + (1.0 / eps)) + (exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) / 2.0; else tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -4.4e-132], N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{-132}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + e^{x \cdot \left(-1 - \varepsilon\right)} \cdot \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -4.39999999999999981e-132Initial program 82.8%
Simplified82.8%
Taylor expanded in x around 0 39.0%
if -4.39999999999999981e-132 < x Initial program 72.5%
Simplified66.1%
Taylor expanded in eps around inf 99.5%
Taylor expanded in x around 0 66.1%
Final simplification59.5%
(FPCore (x eps) :precision binary64 (if (<= x -1.5e-290) (/ (* 2.0 (exp (- x))) 2.0) (/ (+ 1.0 (exp (* x (+ eps -1.0)))) 2.0)))
double code(double x, double eps) {
double tmp;
if (x <= -1.5e-290) {
tmp = (2.0 * exp(-x)) / 2.0;
} else {
tmp = (1.0 + exp((x * (eps + -1.0)))) / 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 <= (-1.5d-290)) then
tmp = (2.0d0 * exp(-x)) / 2.0d0
else
tmp = (1.0d0 + exp((x * (eps + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -1.5e-290) {
tmp = (2.0 * Math.exp(-x)) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (eps + -1.0)))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -1.5e-290: tmp = (2.0 * math.exp(-x)) / 2.0 else: tmp = (1.0 + math.exp((x * (eps + -1.0)))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -1.5e-290) tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps + -1.0)))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -1.5e-290) tmp = (2.0 * exp(-x)) / 2.0; else tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -1.5e-290], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.5 \cdot 10^{-290}:\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -1.49999999999999996e-290Initial program 72.8%
Simplified62.1%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around 0 77.4%
rec-exp77.4%
neg-mul-177.4%
count-277.4%
neg-mul-177.4%
Simplified77.4%
if -1.49999999999999996e-290 < x Initial program 76.4%
Simplified70.3%
Taylor expanded in eps around inf 99.4%
Taylor expanded in x around 0 60.3%
Final simplification67.0%
(FPCore (x eps) :precision binary64 (if (<= x -9e-6) (/ (* 2.0 (exp (- x))) 2.0) (/ (+ 1.0 (exp (* x eps))) 2.0)))
double code(double x, double eps) {
double tmp;
if (x <= -9e-6) {
tmp = (2.0 * exp(-x)) / 2.0;
} else {
tmp = (1.0 + exp((x * 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 (x <= (-9d-6)) then
tmp = (2.0d0 * exp(-x)) / 2.0d0
else
tmp = (1.0d0 + exp((x * eps))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -9e-6) {
tmp = (2.0 * Math.exp(-x)) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * eps))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -9e-6: tmp = (2.0 * math.exp(-x)) / 2.0 else: tmp = (1.0 + math.exp((x * eps))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -9e-6) tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * eps))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -9e-6) tmp = (2.0 * exp(-x)) / 2.0; else tmp = (1.0 + exp((x * eps))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -9e-6], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-6}:\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \varepsilon}}{2}\\
\end{array}
\end{array}
if x < -9.00000000000000023e-6Initial program 97.1%
Simplified97.1%
Taylor expanded in eps around inf 97.1%
Taylor expanded in eps around 0 94.2%
rec-exp94.2%
neg-mul-194.2%
count-294.2%
neg-mul-194.2%
Simplified94.2%
if -9.00000000000000023e-6 < x Initial program 71.6%
Simplified62.5%
Taylor expanded in eps around inf 99.5%
Taylor expanded in x around 0 67.6%
Taylor expanded in eps around inf 67.7%
*-commutative67.7%
Simplified67.7%
Final simplification71.2%
(FPCore (x eps)
:precision binary64
(if (<= eps 1.9e+263)
(/ (* 2.0 (exp (- x))) 2.0)
(if (<= eps 4.2e+304)
(/ (+ 2.0 (* x (* (- 1.0 eps) (+ -1.0 (/ -1.0 eps))))) 2.0)
(* x (* eps -0.5)))))
double code(double x, double eps) {
double tmp;
if (eps <= 1.9e+263) {
tmp = (2.0 * exp(-x)) / 2.0;
} else if (eps <= 4.2e+304) {
tmp = (2.0 + (x * ((1.0 - eps) * (-1.0 + (-1.0 / eps))))) / 2.0;
} else {
tmp = x * (eps * -0.5);
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= 1.9d+263) then
tmp = (2.0d0 * exp(-x)) / 2.0d0
else if (eps <= 4.2d+304) then
tmp = (2.0d0 + (x * ((1.0d0 - eps) * ((-1.0d0) + ((-1.0d0) / eps))))) / 2.0d0
else
tmp = x * (eps * (-0.5d0))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= 1.9e+263) {
tmp = (2.0 * Math.exp(-x)) / 2.0;
} else if (eps <= 4.2e+304) {
tmp = (2.0 + (x * ((1.0 - eps) * (-1.0 + (-1.0 / eps))))) / 2.0;
} else {
tmp = x * (eps * -0.5);
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= 1.9e+263: tmp = (2.0 * math.exp(-x)) / 2.0 elif eps <= 4.2e+304: tmp = (2.0 + (x * ((1.0 - eps) * (-1.0 + (-1.0 / eps))))) / 2.0 else: tmp = x * (eps * -0.5) return tmp
function code(x, eps) tmp = 0.0 if (eps <= 1.9e+263) tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0); elseif (eps <= 4.2e+304) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 - eps) * Float64(-1.0 + Float64(-1.0 / eps))))) / 2.0); else tmp = Float64(x * Float64(eps * -0.5)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 1.9e+263) tmp = (2.0 * exp(-x)) / 2.0; elseif (eps <= 4.2e+304) tmp = (2.0 + (x * ((1.0 - eps) * (-1.0 + (-1.0 / eps))))) / 2.0; else tmp = x * (eps * -0.5); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, 1.9e+263], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 4.2e+304], N[(N[(2.0 + N[(x * N[(N[(1.0 - eps), $MachinePrecision] * N[(-1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(x * N[(eps * -0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 1.9 \cdot 10^{+263}:\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\
\mathbf{elif}\;\varepsilon \leq 4.2 \cdot 10^{+304}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(1 - \varepsilon\right) \cdot \left(-1 + \frac{-1}{\varepsilon}\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\varepsilon \cdot -0.5\right)\\
\end{array}
\end{array}
if eps < 1.9e263Initial program 73.7%
Simplified65.7%
Taylor expanded in eps around inf 99.1%
Taylor expanded in eps around 0 70.6%
rec-exp70.5%
neg-mul-170.5%
count-270.5%
neg-mul-170.5%
Simplified70.5%
if 1.9e263 < eps < 4.1999999999999999e304Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 51.6%
Taylor expanded in x around 0 27.0%
mul-1-neg27.0%
distribute-rgt-neg-in27.0%
*-commutative27.0%
distribute-rgt-neg-in27.0%
mul-1-neg27.0%
distribute-lft-in27.0%
metadata-eval27.0%
neg-mul-127.0%
distribute-neg-frac27.0%
metadata-eval27.0%
Simplified27.0%
if 4.1999999999999999e304 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Final simplification68.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* x (+ eps 1.0))))
(if (<= x -9e-6)
(/ (* (+ (/ 1.0 eps) -1.0) t_0) 2.0)
(if (<= x 520.0)
1.0
(if (<= x 4.1e+195)
0.0
(if (<= x 5.5e+229)
(/ (+ t_0 (/ t_0 eps)) 2.0)
(/ (+ (+ 1.0 (/ 1.0 eps)) (+ 1.0 (/ -1.0 eps))) 2.0)))))))
double code(double x, double eps) {
double t_0 = x * (eps + 1.0);
double tmp;
if (x <= -9e-6) {
tmp = (((1.0 / eps) + -1.0) * t_0) / 2.0;
} else if (x <= 520.0) {
tmp = 1.0;
} else if (x <= 4.1e+195) {
tmp = 0.0;
} else if (x <= 5.5e+229) {
tmp = (t_0 + (t_0 / eps)) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-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) :: t_0
real(8) :: tmp
t_0 = x * (eps + 1.0d0)
if (x <= (-9d-6)) then
tmp = (((1.0d0 / eps) + (-1.0d0)) * t_0) / 2.0d0
else if (x <= 520.0d0) then
tmp = 1.0d0
else if (x <= 4.1d+195) then
tmp = 0.0d0
else if (x <= 5.5d+229) then
tmp = (t_0 + (t_0 / eps)) / 2.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps)) + (1.0d0 + ((-1.0d0) / eps))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = x * (eps + 1.0);
double tmp;
if (x <= -9e-6) {
tmp = (((1.0 / eps) + -1.0) * t_0) / 2.0;
} else if (x <= 520.0) {
tmp = 1.0;
} else if (x <= 4.1e+195) {
tmp = 0.0;
} else if (x <= 5.5e+229) {
tmp = (t_0 + (t_0 / eps)) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = x * (eps + 1.0) tmp = 0 if x <= -9e-6: tmp = (((1.0 / eps) + -1.0) * t_0) / 2.0 elif x <= 520.0: tmp = 1.0 elif x <= 4.1e+195: tmp = 0.0 elif x <= 5.5e+229: tmp = (t_0 + (t_0 / eps)) / 2.0 else: tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0 return tmp
function code(x, eps) t_0 = Float64(x * Float64(eps + 1.0)) tmp = 0.0 if (x <= -9e-6) tmp = Float64(Float64(Float64(Float64(1.0 / eps) + -1.0) * t_0) / 2.0); elseif (x <= 520.0) tmp = 1.0; elseif (x <= 4.1e+195) tmp = 0.0; elseif (x <= 5.5e+229) tmp = Float64(Float64(t_0 + Float64(t_0 / eps)) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) + Float64(1.0 + Float64(-1.0 / eps))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = x * (eps + 1.0); tmp = 0.0; if (x <= -9e-6) tmp = (((1.0 / eps) + -1.0) * t_0) / 2.0; elseif (x <= 520.0) tmp = 1.0; elseif (x <= 4.1e+195) tmp = 0.0; elseif (x <= 5.5e+229) tmp = (t_0 + (t_0 / eps)) / 2.0; else tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(x * N[(eps + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9e-6], N[(N[(N[(N[(1.0 / eps), $MachinePrecision] + -1.0), $MachinePrecision] * t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 520.0], 1.0, If[LessEqual[x, 4.1e+195], 0.0, If[LessEqual[x, 5.5e+229], N[(N[(t$95$0 + N[(t$95$0 / eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(\varepsilon + 1\right)\\
\mathbf{if}\;x \leq -9 \cdot 10^{-6}:\\
\;\;\;\;\frac{\left(\frac{1}{\varepsilon} + -1\right) \cdot t_0}{2}\\
\mathbf{elif}\;x \leq 520:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{+195}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+229}:\\
\;\;\;\;\frac{t_0 + \frac{t_0}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if x < -9.00000000000000023e-6Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 53.6%
Taylor expanded in x around inf 24.3%
sub-neg24.3%
metadata-eval24.3%
associate-*r*24.3%
+-commutative24.3%
Simplified24.3%
if -9.00000000000000023e-6 < x < 520Initial program 59.1%
Simplified59.1%
Taylor expanded in x around 0 71.6%
if 520 < x < 4.1e195Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Applied egg-rr0.0%
div-sub0.0%
+-inverses49.7%
Simplified49.7%
if 4.1e195 < x < 5.5000000000000002e229Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 83.3%
Taylor expanded in x around inf 50.0%
sub-neg50.0%
metadata-eval50.0%
associate-*r*50.0%
+-commutative50.0%
Simplified50.0%
+-commutative50.0%
distribute-rgt-in50.0%
associate-*l/50.0%
*-un-lft-identity50.0%
associate-*r*50.0%
neg-mul-150.0%
add-sqr-sqrt0.0%
sqrt-unprod50.0%
sqr-neg50.0%
sqrt-unprod19.4%
add-sqr-sqrt19.4%
Applied egg-rr19.4%
if 5.5000000000000002e229 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 28.4%
Taylor expanded in x around 0 54.8%
Final simplification59.1%
(FPCore (x eps)
:precision binary64
(if (<= x -9e-6)
(/ (* (+ (/ 1.0 eps) -1.0) (* x (+ eps 1.0))) 2.0)
(if (<= x 620.0)
1.0
(if (<= x 1.3e+195)
0.0
(if (<= x 2.6e+230)
(* (* x eps) 0.5)
(/ (+ (+ 1.0 (/ 1.0 eps)) (+ 1.0 (/ -1.0 eps))) 2.0))))))
double code(double x, double eps) {
double tmp;
if (x <= -9e-6) {
tmp = (((1.0 / eps) + -1.0) * (x * (eps + 1.0))) / 2.0;
} else if (x <= 620.0) {
tmp = 1.0;
} else if (x <= 1.3e+195) {
tmp = 0.0;
} else if (x <= 2.6e+230) {
tmp = (x * eps) * 0.5;
} else {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-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 (x <= (-9d-6)) then
tmp = (((1.0d0 / eps) + (-1.0d0)) * (x * (eps + 1.0d0))) / 2.0d0
else if (x <= 620.0d0) then
tmp = 1.0d0
else if (x <= 1.3d+195) then
tmp = 0.0d0
else if (x <= 2.6d+230) then
tmp = (x * eps) * 0.5d0
else
tmp = ((1.0d0 + (1.0d0 / eps)) + (1.0d0 + ((-1.0d0) / eps))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -9e-6) {
tmp = (((1.0 / eps) + -1.0) * (x * (eps + 1.0))) / 2.0;
} else if (x <= 620.0) {
tmp = 1.0;
} else if (x <= 1.3e+195) {
tmp = 0.0;
} else if (x <= 2.6e+230) {
tmp = (x * eps) * 0.5;
} else {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -9e-6: tmp = (((1.0 / eps) + -1.0) * (x * (eps + 1.0))) / 2.0 elif x <= 620.0: tmp = 1.0 elif x <= 1.3e+195: tmp = 0.0 elif x <= 2.6e+230: tmp = (x * eps) * 0.5 else: tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -9e-6) tmp = Float64(Float64(Float64(Float64(1.0 / eps) + -1.0) * Float64(x * Float64(eps + 1.0))) / 2.0); elseif (x <= 620.0) tmp = 1.0; elseif (x <= 1.3e+195) tmp = 0.0; elseif (x <= 2.6e+230) tmp = Float64(Float64(x * eps) * 0.5); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) + Float64(1.0 + Float64(-1.0 / eps))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -9e-6) tmp = (((1.0 / eps) + -1.0) * (x * (eps + 1.0))) / 2.0; elseif (x <= 620.0) tmp = 1.0; elseif (x <= 1.3e+195) tmp = 0.0; elseif (x <= 2.6e+230) tmp = (x * eps) * 0.5; else tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -9e-6], N[(N[(N[(N[(1.0 / eps), $MachinePrecision] + -1.0), $MachinePrecision] * N[(x * N[(eps + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 620.0], 1.0, If[LessEqual[x, 1.3e+195], 0.0, If[LessEqual[x, 2.6e+230], N[(N[(x * eps), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-6}:\\
\;\;\;\;\frac{\left(\frac{1}{\varepsilon} + -1\right) \cdot \left(x \cdot \left(\varepsilon + 1\right)\right)}{2}\\
\mathbf{elif}\;x \leq 620:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+195}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+230}:\\
\;\;\;\;\left(x \cdot \varepsilon\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if x < -9.00000000000000023e-6Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 53.6%
Taylor expanded in x around inf 24.3%
sub-neg24.3%
metadata-eval24.3%
associate-*r*24.3%
+-commutative24.3%
Simplified24.3%
if -9.00000000000000023e-6 < x < 620Initial program 59.1%
Simplified59.1%
Taylor expanded in x around 0 71.6%
if 620 < x < 1.30000000000000001e195Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Applied egg-rr0.0%
div-sub0.0%
+-inverses49.7%
Simplified49.7%
if 1.30000000000000001e195 < x < 2.5999999999999999e230Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 83.3%
Taylor expanded in eps around inf 50.0%
associate-*r*50.0%
mul-1-neg50.0%
Simplified50.0%
div-inv50.0%
*-commutative50.0%
add-sqr-sqrt50.0%
sqrt-unprod69.4%
sqr-neg69.4%
sqrt-unprod19.4%
add-sqr-sqrt19.4%
metadata-eval19.4%
Applied egg-rr19.4%
if 2.5999999999999999e230 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 28.4%
Taylor expanded in x around 0 54.8%
Final simplification59.1%
(FPCore (x eps)
:precision binary64
(if (<= x -9e-6)
(/ (* (+ (/ 1.0 eps) -1.0) (* x (+ eps 1.0))) 2.0)
(if (<= x 550.0)
1.0
(if (<= x 2.02e+195) 0.0 (if (<= x 1.3e+297) (* (* x eps) 0.5) 0.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -9e-6) {
tmp = (((1.0 / eps) + -1.0) * (x * (eps + 1.0))) / 2.0;
} else if (x <= 550.0) {
tmp = 1.0;
} else if (x <= 2.02e+195) {
tmp = 0.0;
} else if (x <= 1.3e+297) {
tmp = (x * eps) * 0.5;
} 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 <= (-9d-6)) then
tmp = (((1.0d0 / eps) + (-1.0d0)) * (x * (eps + 1.0d0))) / 2.0d0
else if (x <= 550.0d0) then
tmp = 1.0d0
else if (x <= 2.02d+195) then
tmp = 0.0d0
else if (x <= 1.3d+297) then
tmp = (x * eps) * 0.5d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -9e-6) {
tmp = (((1.0 / eps) + -1.0) * (x * (eps + 1.0))) / 2.0;
} else if (x <= 550.0) {
tmp = 1.0;
} else if (x <= 2.02e+195) {
tmp = 0.0;
} else if (x <= 1.3e+297) {
tmp = (x * eps) * 0.5;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -9e-6: tmp = (((1.0 / eps) + -1.0) * (x * (eps + 1.0))) / 2.0 elif x <= 550.0: tmp = 1.0 elif x <= 2.02e+195: tmp = 0.0 elif x <= 1.3e+297: tmp = (x * eps) * 0.5 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -9e-6) tmp = Float64(Float64(Float64(Float64(1.0 / eps) + -1.0) * Float64(x * Float64(eps + 1.0))) / 2.0); elseif (x <= 550.0) tmp = 1.0; elseif (x <= 2.02e+195) tmp = 0.0; elseif (x <= 1.3e+297) tmp = Float64(Float64(x * eps) * 0.5); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -9e-6) tmp = (((1.0 / eps) + -1.0) * (x * (eps + 1.0))) / 2.0; elseif (x <= 550.0) tmp = 1.0; elseif (x <= 2.02e+195) tmp = 0.0; elseif (x <= 1.3e+297) tmp = (x * eps) * 0.5; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -9e-6], N[(N[(N[(N[(1.0 / eps), $MachinePrecision] + -1.0), $MachinePrecision] * N[(x * N[(eps + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 550.0], 1.0, If[LessEqual[x, 2.02e+195], 0.0, If[LessEqual[x, 1.3e+297], N[(N[(x * eps), $MachinePrecision] * 0.5), $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-6}:\\
\;\;\;\;\frac{\left(\frac{1}{\varepsilon} + -1\right) \cdot \left(x \cdot \left(\varepsilon + 1\right)\right)}{2}\\
\mathbf{elif}\;x \leq 550:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.02 \cdot 10^{+195}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+297}:\\
\;\;\;\;\left(x \cdot \varepsilon\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -9.00000000000000023e-6Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 53.6%
Taylor expanded in x around inf 24.3%
sub-neg24.3%
metadata-eval24.3%
associate-*r*24.3%
+-commutative24.3%
Simplified24.3%
if -9.00000000000000023e-6 < x < 550Initial program 59.1%
Simplified59.1%
Taylor expanded in x around 0 71.6%
if 550 < x < 2.01999999999999988e195 or 1.3e297 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Applied egg-rr0.0%
div-sub0.0%
+-inverses50.8%
Simplified50.8%
if 2.01999999999999988e195 < x < 1.3e297Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 40.5%
Taylor expanded in eps around inf 30.9%
associate-*r*30.9%
mul-1-neg30.9%
Simplified30.9%
div-inv30.9%
*-commutative30.9%
add-sqr-sqrt30.5%
sqrt-unprod71.2%
sqr-neg71.2%
sqrt-unprod26.2%
add-sqr-sqrt26.7%
metadata-eval26.7%
Applied egg-rr26.7%
Final simplification57.9%
(FPCore (x eps)
:precision binary64
(if (<= x -9e-6)
(* x (* eps -0.5))
(if (<= x 480.0)
1.0
(if (<= x 1.32e+197) 0.0 (if (<= x 1.35e+297) (* (* x eps) 0.5) 0.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -9e-6) {
tmp = x * (eps * -0.5);
} else if (x <= 480.0) {
tmp = 1.0;
} else if (x <= 1.32e+197) {
tmp = 0.0;
} else if (x <= 1.35e+297) {
tmp = (x * eps) * 0.5;
} 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 <= (-9d-6)) then
tmp = x * (eps * (-0.5d0))
else if (x <= 480.0d0) then
tmp = 1.0d0
else if (x <= 1.32d+197) then
tmp = 0.0d0
else if (x <= 1.35d+297) then
tmp = (x * eps) * 0.5d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -9e-6) {
tmp = x * (eps * -0.5);
} else if (x <= 480.0) {
tmp = 1.0;
} else if (x <= 1.32e+197) {
tmp = 0.0;
} else if (x <= 1.35e+297) {
tmp = (x * eps) * 0.5;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -9e-6: tmp = x * (eps * -0.5) elif x <= 480.0: tmp = 1.0 elif x <= 1.32e+197: tmp = 0.0 elif x <= 1.35e+297: tmp = (x * eps) * 0.5 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -9e-6) tmp = Float64(x * Float64(eps * -0.5)); elseif (x <= 480.0) tmp = 1.0; elseif (x <= 1.32e+197) tmp = 0.0; elseif (x <= 1.35e+297) tmp = Float64(Float64(x * eps) * 0.5); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -9e-6) tmp = x * (eps * -0.5); elseif (x <= 480.0) tmp = 1.0; elseif (x <= 1.32e+197) tmp = 0.0; elseif (x <= 1.35e+297) tmp = (x * eps) * 0.5; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -9e-6], N[(x * N[(eps * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 480.0], 1.0, If[LessEqual[x, 1.32e+197], 0.0, If[LessEqual[x, 1.35e+297], N[(N[(x * eps), $MachinePrecision] * 0.5), $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-6}:\\
\;\;\;\;x \cdot \left(\varepsilon \cdot -0.5\right)\\
\mathbf{elif}\;x \leq 480:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+197}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+297}:\\
\;\;\;\;\left(x \cdot \varepsilon\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -9.00000000000000023e-6Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 53.6%
Taylor expanded in eps around inf 24.3%
associate-*r*24.3%
mul-1-neg24.3%
Simplified24.3%
Taylor expanded in eps around 0 24.3%
*-commutative24.3%
*-commutative24.3%
associate-*l*24.3%
Simplified24.3%
if -9.00000000000000023e-6 < x < 480Initial program 59.1%
Simplified59.1%
Taylor expanded in x around 0 71.6%
if 480 < x < 1.3200000000000001e197 or 1.35e297 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Applied egg-rr0.0%
div-sub0.0%
+-inverses50.8%
Simplified50.8%
if 1.3200000000000001e197 < x < 1.35e297Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 40.5%
Taylor expanded in eps around inf 30.9%
associate-*r*30.9%
mul-1-neg30.9%
Simplified30.9%
div-inv30.9%
*-commutative30.9%
add-sqr-sqrt30.5%
sqrt-unprod71.2%
sqr-neg71.2%
sqrt-unprod26.2%
add-sqr-sqrt26.7%
metadata-eval26.7%
Applied egg-rr26.7%
Final simplification57.9%
(FPCore (x eps) :precision binary64 (if (<= x -9e-6) (* x (* eps -0.5)) (if (<= x 580.0) 1.0 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -9e-6) {
tmp = x * (eps * -0.5);
} else if (x <= 580.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 <= (-9d-6)) then
tmp = x * (eps * (-0.5d0))
else if (x <= 580.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 <= -9e-6) {
tmp = x * (eps * -0.5);
} else if (x <= 580.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -9e-6: tmp = x * (eps * -0.5) elif x <= 580.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -9e-6) tmp = Float64(x * Float64(eps * -0.5)); elseif (x <= 580.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -9e-6) tmp = x * (eps * -0.5); elseif (x <= 580.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -9e-6], N[(x * N[(eps * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 580.0], 1.0, 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-6}:\\
\;\;\;\;x \cdot \left(\varepsilon \cdot -0.5\right)\\
\mathbf{elif}\;x \leq 580:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -9.00000000000000023e-6Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 53.6%
Taylor expanded in eps around inf 24.3%
associate-*r*24.3%
mul-1-neg24.3%
Simplified24.3%
Taylor expanded in eps around 0 24.3%
*-commutative24.3%
*-commutative24.3%
associate-*l*24.3%
Simplified24.3%
if -9.00000000000000023e-6 < x < 580Initial program 59.1%
Simplified59.1%
Taylor expanded in x around 0 71.6%
if 580 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Applied egg-rr0.0%
div-sub0.0%
+-inverses46.4%
Simplified46.4%
Final simplification58.7%
(FPCore (x eps) :precision binary64 (if (<= x 580.0) 0.5 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 580.0) {
tmp = 0.5;
} 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 <= 580.0d0) then
tmp = 0.5d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 580.0) {
tmp = 0.5;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 580.0: tmp = 0.5 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 580.0) tmp = 0.5; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 580.0) tmp = 0.5; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 580.0], 0.5, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 580:\\
\;\;\;\;0.5\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 580Initial program 66.0%
Simplified66.0%
Taylor expanded in eps around 0 59.2%
Simplified59.7%
Taylor expanded in x around inf 12.3%
Taylor expanded in x around 0 12.2%
if 580 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Applied egg-rr0.0%
div-sub0.0%
+-inverses46.4%
Simplified46.4%
Final simplification21.3%
(FPCore (x eps) :precision binary64 (if (<= x 550.0) 1.0 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 550.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 <= 550.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 <= 550.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 550.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 550.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 550.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 550.0], 1.0, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 550:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 550Initial program 66.0%
Simplified66.0%
Taylor expanded in x around 0 59.2%
if 550 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Applied egg-rr0.0%
div-sub0.0%
+-inverses46.4%
Simplified46.4%
Final simplification55.8%
(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 75.0%
Simplified75.0%
Taylor expanded in eps around inf 99.2%
Applied egg-rr1.6%
div-sub1.6%
+-inverses14.2%
Simplified14.2%
Final simplification14.2%
herbie shell --seed 2023337
(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))