
(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 12 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 72.0%
Simplified72.0%
Taylor expanded in eps around inf 99.1%
Taylor expanded in eps around -inf 99.1%
Simplified99.1%
Taylor expanded in eps around inf 99.1%
+-commutative99.1%
mul-1-neg99.1%
distribute-rgt-neg-in99.1%
sub-neg99.1%
mul-1-neg99.1%
distribute-neg-in99.1%
metadata-eval99.1%
mul-1-neg99.1%
remove-double-neg99.1%
exp-prod99.1%
*-lft-identity99.1%
metadata-eval99.1%
cancel-sign-sub-inv99.1%
exp-prod99.1%
mul-1-neg99.1%
distribute-rgt-neg-in99.1%
sub-neg99.1%
mul-1-neg99.1%
remove-double-neg99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= x -3.1e-260)
(/ (+ (exp (* x (- -1.0 eps))) t_0) 2.0)
(if (<= x 9e+24)
(/ (+ (exp (* x eps)) 1.0) 2.0)
(if (or (<= x 9e+139) (not (<= x 1.35e+243)))
(/ (* 2.0 t_0) 2.0)
(/ (+ 1.0 (exp (* x (+ -1.0 eps)))) 2.0))))))
double code(double x, double eps) {
double t_0 = exp(-x);
double tmp;
if (x <= -3.1e-260) {
tmp = (exp((x * (-1.0 - eps))) + t_0) / 2.0;
} else if (x <= 9e+24) {
tmp = (exp((x * eps)) + 1.0) / 2.0;
} else if ((x <= 9e+139) || !(x <= 1.35e+243)) {
tmp = (2.0 * t_0) / 2.0;
} else {
tmp = (1.0 + exp((x * (-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 = exp(-x)
if (x <= (-3.1d-260)) then
tmp = (exp((x * ((-1.0d0) - eps))) + t_0) / 2.0d0
else if (x <= 9d+24) then
tmp = (exp((x * eps)) + 1.0d0) / 2.0d0
else if ((x <= 9d+139) .or. (.not. (x <= 1.35d+243))) then
tmp = (2.0d0 * t_0) / 2.0d0
else
tmp = (1.0d0 + exp((x * ((-1.0d0) + eps)))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.exp(-x);
double tmp;
if (x <= -3.1e-260) {
tmp = (Math.exp((x * (-1.0 - eps))) + t_0) / 2.0;
} else if (x <= 9e+24) {
tmp = (Math.exp((x * eps)) + 1.0) / 2.0;
} else if ((x <= 9e+139) || !(x <= 1.35e+243)) {
tmp = (2.0 * t_0) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (-1.0 + eps)))) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = math.exp(-x) tmp = 0 if x <= -3.1e-260: tmp = (math.exp((x * (-1.0 - eps))) + t_0) / 2.0 elif x <= 9e+24: tmp = (math.exp((x * eps)) + 1.0) / 2.0 elif (x <= 9e+139) or not (x <= 1.35e+243): tmp = (2.0 * t_0) / 2.0 else: tmp = (1.0 + math.exp((x * (-1.0 + eps)))) / 2.0 return tmp
function code(x, eps) t_0 = exp(Float64(-x)) tmp = 0.0 if (x <= -3.1e-260) tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 - eps))) + t_0) / 2.0); elseif (x <= 9e+24) tmp = Float64(Float64(exp(Float64(x * eps)) + 1.0) / 2.0); elseif ((x <= 9e+139) || !(x <= 1.35e+243)) tmp = Float64(Float64(2.0 * t_0) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps)))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = exp(-x); tmp = 0.0; if (x <= -3.1e-260) tmp = (exp((x * (-1.0 - eps))) + t_0) / 2.0; elseif (x <= 9e+24) tmp = (exp((x * eps)) + 1.0) / 2.0; elseif ((x <= 9e+139) || ~((x <= 1.35e+243))) tmp = (2.0 * t_0) / 2.0; else tmp = (1.0 + exp((x * (-1.0 + eps)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[x, -3.1e-260], N[(N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 9e+24], N[(N[(N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 9e+139], N[Not[LessEqual[x, 1.35e+243]], $MachinePrecision]], N[(N[(2.0 * t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;x \leq -3.1 \cdot 10^{-260}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 - \varepsilon\right)} + t_0}{2}\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+24}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon} + 1}{2}\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+139} \lor \neg \left(x \leq 1.35 \cdot 10^{+243}\right):\\
\;\;\;\;\frac{2 \cdot t_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + \varepsilon\right)}}{2}\\
\end{array}
\end{array}
if x < -3.09999999999999983e-260Initial program 71.7%
Simplified71.7%
Taylor expanded in eps around inf 98.7%
Taylor expanded in eps around 0 88.8%
Taylor expanded in eps around -inf 88.8%
sub-neg88.8%
mul-1-neg88.8%
mul-1-neg88.8%
remove-double-neg88.8%
mul-1-neg88.8%
distribute-rgt-neg-in88.8%
sub-neg88.8%
mul-1-neg88.8%
remove-double-neg88.8%
distribute-neg-in88.8%
metadata-eval88.8%
unsub-neg88.8%
Simplified88.8%
if -3.09999999999999983e-260 < x < 9.00000000000000039e24Initial program 53.1%
Simplified43.1%
Taylor expanded in eps around inf 98.9%
Taylor expanded in x around 0 83.8%
Taylor expanded in eps around inf 84.6%
*-commutative84.3%
Simplified84.6%
if 9.00000000000000039e24 < x < 8.9999999999999999e139 or 1.3500000000000001e243 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 75.4%
neg-mul-175.4%
rec-exp75.4%
count-275.4%
rec-exp75.4%
Simplified75.4%
if 8.9999999999999999e139 < x < 1.3500000000000001e243Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 40.0%
Final simplification80.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (* 2.0 (exp (- x))) 2.0)))
(if (<= x -700.0)
t_0
(if (<= x -1.3e-211)
(/
(+
2.0
(*
x
(+
(* (+ -1.0 eps) (+ 1.0 (/ 1.0 eps)))
(/ (+ -1.0 (/ 1.0 eps)) (/ (- 1.0 eps) (- 1.0 (pow eps 2.0)))))))
2.0)
(if (<= x 1e+22)
(/ (+ (exp (* x eps)) 1.0) 2.0)
(if (or (<= x 3.4e+139) (not (<= x 8.5e+243)))
t_0
(/ (+ 1.0 (exp (* x (+ -1.0 eps)))) 2.0)))))))
double code(double x, double eps) {
double t_0 = (2.0 * exp(-x)) / 2.0;
double tmp;
if (x <= -700.0) {
tmp = t_0;
} else if (x <= -1.3e-211) {
tmp = (2.0 + (x * (((-1.0 + eps) * (1.0 + (1.0 / eps))) + ((-1.0 + (1.0 / eps)) / ((1.0 - eps) / (1.0 - pow(eps, 2.0))))))) / 2.0;
} else if (x <= 1e+22) {
tmp = (exp((x * eps)) + 1.0) / 2.0;
} else if ((x <= 3.4e+139) || !(x <= 8.5e+243)) {
tmp = t_0;
} else {
tmp = (1.0 + exp((x * (-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 = (2.0d0 * exp(-x)) / 2.0d0
if (x <= (-700.0d0)) then
tmp = t_0
else if (x <= (-1.3d-211)) then
tmp = (2.0d0 + (x * ((((-1.0d0) + eps) * (1.0d0 + (1.0d0 / eps))) + (((-1.0d0) + (1.0d0 / eps)) / ((1.0d0 - eps) / (1.0d0 - (eps ** 2.0d0))))))) / 2.0d0
else if (x <= 1d+22) then
tmp = (exp((x * eps)) + 1.0d0) / 2.0d0
else if ((x <= 3.4d+139) .or. (.not. (x <= 8.5d+243))) then
tmp = t_0
else
tmp = (1.0d0 + exp((x * ((-1.0d0) + eps)))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = (2.0 * Math.exp(-x)) / 2.0;
double tmp;
if (x <= -700.0) {
tmp = t_0;
} else if (x <= -1.3e-211) {
tmp = (2.0 + (x * (((-1.0 + eps) * (1.0 + (1.0 / eps))) + ((-1.0 + (1.0 / eps)) / ((1.0 - eps) / (1.0 - Math.pow(eps, 2.0))))))) / 2.0;
} else if (x <= 1e+22) {
tmp = (Math.exp((x * eps)) + 1.0) / 2.0;
} else if ((x <= 3.4e+139) || !(x <= 8.5e+243)) {
tmp = t_0;
} else {
tmp = (1.0 + Math.exp((x * (-1.0 + eps)))) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = (2.0 * math.exp(-x)) / 2.0 tmp = 0 if x <= -700.0: tmp = t_0 elif x <= -1.3e-211: tmp = (2.0 + (x * (((-1.0 + eps) * (1.0 + (1.0 / eps))) + ((-1.0 + (1.0 / eps)) / ((1.0 - eps) / (1.0 - math.pow(eps, 2.0))))))) / 2.0 elif x <= 1e+22: tmp = (math.exp((x * eps)) + 1.0) / 2.0 elif (x <= 3.4e+139) or not (x <= 8.5e+243): tmp = t_0 else: tmp = (1.0 + math.exp((x * (-1.0 + eps)))) / 2.0 return tmp
function code(x, eps) t_0 = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0) tmp = 0.0 if (x <= -700.0) tmp = t_0; elseif (x <= -1.3e-211) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(-1.0 + eps) * Float64(1.0 + Float64(1.0 / eps))) + Float64(Float64(-1.0 + Float64(1.0 / eps)) / Float64(Float64(1.0 - eps) / Float64(1.0 - (eps ^ 2.0))))))) / 2.0); elseif (x <= 1e+22) tmp = Float64(Float64(exp(Float64(x * eps)) + 1.0) / 2.0); elseif ((x <= 3.4e+139) || !(x <= 8.5e+243)) tmp = t_0; else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps)))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = (2.0 * exp(-x)) / 2.0; tmp = 0.0; if (x <= -700.0) tmp = t_0; elseif (x <= -1.3e-211) tmp = (2.0 + (x * (((-1.0 + eps) * (1.0 + (1.0 / eps))) + ((-1.0 + (1.0 / eps)) / ((1.0 - eps) / (1.0 - (eps ^ 2.0))))))) / 2.0; elseif (x <= 1e+22) tmp = (exp((x * eps)) + 1.0) / 2.0; elseif ((x <= 3.4e+139) || ~((x <= 8.5e+243))) tmp = t_0; else tmp = (1.0 + exp((x * (-1.0 + eps)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -700.0], t$95$0, If[LessEqual[x, -1.3e-211], N[(N[(2.0 + N[(x * N[(N[(N[(-1.0 + eps), $MachinePrecision] * N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 - eps), $MachinePrecision] / N[(1.0 - N[Power[eps, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1e+22], N[(N[(N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 3.4e+139], N[Not[LessEqual[x, 8.5e+243]], $MachinePrecision]], t$95$0, N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2 \cdot e^{-x}}{2}\\
\mathbf{if}\;x \leq -700:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -1.3 \cdot 10^{-211}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(-1 + \varepsilon\right) \cdot \left(1 + \frac{1}{\varepsilon}\right) + \frac{-1 + \frac{1}{\varepsilon}}{\frac{1 - \varepsilon}{1 - {\varepsilon}^{2}}}\right)}{2}\\
\mathbf{elif}\;x \leq 10^{+22}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon} + 1}{2}\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{+139} \lor \neg \left(x \leq 8.5 \cdot 10^{+243}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + \varepsilon\right)}}{2}\\
\end{array}
\end{array}
if x < -700 or 1e22 < x < 3.4000000000000002e139 or 8.50000000000000026e243 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 85.6%
neg-mul-185.6%
rec-exp85.6%
count-285.6%
rec-exp85.6%
Simplified85.6%
if -700 < x < -1.3e-211Initial program 57.3%
Simplified41.7%
Taylor expanded in x around 0 61.9%
*-commutative61.9%
flip-+75.1%
associate-*r/75.1%
sub-neg75.1%
distribute-neg-frac75.1%
metadata-eval75.1%
metadata-eval75.1%
pow275.1%
Applied egg-rr75.1%
associate-/l*75.1%
Simplified75.1%
if -1.3e-211 < x < 1e22Initial program 54.0%
Simplified44.3%
Taylor expanded in eps around inf 99.0%
Taylor expanded in x around 0 84.5%
Taylor expanded in eps around inf 85.2%
*-commutative85.2%
Simplified85.2%
if 3.4000000000000002e139 < x < 8.50000000000000026e243Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 40.0%
Final simplification79.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (* 2.0 (exp (- x))) 2.0)))
(if (<= x -2e-259)
t_0
(if (<= x 1.15e+20)
(/ (+ (exp (* x eps)) 1.0) 2.0)
(if (or (<= x 1.42e+141) (not (<= x 1e+244)))
t_0
(/ (+ 1.0 (exp (* x (+ -1.0 eps)))) 2.0))))))
double code(double x, double eps) {
double t_0 = (2.0 * exp(-x)) / 2.0;
double tmp;
if (x <= -2e-259) {
tmp = t_0;
} else if (x <= 1.15e+20) {
tmp = (exp((x * eps)) + 1.0) / 2.0;
} else if ((x <= 1.42e+141) || !(x <= 1e+244)) {
tmp = t_0;
} else {
tmp = (1.0 + exp((x * (-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 = (2.0d0 * exp(-x)) / 2.0d0
if (x <= (-2d-259)) then
tmp = t_0
else if (x <= 1.15d+20) then
tmp = (exp((x * eps)) + 1.0d0) / 2.0d0
else if ((x <= 1.42d+141) .or. (.not. (x <= 1d+244))) then
tmp = t_0
else
tmp = (1.0d0 + exp((x * ((-1.0d0) + eps)))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = (2.0 * Math.exp(-x)) / 2.0;
double tmp;
if (x <= -2e-259) {
tmp = t_0;
} else if (x <= 1.15e+20) {
tmp = (Math.exp((x * eps)) + 1.0) / 2.0;
} else if ((x <= 1.42e+141) || !(x <= 1e+244)) {
tmp = t_0;
} else {
tmp = (1.0 + Math.exp((x * (-1.0 + eps)))) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = (2.0 * math.exp(-x)) / 2.0 tmp = 0 if x <= -2e-259: tmp = t_0 elif x <= 1.15e+20: tmp = (math.exp((x * eps)) + 1.0) / 2.0 elif (x <= 1.42e+141) or not (x <= 1e+244): tmp = t_0 else: tmp = (1.0 + math.exp((x * (-1.0 + eps)))) / 2.0 return tmp
function code(x, eps) t_0 = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0) tmp = 0.0 if (x <= -2e-259) tmp = t_0; elseif (x <= 1.15e+20) tmp = Float64(Float64(exp(Float64(x * eps)) + 1.0) / 2.0); elseif ((x <= 1.42e+141) || !(x <= 1e+244)) tmp = t_0; else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps)))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = (2.0 * exp(-x)) / 2.0; tmp = 0.0; if (x <= -2e-259) tmp = t_0; elseif (x <= 1.15e+20) tmp = (exp((x * eps)) + 1.0) / 2.0; elseif ((x <= 1.42e+141) || ~((x <= 1e+244))) tmp = t_0; else tmp = (1.0 + exp((x * (-1.0 + eps)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -2e-259], t$95$0, If[LessEqual[x, 1.15e+20], N[(N[(N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.42e+141], N[Not[LessEqual[x, 1e+244]], $MachinePrecision]], t$95$0, N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2 \cdot e^{-x}}{2}\\
\mathbf{if}\;x \leq -2 \cdot 10^{-259}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+20}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon} + 1}{2}\\
\mathbf{elif}\;x \leq 1.42 \cdot 10^{+141} \lor \neg \left(x \leq 10^{+244}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + \varepsilon\right)}}{2}\\
\end{array}
\end{array}
if x < -2.0000000000000001e-259 or 1.15e20 < x < 1.42000000000000005e141 or 1.00000000000000007e244 < x Initial program 80.6%
Simplified73.8%
Taylor expanded in eps around inf 99.1%
Taylor expanded in eps around 0 75.8%
neg-mul-175.8%
rec-exp75.8%
count-275.8%
rec-exp75.8%
Simplified75.8%
if -2.0000000000000001e-259 < x < 1.15e20Initial program 53.1%
Simplified43.1%
Taylor expanded in eps around inf 98.9%
Taylor expanded in x around 0 83.8%
Taylor expanded in eps around inf 84.6%
*-commutative84.3%
Simplified84.6%
if 1.42000000000000005e141 < x < 1.00000000000000007e244Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 40.0%
Final simplification76.1%
(FPCore (x eps)
:precision binary64
(if (or (<= x -5e-244)
(and (not (<= x 2.3e+17))
(or (<= x 4.4e+144) (not (<= x 1.08e+242)))))
(/ (* 2.0 (exp (- x))) 2.0)
(/ (+ (exp (* x eps)) 1.0) 2.0)))
double code(double x, double eps) {
double tmp;
if ((x <= -5e-244) || (!(x <= 2.3e+17) && ((x <= 4.4e+144) || !(x <= 1.08e+242)))) {
tmp = (2.0 * exp(-x)) / 2.0;
} else {
tmp = (exp((x * eps)) + 1.0) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((x <= (-5d-244)) .or. (.not. (x <= 2.3d+17)) .and. (x <= 4.4d+144) .or. (.not. (x <= 1.08d+242))) then
tmp = (2.0d0 * exp(-x)) / 2.0d0
else
tmp = (exp((x * eps)) + 1.0d0) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((x <= -5e-244) || (!(x <= 2.3e+17) && ((x <= 4.4e+144) || !(x <= 1.08e+242)))) {
tmp = (2.0 * Math.exp(-x)) / 2.0;
} else {
tmp = (Math.exp((x * eps)) + 1.0) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if (x <= -5e-244) or (not (x <= 2.3e+17) and ((x <= 4.4e+144) or not (x <= 1.08e+242))): tmp = (2.0 * math.exp(-x)) / 2.0 else: tmp = (math.exp((x * eps)) + 1.0) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if ((x <= -5e-244) || (!(x <= 2.3e+17) && ((x <= 4.4e+144) || !(x <= 1.08e+242)))) tmp = Float64(Float64(2.0 * exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * eps)) + 1.0) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((x <= -5e-244) || (~((x <= 2.3e+17)) && ((x <= 4.4e+144) || ~((x <= 1.08e+242))))) tmp = (2.0 * exp(-x)) / 2.0; else tmp = (exp((x * eps)) + 1.0) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[x, -5e-244], And[N[Not[LessEqual[x, 2.3e+17]], $MachinePrecision], Or[LessEqual[x, 4.4e+144], N[Not[LessEqual[x, 1.08e+242]], $MachinePrecision]]]], N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-244} \lor \neg \left(x \leq 2.3 \cdot 10^{+17}\right) \land \left(x \leq 4.4 \cdot 10^{+144} \lor \neg \left(x \leq 1.08 \cdot 10^{+242}\right)\right):\\
\;\;\;\;\frac{2 \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon} + 1}{2}\\
\end{array}
\end{array}
if x < -4.99999999999999998e-244 or 2.3e17 < x < 4.39999999999999976e144 or 1.07999999999999989e242 < x Initial program 80.6%
Simplified73.8%
Taylor expanded in eps around inf 99.1%
Taylor expanded in eps around 0 75.8%
neg-mul-175.8%
rec-exp75.8%
count-275.8%
rec-exp75.8%
Simplified75.8%
if -4.99999999999999998e-244 < x < 2.3e17 or 4.39999999999999976e144 < x < 1.07999999999999989e242Initial program 61.6%
Simplified53.4%
Taylor expanded in eps around inf 99.1%
Taylor expanded in x around 0 75.9%
Taylor expanded in eps around inf 76.5%
*-commutative76.1%
Simplified76.5%
Final simplification76.1%
(FPCore (x eps) :precision binary64 (/ (* 2.0 (exp (- x))) 2.0))
double code(double x, double eps) {
return (2.0 * exp(-x)) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (2.0d0 * exp(-x)) / 2.0d0
end function
public static double code(double x, double eps) {
return (2.0 * Math.exp(-x)) / 2.0;
}
def code(x, eps): return (2.0 * math.exp(-x)) / 2.0
function code(x, eps) return Float64(Float64(2.0 * exp(Float64(-x))) / 2.0) end
function tmp = code(x, eps) tmp = (2.0 * exp(-x)) / 2.0; end
code[x_, eps_] := N[(N[(2.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{2 \cdot e^{-x}}{2}
\end{array}
Initial program 72.0%
Simplified64.6%
Taylor expanded in eps around inf 99.1%
Taylor expanded in eps around 0 71.7%
neg-mul-171.7%
rec-exp71.7%
count-271.7%
rec-exp71.7%
Simplified71.7%
Final simplification71.7%
(FPCore (x eps) :precision binary64 (if (<= x 1.16e-5) (/ (+ 2.0 (* x (+ (/ -1.0 eps) (* (+ eps 1.0) (+ -1.0 (/ 1.0 eps)))))) 2.0) 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 1.16e-5) {
tmp = (2.0 + (x * ((-1.0 / eps) + ((eps + 1.0) * (-1.0 + (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 <= 1.16d-5) then
tmp = (2.0d0 + (x * (((-1.0d0) / eps) + ((eps + 1.0d0) * ((-1.0d0) + (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 <= 1.16e-5) {
tmp = (2.0 + (x * ((-1.0 / eps) + ((eps + 1.0) * (-1.0 + (1.0 / eps)))))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.16e-5: tmp = (2.0 + (x * ((-1.0 / eps) + ((eps + 1.0) * (-1.0 + (1.0 / eps)))))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 1.16e-5) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(-1.0 / eps) + Float64(Float64(eps + 1.0) * Float64(-1.0 + 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 <= 1.16e-5) tmp = (2.0 + (x * ((-1.0 / eps) + ((eps + 1.0) * (-1.0 + (1.0 / eps)))))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 1.16e-5], N[(N[(2.0 + N[(x * N[(N[(-1.0 / eps), $MachinePrecision] + N[(N[(eps + 1.0), $MachinePrecision] * N[(-1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.16 \cdot 10^{-5}:\\
\;\;\;\;\frac{2 + x \cdot \left(\frac{-1}{\varepsilon} + \left(\varepsilon + 1\right) \cdot \left(-1 + \frac{1}{\varepsilon}\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.1600000000000001e-5Initial program 61.7%
Simplified51.5%
Taylor expanded in x around 0 61.1%
Taylor expanded in eps around 0 63.1%
if 1.1600000000000001e-5 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around -inf 100.0%
Simplified100.0%
Applied egg-rr0.3%
+-inverses0.3%
mul0-rgt58.6%
Simplified58.6%
Final simplification61.9%
(FPCore (x eps) :precision binary64 (if (<= x 1.16e-5) (/ (- 2.0 (* x (+ eps 2.0))) 2.0) 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 1.16e-5) {
tmp = (2.0 - (x * (eps + 2.0))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 1.16d-5) then
tmp = (2.0d0 - (x * (eps + 2.0d0))) / 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.16e-5) {
tmp = (2.0 - (x * (eps + 2.0))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.16e-5: tmp = (2.0 - (x * (eps + 2.0))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 1.16e-5) tmp = Float64(Float64(2.0 - Float64(x * Float64(eps + 2.0))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 1.16e-5) tmp = (2.0 - (x * (eps + 2.0))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 1.16e-5], N[(N[(2.0 - N[(x * N[(eps + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.16 \cdot 10^{-5}:\\
\;\;\;\;\frac{2 - x \cdot \left(\varepsilon + 2\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.1600000000000001e-5Initial program 61.7%
Simplified61.7%
Taylor expanded in eps around inf 98.8%
Taylor expanded in eps around 0 88.6%
Taylor expanded in x around 0 62.4%
mul-1-neg62.4%
unsub-neg62.4%
Simplified62.4%
if 1.1600000000000001e-5 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around -inf 100.0%
Simplified100.0%
Applied egg-rr0.3%
+-inverses0.3%
mul0-rgt58.6%
Simplified58.6%
Final simplification61.4%
(FPCore (x eps) :precision binary64 (if (<= x -0.39) (/ (* x (- -1.0 eps)) 2.0) (if (<= x 2.6e+15) 1.0 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -0.39) {
tmp = (x * (-1.0 - eps)) / 2.0;
} else if (x <= 2.6e+15) {
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.39d0)) then
tmp = (x * ((-1.0d0) - eps)) / 2.0d0
else if (x <= 2.6d+15) 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.39) {
tmp = (x * (-1.0 - eps)) / 2.0;
} else if (x <= 2.6e+15) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -0.39: tmp = (x * (-1.0 - eps)) / 2.0 elif x <= 2.6e+15: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -0.39) tmp = Float64(Float64(x * Float64(-1.0 - eps)) / 2.0); elseif (x <= 2.6e+15) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -0.39) tmp = (x * (-1.0 - eps)) / 2.0; elseif (x <= 2.6e+15) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -0.39], N[(N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.6e+15], 1.0, 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.39:\\
\;\;\;\;\frac{x \cdot \left(-1 - \varepsilon\right)}{2}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+15}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -0.39000000000000001Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 49.8%
Taylor expanded in x around inf 19.5%
mul-1-neg19.5%
distribute-rgt-neg-in19.5%
distribute-neg-in19.5%
metadata-eval19.5%
unsub-neg19.5%
Simplified19.5%
if -0.39000000000000001 < x < 2.6e15Initial program 54.6%
Simplified54.6%
Taylor expanded in x around 0 71.7%
if 2.6e15 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around -inf 100.0%
Simplified100.0%
Applied egg-rr0.3%
+-inverses0.3%
mul0-rgt62.1%
Simplified62.1%
Final simplification62.6%
(FPCore (x eps) :precision binary64 (if (<= x -0.39) (/ (* x (- eps)) 2.0) (if (<= x 2.6e+15) 1.0 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -0.39) {
tmp = (x * -eps) / 2.0;
} else if (x <= 2.6e+15) {
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.39d0)) then
tmp = (x * -eps) / 2.0d0
else if (x <= 2.6d+15) 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.39) {
tmp = (x * -eps) / 2.0;
} else if (x <= 2.6e+15) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -0.39: tmp = (x * -eps) / 2.0 elif x <= 2.6e+15: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -0.39) tmp = Float64(Float64(x * Float64(-eps)) / 2.0); elseif (x <= 2.6e+15) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -0.39) tmp = (x * -eps) / 2.0; elseif (x <= 2.6e+15) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -0.39], N[(N[(x * (-eps)), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.6e+15], 1.0, 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.39:\\
\;\;\;\;\frac{x \cdot \left(-\varepsilon\right)}{2}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+15}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -0.39000000000000001Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 49.8%
Taylor expanded in eps around inf 49.8%
*-commutative49.8%
Simplified49.8%
Taylor expanded in eps around inf 19.5%
associate-*r*19.5%
mul-1-neg19.5%
Simplified19.5%
if -0.39000000000000001 < x < 2.6e15Initial program 54.6%
Simplified54.6%
Taylor expanded in x around 0 71.7%
if 2.6e15 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around -inf 100.0%
Simplified100.0%
Applied egg-rr0.3%
+-inverses0.3%
mul0-rgt62.1%
Simplified62.1%
Final simplification62.6%
(FPCore (x eps) :precision binary64 (if (<= x 2.6e+15) 1.0 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 2.6e+15) {
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 <= 2.6d+15) 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 <= 2.6e+15) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 2.6e+15: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 2.6e+15) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 2.6e+15) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 2.6e+15], 1.0, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.6 \cdot 10^{+15}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2.6e15Initial program 62.5%
Simplified62.5%
Taylor expanded in x around 0 59.9%
if 2.6e15 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around -inf 100.0%
Simplified100.0%
Applied egg-rr0.3%
+-inverses0.3%
mul0-rgt62.1%
Simplified62.1%
Final simplification60.5%
(FPCore (x eps) :precision binary64 0.0)
double code(double x, double eps) {
return 0.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 0.0d0
end function
public static double code(double x, double eps) {
return 0.0;
}
def code(x, eps): return 0.0
function code(x, eps) return 0.0 end
function tmp = code(x, eps) tmp = 0.0; end
code[x_, eps_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 72.0%
Simplified72.0%
Taylor expanded in eps around inf 99.1%
Taylor expanded in eps around -inf 99.1%
Simplified99.1%
Applied egg-rr1.8%
+-inverses1.8%
mul0-rgt17.6%
Simplified17.6%
Final simplification17.6%
herbie shell --seed 2024010
(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))