
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
(FPCore (x eps) :precision binary64 (/ (+ (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 70.8%
*-commutative70.8%
distribute-rgt-neg-in70.8%
*-commutative70.8%
sub-neg70.8%
metadata-eval70.8%
distribute-rgt-neg-in70.8%
Simplified70.8%
Taylor expanded in eps around inf 99.7%
associate-*r*99.7%
mul-1-neg99.7%
mul-1-neg99.7%
associate-*r*99.7%
mul-1-neg99.7%
+-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x eps)
:precision binary64
(if (<= x 1.4e+93)
(/ (+ (exp (* x eps)) (exp (* x (- eps)))) 2.0)
(if (<= x 3.1e+203)
0.0
(if (<= x 7.8e+247)
(/ (+ 1.0 (exp (* x (+ eps -1.0)))) 2.0)
(/ (+ (+ 1.0 (/ 1.0 eps)) (+ 1.0 (/ -1.0 eps))) 2.0)))))
double code(double x, double eps) {
double tmp;
if (x <= 1.4e+93) {
tmp = (exp((x * eps)) + exp((x * -eps))) / 2.0;
} else if (x <= 3.1e+203) {
tmp = 0.0;
} else if (x <= 7.8e+247) {
tmp = (1.0 + exp((x * (eps + -1.0)))) / 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) :: tmp
if (x <= 1.4d+93) then
tmp = (exp((x * eps)) + exp((x * -eps))) / 2.0d0
else if (x <= 3.1d+203) then
tmp = 0.0d0
else if (x <= 7.8d+247) then
tmp = (1.0d0 + exp((x * (eps + (-1.0d0))))) / 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 tmp;
if (x <= 1.4e+93) {
tmp = (Math.exp((x * eps)) + Math.exp((x * -eps))) / 2.0;
} else if (x <= 3.1e+203) {
tmp = 0.0;
} else if (x <= 7.8e+247) {
tmp = (1.0 + Math.exp((x * (eps + -1.0)))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.4e+93: tmp = (math.exp((x * eps)) + math.exp((x * -eps))) / 2.0 elif x <= 3.1e+203: tmp = 0.0 elif x <= 7.8e+247: tmp = (1.0 + math.exp((x * (eps + -1.0)))) / 2.0 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 <= 1.4e+93) tmp = Float64(Float64(exp(Float64(x * eps)) + exp(Float64(x * Float64(-eps)))) / 2.0); elseif (x <= 3.1e+203) tmp = 0.0; elseif (x <= 7.8e+247) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps + -1.0)))) / 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) tmp = 0.0; if (x <= 1.4e+93) tmp = (exp((x * eps)) + exp((x * -eps))) / 2.0; elseif (x <= 3.1e+203) tmp = 0.0; elseif (x <= 7.8e+247) tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0; 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, 1.4e+93], N[(N[(N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3.1e+203], 0.0, If[LessEqual[x, 7.8e+247], N[(N[(1.0 + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $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}
\mathbf{if}\;x \leq 1.4 \cdot 10^{+93}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon} + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{+203}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{+247}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if x < 1.39999999999999994e93Initial program 63.6%
*-commutative63.6%
distribute-rgt-neg-in63.6%
*-commutative63.6%
sub-neg63.6%
metadata-eval63.6%
distribute-rgt-neg-in63.6%
Simplified63.6%
Taylor expanded in eps around inf 99.7%
associate-*r*99.7%
mul-1-neg99.7%
mul-1-neg99.7%
associate-*r*99.7%
mul-1-neg99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in eps around inf 95.9%
*-commutative77.5%
Simplified95.9%
Taylor expanded in eps around inf 96.1%
*-commutative96.1%
mul-1-neg96.1%
distribute-rgt-neg-out96.1%
Simplified96.1%
if 1.39999999999999994e93 < x < 3.1e203Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 14.6%
Taylor expanded in x around 0 71.7%
sub-neg71.7%
flip-+37.6%
Applied egg-rr42.1%
div-sub42.1%
+-inverses75.4%
Simplified75.4%
if 3.1e203 < x < 7.80000000000000003e247Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 32.7%
Taylor expanded in eps around inf 32.9%
mul-1-neg32.9%
distribute-lft-neg-in32.9%
Simplified32.9%
if 7.80000000000000003e247 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 23.3%
Taylor expanded in x around 0 65.4%
Final simplification89.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (+ 1.0 (exp (* x (+ eps -1.0)))) 2.0)))
(if (<= x -4.5e-272)
(/ (+ 1.0 (pow E (* x (- eps)))) 2.0)
(if (<= x 1.5e+87)
t_0
(if (<= x 1.5e+202)
0.0
(if (<= x 3.2e+247)
t_0
(/ (+ (+ 1.0 (/ 1.0 eps)) (+ 1.0 (/ -1.0 eps))) 2.0)))))))
double code(double x, double eps) {
double t_0 = (1.0 + exp((x * (eps + -1.0)))) / 2.0;
double tmp;
if (x <= -4.5e-272) {
tmp = (1.0 + pow(((double) M_E), (x * -eps))) / 2.0;
} else if (x <= 1.5e+87) {
tmp = t_0;
} else if (x <= 1.5e+202) {
tmp = 0.0;
} else if (x <= 3.2e+247) {
tmp = t_0;
} else {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
public static double code(double x, double eps) {
double t_0 = (1.0 + Math.exp((x * (eps + -1.0)))) / 2.0;
double tmp;
if (x <= -4.5e-272) {
tmp = (1.0 + Math.pow(Math.E, (x * -eps))) / 2.0;
} else if (x <= 1.5e+87) {
tmp = t_0;
} else if (x <= 1.5e+202) {
tmp = 0.0;
} else if (x <= 3.2e+247) {
tmp = t_0;
} else {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = (1.0 + math.exp((x * (eps + -1.0)))) / 2.0 tmp = 0 if x <= -4.5e-272: tmp = (1.0 + math.pow(math.e, (x * -eps))) / 2.0 elif x <= 1.5e+87: tmp = t_0 elif x <= 1.5e+202: tmp = 0.0 elif x <= 3.2e+247: tmp = t_0 else: tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0 return tmp
function code(x, eps) t_0 = Float64(Float64(1.0 + exp(Float64(x * Float64(eps + -1.0)))) / 2.0) tmp = 0.0 if (x <= -4.5e-272) tmp = Float64(Float64(1.0 + (exp(1) ^ Float64(x * Float64(-eps)))) / 2.0); elseif (x <= 1.5e+87) tmp = t_0; elseif (x <= 1.5e+202) tmp = 0.0; elseif (x <= 3.2e+247) tmp = t_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 = (1.0 + exp((x * (eps + -1.0)))) / 2.0; tmp = 0.0; if (x <= -4.5e-272) tmp = (1.0 + (2.71828182845904523536 ^ (x * -eps))) / 2.0; elseif (x <= 1.5e+87) tmp = t_0; elseif (x <= 1.5e+202) tmp = 0.0; elseif (x <= 3.2e+247) tmp = t_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[(N[(1.0 + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -4.5e-272], N[(N[(1.0 + N[Power[E, N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.5e+87], t$95$0, If[LessEqual[x, 1.5e+202], 0.0, If[LessEqual[x, 3.2e+247], t$95$0, 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 := \frac{1 + e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\mathbf{if}\;x \leq -4.5 \cdot 10^{-272}:\\
\;\;\;\;\frac{1 + {e}^{\left(x \cdot \left(-\varepsilon\right)\right)}}{2}\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+87}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+202}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{+247}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if x < -4.4999999999999998e-272Initial program 72.4%
*-commutative72.4%
distribute-rgt-neg-in72.4%
*-commutative72.4%
sub-neg72.4%
metadata-eval72.4%
distribute-rgt-neg-in72.4%
Simplified72.4%
Taylor expanded in x around 0 48.0%
Taylor expanded in eps around inf 75.1%
mul-1-neg75.1%
distribute-lft-neg-in75.1%
Simplified75.1%
*-commutative75.1%
*-un-lft-identity75.1%
exp-prod75.1%
*-commutative75.1%
add-sqr-sqrt75.1%
sqrt-unprod71.5%
sqr-neg71.5%
sqrt-unprod0.0%
add-sqr-sqrt65.0%
Applied egg-rr65.0%
exp-1-e65.0%
Simplified65.0%
Taylor expanded in eps around inf 65.5%
associate-*r*65.5%
mul-1-neg65.5%
Simplified65.5%
if -4.4999999999999998e-272 < x < 1.4999999999999999e87 or 1.5000000000000001e202 < x < 3.20000000000000022e247Initial program 59.1%
*-commutative59.1%
distribute-rgt-neg-in59.1%
*-commutative59.1%
sub-neg59.1%
metadata-eval59.1%
distribute-rgt-neg-in59.1%
Simplified59.1%
Taylor expanded in x around 0 33.3%
Taylor expanded in eps around inf 74.2%
mul-1-neg74.2%
distribute-lft-neg-in74.2%
Simplified74.2%
if 1.4999999999999999e87 < x < 1.5000000000000001e202Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 14.6%
Taylor expanded in x around 0 71.7%
sub-neg71.7%
flip-+37.6%
Applied egg-rr42.1%
div-sub42.1%
+-inverses75.4%
Simplified75.4%
if 3.20000000000000022e247 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 23.3%
Taylor expanded in x around 0 65.4%
Final simplification70.1%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (+ 1.0 (exp (* x (+ eps -1.0)))) 2.0)))
(if (<= x -1e-271)
(/ (+ 1.0 (exp (* x (- eps)))) 2.0)
(if (<= x 1.8e+86)
t_0
(if (<= x 3.1e+203)
0.0
(if (<= x 6e+247)
t_0
(/ (+ (+ 1.0 (/ 1.0 eps)) (+ 1.0 (/ -1.0 eps))) 2.0)))))))
double code(double x, double eps) {
double t_0 = (1.0 + exp((x * (eps + -1.0)))) / 2.0;
double tmp;
if (x <= -1e-271) {
tmp = (1.0 + exp((x * -eps))) / 2.0;
} else if (x <= 1.8e+86) {
tmp = t_0;
} else if (x <= 3.1e+203) {
tmp = 0.0;
} else if (x <= 6e+247) {
tmp = t_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 = (1.0d0 + exp((x * (eps + (-1.0d0))))) / 2.0d0
if (x <= (-1d-271)) then
tmp = (1.0d0 + exp((x * -eps))) / 2.0d0
else if (x <= 1.8d+86) then
tmp = t_0
else if (x <= 3.1d+203) then
tmp = 0.0d0
else if (x <= 6d+247) then
tmp = t_0
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 = (1.0 + Math.exp((x * (eps + -1.0)))) / 2.0;
double tmp;
if (x <= -1e-271) {
tmp = (1.0 + Math.exp((x * -eps))) / 2.0;
} else if (x <= 1.8e+86) {
tmp = t_0;
} else if (x <= 3.1e+203) {
tmp = 0.0;
} else if (x <= 6e+247) {
tmp = t_0;
} else {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = (1.0 + math.exp((x * (eps + -1.0)))) / 2.0 tmp = 0 if x <= -1e-271: tmp = (1.0 + math.exp((x * -eps))) / 2.0 elif x <= 1.8e+86: tmp = t_0 elif x <= 3.1e+203: tmp = 0.0 elif x <= 6e+247: tmp = t_0 else: tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0 return tmp
function code(x, eps) t_0 = Float64(Float64(1.0 + exp(Float64(x * Float64(eps + -1.0)))) / 2.0) tmp = 0.0 if (x <= -1e-271) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps)))) / 2.0); elseif (x <= 1.8e+86) tmp = t_0; elseif (x <= 3.1e+203) tmp = 0.0; elseif (x <= 6e+247) tmp = t_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 = (1.0 + exp((x * (eps + -1.0)))) / 2.0; tmp = 0.0; if (x <= -1e-271) tmp = (1.0 + exp((x * -eps))) / 2.0; elseif (x <= 1.8e+86) tmp = t_0; elseif (x <= 3.1e+203) tmp = 0.0; elseif (x <= 6e+247) tmp = t_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[(N[(1.0 + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -1e-271], N[(N[(1.0 + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.8e+86], t$95$0, If[LessEqual[x, 3.1e+203], 0.0, If[LessEqual[x, 6e+247], t$95$0, 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 := \frac{1 + e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\mathbf{if}\;x \leq -1 \cdot 10^{-271}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{+86}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{+203}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+247}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if x < -9.99999999999999963e-272Initial program 72.4%
*-commutative72.4%
distribute-rgt-neg-in72.4%
*-commutative72.4%
sub-neg72.4%
metadata-eval72.4%
distribute-rgt-neg-in72.4%
Simplified72.4%
Taylor expanded in eps around inf 99.4%
associate-*r*99.4%
mul-1-neg99.4%
mul-1-neg99.4%
associate-*r*99.4%
mul-1-neg99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in eps around inf 99.4%
*-commutative75.5%
Simplified99.4%
Taylor expanded in eps around inf 99.8%
*-commutative99.8%
mul-1-neg99.8%
distribute-rgt-neg-out99.8%
Simplified99.8%
Taylor expanded in x around 0 65.5%
if -9.99999999999999963e-272 < x < 1.80000000000000003e86 or 3.1e203 < x < 6e247Initial program 59.1%
*-commutative59.1%
distribute-rgt-neg-in59.1%
*-commutative59.1%
sub-neg59.1%
metadata-eval59.1%
distribute-rgt-neg-in59.1%
Simplified59.1%
Taylor expanded in x around 0 33.3%
Taylor expanded in eps around inf 74.2%
mul-1-neg74.2%
distribute-lft-neg-in74.2%
Simplified74.2%
if 1.80000000000000003e86 < x < 3.1e203Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 14.6%
Taylor expanded in x around 0 71.7%
sub-neg71.7%
flip-+37.6%
Applied egg-rr42.1%
div-sub42.1%
+-inverses75.4%
Simplified75.4%
if 6e247 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 23.3%
Taylor expanded in x around 0 65.4%
Final simplification70.1%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (+ 1.0 (exp (* x eps))) 2.0)))
(if (<= x -440.0)
(/ (/ (expm1 (- x)) eps) 2.0)
(if (<= x 2.2e+85)
t_0
(if (<= x 1.5e+199)
0.0
(if (<= x 9.8e+247)
t_0
(/ (+ (+ 1.0 (/ 1.0 eps)) (+ 1.0 (/ -1.0 eps))) 2.0)))))))
double code(double x, double eps) {
double t_0 = (1.0 + exp((x * eps))) / 2.0;
double tmp;
if (x <= -440.0) {
tmp = (expm1(-x) / eps) / 2.0;
} else if (x <= 2.2e+85) {
tmp = t_0;
} else if (x <= 1.5e+199) {
tmp = 0.0;
} else if (x <= 9.8e+247) {
tmp = t_0;
} else {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
public static double code(double x, double eps) {
double t_0 = (1.0 + Math.exp((x * eps))) / 2.0;
double tmp;
if (x <= -440.0) {
tmp = (Math.expm1(-x) / eps) / 2.0;
} else if (x <= 2.2e+85) {
tmp = t_0;
} else if (x <= 1.5e+199) {
tmp = 0.0;
} else if (x <= 9.8e+247) {
tmp = t_0;
} else {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = (1.0 + math.exp((x * eps))) / 2.0 tmp = 0 if x <= -440.0: tmp = (math.expm1(-x) / eps) / 2.0 elif x <= 2.2e+85: tmp = t_0 elif x <= 1.5e+199: tmp = 0.0 elif x <= 9.8e+247: tmp = t_0 else: tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0 return tmp
function code(x, eps) t_0 = Float64(Float64(1.0 + exp(Float64(x * eps))) / 2.0) tmp = 0.0 if (x <= -440.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps) / 2.0); elseif (x <= 2.2e+85) tmp = t_0; elseif (x <= 1.5e+199) tmp = 0.0; elseif (x <= 9.8e+247) tmp = t_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
code[x_, eps_] := Block[{t$95$0 = N[(N[(1.0 + N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -440.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.2e+85], t$95$0, If[LessEqual[x, 1.5e+199], 0.0, If[LessEqual[x, 9.8e+247], t$95$0, 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 := \frac{1 + e^{x \cdot \varepsilon}}{2}\\
\mathbf{if}\;x \leq -440:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{\varepsilon}}{2}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+85}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+199}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 9.8 \cdot 10^{+247}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if x < -440Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 69.4%
Taylor expanded in eps around 0 31.6%
expm1-def31.6%
mul-1-neg31.6%
Simplified31.6%
if -440 < x < 2.2000000000000002e85 or 1.5e199 < x < 9.7999999999999996e247Initial program 58.5%
*-commutative58.5%
distribute-rgt-neg-in58.5%
*-commutative58.5%
sub-neg58.5%
metadata-eval58.5%
distribute-rgt-neg-in58.5%
Simplified58.5%
Taylor expanded in x around 0 34.6%
Taylor expanded in eps around inf 75.8%
mul-1-neg75.8%
distribute-lft-neg-in75.8%
Simplified75.8%
Taylor expanded in eps around inf 76.0%
*-commutative76.0%
Simplified76.0%
if 2.2000000000000002e85 < x < 1.5e199Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 14.6%
Taylor expanded in x around 0 71.7%
sub-neg71.7%
flip-+37.6%
Applied egg-rr42.1%
div-sub42.1%
+-inverses75.4%
Simplified75.4%
if 9.7999999999999996e247 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 23.3%
Taylor expanded in x around 0 65.4%
Final simplification68.8%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (+ 1.0 (exp (* x eps))) 2.0)))
(if (<= x -1e-271)
(/ (+ 1.0 (exp (* x (- 1.0 eps)))) 2.0)
(if (<= x 4e+92)
t_0
(if (<= x 3.8e+203)
0.0
(if (<= x 9.4e+247)
t_0
(/ (+ (+ 1.0 (/ 1.0 eps)) (+ 1.0 (/ -1.0 eps))) 2.0)))))))
double code(double x, double eps) {
double t_0 = (1.0 + exp((x * eps))) / 2.0;
double tmp;
if (x <= -1e-271) {
tmp = (1.0 + exp((x * (1.0 - eps)))) / 2.0;
} else if (x <= 4e+92) {
tmp = t_0;
} else if (x <= 3.8e+203) {
tmp = 0.0;
} else if (x <= 9.4e+247) {
tmp = t_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 = (1.0d0 + exp((x * eps))) / 2.0d0
if (x <= (-1d-271)) then
tmp = (1.0d0 + exp((x * (1.0d0 - eps)))) / 2.0d0
else if (x <= 4d+92) then
tmp = t_0
else if (x <= 3.8d+203) then
tmp = 0.0d0
else if (x <= 9.4d+247) then
tmp = t_0
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 = (1.0 + Math.exp((x * eps))) / 2.0;
double tmp;
if (x <= -1e-271) {
tmp = (1.0 + Math.exp((x * (1.0 - eps)))) / 2.0;
} else if (x <= 4e+92) {
tmp = t_0;
} else if (x <= 3.8e+203) {
tmp = 0.0;
} else if (x <= 9.4e+247) {
tmp = t_0;
} else {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = (1.0 + math.exp((x * eps))) / 2.0 tmp = 0 if x <= -1e-271: tmp = (1.0 + math.exp((x * (1.0 - eps)))) / 2.0 elif x <= 4e+92: tmp = t_0 elif x <= 3.8e+203: tmp = 0.0 elif x <= 9.4e+247: tmp = t_0 else: tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0 return tmp
function code(x, eps) t_0 = Float64(Float64(1.0 + exp(Float64(x * eps))) / 2.0) tmp = 0.0 if (x <= -1e-271) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(1.0 - eps)))) / 2.0); elseif (x <= 4e+92) tmp = t_0; elseif (x <= 3.8e+203) tmp = 0.0; elseif (x <= 9.4e+247) tmp = t_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 = (1.0 + exp((x * eps))) / 2.0; tmp = 0.0; if (x <= -1e-271) tmp = (1.0 + exp((x * (1.0 - eps)))) / 2.0; elseif (x <= 4e+92) tmp = t_0; elseif (x <= 3.8e+203) tmp = 0.0; elseif (x <= 9.4e+247) tmp = t_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[(N[(1.0 + N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -1e-271], N[(N[(1.0 + N[Exp[N[(x * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4e+92], t$95$0, If[LessEqual[x, 3.8e+203], 0.0, If[LessEqual[x, 9.4e+247], t$95$0, 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 := \frac{1 + e^{x \cdot \varepsilon}}{2}\\
\mathbf{if}\;x \leq -1 \cdot 10^{-271}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(1 - \varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+92}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{+203}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 9.4 \cdot 10^{+247}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if x < -9.99999999999999963e-272Initial program 72.4%
*-commutative72.4%
distribute-rgt-neg-in72.4%
*-commutative72.4%
sub-neg72.4%
metadata-eval72.4%
distribute-rgt-neg-in72.4%
Simplified72.4%
Taylor expanded in x around 0 48.0%
Taylor expanded in eps around inf 75.1%
mul-1-neg75.1%
distribute-lft-neg-in75.1%
Simplified75.1%
add-sqr-sqrt75.1%
sqrt-unprod71.5%
sqr-neg71.5%
sqrt-unprod0.0%
add-sqr-sqrt65.0%
sub-neg65.0%
distribute-lft-in65.0%
*-rgt-identity65.0%
Applied egg-rr65.0%
*-commutative65.0%
distribute-rgt1-in65.0%
mul-1-neg65.0%
+-commutative65.0%
*-commutative65.0%
mul-1-neg65.0%
sub-neg65.0%
Simplified65.0%
if -9.99999999999999963e-272 < x < 4.0000000000000002e92 or 3.80000000000000024e203 < x < 9.4000000000000005e247Initial program 59.1%
*-commutative59.1%
distribute-rgt-neg-in59.1%
*-commutative59.1%
sub-neg59.1%
metadata-eval59.1%
distribute-rgt-neg-in59.1%
Simplified59.1%
Taylor expanded in x around 0 33.3%
Taylor expanded in eps around inf 74.2%
mul-1-neg74.2%
distribute-lft-neg-in74.2%
Simplified74.2%
Taylor expanded in eps around inf 74.2%
*-commutative74.2%
Simplified74.2%
if 4.0000000000000002e92 < x < 3.80000000000000024e203Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 14.6%
Taylor expanded in x around 0 71.7%
sub-neg71.7%
flip-+37.6%
Applied egg-rr42.1%
div-sub42.1%
+-inverses75.4%
Simplified75.4%
if 9.4000000000000005e247 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 23.3%
Taylor expanded in x around 0 65.4%
Final simplification69.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (+ 1.0 (exp (* x eps))) 2.0)))
(if (<= x -4.5e-272)
(/ (+ 1.0 (exp (* x (- eps)))) 2.0)
(if (<= x 1.3e+93)
t_0
(if (<= x 7.5e+201)
0.0
(if (<= x 4e+247)
t_0
(/ (+ (+ 1.0 (/ 1.0 eps)) (+ 1.0 (/ -1.0 eps))) 2.0)))))))
double code(double x, double eps) {
double t_0 = (1.0 + exp((x * eps))) / 2.0;
double tmp;
if (x <= -4.5e-272) {
tmp = (1.0 + exp((x * -eps))) / 2.0;
} else if (x <= 1.3e+93) {
tmp = t_0;
} else if (x <= 7.5e+201) {
tmp = 0.0;
} else if (x <= 4e+247) {
tmp = t_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 = (1.0d0 + exp((x * eps))) / 2.0d0
if (x <= (-4.5d-272)) then
tmp = (1.0d0 + exp((x * -eps))) / 2.0d0
else if (x <= 1.3d+93) then
tmp = t_0
else if (x <= 7.5d+201) then
tmp = 0.0d0
else if (x <= 4d+247) then
tmp = t_0
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 = (1.0 + Math.exp((x * eps))) / 2.0;
double tmp;
if (x <= -4.5e-272) {
tmp = (1.0 + Math.exp((x * -eps))) / 2.0;
} else if (x <= 1.3e+93) {
tmp = t_0;
} else if (x <= 7.5e+201) {
tmp = 0.0;
} else if (x <= 4e+247) {
tmp = t_0;
} else {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = (1.0 + math.exp((x * eps))) / 2.0 tmp = 0 if x <= -4.5e-272: tmp = (1.0 + math.exp((x * -eps))) / 2.0 elif x <= 1.3e+93: tmp = t_0 elif x <= 7.5e+201: tmp = 0.0 elif x <= 4e+247: tmp = t_0 else: tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0 return tmp
function code(x, eps) t_0 = Float64(Float64(1.0 + exp(Float64(x * eps))) / 2.0) tmp = 0.0 if (x <= -4.5e-272) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps)))) / 2.0); elseif (x <= 1.3e+93) tmp = t_0; elseif (x <= 7.5e+201) tmp = 0.0; elseif (x <= 4e+247) tmp = t_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 = (1.0 + exp((x * eps))) / 2.0; tmp = 0.0; if (x <= -4.5e-272) tmp = (1.0 + exp((x * -eps))) / 2.0; elseif (x <= 1.3e+93) tmp = t_0; elseif (x <= 7.5e+201) tmp = 0.0; elseif (x <= 4e+247) tmp = t_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[(N[(1.0 + N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -4.5e-272], N[(N[(1.0 + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.3e+93], t$95$0, If[LessEqual[x, 7.5e+201], 0.0, If[LessEqual[x, 4e+247], t$95$0, 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 := \frac{1 + e^{x \cdot \varepsilon}}{2}\\
\mathbf{if}\;x \leq -4.5 \cdot 10^{-272}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{+93}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+201}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+247}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if x < -4.4999999999999998e-272Initial program 72.4%
*-commutative72.4%
distribute-rgt-neg-in72.4%
*-commutative72.4%
sub-neg72.4%
metadata-eval72.4%
distribute-rgt-neg-in72.4%
Simplified72.4%
Taylor expanded in eps around inf 99.4%
associate-*r*99.4%
mul-1-neg99.4%
mul-1-neg99.4%
associate-*r*99.4%
mul-1-neg99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in eps around inf 99.4%
*-commutative75.5%
Simplified99.4%
Taylor expanded in eps around inf 99.8%
*-commutative99.8%
mul-1-neg99.8%
distribute-rgt-neg-out99.8%
Simplified99.8%
Taylor expanded in x around 0 65.5%
if -4.4999999999999998e-272 < x < 1.3e93 or 7.5000000000000004e201 < x < 3.99999999999999981e247Initial program 59.1%
*-commutative59.1%
distribute-rgt-neg-in59.1%
*-commutative59.1%
sub-neg59.1%
metadata-eval59.1%
distribute-rgt-neg-in59.1%
Simplified59.1%
Taylor expanded in x around 0 33.3%
Taylor expanded in eps around inf 74.2%
mul-1-neg74.2%
distribute-lft-neg-in74.2%
Simplified74.2%
Taylor expanded in eps around inf 74.2%
*-commutative74.2%
Simplified74.2%
if 1.3e93 < x < 7.5000000000000004e201Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 14.6%
Taylor expanded in x around 0 71.7%
sub-neg71.7%
flip-+37.6%
Applied egg-rr42.1%
div-sub42.1%
+-inverses75.4%
Simplified75.4%
if 3.99999999999999981e247 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 23.3%
Taylor expanded in x around 0 65.4%
Final simplification70.1%
(FPCore (x eps)
:precision binary64
(if (<= x -480.0)
(/ (/ (expm1 (- x)) eps) 2.0)
(if (<= x 450.0)
1.0
(if (<= x 1e+201)
0.0
(if (<= x 4.1e+247)
(/ (/ (expm1 x) eps) 2.0)
(/ (+ (+ 1.0 (/ 1.0 eps)) (+ 1.0 (/ -1.0 eps))) 2.0))))))
double code(double x, double eps) {
double tmp;
if (x <= -480.0) {
tmp = (expm1(-x) / eps) / 2.0;
} else if (x <= 450.0) {
tmp = 1.0;
} else if (x <= 1e+201) {
tmp = 0.0;
} else if (x <= 4.1e+247) {
tmp = (expm1(x) / eps) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.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 <= 450.0) {
tmp = 1.0;
} else if (x <= 1e+201) {
tmp = 0.0;
} else if (x <= 4.1e+247) {
tmp = (Math.expm1(x) / eps) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -480.0: tmp = (math.expm1(-x) / eps) / 2.0 elif x <= 450.0: tmp = 1.0 elif x <= 1e+201: tmp = 0.0 elif x <= 4.1e+247: tmp = (math.expm1(x) / eps) / 2.0 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 <= -480.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps) / 2.0); elseif (x <= 450.0) tmp = 1.0; elseif (x <= 1e+201) tmp = 0.0; elseif (x <= 4.1e+247) tmp = Float64(Float64(expm1(x) / 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
code[x_, eps_] := If[LessEqual[x, -480.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 450.0], 1.0, If[LessEqual[x, 1e+201], 0.0, If[LessEqual[x, 4.1e+247], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps), $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}
\mathbf{if}\;x \leq -480:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{\varepsilon}}{2}\\
\mathbf{elif}\;x \leq 450:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 10^{+201}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{+247}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if x < -480Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 69.4%
Taylor expanded in eps around 0 31.6%
expm1-def31.6%
mul-1-neg31.6%
Simplified31.6%
if -480 < x < 450Initial program 50.2%
*-commutative50.2%
distribute-rgt-neg-in50.2%
*-commutative50.2%
sub-neg50.2%
metadata-eval50.2%
distribute-rgt-neg-in50.2%
Simplified50.2%
Taylor expanded in x around 0 72.0%
if 450 < x < 1.00000000000000004e201Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 23.9%
Taylor expanded in x around 0 62.2%
sub-neg62.2%
flip-+34.2%
Applied egg-rr37.2%
div-sub37.2%
+-inverses64.0%
Simplified64.0%
if 1.00000000000000004e201 < x < 4.1000000000000002e247Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 32.7%
Taylor expanded in eps around 0 1.8%
expm1-def1.8%
mul-1-neg1.8%
Simplified1.8%
expm1-log1p-u1.7%
expm1-udef1.6%
div-inv1.6%
associate-*r/1.6%
*-commutative1.6%
*-un-lft-identity1.6%
add-sqr-sqrt0.0%
sqrt-unprod30.9%
sqr-neg30.9%
sqrt-unprod30.9%
add-sqr-sqrt30.9%
Applied egg-rr30.9%
expm1-def30.9%
expm1-log1p31.1%
Simplified31.1%
if 4.1000000000000002e247 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 23.3%
Taylor expanded in x around 0 65.4%
Final simplification62.3%
(FPCore (x eps)
:precision binary64
(if (<= x 1.8e-25)
(/ (+ 1.0 (+ 1.0 (* x (- 1.0 eps)))) 2.0)
(if (<= x 2e+199)
0.0
(if (<= x 2.7e+247)
(/ (/ (expm1 x) eps) 2.0)
(/ (+ (+ 1.0 (/ 1.0 eps)) (+ 1.0 (/ -1.0 eps))) 2.0)))))
double code(double x, double eps) {
double tmp;
if (x <= 1.8e-25) {
tmp = (1.0 + (1.0 + (x * (1.0 - eps)))) / 2.0;
} else if (x <= 2e+199) {
tmp = 0.0;
} else if (x <= 2.7e+247) {
tmp = (expm1(x) / eps) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
public static double code(double x, double eps) {
double tmp;
if (x <= 1.8e-25) {
tmp = (1.0 + (1.0 + (x * (1.0 - eps)))) / 2.0;
} else if (x <= 2e+199) {
tmp = 0.0;
} else if (x <= 2.7e+247) {
tmp = (Math.expm1(x) / eps) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.8e-25: tmp = (1.0 + (1.0 + (x * (1.0 - eps)))) / 2.0 elif x <= 2e+199: tmp = 0.0 elif x <= 2.7e+247: tmp = (math.expm1(x) / eps) / 2.0 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 <= 1.8e-25) tmp = Float64(Float64(1.0 + Float64(1.0 + Float64(x * Float64(1.0 - eps)))) / 2.0); elseif (x <= 2e+199) tmp = 0.0; elseif (x <= 2.7e+247) tmp = Float64(Float64(expm1(x) / 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
code[x_, eps_] := If[LessEqual[x, 1.8e-25], N[(N[(1.0 + N[(1.0 + N[(x * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2e+199], 0.0, If[LessEqual[x, 2.7e+247], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps), $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}
\mathbf{if}\;x \leq 1.8 \cdot 10^{-25}:\\
\;\;\;\;\frac{1 + \left(1 + x \cdot \left(1 - \varepsilon\right)\right)}{2}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+199}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{+247}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if x < 1.8e-25Initial program 59.9%
*-commutative59.9%
distribute-rgt-neg-in59.9%
*-commutative59.9%
sub-neg59.9%
metadata-eval59.9%
distribute-rgt-neg-in59.9%
Simplified59.9%
Taylor expanded in x around 0 41.4%
Taylor expanded in eps around inf 81.2%
mul-1-neg81.2%
distribute-lft-neg-in81.2%
Simplified81.2%
*-commutative81.2%
*-un-lft-identity81.2%
exp-prod81.2%
*-commutative81.2%
add-sqr-sqrt51.0%
sqrt-unprod80.2%
sqr-neg80.2%
sqrt-unprod31.3%
add-sqr-sqrt76.4%
Applied egg-rr76.4%
exp-1-e76.4%
Simplified76.4%
Taylor expanded in x around 0 62.0%
associate-*r*62.0%
log-E62.0%
associate-*r*62.0%
Simplified62.0%
if 1.8e-25 < x < 2.00000000000000019e199Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 25.2%
Taylor expanded in x around 0 59.4%
sub-neg59.4%
flip-+32.6%
Applied egg-rr35.5%
div-sub35.5%
+-inverses61.1%
Simplified61.1%
if 2.00000000000000019e199 < x < 2.7e247Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 32.7%
Taylor expanded in eps around 0 1.8%
expm1-def1.8%
mul-1-neg1.8%
Simplified1.8%
expm1-log1p-u1.7%
expm1-udef1.6%
div-inv1.6%
associate-*r/1.6%
*-commutative1.6%
*-un-lft-identity1.6%
add-sqr-sqrt0.0%
sqrt-unprod30.9%
sqr-neg30.9%
sqrt-unprod30.9%
add-sqr-sqrt30.9%
Applied egg-rr30.9%
expm1-def30.9%
expm1-log1p31.1%
Simplified31.1%
if 2.7e247 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 23.3%
Taylor expanded in x around 0 65.4%
Final simplification60.5%
(FPCore (x eps)
:precision binary64
(if (<= x 1.8e-25)
(/ (+ 1.0 (+ 1.0 (* x (- 1.0 eps)))) 2.0)
(if (<= x 1.25e+202)
0.0
(if (<= x 5.5e+247)
(/ (+ 2.0 (* x eps)) 2.0)
(/ (+ (+ 1.0 (/ 1.0 eps)) (+ 1.0 (/ -1.0 eps))) 2.0)))))
double code(double x, double eps) {
double tmp;
if (x <= 1.8e-25) {
tmp = (1.0 + (1.0 + (x * (1.0 - eps)))) / 2.0;
} else if (x <= 1.25e+202) {
tmp = 0.0;
} else if (x <= 5.5e+247) {
tmp = (2.0 + (x * 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) :: tmp
if (x <= 1.8d-25) then
tmp = (1.0d0 + (1.0d0 + (x * (1.0d0 - eps)))) / 2.0d0
else if (x <= 1.25d+202) then
tmp = 0.0d0
else if (x <= 5.5d+247) then
tmp = (2.0d0 + (x * 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 tmp;
if (x <= 1.8e-25) {
tmp = (1.0 + (1.0 + (x * (1.0 - eps)))) / 2.0;
} else if (x <= 1.25e+202) {
tmp = 0.0;
} else if (x <= 5.5e+247) {
tmp = (2.0 + (x * eps)) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps)) + (1.0 + (-1.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.8e-25: tmp = (1.0 + (1.0 + (x * (1.0 - eps)))) / 2.0 elif x <= 1.25e+202: tmp = 0.0 elif x <= 5.5e+247: tmp = (2.0 + (x * eps)) / 2.0 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 <= 1.8e-25) tmp = Float64(Float64(1.0 + Float64(1.0 + Float64(x * Float64(1.0 - eps)))) / 2.0); elseif (x <= 1.25e+202) tmp = 0.0; elseif (x <= 5.5e+247) tmp = Float64(Float64(2.0 + Float64(x * 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) tmp = 0.0; if (x <= 1.8e-25) tmp = (1.0 + (1.0 + (x * (1.0 - eps)))) / 2.0; elseif (x <= 1.25e+202) tmp = 0.0; elseif (x <= 5.5e+247) tmp = (2.0 + (x * 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_] := If[LessEqual[x, 1.8e-25], N[(N[(1.0 + N[(1.0 + N[(x * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.25e+202], 0.0, If[LessEqual[x, 5.5e+247], N[(N[(2.0 + N[(x * 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}
\mathbf{if}\;x \leq 1.8 \cdot 10^{-25}:\\
\;\;\;\;\frac{1 + \left(1 + x \cdot \left(1 - \varepsilon\right)\right)}{2}\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{+202}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+247}:\\
\;\;\;\;\frac{2 + x \cdot \varepsilon}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if x < 1.8e-25Initial program 59.9%
*-commutative59.9%
distribute-rgt-neg-in59.9%
*-commutative59.9%
sub-neg59.9%
metadata-eval59.9%
distribute-rgt-neg-in59.9%
Simplified59.9%
Taylor expanded in x around 0 41.4%
Taylor expanded in eps around inf 81.2%
mul-1-neg81.2%
distribute-lft-neg-in81.2%
Simplified81.2%
*-commutative81.2%
*-un-lft-identity81.2%
exp-prod81.2%
*-commutative81.2%
add-sqr-sqrt51.0%
sqrt-unprod80.2%
sqr-neg80.2%
sqrt-unprod31.3%
add-sqr-sqrt76.4%
Applied egg-rr76.4%
exp-1-e76.4%
Simplified76.4%
Taylor expanded in x around 0 62.0%
associate-*r*62.0%
log-E62.0%
associate-*r*62.0%
Simplified62.0%
if 1.8e-25 < x < 1.25e202Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 25.2%
Taylor expanded in x around 0 59.4%
sub-neg59.4%
flip-+32.6%
Applied egg-rr35.5%
div-sub35.5%
+-inverses61.1%
Simplified61.1%
if 1.25e202 < x < 5.4999999999999998e247Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 32.7%
Taylor expanded in x around 0 17.1%
associate-*r*17.1%
mul-1-neg17.1%
*-commutative17.1%
Simplified17.1%
Taylor expanded in eps around inf 17.4%
+-commutative17.4%
Simplified17.4%
if 5.4999999999999998e247 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 23.3%
Taylor expanded in x around 0 65.4%
Final simplification59.8%
(FPCore (x eps)
:precision binary64
(if (<= x -1.0)
(/ (* x (- eps)) 2.0)
(if (<= x 600.0)
1.0
(if (<= x 3.8e+205)
0.0
(if (<= x 4.8e+247) (/ (+ 2.0 (* x eps)) 2.0) 0.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -1.0) {
tmp = (x * -eps) / 2.0;
} else if (x <= 600.0) {
tmp = 1.0;
} else if (x <= 3.8e+205) {
tmp = 0.0;
} else if (x <= 4.8e+247) {
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 <= (-1.0d0)) then
tmp = (x * -eps) / 2.0d0
else if (x <= 600.0d0) then
tmp = 1.0d0
else if (x <= 3.8d+205) then
tmp = 0.0d0
else if (x <= 4.8d+247) 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 <= -1.0) {
tmp = (x * -eps) / 2.0;
} else if (x <= 600.0) {
tmp = 1.0;
} else if (x <= 3.8e+205) {
tmp = 0.0;
} else if (x <= 4.8e+247) {
tmp = (2.0 + (x * eps)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -1.0: tmp = (x * -eps) / 2.0 elif x <= 600.0: tmp = 1.0 elif x <= 3.8e+205: tmp = 0.0 elif x <= 4.8e+247: tmp = (2.0 + (x * eps)) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(x * Float64(-eps)) / 2.0); elseif (x <= 600.0) tmp = 1.0; elseif (x <= 3.8e+205) tmp = 0.0; elseif (x <= 4.8e+247) 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 <= -1.0) tmp = (x * -eps) / 2.0; elseif (x <= 600.0) tmp = 1.0; elseif (x <= 3.8e+205) tmp = 0.0; elseif (x <= 4.8e+247) tmp = (2.0 + (x * eps)) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -1.0], N[(N[(x * (-eps)), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 600.0], 1.0, If[LessEqual[x, 3.8e+205], 0.0, If[LessEqual[x, 4.8e+247], N[(N[(2.0 + N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{x \cdot \left(-\varepsilon\right)}{2}\\
\mathbf{elif}\;x \leq 600:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{+205}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+247}:\\
\;\;\;\;\frac{2 + x \cdot \varepsilon}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 58.7%
associate-*r*58.7%
mul-1-neg58.7%
+-commutative58.7%
Simplified58.7%
Taylor expanded in x around inf 21.9%
Taylor expanded in eps around inf 21.9%
associate-*r*21.9%
mul-1-neg21.9%
Simplified21.9%
if -1 < x < 600Initial program 50.2%
*-commutative50.2%
distribute-rgt-neg-in50.2%
*-commutative50.2%
sub-neg50.2%
metadata-eval50.2%
distribute-rgt-neg-in50.2%
Simplified50.2%
Taylor expanded in x around 0 72.0%
if 600 < x < 3.8e205 or 4.8e247 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 23.7%
Taylor expanded in x around 0 63.0%
sub-neg63.0%
flip-+32.8%
Applied egg-rr35.1%
div-sub35.1%
+-inverses64.2%
Simplified64.2%
if 3.8e205 < x < 4.8e247Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 32.7%
Taylor expanded in x around 0 17.1%
associate-*r*17.1%
mul-1-neg17.1%
*-commutative17.1%
Simplified17.1%
Taylor expanded in eps around inf 17.4%
+-commutative17.4%
Simplified17.4%
Final simplification60.1%
(FPCore (x eps) :precision binary64 (if (<= x 1.8e-25) (/ (+ 1.0 (+ 1.0 (* x (- 1.0 eps)))) 2.0) (if (<= x 2.6e+206) 0.0 (if (<= x 6e+247) (/ (+ 2.0 (* x eps)) 2.0) 0.0))))
double code(double x, double eps) {
double tmp;
if (x <= 1.8e-25) {
tmp = (1.0 + (1.0 + (x * (1.0 - eps)))) / 2.0;
} else if (x <= 2.6e+206) {
tmp = 0.0;
} else if (x <= 6e+247) {
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 <= 1.8d-25) then
tmp = (1.0d0 + (1.0d0 + (x * (1.0d0 - eps)))) / 2.0d0
else if (x <= 2.6d+206) then
tmp = 0.0d0
else if (x <= 6d+247) 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 <= 1.8e-25) {
tmp = (1.0 + (1.0 + (x * (1.0 - eps)))) / 2.0;
} else if (x <= 2.6e+206) {
tmp = 0.0;
} else if (x <= 6e+247) {
tmp = (2.0 + (x * eps)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.8e-25: tmp = (1.0 + (1.0 + (x * (1.0 - eps)))) / 2.0 elif x <= 2.6e+206: tmp = 0.0 elif x <= 6e+247: tmp = (2.0 + (x * eps)) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 1.8e-25) tmp = Float64(Float64(1.0 + Float64(1.0 + Float64(x * Float64(1.0 - eps)))) / 2.0); elseif (x <= 2.6e+206) tmp = 0.0; elseif (x <= 6e+247) 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 <= 1.8e-25) tmp = (1.0 + (1.0 + (x * (1.0 - eps)))) / 2.0; elseif (x <= 2.6e+206) tmp = 0.0; elseif (x <= 6e+247) tmp = (2.0 + (x * eps)) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 1.8e-25], N[(N[(1.0 + N[(1.0 + N[(x * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.6e+206], 0.0, If[LessEqual[x, 6e+247], N[(N[(2.0 + N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.8 \cdot 10^{-25}:\\
\;\;\;\;\frac{1 + \left(1 + x \cdot \left(1 - \varepsilon\right)\right)}{2}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+206}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+247}:\\
\;\;\;\;\frac{2 + x \cdot \varepsilon}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.8e-25Initial program 59.9%
*-commutative59.9%
distribute-rgt-neg-in59.9%
*-commutative59.9%
sub-neg59.9%
metadata-eval59.9%
distribute-rgt-neg-in59.9%
Simplified59.9%
Taylor expanded in x around 0 41.4%
Taylor expanded in eps around inf 81.2%
mul-1-neg81.2%
distribute-lft-neg-in81.2%
Simplified81.2%
*-commutative81.2%
*-un-lft-identity81.2%
exp-prod81.2%
*-commutative81.2%
add-sqr-sqrt51.0%
sqrt-unprod80.2%
sqr-neg80.2%
sqrt-unprod31.3%
add-sqr-sqrt76.4%
Applied egg-rr76.4%
exp-1-e76.4%
Simplified76.4%
Taylor expanded in x around 0 62.0%
associate-*r*62.0%
log-E62.0%
associate-*r*62.0%
Simplified62.0%
if 1.8e-25 < x < 2.59999999999999989e206 or 6e247 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 24.7%
Taylor expanded in x around 0 60.9%
sub-neg60.9%
flip-+31.6%
Applied egg-rr33.9%
div-sub33.9%
+-inverses62.0%
Simplified62.0%
if 2.59999999999999989e206 < x < 6e247Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 32.7%
Taylor expanded in x around 0 17.1%
associate-*r*17.1%
mul-1-neg17.1%
*-commutative17.1%
Simplified17.1%
Taylor expanded in eps around inf 17.4%
+-commutative17.4%
Simplified17.4%
Final simplification59.7%
(FPCore (x eps) :precision binary64 (if (<= x -1.0) (/ (* x (- eps)) 2.0) (if (<= x 500.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 <= 500.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 <= 500.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 <= 500.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 <= 500.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(x * Float64(-eps)) / 2.0); elseif (x <= 500.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 <= 500.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -1.0], N[(N[(x * (-eps)), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 500.0], 1.0, 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{x \cdot \left(-\varepsilon\right)}{2}\\
\mathbf{elif}\;x \leq 500:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 58.7%
associate-*r*58.7%
mul-1-neg58.7%
+-commutative58.7%
Simplified58.7%
Taylor expanded in x around inf 21.9%
Taylor expanded in eps around inf 21.9%
associate-*r*21.9%
mul-1-neg21.9%
Simplified21.9%
if -1 < x < 500Initial program 50.2%
*-commutative50.2%
distribute-rgt-neg-in50.2%
*-commutative50.2%
sub-neg50.2%
metadata-eval50.2%
distribute-rgt-neg-in50.2%
Simplified50.2%
Taylor expanded in x around 0 72.0%
if 500 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 25.4%
Taylor expanded in x around 0 54.4%
sub-neg54.4%
flip-+26.6%
Applied egg-rr30.1%
div-sub30.1%
+-inverses56.6%
Simplified56.6%
Final simplification60.5%
(FPCore (x eps) :precision binary64 (if (<= x 600.0) 1.0 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 600.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 <= 600.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 <= 600.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 600.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 600.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 600.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 600.0], 1.0, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 600:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 600Initial program 60.3%
*-commutative60.3%
distribute-rgt-neg-in60.3%
*-commutative60.3%
sub-neg60.3%
metadata-eval60.3%
distribute-rgt-neg-in60.3%
Simplified60.3%
Taylor expanded in x around 0 58.1%
if 600 < x Initial program 100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 25.4%
Taylor expanded in x around 0 54.4%
sub-neg54.4%
flip-+26.6%
Applied egg-rr30.1%
div-sub30.1%
+-inverses56.6%
Simplified56.6%
Final simplification57.7%
(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 70.8%
*-commutative70.8%
distribute-rgt-neg-in70.8%
*-commutative70.8%
sub-neg70.8%
metadata-eval70.8%
distribute-rgt-neg-in70.8%
Simplified70.8%
Taylor expanded in x around 0 37.2%
Taylor expanded in x around 0 28.0%
sub-neg28.0%
flip-+9.7%
Applied egg-rr9.2%
div-sub9.2%
+-inverses16.8%
Simplified16.8%
Final simplification16.8%
herbie shell --seed 2023305
(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))