
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
(FPCore (x eps) :precision binary64 (/ (+ (exp (* x (+ eps -1.0))) (/ 1.0 (exp (+ x (* x eps))))) 2.0))
double code(double x, double eps) {
return (exp((x * (eps + -1.0))) + (1.0 / exp((x + (x * eps))))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (exp((x * (eps + (-1.0d0)))) + (1.0d0 / exp((x + (x * eps))))) / 2.0d0
end function
public static double code(double x, double eps) {
return (Math.exp((x * (eps + -1.0))) + (1.0 / Math.exp((x + (x * eps))))) / 2.0;
}
def code(x, eps): return (math.exp((x * (eps + -1.0))) + (1.0 / math.exp((x + (x * eps))))) / 2.0
function code(x, eps) return Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + Float64(1.0 / exp(Float64(x + Float64(x * eps))))) / 2.0) end
function tmp = code(x, eps) tmp = (exp((x * (eps + -1.0))) + (1.0 / exp((x + (x * eps))))) / 2.0; end
code[x_, eps_] := N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Exp[N[(x + N[(x * eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{x \cdot \left(\varepsilon + -1\right)} + \frac{1}{e^{x + x \cdot \varepsilon}}}{2}
\end{array}
Initial program 77.7%
Simplified65.0%
pow-neg65.0%
associate-*l/65.0%
*-un-lft-identity65.0%
add-sqr-sqrt35.8%
sqrt-unprod59.1%
frac-times59.2%
metadata-eval59.2%
metadata-eval59.2%
frac-times59.1%
sqrt-unprod28.9%
add-sqr-sqrt63.3%
add-sqr-sqrt40.3%
sqrt-unprod61.3%
sqr-neg61.3%
sqrt-unprod12.4%
add-sqr-sqrt24.7%
pow-exp36.3%
*-commutative36.3%
+-commutative36.3%
distribute-rgt-in36.3%
Applied egg-rr75.7%
Taylor expanded in eps around inf 100.0%
Final simplification100.0%
(FPCore (x eps) :precision binary64 (if (<= eps 3.7e-264) 0.0 (/ (+ (exp (* x (+ eps -1.0))) (exp (* eps (- x)))) 2.0)))
double code(double x, double eps) {
double tmp;
if (eps <= 3.7e-264) {
tmp = 0.0;
} else {
tmp = (exp((x * (eps + -1.0))) + exp((eps * -x))) / 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 <= 3.7d-264) then
tmp = 0.0d0
else
tmp = (exp((x * (eps + (-1.0d0)))) + exp((eps * -x))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= 3.7e-264) {
tmp = 0.0;
} else {
tmp = (Math.exp((x * (eps + -1.0))) + Math.exp((eps * -x))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= 3.7e-264: tmp = 0.0 else: tmp = (math.exp((x * (eps + -1.0))) + math.exp((eps * -x))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (eps <= 3.7e-264) tmp = 0.0; else tmp = Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(eps * Float64(-x)))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 3.7e-264) tmp = 0.0; else tmp = (exp((x * (eps + -1.0))) + exp((eps * -x))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, 3.7e-264], 0.0, N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(eps * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 3.7 \cdot 10^{-264}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{\varepsilon \cdot \left(-x\right)}}{2}\\
\end{array}
\end{array}
if eps < 3.69999999999999996e-264Initial program 78.2%
Simplified67.3%
Taylor expanded in eps around 0 17.8%
Taylor expanded in x around 0 18.1%
if 3.69999999999999996e-264 < eps Initial program 77.1%
Simplified62.1%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 97.5%
*-commutative97.5%
neg-mul-197.5%
distribute-rgt-neg-in97.5%
Simplified97.5%
Final simplification53.4%
(FPCore (x eps) :precision binary64 (if (<= x 1.65e+205) (/ (+ (exp (* eps (- x))) (exp (* x eps))) 2.0) 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 1.65e+205) {
tmp = (exp((eps * -x)) + 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 <= 1.65d+205) then
tmp = (exp((eps * -x)) + 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 <= 1.65e+205) {
tmp = (Math.exp((eps * -x)) + Math.exp((x * eps))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.65e+205: tmp = (math.exp((eps * -x)) + math.exp((x * eps))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 1.65e+205) tmp = Float64(Float64(exp(Float64(eps * Float64(-x))) + 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 <= 1.65e+205) tmp = (exp((eps * -x)) + exp((x * eps))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 1.65e+205], N[(N[(N[Exp[N[(eps * (-x)), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.65 \cdot 10^{+205}:\\
\;\;\;\;\frac{e^{\varepsilon \cdot \left(-x\right)} + e^{x \cdot \varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.6500000000000001e205Initial program 75.8%
Simplified62.1%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 93.4%
*-commutative93.4%
neg-mul-193.4%
distribute-rgt-neg-in93.4%
Simplified93.4%
Taylor expanded in eps around inf 91.7%
*-commutative91.7%
Simplified91.7%
if 1.6500000000000001e205 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 70.5%
Taylor expanded in x around 0 70.5%
Final simplification90.1%
(FPCore (x eps) :precision binary64 (/ (+ (exp (* x (+ eps -1.0))) (exp (* x (- -1.0 eps)))) 2.0))
double code(double x, double eps) {
return (exp((x * (eps + -1.0))) + exp((x * (-1.0 - eps)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (exp((x * (eps + (-1.0d0)))) + exp((x * ((-1.0d0) - eps)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (Math.exp((x * (eps + -1.0))) + Math.exp((x * (-1.0 - eps)))) / 2.0;
}
def code(x, eps): return (math.exp((x * (eps + -1.0))) + math.exp((x * (-1.0 - eps)))) / 2.0
function code(x, eps) return Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0) end
function tmp = code(x, eps) tmp = (exp((x * (eps + -1.0))) + exp((x * (-1.0 - eps)))) / 2.0; end
code[x_, eps_] := N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}
\end{array}
Initial program 77.7%
Simplified65.0%
Taylor expanded in eps around inf 100.0%
Final simplification100.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* x (+ eps -1.0))))
(if (<= x -4.7e+95)
(pow 0.0 -1.0)
(if (<= x -5.8e-245)
(/ (+ (/ 1.0 (exp (+ x (* x eps)))) (+ 1.0 t_0)) 2.0)
(if (<= x 6.2e+54)
(/ (+ (exp t_0) (+ 1.0 (* x (- -1.0 eps)))) 2.0)
(if (<= x 1.25e+114) 0.0 (if (<= x 1.5e+205) (pow 0.0 -1.0) 0.0)))))))
double code(double x, double eps) {
double t_0 = x * (eps + -1.0);
double tmp;
if (x <= -4.7e+95) {
tmp = pow(0.0, -1.0);
} else if (x <= -5.8e-245) {
tmp = ((1.0 / exp((x + (x * eps)))) + (1.0 + t_0)) / 2.0;
} else if (x <= 6.2e+54) {
tmp = (exp(t_0) + (1.0 + (x * (-1.0 - eps)))) / 2.0;
} else if (x <= 1.25e+114) {
tmp = 0.0;
} else if (x <= 1.5e+205) {
tmp = pow(0.0, -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) :: t_0
real(8) :: tmp
t_0 = x * (eps + (-1.0d0))
if (x <= (-4.7d+95)) then
tmp = 0.0d0 ** (-1.0d0)
else if (x <= (-5.8d-245)) then
tmp = ((1.0d0 / exp((x + (x * eps)))) + (1.0d0 + t_0)) / 2.0d0
else if (x <= 6.2d+54) then
tmp = (exp(t_0) + (1.0d0 + (x * ((-1.0d0) - eps)))) / 2.0d0
else if (x <= 1.25d+114) then
tmp = 0.0d0
else if (x <= 1.5d+205) then
tmp = 0.0d0 ** (-1.0d0)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = x * (eps + -1.0);
double tmp;
if (x <= -4.7e+95) {
tmp = Math.pow(0.0, -1.0);
} else if (x <= -5.8e-245) {
tmp = ((1.0 / Math.exp((x + (x * eps)))) + (1.0 + t_0)) / 2.0;
} else if (x <= 6.2e+54) {
tmp = (Math.exp(t_0) + (1.0 + (x * (-1.0 - eps)))) / 2.0;
} else if (x <= 1.25e+114) {
tmp = 0.0;
} else if (x <= 1.5e+205) {
tmp = Math.pow(0.0, -1.0);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): t_0 = x * (eps + -1.0) tmp = 0 if x <= -4.7e+95: tmp = math.pow(0.0, -1.0) elif x <= -5.8e-245: tmp = ((1.0 / math.exp((x + (x * eps)))) + (1.0 + t_0)) / 2.0 elif x <= 6.2e+54: tmp = (math.exp(t_0) + (1.0 + (x * (-1.0 - eps)))) / 2.0 elif x <= 1.25e+114: tmp = 0.0 elif x <= 1.5e+205: tmp = math.pow(0.0, -1.0) else: tmp = 0.0 return tmp
function code(x, eps) t_0 = Float64(x * Float64(eps + -1.0)) tmp = 0.0 if (x <= -4.7e+95) tmp = 0.0 ^ -1.0; elseif (x <= -5.8e-245) tmp = Float64(Float64(Float64(1.0 / exp(Float64(x + Float64(x * eps)))) + Float64(1.0 + t_0)) / 2.0); elseif (x <= 6.2e+54) tmp = Float64(Float64(exp(t_0) + Float64(1.0 + Float64(x * Float64(-1.0 - eps)))) / 2.0); elseif (x <= 1.25e+114) tmp = 0.0; elseif (x <= 1.5e+205) tmp = 0.0 ^ -1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) t_0 = x * (eps + -1.0); tmp = 0.0; if (x <= -4.7e+95) tmp = 0.0 ^ -1.0; elseif (x <= -5.8e-245) tmp = ((1.0 / exp((x + (x * eps)))) + (1.0 + t_0)) / 2.0; elseif (x <= 6.2e+54) tmp = (exp(t_0) + (1.0 + (x * (-1.0 - eps)))) / 2.0; elseif (x <= 1.25e+114) tmp = 0.0; elseif (x <= 1.5e+205) tmp = 0.0 ^ -1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.7e+95], N[Power[0.0, -1.0], $MachinePrecision], If[LessEqual[x, -5.8e-245], N[(N[(N[(1.0 / N[Exp[N[(x + N[(x * eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 6.2e+54], N[(N[(N[Exp[t$95$0], $MachinePrecision] + N[(1.0 + N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.25e+114], 0.0, If[LessEqual[x, 1.5e+205], N[Power[0.0, -1.0], $MachinePrecision], 0.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(\varepsilon + -1\right)\\
\mathbf{if}\;x \leq -4.7 \cdot 10^{+95}:\\
\;\;\;\;{0}^{-1}\\
\mathbf{elif}\;x \leq -5.8 \cdot 10^{-245}:\\
\;\;\;\;\frac{\frac{1}{e^{x + x \cdot \varepsilon}} + \left(1 + t\_0\right)}{2}\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{+54}:\\
\;\;\;\;\frac{e^{t\_0} + \left(1 + x \cdot \left(-1 - \varepsilon\right)\right)}{2}\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{+114}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.5 \cdot 10^{+205}:\\
\;\;\;\;{0}^{-1}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -4.69999999999999972e95 or 1.25e114 < x < 1.5e205Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 10.7%
Applied egg-rr45.9%
Taylor expanded in eps around 0 90.0%
if -4.69999999999999972e95 < x < -5.7999999999999999e-245Initial program 63.1%
Simplified43.3%
pow-neg43.3%
associate-*l/43.3%
*-un-lft-identity43.3%
add-sqr-sqrt25.2%
sqrt-unprod42.4%
frac-times42.5%
metadata-eval42.5%
metadata-eval42.5%
frac-times42.4%
sqrt-unprod17.5%
add-sqr-sqrt42.0%
add-sqr-sqrt0.0%
sqrt-unprod39.4%
sqr-neg39.4%
sqrt-unprod26.4%
add-sqr-sqrt26.4%
pow-exp43.3%
*-commutative43.3%
+-commutative43.3%
distribute-rgt-in43.3%
Applied egg-rr61.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 77.7%
if -5.7999999999999999e-245 < x < 6.1999999999999999e54Initial program 67.4%
Simplified48.2%
pow-neg48.2%
associate-*l/48.2%
*-un-lft-identity48.2%
add-sqr-sqrt27.8%
sqrt-unprod46.8%
frac-times46.9%
metadata-eval46.9%
metadata-eval46.9%
frac-times46.8%
sqrt-unprod20.2%
add-sqr-sqrt44.7%
add-sqr-sqrt44.3%
sqrt-unprod58.4%
sqr-neg58.4%
sqrt-unprod0.9%
add-sqr-sqrt19.8%
pow-exp38.1%
*-commutative38.1%
+-commutative38.1%
distribute-rgt-in38.1%
Applied egg-rr63.9%
Taylor expanded in eps around inf 99.9%
Taylor expanded in x around 0 74.0%
Simplified74.0%
if 6.1999999999999999e54 < x < 1.25e114 or 1.5e205 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 77.0%
Taylor expanded in x around 0 77.0%
Final simplification79.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* x (+ eps -1.0))))
(if (<= x -4.7e+95)
(pow 0.0 -1.0)
(if (<= x -5.8e-245)
(/ (+ (exp (* eps (- x))) (+ 1.0 t_0)) 2.0)
(if (<= x 2.5e+55)
(/ (+ (exp t_0) (+ 1.0 (* x (- -1.0 eps)))) 2.0)
(if (<= x 1.2e+114) 0.0 (if (<= x 5e+199) (pow 0.0 -1.0) 0.0)))))))
double code(double x, double eps) {
double t_0 = x * (eps + -1.0);
double tmp;
if (x <= -4.7e+95) {
tmp = pow(0.0, -1.0);
} else if (x <= -5.8e-245) {
tmp = (exp((eps * -x)) + (1.0 + t_0)) / 2.0;
} else if (x <= 2.5e+55) {
tmp = (exp(t_0) + (1.0 + (x * (-1.0 - eps)))) / 2.0;
} else if (x <= 1.2e+114) {
tmp = 0.0;
} else if (x <= 5e+199) {
tmp = pow(0.0, -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) :: t_0
real(8) :: tmp
t_0 = x * (eps + (-1.0d0))
if (x <= (-4.7d+95)) then
tmp = 0.0d0 ** (-1.0d0)
else if (x <= (-5.8d-245)) then
tmp = (exp((eps * -x)) + (1.0d0 + t_0)) / 2.0d0
else if (x <= 2.5d+55) then
tmp = (exp(t_0) + (1.0d0 + (x * ((-1.0d0) - eps)))) / 2.0d0
else if (x <= 1.2d+114) then
tmp = 0.0d0
else if (x <= 5d+199) then
tmp = 0.0d0 ** (-1.0d0)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = x * (eps + -1.0);
double tmp;
if (x <= -4.7e+95) {
tmp = Math.pow(0.0, -1.0);
} else if (x <= -5.8e-245) {
tmp = (Math.exp((eps * -x)) + (1.0 + t_0)) / 2.0;
} else if (x <= 2.5e+55) {
tmp = (Math.exp(t_0) + (1.0 + (x * (-1.0 - eps)))) / 2.0;
} else if (x <= 1.2e+114) {
tmp = 0.0;
} else if (x <= 5e+199) {
tmp = Math.pow(0.0, -1.0);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): t_0 = x * (eps + -1.0) tmp = 0 if x <= -4.7e+95: tmp = math.pow(0.0, -1.0) elif x <= -5.8e-245: tmp = (math.exp((eps * -x)) + (1.0 + t_0)) / 2.0 elif x <= 2.5e+55: tmp = (math.exp(t_0) + (1.0 + (x * (-1.0 - eps)))) / 2.0 elif x <= 1.2e+114: tmp = 0.0 elif x <= 5e+199: tmp = math.pow(0.0, -1.0) else: tmp = 0.0 return tmp
function code(x, eps) t_0 = Float64(x * Float64(eps + -1.0)) tmp = 0.0 if (x <= -4.7e+95) tmp = 0.0 ^ -1.0; elseif (x <= -5.8e-245) tmp = Float64(Float64(exp(Float64(eps * Float64(-x))) + Float64(1.0 + t_0)) / 2.0); elseif (x <= 2.5e+55) tmp = Float64(Float64(exp(t_0) + Float64(1.0 + Float64(x * Float64(-1.0 - eps)))) / 2.0); elseif (x <= 1.2e+114) tmp = 0.0; elseif (x <= 5e+199) tmp = 0.0 ^ -1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) t_0 = x * (eps + -1.0); tmp = 0.0; if (x <= -4.7e+95) tmp = 0.0 ^ -1.0; elseif (x <= -5.8e-245) tmp = (exp((eps * -x)) + (1.0 + t_0)) / 2.0; elseif (x <= 2.5e+55) tmp = (exp(t_0) + (1.0 + (x * (-1.0 - eps)))) / 2.0; elseif (x <= 1.2e+114) tmp = 0.0; elseif (x <= 5e+199) tmp = 0.0 ^ -1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -4.7e+95], N[Power[0.0, -1.0], $MachinePrecision], If[LessEqual[x, -5.8e-245], N[(N[(N[Exp[N[(eps * (-x)), $MachinePrecision]], $MachinePrecision] + N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.5e+55], N[(N[(N[Exp[t$95$0], $MachinePrecision] + N[(1.0 + N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.2e+114], 0.0, If[LessEqual[x, 5e+199], N[Power[0.0, -1.0], $MachinePrecision], 0.0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(\varepsilon + -1\right)\\
\mathbf{if}\;x \leq -4.7 \cdot 10^{+95}:\\
\;\;\;\;{0}^{-1}\\
\mathbf{elif}\;x \leq -5.8 \cdot 10^{-245}:\\
\;\;\;\;\frac{e^{\varepsilon \cdot \left(-x\right)} + \left(1 + t\_0\right)}{2}\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+55}:\\
\;\;\;\;\frac{e^{t\_0} + \left(1 + x \cdot \left(-1 - \varepsilon\right)\right)}{2}\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+114}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+199}:\\
\;\;\;\;{0}^{-1}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -4.69999999999999972e95 or 1.2e114 < x < 4.9999999999999998e199Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 10.7%
Applied egg-rr45.9%
Taylor expanded in eps around 0 90.0%
if -4.69999999999999972e95 < x < -5.7999999999999999e-245Initial program 63.1%
Simplified43.3%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
neg-mul-1100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 77.7%
if -5.7999999999999999e-245 < x < 2.50000000000000023e55Initial program 67.4%
Simplified48.2%
pow-neg48.2%
associate-*l/48.2%
*-un-lft-identity48.2%
add-sqr-sqrt27.8%
sqrt-unprod46.8%
frac-times46.9%
metadata-eval46.9%
metadata-eval46.9%
frac-times46.8%
sqrt-unprod20.2%
add-sqr-sqrt44.7%
add-sqr-sqrt44.3%
sqrt-unprod58.4%
sqr-neg58.4%
sqrt-unprod0.9%
add-sqr-sqrt19.8%
pow-exp38.1%
*-commutative38.1%
+-commutative38.1%
distribute-rgt-in38.1%
Applied egg-rr63.9%
Taylor expanded in eps around inf 99.9%
Taylor expanded in x around 0 74.0%
Simplified74.0%
if 2.50000000000000023e55 < x < 1.2e114 or 4.9999999999999998e199 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 77.0%
Taylor expanded in x around 0 77.0%
Final simplification79.0%
(FPCore (x eps)
:precision binary64
(if (<= x -4.7e+95)
(pow 0.0 -1.0)
(if (<= x 3.6e-75)
(/ (+ (exp (* eps (- x))) (+ 1.0 (* x (+ eps -1.0)))) 2.0)
(if (<= x 5e+199) (pow 0.0 -1.0) 0.0))))
double code(double x, double eps) {
double tmp;
if (x <= -4.7e+95) {
tmp = pow(0.0, -1.0);
} else if (x <= 3.6e-75) {
tmp = (exp((eps * -x)) + (1.0 + (x * (eps + -1.0)))) / 2.0;
} else if (x <= 5e+199) {
tmp = pow(0.0, -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 <= (-4.7d+95)) then
tmp = 0.0d0 ** (-1.0d0)
else if (x <= 3.6d-75) then
tmp = (exp((eps * -x)) + (1.0d0 + (x * (eps + (-1.0d0))))) / 2.0d0
else if (x <= 5d+199) then
tmp = 0.0d0 ** (-1.0d0)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -4.7e+95) {
tmp = Math.pow(0.0, -1.0);
} else if (x <= 3.6e-75) {
tmp = (Math.exp((eps * -x)) + (1.0 + (x * (eps + -1.0)))) / 2.0;
} else if (x <= 5e+199) {
tmp = Math.pow(0.0, -1.0);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -4.7e+95: tmp = math.pow(0.0, -1.0) elif x <= 3.6e-75: tmp = (math.exp((eps * -x)) + (1.0 + (x * (eps + -1.0)))) / 2.0 elif x <= 5e+199: tmp = math.pow(0.0, -1.0) else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -4.7e+95) tmp = 0.0 ^ -1.0; elseif (x <= 3.6e-75) tmp = Float64(Float64(exp(Float64(eps * Float64(-x))) + Float64(1.0 + Float64(x * Float64(eps + -1.0)))) / 2.0); elseif (x <= 5e+199) tmp = 0.0 ^ -1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -4.7e+95) tmp = 0.0 ^ -1.0; elseif (x <= 3.6e-75) tmp = (exp((eps * -x)) + (1.0 + (x * (eps + -1.0)))) / 2.0; elseif (x <= 5e+199) tmp = 0.0 ^ -1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -4.7e+95], N[Power[0.0, -1.0], $MachinePrecision], If[LessEqual[x, 3.6e-75], N[(N[(N[Exp[N[(eps * (-x)), $MachinePrecision]], $MachinePrecision] + N[(1.0 + N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5e+199], N[Power[0.0, -1.0], $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.7 \cdot 10^{+95}:\\
\;\;\;\;{0}^{-1}\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-75}:\\
\;\;\;\;\frac{e^{\varepsilon \cdot \left(-x\right)} + \left(1 + x \cdot \left(\varepsilon + -1\right)\right)}{2}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+199}:\\
\;\;\;\;{0}^{-1}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -4.69999999999999972e95 or 3.6e-75 < x < 4.9999999999999998e199Initial program 94.0%
Simplified93.1%
Taylor expanded in eps around 0 18.7%
Applied egg-rr36.7%
Taylor expanded in eps around 0 74.9%
if -4.69999999999999972e95 < x < 3.6e-75Initial program 59.0%
Simplified33.5%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
neg-mul-1100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 87.0%
if 4.9999999999999998e199 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 70.5%
Taylor expanded in x around 0 70.5%
Final simplification80.4%
(FPCore (x eps)
:precision binary64
(if (<= x -1.9e-5)
(pow 0.0 -1.0)
(if (<= x -3.2e-239)
(/
(+ 2.0 (* x (+ -1.0 (+ eps (/ (- 1.0 (* eps eps)) (+ eps -1.0))))))
2.0)
(if (<= x 4.9e-82) 1.0 (if (<= x 5.8e+203) (pow 0.0 -1.0) 0.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -1.9e-5) {
tmp = pow(0.0, -1.0);
} else if (x <= -3.2e-239) {
tmp = (2.0 + (x * (-1.0 + (eps + ((1.0 - (eps * eps)) / (eps + -1.0)))))) / 2.0;
} else if (x <= 4.9e-82) {
tmp = 1.0;
} else if (x <= 5.8e+203) {
tmp = pow(0.0, -1.0);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-1.9d-5)) then
tmp = 0.0d0 ** (-1.0d0)
else if (x <= (-3.2d-239)) then
tmp = (2.0d0 + (x * ((-1.0d0) + (eps + ((1.0d0 - (eps * eps)) / (eps + (-1.0d0))))))) / 2.0d0
else if (x <= 4.9d-82) then
tmp = 1.0d0
else if (x <= 5.8d+203) then
tmp = 0.0d0 ** (-1.0d0)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -1.9e-5) {
tmp = Math.pow(0.0, -1.0);
} else if (x <= -3.2e-239) {
tmp = (2.0 + (x * (-1.0 + (eps + ((1.0 - (eps * eps)) / (eps + -1.0)))))) / 2.0;
} else if (x <= 4.9e-82) {
tmp = 1.0;
} else if (x <= 5.8e+203) {
tmp = Math.pow(0.0, -1.0);
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -1.9e-5: tmp = math.pow(0.0, -1.0) elif x <= -3.2e-239: tmp = (2.0 + (x * (-1.0 + (eps + ((1.0 - (eps * eps)) / (eps + -1.0)))))) / 2.0 elif x <= 4.9e-82: tmp = 1.0 elif x <= 5.8e+203: tmp = math.pow(0.0, -1.0) else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -1.9e-5) tmp = 0.0 ^ -1.0; elseif (x <= -3.2e-239) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(eps + Float64(Float64(1.0 - Float64(eps * eps)) / Float64(eps + -1.0)))))) / 2.0); elseif (x <= 4.9e-82) tmp = 1.0; elseif (x <= 5.8e+203) tmp = 0.0 ^ -1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -1.9e-5) tmp = 0.0 ^ -1.0; elseif (x <= -3.2e-239) tmp = (2.0 + (x * (-1.0 + (eps + ((1.0 - (eps * eps)) / (eps + -1.0)))))) / 2.0; elseif (x <= 4.9e-82) tmp = 1.0; elseif (x <= 5.8e+203) tmp = 0.0 ^ -1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -1.9e-5], N[Power[0.0, -1.0], $MachinePrecision], If[LessEqual[x, -3.2e-239], N[(N[(2.0 + N[(x * N[(-1.0 + N[(eps + N[(N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision] / N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.9e-82], 1.0, If[LessEqual[x, 5.8e+203], N[Power[0.0, -1.0], $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{-5}:\\
\;\;\;\;{0}^{-1}\\
\mathbf{elif}\;x \leq -3.2 \cdot 10^{-239}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + \left(\varepsilon + \frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon + -1}\right)\right)}{2}\\
\mathbf{elif}\;x \leq 4.9 \cdot 10^{-82}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{+203}:\\
\;\;\;\;{0}^{-1}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1.9000000000000001e-5 or 4.9000000000000003e-82 < x < 5.80000000000000021e203Initial program 93.9%
Simplified93.2%
Taylor expanded in eps around 0 16.5%
Applied egg-rr35.5%
Taylor expanded in eps around 0 77.1%
if -1.9000000000000001e-5 < x < -3.1999999999999999e-239Initial program 53.6%
Simplified29.3%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 76.7%
mul-1-neg76.7%
distribute-neg-in76.7%
metadata-eval76.7%
flip-+82.3%
metadata-eval82.3%
Applied egg-rr82.3%
if -3.1999999999999999e-239 < x < 4.9000000000000003e-82Initial program 54.8%
Simplified21.9%
pow-neg21.9%
associate-*l/21.9%
*-un-lft-identity21.9%
add-sqr-sqrt13.4%
sqrt-unprod20.7%
frac-times20.9%
metadata-eval20.9%
metadata-eval20.9%
frac-times20.7%
sqrt-unprod7.6%
add-sqr-sqrt17.1%
add-sqr-sqrt16.0%
sqrt-unprod41.2%
sqr-neg41.2%
sqrt-unprod1.6%
add-sqr-sqrt9.4%
pow-exp40.5%
*-commutative40.5%
+-commutative40.5%
distribute-rgt-in40.5%
Applied egg-rr50.0%
Taylor expanded in x around 0 38.2%
associate-*r/38.2%
metadata-eval38.2%
Simplified38.2%
Taylor expanded in eps around 0 38.2%
Taylor expanded in eps around inf 88.2%
if 5.80000000000000021e203 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 70.5%
Taylor expanded in x around 0 70.5%
Final simplification80.1%
(FPCore (x eps)
:precision binary64
(if (<= x -6.8e-242)
(/ (+ 2.0 (* x (+ -1.0 (+ eps (/ (- 1.0 (* eps eps)) (+ eps -1.0)))))) 2.0)
(if (<= x 1.1e+45)
(+ 1.0 (* x eps))
(if (<= x 1.55e+121) 0.0 (if (<= x 5.6e+203) (* x eps) 0.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -6.8e-242) {
tmp = (2.0 + (x * (-1.0 + (eps + ((1.0 - (eps * eps)) / (eps + -1.0)))))) / 2.0;
} else if (x <= 1.1e+45) {
tmp = 1.0 + (x * eps);
} else if (x <= 1.55e+121) {
tmp = 0.0;
} else if (x <= 5.6e+203) {
tmp = x * eps;
} 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 <= (-6.8d-242)) then
tmp = (2.0d0 + (x * ((-1.0d0) + (eps + ((1.0d0 - (eps * eps)) / (eps + (-1.0d0))))))) / 2.0d0
else if (x <= 1.1d+45) then
tmp = 1.0d0 + (x * eps)
else if (x <= 1.55d+121) then
tmp = 0.0d0
else if (x <= 5.6d+203) then
tmp = x * eps
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -6.8e-242) {
tmp = (2.0 + (x * (-1.0 + (eps + ((1.0 - (eps * eps)) / (eps + -1.0)))))) / 2.0;
} else if (x <= 1.1e+45) {
tmp = 1.0 + (x * eps);
} else if (x <= 1.55e+121) {
tmp = 0.0;
} else if (x <= 5.6e+203) {
tmp = x * eps;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -6.8e-242: tmp = (2.0 + (x * (-1.0 + (eps + ((1.0 - (eps * eps)) / (eps + -1.0)))))) / 2.0 elif x <= 1.1e+45: tmp = 1.0 + (x * eps) elif x <= 1.55e+121: tmp = 0.0 elif x <= 5.6e+203: tmp = x * eps else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -6.8e-242) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(eps + Float64(Float64(1.0 - Float64(eps * eps)) / Float64(eps + -1.0)))))) / 2.0); elseif (x <= 1.1e+45) tmp = Float64(1.0 + Float64(x * eps)); elseif (x <= 1.55e+121) tmp = 0.0; elseif (x <= 5.6e+203) tmp = Float64(x * eps); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -6.8e-242) tmp = (2.0 + (x * (-1.0 + (eps + ((1.0 - (eps * eps)) / (eps + -1.0)))))) / 2.0; elseif (x <= 1.1e+45) tmp = 1.0 + (x * eps); elseif (x <= 1.55e+121) tmp = 0.0; elseif (x <= 5.6e+203) tmp = x * eps; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -6.8e-242], N[(N[(2.0 + N[(x * N[(-1.0 + N[(eps + N[(N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision] / N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.1e+45], N[(1.0 + N[(x * eps), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.55e+121], 0.0, If[LessEqual[x, 5.6e+203], N[(x * eps), $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-242}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + \left(\varepsilon + \frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon + -1}\right)\right)}{2}\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+45}:\\
\;\;\;\;1 + x \cdot \varepsilon\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{+121}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{+203}:\\
\;\;\;\;x \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -6.8000000000000001e-242Initial program 76.0%
Simplified63.5%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 42.2%
mul-1-neg42.2%
distribute-neg-in42.2%
metadata-eval42.2%
flip-+53.7%
metadata-eval53.7%
Applied egg-rr53.7%
if -6.8000000000000001e-242 < x < 1.1e45Initial program 65.5%
Simplified44.9%
Taylor expanded in eps around inf 99.9%
Taylor expanded in x around 0 62.9%
associate--l+63.1%
add-sqr-sqrt12.1%
sqrt-unprod77.9%
mul-1-neg77.9%
mul-1-neg77.9%
sqr-neg77.9%
sqrt-unprod54.0%
add-sqr-sqrt64.4%
add-exp-log54.0%
expm1-undefine54.0%
log1p-define54.0%
expm1-log1p-u64.4%
Applied egg-rr64.4%
Taylor expanded in x around 0 64.4%
+-commutative64.4%
Simplified64.4%
if 1.1e45 < x < 1.55000000000000004e121 or 5.5999999999999998e203 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 71.9%
Taylor expanded in x around 0 71.9%
if 1.55000000000000004e121 < x < 5.5999999999999998e203Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 0.7%
associate--l+2.9%
add-sqr-sqrt4.8%
sqrt-unprod53.8%
mul-1-neg53.8%
mul-1-neg53.8%
sqr-neg53.8%
sqrt-unprod20.1%
add-sqr-sqrt20.1%
add-exp-log20.1%
expm1-undefine20.1%
log1p-define20.1%
expm1-log1p-u20.1%
Applied egg-rr20.1%
Taylor expanded in x around inf 20.2%
Final simplification56.9%
(FPCore (x eps) :precision binary64 (if (<= x 1.0) (- 1.0 x) (if (<= x 1.65e+119) 0.0 (if (<= x 9.5e+203) (* x eps) 0.0))))
double code(double x, double eps) {
double tmp;
if (x <= 1.0) {
tmp = 1.0 - x;
} else if (x <= 1.65e+119) {
tmp = 0.0;
} else if (x <= 9.5e+203) {
tmp = x * eps;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 1.0d0) then
tmp = 1.0d0 - x
else if (x <= 1.65d+119) then
tmp = 0.0d0
else if (x <= 9.5d+203) then
tmp = x * eps
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 1.0) {
tmp = 1.0 - x;
} else if (x <= 1.65e+119) {
tmp = 0.0;
} else if (x <= 9.5e+203) {
tmp = x * eps;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.0: tmp = 1.0 - x elif x <= 1.65e+119: tmp = 0.0 elif x <= 9.5e+203: tmp = x * eps else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 1.0) tmp = Float64(1.0 - x); elseif (x <= 1.65e+119) tmp = 0.0; elseif (x <= 9.5e+203) tmp = Float64(x * eps); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 1.0) tmp = 1.0 - x; elseif (x <= 1.65e+119) tmp = 0.0; elseif (x <= 9.5e+203) tmp = x * eps; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 1.0], N[(1.0 - x), $MachinePrecision], If[LessEqual[x, 1.65e+119], 0.0, If[LessEqual[x, 9.5e+203], N[(x * eps), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;1 - x\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{+119}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+203}:\\
\;\;\;\;x \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1Initial program 68.4%
Simplified50.5%
Taylor expanded in eps around inf 99.9%
Taylor expanded in x around 0 56.7%
Taylor expanded in x around inf 56.2%
Simplified56.6%
Taylor expanded in x around 0 56.7%
neg-mul-156.7%
unsub-neg56.7%
Simplified56.7%
if 1 < x < 1.6500000000000001e119 or 9.4999999999999995e203 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 59.0%
Taylor expanded in x around 0 59.0%
if 1.6500000000000001e119 < x < 9.4999999999999995e203Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 0.7%
associate--l+2.9%
add-sqr-sqrt4.8%
sqrt-unprod53.8%
mul-1-neg53.8%
mul-1-neg53.8%
sqr-neg53.8%
sqrt-unprod20.1%
add-sqr-sqrt20.1%
add-exp-log20.1%
expm1-undefine20.1%
log1p-define20.1%
expm1-log1p-u20.1%
Applied egg-rr20.1%
Taylor expanded in x around inf 20.2%
Final simplification53.3%
(FPCore (x eps) :precision binary64 (if (<= x 105000.0) 1.0 (if (<= x 9.6e+119) 0.0 (if (<= x 5.3e+204) (* x eps) 0.0))))
double code(double x, double eps) {
double tmp;
if (x <= 105000.0) {
tmp = 1.0;
} else if (x <= 9.6e+119) {
tmp = 0.0;
} else if (x <= 5.3e+204) {
tmp = x * eps;
} 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 <= 105000.0d0) then
tmp = 1.0d0
else if (x <= 9.6d+119) then
tmp = 0.0d0
else if (x <= 5.3d+204) then
tmp = x * eps
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 105000.0) {
tmp = 1.0;
} else if (x <= 9.6e+119) {
tmp = 0.0;
} else if (x <= 5.3e+204) {
tmp = x * eps;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 105000.0: tmp = 1.0 elif x <= 9.6e+119: tmp = 0.0 elif x <= 5.3e+204: tmp = x * eps else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 105000.0) tmp = 1.0; elseif (x <= 9.6e+119) tmp = 0.0; elseif (x <= 5.3e+204) tmp = Float64(x * eps); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 105000.0) tmp = 1.0; elseif (x <= 9.6e+119) tmp = 0.0; elseif (x <= 5.3e+204) tmp = x * eps; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 105000.0], 1.0, If[LessEqual[x, 9.6e+119], 0.0, If[LessEqual[x, 5.3e+204], N[(x * eps), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 105000:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{+119}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 5.3 \cdot 10^{+204}:\\
\;\;\;\;x \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 105000Initial program 68.8%
Simplified51.1%
pow-neg51.1%
associate-*l/51.1%
*-un-lft-identity51.1%
add-sqr-sqrt27.2%
sqrt-unprod50.5%
frac-times50.6%
metadata-eval50.6%
metadata-eval50.6%
frac-times50.5%
sqrt-unprod23.5%
add-sqr-sqrt48.6%
add-sqr-sqrt16.4%
sqrt-unprod45.8%
sqr-neg45.8%
sqrt-unprod17.4%
add-sqr-sqrt25.3%
pow-exp41.5%
*-commutative41.5%
+-commutative41.5%
distribute-rgt-in41.5%
Applied egg-rr66.0%
Taylor expanded in x around 0 21.6%
associate-*r/21.6%
metadata-eval21.6%
Simplified21.6%
Taylor expanded in eps around 0 21.6%
Taylor expanded in eps around inf 55.6%
if 105000 < x < 9.6e119 or 5.3e204 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 61.5%
Taylor expanded in x around 0 61.5%
if 9.6e119 < x < 5.3e204Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in x around 0 0.7%
associate--l+2.9%
add-sqr-sqrt4.8%
sqrt-unprod53.8%
mul-1-neg53.8%
mul-1-neg53.8%
sqr-neg53.8%
sqrt-unprod20.1%
add-sqr-sqrt20.1%
add-exp-log20.1%
expm1-undefine20.1%
log1p-define20.1%
expm1-log1p-u20.1%
Applied egg-rr20.1%
Taylor expanded in x around inf 20.2%
Final simplification52.9%
(FPCore (x eps) :precision binary64 (if (<= x 105000.0) 1.0 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 105000.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 <= 105000.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 <= 105000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 105000.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 105000.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 105000.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 105000.0], 1.0, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 105000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 105000Initial program 68.8%
Simplified51.1%
pow-neg51.1%
associate-*l/51.1%
*-un-lft-identity51.1%
add-sqr-sqrt27.2%
sqrt-unprod50.5%
frac-times50.6%
metadata-eval50.6%
metadata-eval50.6%
frac-times50.5%
sqrt-unprod23.5%
add-sqr-sqrt48.6%
add-sqr-sqrt16.4%
sqrt-unprod45.8%
sqr-neg45.8%
sqrt-unprod17.4%
add-sqr-sqrt25.3%
pow-exp41.5%
*-commutative41.5%
+-commutative41.5%
distribute-rgt-in41.5%
Applied egg-rr66.0%
Taylor expanded in x around 0 21.6%
associate-*r/21.6%
metadata-eval21.6%
Simplified21.6%
Taylor expanded in eps around 0 21.6%
Taylor expanded in eps around inf 55.6%
if 105000 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 47.4%
Taylor expanded in x around 0 47.4%
(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.7%
Simplified65.0%
Taylor expanded in eps around 0 15.0%
Taylor expanded in x around 0 15.2%
herbie shell --seed 2024137
(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))