
(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 77.3%
Simplified63.7%
Taylor expanded in eps around inf 99.3%
Final simplification99.3%
(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 77.3%
Simplified63.7%
Taylor expanded in eps around inf 99.3%
Taylor expanded in eps around inf 88.7%
neg-mul-188.7%
distribute-lft-neg-in88.7%
*-commutative88.7%
Simplified88.7%
Final simplification88.7%
(FPCore (x eps)
:precision binary64
(if (<= x -5.2e-21)
(/
(+ (+ 1.0 (/ 1.0 eps)) (* (exp (* x (- -1.0 eps))) (- (/ -1.0 eps) -1.0)))
2.0)
(if (<= x 9.2e+110)
(/ (+ 1.0 (exp (* x eps))) 2.0)
(if (<= x 2.2e+184) 0.0 (/ (+ 1.0 (exp (* x (+ -1.0 eps)))) 2.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -5.2e-21) {
tmp = ((1.0 + (1.0 / eps)) + (exp((x * (-1.0 - eps))) * ((-1.0 / eps) - -1.0))) / 2.0;
} else if (x <= 9.2e+110) {
tmp = (1.0 + exp((x * eps))) / 2.0;
} else if (x <= 2.2e+184) {
tmp = 0.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-21)) then
tmp = ((1.0d0 + (1.0d0 / eps)) + (exp((x * ((-1.0d0) - eps))) * (((-1.0d0) / eps) - (-1.0d0)))) / 2.0d0
else if (x <= 9.2d+110) then
tmp = (1.0d0 + exp((x * eps))) / 2.0d0
else if (x <= 2.2d+184) then
tmp = 0.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-21) {
tmp = ((1.0 + (1.0 / eps)) + (Math.exp((x * (-1.0 - eps))) * ((-1.0 / eps) - -1.0))) / 2.0;
} else if (x <= 9.2e+110) {
tmp = (1.0 + Math.exp((x * eps))) / 2.0;
} else if (x <= 2.2e+184) {
tmp = 0.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-21: tmp = ((1.0 + (1.0 / eps)) + (math.exp((x * (-1.0 - eps))) * ((-1.0 / eps) - -1.0))) / 2.0 elif x <= 9.2e+110: tmp = (1.0 + math.exp((x * eps))) / 2.0 elif x <= 2.2e+184: tmp = 0.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-21) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) + Float64(exp(Float64(x * Float64(-1.0 - eps))) * Float64(Float64(-1.0 / eps) - -1.0))) / 2.0); elseif (x <= 9.2e+110) tmp = Float64(Float64(1.0 + exp(Float64(x * eps))) / 2.0); elseif (x <= 2.2e+184) tmp = 0.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-21) tmp = ((1.0 + (1.0 / eps)) + (exp((x * (-1.0 - eps))) * ((-1.0 / eps) - -1.0))) / 2.0; elseif (x <= 9.2e+110) tmp = (1.0 + exp((x * eps))) / 2.0; elseif (x <= 2.2e+184) tmp = 0.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-21], N[(N[(N[(1.0 + N[(1.0 / eps), $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], If[LessEqual[x, 9.2e+110], N[(N[(1.0 + N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.2e+184], 0.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}
\mathbf{if}\;x \leq -5.2 \cdot 10^{-21}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + e^{x \cdot \left(-1 - \varepsilon\right)} \cdot \left(\frac{-1}{\varepsilon} - -1\right)}{2}\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{+110}:\\
\;\;\;\;\frac{1 + e^{x \cdot \varepsilon}}{2}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+184}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + \varepsilon\right)}}{2}\\
\end{array}
\end{array}
if x < -5.20000000000000035e-21Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 53.9%
if -5.20000000000000035e-21 < x < 9.2000000000000001e110Initial program 64.6%
Simplified64.6%
Taylor expanded in x around 0 42.9%
Taylor expanded in eps around inf 77.8%
*-commutative77.8%
sub-neg77.8%
neg-mul-177.8%
*-commutative77.8%
associate-*r*77.8%
neg-mul-177.8%
sub-neg77.8%
*-lft-identity77.8%
*-commutative77.8%
*-lft-identity77.8%
associate-*r*77.8%
neg-mul-177.8%
neg-sub077.8%
associate--r-77.8%
metadata-eval77.8%
+-commutative77.8%
Simplified77.8%
Taylor expanded in eps around inf 78.1%
*-commutative78.1%
Simplified78.1%
if 9.2000000000000001e110 < x < 2.2e184Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 82.6%
associate-/l/82.6%
distribute-rgt1-in82.6%
metadata-eval82.6%
mul0-lft82.6%
associate-/r*82.6%
metadata-eval82.6%
metadata-eval82.6%
distribute-neg-frac82.6%
Applied egg-rr82.6%
Taylor expanded in eps around 0 82.6%
if 2.2e184 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 37.4%
Taylor expanded in eps around inf 37.7%
*-commutative37.7%
sub-neg37.7%
neg-mul-137.7%
*-commutative37.7%
associate-*r*37.7%
neg-mul-137.7%
sub-neg37.7%
*-lft-identity37.7%
*-commutative37.7%
*-lft-identity37.7%
associate-*r*37.7%
neg-mul-137.7%
neg-sub037.7%
associate--r-37.7%
metadata-eval37.7%
+-commutative37.7%
Simplified37.7%
Final simplification69.5%
(FPCore (x eps)
:precision binary64
(if (<= x -1.05e-19)
(pow (* eps 0.0) -1.0)
(if (<= x 1.45e+116)
(/ (+ 1.0 (exp (* x eps))) 2.0)
(if (<= x 2.1e+184) 0.0 (/ (+ 1.0 (exp (* x (+ -1.0 eps)))) 2.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -1.05e-19) {
tmp = pow((eps * 0.0), -1.0);
} else if (x <= 1.45e+116) {
tmp = (1.0 + exp((x * eps))) / 2.0;
} else if (x <= 2.1e+184) {
tmp = 0.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 <= (-1.05d-19)) then
tmp = (eps * 0.0d0) ** (-1.0d0)
else if (x <= 1.45d+116) then
tmp = (1.0d0 + exp((x * eps))) / 2.0d0
else if (x <= 2.1d+184) then
tmp = 0.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 <= -1.05e-19) {
tmp = Math.pow((eps * 0.0), -1.0);
} else if (x <= 1.45e+116) {
tmp = (1.0 + Math.exp((x * eps))) / 2.0;
} else if (x <= 2.1e+184) {
tmp = 0.0;
} else {
tmp = (1.0 + Math.exp((x * (-1.0 + eps)))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -1.05e-19: tmp = math.pow((eps * 0.0), -1.0) elif x <= 1.45e+116: tmp = (1.0 + math.exp((x * eps))) / 2.0 elif x <= 2.1e+184: tmp = 0.0 else: tmp = (1.0 + math.exp((x * (-1.0 + eps)))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -1.05e-19) tmp = Float64(eps * 0.0) ^ -1.0; elseif (x <= 1.45e+116) tmp = Float64(Float64(1.0 + exp(Float64(x * eps))) / 2.0); elseif (x <= 2.1e+184) tmp = 0.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 <= -1.05e-19) tmp = (eps * 0.0) ^ -1.0; elseif (x <= 1.45e+116) tmp = (1.0 + exp((x * eps))) / 2.0; elseif (x <= 2.1e+184) tmp = 0.0; else tmp = (1.0 + exp((x * (-1.0 + eps)))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -1.05e-19], N[Power[N[(eps * 0.0), $MachinePrecision], -1.0], $MachinePrecision], If[LessEqual[x, 1.45e+116], N[(N[(1.0 + N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.1e+184], 0.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}
\mathbf{if}\;x \leq -1.05 \cdot 10^{-19}:\\
\;\;\;\;{\left(\varepsilon \cdot 0\right)}^{-1}\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+116}:\\
\;\;\;\;\frac{1 + e^{x \cdot \varepsilon}}{2}\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{+184}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + \varepsilon\right)}}{2}\\
\end{array}
\end{array}
if x < -1.0499999999999999e-19Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 0.1%
Applied egg-rr52.2%
if -1.0499999999999999e-19 < x < 1.4500000000000001e116Initial program 64.8%
Simplified64.8%
Taylor expanded in x around 0 43.1%
Taylor expanded in eps around inf 77.7%
*-commutative77.7%
sub-neg77.7%
neg-mul-177.7%
*-commutative77.7%
associate-*r*77.7%
neg-mul-177.7%
sub-neg77.7%
*-lft-identity77.7%
*-commutative77.7%
*-lft-identity77.7%
associate-*r*77.7%
neg-mul-177.7%
neg-sub077.7%
associate--r-77.7%
metadata-eval77.7%
+-commutative77.7%
Simplified77.7%
Taylor expanded in eps around inf 78.0%
*-commutative78.0%
Simplified78.0%
if 1.4500000000000001e116 < x < 2.1e184Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 82.6%
associate-/l/82.6%
distribute-rgt1-in82.6%
metadata-eval82.6%
mul0-lft82.6%
associate-/r*82.6%
metadata-eval82.6%
metadata-eval82.6%
distribute-neg-frac82.6%
Applied egg-rr82.6%
Taylor expanded in eps around 0 82.6%
if 2.1e184 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 37.4%
Taylor expanded in eps around inf 37.7%
*-commutative37.7%
sub-neg37.7%
neg-mul-137.7%
*-commutative37.7%
associate-*r*37.7%
neg-mul-137.7%
sub-neg37.7%
*-lft-identity37.7%
*-commutative37.7%
*-lft-identity37.7%
associate-*r*37.7%
neg-mul-137.7%
neg-sub037.7%
associate--r-37.7%
metadata-eval37.7%
+-commutative37.7%
Simplified37.7%
Final simplification69.3%
(FPCore (x eps)
:precision binary64
(if (<= x -2.1e-19)
(pow (* eps 0.0) -1.0)
(if (or (<= x 1.35e+111) (not (<= x 2.3e+184)))
(/ (+ 1.0 (exp (* x eps))) 2.0)
0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -2.1e-19) {
tmp = pow((eps * 0.0), -1.0);
} else if ((x <= 1.35e+111) || !(x <= 2.3e+184)) {
tmp = (1.0 + 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 <= (-2.1d-19)) then
tmp = (eps * 0.0d0) ** (-1.0d0)
else if ((x <= 1.35d+111) .or. (.not. (x <= 2.3d+184))) then
tmp = (1.0d0 + 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 <= -2.1e-19) {
tmp = Math.pow((eps * 0.0), -1.0);
} else if ((x <= 1.35e+111) || !(x <= 2.3e+184)) {
tmp = (1.0 + Math.exp((x * eps))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -2.1e-19: tmp = math.pow((eps * 0.0), -1.0) elif (x <= 1.35e+111) or not (x <= 2.3e+184): tmp = (1.0 + math.exp((x * eps))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -2.1e-19) tmp = Float64(eps * 0.0) ^ -1.0; elseif ((x <= 1.35e+111) || !(x <= 2.3e+184)) tmp = Float64(Float64(1.0 + exp(Float64(x * eps))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -2.1e-19) tmp = (eps * 0.0) ^ -1.0; elseif ((x <= 1.35e+111) || ~((x <= 2.3e+184))) tmp = (1.0 + exp((x * eps))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -2.1e-19], N[Power[N[(eps * 0.0), $MachinePrecision], -1.0], $MachinePrecision], If[Or[LessEqual[x, 1.35e+111], N[Not[LessEqual[x, 2.3e+184]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-19}:\\
\;\;\;\;{\left(\varepsilon \cdot 0\right)}^{-1}\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{+111} \lor \neg \left(x \leq 2.3 \cdot 10^{+184}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.0999999999999999e-19Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 0.1%
Applied egg-rr52.2%
if -2.0999999999999999e-19 < x < 1.3499999999999999e111 or 2.3e184 < x Initial program 69.9%
Simplified69.9%
Taylor expanded in x around 0 42.3%
Taylor expanded in eps around inf 71.9%
*-commutative71.9%
sub-neg71.9%
neg-mul-171.9%
*-commutative71.9%
associate-*r*71.9%
neg-mul-171.9%
sub-neg71.9%
*-lft-identity71.9%
*-commutative71.9%
*-lft-identity71.9%
associate-*r*71.9%
neg-mul-171.9%
neg-sub071.9%
associate--r-71.9%
metadata-eval71.9%
+-commutative71.9%
Simplified71.9%
Taylor expanded in eps around inf 72.1%
*-commutative72.1%
Simplified72.1%
if 1.3499999999999999e111 < x < 2.3e184Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 82.6%
associate-/l/82.6%
distribute-rgt1-in82.6%
metadata-eval82.6%
mul0-lft82.6%
associate-/r*82.6%
metadata-eval82.6%
metadata-eval82.6%
distribute-neg-frac82.6%
Applied egg-rr82.6%
Taylor expanded in eps around 0 82.6%
Final simplification69.2%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (pow (* eps 0.0) -1.0)))
(if (<= x -5e-18)
t_0
(if (<= x 14500000.0) 1.0 (if (<= x 2.2e+184) 0.0 t_0)))))
double code(double x, double eps) {
double t_0 = pow((eps * 0.0), -1.0);
double tmp;
if (x <= -5e-18) {
tmp = t_0;
} else if (x <= 14500000.0) {
tmp = 1.0;
} else if (x <= 2.2e+184) {
tmp = 0.0;
} else {
tmp = t_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 = (eps * 0.0d0) ** (-1.0d0)
if (x <= (-5d-18)) then
tmp = t_0
else if (x <= 14500000.0d0) then
tmp = 1.0d0
else if (x <= 2.2d+184) then
tmp = 0.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.pow((eps * 0.0), -1.0);
double tmp;
if (x <= -5e-18) {
tmp = t_0;
} else if (x <= 14500000.0) {
tmp = 1.0;
} else if (x <= 2.2e+184) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, eps): t_0 = math.pow((eps * 0.0), -1.0) tmp = 0 if x <= -5e-18: tmp = t_0 elif x <= 14500000.0: tmp = 1.0 elif x <= 2.2e+184: tmp = 0.0 else: tmp = t_0 return tmp
function code(x, eps) t_0 = Float64(eps * 0.0) ^ -1.0 tmp = 0.0 if (x <= -5e-18) tmp = t_0; elseif (x <= 14500000.0) tmp = 1.0; elseif (x <= 2.2e+184) tmp = 0.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, eps) t_0 = (eps * 0.0) ^ -1.0; tmp = 0.0; if (x <= -5e-18) tmp = t_0; elseif (x <= 14500000.0) tmp = 1.0; elseif (x <= 2.2e+184) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Power[N[(eps * 0.0), $MachinePrecision], -1.0], $MachinePrecision]}, If[LessEqual[x, -5e-18], t$95$0, If[LessEqual[x, 14500000.0], 1.0, If[LessEqual[x, 2.2e+184], 0.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\varepsilon \cdot 0\right)}^{-1}\\
\mathbf{if}\;x \leq -5 \cdot 10^{-18}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 14500000:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+184}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -5.00000000000000036e-18 or 2.2e184 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 13.9%
Applied egg-rr46.2%
if -5.00000000000000036e-18 < x < 1.45e7Initial program 59.3%
Simplified59.3%
Taylor expanded in x around 0 75.2%
if 1.45e7 < x < 2.2e184Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 64.7%
associate-/l/64.7%
distribute-rgt1-in64.7%
metadata-eval64.7%
mul0-lft64.7%
associate-/r*64.7%
metadata-eval64.7%
metadata-eval64.7%
distribute-neg-frac64.7%
Applied egg-rr64.7%
Taylor expanded in eps around 0 64.7%
Final simplification65.2%
(FPCore (x eps) :precision binary64 (if (<= x 230.0) (/ (- 2.0 (* x eps)) 2.0) (if (<= x 3.4e+184) 0.0 (/ (/ (- (* eps (+ 2.0 (* x eps))) x) eps) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= 230.0) {
tmp = (2.0 - (x * eps)) / 2.0;
} else if (x <= 3.4e+184) {
tmp = 0.0;
} else {
tmp = (((eps * (2.0 + (x * eps))) - 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 <= 230.0d0) then
tmp = (2.0d0 - (x * eps)) / 2.0d0
else if (x <= 3.4d+184) then
tmp = 0.0d0
else
tmp = (((eps * (2.0d0 + (x * eps))) - x) / eps) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 230.0) {
tmp = (2.0 - (x * eps)) / 2.0;
} else if (x <= 3.4e+184) {
tmp = 0.0;
} else {
tmp = (((eps * (2.0 + (x * eps))) - x) / eps) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 230.0: tmp = (2.0 - (x * eps)) / 2.0 elif x <= 3.4e+184: tmp = 0.0 else: tmp = (((eps * (2.0 + (x * eps))) - x) / eps) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 230.0) tmp = Float64(Float64(2.0 - Float64(x * eps)) / 2.0); elseif (x <= 3.4e+184) tmp = 0.0; else tmp = Float64(Float64(Float64(Float64(eps * Float64(2.0 + Float64(x * eps))) - x) / eps) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 230.0) tmp = (2.0 - (x * eps)) / 2.0; elseif (x <= 3.4e+184) tmp = 0.0; else tmp = (((eps * (2.0 + (x * eps))) - x) / eps) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 230.0], N[(N[(2.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3.4e+184], 0.0, N[(N[(N[(N[(eps * N[(2.0 + N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 230:\\
\;\;\;\;\frac{2 - x \cdot \varepsilon}{2}\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{+184}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\varepsilon \cdot \left(2 + x \cdot \varepsilon\right) - x}{\varepsilon}}{2}\\
\end{array}
\end{array}
if x < 230Initial program 68.9%
Simplified50.3%
Taylor expanded in x around 0 58.3%
Taylor expanded in eps around 0 63.8%
Taylor expanded in eps around 0 63.8%
*-commutative63.8%
neg-mul-163.8%
unsub-neg63.8%
Simplified63.8%
if 230 < x < 3.4000000000000002e184Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 61.6%
associate-/l/61.6%
distribute-rgt1-in61.6%
metadata-eval61.6%
mul0-lft61.6%
associate-/r*61.6%
metadata-eval61.6%
metadata-eval61.6%
distribute-neg-frac61.6%
Applied egg-rr61.6%
Taylor expanded in eps around 0 61.6%
if 3.4000000000000002e184 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 37.4%
Taylor expanded in x around 0 29.7%
*-commutative29.7%
associate-*r*29.7%
mul-1-neg29.7%
distribute-lft-neg-in29.7%
associate-*l*29.7%
mul-1-neg29.7%
distribute-lft-in29.7%
metadata-eval29.7%
associate-*r/29.7%
metadata-eval29.7%
*-commutative29.7%
Simplified29.7%
Taylor expanded in eps around 0 36.3%
Final simplification60.4%
(FPCore (x eps)
:precision binary64
(if (<= x -2.7e-12)
(* x (* eps -0.5))
(if (<= x 14500000.0)
1.0
(if (<= x 8.4e+217) 0.0 (/ (+ 2.0 (* x eps)) 2.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -2.7e-12) {
tmp = x * (eps * -0.5);
} else if (x <= 14500000.0) {
tmp = 1.0;
} else if (x <= 8.4e+217) {
tmp = 0.0;
} else {
tmp = (2.0 + (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.7d-12)) then
tmp = x * (eps * (-0.5d0))
else if (x <= 14500000.0d0) then
tmp = 1.0d0
else if (x <= 8.4d+217) then
tmp = 0.0d0
else
tmp = (2.0d0 + (x * eps)) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -2.7e-12) {
tmp = x * (eps * -0.5);
} else if (x <= 14500000.0) {
tmp = 1.0;
} else if (x <= 8.4e+217) {
tmp = 0.0;
} else {
tmp = (2.0 + (x * eps)) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -2.7e-12: tmp = x * (eps * -0.5) elif x <= 14500000.0: tmp = 1.0 elif x <= 8.4e+217: tmp = 0.0 else: tmp = (2.0 + (x * eps)) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -2.7e-12) tmp = Float64(x * Float64(eps * -0.5)); elseif (x <= 14500000.0) tmp = 1.0; elseif (x <= 8.4e+217) tmp = 0.0; else tmp = Float64(Float64(2.0 + Float64(x * eps)) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -2.7e-12) tmp = x * (eps * -0.5); elseif (x <= 14500000.0) tmp = 1.0; elseif (x <= 8.4e+217) tmp = 0.0; else tmp = (2.0 + (x * eps)) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -2.7e-12], N[(x * N[(eps * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 14500000.0], 1.0, If[LessEqual[x, 8.4e+217], 0.0, N[(N[(2.0 + N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-12}:\\
\;\;\;\;x \cdot \left(\varepsilon \cdot -0.5\right)\\
\mathbf{elif}\;x \leq 14500000:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 8.4 \cdot 10^{+217}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \varepsilon}{2}\\
\end{array}
\end{array}
if x < -2.6999999999999998e-12Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.2%
Taylor expanded in eps around 0 27.8%
Taylor expanded in eps around inf 27.8%
*-commutative27.8%
associate-*r*27.8%
*-commutative27.8%
associate-*l*27.8%
Simplified27.8%
if -2.6999999999999998e-12 < x < 1.45e7Initial program 59.3%
Simplified59.3%
Taylor expanded in x around 0 75.2%
if 1.45e7 < x < 8.4000000000000003e217Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 59.9%
associate-/l/59.9%
distribute-rgt1-in59.9%
metadata-eval59.9%
mul0-lft59.9%
associate-/r*59.9%
metadata-eval59.9%
metadata-eval59.9%
distribute-neg-frac59.9%
Applied egg-rr59.9%
Taylor expanded in eps around 0 59.9%
if 8.4000000000000003e217 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 47.5%
Taylor expanded in x around 0 46.5%
*-commutative46.5%
associate-*r*46.5%
mul-1-neg46.5%
distribute-lft-neg-in46.5%
associate-*l*46.5%
mul-1-neg46.5%
distribute-lft-in46.5%
metadata-eval46.5%
associate-*r/46.5%
metadata-eval46.5%
*-commutative46.5%
Simplified46.5%
Taylor expanded in eps around inf 46.8%
*-commutative46.8%
Simplified46.8%
Final simplification62.0%
(FPCore (x eps) :precision binary64 (if (<= x 220.0) (/ (- 2.0 (* x eps)) 2.0) (if (<= x 4.6e+217) 0.0 (/ (+ 2.0 (* x eps)) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= 220.0) {
tmp = (2.0 - (x * eps)) / 2.0;
} else if (x <= 4.6e+217) {
tmp = 0.0;
} else {
tmp = (2.0 + (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 <= 220.0d0) then
tmp = (2.0d0 - (x * eps)) / 2.0d0
else if (x <= 4.6d+217) then
tmp = 0.0d0
else
tmp = (2.0d0 + (x * eps)) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 220.0) {
tmp = (2.0 - (x * eps)) / 2.0;
} else if (x <= 4.6e+217) {
tmp = 0.0;
} else {
tmp = (2.0 + (x * eps)) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 220.0: tmp = (2.0 - (x * eps)) / 2.0 elif x <= 4.6e+217: tmp = 0.0 else: tmp = (2.0 + (x * eps)) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 220.0) tmp = Float64(Float64(2.0 - Float64(x * eps)) / 2.0); elseif (x <= 4.6e+217) tmp = 0.0; else tmp = Float64(Float64(2.0 + Float64(x * eps)) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 220.0) tmp = (2.0 - (x * eps)) / 2.0; elseif (x <= 4.6e+217) tmp = 0.0; else tmp = (2.0 + (x * eps)) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 220.0], N[(N[(2.0 - N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.6e+217], 0.0, N[(N[(2.0 + N[(x * eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 220:\\
\;\;\;\;\frac{2 - x \cdot \varepsilon}{2}\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+217}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \varepsilon}{2}\\
\end{array}
\end{array}
if x < 220Initial program 68.9%
Simplified50.3%
Taylor expanded in x around 0 58.3%
Taylor expanded in eps around 0 63.8%
Taylor expanded in eps around 0 63.8%
*-commutative63.8%
neg-mul-163.8%
unsub-neg63.8%
Simplified63.8%
if 220 < x < 4.5999999999999998e217Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 57.8%
associate-/l/57.8%
distribute-rgt1-in57.8%
metadata-eval57.8%
mul0-lft57.8%
associate-/r*57.8%
metadata-eval57.8%
metadata-eval57.8%
distribute-neg-frac57.8%
Applied egg-rr57.8%
Taylor expanded in eps around 0 57.8%
if 4.5999999999999998e217 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 47.5%
Taylor expanded in x around 0 46.5%
*-commutative46.5%
associate-*r*46.5%
mul-1-neg46.5%
distribute-lft-neg-in46.5%
associate-*l*46.5%
mul-1-neg46.5%
distribute-lft-in46.5%
metadata-eval46.5%
associate-*r/46.5%
metadata-eval46.5%
*-commutative46.5%
Simplified46.5%
Taylor expanded in eps around inf 46.8%
*-commutative46.8%
Simplified46.8%
(FPCore (x eps) :precision binary64 (if (<= x -2.7e-12) (* x (* eps -0.5)) (if (<= x 14500000.0) 1.0 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -2.7e-12) {
tmp = x * (eps * -0.5);
} else if (x <= 14500000.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 <= (-2.7d-12)) then
tmp = x * (eps * (-0.5d0))
else if (x <= 14500000.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 <= -2.7e-12) {
tmp = x * (eps * -0.5);
} else if (x <= 14500000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -2.7e-12: tmp = x * (eps * -0.5) elif x <= 14500000.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -2.7e-12) tmp = Float64(x * Float64(eps * -0.5)); elseif (x <= 14500000.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -2.7e-12) tmp = x * (eps * -0.5); elseif (x <= 14500000.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -2.7e-12], N[(x * N[(eps * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 14500000.0], 1.0, 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-12}:\\
\;\;\;\;x \cdot \left(\varepsilon \cdot -0.5\right)\\
\mathbf{elif}\;x \leq 14500000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -2.6999999999999998e-12Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.2%
Taylor expanded in eps around 0 27.8%
Taylor expanded in eps around inf 27.8%
*-commutative27.8%
associate-*r*27.8%
*-commutative27.8%
associate-*l*27.8%
Simplified27.8%
if -2.6999999999999998e-12 < x < 1.45e7Initial program 59.3%
Simplified59.3%
Taylor expanded in x around 0 75.2%
if 1.45e7 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.0%
associate-/l/53.0%
distribute-rgt1-in53.0%
metadata-eval53.0%
mul0-lft53.0%
associate-/r*53.0%
metadata-eval53.0%
metadata-eval53.0%
distribute-neg-frac53.0%
Applied egg-rr53.0%
Taylor expanded in eps around 0 53.0%
Final simplification60.9%
(FPCore (x eps) :precision binary64 (if (<= x 14500000.0) 1.0 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 14500000.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 <= 14500000.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 <= 14500000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 14500000.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 14500000.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 14500000.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 14500000.0], 1.0, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 14500000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.45e7Initial program 69.2%
Simplified69.2%
Taylor expanded in x around 0 57.7%
if 1.45e7 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 53.0%
associate-/l/53.0%
distribute-rgt1-in53.0%
metadata-eval53.0%
mul0-lft53.0%
associate-/r*53.0%
metadata-eval53.0%
metadata-eval53.0%
distribute-neg-frac53.0%
Applied egg-rr53.0%
Taylor expanded in eps around 0 53.0%
Final simplification56.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 77.3%
Simplified63.7%
Taylor expanded in eps around 0 15.4%
associate-/l/15.4%
distribute-rgt1-in15.4%
metadata-eval15.4%
mul0-lft15.7%
associate-/r*15.7%
metadata-eval15.7%
metadata-eval15.7%
distribute-neg-frac15.7%
Applied egg-rr15.7%
Taylor expanded in eps around 0 15.7%
herbie shell --seed 2024118
(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))