
(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 14 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 73.1%
Simplified64.1%
Taylor expanded in eps around inf 99.6%
Final simplification99.6%
(FPCore (x eps)
:precision binary64
(if (<= eps 9.2e-264)
0.0
(if (<= eps 2e-5)
(/ (* eps (+ x (/ (- 2.0 (* x eps)) eps))) 2.0)
(/ (+ (exp (* x (- eps))) (exp (* x eps))) 2.0))))
double code(double x, double eps) {
double tmp;
if (eps <= 9.2e-264) {
tmp = 0.0;
} else if (eps <= 2e-5) {
tmp = (eps * (x + ((2.0 - (x * eps)) / eps))) / 2.0;
} else {
tmp = (exp((x * -eps)) + exp((x * eps))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= 9.2d-264) then
tmp = 0.0d0
else if (eps <= 2d-5) then
tmp = (eps * (x + ((2.0d0 - (x * eps)) / eps))) / 2.0d0
else
tmp = (exp((x * -eps)) + exp((x * eps))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= 9.2e-264) {
tmp = 0.0;
} else if (eps <= 2e-5) {
tmp = (eps * (x + ((2.0 - (x * eps)) / eps))) / 2.0;
} else {
tmp = (Math.exp((x * -eps)) + Math.exp((x * eps))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= 9.2e-264: tmp = 0.0 elif eps <= 2e-5: tmp = (eps * (x + ((2.0 - (x * eps)) / eps))) / 2.0 else: tmp = (math.exp((x * -eps)) + math.exp((x * eps))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (eps <= 9.2e-264) tmp = 0.0; elseif (eps <= 2e-5) tmp = Float64(Float64(eps * Float64(x + Float64(Float64(2.0 - Float64(x * eps)) / eps))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-eps))) + exp(Float64(x * eps))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 9.2e-264) tmp = 0.0; elseif (eps <= 2e-5) tmp = (eps * (x + ((2.0 - (x * eps)) / eps))) / 2.0; else tmp = (exp((x * -eps)) + exp((x * eps))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, 9.2e-264], 0.0, If[LessEqual[eps, 2e-5], N[(N[(eps * N[(x + N[(N[(2.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 9.2 \cdot 10^{-264}:\\
\;\;\;\;0\\
\mathbf{elif}\;\varepsilon \leq 2 \cdot 10^{-5}:\\
\;\;\;\;\frac{\varepsilon \cdot \left(x + \frac{2 - x \cdot \varepsilon}{\varepsilon}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-\varepsilon\right)} + e^{x \cdot \varepsilon}}{2}\\
\end{array}
\end{array}
if eps < 9.20000000000000046e-264Initial program 73.4%
Simplified63.3%
Taylor expanded in eps around 0 18.6%
Taylor expanded in x around 0 18.8%
if 9.20000000000000046e-264 < eps < 2.00000000000000016e-5Initial program 32.6%
Simplified32.6%
Taylor expanded in x around 0 7.0%
Taylor expanded in eps around inf 74.4%
Simplified74.4%
Taylor expanded in x around 0 74.2%
distribute-rgt-in74.2%
*-lft-identity74.2%
distribute-lft-out74.2%
associate-*r*74.2%
distribute-rgt-in74.2%
mul-1-neg74.2%
sub-neg74.2%
Simplified74.2%
Taylor expanded in eps around inf 89.2%
associate-*r*89.2%
neg-mul-189.2%
Simplified89.2%
if 2.00000000000000016e-5 < eps Initial program 100.0%
Simplified86.9%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification53.0%
(FPCore (x eps) :precision binary64 (/ (+ (exp (* x (+ -1.0 eps))) (exp (* x (- eps)))) 2.0))
double code(double x, double eps) {
return (exp((x * (-1.0 + eps))) + exp((x * -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 * -eps))) / 2.0d0
end function
public static double code(double x, double eps) {
return (Math.exp((x * (-1.0 + eps))) + Math.exp((x * -eps))) / 2.0;
}
def code(x, eps): return (math.exp((x * (-1.0 + eps))) + math.exp((x * -eps))) / 2.0
function code(x, eps) return Float64(Float64(exp(Float64(x * Float64(-1.0 + eps))) + exp(Float64(x * Float64(-eps)))) / 2.0) end
function tmp = code(x, eps) tmp = (exp((x * (-1.0 + eps))) + exp((x * -eps))) / 2.0; end
code[x_, eps_] := N[(N[(N[Exp[N[(x * N[(-1.0 + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{x \cdot \left(-1 + \varepsilon\right)} + e^{x \cdot \left(-\varepsilon\right)}}{2}
\end{array}
Initial program 73.1%
Simplified64.1%
Taylor expanded in eps around inf 99.6%
Taylor expanded in eps around inf 88.9%
mul-1-neg88.9%
*-commutative88.9%
distribute-rgt-neg-in88.9%
Simplified88.9%
Final simplification88.9%
(FPCore (x eps)
:precision binary64
(if (<= x 3.7e-277)
(/
(* x (+ eps (/ (* eps (+ (/ 1.0 eps) (/ (exp (* x (- eps))) eps))) x)))
2.0)
(/ (+ 1.0 (exp (* x (+ -1.0 eps)))) 2.0)))
double code(double x, double eps) {
double tmp;
if (x <= 3.7e-277) {
tmp = (x * (eps + ((eps * ((1.0 / eps) + (exp((x * -eps)) / eps))) / x))) / 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) :: tmp
if (x <= 3.7d-277) then
tmp = (x * (eps + ((eps * ((1.0d0 / eps) + (exp((x * -eps)) / eps))) / x))) / 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 tmp;
if (x <= 3.7e-277) {
tmp = (x * (eps + ((eps * ((1.0 / eps) + (Math.exp((x * -eps)) / eps))) / x))) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (-1.0 + eps)))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 3.7e-277: tmp = (x * (eps + ((eps * ((1.0 / eps) + (math.exp((x * -eps)) / eps))) / x))) / 2.0 else: tmp = (1.0 + math.exp((x * (-1.0 + eps)))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 3.7e-277) tmp = Float64(Float64(x * Float64(eps + Float64(Float64(eps * Float64(Float64(1.0 / eps) + Float64(exp(Float64(x * Float64(-eps))) / eps))) / x))) / 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) tmp = 0.0; if (x <= 3.7e-277) tmp = (x * (eps + ((eps * ((1.0 / eps) + (exp((x * -eps)) / eps))) / x))) / 2.0; else tmp = (1.0 + exp((x * (-1.0 + eps)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 3.7e-277], N[(N[(x * N[(eps + N[(N[(eps * N[(N[(1.0 / eps), $MachinePrecision] + N[(N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $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}
\mathbf{if}\;x \leq 3.7 \cdot 10^{-277}:\\
\;\;\;\;\frac{x \cdot \left(\varepsilon + \frac{\varepsilon \cdot \left(\frac{1}{\varepsilon} + \frac{e^{x \cdot \left(-\varepsilon\right)}}{\varepsilon}\right)}{x}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + \varepsilon\right)}}{2}\\
\end{array}
\end{array}
if x < 3.69999999999999985e-277Initial program 65.1%
Simplified65.1%
Taylor expanded in x around 0 39.0%
Taylor expanded in eps around inf 83.6%
Simplified83.6%
Taylor expanded in x around inf 83.4%
Taylor expanded in eps around inf 83.9%
mul-1-neg99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
Simplified83.9%
if 3.69999999999999985e-277 < x Initial program 80.5%
Simplified74.4%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 79.6%
mul-1-neg79.6%
*-commutative79.6%
distribute-rgt-neg-in79.6%
Simplified79.6%
Taylor expanded in x around 0 48.5%
Final simplification65.4%
(FPCore (x eps) :precision binary64 (if (<= x 4e-277) (/ (* eps (+ x (/ (+ 1.0 (exp (* x (- -1.0 eps)))) eps))) 2.0) (/ (+ 1.0 (exp (* x (+ -1.0 eps)))) 2.0)))
double code(double x, double eps) {
double tmp;
if (x <= 4e-277) {
tmp = (eps * (x + ((1.0 + exp((x * (-1.0 - eps)))) / eps))) / 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) :: tmp
if (x <= 4d-277) then
tmp = (eps * (x + ((1.0d0 + exp((x * ((-1.0d0) - eps)))) / eps))) / 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 tmp;
if (x <= 4e-277) {
tmp = (eps * (x + ((1.0 + Math.exp((x * (-1.0 - eps)))) / eps))) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (-1.0 + eps)))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 4e-277: tmp = (eps * (x + ((1.0 + math.exp((x * (-1.0 - eps)))) / eps))) / 2.0 else: tmp = (1.0 + math.exp((x * (-1.0 + eps)))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 4e-277) tmp = Float64(Float64(eps * Float64(x + Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps)))) / eps))) / 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) tmp = 0.0; if (x <= 4e-277) tmp = (eps * (x + ((1.0 + exp((x * (-1.0 - eps)))) / eps))) / 2.0; else tmp = (1.0 + exp((x * (-1.0 + eps)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 4e-277], N[(N[(eps * N[(x + N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision]), $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}
\mathbf{if}\;x \leq 4 \cdot 10^{-277}:\\
\;\;\;\;\frac{\varepsilon \cdot \left(x + \frac{1 + e^{x \cdot \left(-1 - \varepsilon\right)}}{\varepsilon}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + \varepsilon\right)}}{2}\\
\end{array}
\end{array}
if x < 3.99999999999999988e-277Initial program 65.1%
Simplified65.1%
Taylor expanded in x around 0 39.0%
Taylor expanded in eps around inf 83.6%
Simplified83.6%
Taylor expanded in x around 0 83.6%
distribute-rgt-in83.6%
*-lft-identity83.6%
distribute-lft-out83.6%
associate-*r*83.6%
distribute-rgt-in83.6%
mul-1-neg83.6%
sub-neg83.6%
Simplified83.6%
if 3.99999999999999988e-277 < x Initial program 80.5%
Simplified74.4%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 79.6%
mul-1-neg79.6%
*-commutative79.6%
distribute-rgt-neg-in79.6%
Simplified79.6%
Taylor expanded in x around 0 48.5%
Final simplification65.2%
(FPCore (x eps)
:precision binary64
(if (<= x -5.2e-93)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x -6.5e-115)
(/ (/ (+ x (* eps (- 2.0 (* x eps)))) eps) 2.0)
(/ (+ 1.0 (exp (* x (+ -1.0 eps)))) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= -5.2e-93) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= -6.5e-115) {
tmp = ((x + (eps * (2.0 - (x * eps)))) / eps) / 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) :: tmp
if (x <= (-5.2d-93)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= (-6.5d-115)) then
tmp = ((x + (eps * (2.0d0 - (x * eps)))) / eps) / 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 tmp;
if (x <= -5.2e-93) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= -6.5e-115) {
tmp = ((x + (eps * (2.0 - (x * eps)))) / eps) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (-1.0 + eps)))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -5.2e-93: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= -6.5e-115: tmp = ((x + (eps * (2.0 - (x * eps)))) / eps) / 2.0 else: tmp = (1.0 + math.exp((x * (-1.0 + eps)))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -5.2e-93) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= -6.5e-115) tmp = Float64(Float64(Float64(x + Float64(eps * Float64(2.0 - Float64(x * eps)))) / eps) / 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) tmp = 0.0; if (x <= -5.2e-93) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= -6.5e-115) tmp = ((x + (eps * (2.0 - (x * eps)))) / eps) / 2.0; else tmp = (1.0 + exp((x * (-1.0 + eps)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -5.2e-93], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -6.5e-115], N[(N[(N[(x + N[(eps * N[(2.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps), $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}
\mathbf{if}\;x \leq -5.2 \cdot 10^{-93}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{-115}:\\
\;\;\;\;\frac{\frac{x + \varepsilon \cdot \left(2 - x \cdot \varepsilon\right)}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + \varepsilon\right)}}{2}\\
\end{array}
\end{array}
if x < -5.1999999999999997e-93Initial program 76.5%
Simplified76.5%
Taylor expanded in x around 0 44.8%
Taylor expanded in eps around inf 66.5%
mul-1-neg66.5%
neg-mul-166.5%
distribute-rgt-neg-in66.5%
distribute-neg-in66.5%
metadata-eval66.5%
Simplified66.5%
Taylor expanded in eps around 0 90.1%
neg-mul-190.1%
Simplified90.1%
if -5.1999999999999997e-93 < x < -6.50000000000000033e-115Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 35.4%
Taylor expanded in x around 0 17.6%
Taylor expanded in eps around 0 33.3%
mul-1-neg33.3%
*-commutative33.3%
unsub-neg33.3%
*-commutative33.3%
Simplified33.3%
if -6.50000000000000033e-115 < x Initial program 71.0%
Simplified59.5%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 85.2%
mul-1-neg85.2%
*-commutative85.2%
distribute-rgt-neg-in85.2%
Simplified85.2%
Taylor expanded in x around 0 60.3%
Final simplification67.4%
(FPCore (x eps)
:precision binary64
(if (<= x -5.8e-93)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x -6.6e-117)
(/ (/ (+ x (* eps (- 2.0 (* x eps)))) eps) 2.0)
(/ (+ 1.0 (exp (* x eps))) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= -5.8e-93) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= -6.6e-117) {
tmp = ((x + (eps * (2.0 - (x * eps)))) / eps) / 2.0;
} else {
tmp = (1.0 + exp((x * eps))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-5.8d-93)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= (-6.6d-117)) then
tmp = ((x + (eps * (2.0d0 - (x * eps)))) / eps) / 2.0d0
else
tmp = (1.0d0 + exp((x * eps))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -5.8e-93) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= -6.6e-117) {
tmp = ((x + (eps * (2.0 - (x * eps)))) / eps) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * eps))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -5.8e-93: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= -6.6e-117: tmp = ((x + (eps * (2.0 - (x * eps)))) / eps) / 2.0 else: tmp = (1.0 + math.exp((x * eps))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -5.8e-93) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= -6.6e-117) tmp = Float64(Float64(Float64(x + Float64(eps * Float64(2.0 - Float64(x * eps)))) / eps) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * eps))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -5.8e-93) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= -6.6e-117) tmp = ((x + (eps * (2.0 - (x * eps)))) / eps) / 2.0; else tmp = (1.0 + exp((x * eps))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -5.8e-93], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -6.6e-117], N[(N[(N[(x + N[(eps * N[(2.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{-93}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq -6.6 \cdot 10^{-117}:\\
\;\;\;\;\frac{\frac{x + \varepsilon \cdot \left(2 - x \cdot \varepsilon\right)}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \varepsilon}}{2}\\
\end{array}
\end{array}
if x < -5.7999999999999997e-93Initial program 76.5%
Simplified76.5%
Taylor expanded in x around 0 44.8%
Taylor expanded in eps around inf 66.5%
mul-1-neg66.5%
neg-mul-166.5%
distribute-rgt-neg-in66.5%
distribute-neg-in66.5%
metadata-eval66.5%
Simplified66.5%
Taylor expanded in eps around 0 90.1%
neg-mul-190.1%
Simplified90.1%
if -5.7999999999999997e-93 < x < -6.6000000000000003e-117Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 35.4%
Taylor expanded in x around 0 17.6%
Taylor expanded in eps around 0 33.3%
mul-1-neg33.3%
*-commutative33.3%
unsub-neg33.3%
*-commutative33.3%
Simplified33.3%
if -6.6000000000000003e-117 < x Initial program 71.0%
Simplified59.5%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 85.2%
mul-1-neg85.2%
*-commutative85.2%
distribute-rgt-neg-in85.2%
Simplified85.2%
Taylor expanded in eps around inf 80.9%
*-commutative80.9%
Simplified80.9%
Taylor expanded in x around 0 60.3%
Final simplification67.3%
(FPCore (x eps) :precision binary64 (if (<= x -4.2e-239) (/ (+ 1.0 (exp (* x (- eps)))) 2.0) (/ (+ 1.0 (exp (* x (+ -1.0 eps)))) 2.0)))
double code(double x, double eps) {
double tmp;
if (x <= -4.2e-239) {
tmp = (1.0 + exp((x * -eps))) / 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) :: tmp
if (x <= (-4.2d-239)) then
tmp = (1.0d0 + exp((x * -eps))) / 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 tmp;
if (x <= -4.2e-239) {
tmp = (1.0 + Math.exp((x * -eps))) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (-1.0 + eps)))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -4.2e-239: tmp = (1.0 + math.exp((x * -eps))) / 2.0 else: tmp = (1.0 + math.exp((x * (-1.0 + eps)))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -4.2e-239) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-eps)))) / 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) tmp = 0.0; if (x <= -4.2e-239) tmp = (1.0 + exp((x * -eps))) / 2.0; else tmp = (1.0 + exp((x * (-1.0 + eps)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -4.2e-239], N[(N[(1.0 + N[Exp[N[(x * (-eps)), $MachinePrecision]], $MachinePrecision]), $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}
\mathbf{if}\;x \leq -4.2 \cdot 10^{-239}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-\varepsilon\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + \varepsilon\right)}}{2}\\
\end{array}
\end{array}
if x < -4.2000000000000004e-239Initial program 68.4%
Simplified68.4%
Taylor expanded in x around 0 42.5%
Taylor expanded in eps around inf 72.9%
mul-1-neg72.9%
neg-mul-172.9%
distribute-rgt-neg-in72.9%
distribute-neg-in72.9%
metadata-eval72.9%
Simplified72.9%
Taylor expanded in x around 0 72.9%
distribute-rgt-in79.7%
*-lft-identity79.7%
distribute-lft-out79.7%
associate-*r*79.7%
distribute-rgt-in79.7%
mul-1-neg79.7%
sub-neg79.7%
Simplified72.9%
Taylor expanded in eps around inf 73.5%
associate-*r*55.5%
neg-mul-155.5%
Simplified73.5%
if -4.2000000000000004e-239 < x Initial program 76.1%
Simplified65.8%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 82.7%
mul-1-neg82.7%
*-commutative82.7%
distribute-rgt-neg-in82.7%
Simplified82.7%
Taylor expanded in x around 0 56.0%
Final simplification62.7%
(FPCore (x eps) :precision binary64 (if (<= x 500000000000.0) (/ (+ 1.0 (exp (- x))) 2.0) 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 500000000000.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 500000000000.0d0) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 500000000000.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 500000000000.0: tmp = (1.0 + math.exp(-x)) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 500000000000.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 500000000000.0) tmp = (1.0 + exp(-x)) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 500000000000.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 500000000000:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 5e11Initial program 62.6%
Simplified62.6%
Taylor expanded in x around 0 41.6%
Taylor expanded in eps around inf 78.4%
mul-1-neg78.4%
neg-mul-178.4%
distribute-rgt-neg-in78.4%
distribute-neg-in78.4%
metadata-eval78.4%
Simplified78.4%
Taylor expanded in eps around 0 79.5%
neg-mul-179.5%
Simplified79.5%
if 5e11 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 50.8%
Taylor expanded in x around 0 50.8%
(FPCore (x eps) :precision binary64 (if (<= x -0.004) (/ (/ (+ x (* eps (- 2.0 (* x eps)))) eps) 2.0) (if (<= x 500000000000.0) 1.0 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -0.004) {
tmp = ((x + (eps * (2.0 - (x * eps)))) / eps) / 2.0;
} else if (x <= 500000000000.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.004d0)) then
tmp = ((x + (eps * (2.0d0 - (x * eps)))) / eps) / 2.0d0
else if (x <= 500000000000.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.004) {
tmp = ((x + (eps * (2.0 - (x * eps)))) / eps) / 2.0;
} else if (x <= 500000000000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -0.004: tmp = ((x + (eps * (2.0 - (x * eps)))) / eps) / 2.0 elif x <= 500000000000.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -0.004) tmp = Float64(Float64(Float64(x + Float64(eps * Float64(2.0 - Float64(x * eps)))) / eps) / 2.0); elseif (x <= 500000000000.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -0.004) tmp = ((x + (eps * (2.0 - (x * eps)))) / eps) / 2.0; elseif (x <= 500000000000.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -0.004], N[(N[(N[(x + N[(eps * N[(2.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 500000000000.0], 1.0, 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.004:\\
\;\;\;\;\frac{\frac{x + \varepsilon \cdot \left(2 - x \cdot \varepsilon\right)}{\varepsilon}}{2}\\
\mathbf{elif}\;x \leq 500000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -0.0040000000000000001Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 59.4%
Taylor expanded in x around 0 32.5%
Taylor expanded in eps around 0 51.6%
mul-1-neg51.6%
*-commutative51.6%
unsub-neg51.6%
*-commutative51.6%
Simplified51.6%
if -0.0040000000000000001 < x < 5e11Initial program 51.2%
Simplified51.2%
Taylor expanded in x around 0 37.1%
Taylor expanded in eps around inf 84.9%
Simplified84.9%
Taylor expanded in x around 0 72.6%
distribute-rgt-in72.6%
*-lft-identity72.6%
distribute-lft-out72.6%
associate-*r*72.6%
distribute-rgt-in72.6%
mul-1-neg72.6%
sub-neg72.6%
Simplified72.6%
Taylor expanded in x around 0 73.6%
if 5e11 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 50.8%
Taylor expanded in x around 0 50.8%
Final simplification63.5%
(FPCore (x eps) :precision binary64 (if (<= x 3.4e-9) (/ (+ 2.0 (* x (- -1.0 eps))) 2.0) 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 3.4e-9) {
tmp = (2.0 + (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 <= 3.4d-9) then
tmp = (2.0d0 + (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 <= 3.4e-9) {
tmp = (2.0 + (x * (-1.0 - eps))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 3.4e-9: tmp = (2.0 + (x * (-1.0 - eps))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 3.4e-9) tmp = Float64(Float64(2.0 + 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 <= 3.4e-9) tmp = (2.0 + (x * (-1.0 - eps))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 3.4e-9], N[(N[(2.0 + N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.4 \cdot 10^{-9}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 - \varepsilon\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 3.3999999999999998e-9Initial program 61.4%
Simplified61.4%
Taylor expanded in x around 0 41.8%
Taylor expanded in eps around inf 79.8%
mul-1-neg79.8%
neg-mul-179.8%
distribute-rgt-neg-in79.8%
distribute-neg-in79.8%
metadata-eval79.8%
Simplified79.8%
Taylor expanded in x around 0 65.0%
distribute-rgt-in65.0%
*-lft-identity65.0%
distribute-lft-out65.0%
associate-*r*65.0%
distribute-rgt-in65.0%
mul-1-neg65.0%
sub-neg65.0%
Simplified65.0%
if 3.3999999999999998e-9 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 47.0%
Taylor expanded in x around 0 47.0%
(FPCore (x eps) :precision binary64 (if (<= x 2.0) (/ (- 2.0 x) 2.0) 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 - x) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 2.0d0) then
tmp = (2.0d0 - x) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 2.0) {
tmp = (2.0 - x) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 2.0: tmp = (2.0 - x) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 2.0) tmp = Float64(Float64(2.0 - x) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 2.0) tmp = (2.0 - x) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 2.0], N[(N[(2.0 - x), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;\frac{2 - x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 2Initial program 62.0%
Simplified49.2%
Taylor expanded in eps around inf 99.4%
Taylor expanded in eps around inf 99.4%
mul-1-neg99.4%
*-commutative99.4%
distribute-rgt-neg-in99.4%
Simplified99.4%
Taylor expanded in x around 0 58.2%
*-commutative58.2%
distribute-rgt1-in58.2%
metadata-eval58.2%
mul0-lft58.2%
metadata-eval58.2%
neg-mul-158.2%
unsub-neg58.2%
Simplified58.2%
if 2 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 48.8%
Taylor expanded in x around 0 48.8%
(FPCore (x eps) :precision binary64 (if (<= x 500000000000.0) 1.0 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 500000000000.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 <= 500000000000.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 <= 500000000000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 500000000000.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 500000000000.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 500000000000.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 500000000000.0], 1.0, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 500000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 5e11Initial program 62.6%
Simplified62.6%
Taylor expanded in x around 0 38.6%
Taylor expanded in eps around inf 82.3%
Simplified82.3%
Taylor expanded in x around 0 63.0%
distribute-rgt-in63.0%
*-lft-identity63.0%
distribute-lft-out63.0%
associate-*r*63.0%
distribute-rgt-in63.0%
mul-1-neg63.0%
sub-neg63.0%
Simplified63.0%
Taylor expanded in x around 0 57.1%
if 5e11 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 50.8%
Taylor expanded in x around 0 50.8%
(FPCore (x eps) :precision binary64 0.0)
double code(double x, double eps) {
return 0.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 0.0d0
end function
public static double code(double x, double eps) {
return 0.0;
}
def code(x, eps): return 0.0
function code(x, eps) return 0.0 end
function tmp = code(x, eps) tmp = 0.0; end
code[x_, eps_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 73.1%
Simplified64.1%
Taylor expanded in eps around 0 15.8%
Taylor expanded in x around 0 16.0%
herbie shell --seed 2024186
(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))