
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 0.00047) (* (exp (- x)) (+ x 1.0)) (/ (+ (exp (+ -1.0 (+ 1.0 (* x (- -1.0 eps_m))))) (exp (* eps_m x))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.00047) {
tmp = exp(-x) * (x + 1.0);
} else {
tmp = (exp((-1.0 + (1.0 + (x * (-1.0 - eps_m))))) + exp((eps_m * x))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 0.00047d0) then
tmp = exp(-x) * (x + 1.0d0)
else
tmp = (exp(((-1.0d0) + (1.0d0 + (x * ((-1.0d0) - eps_m))))) + exp((eps_m * x))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.00047) {
tmp = Math.exp(-x) * (x + 1.0);
} else {
tmp = (Math.exp((-1.0 + (1.0 + (x * (-1.0 - eps_m))))) + Math.exp((eps_m * x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 0.00047: tmp = math.exp(-x) * (x + 1.0) else: tmp = (math.exp((-1.0 + (1.0 + (x * (-1.0 - eps_m))))) + math.exp((eps_m * x))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 0.00047) tmp = Float64(exp(Float64(-x)) * Float64(x + 1.0)); else tmp = Float64(Float64(exp(Float64(-1.0 + Float64(1.0 + Float64(x * Float64(-1.0 - eps_m))))) + exp(Float64(eps_m * x))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 0.00047) tmp = exp(-x) * (x + 1.0); else tmp = (exp((-1.0 + (1.0 + (x * (-1.0 - eps_m))))) + exp((eps_m * x))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 0.00047], N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[N[(-1.0 + N[(1.0 + N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 0.00047:\\
\;\;\;\;e^{-x} \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{-1 + \left(1 + x \cdot \left(-1 - eps\_m\right)\right)} + e^{eps\_m \cdot x}}{2}\\
\end{array}
\end{array}
if eps < 4.69999999999999986e-4Initial program 56.1%
Simplified48.0%
Taylor expanded in eps around 0 32.8%
associate-+r+75.6%
mul-1-neg75.6%
sub-neg75.6%
+-inverses75.6%
distribute-lft-out75.6%
distribute-rgt1-in76.6%
mul-1-neg76.6%
Simplified76.6%
Taylor expanded in eps around 0 76.6%
+-commutative76.6%
Simplified76.6%
if 4.69999999999999986e-4 < eps Initial program 100.0%
Simplified79.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
*-commutative100.0%
expm1-log1p-u67.6%
expm1-undefine67.6%
Applied egg-rr67.6%
sub-neg67.6%
log1p-undefine67.6%
rem-exp-log100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
neg-mul-1100.0%
+-commutative100.0%
neg-mul-1100.0%
distribute-rgt-neg-in100.0%
mul-1-neg100.0%
fma-define100.0%
distribute-lft-in100.0%
metadata-eval100.0%
mul-1-neg100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
fma-undefine100.0%
Applied egg-rr100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification82.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 5e-48) (* (exp (- x)) (+ x 1.0)) (/ (+ (exp (* x (+ eps_m -1.0))) (exp (* eps_m (- x)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 5e-48) {
tmp = exp(-x) * (x + 1.0);
} else {
tmp = (exp((x * (eps_m + -1.0))) + exp((eps_m * -x))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 5d-48) then
tmp = exp(-x) * (x + 1.0d0)
else
tmp = (exp((x * (eps_m + (-1.0d0)))) + exp((eps_m * -x))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 5e-48) {
tmp = Math.exp(-x) * (x + 1.0);
} else {
tmp = (Math.exp((x * (eps_m + -1.0))) + Math.exp((eps_m * -x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 5e-48: tmp = math.exp(-x) * (x + 1.0) else: tmp = (math.exp((x * (eps_m + -1.0))) + math.exp((eps_m * -x))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 5e-48) tmp = Float64(exp(Float64(-x)) * Float64(x + 1.0)); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + exp(Float64(eps_m * Float64(-x)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 5e-48) tmp = exp(-x) * (x + 1.0); else tmp = (exp((x * (eps_m + -1.0))) + exp((eps_m * -x))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 5e-48], N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 5 \cdot 10^{-48}:\\
\;\;\;\;e^{-x} \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\end{array}
\end{array}
if eps < 4.9999999999999999e-48Initial program 55.3%
Simplified46.7%
Taylor expanded in eps around 0 30.9%
associate-+r+74.5%
mul-1-neg74.5%
sub-neg74.5%
+-inverses74.5%
distribute-lft-out74.5%
distribute-rgt1-in75.6%
mul-1-neg75.6%
Simplified75.6%
Taylor expanded in eps around 0 75.6%
+-commutative75.6%
Simplified75.6%
if 4.9999999999999999e-48 < eps Initial program 97.5%
Simplified78.7%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
mul-1-neg100.0%
Simplified100.0%
Final simplification82.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ eps_m -1.0)))))
(if (<= x -4.7e-257)
(/ (+ 1.0 (exp (* eps_m (- x)))) 2.0)
(if (<= x 200000.0)
(/ (+ t_0 (+ 1.0 (* x (- -1.0 eps_m)))) 2.0)
(if (<= x 1.05e+264) 0.0 (/ (+ 1.0 t_0) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double tmp;
if (x <= -4.7e-257) {
tmp = (1.0 + exp((eps_m * -x))) / 2.0;
} else if (x <= 200000.0) {
tmp = (t_0 + (1.0 + (x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 1.05e+264) {
tmp = 0.0;
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = exp((x * (eps_m + (-1.0d0))))
if (x <= (-4.7d-257)) then
tmp = (1.0d0 + exp((eps_m * -x))) / 2.0d0
else if (x <= 200000.0d0) then
tmp = (t_0 + (1.0d0 + (x * ((-1.0d0) - eps_m)))) / 2.0d0
else if (x <= 1.05d+264) then
tmp = 0.0d0
else
tmp = (1.0d0 + t_0) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * (eps_m + -1.0)));
double tmp;
if (x <= -4.7e-257) {
tmp = (1.0 + Math.exp((eps_m * -x))) / 2.0;
} else if (x <= 200000.0) {
tmp = (t_0 + (1.0 + (x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 1.05e+264) {
tmp = 0.0;
} else {
tmp = (1.0 + t_0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (eps_m + -1.0))) tmp = 0 if x <= -4.7e-257: tmp = (1.0 + math.exp((eps_m * -x))) / 2.0 elif x <= 200000.0: tmp = (t_0 + (1.0 + (x * (-1.0 - eps_m)))) / 2.0 elif x <= 1.05e+264: tmp = 0.0 else: tmp = (1.0 + t_0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) tmp = 0.0 if (x <= -4.7e-257) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * Float64(-x)))) / 2.0); elseif (x <= 200000.0) tmp = Float64(Float64(t_0 + Float64(1.0 + Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif (x <= 1.05e+264) tmp = 0.0; else tmp = Float64(Float64(1.0 + t_0) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (eps_m + -1.0))); tmp = 0.0; if (x <= -4.7e-257) tmp = (1.0 + exp((eps_m * -x))) / 2.0; elseif (x <= 200000.0) tmp = (t_0 + (1.0 + (x * (-1.0 - eps_m)))) / 2.0; elseif (x <= 1.05e+264) tmp = 0.0; else tmp = (1.0 + t_0) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -4.7e-257], N[(N[(1.0 + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 200000.0], N[(N[(t$95$0 + N[(1.0 + N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.05e+264], 0.0, N[(N[(1.0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps\_m + -1\right)}\\
\mathbf{if}\;x \leq -4.7 \cdot 10^{-257}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\mathbf{elif}\;x \leq 200000:\\
\;\;\;\;\frac{t\_0 + \left(1 + x \cdot \left(-1 - eps\_m\right)\right)}{2}\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+264}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + t\_0}{2}\\
\end{array}
\end{array}
if x < -4.6999999999999998e-257Initial program 66.5%
Simplified66.5%
Taylor expanded in x around 0 45.5%
Taylor expanded in eps around inf 73.8%
mul-1-neg73.8%
neg-mul-173.8%
distribute-lft-neg-in73.8%
+-commutative73.8%
Simplified73.8%
Taylor expanded in eps around inf 73.9%
if -4.6999999999999998e-257 < x < 2e5Initial program 45.5%
Simplified21.3%
Taylor expanded in eps around inf 98.6%
Taylor expanded in x around 0 90.5%
neg-mul-190.5%
distribute-lft-neg-in90.5%
+-commutative90.5%
Simplified90.5%
if 2e5 < x < 1.05000000000000005e264Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 62.3%
div-sub62.3%
mul-1-neg62.3%
rec-exp62.3%
+-inverses62.3%
metadata-eval62.3%
Simplified62.3%
if 1.05000000000000005e264 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
*-commutative100.0%
expm1-log1p-u50.0%
expm1-undefine50.0%
Applied egg-rr50.0%
sub-neg50.0%
log1p-undefine50.0%
rem-exp-log100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
neg-mul-1100.0%
+-commutative100.0%
neg-mul-1100.0%
distribute-rgt-neg-in100.0%
mul-1-neg100.0%
fma-define100.0%
distribute-lft-in100.0%
metadata-eval100.0%
mul-1-neg100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 32.2%
Final simplification75.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -4e-256)
(/ (+ 1.0 (exp (* eps_m (- x)))) 2.0)
(if (or (<= x 190000.0) (not (<= x 1.45e+264)))
(/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0)
0.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -4e-256) {
tmp = (1.0 + exp((eps_m * -x))) / 2.0;
} else if ((x <= 190000.0) || !(x <= 1.45e+264)) {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-4d-256)) then
tmp = (1.0d0 + exp((eps_m * -x))) / 2.0d0
else if ((x <= 190000.0d0) .or. (.not. (x <= 1.45d+264))) then
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -4e-256) {
tmp = (1.0 + Math.exp((eps_m * -x))) / 2.0;
} else if ((x <= 190000.0) || !(x <= 1.45e+264)) {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -4e-256: tmp = (1.0 + math.exp((eps_m * -x))) / 2.0 elif (x <= 190000.0) or not (x <= 1.45e+264): tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -4e-256) tmp = Float64(Float64(1.0 + exp(Float64(eps_m * Float64(-x)))) / 2.0); elseif ((x <= 190000.0) || !(x <= 1.45e+264)) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -4e-256) tmp = (1.0 + exp((eps_m * -x))) / 2.0; elseif ((x <= 190000.0) || ~((x <= 1.45e+264))) tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -4e-256], N[(N[(1.0 + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 190000.0], N[Not[LessEqual[x, 1.45e+264]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-256}:\\
\;\;\;\;\frac{1 + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\mathbf{elif}\;x \leq 190000 \lor \neg \left(x \leq 1.45 \cdot 10^{+264}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -3.99999999999999991e-256Initial program 66.5%
Simplified66.5%
Taylor expanded in x around 0 45.5%
Taylor expanded in eps around inf 73.8%
mul-1-neg73.8%
neg-mul-173.8%
distribute-lft-neg-in73.8%
+-commutative73.8%
Simplified73.8%
Taylor expanded in eps around inf 73.9%
if -3.99999999999999991e-256 < x < 1.9e5 or 1.4499999999999999e264 < x Initial program 50.6%
Simplified28.7%
Taylor expanded in eps around inf 98.8%
associate-*r*98.8%
neg-mul-198.8%
*-commutative98.8%
expm1-log1p-u86.4%
expm1-undefine86.4%
Applied egg-rr86.4%
sub-neg86.4%
log1p-undefine86.4%
rem-exp-log98.8%
*-commutative98.8%
distribute-lft-neg-in98.8%
neg-mul-198.8%
+-commutative98.8%
neg-mul-198.8%
distribute-rgt-neg-in98.8%
mul-1-neg98.8%
fma-define98.8%
distribute-lft-in98.8%
metadata-eval98.8%
mul-1-neg98.8%
unsub-neg98.8%
metadata-eval98.8%
Simplified98.8%
Taylor expanded in x around 0 83.9%
if 1.9e5 < x < 1.4499999999999999e264Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 62.3%
div-sub62.3%
mul-1-neg62.3%
rec-exp62.3%
+-inverses62.3%
metadata-eval62.3%
Simplified62.3%
Final simplification75.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 405.0)
(* (exp (- x)) (+ x 1.0))
(/
(* eps_m (+ (/ 1.0 eps_m) (- (/ (exp (* x (+ eps_m -1.0))) eps_m) x)))
2.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 405.0) {
tmp = exp(-x) * (x + 1.0);
} else {
tmp = (eps_m * ((1.0 / eps_m) + ((exp((x * (eps_m + -1.0))) / eps_m) - x))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 405.0d0) then
tmp = exp(-x) * (x + 1.0d0)
else
tmp = (eps_m * ((1.0d0 / eps_m) + ((exp((x * (eps_m + (-1.0d0)))) / eps_m) - x))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 405.0) {
tmp = Math.exp(-x) * (x + 1.0);
} else {
tmp = (eps_m * ((1.0 / eps_m) + ((Math.exp((x * (eps_m + -1.0))) / eps_m) - x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 405.0: tmp = math.exp(-x) * (x + 1.0) else: tmp = (eps_m * ((1.0 / eps_m) + ((math.exp((x * (eps_m + -1.0))) / eps_m) - x))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 405.0) tmp = Float64(exp(Float64(-x)) * Float64(x + 1.0)); else tmp = Float64(Float64(eps_m * Float64(Float64(1.0 / eps_m) + Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) / eps_m) - x))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 405.0) tmp = exp(-x) * (x + 1.0); else tmp = (eps_m * ((1.0 / eps_m) + ((exp((x * (eps_m + -1.0))) / eps_m) - x))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 405.0], N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(eps$95$m * N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / eps$95$m), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 405:\\
\;\;\;\;e^{-x} \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot \left(\frac{1}{eps\_m} + \left(\frac{e^{x \cdot \left(eps\_m + -1\right)}}{eps\_m} - x\right)\right)}{2}\\
\end{array}
\end{array}
if eps < 405Initial program 56.4%
Simplified48.3%
Taylor expanded in eps around 0 33.1%
associate-+r+75.7%
mul-1-neg75.7%
sub-neg75.7%
+-inverses75.7%
distribute-lft-out75.7%
distribute-rgt1-in76.8%
mul-1-neg76.8%
Simplified76.8%
Taylor expanded in eps around 0 76.8%
+-commutative76.8%
Simplified76.8%
if 405 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 65.5%
Taylor expanded in eps around inf 77.4%
associate--l+77.4%
mul-1-neg77.4%
Simplified77.4%
Final simplification76.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 0.95) (+ 1.0 (* x (+ -1.0 (* x (+ 0.5 (* x -0.16666666666666666)))))) (if (<= x 6e+264) (* x (exp (- x))) (/ (* eps_m x) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 0.95) {
tmp = 1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))));
} else if (x <= 6e+264) {
tmp = x * exp(-x);
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 0.95d0) then
tmp = 1.0d0 + (x * ((-1.0d0) + (x * (0.5d0 + (x * (-0.16666666666666666d0))))))
else if (x <= 6d+264) then
tmp = x * exp(-x)
else
tmp = (eps_m * x) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 0.95) {
tmp = 1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))));
} else if (x <= 6e+264) {
tmp = x * Math.exp(-x);
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 0.95: tmp = 1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666))))) elif x <= 6e+264: tmp = x * math.exp(-x) else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 0.95) tmp = Float64(1.0 + Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * -0.16666666666666666)))))); elseif (x <= 6e+264) tmp = Float64(x * exp(Float64(-x))); else tmp = Float64(Float64(eps_m * x) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 0.95) tmp = 1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666))))); elseif (x <= 6e+264) tmp = x * exp(-x); else tmp = (eps_m * x) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 0.95], N[(1.0 + N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6e+264], N[(x * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], N[(N[(eps$95$m * x), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.95:\\
\;\;\;\;1 + x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot -0.16666666666666666\right)\right)\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+264}:\\
\;\;\;\;x \cdot e^{-x}\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < 0.94999999999999996Initial program 55.7%
Simplified39.6%
Taylor expanded in eps around inf 97.8%
Taylor expanded in eps around 0 82.8%
neg-mul-182.8%
Simplified82.8%
Taylor expanded in x around 0 75.1%
if 0.94999999999999996 < x < 6e264Initial program 98.4%
Simplified98.4%
Taylor expanded in eps around 0 60.3%
associate-+r+61.9%
mul-1-neg61.9%
sub-neg61.9%
+-inverses61.9%
distribute-lft-out61.9%
distribute-rgt1-in61.9%
mul-1-neg61.9%
Simplified61.9%
Taylor expanded in x around inf 60.8%
if 6e264 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 30.3%
+-commutative30.3%
mul-1-neg30.3%
unsub-neg30.3%
*-commutative30.3%
Simplified30.3%
Taylor expanded in eps around inf 30.4%
*-commutative30.4%
Simplified30.4%
Final simplification69.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 0.00047) (* (exp (- x)) (+ x 1.0)) (/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.00047) {
tmp = exp(-x) * (x + 1.0);
} else {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 0.00047d0) then
tmp = exp(-x) * (x + 1.0d0)
else
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.00047) {
tmp = Math.exp(-x) * (x + 1.0);
} else {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 0.00047: tmp = math.exp(-x) * (x + 1.0) else: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 0.00047) tmp = Float64(exp(Float64(-x)) * Float64(x + 1.0)); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 0.00047) tmp = exp(-x) * (x + 1.0); else tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 0.00047], N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 0.00047:\\
\;\;\;\;e^{-x} \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if eps < 4.69999999999999986e-4Initial program 56.1%
Simplified48.0%
Taylor expanded in eps around 0 32.8%
associate-+r+75.6%
mul-1-neg75.6%
sub-neg75.6%
+-inverses75.6%
distribute-lft-out75.6%
distribute-rgt1-in76.6%
mul-1-neg76.6%
Simplified76.6%
Taylor expanded in eps around 0 76.6%
+-commutative76.6%
Simplified76.6%
if 4.69999999999999986e-4 < eps Initial program 100.0%
Simplified79.0%
Taylor expanded in eps around inf 100.0%
associate-*r*100.0%
neg-mul-1100.0%
*-commutative100.0%
expm1-log1p-u67.6%
expm1-undefine67.6%
Applied egg-rr67.6%
sub-neg67.6%
log1p-undefine67.6%
rem-exp-log100.0%
*-commutative100.0%
distribute-lft-neg-in100.0%
neg-mul-1100.0%
+-commutative100.0%
neg-mul-1100.0%
distribute-rgt-neg-in100.0%
mul-1-neg100.0%
fma-define100.0%
distribute-lft-in100.0%
metadata-eval100.0%
mul-1-neg100.0%
unsub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 56.8%
Final simplification71.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 0.00047) (* (exp (- x)) (+ x 1.0)) (/ (+ 2.0 (* x (- x 2.0))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.00047) {
tmp = exp(-x) * (x + 1.0);
} else {
tmp = (2.0 + (x * (x - 2.0))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 0.00047d0) then
tmp = exp(-x) * (x + 1.0d0)
else
tmp = (2.0d0 + (x * (x - 2.0d0))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 0.00047) {
tmp = Math.exp(-x) * (x + 1.0);
} else {
tmp = (2.0 + (x * (x - 2.0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 0.00047: tmp = math.exp(-x) * (x + 1.0) else: tmp = (2.0 + (x * (x - 2.0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 0.00047) tmp = Float64(exp(Float64(-x)) * Float64(x + 1.0)); else tmp = Float64(Float64(2.0 + Float64(x * Float64(x - 2.0))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 0.00047) tmp = exp(-x) * (x + 1.0); else tmp = (2.0 + (x * (x - 2.0))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 0.00047], N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 + N[(x * N[(x - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 0.00047:\\
\;\;\;\;e^{-x} \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(x - 2\right)}{2}\\
\end{array}
\end{array}
if eps < 4.69999999999999986e-4Initial program 56.1%
Simplified48.0%
Taylor expanded in eps around 0 32.8%
associate-+r+75.6%
mul-1-neg75.6%
sub-neg75.6%
+-inverses75.6%
distribute-lft-out75.6%
distribute-rgt1-in76.6%
mul-1-neg76.6%
Simplified76.6%
Taylor expanded in eps around 0 76.6%
+-commutative76.6%
Simplified76.6%
if 4.69999999999999986e-4 < eps Initial program 100.0%
Simplified79.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 54.2%
neg-mul-154.2%
Simplified54.2%
Taylor expanded in x around 0 56.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 6.4e+264) (/ (/ 2.0 (exp x)) 2.0) (/ (* eps_m x) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 6.4e+264) {
tmp = (2.0 / exp(x)) / 2.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 6.4d+264) then
tmp = (2.0d0 / exp(x)) / 2.0d0
else
tmp = (eps_m * x) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 6.4e+264) {
tmp = (2.0 / Math.exp(x)) / 2.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 6.4e+264: tmp = (2.0 / math.exp(x)) / 2.0 else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 6.4e+264) tmp = Float64(Float64(2.0 / exp(x)) / 2.0); else tmp = Float64(Float64(eps_m * x) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 6.4e+264) tmp = (2.0 / exp(x)) / 2.0; else tmp = (eps_m * x) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 6.4e+264], N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(eps$95$m * x), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.4 \cdot 10^{+264}:\\
\;\;\;\;\frac{\frac{2}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < 6.4000000000000001e264Initial program 66.5%
Simplified54.5%
Taylor expanded in eps around inf 98.0%
associate-*r*98.0%
neg-mul-198.0%
*-commutative98.0%
expm1-log1p-u67.0%
expm1-undefine67.0%
Applied egg-rr67.0%
sub-neg67.0%
log1p-undefine67.0%
rem-exp-log98.0%
*-commutative98.0%
distribute-lft-neg-in98.0%
neg-mul-198.0%
+-commutative98.0%
neg-mul-198.0%
distribute-rgt-neg-in98.0%
mul-1-neg98.0%
fma-define98.0%
distribute-lft-in98.0%
metadata-eval98.0%
mul-1-neg98.0%
unsub-neg98.0%
metadata-eval98.0%
Simplified98.0%
fma-undefine98.0%
Applied egg-rr98.0%
Taylor expanded in eps around 0 77.2%
neg-mul-177.2%
exp-neg77.2%
associate-*r/77.2%
metadata-eval77.2%
Simplified77.2%
if 6.4000000000000001e264 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 30.3%
+-commutative30.3%
mul-1-neg30.3%
unsub-neg30.3%
*-commutative30.3%
Simplified30.3%
Taylor expanded in eps around inf 30.4%
*-commutative30.4%
Simplified30.4%
Final simplification75.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -0.0064) (* eps_m (* x -0.5)) (if (<= x 150000.0) 1.0 (if (<= x 4.8e+264) 0.0 (/ (* eps_m x) 2.0)))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.0064) {
tmp = eps_m * (x * -0.5);
} else if (x <= 150000.0) {
tmp = 1.0;
} else if (x <= 4.8e+264) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-0.0064d0)) then
tmp = eps_m * (x * (-0.5d0))
else if (x <= 150000.0d0) then
tmp = 1.0d0
else if (x <= 4.8d+264) then
tmp = 0.0d0
else
tmp = (eps_m * x) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -0.0064) {
tmp = eps_m * (x * -0.5);
} else if (x <= 150000.0) {
tmp = 1.0;
} else if (x <= 4.8e+264) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.0064: tmp = eps_m * (x * -0.5) elif x <= 150000.0: tmp = 1.0 elif x <= 4.8e+264: tmp = 0.0 else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.0064) tmp = Float64(eps_m * Float64(x * -0.5)); elseif (x <= 150000.0) tmp = 1.0; elseif (x <= 4.8e+264) tmp = 0.0; else tmp = Float64(Float64(eps_m * x) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -0.0064) tmp = eps_m * (x * -0.5); elseif (x <= 150000.0) tmp = 1.0; elseif (x <= 4.8e+264) tmp = 0.0; else tmp = (eps_m * x) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.0064], N[(eps$95$m * N[(x * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 150000.0], 1.0, If[LessEqual[x, 4.8e+264], 0.0, N[(N[(eps$95$m * x), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0064:\\
\;\;\;\;eps\_m \cdot \left(x \cdot -0.5\right)\\
\mathbf{elif}\;x \leq 150000:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+264}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < -0.00640000000000000031Initial program 92.7%
Simplified92.7%
Taylor expanded in x around 0 72.0%
Taylor expanded in x around inf 35.5%
+-commutative35.5%
sub-neg35.5%
metadata-eval35.5%
+-commutative35.5%
Simplified35.5%
Taylor expanded in eps around inf 35.5%
*-commutative35.5%
*-commutative35.5%
*-commutative35.5%
associate-*r*35.5%
Simplified35.5%
if -0.00640000000000000031 < x < 1.5e5Initial program 45.2%
Simplified45.2%
Taylor expanded in x around 0 80.7%
if 1.5e5 < x < 4.79999999999999985e264Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 62.3%
div-sub62.3%
mul-1-neg62.3%
rec-exp62.3%
+-inverses62.3%
metadata-eval62.3%
Simplified62.3%
if 4.79999999999999985e264 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 30.3%
+-commutative30.3%
mul-1-neg30.3%
unsub-neg30.3%
*-commutative30.3%
Simplified30.3%
Taylor expanded in eps around inf 30.4%
*-commutative30.4%
Simplified30.4%
Final simplification67.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 1.6) (+ 1.0 (* x (+ -1.0 (* x (+ 0.5 (* x -0.16666666666666666)))))) (if (<= x 2.6e+264) 0.0 (/ (* eps_m x) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.6) {
tmp = 1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))));
} else if (x <= 2.6e+264) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 1.6d0) then
tmp = 1.0d0 + (x * ((-1.0d0) + (x * (0.5d0 + (x * (-0.16666666666666666d0))))))
else if (x <= 2.6d+264) then
tmp = 0.0d0
else
tmp = (eps_m * x) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 1.6) {
tmp = 1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666)))));
} else if (x <= 2.6e+264) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.6: tmp = 1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666))))) elif x <= 2.6e+264: tmp = 0.0 else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.6) tmp = Float64(1.0 + Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * -0.16666666666666666)))))); elseif (x <= 2.6e+264) tmp = 0.0; else tmp = Float64(Float64(eps_m * x) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1.6) tmp = 1.0 + (x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666))))); elseif (x <= 2.6e+264) tmp = 0.0; else tmp = (eps_m * x) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1.6], N[(1.0 + N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.6e+264], 0.0, N[(N[(eps$95$m * x), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.6:\\
\;\;\;\;1 + x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot -0.16666666666666666\right)\right)\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+264}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < 1.6000000000000001Initial program 55.7%
Simplified39.6%
Taylor expanded in eps around inf 97.8%
Taylor expanded in eps around 0 82.8%
neg-mul-182.8%
Simplified82.8%
Taylor expanded in x around 0 75.1%
if 1.6000000000000001 < x < 2.6e264Initial program 98.4%
Simplified98.5%
Taylor expanded in eps around 0 60.3%
div-sub60.3%
mul-1-neg60.3%
rec-exp60.3%
+-inverses60.3%
metadata-eval60.3%
Simplified60.3%
if 2.6e264 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 30.3%
+-commutative30.3%
mul-1-neg30.3%
unsub-neg30.3%
*-commutative30.3%
Simplified30.3%
Taylor expanded in eps around inf 30.4%
*-commutative30.4%
Simplified30.4%
Final simplification69.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 150000.0) (/ (+ 2.0 (* x (- x 2.0))) 2.0) (if (<= x 3.9e+264) 0.0 (/ (* eps_m x) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 150000.0) {
tmp = (2.0 + (x * (x - 2.0))) / 2.0;
} else if (x <= 3.9e+264) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 150000.0d0) then
tmp = (2.0d0 + (x * (x - 2.0d0))) / 2.0d0
else if (x <= 3.9d+264) then
tmp = 0.0d0
else
tmp = (eps_m * x) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 150000.0) {
tmp = (2.0 + (x * (x - 2.0))) / 2.0;
} else if (x <= 3.9e+264) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 150000.0: tmp = (2.0 + (x * (x - 2.0))) / 2.0 elif x <= 3.9e+264: tmp = 0.0 else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 150000.0) tmp = Float64(Float64(2.0 + Float64(x * Float64(x - 2.0))) / 2.0); elseif (x <= 3.9e+264) tmp = 0.0; else tmp = Float64(Float64(eps_m * x) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 150000.0) tmp = (2.0 + (x * (x - 2.0))) / 2.0; elseif (x <= 3.9e+264) tmp = 0.0; else tmp = (eps_m * x) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 150000.0], N[(N[(2.0 + N[(x * N[(x - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3.9e+264], 0.0, N[(N[(eps$95$m * x), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 150000:\\
\;\;\;\;\frac{2 + x \cdot \left(x - 2\right)}{2}\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{+264}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < 1.5e5Initial program 55.7%
Simplified39.8%
Taylor expanded in eps around inf 97.3%
Taylor expanded in eps around 0 82.0%
neg-mul-182.0%
Simplified82.0%
Taylor expanded in x around 0 72.8%
if 1.5e5 < x < 3.89999999999999994e264Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 62.3%
div-sub62.3%
mul-1-neg62.3%
rec-exp62.3%
+-inverses62.3%
metadata-eval62.3%
Simplified62.3%
if 3.89999999999999994e264 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 30.3%
+-commutative30.3%
mul-1-neg30.3%
unsub-neg30.3%
*-commutative30.3%
Simplified30.3%
Taylor expanded in eps around inf 30.4%
*-commutative30.4%
Simplified30.4%
Final simplification68.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.95e-8) (/ (+ 2.0 (* x (- -1.0 eps_m))) 2.0) (if (<= x 2.9e+264) 0.0 (/ (* eps_m x) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.95e-8) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else if (x <= 2.9e+264) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 2.95d-8) then
tmp = (2.0d0 + (x * ((-1.0d0) - eps_m))) / 2.0d0
else if (x <= 2.9d+264) then
tmp = 0.0d0
else
tmp = (eps_m * x) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 2.95e-8) {
tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0;
} else if (x <= 2.9e+264) {
tmp = 0.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.95e-8: tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0 elif x <= 2.9e+264: tmp = 0.0 else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.95e-8) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 - eps_m))) / 2.0); elseif (x <= 2.9e+264) tmp = 0.0; else tmp = Float64(Float64(eps_m * x) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 2.95e-8) tmp = (2.0 + (x * (-1.0 - eps_m))) / 2.0; elseif (x <= 2.9e+264) tmp = 0.0; else tmp = (eps_m * x) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 2.95e-8], N[(N[(2.0 + N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.9e+264], 0.0, N[(N[(eps$95$m * x), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.95 \cdot 10^{-8}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 - eps\_m\right)}{2}\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{+264}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < 2.9499999999999999e-8Initial program 55.2%
Simplified55.2%
Taylor expanded in x around 0 40.4%
Taylor expanded in eps around inf 82.4%
mul-1-neg82.4%
neg-mul-182.4%
distribute-lft-neg-in82.4%
+-commutative82.4%
Simplified82.4%
Taylor expanded in x around 0 71.0%
associate-*r*71.0%
+-commutative71.0%
associate-*r*71.0%
*-commutative71.0%
distribute-rgt1-in71.0%
distribute-lft-out71.0%
associate-*r*71.0%
distribute-rgt-in71.0%
mul-1-neg71.0%
sub-neg71.0%
Simplified71.0%
if 2.9499999999999999e-8 < x < 2.8999999999999998e264Initial program 98.5%
Simplified98.5%
Taylor expanded in eps around 0 58.5%
div-sub58.5%
mul-1-neg58.5%
rec-exp58.5%
+-inverses58.5%
metadata-eval58.5%
Simplified58.5%
if 2.8999999999999998e264 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 30.3%
+-commutative30.3%
mul-1-neg30.3%
unsub-neg30.3%
*-commutative30.3%
Simplified30.3%
Taylor expanded in eps around inf 30.4%
*-commutative30.4%
Simplified30.4%
Final simplification66.3%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -0.0064) (* eps_m (* x -0.5)) (if (<= x 150000.0) 1.0 0.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.0064) {
tmp = eps_m * (x * -0.5);
} else if (x <= 150000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-0.0064d0)) then
tmp = eps_m * (x * (-0.5d0))
else if (x <= 150000.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -0.0064) {
tmp = eps_m * (x * -0.5);
} else if (x <= 150000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.0064: tmp = eps_m * (x * -0.5) elif x <= 150000.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.0064) tmp = Float64(eps_m * Float64(x * -0.5)); elseif (x <= 150000.0) tmp = 1.0; else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -0.0064) tmp = eps_m * (x * -0.5); elseif (x <= 150000.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.0064], N[(eps$95$m * N[(x * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 150000.0], 1.0, 0.0]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0064:\\
\;\;\;\;eps\_m \cdot \left(x \cdot -0.5\right)\\
\mathbf{elif}\;x \leq 150000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -0.00640000000000000031Initial program 92.7%
Simplified92.7%
Taylor expanded in x around 0 72.0%
Taylor expanded in x around inf 35.5%
+-commutative35.5%
sub-neg35.5%
metadata-eval35.5%
+-commutative35.5%
Simplified35.5%
Taylor expanded in eps around inf 35.5%
*-commutative35.5%
*-commutative35.5%
*-commutative35.5%
associate-*r*35.5%
Simplified35.5%
if -0.00640000000000000031 < x < 1.5e5Initial program 45.2%
Simplified45.2%
Taylor expanded in x around 0 80.7%
if 1.5e5 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 56.4%
div-sub56.4%
mul-1-neg56.4%
rec-exp56.4%
+-inverses56.4%
metadata-eval56.4%
Simplified56.4%
Final simplification66.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 150000.0) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 150000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 150000.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 150000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 150000.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 150000.0) tmp = 1.0; else tmp = 0.0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 150000.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 150000.0], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 150000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1.5e5Initial program 55.7%
Simplified55.7%
Taylor expanded in x around 0 63.5%
if 1.5e5 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 56.4%
div-sub56.4%
mul-1-neg56.4%
rec-exp56.4%
+-inverses56.4%
metadata-eval56.4%
Simplified56.4%
Final simplification61.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 0.0)
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 0.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = 0.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 0.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return 0.0
eps_m = abs(eps) function code(x, eps_m) return 0.0 end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 0.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 0.0
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
0
\end{array}
Initial program 67.8%
Simplified63.7%
Taylor expanded in eps around 0 17.0%
div-sub17.0%
mul-1-neg17.0%
rec-exp17.1%
+-inverses17.3%
metadata-eval17.3%
Simplified17.3%
herbie shell --seed 2024144
(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))