
(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 1.0) (/ (/ (* eps_m (* 2.0 (* (+ x 1.0) (exp (- x))))) eps_m) 2.0) (/ (+ (exp (* x eps_m)) (exp (* x (- eps_m)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.0) {
tmp = ((eps_m * (2.0 * ((x + 1.0) * exp(-x)))) / eps_m) / 2.0;
} else {
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 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.0d0) then
tmp = ((eps_m * (2.0d0 * ((x + 1.0d0) * exp(-x)))) / eps_m) / 2.0d0
else
tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 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.0) {
tmp = ((eps_m * (2.0 * ((x + 1.0) * Math.exp(-x)))) / eps_m) / 2.0;
} else {
tmp = (Math.exp((x * eps_m)) + Math.exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.0: tmp = ((eps_m * (2.0 * ((x + 1.0) * math.exp(-x)))) / eps_m) / 2.0 else: tmp = (math.exp((x * eps_m)) + math.exp((x * -eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.0) tmp = Float64(Float64(Float64(eps_m * Float64(2.0 * Float64(Float64(x + 1.0) * exp(Float64(-x))))) / eps_m) / 2.0); else tmp = Float64(Float64(exp(Float64(x * eps_m)) + exp(Float64(x * Float64(-eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 1.0) tmp = ((eps_m * (2.0 * ((x + 1.0) * exp(-x)))) / eps_m) / 2.0; else tmp = (exp((x * eps_m)) + exp((x * -eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 1.0], N[(N[(N[(eps$95$m * N[(2.0 * N[(N[(x + 1.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 1:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(2 \cdot \left(\left(x + 1\right) \cdot e^{-x}\right)\right)}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 63.1%
Simplified54.9%
Taylor expanded in eps around 0 28.6%
associate-+r+66.3%
mul-1-neg66.3%
sub-neg66.3%
+-inverses66.3%
distribute-lft-out66.3%
distribute-rgt1-in66.3%
mul-1-neg66.3%
Simplified66.3%
if 1 < eps Initial program 100.0%
Simplified92.9%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around -inf 100.0%
rec-exp100.0%
distribute-rgt-out--100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
mul-1-neg100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Final simplification75.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ eps_m -1.0))) (/ 1.0 (exp (+ x (* x eps_m))))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (x * eps_m))))) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = (exp((x * (eps_m + (-1.0d0)))) + (1.0d0 / exp((x + (x * eps_m))))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (eps_m + -1.0))) + (1.0 / Math.exp((x + (x * eps_m))))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (eps_m + -1.0))) + (1.0 / math.exp((x + (x * eps_m))))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + Float64(1.0 / exp(Float64(x + Float64(x * eps_m))))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (eps_m + -1.0))) + (1.0 / exp((x + (x * eps_m))))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(eps\_m + -1\right)} + \frac{1}{e^{x + x \cdot eps\_m}}}{2}
\end{array}
Initial program 73.2%
Simplified67.2%
Taylor expanded in eps around inf 99.1%
Final simplification99.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -720.0)
(/ (/ (expm1 (- x)) eps_m) 2.0)
(if (<= x -5e-211)
(/
(+
2.0
(*
x
(/
(* (+ eps_m 1.0) (+ 1.0 (+ (/ 1.0 eps_m) (- (/ 1.0 eps_m) eps_m))))
(+ eps_m 1.0))))
2.0)
(if (<= x 5800000.0)
1.0
(if (<= x 9.5e+68) 0.0 (/ (/ (expm1 x) eps_m) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -720.0) {
tmp = (expm1(-x) / eps_m) / 2.0;
} else if (x <= -5e-211) {
tmp = (2.0 + (x * (((eps_m + 1.0) * (1.0 + ((1.0 / eps_m) + ((1.0 / eps_m) - eps_m)))) / (eps_m + 1.0)))) / 2.0;
} else if (x <= 5800000.0) {
tmp = 1.0;
} else if (x <= 9.5e+68) {
tmp = 0.0;
} else {
tmp = (expm1(x) / eps_m) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -720.0) {
tmp = (Math.expm1(-x) / eps_m) / 2.0;
} else if (x <= -5e-211) {
tmp = (2.0 + (x * (((eps_m + 1.0) * (1.0 + ((1.0 / eps_m) + ((1.0 / eps_m) - eps_m)))) / (eps_m + 1.0)))) / 2.0;
} else if (x <= 5800000.0) {
tmp = 1.0;
} else if (x <= 9.5e+68) {
tmp = 0.0;
} else {
tmp = (Math.expm1(x) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -720.0: tmp = (math.expm1(-x) / eps_m) / 2.0 elif x <= -5e-211: tmp = (2.0 + (x * (((eps_m + 1.0) * (1.0 + ((1.0 / eps_m) + ((1.0 / eps_m) - eps_m)))) / (eps_m + 1.0)))) / 2.0 elif x <= 5800000.0: tmp = 1.0 elif x <= 9.5e+68: tmp = 0.0 else: tmp = (math.expm1(x) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -720.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps_m) / 2.0); elseif (x <= -5e-211) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(eps_m + 1.0) * Float64(1.0 + Float64(Float64(1.0 / eps_m) + Float64(Float64(1.0 / eps_m) - eps_m)))) / Float64(eps_m + 1.0)))) / 2.0); elseif (x <= 5800000.0) tmp = 1.0; elseif (x <= 9.5e+68) tmp = 0.0; else tmp = Float64(Float64(expm1(x) / eps_m) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -720.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -5e-211], N[(N[(2.0 + N[(x * N[(N[(N[(eps$95$m + 1.0), $MachinePrecision] * N[(1.0 + N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 / eps$95$m), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5800000.0], 1.0, If[LessEqual[x, 9.5e+68], 0.0, N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -720:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq -5 \cdot 10^{-211}:\\
\;\;\;\;\frac{2 + x \cdot \frac{\left(eps\_m + 1\right) \cdot \left(1 + \left(\frac{1}{eps\_m} + \left(\frac{1}{eps\_m} - eps\_m\right)\right)\right)}{eps\_m + 1}}{2}\\
\mathbf{elif}\;x \leq 5800000:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+68}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -720Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 62.7%
Taylor expanded in eps around 0 38.5%
expm1-define38.5%
neg-mul-138.5%
Simplified38.5%
if -720 < x < -5.0000000000000002e-211Initial program 62.1%
Simplified44.1%
Taylor expanded in x around 0 57.4%
Taylor expanded in eps around 0 56.5%
associate--l+56.5%
flip-+55.5%
*-commutative55.5%
*-commutative55.5%
swap-sqr55.5%
metadata-eval55.5%
*-un-lft-identity55.5%
pow255.5%
Applied egg-rr36.0%
unpow236.0%
difference-of-squares36.0%
associate-+l+36.0%
associate--l+36.9%
associate--r-36.9%
+-inverses36.9%
associate-+l+36.9%
metadata-eval36.9%
+-commutative36.9%
associate--l+52.9%
associate--r-52.9%
+-inverses52.9%
associate-+l+52.9%
metadata-eval52.9%
+-commutative52.9%
Simplified52.9%
if -5.0000000000000002e-211 < x < 5.8e6Initial program 50.8%
Simplified50.8%
Taylor expanded in x around 0 80.3%
if 5.8e6 < x < 9.50000000000000069e68Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 73.8%
div-sub73.8%
mul-1-neg73.8%
rec-exp73.8%
+-inverses73.8%
metadata-eval73.8%
Simplified73.8%
if 9.50000000000000069e68 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 34.5%
Taylor expanded in eps around 0 1.9%
expm1-define1.9%
neg-mul-11.9%
Simplified1.9%
*-un-lft-identity1.9%
add-sqr-sqrt0.0%
sqrt-unprod33.3%
sqr-neg33.3%
sqrt-unprod33.3%
add-sqr-sqrt33.3%
Applied egg-rr33.3%
*-lft-identity33.3%
Simplified33.3%
Final simplification59.1%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -2.6e+77)
(/
(/
(*
x
(+
-1.0
(* x (+ 0.5 (* x (- (* x 0.041666666666666664) 0.16666666666666666))))))
eps_m)
2.0)
(if (<= x -5.4e-211)
(/
(+
2.0
(*
x
(/
(* (+ eps_m 1.0) (+ 1.0 (+ (/ 1.0 eps_m) (- (/ 1.0 eps_m) eps_m))))
(+ eps_m 1.0))))
2.0)
(if (<= x 5800000.0)
1.0
(if (<= x 9.2e+69) 0.0 (/ (/ (expm1 x) eps_m) 2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2.6e+77) {
tmp = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0;
} else if (x <= -5.4e-211) {
tmp = (2.0 + (x * (((eps_m + 1.0) * (1.0 + ((1.0 / eps_m) + ((1.0 / eps_m) - eps_m)))) / (eps_m + 1.0)))) / 2.0;
} else if (x <= 5800000.0) {
tmp = 1.0;
} else if (x <= 9.2e+69) {
tmp = 0.0;
} else {
tmp = (expm1(x) / eps_m) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -2.6e+77) {
tmp = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0;
} else if (x <= -5.4e-211) {
tmp = (2.0 + (x * (((eps_m + 1.0) * (1.0 + ((1.0 / eps_m) + ((1.0 / eps_m) - eps_m)))) / (eps_m + 1.0)))) / 2.0;
} else if (x <= 5800000.0) {
tmp = 1.0;
} else if (x <= 9.2e+69) {
tmp = 0.0;
} else {
tmp = (Math.expm1(x) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2.6e+77: tmp = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0 elif x <= -5.4e-211: tmp = (2.0 + (x * (((eps_m + 1.0) * (1.0 + ((1.0 / eps_m) + ((1.0 / eps_m) - eps_m)))) / (eps_m + 1.0)))) / 2.0 elif x <= 5800000.0: tmp = 1.0 elif x <= 9.2e+69: tmp = 0.0 else: tmp = (math.expm1(x) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2.6e+77) tmp = Float64(Float64(Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * Float64(Float64(x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0); elseif (x <= -5.4e-211) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(eps_m + 1.0) * Float64(1.0 + Float64(Float64(1.0 / eps_m) + Float64(Float64(1.0 / eps_m) - eps_m)))) / Float64(eps_m + 1.0)))) / 2.0); elseif (x <= 5800000.0) tmp = 1.0; elseif (x <= 9.2e+69) tmp = 0.0; else tmp = Float64(Float64(expm1(x) / eps_m) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2.6e+77], N[(N[(N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * N[(N[(x * 0.041666666666666664), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -5.4e-211], N[(N[(2.0 + N[(x * N[(N[(N[(eps$95$m + 1.0), $MachinePrecision] * N[(1.0 + N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 / eps$95$m), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5800000.0], 1.0, If[LessEqual[x, 9.2e+69], 0.0, N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+77}:\\
\;\;\;\;\frac{\frac{x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot \left(x \cdot 0.041666666666666664 - 0.16666666666666666\right)\right)\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq -5.4 \cdot 10^{-211}:\\
\;\;\;\;\frac{2 + x \cdot \frac{\left(eps\_m + 1\right) \cdot \left(1 + \left(\frac{1}{eps\_m} + \left(\frac{1}{eps\_m} - eps\_m\right)\right)\right)}{eps\_m + 1}}{2}\\
\mathbf{elif}\;x \leq 5800000:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 9.2 \cdot 10^{+69}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -2.6000000000000002e77Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 63.7%
Taylor expanded in eps around 0 37.5%
expm1-define37.5%
neg-mul-137.5%
Simplified37.5%
Taylor expanded in x around 0 37.5%
if -2.6000000000000002e77 < x < -5.3999999999999998e-211Initial program 71.4%
Simplified57.9%
Taylor expanded in x around 0 44.1%
Taylor expanded in eps around 0 43.3%
associate--l+43.3%
flip-+48.6%
*-commutative48.6%
*-commutative48.6%
swap-sqr48.6%
metadata-eval48.6%
*-un-lft-identity48.6%
pow248.6%
Applied egg-rr33.9%
unpow233.9%
difference-of-squares33.9%
associate-+l+33.9%
associate--l+34.6%
associate--r-34.6%
+-inverses34.6%
associate-+l+34.6%
metadata-eval34.6%
+-commutative34.6%
associate--l+46.7%
associate--r-46.7%
+-inverses46.7%
associate-+l+46.7%
metadata-eval46.7%
+-commutative46.7%
Simplified46.7%
if -5.3999999999999998e-211 < x < 5.8e6Initial program 50.8%
Simplified50.8%
Taylor expanded in x around 0 80.3%
if 5.8e6 < x < 9.20000000000000067e69Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 73.8%
div-sub73.8%
mul-1-neg73.8%
rec-exp73.8%
+-inverses73.8%
metadata-eval73.8%
Simplified73.8%
if 9.20000000000000067e69 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 34.5%
Taylor expanded in eps around 0 1.9%
expm1-define1.9%
neg-mul-11.9%
Simplified1.9%
*-un-lft-identity1.9%
add-sqr-sqrt0.0%
sqrt-unprod33.3%
sqr-neg33.3%
sqrt-unprod33.3%
add-sqr-sqrt33.3%
Applied egg-rr33.3%
*-lft-identity33.3%
Simplified33.3%
Final simplification58.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -4e+27)
(/ (/ (expm1 (- x)) eps_m) 2.0)
(if (<= x -2e-295)
(/ (+ (exp (* x (- -1.0 eps_m))) (+ 1.0 (* x eps_m))) 2.0)
(/ (+ (exp (* x eps_m)) (/ 1.0 (+ 1.0 (* x (+ eps_m 1.0))))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -4e+27) {
tmp = (expm1(-x) / eps_m) / 2.0;
} else if (x <= -2e-295) {
tmp = (exp((x * (-1.0 - eps_m))) + (1.0 + (x * eps_m))) / 2.0;
} else {
tmp = (exp((x * eps_m)) + (1.0 / (1.0 + (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 <= -4e+27) {
tmp = (Math.expm1(-x) / eps_m) / 2.0;
} else if (x <= -2e-295) {
tmp = (Math.exp((x * (-1.0 - eps_m))) + (1.0 + (x * eps_m))) / 2.0;
} else {
tmp = (Math.exp((x * eps_m)) + (1.0 / (1.0 + (x * (eps_m + 1.0))))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -4e+27: tmp = (math.expm1(-x) / eps_m) / 2.0 elif x <= -2e-295: tmp = (math.exp((x * (-1.0 - eps_m))) + (1.0 + (x * eps_m))) / 2.0 else: tmp = (math.exp((x * eps_m)) + (1.0 / (1.0 + (x * (eps_m + 1.0))))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -4e+27) tmp = Float64(Float64(expm1(Float64(-x)) / eps_m) / 2.0); elseif (x <= -2e-295) tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 - eps_m))) + Float64(1.0 + Float64(x * eps_m))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * eps_m)) + Float64(1.0 / Float64(1.0 + 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, -4e+27], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -2e-295], N[(N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[(1.0 + N[(x * N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{+27}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-295}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 - eps\_m\right)} + \left(1 + x \cdot eps\_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + \frac{1}{1 + x \cdot \left(eps\_m + 1\right)}}{2}\\
\end{array}
\end{array}
if x < -4.0000000000000001e27Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 60.7%
Taylor expanded in eps around 0 40.5%
expm1-define40.5%
neg-mul-140.5%
Simplified40.5%
if -4.0000000000000001e27 < x < -2.00000000000000012e-295Initial program 56.9%
Simplified43.1%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around -inf 100.0%
rec-exp100.0%
distribute-rgt-out--100.0%
Simplified100.0%
Taylor expanded in x around 0 81.1%
if -2.00000000000000012e-295 < x Initial program 73.9%
Simplified69.8%
Taylor expanded in eps around inf 98.4%
Taylor expanded in eps around inf 83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in x around 0 60.3%
+-commutative60.3%
Simplified60.3%
Final simplification62.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -6.5e+24)
(/ (/ (expm1 (- x)) eps_m) 2.0)
(if (<= x -1e-299)
(/ (+ (exp (* x (- -1.0 eps_m))) (+ 1.0 (* x eps_m))) 2.0)
(/ (+ 1.0 (exp (* x eps_m))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -6.5e+24) {
tmp = (expm1(-x) / eps_m) / 2.0;
} else if (x <= -1e-299) {
tmp = (exp((x * (-1.0 - eps_m))) + (1.0 + (x * eps_m))) / 2.0;
} else {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -6.5e+24) {
tmp = (Math.expm1(-x) / eps_m) / 2.0;
} else if (x <= -1e-299) {
tmp = (Math.exp((x * (-1.0 - eps_m))) + (1.0 + (x * eps_m))) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -6.5e+24: tmp = (math.expm1(-x) / eps_m) / 2.0 elif x <= -1e-299: tmp = (math.exp((x * (-1.0 - eps_m))) + (1.0 + (x * eps_m))) / 2.0 else: tmp = (1.0 + math.exp((x * eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -6.5e+24) tmp = Float64(Float64(expm1(Float64(-x)) / eps_m) / 2.0); elseif (x <= -1e-299) tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 - eps_m))) + Float64(1.0 + Float64(x * eps_m))) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -6.5e+24], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -1e-299], N[(N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(1.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{+24}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-299}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 - eps\_m\right)} + \left(1 + x \cdot eps\_m\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\end{array}
\end{array}
if x < -6.4999999999999996e24Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 60.7%
Taylor expanded in eps around 0 40.5%
expm1-define40.5%
neg-mul-140.5%
Simplified40.5%
if -6.4999999999999996e24 < x < -9.99999999999999992e-300Initial program 56.9%
Simplified43.1%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around -inf 100.0%
rec-exp100.0%
distribute-rgt-out--100.0%
Simplified100.0%
Taylor expanded in x around 0 81.1%
if -9.99999999999999992e-300 < x Initial program 73.9%
Simplified69.8%
Taylor expanded in eps around inf 98.4%
Taylor expanded in eps around inf 83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in x around 0 60.4%
Final simplification63.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 1.0) (/ (/ (* eps_m (* 2.0 (* (+ x 1.0) (exp (- x))))) eps_m) 2.0) (/ (* eps_m (+ x (/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) eps_m))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 1.0) {
tmp = ((eps_m * (2.0 * ((x + 1.0) * exp(-x)))) / eps_m) / 2.0;
} else {
tmp = (eps_m * (x + ((1.0 + exp((x * (-1.0 - eps_m)))) / eps_m))) / 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.0d0) then
tmp = ((eps_m * (2.0d0 * ((x + 1.0d0) * exp(-x)))) / eps_m) / 2.0d0
else
tmp = (eps_m * (x + ((1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / eps_m))) / 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.0) {
tmp = ((eps_m * (2.0 * ((x + 1.0) * Math.exp(-x)))) / eps_m) / 2.0;
} else {
tmp = (eps_m * (x + ((1.0 + Math.exp((x * (-1.0 - eps_m)))) / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 1.0: tmp = ((eps_m * (2.0 * ((x + 1.0) * math.exp(-x)))) / eps_m) / 2.0 else: tmp = (eps_m * (x + ((1.0 + math.exp((x * (-1.0 - eps_m)))) / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 1.0) tmp = Float64(Float64(Float64(eps_m * Float64(2.0 * Float64(Float64(x + 1.0) * exp(Float64(-x))))) / eps_m) / 2.0); else tmp = Float64(Float64(eps_m * Float64(x + Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / eps_m))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 1.0) tmp = ((eps_m * (2.0 * ((x + 1.0) * exp(-x)))) / eps_m) / 2.0; else tmp = (eps_m * (x + ((1.0 + exp((x * (-1.0 - eps_m)))) / eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 1.0], N[(N[(N[(eps$95$m * N[(2.0 * N[(N[(x + 1.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(eps$95$m * N[(x + N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 1:\\
\;\;\;\;\frac{\frac{eps\_m \cdot \left(2 \cdot \left(\left(x + 1\right) \cdot e^{-x}\right)\right)}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot \left(x + \frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 63.1%
Simplified54.9%
Taylor expanded in eps around 0 28.6%
associate-+r+66.3%
mul-1-neg66.3%
sub-neg66.3%
+-inverses66.3%
distribute-lft-out66.3%
distribute-rgt1-in66.3%
mul-1-neg66.3%
Simplified66.3%
if 1 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 69.5%
+-commutative69.5%
mul-1-neg69.5%
distribute-rgt-neg-in69.5%
*-commutative69.5%
distribute-rgt-neg-in69.5%
mul-1-neg69.5%
distribute-lft-in69.5%
metadata-eval69.5%
associate-*r/69.5%
metadata-eval69.5%
Simplified69.5%
Taylor expanded in eps around inf 80.9%
associate--l+80.9%
associate-*r/80.9%
associate-*r*80.9%
remove-double-neg80.9%
neg-mul-180.9%
sub-neg80.9%
associate-*r*80.9%
div-sub80.9%
Simplified80.9%
Final simplification70.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -720.0)
(/ (/ (expm1 (- x)) eps_m) 2.0)
(if (<= x -4.8e-211)
(/
(+
2.0
(*
x
(/
(* (+ eps_m 1.0) (+ 1.0 (+ (/ 1.0 eps_m) (- (/ 1.0 eps_m) eps_m))))
(+ eps_m 1.0))))
2.0)
(/ (+ 1.0 (exp (* x eps_m))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -720.0) {
tmp = (expm1(-x) / eps_m) / 2.0;
} else if (x <= -4.8e-211) {
tmp = (2.0 + (x * (((eps_m + 1.0) * (1.0 + ((1.0 / eps_m) + ((1.0 / eps_m) - eps_m)))) / (eps_m + 1.0)))) / 2.0;
} else {
tmp = (1.0 + exp((x * eps_m))) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -720.0) {
tmp = (Math.expm1(-x) / eps_m) / 2.0;
} else if (x <= -4.8e-211) {
tmp = (2.0 + (x * (((eps_m + 1.0) * (1.0 + ((1.0 / eps_m) + ((1.0 / eps_m) - eps_m)))) / (eps_m + 1.0)))) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -720.0: tmp = (math.expm1(-x) / eps_m) / 2.0 elif x <= -4.8e-211: tmp = (2.0 + (x * (((eps_m + 1.0) * (1.0 + ((1.0 / eps_m) + ((1.0 / eps_m) - eps_m)))) / (eps_m + 1.0)))) / 2.0 else: tmp = (1.0 + math.exp((x * eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -720.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps_m) / 2.0); elseif (x <= -4.8e-211) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(eps_m + 1.0) * Float64(1.0 + Float64(Float64(1.0 / eps_m) + Float64(Float64(1.0 / eps_m) - eps_m)))) / Float64(eps_m + 1.0)))) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * eps_m))) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -720.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -4.8e-211], N[(N[(2.0 + N[(x * N[(N[(N[(eps$95$m + 1.0), $MachinePrecision] * N[(1.0 + N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 / eps$95$m), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -720:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq -4.8 \cdot 10^{-211}:\\
\;\;\;\;\frac{2 + x \cdot \frac{\left(eps\_m + 1\right) \cdot \left(1 + \left(\frac{1}{eps\_m} + \left(\frac{1}{eps\_m} - eps\_m\right)\right)\right)}{eps\_m + 1}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot eps\_m}}{2}\\
\end{array}
\end{array}
if x < -720Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 62.7%
Taylor expanded in eps around 0 38.5%
expm1-define38.5%
neg-mul-138.5%
Simplified38.5%
if -720 < x < -4.8000000000000004e-211Initial program 62.1%
Simplified44.1%
Taylor expanded in x around 0 57.4%
Taylor expanded in eps around 0 56.5%
associate--l+56.5%
flip-+55.5%
*-commutative55.5%
*-commutative55.5%
swap-sqr55.5%
metadata-eval55.5%
*-un-lft-identity55.5%
pow255.5%
Applied egg-rr36.0%
unpow236.0%
difference-of-squares36.0%
associate-+l+36.0%
associate--l+36.9%
associate--r-36.9%
+-inverses36.9%
associate-+l+36.9%
metadata-eval36.9%
+-commutative36.9%
associate--l+52.9%
associate--r-52.9%
+-inverses52.9%
associate-+l+52.9%
metadata-eval52.9%
+-commutative52.9%
Simplified52.9%
if -4.8000000000000004e-211 < x Initial program 70.1%
Simplified65.9%
Taylor expanded in eps around inf 98.6%
Taylor expanded in eps around inf 85.5%
*-commutative85.5%
Simplified85.5%
Taylor expanded in x around 0 64.8%
Final simplification58.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0
(/
(/
(*
x
(+
-1.0
(*
x
(+
0.5
(* x (- (* x 0.041666666666666664) 0.16666666666666666))))))
eps_m)
2.0)))
(if (<= x -2.6e+77)
t_0
(if (<= x -4.5e-212)
(/
(+
2.0
(*
x
(/
(* (+ eps_m 1.0) (+ 1.0 (+ (/ 1.0 eps_m) (- (/ 1.0 eps_m) eps_m))))
(+ eps_m 1.0))))
2.0)
(if (<= x 5800000.0) 1.0 (if (<= x 8.4e+71) 0.0 t_0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0;
double tmp;
if (x <= -2.6e+77) {
tmp = t_0;
} else if (x <= -4.5e-212) {
tmp = (2.0 + (x * (((eps_m + 1.0) * (1.0 + ((1.0 / eps_m) + ((1.0 / eps_m) - eps_m)))) / (eps_m + 1.0)))) / 2.0;
} else if (x <= 5800000.0) {
tmp = 1.0;
} else if (x <= 8.4e+71) {
tmp = 0.0;
} else {
tmp = t_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 = ((x * ((-1.0d0) + (x * (0.5d0 + (x * ((x * 0.041666666666666664d0) - 0.16666666666666666d0)))))) / eps_m) / 2.0d0
if (x <= (-2.6d+77)) then
tmp = t_0
else if (x <= (-4.5d-212)) then
tmp = (2.0d0 + (x * (((eps_m + 1.0d0) * (1.0d0 + ((1.0d0 / eps_m) + ((1.0d0 / eps_m) - eps_m)))) / (eps_m + 1.0d0)))) / 2.0d0
else if (x <= 5800000.0d0) then
tmp = 1.0d0
else if (x <= 8.4d+71) then
tmp = 0.0d0
else
tmp = t_0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0;
double tmp;
if (x <= -2.6e+77) {
tmp = t_0;
} else if (x <= -4.5e-212) {
tmp = (2.0 + (x * (((eps_m + 1.0) * (1.0 + ((1.0 / eps_m) + ((1.0 / eps_m) - eps_m)))) / (eps_m + 1.0)))) / 2.0;
} else if (x <= 5800000.0) {
tmp = 1.0;
} else if (x <= 8.4e+71) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0 tmp = 0 if x <= -2.6e+77: tmp = t_0 elif x <= -4.5e-212: tmp = (2.0 + (x * (((eps_m + 1.0) * (1.0 + ((1.0 / eps_m) + ((1.0 / eps_m) - eps_m)))) / (eps_m + 1.0)))) / 2.0 elif x <= 5800000.0: tmp = 1.0 elif x <= 8.4e+71: tmp = 0.0 else: tmp = t_0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * Float64(Float64(x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0) tmp = 0.0 if (x <= -2.6e+77) tmp = t_0; elseif (x <= -4.5e-212) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(eps_m + 1.0) * Float64(1.0 + Float64(Float64(1.0 / eps_m) + Float64(Float64(1.0 / eps_m) - eps_m)))) / Float64(eps_m + 1.0)))) / 2.0); elseif (x <= 5800000.0) tmp = 1.0; elseif (x <= 8.4e+71) tmp = 0.0; else tmp = t_0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0; tmp = 0.0; if (x <= -2.6e+77) tmp = t_0; elseif (x <= -4.5e-212) tmp = (2.0 + (x * (((eps_m + 1.0) * (1.0 + ((1.0 / eps_m) + ((1.0 / eps_m) - eps_m)))) / (eps_m + 1.0)))) / 2.0; elseif (x <= 5800000.0) tmp = 1.0; elseif (x <= 8.4e+71) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * N[(N[(x * 0.041666666666666664), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -2.6e+77], t$95$0, If[LessEqual[x, -4.5e-212], N[(N[(2.0 + N[(x * N[(N[(N[(eps$95$m + 1.0), $MachinePrecision] * N[(1.0 + N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 / eps$95$m), $MachinePrecision] - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5800000.0], 1.0, If[LessEqual[x, 8.4e+71], 0.0, t$95$0]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \frac{\frac{x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot \left(x \cdot 0.041666666666666664 - 0.16666666666666666\right)\right)\right)}{eps\_m}}{2}\\
\mathbf{if}\;x \leq -2.6 \cdot 10^{+77}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -4.5 \cdot 10^{-212}:\\
\;\;\;\;\frac{2 + x \cdot \frac{\left(eps\_m + 1\right) \cdot \left(1 + \left(\frac{1}{eps\_m} + \left(\frac{1}{eps\_m} - eps\_m\right)\right)\right)}{eps\_m + 1}}{2}\\
\mathbf{elif}\;x \leq 5800000:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 8.4 \cdot 10^{+71}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.6000000000000002e77 or 8.39999999999999957e71 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 43.7%
Taylor expanded in eps around 0 13.2%
expm1-define13.2%
neg-mul-113.2%
Simplified13.2%
Taylor expanded in x around 0 34.6%
if -2.6000000000000002e77 < x < -4.4999999999999999e-212Initial program 71.4%
Simplified57.9%
Taylor expanded in x around 0 44.1%
Taylor expanded in eps around 0 43.3%
associate--l+43.3%
flip-+48.6%
*-commutative48.6%
*-commutative48.6%
swap-sqr48.6%
metadata-eval48.6%
*-un-lft-identity48.6%
pow248.6%
Applied egg-rr33.9%
unpow233.9%
difference-of-squares33.9%
associate-+l+33.9%
associate--l+34.6%
associate--r-34.6%
+-inverses34.6%
associate-+l+34.6%
metadata-eval34.6%
+-commutative34.6%
associate--l+46.7%
associate--r-46.7%
+-inverses46.7%
associate-+l+46.7%
metadata-eval46.7%
+-commutative46.7%
Simplified46.7%
if -4.4999999999999999e-212 < x < 5.8e6Initial program 50.8%
Simplified50.8%
Taylor expanded in x around 0 80.3%
if 5.8e6 < x < 8.39999999999999957e71Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 73.8%
div-sub73.8%
mul-1-neg73.8%
rec-exp73.8%
+-inverses73.8%
metadata-eval73.8%
Simplified73.8%
Final simplification58.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0
(/
(/
(*
x
(+
-1.0
(*
x
(+
0.5
(* x (- (* x 0.041666666666666664) 0.16666666666666666))))))
eps_m)
2.0)))
(if (<= x -2.6e+77)
t_0
(if (<= x 210.0)
(/ (- 2.0 (* x eps_m)) 2.0)
(if (<= x 8.4e+71) 0.0 t_0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0;
double tmp;
if (x <= -2.6e+77) {
tmp = t_0;
} else if (x <= 210.0) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if (x <= 8.4e+71) {
tmp = 0.0;
} else {
tmp = t_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 = ((x * ((-1.0d0) + (x * (0.5d0 + (x * ((x * 0.041666666666666664d0) - 0.16666666666666666d0)))))) / eps_m) / 2.0d0
if (x <= (-2.6d+77)) then
tmp = t_0
else if (x <= 210.0d0) then
tmp = (2.0d0 - (x * eps_m)) / 2.0d0
else if (x <= 8.4d+71) then
tmp = 0.0d0
else
tmp = t_0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0;
double tmp;
if (x <= -2.6e+77) {
tmp = t_0;
} else if (x <= 210.0) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if (x <= 8.4e+71) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0 tmp = 0 if x <= -2.6e+77: tmp = t_0 elif x <= 210.0: tmp = (2.0 - (x * eps_m)) / 2.0 elif x <= 8.4e+71: tmp = 0.0 else: tmp = t_0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(Float64(Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * Float64(Float64(x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0) tmp = 0.0 if (x <= -2.6e+77) tmp = t_0; elseif (x <= 210.0) tmp = Float64(Float64(2.0 - Float64(x * eps_m)) / 2.0); elseif (x <= 8.4e+71) tmp = 0.0; else tmp = t_0; end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0; tmp = 0.0; if (x <= -2.6e+77) tmp = t_0; elseif (x <= 210.0) tmp = (2.0 - (x * eps_m)) / 2.0; elseif (x <= 8.4e+71) tmp = 0.0; else tmp = t_0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * N[(N[(x * 0.041666666666666664), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -2.6e+77], t$95$0, If[LessEqual[x, 210.0], N[(N[(2.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8.4e+71], 0.0, t$95$0]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := \frac{\frac{x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot \left(x \cdot 0.041666666666666664 - 0.16666666666666666\right)\right)\right)}{eps\_m}}{2}\\
\mathbf{if}\;x \leq -2.6 \cdot 10^{+77}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 210:\\
\;\;\;\;\frac{2 - x \cdot eps\_m}{2}\\
\mathbf{elif}\;x \leq 8.4 \cdot 10^{+71}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.6000000000000002e77 or 8.39999999999999957e71 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 43.7%
Taylor expanded in eps around 0 13.2%
expm1-define13.2%
neg-mul-113.2%
Simplified13.2%
Taylor expanded in x around 0 34.6%
if -2.6000000000000002e77 < x < 210Initial program 57.9%
Simplified48.5%
Taylor expanded in x around 0 67.7%
Taylor expanded in eps around 0 66.9%
Taylor expanded in eps around inf 66.9%
mul-1-neg66.9%
distribute-lft-neg-out66.9%
*-commutative66.9%
Simplified66.9%
if 210 < x < 8.39999999999999957e71Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 65.3%
div-sub65.3%
mul-1-neg65.3%
rec-exp65.3%
+-inverses65.3%
metadata-eval65.3%
Simplified65.3%
Final simplification57.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 210.0) (/ (- 2.0 (* x eps_m)) 2.0) (if (<= x 2.2e+150) 0.0 (/ (/ (* x (+ -1.0 (* x 0.5))) eps_m) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 210.0) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if (x <= 2.2e+150) {
tmp = 0.0;
} else {
tmp = ((x * (-1.0 + (x * 0.5))) / eps_m) / 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 <= 210.0d0) then
tmp = (2.0d0 - (x * eps_m)) / 2.0d0
else if (x <= 2.2d+150) then
tmp = 0.0d0
else
tmp = ((x * ((-1.0d0) + (x * 0.5d0))) / eps_m) / 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 <= 210.0) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if (x <= 2.2e+150) {
tmp = 0.0;
} else {
tmp = ((x * (-1.0 + (x * 0.5))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 210.0: tmp = (2.0 - (x * eps_m)) / 2.0 elif x <= 2.2e+150: tmp = 0.0 else: tmp = ((x * (-1.0 + (x * 0.5))) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 210.0) tmp = Float64(Float64(2.0 - Float64(x * eps_m)) / 2.0); elseif (x <= 2.2e+150) tmp = 0.0; else tmp = Float64(Float64(Float64(x * Float64(-1.0 + Float64(x * 0.5))) / eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 210.0) tmp = (2.0 - (x * eps_m)) / 2.0; elseif (x <= 2.2e+150) tmp = 0.0; else tmp = ((x * (-1.0 + (x * 0.5))) / eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 210.0], N[(N[(2.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.2e+150], 0.0, N[(N[(N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 210:\\
\;\;\;\;\frac{2 - x \cdot eps\_m}{2}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+150}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \left(-1 + x \cdot 0.5\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < 210Initial program 63.3%
Simplified55.1%
Taylor expanded in x around 0 59.4%
Taylor expanded in eps around 0 62.6%
Taylor expanded in eps around inf 62.6%
mul-1-neg62.6%
distribute-lft-neg-out62.6%
*-commutative62.6%
Simplified62.6%
if 210 < x < 2.19999999999999999e150Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 55.0%
div-sub55.0%
mul-1-neg55.0%
rec-exp55.0%
+-inverses55.0%
metadata-eval55.0%
Simplified55.0%
if 2.19999999999999999e150 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 39.9%
Taylor expanded in eps around 0 1.9%
expm1-define1.9%
neg-mul-11.9%
Simplified1.9%
Taylor expanded in x around 0 36.0%
Final simplification58.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1.85e-13) (* (* x eps_m) -0.5) (if (<= x 5800000.0) 1.0 (if (<= x 1e+218) 0.0 (* eps_m (* x 0.5))))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.85e-13) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 5800000.0) {
tmp = 1.0;
} else if (x <= 1e+218) {
tmp = 0.0;
} else {
tmp = eps_m * (x * 0.5);
}
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.85d-13)) then
tmp = (x * eps_m) * (-0.5d0)
else if (x <= 5800000.0d0) then
tmp = 1.0d0
else if (x <= 1d+218) then
tmp = 0.0d0
else
tmp = eps_m * (x * 0.5d0)
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.85e-13) {
tmp = (x * eps_m) * -0.5;
} else if (x <= 5800000.0) {
tmp = 1.0;
} else if (x <= 1e+218) {
tmp = 0.0;
} else {
tmp = eps_m * (x * 0.5);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.85e-13: tmp = (x * eps_m) * -0.5 elif x <= 5800000.0: tmp = 1.0 elif x <= 1e+218: tmp = 0.0 else: tmp = eps_m * (x * 0.5) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.85e-13) tmp = Float64(Float64(x * eps_m) * -0.5); elseif (x <= 5800000.0) tmp = 1.0; elseif (x <= 1e+218) tmp = 0.0; else tmp = Float64(eps_m * Float64(x * 0.5)); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.85e-13) tmp = (x * eps_m) * -0.5; elseif (x <= 5800000.0) tmp = 1.0; elseif (x <= 1e+218) tmp = 0.0; else tmp = eps_m * (x * 0.5); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.85e-13], N[(N[(x * eps$95$m), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[x, 5800000.0], 1.0, If[LessEqual[x, 1e+218], 0.0, N[(eps$95$m * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{-13}:\\
\;\;\;\;\left(x \cdot eps\_m\right) \cdot -0.5\\
\mathbf{elif}\;x \leq 5800000:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 10^{+218}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;eps\_m \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if x < -1.84999999999999994e-13Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.1%
Taylor expanded in eps around 0 20.4%
Taylor expanded in x around 0 20.4%
neg-mul-120.4%
distribute-neg-in20.4%
metadata-eval20.4%
sub-neg20.4%
associate-+l-20.4%
+-inverses20.4%
metadata-eval20.4%
Simplified20.4%
Taylor expanded in eps around inf 20.4%
*-commutative20.4%
*-commutative20.4%
Simplified20.4%
if -1.84999999999999994e-13 < x < 5.8e6Initial program 53.3%
Simplified53.3%
Taylor expanded in x around 0 74.7%
if 5.8e6 < x < 1.00000000000000008e218Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 52.8%
div-sub52.8%
mul-1-neg52.8%
rec-exp52.8%
+-inverses52.8%
metadata-eval52.8%
Simplified52.8%
if 1.00000000000000008e218 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 43.6%
Taylor expanded in x around 0 37.7%
mul-1-neg37.7%
distribute-rgt-neg-in37.7%
*-commutative37.7%
distribute-rgt-neg-in37.7%
mul-1-neg37.7%
associate-*r*37.7%
*-commutative37.7%
associate-*l*37.7%
distribute-lft-in37.7%
metadata-eval37.7%
neg-mul-137.7%
distribute-neg-frac37.7%
metadata-eval37.7%
Simplified37.7%
Taylor expanded in eps around inf 38.0%
*-commutative38.0%
*-commutative38.0%
*-commutative38.0%
associate-*r*38.0%
Simplified38.0%
Final simplification59.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 245.0) (/ (- 2.0 (* x eps_m)) 2.0) (if (<= x 3.3e+216) 0.0 (* eps_m (* x 0.5)))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 245.0) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if (x <= 3.3e+216) {
tmp = 0.0;
} else {
tmp = eps_m * (x * 0.5);
}
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 <= 245.0d0) then
tmp = (2.0d0 - (x * eps_m)) / 2.0d0
else if (x <= 3.3d+216) then
tmp = 0.0d0
else
tmp = eps_m * (x * 0.5d0)
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 245.0) {
tmp = (2.0 - (x * eps_m)) / 2.0;
} else if (x <= 3.3e+216) {
tmp = 0.0;
} else {
tmp = eps_m * (x * 0.5);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 245.0: tmp = (2.0 - (x * eps_m)) / 2.0 elif x <= 3.3e+216: tmp = 0.0 else: tmp = eps_m * (x * 0.5) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 245.0) tmp = Float64(Float64(2.0 - Float64(x * eps_m)) / 2.0); elseif (x <= 3.3e+216) tmp = 0.0; else tmp = Float64(eps_m * Float64(x * 0.5)); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 245.0) tmp = (2.0 - (x * eps_m)) / 2.0; elseif (x <= 3.3e+216) tmp = 0.0; else tmp = eps_m * (x * 0.5); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 245.0], N[(N[(2.0 - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 3.3e+216], 0.0, N[(eps$95$m * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 245:\\
\;\;\;\;\frac{2 - x \cdot eps\_m}{2}\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{+216}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;eps\_m \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if x < 245Initial program 63.3%
Simplified55.1%
Taylor expanded in x around 0 59.4%
Taylor expanded in eps around 0 62.6%
Taylor expanded in eps around inf 62.6%
mul-1-neg62.6%
distribute-lft-neg-out62.6%
*-commutative62.6%
Simplified62.6%
if 245 < x < 3.3e216Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 50.8%
div-sub50.8%
mul-1-neg50.8%
rec-exp50.8%
+-inverses50.8%
metadata-eval50.8%
Simplified50.8%
if 3.3e216 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 43.6%
Taylor expanded in x around 0 37.7%
mul-1-neg37.7%
distribute-rgt-neg-in37.7%
*-commutative37.7%
distribute-rgt-neg-in37.7%
mul-1-neg37.7%
associate-*r*37.7%
*-commutative37.7%
associate-*l*37.7%
distribute-lft-in37.7%
metadata-eval37.7%
neg-mul-137.7%
distribute-neg-frac37.7%
metadata-eval37.7%
Simplified37.7%
Taylor expanded in eps around inf 38.0%
*-commutative38.0%
*-commutative38.0%
*-commutative38.0%
associate-*r*38.0%
Simplified38.0%
Final simplification58.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 5800000.0) 1.0 (if (<= x 6.6e+215) 0.0 (* eps_m (* x 0.5)))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 5800000.0) {
tmp = 1.0;
} else if (x <= 6.6e+215) {
tmp = 0.0;
} else {
tmp = eps_m * (x * 0.5);
}
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 <= 5800000.0d0) then
tmp = 1.0d0
else if (x <= 6.6d+215) then
tmp = 0.0d0
else
tmp = eps_m * (x * 0.5d0)
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 5800000.0) {
tmp = 1.0;
} else if (x <= 6.6e+215) {
tmp = 0.0;
} else {
tmp = eps_m * (x * 0.5);
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 5800000.0: tmp = 1.0 elif x <= 6.6e+215: tmp = 0.0 else: tmp = eps_m * (x * 0.5) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 5800000.0) tmp = 1.0; elseif (x <= 6.6e+215) tmp = 0.0; else tmp = Float64(eps_m * Float64(x * 0.5)); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 5800000.0) tmp = 1.0; elseif (x <= 6.6e+215) tmp = 0.0; else tmp = eps_m * (x * 0.5); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 5800000.0], 1.0, If[LessEqual[x, 6.6e+215], 0.0, N[(eps$95$m * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5800000:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{+215}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;eps\_m \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if x < 5.8e6Initial program 63.7%
Simplified63.7%
Taylor expanded in x around 0 58.8%
if 5.8e6 < x < 6.5999999999999997e215Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 52.8%
div-sub52.8%
mul-1-neg52.8%
rec-exp52.8%
+-inverses52.8%
metadata-eval52.8%
Simplified52.8%
if 6.5999999999999997e215 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 43.6%
Taylor expanded in x around 0 37.7%
mul-1-neg37.7%
distribute-rgt-neg-in37.7%
*-commutative37.7%
distribute-rgt-neg-in37.7%
mul-1-neg37.7%
associate-*r*37.7%
*-commutative37.7%
associate-*l*37.7%
distribute-lft-in37.7%
metadata-eval37.7%
neg-mul-137.7%
distribute-neg-frac37.7%
metadata-eval37.7%
Simplified37.7%
Taylor expanded in eps around inf 38.0%
*-commutative38.0%
*-commutative38.0%
*-commutative38.0%
associate-*r*38.0%
Simplified38.0%
Final simplification56.1%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 5800000.0) 1.0 0.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 5800000.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 <= 5800000.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 <= 5800000.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 5800000.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 5800000.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 <= 5800000.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, 5800000.0], 1.0, 0.0]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5800000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 5.8e6Initial program 63.7%
Simplified63.7%
Taylor expanded in x around 0 58.8%
if 5.8e6 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 47.1%
div-sub47.1%
mul-1-neg47.1%
rec-exp47.1%
+-inverses47.1%
metadata-eval47.1%
Simplified47.1%
Final simplification55.7%
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.2%
Simplified67.2%
Taylor expanded in eps around 0 13.9%
div-sub13.9%
mul-1-neg13.9%
rec-exp13.9%
+-inverses14.2%
metadata-eval14.2%
Simplified14.2%
herbie shell --seed 2024188
(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))