
(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 11 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
(let* ((t_0 (exp (- x))))
(if (<= eps_m 0.0001)
(/ (+ (* t_0 (+ x 2.0)) (* x t_0)) 2.0)
(/
(+
(* (+ 1.0 (/ 1.0 eps_m)) (exp (* x (+ eps_m -1.0))))
(* (exp (* x (- -1.0 eps_m))) (- (/ -1.0 eps_m) -1.0)))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp(-x);
double tmp;
if (eps_m <= 0.0001) {
tmp = ((t_0 * (x + 2.0)) + (x * t_0)) / 2.0;
} else {
tmp = (((1.0 + (1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (exp((x * (-1.0 - eps_m))) * ((-1.0 / 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) :: t_0
real(8) :: tmp
t_0 = exp(-x)
if (eps_m <= 0.0001d0) then
tmp = ((t_0 * (x + 2.0d0)) + (x * t_0)) / 2.0d0
else
tmp = (((1.0d0 + (1.0d0 / eps_m)) * exp((x * (eps_m + (-1.0d0))))) + (exp((x * ((-1.0d0) - eps_m))) * (((-1.0d0) / 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 t_0 = Math.exp(-x);
double tmp;
if (eps_m <= 0.0001) {
tmp = ((t_0 * (x + 2.0)) + (x * t_0)) / 2.0;
} else {
tmp = (((1.0 + (1.0 / eps_m)) * Math.exp((x * (eps_m + -1.0)))) + (Math.exp((x * (-1.0 - eps_m))) * ((-1.0 / eps_m) - -1.0))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp(-x) tmp = 0 if eps_m <= 0.0001: tmp = ((t_0 * (x + 2.0)) + (x * t_0)) / 2.0 else: tmp = (((1.0 + (1.0 / eps_m)) * math.exp((x * (eps_m + -1.0)))) + (math.exp((x * (-1.0 - eps_m))) * ((-1.0 / eps_m) - -1.0))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(-x)) tmp = 0.0 if (eps_m <= 0.0001) tmp = Float64(Float64(Float64(t_0 * Float64(x + 2.0)) + Float64(x * t_0)) / 2.0); else tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * exp(Float64(x * Float64(eps_m + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(Float64(-1.0 / eps_m) - -1.0))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp(-x); tmp = 0.0; if (eps_m <= 0.0001) tmp = ((t_0 * (x + 2.0)) + (x * t_0)) / 2.0; else tmp = (((1.0 + (1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (exp((x * (-1.0 - eps_m))) * ((-1.0 / eps_m) - -1.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[(-x)], $MachinePrecision]}, If[LessEqual[eps$95$m, 0.0001], N[(N[(N[(t$95$0 * N[(x + 2.0), $MachinePrecision]), $MachinePrecision] + N[(x * t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(-1.0 / eps$95$m), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;eps_m \leq 0.0001:\\
\;\;\;\;\frac{t_0 \cdot \left(x + 2\right) + x \cdot t_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps_m}\right) \cdot e^{x \cdot \left(eps_m + -1\right)} + e^{x \cdot \left(-1 - eps_m\right)} \cdot \left(\frac{-1}{eps_m} - -1\right)}{2}\\
\end{array}
\end{array}
if eps < 1.00000000000000005e-4Initial program 63.4%
Simplified63.4%
Taylor expanded in eps around 0 70.0%
associate--r+70.0%
associate-*r*70.0%
mul-1-neg70.0%
cancel-sign-sub70.0%
distribute-rgt1-in70.0%
distribute-rgt-out--71.6%
mul-1-neg71.6%
mul-1-neg71.6%
Simplified71.6%
Taylor expanded in x around inf 70.0%
+-commutative70.0%
distribute-rgt-in71.6%
Simplified71.6%
if 1.00000000000000005e-4 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
distribute-rgt-out100.0%
Simplified100.0%
Final simplification79.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= eps_m 0.0002)
(/ (+ (* t_0 (+ x 2.0)) (* x t_0)) 2.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 t_0 = exp(-x);
double tmp;
if (eps_m <= 0.0002) {
tmp = ((t_0 * (x + 2.0)) + (x * t_0)) / 2.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) :: t_0
real(8) :: tmp
t_0 = exp(-x)
if (eps_m <= 0.0002d0) then
tmp = ((t_0 * (x + 2.0d0)) + (x * t_0)) / 2.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 t_0 = Math.exp(-x);
double tmp;
if (eps_m <= 0.0002) {
tmp = ((t_0 * (x + 2.0)) + (x * t_0)) / 2.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): t_0 = math.exp(-x) tmp = 0 if eps_m <= 0.0002: tmp = ((t_0 * (x + 2.0)) + (x * t_0)) / 2.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) t_0 = exp(Float64(-x)) tmp = 0.0 if (eps_m <= 0.0002) tmp = Float64(Float64(Float64(t_0 * Float64(x + 2.0)) + Float64(x * t_0)) / 2.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) t_0 = exp(-x); tmp = 0.0; if (eps_m <= 0.0002) tmp = ((t_0 * (x + 2.0)) + (x * t_0)) / 2.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_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[eps$95$m, 0.0002], N[(N[(N[(t$95$0 * N[(x + 2.0), $MachinePrecision]), $MachinePrecision] + N[(x * t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $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}
t_0 := e^{-x}\\
\mathbf{if}\;eps_m \leq 0.0002:\\
\;\;\;\;\frac{t_0 \cdot \left(x + 2\right) + x \cdot t_0}{2}\\
\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 < 2.0000000000000001e-4Initial program 63.4%
Simplified63.4%
Taylor expanded in eps around 0 70.0%
associate--r+70.0%
associate-*r*70.0%
mul-1-neg70.0%
cancel-sign-sub70.0%
distribute-rgt1-in70.0%
distribute-rgt-out--71.6%
mul-1-neg71.6%
mul-1-neg71.6%
Simplified71.6%
Taylor expanded in x around inf 70.0%
+-commutative70.0%
distribute-rgt-in71.6%
Simplified71.6%
if 2.0000000000000001e-4 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification79.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -4.4e-56)
(/ (+ 2.0 (* x (log1p (expm1 (- eps_m))))) 2.0)
(if (<= x -6e-180)
(/ (+ 2.0 (* x (/ (- 1.0 (pow (- 1.0 eps_m) 2.0)) (+ eps_m -2.0)))) 2.0)
(/ (+ (exp (- x)) (exp (* x (+ eps_m -1.0)))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -4.4e-56) {
tmp = (2.0 + (x * log1p(expm1(-eps_m)))) / 2.0;
} else if (x <= -6e-180) {
tmp = (2.0 + (x * ((1.0 - pow((1.0 - eps_m), 2.0)) / (eps_m + -2.0)))) / 2.0;
} else {
tmp = (exp(-x) + exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -4.4e-56) {
tmp = (2.0 + (x * Math.log1p(Math.expm1(-eps_m)))) / 2.0;
} else if (x <= -6e-180) {
tmp = (2.0 + (x * ((1.0 - Math.pow((1.0 - eps_m), 2.0)) / (eps_m + -2.0)))) / 2.0;
} else {
tmp = (Math.exp(-x) + Math.exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -4.4e-56: tmp = (2.0 + (x * math.log1p(math.expm1(-eps_m)))) / 2.0 elif x <= -6e-180: tmp = (2.0 + (x * ((1.0 - math.pow((1.0 - eps_m), 2.0)) / (eps_m + -2.0)))) / 2.0 else: tmp = (math.exp(-x) + math.exp((x * (eps_m + -1.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -4.4e-56) tmp = Float64(Float64(2.0 + Float64(x * log1p(expm1(Float64(-eps_m))))) / 2.0); elseif (x <= -6e-180) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 - (Float64(1.0 - eps_m) ^ 2.0)) / Float64(eps_m + -2.0)))) / 2.0); else tmp = Float64(Float64(exp(Float64(-x)) + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -4.4e-56], N[(N[(2.0 + N[(x * N[Log[1 + N[(Exp[(-eps$95$m)] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -6e-180], N[(N[(2.0 + N[(x * N[(N[(1.0 - N[Power[N[(1.0 - eps$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(eps$95$m + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[(-x)], $MachinePrecision] + 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}\;x \leq -4.4 \cdot 10^{-56}:\\
\;\;\;\;\frac{2 + x \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(-eps_m\right)\right)}{2}\\
\mathbf{elif}\;x \leq -6 \cdot 10^{-180}:\\
\;\;\;\;\frac{2 + x \cdot \frac{1 - {\left(1 - eps_m\right)}^{2}}{eps_m + -2}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{-x} + e^{x \cdot \left(eps_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -4.40000000000000008e-56Initial program 79.1%
Simplified79.1%
Taylor expanded in eps around inf 94.6%
Taylor expanded in eps around 0 89.5%
Taylor expanded in x around 0 35.0%
add-sqr-sqrt0.0%
sqrt-unprod16.2%
mul-1-neg16.2%
mul-1-neg16.2%
sqr-neg16.2%
sqrt-unprod16.2%
add-sqr-sqrt42.2%
add-exp-log16.2%
expm1-udef16.2%
sub-neg16.2%
log1p-def16.2%
expm1-log1p-u42.2%
log1p-expm1-u59.0%
Applied egg-rr59.0%
if -4.40000000000000008e-56 < x < -6.0000000000000001e-180Initial program 63.0%
Simplified63.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 81.4%
Taylor expanded in x around 0 72.4%
flip--39.8%
associate-*r/39.8%
metadata-eval39.8%
sub-neg39.8%
mul-1-neg39.8%
mul-1-neg39.8%
sqr-neg39.8%
pow239.8%
metadata-eval39.8%
+-commutative39.8%
add-sqr-sqrt6.6%
sqrt-unprod72.0%
mul-1-neg72.0%
mul-1-neg72.0%
sqr-neg72.0%
sqrt-unprod65.4%
add-sqr-sqrt86.8%
Applied egg-rr86.8%
*-commutative86.8%
associate-/l*72.1%
associate-/r/86.8%
*-lft-identity86.8%
metadata-eval86.8%
times-frac86.8%
neg-mul-186.8%
neg-mul-186.8%
neg-sub086.8%
+-commutative86.8%
associate--r+86.8%
metadata-eval86.8%
neg-sub086.8%
associate-+r-86.8%
metadata-eval86.8%
associate--r-86.8%
metadata-eval86.8%
+-commutative86.8%
Simplified86.8%
if -6.0000000000000001e-180 < x Initial program 73.7%
Simplified73.7%
Taylor expanded in eps around inf 99.1%
Taylor expanded in eps around 0 81.3%
Taylor expanded in eps around -inf 81.3%
cancel-sign-sub-inv81.3%
associate-*r*81.3%
neg-mul-181.3%
mul-1-neg81.3%
sub-neg81.3%
*-commutative81.3%
metadata-eval81.3%
neg-mul-181.3%
*-lft-identity81.3%
Simplified81.3%
Final simplification77.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= eps_m 6.2e-14)
(/ (* t_0 2.0) 2.0)
(/ (+ t_0 (exp (* eps_m x))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp(-x);
double tmp;
if (eps_m <= 6.2e-14) {
tmp = (t_0 * 2.0) / 2.0;
} else {
tmp = (t_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) :: t_0
real(8) :: tmp
t_0 = exp(-x)
if (eps_m <= 6.2d-14) then
tmp = (t_0 * 2.0d0) / 2.0d0
else
tmp = (t_0 + 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 t_0 = Math.exp(-x);
double tmp;
if (eps_m <= 6.2e-14) {
tmp = (t_0 * 2.0) / 2.0;
} else {
tmp = (t_0 + Math.exp((eps_m * x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp(-x) tmp = 0 if eps_m <= 6.2e-14: tmp = (t_0 * 2.0) / 2.0 else: tmp = (t_0 + math.exp((eps_m * x))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(-x)) tmp = 0.0 if (eps_m <= 6.2e-14) tmp = Float64(Float64(t_0 * 2.0) / 2.0); else tmp = Float64(Float64(t_0 + exp(Float64(eps_m * x))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp(-x); tmp = 0.0; if (eps_m <= 6.2e-14) tmp = (t_0 * 2.0) / 2.0; else tmp = (t_0 + exp((eps_m * x))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[eps$95$m, 6.2e-14], N[(N[(t$95$0 * 2.0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(t$95$0 + N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;eps_m \leq 6.2 \cdot 10^{-14}:\\
\;\;\;\;\frac{t_0 \cdot 2}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0 + e^{eps_m \cdot x}}{2}\\
\end{array}
\end{array}
if eps < 6.20000000000000009e-14Initial program 63.6%
Simplified63.6%
Taylor expanded in eps around inf 98.1%
Taylor expanded in eps around 0 81.7%
Taylor expanded in eps around 0 77.2%
cancel-sign-sub-inv77.2%
neg-mul-177.2%
metadata-eval77.2%
neg-mul-177.2%
*-lft-identity77.2%
count-277.2%
Simplified77.2%
if 6.20000000000000009e-14 < eps Initial program 98.6%
Simplified98.6%
Taylor expanded in eps around inf 98.6%
Taylor expanded in eps around 0 86.6%
Taylor expanded in eps around -inf 86.6%
cancel-sign-sub-inv86.6%
associate-*r*86.6%
neg-mul-186.6%
mul-1-neg86.6%
sub-neg86.6%
*-commutative86.6%
metadata-eval86.6%
neg-mul-186.6%
*-lft-identity86.6%
Simplified86.6%
Taylor expanded in eps around inf 86.6%
*-commutative86.6%
Simplified86.6%
Final simplification79.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= eps_m 1.12e+210)
(/ (* (exp (- x)) 2.0) 2.0)
(if (<= eps_m 4.5e+263)
(/ (+ 2.0 (* eps_m x)) 2.0)
(/
(+ 2.0 (* x (/ (- 1.0 (pow (- 1.0 eps_m) 2.0)) (+ eps_m -2.0))))
2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.12e+210) {
tmp = (exp(-x) * 2.0) / 2.0;
} else if (eps_m <= 4.5e+263) {
tmp = (2.0 + (eps_m * x)) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 - pow((1.0 - eps_m), 2.0)) / (eps_m + -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 <= 1.12d+210) then
tmp = (exp(-x) * 2.0d0) / 2.0d0
else if (eps_m <= 4.5d+263) then
tmp = (2.0d0 + (eps_m * x)) / 2.0d0
else
tmp = (2.0d0 + (x * ((1.0d0 - ((1.0d0 - eps_m) ** 2.0d0)) / (eps_m + (-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 <= 1.12e+210) {
tmp = (Math.exp(-x) * 2.0) / 2.0;
} else if (eps_m <= 4.5e+263) {
tmp = (2.0 + (eps_m * x)) / 2.0;
} else {
tmp = (2.0 + (x * ((1.0 - Math.pow((1.0 - eps_m), 2.0)) / (eps_m + -2.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.12e+210: tmp = (math.exp(-x) * 2.0) / 2.0 elif eps_m <= 4.5e+263: tmp = (2.0 + (eps_m * x)) / 2.0 else: tmp = (2.0 + (x * ((1.0 - math.pow((1.0 - eps_m), 2.0)) / (eps_m + -2.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.12e+210) tmp = Float64(Float64(exp(Float64(-x)) * 2.0) / 2.0); elseif (eps_m <= 4.5e+263) tmp = Float64(Float64(2.0 + Float64(eps_m * x)) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(1.0 - (Float64(1.0 - eps_m) ^ 2.0)) / Float64(eps_m + -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 <= 1.12e+210) tmp = (exp(-x) * 2.0) / 2.0; elseif (eps_m <= 4.5e+263) tmp = (2.0 + (eps_m * x)) / 2.0; else tmp = (2.0 + (x * ((1.0 - ((1.0 - eps_m) ^ 2.0)) / (eps_m + -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, 1.12e+210], N[(N[(N[Exp[(-x)], $MachinePrecision] * 2.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps$95$m, 4.5e+263], N[(N[(2.0 + N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(N[(1.0 - N[Power[N[(1.0 - eps$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(eps$95$m + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps_m \leq 1.12 \cdot 10^{+210}:\\
\;\;\;\;\frac{e^{-x} \cdot 2}{2}\\
\mathbf{elif}\;eps_m \leq 4.5 \cdot 10^{+263}:\\
\;\;\;\;\frac{2 + eps_m \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \frac{1 - {\left(1 - eps_m\right)}^{2}}{eps_m + -2}}{2}\\
\end{array}
\end{array}
if eps < 1.12000000000000005e210Initial program 70.9%
Simplified70.9%
Taylor expanded in eps around inf 98.1%
Taylor expanded in eps around 0 84.9%
Taylor expanded in eps around 0 73.4%
cancel-sign-sub-inv73.4%
neg-mul-173.4%
metadata-eval73.4%
neg-mul-173.4%
*-lft-identity73.4%
count-273.4%
Simplified73.4%
if 1.12000000000000005e210 < eps < 4.50000000000000014e263Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 76.4%
Taylor expanded in x around 0 45.3%
Taylor expanded in eps around inf 45.3%
if 4.50000000000000014e263 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 46.2%
Taylor expanded in x around 0 12.6%
flip--33.3%
associate-*r/33.3%
metadata-eval33.3%
sub-neg33.3%
mul-1-neg33.3%
mul-1-neg33.3%
sqr-neg33.3%
pow233.3%
metadata-eval33.3%
+-commutative33.3%
add-sqr-sqrt33.3%
sqrt-unprod0.0%
mul-1-neg0.0%
mul-1-neg0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt66.7%
Applied egg-rr66.7%
*-commutative66.7%
associate-/l*11.1%
associate-/r/66.7%
*-lft-identity66.7%
metadata-eval66.7%
times-frac66.7%
neg-mul-166.7%
neg-mul-166.7%
neg-sub066.7%
+-commutative66.7%
associate--r+66.7%
metadata-eval66.7%
neg-sub066.7%
associate-+r-66.7%
metadata-eval66.7%
associate--r-66.7%
metadata-eval66.7%
+-commutative66.7%
Simplified66.7%
Final simplification71.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 1.1e+210) (/ (* (exp (- x)) 2.0) 2.0) (/ (+ 2.0 (* eps_m x)) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.1e+210) {
tmp = (exp(-x) * 2.0) / 2.0;
} else {
tmp = (2.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 <= 1.1d+210) then
tmp = (exp(-x) * 2.0d0) / 2.0d0
else
tmp = (2.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 <= 1.1e+210) {
tmp = (Math.exp(-x) * 2.0) / 2.0;
} else {
tmp = (2.0 + (eps_m * x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.1e+210: tmp = (math.exp(-x) * 2.0) / 2.0 else: tmp = (2.0 + (eps_m * x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.1e+210) tmp = Float64(Float64(exp(Float64(-x)) * 2.0) / 2.0); else tmp = Float64(Float64(2.0 + 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 <= 1.1e+210) tmp = (exp(-x) * 2.0) / 2.0; else tmp = (2.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, 1.1e+210], N[(N[(N[Exp[(-x)], $MachinePrecision] * 2.0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps_m \leq 1.1 \cdot 10^{+210}:\\
\;\;\;\;\frac{e^{-x} \cdot 2}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + eps_m \cdot x}{2}\\
\end{array}
\end{array}
if eps < 1.09999999999999993e210Initial program 70.9%
Simplified70.9%
Taylor expanded in eps around inf 98.1%
Taylor expanded in eps around 0 84.9%
Taylor expanded in eps around 0 73.4%
cancel-sign-sub-inv73.4%
neg-mul-173.4%
metadata-eval73.4%
neg-mul-173.4%
*-lft-identity73.4%
count-273.4%
Simplified73.4%
if 1.09999999999999993e210 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 64.0%
Taylor expanded in x around 0 31.9%
Taylor expanded in eps around inf 31.9%
Final simplification69.8%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 1.0)
(/ (+ 2.0 (* x -2.0)) 2.0)
(if (<= x 5.3e+250)
0.0
(if (<= x 2.5e+291) (/ (+ 2.0 (* eps_m x)) 2.0) 0.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.0) {
tmp = (2.0 + (x * -2.0)) / 2.0;
} else if (x <= 5.3e+250) {
tmp = 0.0;
} else if (x <= 2.5e+291) {
tmp = (2.0 + (eps_m * x)) / 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 <= 1.0d0) then
tmp = (2.0d0 + (x * (-2.0d0))) / 2.0d0
else if (x <= 5.3d+250) then
tmp = 0.0d0
else if (x <= 2.5d+291) then
tmp = (2.0d0 + (eps_m * x)) / 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 <= 1.0) {
tmp = (2.0 + (x * -2.0)) / 2.0;
} else if (x <= 5.3e+250) {
tmp = 0.0;
} else if (x <= 2.5e+291) {
tmp = (2.0 + (eps_m * x)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.0: tmp = (2.0 + (x * -2.0)) / 2.0 elif x <= 5.3e+250: tmp = 0.0 elif x <= 2.5e+291: tmp = (2.0 + (eps_m * x)) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.0) tmp = Float64(Float64(2.0 + Float64(x * -2.0)) / 2.0); elseif (x <= 5.3e+250) tmp = 0.0; elseif (x <= 2.5e+291) tmp = Float64(Float64(2.0 + Float64(eps_m * x)) / 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 <= 1.0) tmp = (2.0 + (x * -2.0)) / 2.0; elseif (x <= 5.3e+250) tmp = 0.0; elseif (x <= 2.5e+291) tmp = (2.0 + (eps_m * x)) / 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, 1.0], N[(N[(2.0 + N[(x * -2.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5.3e+250], 0.0, If[LessEqual[x, 2.5e+291], N[(N[(2.0 + N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{2 + x \cdot -2}{2}\\
\mathbf{elif}\;x \leq 5.3 \cdot 10^{+250}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+291}:\\
\;\;\;\;\frac{2 + eps_m \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1Initial program 61.9%
Simplified61.9%
Taylor expanded in eps around inf 97.9%
Taylor expanded in eps around 0 87.7%
Taylor expanded in x around 0 63.9%
Taylor expanded in eps around 0 59.9%
if 1 < x < 5.2999999999999999e250 or 2.5e291 < x Initial program 99.8%
Simplified99.8%
Taylor expanded in eps around inf 99.8%
Simplified99.8%
Taylor expanded in eps around 0 55.9%
div-sub55.9%
neg-mul-155.9%
+-inverses55.9%
Simplified55.9%
if 5.2999999999999999e250 < x < 2.5e291Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 73.2%
Taylor expanded in x around 0 46.5%
Taylor expanded in eps around inf 46.6%
Final simplification58.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 230.0)
(/ (- 2.0 (* eps_m x)) 2.0)
(if (<= x 1.9e+249)
0.0
(if (<= x 8.5e+291) (/ (+ 2.0 (* eps_m x)) 2.0) 0.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 230.0) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else if (x <= 1.9e+249) {
tmp = 0.0;
} else if (x <= 8.5e+291) {
tmp = (2.0 + (eps_m * x)) / 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 <= 230.0d0) then
tmp = (2.0d0 - (eps_m * x)) / 2.0d0
else if (x <= 1.9d+249) then
tmp = 0.0d0
else if (x <= 8.5d+291) then
tmp = (2.0d0 + (eps_m * x)) / 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 <= 230.0) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else if (x <= 1.9e+249) {
tmp = 0.0;
} else if (x <= 8.5e+291) {
tmp = (2.0 + (eps_m * x)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 230.0: tmp = (2.0 - (eps_m * x)) / 2.0 elif x <= 1.9e+249: tmp = 0.0 elif x <= 8.5e+291: tmp = (2.0 + (eps_m * x)) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 230.0) tmp = Float64(Float64(2.0 - Float64(eps_m * x)) / 2.0); elseif (x <= 1.9e+249) tmp = 0.0; elseif (x <= 8.5e+291) tmp = Float64(Float64(2.0 + Float64(eps_m * x)) / 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 <= 230.0) tmp = (2.0 - (eps_m * x)) / 2.0; elseif (x <= 1.9e+249) tmp = 0.0; elseif (x <= 8.5e+291) tmp = (2.0 + (eps_m * x)) / 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, 230.0], N[(N[(2.0 - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.9e+249], 0.0, If[LessEqual[x, 8.5e+291], N[(N[(2.0 + N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 230:\\
\;\;\;\;\frac{2 - eps_m \cdot x}{2}\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+249}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+291}:\\
\;\;\;\;\frac{2 + eps_m \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 230Initial program 62.0%
Simplified62.0%
Taylor expanded in eps around inf 97.5%
Taylor expanded in eps around 0 87.3%
Taylor expanded in x around 0 63.6%
sub-neg63.6%
metadata-eval63.6%
+-commutative63.6%
add-sqr-sqrt7.5%
sqrt-unprod60.6%
mul-1-neg60.6%
mul-1-neg60.6%
sqr-neg60.6%
sqrt-unprod50.5%
add-sqr-sqrt66.1%
Applied egg-rr66.1%
associate-+r-66.1%
metadata-eval66.1%
neg-sub066.1%
Simplified66.1%
if 230 < x < 1.8999999999999999e249 or 8.5000000000000003e291 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Simplified100.0%
Taylor expanded in eps around 0 56.7%
div-sub56.7%
neg-mul-156.7%
+-inverses56.7%
Simplified56.7%
if 1.8999999999999999e249 < x < 8.5000000000000003e291Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 73.2%
Taylor expanded in x around 0 46.5%
Taylor expanded in eps around inf 46.6%
Final simplification62.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 1.0) (/ (+ 2.0 (* x -2.0)) 2.0) 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1.0) {
tmp = (2.0 + (x * -2.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 <= 1.0d0) then
tmp = (2.0d0 + (x * (-2.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 <= 1.0) {
tmp = (2.0 + (x * -2.0)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1.0: tmp = (2.0 + (x * -2.0)) / 2.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1.0) tmp = Float64(Float64(2.0 + Float64(x * -2.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 <= 1.0) tmp = (2.0 + (x * -2.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, 1.0], N[(N[(2.0 + N[(x * -2.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{2 + x \cdot -2}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1Initial program 61.9%
Simplified61.9%
Taylor expanded in eps around inf 97.9%
Taylor expanded in eps around 0 87.7%
Taylor expanded in x around 0 63.9%
Taylor expanded in eps around 0 59.9%
if 1 < x Initial program 99.8%
Simplified99.8%
Taylor expanded in eps around inf 99.8%
Simplified99.8%
Taylor expanded in eps around 0 50.8%
div-sub50.8%
neg-mul-150.8%
+-inverses50.8%
Simplified50.8%
Final simplification57.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 3350.0) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 3350.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 <= 3350.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 <= 3350.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 3350.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 3350.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 <= 3350.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, 3350.0], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3350:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 3350Initial program 62.2%
Simplified62.2%
Taylor expanded in x around 0 58.8%
if 3350 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Simplified100.0%
Taylor expanded in eps around 0 52.1%
div-sub52.1%
neg-mul-152.1%
+-inverses52.1%
Simplified52.1%
Final simplification56.8%
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 73.4%
Simplified73.4%
Taylor expanded in eps around inf 53.1%
Simplified66.7%
Taylor expanded in eps around 0 17.0%
div-sub17.0%
neg-mul-117.0%
+-inverses17.2%
Simplified17.2%
Final simplification17.2%
herbie shell --seed 2023333
(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))