
(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 (/ (+ (exp (* x (+ -1.0 eps))) (exp (* x (- -1.0 eps)))) 2.0))
double code(double x, double eps) {
return (exp((x * (-1.0 + eps))) + 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 * ((-1.0d0) + eps))) + exp((x * ((-1.0d0) - eps)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (Math.exp((x * (-1.0 + eps))) + Math.exp((x * (-1.0 - eps)))) / 2.0;
}
def code(x, eps): return (math.exp((x * (-1.0 + eps))) + math.exp((x * (-1.0 - eps)))) / 2.0
function code(x, eps) return Float64(Float64(exp(Float64(x * Float64(-1.0 + eps))) + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0) end
function tmp = code(x, eps) tmp = (exp((x * (-1.0 + eps))) + exp((x * (-1.0 - eps)))) / 2.0; end
code[x_, eps_] := N[(N[(N[Exp[N[(x * N[(-1.0 + eps), $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(-1 + \varepsilon\right)} + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}
\end{array}
Initial program 77.3%
Simplified66.2%
Taylor expanded in eps around inf 99.1%
Taylor expanded in eps around -inf 99.1%
associate-*r*99.1%
*-commutative99.1%
associate-*l*99.1%
cancel-sign-sub-inv99.1%
metadata-eval99.1%
*-lft-identity99.1%
distribute-lft-in99.1%
metadata-eval99.1%
mul-1-neg99.1%
unsub-neg99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 1.0 eps))))
(if (<= eps 1.0)
(/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0)
(if (<= eps 3.55e+103)
(/
(+
(+ t_0 (* x (* t_0 (+ -1.0 eps))))
(* (exp (* x (- -1.0 eps))) (- (/ -1.0 eps) -1.0)))
2.0)
(/
(+
2.0
(+
(* 2.0 (/ 1.0 eps))
(*
x
(+
(* t_0 (- -1.0 eps))
(+ (* t_0 (+ eps 1.0)) (* x (* t_0 (pow (+ eps 1.0) 2.0))))))))
2.0)))))
double code(double x, double eps) {
double t_0 = 1.0 + (1.0 / eps);
double tmp;
if (eps <= 1.0) {
tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else if (eps <= 3.55e+103) {
tmp = ((t_0 + (x * (t_0 * (-1.0 + eps)))) + (exp((x * (-1.0 - eps))) * ((-1.0 / eps) - -1.0))) / 2.0;
} else {
tmp = (2.0 + ((2.0 * (1.0 / eps)) + (x * ((t_0 * (-1.0 - eps)) + ((t_0 * (eps + 1.0)) + (x * (t_0 * pow((eps + 1.0), 2.0)))))))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (1.0d0 / eps)
if (eps <= 1.0d0) then
tmp = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
else if (eps <= 3.55d+103) then
tmp = ((t_0 + (x * (t_0 * ((-1.0d0) + eps)))) + (exp((x * ((-1.0d0) - eps))) * (((-1.0d0) / eps) - (-1.0d0)))) / 2.0d0
else
tmp = (2.0d0 + ((2.0d0 * (1.0d0 / eps)) + (x * ((t_0 * ((-1.0d0) - eps)) + ((t_0 * (eps + 1.0d0)) + (x * (t_0 * ((eps + 1.0d0) ** 2.0d0)))))))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = 1.0 + (1.0 / eps);
double tmp;
if (eps <= 1.0) {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else if (eps <= 3.55e+103) {
tmp = ((t_0 + (x * (t_0 * (-1.0 + eps)))) + (Math.exp((x * (-1.0 - eps))) * ((-1.0 / eps) - -1.0))) / 2.0;
} else {
tmp = (2.0 + ((2.0 * (1.0 / eps)) + (x * ((t_0 * (-1.0 - eps)) + ((t_0 * (eps + 1.0)) + (x * (t_0 * Math.pow((eps + 1.0), 2.0)))))))) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = 1.0 + (1.0 / eps) tmp = 0 if eps <= 1.0: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 elif eps <= 3.55e+103: tmp = ((t_0 + (x * (t_0 * (-1.0 + eps)))) + (math.exp((x * (-1.0 - eps))) * ((-1.0 / eps) - -1.0))) / 2.0 else: tmp = (2.0 + ((2.0 * (1.0 / eps)) + (x * ((t_0 * (-1.0 - eps)) + ((t_0 * (eps + 1.0)) + (x * (t_0 * math.pow((eps + 1.0), 2.0)))))))) / 2.0 return tmp
function code(x, eps) t_0 = Float64(1.0 + Float64(1.0 / eps)) tmp = 0.0 if (eps <= 1.0) tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); elseif (eps <= 3.55e+103) tmp = Float64(Float64(Float64(t_0 + Float64(x * Float64(t_0 * Float64(-1.0 + eps)))) + Float64(exp(Float64(x * Float64(-1.0 - eps))) * Float64(Float64(-1.0 / eps) - -1.0))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(Float64(2.0 * Float64(1.0 / eps)) + Float64(x * Float64(Float64(t_0 * Float64(-1.0 - eps)) + Float64(Float64(t_0 * Float64(eps + 1.0)) + Float64(x * Float64(t_0 * (Float64(eps + 1.0) ^ 2.0)))))))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = 1.0 + (1.0 / eps); tmp = 0.0; if (eps <= 1.0) tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; elseif (eps <= 3.55e+103) tmp = ((t_0 + (x * (t_0 * (-1.0 + eps)))) + (exp((x * (-1.0 - eps))) * ((-1.0 / eps) - -1.0))) / 2.0; else tmp = (2.0 + ((2.0 * (1.0 / eps)) + (x * ((t_0 * (-1.0 - eps)) + ((t_0 * (eps + 1.0)) + (x * (t_0 * ((eps + 1.0) ^ 2.0)))))))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, 1.0], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 3.55e+103], N[(N[(N[(t$95$0 + N[(x * N[(t$95$0 * N[(-1.0 + eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(-1.0 / eps), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(N[(2.0 * N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] + N[(x * N[(N[(t$95$0 * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$0 * N[(eps + 1.0), $MachinePrecision]), $MachinePrecision] + N[(x * N[(t$95$0 * N[Power[N[(eps + 1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{1}{\varepsilon}\\
\mathbf{if}\;\varepsilon \leq 1:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\mathbf{elif}\;\varepsilon \leq 3.55 \cdot 10^{+103}:\\
\;\;\;\;\frac{\left(t\_0 + x \cdot \left(t\_0 \cdot \left(-1 + \varepsilon\right)\right)\right) + e^{x \cdot \left(-1 - \varepsilon\right)} \cdot \left(\frac{-1}{\varepsilon} - -1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \left(2 \cdot \frac{1}{\varepsilon} + x \cdot \left(t\_0 \cdot \left(-1 - \varepsilon\right) + \left(t\_0 \cdot \left(\varepsilon + 1\right) + x \cdot \left(t\_0 \cdot {\left(\varepsilon + 1\right)}^{2}\right)\right)\right)\right)}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 67.2%
Simplified57.5%
Taylor expanded in eps around 0 36.3%
Simplified70.2%
Taylor expanded in eps around 0 70.2%
if 1 < eps < 3.5500000000000001e103Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 73.8%
+-commutative73.8%
associate-+r+73.8%
mul-1-neg73.8%
distribute-rgt-neg-in73.8%
*-commutative73.8%
distribute-rgt-neg-in73.8%
distribute-neg-in73.8%
metadata-eval73.8%
distribute-neg-frac73.8%
metadata-eval73.8%
Simplified73.8%
if 3.5500000000000001e103 < eps Initial program 100.0%
Simplified86.0%
add-cube-cbrt85.8%
pow385.7%
Applied egg-rr99.6%
Taylor expanded in x around 0 89.2%
Final simplification75.0%
(FPCore (x eps)
:precision binary64
(if (<= x -1e-261)
(/ (+ 1.0 (exp (* x (- -1.0 eps)))) 2.0)
(if (or (<= x 1.65e-13)
(not
(or (<= x 68000000000000.0)
(and (not (<= x 4.2e+67)) (<= x 1.15e+105)))))
(/ (+ 1.0 (exp (* x (+ -1.0 eps)))) 2.0)
(/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= -1e-261) {
tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0;
} else if ((x <= 1.65e-13) || !((x <= 68000000000000.0) || (!(x <= 4.2e+67) && (x <= 1.15e+105)))) {
tmp = (1.0 + exp((x * (-1.0 + eps)))) / 2.0;
} else {
tmp = (exp(-x) * (2.0 + (x * 2.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 <= (-1d-261)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps)))) / 2.0d0
else if ((x <= 1.65d-13) .or. (.not. (x <= 68000000000000.0d0) .or. (.not. (x <= 4.2d+67)) .and. (x <= 1.15d+105))) then
tmp = (1.0d0 + exp((x * ((-1.0d0) + eps)))) / 2.0d0
else
tmp = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -1e-261) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps)))) / 2.0;
} else if ((x <= 1.65e-13) || !((x <= 68000000000000.0) || (!(x <= 4.2e+67) && (x <= 1.15e+105)))) {
tmp = (1.0 + Math.exp((x * (-1.0 + eps)))) / 2.0;
} else {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -1e-261: tmp = (1.0 + math.exp((x * (-1.0 - eps)))) / 2.0 elif (x <= 1.65e-13) or not ((x <= 68000000000000.0) or (not (x <= 4.2e+67) and (x <= 1.15e+105))): tmp = (1.0 + math.exp((x * (-1.0 + eps)))) / 2.0 else: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -1e-261) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0); elseif ((x <= 1.65e-13) || !((x <= 68000000000000.0) || (!(x <= 4.2e+67) && (x <= 1.15e+105)))) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps)))) / 2.0); else tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -1e-261) tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0; elseif ((x <= 1.65e-13) || ~(((x <= 68000000000000.0) || (~((x <= 4.2e+67)) && (x <= 1.15e+105))))) tmp = (1.0 + exp((x * (-1.0 + eps)))) / 2.0; else tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -1e-261], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.65e-13], N[Not[Or[LessEqual[x, 68000000000000.0], And[N[Not[LessEqual[x, 4.2e+67]], $MachinePrecision], LessEqual[x, 1.15e+105]]]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-261}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-13} \lor \neg \left(x \leq 68000000000000 \lor \neg \left(x \leq 4.2 \cdot 10^{+67}\right) \land x \leq 1.15 \cdot 10^{+105}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + \varepsilon\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\end{array}
\end{array}
if x < -9.99999999999999984e-262Initial program 73.5%
Simplified73.5%
Taylor expanded in x around 0 49.8%
Taylor expanded in eps around inf 75.8%
cancel-sign-sub-inv75.8%
metadata-eval75.8%
*-lft-identity75.8%
associate-*r*75.8%
+-commutative75.8%
exp-prod66.1%
+-commutative66.1%
*-lft-identity66.1%
metadata-eval66.1%
cancel-sign-sub-inv66.1%
exp-prod75.8%
associate-*r*75.8%
mul-1-neg75.8%
mul-1-neg75.8%
associate-*r*75.8%
*-commutative75.8%
associate-*l*75.8%
cancel-sign-sub-inv75.8%
metadata-eval75.8%
*-lft-identity75.8%
distribute-lft-in75.8%
Simplified75.8%
if -9.99999999999999984e-262 < x < 1.65e-13 or 6.8e13 < x < 4.2000000000000003e67 or 1.1499999999999999e105 < x Initial program 79.6%
Simplified69.6%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around -inf 100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l*100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
*-lft-identity100.0%
distribute-lft-in100.0%
metadata-eval100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 60.3%
if 1.65e-13 < x < 6.8e13 or 4.2000000000000003e67 < x < 1.1499999999999999e105Initial program 82.4%
Simplified82.4%
Taylor expanded in eps around 0 73.4%
Simplified90.8%
Taylor expanded in eps around 0 90.9%
Final simplification69.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (* x (+ -1.0 eps)))) (t_1 (* x (- -1.0 eps))))
(if (<= x -1e-262)
(/ (+ 1.0 (exp t_1)) 2.0)
(if (<= x 1.65e-13)
(/ (+ t_0 (+ 1.0 t_1)) 2.0)
(if (or (<= x 1.8e+14) (and (not (<= x 1.85e+67)) (<= x 2.7e+103)))
(/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0)
(/ (+ 1.0 t_0) 2.0))))))
double code(double x, double eps) {
double t_0 = exp((x * (-1.0 + eps)));
double t_1 = x * (-1.0 - eps);
double tmp;
if (x <= -1e-262) {
tmp = (1.0 + exp(t_1)) / 2.0;
} else if (x <= 1.65e-13) {
tmp = (t_0 + (1.0 + t_1)) / 2.0;
} else if ((x <= 1.8e+14) || (!(x <= 1.85e+67) && (x <= 2.7e+103))) {
tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = exp((x * ((-1.0d0) + eps)))
t_1 = x * ((-1.0d0) - eps)
if (x <= (-1d-262)) then
tmp = (1.0d0 + exp(t_1)) / 2.0d0
else if (x <= 1.65d-13) then
tmp = (t_0 + (1.0d0 + t_1)) / 2.0d0
else if ((x <= 1.8d+14) .or. (.not. (x <= 1.85d+67)) .and. (x <= 2.7d+103)) then
tmp = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
else
tmp = (1.0d0 + t_0) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.exp((x * (-1.0 + eps)));
double t_1 = x * (-1.0 - eps);
double tmp;
if (x <= -1e-262) {
tmp = (1.0 + Math.exp(t_1)) / 2.0;
} else if (x <= 1.65e-13) {
tmp = (t_0 + (1.0 + t_1)) / 2.0;
} else if ((x <= 1.8e+14) || (!(x <= 1.85e+67) && (x <= 2.7e+103))) {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = math.exp((x * (-1.0 + eps))) t_1 = x * (-1.0 - eps) tmp = 0 if x <= -1e-262: tmp = (1.0 + math.exp(t_1)) / 2.0 elif x <= 1.65e-13: tmp = (t_0 + (1.0 + t_1)) / 2.0 elif (x <= 1.8e+14) or (not (x <= 1.85e+67) and (x <= 2.7e+103)): tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 else: tmp = (1.0 + t_0) / 2.0 return tmp
function code(x, eps) t_0 = exp(Float64(x * Float64(-1.0 + eps))) t_1 = Float64(x * Float64(-1.0 - eps)) tmp = 0.0 if (x <= -1e-262) tmp = Float64(Float64(1.0 + exp(t_1)) / 2.0); elseif (x <= 1.65e-13) tmp = Float64(Float64(t_0 + Float64(1.0 + t_1)) / 2.0); elseif ((x <= 1.8e+14) || (!(x <= 1.85e+67) && (x <= 2.7e+103))) tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); else tmp = Float64(Float64(1.0 + t_0) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = exp((x * (-1.0 + eps))); t_1 = x * (-1.0 - eps); tmp = 0.0; if (x <= -1e-262) tmp = (1.0 + exp(t_1)) / 2.0; elseif (x <= 1.65e-13) tmp = (t_0 + (1.0 + t_1)) / 2.0; elseif ((x <= 1.8e+14) || (~((x <= 1.85e+67)) && (x <= 2.7e+103))) tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; else tmp = (1.0 + t_0) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Exp[N[(x * N[(-1.0 + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1e-262], N[(N[(1.0 + N[Exp[t$95$1], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.65e-13], N[(N[(t$95$0 + N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.8e+14], And[N[Not[LessEqual[x, 1.85e+67]], $MachinePrecision], LessEqual[x, 2.7e+103]]], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(-1 + \varepsilon\right)}\\
t_1 := x \cdot \left(-1 - \varepsilon\right)\\
\mathbf{if}\;x \leq -1 \cdot 10^{-262}:\\
\;\;\;\;\frac{1 + e^{t\_1}}{2}\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-13}:\\
\;\;\;\;\frac{t\_0 + \left(1 + t\_1\right)}{2}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{+14} \lor \neg \left(x \leq 1.85 \cdot 10^{+67}\right) \land x \leq 2.7 \cdot 10^{+103}:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + t\_0}{2}\\
\end{array}
\end{array}
if x < -1.00000000000000001e-262Initial program 73.5%
Simplified73.5%
Taylor expanded in x around 0 49.8%
Taylor expanded in eps around inf 75.8%
cancel-sign-sub-inv75.8%
metadata-eval75.8%
*-lft-identity75.8%
associate-*r*75.8%
+-commutative75.8%
exp-prod66.1%
+-commutative66.1%
*-lft-identity66.1%
metadata-eval66.1%
cancel-sign-sub-inv66.1%
exp-prod75.8%
associate-*r*75.8%
mul-1-neg75.8%
mul-1-neg75.8%
associate-*r*75.8%
*-commutative75.8%
associate-*l*75.8%
cancel-sign-sub-inv75.8%
metadata-eval75.8%
*-lft-identity75.8%
distribute-lft-in75.8%
Simplified75.8%
if -1.00000000000000001e-262 < x < 1.65e-13Initial program 56.4%
Simplified35.1%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 87.0%
if 1.65e-13 < x < 1.8e14 or 1.8499999999999999e67 < x < 2.69999999999999993e103Initial program 82.4%
Simplified82.4%
Taylor expanded in eps around 0 73.4%
Simplified90.8%
Taylor expanded in eps around 0 90.9%
if 1.8e14 < x < 1.8499999999999999e67 or 2.69999999999999993e103 < x 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%
*-commutative100.0%
associate-*l*100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
*-lft-identity100.0%
distribute-lft-in100.0%
metadata-eval100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in x around 0 37.3%
Final simplification69.5%
(FPCore (x eps)
:precision binary64
(if (<= x -9.6e-263)
(/ (+ 1.0 (exp (* x (- -1.0 eps)))) 2.0)
(if (or (<= x 3.5e+66) (not (<= x 1.2e+107)))
(/ (+ 1.0 (exp (* x (+ -1.0 eps)))) 2.0)
0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -9.6e-263) {
tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0;
} else if ((x <= 3.5e+66) || !(x <= 1.2e+107)) {
tmp = (1.0 + exp((x * (-1.0 + 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 <= (-9.6d-263)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps)))) / 2.0d0
else if ((x <= 3.5d+66) .or. (.not. (x <= 1.2d+107))) then
tmp = (1.0d0 + exp((x * ((-1.0d0) + 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 <= -9.6e-263) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps)))) / 2.0;
} else if ((x <= 3.5e+66) || !(x <= 1.2e+107)) {
tmp = (1.0 + Math.exp((x * (-1.0 + eps)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -9.6e-263: tmp = (1.0 + math.exp((x * (-1.0 - eps)))) / 2.0 elif (x <= 3.5e+66) or not (x <= 1.2e+107): tmp = (1.0 + math.exp((x * (-1.0 + eps)))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -9.6e-263) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0); elseif ((x <= 3.5e+66) || !(x <= 1.2e+107)) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps)))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -9.6e-263) tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0; elseif ((x <= 3.5e+66) || ~((x <= 1.2e+107))) tmp = (1.0 + exp((x * (-1.0 + eps)))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -9.6e-263], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 3.5e+66], N[Not[LessEqual[x, 1.2e+107]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.6 \cdot 10^{-263}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{+66} \lor \neg \left(x \leq 1.2 \cdot 10^{+107}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + \varepsilon\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -9.6000000000000001e-263Initial program 73.5%
Simplified73.5%
Taylor expanded in x around 0 49.8%
Taylor expanded in eps around inf 75.8%
cancel-sign-sub-inv75.8%
metadata-eval75.8%
*-lft-identity75.8%
associate-*r*75.8%
+-commutative75.8%
exp-prod66.1%
+-commutative66.1%
*-lft-identity66.1%
metadata-eval66.1%
cancel-sign-sub-inv66.1%
exp-prod75.8%
associate-*r*75.8%
mul-1-neg75.8%
mul-1-neg75.8%
associate-*r*75.8%
*-commutative75.8%
associate-*l*75.8%
cancel-sign-sub-inv75.8%
metadata-eval75.8%
*-lft-identity75.8%
distribute-lft-in75.8%
Simplified75.8%
if -9.6000000000000001e-263 < x < 3.4999999999999997e66 or 1.2e107 < x Initial program 77.7%
Simplified68.3%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around -inf 98.7%
associate-*r*98.7%
*-commutative98.7%
associate-*l*98.7%
cancel-sign-sub-inv98.7%
metadata-eval98.7%
*-lft-identity98.7%
distribute-lft-in98.7%
metadata-eval98.7%
mul-1-neg98.7%
unsub-neg98.7%
Simplified98.7%
Taylor expanded in x around 0 59.0%
if 3.4999999999999997e66 < x < 1.2e107Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 86.9%
mul-1-neg86.9%
mul-1-neg86.9%
rec-exp86.9%
sub-neg86.9%
div-sub86.9%
mul-1-neg86.9%
rec-exp86.9%
+-inverses86.9%
Simplified86.9%
Final simplification67.6%
(FPCore (x eps) :precision binary64 (if (<= x 68000000000000.0) (/ (+ 2.0 (* x (- (+ (/ 1.0 eps) (/ -1.0 eps)) eps))) 2.0) (if (or (<= x 1.4e+53) (not (<= x 5e+103))) (/ (/ (exp x) eps) 2.0) 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= 68000000000000.0) {
tmp = (2.0 + (x * (((1.0 / eps) + (-1.0 / eps)) - eps))) / 2.0;
} else if ((x <= 1.4e+53) || !(x <= 5e+103)) {
tmp = (exp(x) / eps) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 68000000000000.0d0) then
tmp = (2.0d0 + (x * (((1.0d0 / eps) + ((-1.0d0) / eps)) - eps))) / 2.0d0
else if ((x <= 1.4d+53) .or. (.not. (x <= 5d+103))) then
tmp = (exp(x) / eps) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 68000000000000.0) {
tmp = (2.0 + (x * (((1.0 / eps) + (-1.0 / eps)) - eps))) / 2.0;
} else if ((x <= 1.4e+53) || !(x <= 5e+103)) {
tmp = (Math.exp(x) / eps) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 68000000000000.0: tmp = (2.0 + (x * (((1.0 / eps) + (-1.0 / eps)) - eps))) / 2.0 elif (x <= 1.4e+53) or not (x <= 5e+103): tmp = (math.exp(x) / eps) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 68000000000000.0) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(1.0 / eps) + Float64(-1.0 / eps)) - eps))) / 2.0); elseif ((x <= 1.4e+53) || !(x <= 5e+103)) tmp = Float64(Float64(exp(x) / eps) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 68000000000000.0) tmp = (2.0 + (x * (((1.0 / eps) + (-1.0 / eps)) - eps))) / 2.0; elseif ((x <= 1.4e+53) || ~((x <= 5e+103))) tmp = (exp(x) / eps) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 68000000000000.0], N[(N[(2.0 + N[(x * N[(N[(N[(1.0 / eps), $MachinePrecision] + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision] - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.4e+53], N[Not[LessEqual[x, 5e+103]], $MachinePrecision]], N[(N[(N[Exp[x], $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 68000000000000:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(\frac{1}{\varepsilon} + \frac{-1}{\varepsilon}\right) - \varepsilon\right)}{2}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+53} \lor \neg \left(x \leq 5 \cdot 10^{+103}\right):\\
\;\;\;\;\frac{\frac{e^{x}}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 6.8e13Initial program 66.4%
Simplified55.5%
Taylor expanded in x around 0 55.4%
Taylor expanded in eps around 0 59.1%
if 6.8e13 < x < 1.4e53 or 5e103 < x Initial program 100.0%
Simplified100.0%
add-cube-cbrt100.0%
pow3100.0%
Applied egg-rr64.0%
Taylor expanded in eps around 0 36.9%
if 1.4e53 < x < 5e103Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 82.6%
mul-1-neg82.6%
mul-1-neg82.6%
rec-exp82.6%
sub-neg82.6%
div-sub82.6%
mul-1-neg82.6%
rec-exp82.6%
+-inverses82.6%
Simplified82.6%
Final simplification54.9%
(FPCore (x eps) :precision binary64 (if (<= x 68000000000000.0) (/ (+ 1.0 (exp (- x))) 2.0) (if (or (<= x 1.2e+52) (not (<= x 1e+104))) (/ (/ (exp x) eps) 2.0) 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= 68000000000000.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if ((x <= 1.2e+52) || !(x <= 1e+104)) {
tmp = (exp(x) / eps) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 68000000000000.0d0) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if ((x <= 1.2d+52) .or. (.not. (x <= 1d+104))) then
tmp = (exp(x) / eps) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 68000000000000.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if ((x <= 1.2e+52) || !(x <= 1e+104)) {
tmp = (Math.exp(x) / eps) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 68000000000000.0: tmp = (1.0 + math.exp(-x)) / 2.0 elif (x <= 1.2e+52) or not (x <= 1e+104): tmp = (math.exp(x) / eps) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 68000000000000.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif ((x <= 1.2e+52) || !(x <= 1e+104)) tmp = Float64(Float64(exp(x) / eps) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 68000000000000.0) tmp = (1.0 + exp(-x)) / 2.0; elseif ((x <= 1.2e+52) || ~((x <= 1e+104))) tmp = (exp(x) / eps) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 68000000000000.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.2e+52], N[Not[LessEqual[x, 1e+104]], $MachinePrecision]], N[(N[(N[Exp[x], $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 68000000000000:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+52} \lor \neg \left(x \leq 10^{+104}\right):\\
\;\;\;\;\frac{\frac{e^{x}}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 6.8e13Initial program 66.4%
Simplified66.4%
Taylor expanded in x around 0 44.8%
Taylor expanded in eps around inf 77.2%
cancel-sign-sub-inv77.2%
metadata-eval77.2%
*-lft-identity77.2%
associate-*r*77.2%
+-commutative77.2%
exp-prod67.6%
+-commutative67.6%
*-lft-identity67.6%
metadata-eval67.6%
cancel-sign-sub-inv67.6%
exp-prod77.2%
associate-*r*77.2%
mul-1-neg77.2%
mul-1-neg77.2%
associate-*r*77.2%
*-commutative77.2%
associate-*l*77.2%
cancel-sign-sub-inv77.2%
metadata-eval77.2%
*-lft-identity77.2%
distribute-lft-in77.2%
Simplified77.2%
Taylor expanded in eps around 0 73.7%
if 6.8e13 < x < 1.2e52 or 1e104 < x Initial program 100.0%
Simplified100.0%
add-cube-cbrt100.0%
pow3100.0%
Applied egg-rr64.0%
Taylor expanded in eps around 0 36.9%
if 1.2e52 < x < 1e104Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 82.6%
mul-1-neg82.6%
mul-1-neg82.6%
rec-exp82.6%
sub-neg82.6%
div-sub82.6%
mul-1-neg82.6%
rec-exp82.6%
+-inverses82.6%
Simplified82.6%
Final simplification64.8%
(FPCore (x eps) :precision binary64 (if (<= x 68000000000000.0) (/ (+ 1.0 (exp (* x (- -1.0 eps)))) 2.0) (if (or (<= x 4.6e+52) (not (<= x 1.2e+106))) (/ (/ (exp x) eps) 2.0) 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= 68000000000000.0) {
tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0;
} else if ((x <= 4.6e+52) || !(x <= 1.2e+106)) {
tmp = (exp(x) / eps) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 68000000000000.0d0) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps)))) / 2.0d0
else if ((x <= 4.6d+52) .or. (.not. (x <= 1.2d+106))) then
tmp = (exp(x) / eps) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 68000000000000.0) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps)))) / 2.0;
} else if ((x <= 4.6e+52) || !(x <= 1.2e+106)) {
tmp = (Math.exp(x) / eps) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 68000000000000.0: tmp = (1.0 + math.exp((x * (-1.0 - eps)))) / 2.0 elif (x <= 4.6e+52) or not (x <= 1.2e+106): tmp = (math.exp(x) / eps) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 68000000000000.0) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0); elseif ((x <= 4.6e+52) || !(x <= 1.2e+106)) tmp = Float64(Float64(exp(x) / eps) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 68000000000000.0) tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0; elseif ((x <= 4.6e+52) || ~((x <= 1.2e+106))) tmp = (exp(x) / eps) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 68000000000000.0], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 4.6e+52], N[Not[LessEqual[x, 1.2e+106]], $MachinePrecision]], N[(N[(N[Exp[x], $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 68000000000000:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+52} \lor \neg \left(x \leq 1.2 \cdot 10^{+106}\right):\\
\;\;\;\;\frac{\frac{e^{x}}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 6.8e13Initial program 66.4%
Simplified66.4%
Taylor expanded in x around 0 44.8%
Taylor expanded in eps around inf 77.2%
cancel-sign-sub-inv77.2%
metadata-eval77.2%
*-lft-identity77.2%
associate-*r*77.2%
+-commutative77.2%
exp-prod67.6%
+-commutative67.6%
*-lft-identity67.6%
metadata-eval67.6%
cancel-sign-sub-inv67.6%
exp-prod77.2%
associate-*r*77.2%
mul-1-neg77.2%
mul-1-neg77.2%
associate-*r*77.2%
*-commutative77.2%
associate-*l*77.2%
cancel-sign-sub-inv77.2%
metadata-eval77.2%
*-lft-identity77.2%
distribute-lft-in77.2%
Simplified77.2%
if 6.8e13 < x < 4.6e52 or 1.2e106 < x Initial program 100.0%
Simplified100.0%
add-cube-cbrt100.0%
pow3100.0%
Applied egg-rr64.0%
Taylor expanded in eps around 0 36.9%
if 4.6e52 < x < 1.2e106Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 82.6%
mul-1-neg82.6%
mul-1-neg82.6%
rec-exp82.6%
sub-neg82.6%
div-sub82.6%
mul-1-neg82.6%
rec-exp82.6%
+-inverses82.6%
Simplified82.6%
Final simplification67.2%
(FPCore (x eps) :precision binary64 (if (<= x -0.85) (* (* x eps) -0.5) (if (<= x 500.0) 1.0 (if (<= x 7.5e+217) 0.0 (/ (* x eps) 2.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -0.85) {
tmp = (x * eps) * -0.5;
} else if (x <= 500.0) {
tmp = 1.0;
} else if (x <= 7.5e+217) {
tmp = 0.0;
} else {
tmp = (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 <= (-0.85d0)) then
tmp = (x * eps) * (-0.5d0)
else if (x <= 500.0d0) then
tmp = 1.0d0
else if (x <= 7.5d+217) then
tmp = 0.0d0
else
tmp = (x * eps) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -0.85) {
tmp = (x * eps) * -0.5;
} else if (x <= 500.0) {
tmp = 1.0;
} else if (x <= 7.5e+217) {
tmp = 0.0;
} else {
tmp = (x * eps) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -0.85: tmp = (x * eps) * -0.5 elif x <= 500.0: tmp = 1.0 elif x <= 7.5e+217: tmp = 0.0 else: tmp = (x * eps) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -0.85) tmp = Float64(Float64(x * eps) * -0.5); elseif (x <= 500.0) tmp = 1.0; elseif (x <= 7.5e+217) tmp = 0.0; else tmp = Float64(Float64(x * eps) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -0.85) tmp = (x * eps) * -0.5; elseif (x <= 500.0) tmp = 1.0; elseif (x <= 7.5e+217) tmp = 0.0; else tmp = (x * eps) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -0.85], N[(N[(x * eps), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[x, 500.0], 1.0, If[LessEqual[x, 7.5e+217], 0.0, N[(N[(x * eps), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.85:\\
\;\;\;\;\left(x \cdot \varepsilon\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 500:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+217}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \varepsilon}{2}\\
\end{array}
\end{array}
if x < -0.849999999999999978Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 66.5%
Taylor expanded in eps around inf 32.3%
frac-2neg32.3%
div-inv32.3%
distribute-rgt-neg-in32.3%
add-sqr-sqrt32.3%
sqrt-unprod32.3%
sqr-neg32.3%
sqrt-unprod0.0%
add-sqr-sqrt24.7%
*-commutative24.7%
metadata-eval24.7%
metadata-eval24.7%
Applied egg-rr24.7%
if -0.849999999999999978 < x < 500Initial program 56.9%
Simplified56.9%
Taylor expanded in x around 0 70.1%
if 500 < x < 7.5000000000000001e217Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 55.1%
mul-1-neg55.1%
mul-1-neg55.1%
rec-exp55.1%
sub-neg55.1%
div-sub55.1%
mul-1-neg55.1%
rec-exp55.1%
+-inverses55.1%
Simplified55.1%
if 7.5000000000000001e217 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 39.1%
Taylor expanded in eps around inf 35.9%
Final simplification56.7%
(FPCore (x eps) :precision binary64 (if (<= x -0.5) (/ (* x (- -1.0 eps)) 2.0) (if (<= x 500.0) 1.0 (if (<= x 7.5e+217) 0.0 (/ (* x eps) 2.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -0.5) {
tmp = (x * (-1.0 - eps)) / 2.0;
} else if (x <= 500.0) {
tmp = 1.0;
} else if (x <= 7.5e+217) {
tmp = 0.0;
} else {
tmp = (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 <= (-0.5d0)) then
tmp = (x * ((-1.0d0) - eps)) / 2.0d0
else if (x <= 500.0d0) then
tmp = 1.0d0
else if (x <= 7.5d+217) then
tmp = 0.0d0
else
tmp = (x * eps) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -0.5) {
tmp = (x * (-1.0 - eps)) / 2.0;
} else if (x <= 500.0) {
tmp = 1.0;
} else if (x <= 7.5e+217) {
tmp = 0.0;
} else {
tmp = (x * eps) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -0.5: tmp = (x * (-1.0 - eps)) / 2.0 elif x <= 500.0: tmp = 1.0 elif x <= 7.5e+217: tmp = 0.0 else: tmp = (x * eps) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -0.5) tmp = Float64(Float64(x * Float64(-1.0 - eps)) / 2.0); elseif (x <= 500.0) tmp = 1.0; elseif (x <= 7.5e+217) tmp = 0.0; else tmp = Float64(Float64(x * eps) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -0.5) tmp = (x * (-1.0 - eps)) / 2.0; elseif (x <= 500.0) tmp = 1.0; elseif (x <= 7.5e+217) tmp = 0.0; else tmp = (x * eps) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -0.5], N[(N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 500.0], 1.0, If[LessEqual[x, 7.5e+217], 0.0, N[(N[(x * eps), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.5:\\
\;\;\;\;\frac{x \cdot \left(-1 - \varepsilon\right)}{2}\\
\mathbf{elif}\;x \leq 500:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+217}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \varepsilon}{2}\\
\end{array}
\end{array}
if x < -0.5Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 58.5%
Taylor expanded in eps around inf 58.5%
cancel-sign-sub-inv58.5%
metadata-eval58.5%
*-lft-identity58.5%
associate-*r*58.5%
+-commutative58.5%
exp-prod58.5%
+-commutative58.5%
*-lft-identity58.5%
metadata-eval58.5%
cancel-sign-sub-inv58.5%
exp-prod58.5%
associate-*r*58.5%
mul-1-neg58.5%
mul-1-neg58.5%
associate-*r*58.5%
*-commutative58.5%
associate-*l*58.5%
cancel-sign-sub-inv58.5%
metadata-eval58.5%
*-lft-identity58.5%
distribute-lft-in58.5%
Simplified58.5%
Taylor expanded in x around 0 24.7%
Taylor expanded in x around inf 24.7%
*-commutative24.7%
associate-*r*24.7%
distribute-lft-in24.7%
metadata-eval24.7%
neg-mul-124.7%
sub-neg24.7%
*-commutative24.7%
Simplified24.7%
if -0.5 < x < 500Initial program 56.9%
Simplified56.9%
Taylor expanded in x around 0 70.1%
if 500 < x < 7.5000000000000001e217Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 55.1%
mul-1-neg55.1%
mul-1-neg55.1%
rec-exp55.1%
sub-neg55.1%
div-sub55.1%
mul-1-neg55.1%
rec-exp55.1%
+-inverses55.1%
Simplified55.1%
if 7.5000000000000001e217 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 39.1%
Taylor expanded in eps around inf 35.9%
Final simplification56.7%
(FPCore (x eps)
:precision binary64
(if (<= x -0.5)
(/ (* x (- -1.0 eps)) 2.0)
(if (<= x 620.0)
(/ (/ (* eps 2.0) eps) 2.0)
(if (<= x 7.5e+217) 0.0 (/ (* x eps) 2.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -0.5) {
tmp = (x * (-1.0 - eps)) / 2.0;
} else if (x <= 620.0) {
tmp = ((eps * 2.0) / eps) / 2.0;
} else if (x <= 7.5e+217) {
tmp = 0.0;
} else {
tmp = (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 <= (-0.5d0)) then
tmp = (x * ((-1.0d0) - eps)) / 2.0d0
else if (x <= 620.0d0) then
tmp = ((eps * 2.0d0) / eps) / 2.0d0
else if (x <= 7.5d+217) then
tmp = 0.0d0
else
tmp = (x * eps) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -0.5) {
tmp = (x * (-1.0 - eps)) / 2.0;
} else if (x <= 620.0) {
tmp = ((eps * 2.0) / eps) / 2.0;
} else if (x <= 7.5e+217) {
tmp = 0.0;
} else {
tmp = (x * eps) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -0.5: tmp = (x * (-1.0 - eps)) / 2.0 elif x <= 620.0: tmp = ((eps * 2.0) / eps) / 2.0 elif x <= 7.5e+217: tmp = 0.0 else: tmp = (x * eps) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -0.5) tmp = Float64(Float64(x * Float64(-1.0 - eps)) / 2.0); elseif (x <= 620.0) tmp = Float64(Float64(Float64(eps * 2.0) / eps) / 2.0); elseif (x <= 7.5e+217) tmp = 0.0; else tmp = Float64(Float64(x * eps) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -0.5) tmp = (x * (-1.0 - eps)) / 2.0; elseif (x <= 620.0) tmp = ((eps * 2.0) / eps) / 2.0; elseif (x <= 7.5e+217) tmp = 0.0; else tmp = (x * eps) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -0.5], N[(N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 620.0], N[(N[(N[(eps * 2.0), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.5e+217], 0.0, N[(N[(x * eps), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.5:\\
\;\;\;\;\frac{x \cdot \left(-1 - \varepsilon\right)}{2}\\
\mathbf{elif}\;x \leq 620:\\
\;\;\;\;\frac{\frac{\varepsilon \cdot 2}{\varepsilon}}{2}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+217}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \varepsilon}{2}\\
\end{array}
\end{array}
if x < -0.5Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 58.5%
Taylor expanded in eps around inf 58.5%
cancel-sign-sub-inv58.5%
metadata-eval58.5%
*-lft-identity58.5%
associate-*r*58.5%
+-commutative58.5%
exp-prod58.5%
+-commutative58.5%
*-lft-identity58.5%
metadata-eval58.5%
cancel-sign-sub-inv58.5%
exp-prod58.5%
associate-*r*58.5%
mul-1-neg58.5%
mul-1-neg58.5%
associate-*r*58.5%
*-commutative58.5%
associate-*l*58.5%
cancel-sign-sub-inv58.5%
metadata-eval58.5%
*-lft-identity58.5%
distribute-lft-in58.5%
Simplified58.5%
Taylor expanded in x around 0 24.7%
Taylor expanded in x around inf 24.7%
*-commutative24.7%
associate-*r*24.7%
distribute-lft-in24.7%
metadata-eval24.7%
neg-mul-124.7%
sub-neg24.7%
*-commutative24.7%
Simplified24.7%
if -0.5 < x < 620Initial program 56.9%
Simplified36.0%
Taylor expanded in eps around 0 27.0%
Simplified71.5%
Taylor expanded in x around 0 70.8%
if 620 < x < 7.5000000000000001e217Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 55.1%
mul-1-neg55.1%
mul-1-neg55.1%
rec-exp55.1%
sub-neg55.1%
div-sub55.1%
mul-1-neg55.1%
rec-exp55.1%
+-inverses55.1%
Simplified55.1%
if 7.5000000000000001e217 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 39.1%
Taylor expanded in eps around inf 35.9%
Final simplification57.0%
(FPCore (x eps) :precision binary64 (if (<= x 210.0) (/ (+ 2.0 (* x (- (+ (/ 1.0 eps) (/ -1.0 eps)) eps))) 2.0) (if (<= x 7.6e+217) 0.0 (/ (* x eps) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= 210.0) {
tmp = (2.0 + (x * (((1.0 / eps) + (-1.0 / eps)) - eps))) / 2.0;
} else if (x <= 7.6e+217) {
tmp = 0.0;
} else {
tmp = (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 <= 210.0d0) then
tmp = (2.0d0 + (x * (((1.0d0 / eps) + ((-1.0d0) / eps)) - eps))) / 2.0d0
else if (x <= 7.6d+217) then
tmp = 0.0d0
else
tmp = (x * eps) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 210.0) {
tmp = (2.0 + (x * (((1.0 / eps) + (-1.0 / eps)) - eps))) / 2.0;
} else if (x <= 7.6e+217) {
tmp = 0.0;
} else {
tmp = (x * eps) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 210.0: tmp = (2.0 + (x * (((1.0 / eps) + (-1.0 / eps)) - eps))) / 2.0 elif x <= 7.6e+217: tmp = 0.0 else: tmp = (x * eps) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 210.0) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(1.0 / eps) + Float64(-1.0 / eps)) - eps))) / 2.0); elseif (x <= 7.6e+217) tmp = 0.0; else tmp = Float64(Float64(x * eps) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 210.0) tmp = (2.0 + (x * (((1.0 / eps) + (-1.0 / eps)) - eps))) / 2.0; elseif (x <= 7.6e+217) tmp = 0.0; else tmp = (x * eps) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 210.0], N[(N[(2.0 + N[(x * N[(N[(N[(1.0 / eps), $MachinePrecision] + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision] - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.6e+217], 0.0, N[(N[(x * eps), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 210:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(\frac{1}{\varepsilon} + \frac{-1}{\varepsilon}\right) - \varepsilon\right)}{2}\\
\mathbf{elif}\;x \leq 7.6 \cdot 10^{+217}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \varepsilon}{2}\\
\end{array}
\end{array}
if x < 210Initial program 65.8%
Simplified54.7%
Taylor expanded in x around 0 56.3%
Taylor expanded in eps around 0 60.1%
if 210 < x < 7.60000000000000004e217Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 55.1%
mul-1-neg55.1%
mul-1-neg55.1%
rec-exp55.1%
sub-neg55.1%
div-sub55.1%
mul-1-neg55.1%
rec-exp55.1%
+-inverses55.1%
Simplified55.1%
if 7.60000000000000004e217 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 39.1%
Taylor expanded in eps around inf 35.9%
Final simplification56.2%
(FPCore (x eps) :precision binary64 (if (<= x 2.0) (/ (- 2.0 (* x (+ eps 1.0))) 2.0) (if (<= x 7.5e+217) 0.0 (/ (* x eps) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 - (x * (eps + 1.0))) / 2.0;
} else if (x <= 7.5e+217) {
tmp = 0.0;
} else {
tmp = (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 <= 2.0d0) then
tmp = (2.0d0 - (x * (eps + 1.0d0))) / 2.0d0
else if (x <= 7.5d+217) then
tmp = 0.0d0
else
tmp = (x * eps) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 - (x * (eps + 1.0))) / 2.0;
} else if (x <= 7.5e+217) {
tmp = 0.0;
} else {
tmp = (x * eps) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 2.0: tmp = (2.0 - (x * (eps + 1.0))) / 2.0 elif x <= 7.5e+217: tmp = 0.0 else: tmp = (x * eps) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 2.0) tmp = Float64(Float64(2.0 - Float64(x * Float64(eps + 1.0))) / 2.0); elseif (x <= 7.5e+217) tmp = 0.0; else tmp = Float64(Float64(x * eps) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 2.0) tmp = (2.0 - (x * (eps + 1.0))) / 2.0; elseif (x <= 7.5e+217) tmp = 0.0; else tmp = (x * eps) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 2.0], N[(N[(2.0 - N[(x * N[(eps + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7.5e+217], 0.0, N[(N[(x * eps), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{2 - x \cdot \left(\varepsilon + 1\right)}{2}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+217}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \varepsilon}{2}\\
\end{array}
\end{array}
if x < 2Initial program 65.8%
Simplified65.8%
Taylor expanded in x around 0 45.6%
Taylor expanded in eps around inf 78.5%
cancel-sign-sub-inv78.5%
metadata-eval78.5%
*-lft-identity78.5%
associate-*r*78.5%
+-commutative78.5%
exp-prod68.7%
+-commutative68.7%
*-lft-identity68.7%
metadata-eval68.7%
cancel-sign-sub-inv68.7%
exp-prod78.5%
associate-*r*78.5%
mul-1-neg78.5%
mul-1-neg78.5%
associate-*r*78.5%
*-commutative78.5%
associate-*l*78.5%
cancel-sign-sub-inv78.5%
metadata-eval78.5%
*-lft-identity78.5%
distribute-lft-in78.5%
Simplified78.5%
Taylor expanded in x around 0 59.3%
Taylor expanded in x around 0 59.3%
associate-*r*59.3%
neg-mul-159.3%
+-commutative59.3%
Simplified59.3%
if 2 < x < 7.5000000000000001e217Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 55.1%
mul-1-neg55.1%
mul-1-neg55.1%
rec-exp55.1%
sub-neg55.1%
div-sub55.1%
mul-1-neg55.1%
rec-exp55.1%
+-inverses55.1%
Simplified55.1%
if 7.5000000000000001e217 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 39.1%
Taylor expanded in eps around inf 35.9%
Final simplification55.7%
(FPCore (x eps) :precision binary64 (if (<= x -0.85) (* (* x eps) -0.5) (if (<= x 510.0) 1.0 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -0.85) {
tmp = (x * eps) * -0.5;
} else if (x <= 510.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 <= (-0.85d0)) then
tmp = (x * eps) * (-0.5d0)
else if (x <= 510.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 <= -0.85) {
tmp = (x * eps) * -0.5;
} else if (x <= 510.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -0.85: tmp = (x * eps) * -0.5 elif x <= 510.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -0.85) tmp = Float64(Float64(x * eps) * -0.5); elseif (x <= 510.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -0.85) tmp = (x * eps) * -0.5; elseif (x <= 510.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -0.85], N[(N[(x * eps), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[x, 510.0], 1.0, 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.85:\\
\;\;\;\;\left(x \cdot \varepsilon\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 510:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -0.849999999999999978Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 66.5%
Taylor expanded in eps around inf 32.3%
frac-2neg32.3%
div-inv32.3%
distribute-rgt-neg-in32.3%
add-sqr-sqrt32.3%
sqrt-unprod32.3%
sqr-neg32.3%
sqrt-unprod0.0%
add-sqr-sqrt24.7%
*-commutative24.7%
metadata-eval24.7%
metadata-eval24.7%
Applied egg-rr24.7%
if -0.849999999999999978 < x < 510Initial program 56.9%
Simplified56.9%
Taylor expanded in x around 0 70.1%
if 510 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 48.5%
mul-1-neg48.5%
mul-1-neg48.5%
rec-exp48.5%
sub-neg48.5%
div-sub48.5%
mul-1-neg48.5%
rec-exp48.5%
+-inverses48.5%
Simplified48.5%
Final simplification56.6%
(FPCore (x eps) :precision binary64 (if (<= x 480.0) 1.0 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 480.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 <= 480.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 <= 480.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 480.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 480.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 480.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 480.0], 1.0, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 480:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 480Initial program 65.8%
Simplified65.8%
Taylor expanded in x around 0 56.3%
if 480 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 48.5%
mul-1-neg48.5%
mul-1-neg48.5%
rec-exp48.5%
sub-neg48.5%
div-sub48.5%
mul-1-neg48.5%
rec-exp48.5%
+-inverses48.5%
Simplified48.5%
Final simplification53.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 77.3%
Simplified66.2%
Taylor expanded in eps around 0 17.7%
mul-1-neg17.7%
mul-1-neg17.7%
rec-exp17.7%
sub-neg17.7%
div-sub17.7%
mul-1-neg17.7%
rec-exp17.7%
+-inverses17.9%
Simplified17.9%
Final simplification17.9%
herbie shell --seed 2024055
(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))