
(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 14 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 (<= x 2.4) (/ (+ (exp (* x (- eps_m))) (exp (* x eps_m))) 2.0) (/ (+ (exp (* x (+ -1.0 eps_m))) (exp (- x))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 2.4) {
tmp = (exp((x * -eps_m)) + exp((x * eps_m))) / 2.0;
} else {
tmp = (exp((x * (-1.0 + eps_m))) + exp(-x)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 2.4d0) then
tmp = (exp((x * -eps_m)) + exp((x * eps_m))) / 2.0d0
else
tmp = (exp((x * ((-1.0d0) + eps_m))) + exp(-x)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 2.4) {
tmp = (Math.exp((x * -eps_m)) + Math.exp((x * eps_m))) / 2.0;
} else {
tmp = (Math.exp((x * (-1.0 + eps_m))) + Math.exp(-x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 2.4: tmp = (math.exp((x * -eps_m)) + math.exp((x * eps_m))) / 2.0 else: tmp = (math.exp((x * (-1.0 + eps_m))) + math.exp(-x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 2.4) tmp = Float64(Float64(exp(Float64(x * Float64(-eps_m))) + exp(Float64(x * eps_m))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + exp(Float64(-x))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 2.4) tmp = (exp((x * -eps_m)) + exp((x * eps_m))) / 2.0; else tmp = (exp((x * (-1.0 + eps_m))) + exp(-x)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 2.4], N[(N[(N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.4:\\
\;\;\;\;\frac{e^{x \cdot \left(-eps\_m\right)} + e^{x \cdot eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + e^{-x}}{2}\\
\end{array}
\end{array}
if x < 2.39999999999999991Initial program 63.0%
Simplified41.9%
Taylor expanded in eps around inf 98.3%
Taylor expanded in eps around inf 98.3%
associate-*r*98.3%
neg-mul-198.3%
Simplified98.3%
Taylor expanded in eps around inf 99.0%
*-commutative99.0%
Simplified99.0%
if 2.39999999999999991 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 73.0%
neg-mul-173.0%
Simplified73.0%
Final simplification92.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= x -5e-308)
(/ (+ (exp (* x (- eps_m))) t_0) 2.0)
(/ (+ (exp (* x (+ -1.0 eps_m))) t_0) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp(-x);
double tmp;
if (x <= -5e-308) {
tmp = (exp((x * -eps_m)) + t_0) / 2.0;
} else {
tmp = (exp((x * (-1.0 + eps_m))) + t_0) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-x)
if (x <= (-5d-308)) then
tmp = (exp((x * -eps_m)) + t_0) / 2.0d0
else
tmp = (exp((x * ((-1.0d0) + eps_m))) + t_0) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp(-x);
double tmp;
if (x <= -5e-308) {
tmp = (Math.exp((x * -eps_m)) + t_0) / 2.0;
} else {
tmp = (Math.exp((x * (-1.0 + eps_m))) + t_0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp(-x) tmp = 0 if x <= -5e-308: tmp = (math.exp((x * -eps_m)) + t_0) / 2.0 else: tmp = (math.exp((x * (-1.0 + eps_m))) + t_0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(-x)) tmp = 0.0 if (x <= -5e-308) tmp = Float64(Float64(exp(Float64(x * Float64(-eps_m))) + t_0) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + t_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 (x <= -5e-308) tmp = (exp((x * -eps_m)) + t_0) / 2.0; else tmp = (exp((x * (-1.0 + eps_m))) + t_0) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[x, -5e-308], N[(N[(N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;x \leq -5 \cdot 10^{-308}:\\
\;\;\;\;\frac{e^{x \cdot \left(-eps\_m\right)} + t\_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + t\_0}{2}\\
\end{array}
\end{array}
if x < -4.99999999999999955e-308Initial program 68.0%
Simplified50.9%
Taylor expanded in eps around inf 97.6%
Taylor expanded in eps around inf 97.6%
associate-*r*97.6%
neg-mul-197.6%
Simplified97.6%
Taylor expanded in eps around 0 85.5%
if -4.99999999999999955e-308 < x Initial program 75.1%
Simplified59.9%
Taylor expanded in eps around inf 99.6%
Taylor expanded in eps around 0 80.8%
neg-mul-180.8%
Simplified80.8%
Final simplification82.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -5e-308) (/ (+ 1.0 (exp (- x (* x eps_m)))) 2.0) (/ (+ (exp (* x (+ -1.0 eps_m))) (exp (- x))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -5e-308) {
tmp = (1.0 + exp((x - (x * eps_m)))) / 2.0;
} else {
tmp = (exp((x * (-1.0 + eps_m))) + exp(-x)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-5d-308)) then
tmp = (1.0d0 + exp((x - (x * eps_m)))) / 2.0d0
else
tmp = (exp((x * ((-1.0d0) + eps_m))) + exp(-x)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -5e-308) {
tmp = (1.0 + Math.exp((x - (x * eps_m)))) / 2.0;
} else {
tmp = (Math.exp((x * (-1.0 + eps_m))) + Math.exp(-x)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -5e-308: tmp = (1.0 + math.exp((x - (x * eps_m)))) / 2.0 else: tmp = (math.exp((x * (-1.0 + eps_m))) + math.exp(-x)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -5e-308) tmp = Float64(Float64(1.0 + exp(Float64(x - Float64(x * eps_m)))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + exp(Float64(-x))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -5e-308) tmp = (1.0 + exp((x - (x * eps_m)))) / 2.0; else tmp = (exp((x * (-1.0 + eps_m))) + exp(-x)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -5e-308], N[(N[(1.0 + N[Exp[N[(x - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-308}:\\
\;\;\;\;\frac{1 + e^{x - x \cdot eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + e^{-x}}{2}\\
\end{array}
\end{array}
if x < -4.99999999999999955e-308Initial program 68.0%
Simplified68.0%
Taylor expanded in x around 0 46.3%
*-commutative46.3%
sub-neg46.3%
distribute-rgt-in46.3%
*-un-lft-identity46.3%
add-sqr-sqrt46.3%
sqrt-unprod47.8%
sqr-neg47.8%
sqrt-unprod0.0%
add-sqr-sqrt46.4%
add-sqr-sqrt46.4%
sqrt-unprod45.5%
sqr-neg45.5%
sqrt-unprod0.0%
add-sqr-sqrt40.4%
Applied egg-rr40.4%
Taylor expanded in eps around inf 69.9%
neg-mul-169.9%
sub-neg69.9%
Simplified69.9%
if -4.99999999999999955e-308 < x Initial program 75.1%
Simplified59.9%
Taylor expanded in eps around inf 99.6%
Taylor expanded in eps around 0 80.8%
neg-mul-180.8%
Simplified80.8%
Final simplification76.0%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (- -1.0 eps_m))) (exp (* x (+ -1.0 eps_m)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (-1.0 - eps_m))) + exp((x * (-1.0 + 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 * ((-1.0d0) - eps_m))) + exp((x * ((-1.0d0) + eps_m)))) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (Math.exp((x * (-1.0 - eps_m))) + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (-1.0 - eps_m))) + math.exp((x * (-1.0 + eps_m)))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(-1.0 - eps_m))) + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (-1.0 - eps_m))) + exp((x * (-1.0 + eps_m)))) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(-1 - eps\_m\right)} + e^{x \cdot \left(-1 + eps\_m\right)}}{2}
\end{array}
Initial program 72.0%
Simplified56.0%
Taylor expanded in eps around inf 98.7%
Final simplification98.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.32e+66)
(/
(/
(*
x
(+
-1.0
(* x (+ 0.5 (* x (- (* x 0.041666666666666664) 0.16666666666666666))))))
eps_m)
2.0)
(if (<= x -9e-7)
(* eps_m (+ 1.0 (* eps_m (+ -1.0 eps_m))))
(if (<= x 680.0)
1.0
(if (<= x 8.8e+33)
(/ (/ (expm1 x) eps_m) 2.0)
(if (<= x 2.3e+185)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(/
(/ (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666))))) eps_m)
2.0)))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.32e+66) {
tmp = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0;
} else if (x <= -9e-7) {
tmp = eps_m * (1.0 + (eps_m * (-1.0 + eps_m)));
} else if (x <= 680.0) {
tmp = 1.0;
} else if (x <= 8.8e+33) {
tmp = (expm1(x) / eps_m) / 2.0;
} else if (x <= 2.3e+185) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.32e+66) {
tmp = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0;
} else if (x <= -9e-7) {
tmp = eps_m * (1.0 + (eps_m * (-1.0 + eps_m)));
} else if (x <= 680.0) {
tmp = 1.0;
} else if (x <= 8.8e+33) {
tmp = (Math.expm1(x) / eps_m) / 2.0;
} else if (x <= 2.3e+185) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.32e+66: tmp = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0 elif x <= -9e-7: tmp = eps_m * (1.0 + (eps_m * (-1.0 + eps_m))) elif x <= 680.0: tmp = 1.0 elif x <= 8.8e+33: tmp = (math.expm1(x) / eps_m) / 2.0 elif x <= 2.3e+185: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 else: tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.32e+66) 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 <= -9e-7) tmp = Float64(eps_m * Float64(1.0 + Float64(eps_m * Float64(-1.0 + eps_m)))); elseif (x <= 680.0) tmp = 1.0; elseif (x <= 8.8e+33) tmp = Float64(Float64(expm1(x) / eps_m) / 2.0); elseif (x <= 2.3e+185) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666))))) / eps_m) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.32e+66], 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, -9e-7], N[(eps$95$m * N[(1.0 + N[(eps$95$m * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 680.0], 1.0, If[LessEqual[x, 8.8e+33], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.3e+185], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(x * N[(1.0 + N[(x * N[(0.5 + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $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 -1.32 \cdot 10^{+66}:\\
\;\;\;\;\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 -9 \cdot 10^{-7}:\\
\;\;\;\;eps\_m \cdot \left(1 + eps\_m \cdot \left(-1 + eps\_m\right)\right)\\
\mathbf{elif}\;x \leq 680:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{+33}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+185}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -1.32000000000000009e66Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 56.6%
Taylor expanded in eps around 0 44.8%
expm1-define44.8%
neg-mul-144.8%
Simplified44.8%
Taylor expanded in x around 0 44.8%
if -1.32000000000000009e66 < x < -8.99999999999999959e-7Initial program 80.3%
Simplified80.3%
Taylor expanded in x around 0 22.5%
Taylor expanded in x around 0 3.0%
add-sqr-sqrt2.3%
sqrt-unprod2.8%
frac-times2.8%
metadata-eval2.8%
metadata-eval2.8%
frac-times2.8%
sqrt-unprod0.8%
add-sqr-sqrt3.1%
div-inv3.1%
mul-1-neg3.1%
sub-neg3.1%
flip--3.1%
Applied egg-rr3.0%
Taylor expanded in eps around 0 41.9%
if -8.99999999999999959e-7 < x < 680Initial program 55.0%
Simplified55.0%
Taylor expanded in x around 0 44.5%
Taylor expanded in x around 0 32.6%
Taylor expanded in eps around 0 77.6%
if 680 < x < 8.79999999999999975e33Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 44.5%
*-commutative44.5%
sub-neg44.5%
distribute-rgt-in44.5%
*-un-lft-identity44.5%
add-sqr-sqrt0.0%
sqrt-unprod44.4%
sqr-neg44.4%
sqrt-unprod44.4%
add-sqr-sqrt44.4%
add-sqr-sqrt0.0%
sqrt-unprod44.4%
sqr-neg44.4%
sqrt-unprod44.4%
add-sqr-sqrt44.4%
Applied egg-rr44.4%
Taylor expanded in eps around 0 43.1%
expm1-define43.1%
Simplified43.1%
if 8.79999999999999975e33 < x < 2.3000000000000001e185Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 24.4%
Taylor expanded in x around 0 65.6%
if 2.3000000000000001e185 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 31.2%
*-commutative31.2%
sub-neg31.2%
distribute-rgt-in31.2%
*-un-lft-identity31.2%
add-sqr-sqrt0.0%
sqrt-unprod37.9%
sqr-neg37.9%
sqrt-unprod31.0%
add-sqr-sqrt31.0%
add-sqr-sqrt0.0%
sqrt-unprod47.2%
sqr-neg47.2%
sqrt-unprod47.1%
add-sqr-sqrt47.1%
Applied egg-rr47.1%
Taylor expanded in eps around 0 29.6%
expm1-define29.6%
Simplified29.6%
Taylor expanded in x around 0 29.6%
Final simplification65.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -2e-308)
(/ (+ 1.0 (exp (- x (* x eps_m)))) 2.0)
(if (or (<= x 1.08e+33) (not (<= x 7e+184)))
(/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2e-308) {
tmp = (1.0 + exp((x - (x * eps_m)))) / 2.0;
} else if ((x <= 1.08e+33) || !(x <= 7e+184)) {
tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / 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 <= (-2d-308)) then
tmp = (1.0d0 + exp((x - (x * eps_m)))) / 2.0d0
else if ((x <= 1.08d+33) .or. (.not. (x <= 7d+184))) then
tmp = (1.0d0 + exp((x * ((-1.0d0) + eps_m)))) / 2.0d0
else
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 - (1.0d0 / 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 <= -2e-308) {
tmp = (1.0 + Math.exp((x - (x * eps_m)))) / 2.0;
} else if ((x <= 1.08e+33) || !(x <= 7e+184)) {
tmp = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
} else {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -2e-308: tmp = (1.0 + math.exp((x - (x * eps_m)))) / 2.0 elif (x <= 1.08e+33) or not (x <= 7e+184): tmp = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 else: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -2e-308) tmp = Float64(Float64(1.0 + exp(Float64(x - Float64(x * eps_m)))) / 2.0); elseif ((x <= 1.08e+33) || !(x <= 7e+184)) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -2e-308) tmp = (1.0 + exp((x - (x * eps_m)))) / 2.0; elseif ((x <= 1.08e+33) || ~((x <= 7e+184))) tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0; else tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2e-308], N[(N[(1.0 + N[Exp[N[(x - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.08e+33], N[Not[LessEqual[x, 7e+184]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-308}:\\
\;\;\;\;\frac{1 + e^{x - x \cdot eps\_m}}{2}\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{+33} \lor \neg \left(x \leq 7 \cdot 10^{+184}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\end{array}
\end{array}
if x < -1.9999999999999998e-308Initial program 68.0%
Simplified68.0%
Taylor expanded in x around 0 46.3%
*-commutative46.3%
sub-neg46.3%
distribute-rgt-in46.3%
*-un-lft-identity46.3%
add-sqr-sqrt46.3%
sqrt-unprod47.8%
sqr-neg47.8%
sqrt-unprod0.0%
add-sqr-sqrt46.4%
add-sqr-sqrt46.4%
sqrt-unprod45.5%
sqr-neg45.5%
sqrt-unprod0.0%
add-sqr-sqrt40.4%
Applied egg-rr40.4%
Taylor expanded in eps around inf 69.9%
neg-mul-169.9%
sub-neg69.9%
Simplified69.9%
if -1.9999999999999998e-308 < x < 1.08000000000000005e33 or 6.99999999999999956e184 < x Initial program 68.3%
Simplified68.3%
Taylor expanded in x around 0 41.0%
Taylor expanded in eps around inf 72.3%
mul-1-neg72.3%
distribute-lft-neg-in72.3%
Simplified72.3%
if 1.08000000000000005e33 < x < 6.99999999999999956e184Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 24.4%
Taylor expanded in x around 0 65.6%
Final simplification70.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.6e-268)
(/ (+ 1.0 (exp (- x (* x eps_m)))) 2.0)
(if (<= x 6e+33)
(/ (+ (exp (* x eps_m)) (- 1.0 (* x (+ 1.0 eps_m)))) 2.0)
(if (<= x 1.1e+185)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(/ (+ 1.0 (exp (* x (+ -1.0 eps_m)))) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.6e-268) {
tmp = (1.0 + exp((x - (x * eps_m)))) / 2.0;
} else if (x <= 6e+33) {
tmp = (exp((x * eps_m)) + (1.0 - (x * (1.0 + eps_m)))) / 2.0;
} else if (x <= 1.1e+185) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (1.0 + exp((x * (-1.0 + 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 <= (-1.6d-268)) then
tmp = (1.0d0 + exp((x - (x * eps_m)))) / 2.0d0
else if (x <= 6d+33) then
tmp = (exp((x * eps_m)) + (1.0d0 - (x * (1.0d0 + eps_m)))) / 2.0d0
else if (x <= 1.1d+185) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 - (1.0d0 / eps_m))) / 2.0d0
else
tmp = (1.0d0 + exp((x * ((-1.0d0) + 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 <= -1.6e-268) {
tmp = (1.0 + Math.exp((x - (x * eps_m)))) / 2.0;
} else if (x <= 6e+33) {
tmp = (Math.exp((x * eps_m)) + (1.0 - (x * (1.0 + eps_m)))) / 2.0;
} else if (x <= 1.1e+185) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = (1.0 + Math.exp((x * (-1.0 + eps_m)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.6e-268: tmp = (1.0 + math.exp((x - (x * eps_m)))) / 2.0 elif x <= 6e+33: tmp = (math.exp((x * eps_m)) + (1.0 - (x * (1.0 + eps_m)))) / 2.0 elif x <= 1.1e+185: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 else: tmp = (1.0 + math.exp((x * (-1.0 + eps_m)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.6e-268) tmp = Float64(Float64(1.0 + exp(Float64(x - Float64(x * eps_m)))) / 2.0); elseif (x <= 6e+33) tmp = Float64(Float64(exp(Float64(x * eps_m)) + Float64(1.0 - Float64(x * Float64(1.0 + eps_m)))) / 2.0); elseif (x <= 1.1e+185) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 + eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1.6e-268) tmp = (1.0 + exp((x - (x * eps_m)))) / 2.0; elseif (x <= 6e+33) tmp = (exp((x * eps_m)) + (1.0 - (x * (1.0 + eps_m)))) / 2.0; elseif (x <= 1.1e+185) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0; else tmp = (1.0 + exp((x * (-1.0 + eps_m)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1.6e-268], N[(N[(1.0 + N[Exp[N[(x - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 6e+33], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] + N[(1.0 - N[(x * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.1e+185], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{-268}:\\
\;\;\;\;\frac{1 + e^{x - x \cdot eps\_m}}{2}\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+33}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m} + \left(1 - x \cdot \left(1 + eps\_m\right)\right)}{2}\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+185}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 + eps\_m\right)}}{2}\\
\end{array}
\end{array}
if x < -1.5999999999999999e-268Initial program 68.0%
Simplified68.0%
Taylor expanded in x around 0 44.2%
*-commutative44.2%
sub-neg44.2%
distribute-rgt-in44.2%
*-un-lft-identity44.2%
add-sqr-sqrt44.2%
sqrt-unprod45.9%
sqr-neg45.9%
sqrt-unprod0.0%
add-sqr-sqrt44.4%
add-sqr-sqrt44.4%
sqrt-unprod42.8%
sqr-neg42.8%
sqrt-unprod0.0%
add-sqr-sqrt37.6%
Applied egg-rr37.6%
Taylor expanded in eps around inf 66.8%
neg-mul-166.8%
sub-neg66.8%
Simplified66.8%
if -1.5999999999999999e-268 < x < 5.99999999999999967e33Initial program 60.7%
Simplified32.3%
Taylor expanded in eps around inf 99.4%
Taylor expanded in x around 0 86.3%
neg-mul-186.3%
distribute-rgt-neg-in86.3%
distribute-neg-in86.3%
metadata-eval86.3%
unsub-neg86.3%
Simplified86.3%
Taylor expanded in eps around inf 86.3%
*-commutative99.0%
Simplified86.3%
if 5.99999999999999967e33 < x < 1.1e185Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 24.4%
Taylor expanded in x around 0 65.6%
if 1.1e185 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 31.2%
Taylor expanded in eps around inf 31.4%
mul-1-neg31.4%
distribute-lft-neg-in31.4%
Simplified31.4%
Final simplification71.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -5200000.0)
(/ (/ (expm1 (- x)) eps_m) 2.0)
(if (<= x 600.0)
1.0
(if (<= x 5e+34)
(/ (/ (expm1 x) eps_m) 2.0)
(if (<= x 7e+184)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(/
(/ (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666))))) eps_m)
2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -5200000.0) {
tmp = (expm1(-x) / eps_m) / 2.0;
} else if (x <= 600.0) {
tmp = 1.0;
} else if (x <= 5e+34) {
tmp = (expm1(x) / eps_m) / 2.0;
} else if (x <= 7e+184) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -5200000.0) {
tmp = (Math.expm1(-x) / eps_m) / 2.0;
} else if (x <= 600.0) {
tmp = 1.0;
} else if (x <= 5e+34) {
tmp = (Math.expm1(x) / eps_m) / 2.0;
} else if (x <= 7e+184) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -5200000.0: tmp = (math.expm1(-x) / eps_m) / 2.0 elif x <= 600.0: tmp = 1.0 elif x <= 5e+34: tmp = (math.expm1(x) / eps_m) / 2.0 elif x <= 7e+184: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 else: tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -5200000.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps_m) / 2.0); elseif (x <= 600.0) tmp = 1.0; elseif (x <= 5e+34) tmp = Float64(Float64(expm1(x) / eps_m) / 2.0); elseif (x <= 7e+184) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666))))) / eps_m) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -5200000.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 600.0], 1.0, If[LessEqual[x, 5e+34], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 7e+184], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(x * N[(1.0 + N[(x * N[(0.5 + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $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 -5200000:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 600:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+34}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 7 \cdot 10^{+184}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -5.2e6Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 50.3%
Taylor expanded in eps around 0 51.4%
expm1-define51.4%
neg-mul-151.4%
Simplified51.4%
if -5.2e6 < x < 600Initial program 54.3%
Simplified54.3%
Taylor expanded in x around 0 44.0%
Taylor expanded in x around 0 32.3%
Taylor expanded in eps around 0 76.6%
if 600 < x < 4.9999999999999998e34Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 44.5%
*-commutative44.5%
sub-neg44.5%
distribute-rgt-in44.5%
*-un-lft-identity44.5%
add-sqr-sqrt0.0%
sqrt-unprod44.4%
sqr-neg44.4%
sqrt-unprod44.4%
add-sqr-sqrt44.4%
add-sqr-sqrt0.0%
sqrt-unprod44.4%
sqr-neg44.4%
sqrt-unprod44.4%
add-sqr-sqrt44.4%
Applied egg-rr44.4%
Taylor expanded in eps around 0 43.1%
expm1-define43.1%
Simplified43.1%
if 4.9999999999999998e34 < x < 6.99999999999999956e184Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 24.4%
Taylor expanded in x around 0 65.6%
if 6.99999999999999956e184 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 31.2%
*-commutative31.2%
sub-neg31.2%
distribute-rgt-in31.2%
*-un-lft-identity31.2%
add-sqr-sqrt0.0%
sqrt-unprod37.9%
sqr-neg37.9%
sqrt-unprod31.0%
add-sqr-sqrt31.0%
add-sqr-sqrt0.0%
sqrt-unprod47.2%
sqr-neg47.2%
sqrt-unprod47.1%
add-sqr-sqrt47.1%
Applied egg-rr47.1%
Taylor expanded in eps around 0 29.6%
expm1-define29.6%
Simplified29.6%
Taylor expanded in x around 0 29.6%
Final simplification66.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 440.0)
(/ (+ 1.0 (exp (- x (* x eps_m)))) 2.0)
(if (<= x 2.1e+34)
(/ (/ (expm1 x) eps_m) 2.0)
(if (<= x 9.5e+184)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(/
(/ (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666))))) eps_m)
2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 440.0) {
tmp = (1.0 + exp((x - (x * eps_m)))) / 2.0;
} else if (x <= 2.1e+34) {
tmp = (expm1(x) / eps_m) / 2.0;
} else if (x <= 9.5e+184) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 440.0) {
tmp = (1.0 + Math.exp((x - (x * eps_m)))) / 2.0;
} else if (x <= 2.1e+34) {
tmp = (Math.expm1(x) / eps_m) / 2.0;
} else if (x <= 9.5e+184) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 440.0: tmp = (1.0 + math.exp((x - (x * eps_m)))) / 2.0 elif x <= 2.1e+34: tmp = (math.expm1(x) / eps_m) / 2.0 elif x <= 9.5e+184: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 else: tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 440.0) tmp = Float64(Float64(1.0 + exp(Float64(x - Float64(x * eps_m)))) / 2.0); elseif (x <= 2.1e+34) tmp = Float64(Float64(expm1(x) / eps_m) / 2.0); elseif (x <= 9.5e+184) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666))))) / eps_m) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 440.0], N[(N[(1.0 + N[Exp[N[(x - N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.1e+34], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 9.5e+184], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(x * N[(1.0 + N[(x * N[(0.5 + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $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 440:\\
\;\;\;\;\frac{1 + e^{x - x \cdot eps\_m}}{2}\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{+34}:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+184}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < 440Initial program 63.0%
Simplified63.0%
Taylor expanded in x around 0 45.2%
*-commutative45.2%
sub-neg45.2%
distribute-rgt-in45.2%
*-un-lft-identity45.2%
add-sqr-sqrt27.2%
sqrt-unprod46.0%
sqr-neg46.0%
sqrt-unprod17.9%
add-sqr-sqrt45.2%
add-sqr-sqrt27.3%
sqrt-unprod44.1%
sqr-neg44.1%
sqrt-unprod18.4%
add-sqr-sqrt42.2%
Applied egg-rr42.2%
Taylor expanded in eps around inf 77.5%
neg-mul-177.5%
sub-neg77.5%
Simplified77.5%
if 440 < x < 2.10000000000000017e34Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 44.5%
*-commutative44.5%
sub-neg44.5%
distribute-rgt-in44.5%
*-un-lft-identity44.5%
add-sqr-sqrt0.0%
sqrt-unprod44.4%
sqr-neg44.4%
sqrt-unprod44.4%
add-sqr-sqrt44.4%
add-sqr-sqrt0.0%
sqrt-unprod44.4%
sqr-neg44.4%
sqrt-unprod44.4%
add-sqr-sqrt44.4%
Applied egg-rr44.4%
Taylor expanded in eps around 0 43.1%
expm1-define43.1%
Simplified43.1%
if 2.10000000000000017e34 < x < 9.4999999999999995e184Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 24.4%
Taylor expanded in x around 0 65.6%
if 9.4999999999999995e184 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 31.2%
*-commutative31.2%
sub-neg31.2%
distribute-rgt-in31.2%
*-un-lft-identity31.2%
add-sqr-sqrt0.0%
sqrt-unprod37.9%
sqr-neg37.9%
sqrt-unprod31.0%
add-sqr-sqrt31.0%
add-sqr-sqrt0.0%
sqrt-unprod47.2%
sqr-neg47.2%
sqrt-unprod47.1%
add-sqr-sqrt47.1%
Applied egg-rr47.1%
Taylor expanded in eps around 0 29.6%
expm1-define29.6%
Simplified29.6%
Taylor expanded in x around 0 29.6%
Final simplification70.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (- 1.0 (/ 1.0 eps_m)))
(t_1 (* eps_m (+ 1.0 (* eps_m (+ -1.0 eps_m)))))
(t_2 (+ 1.0 (/ 1.0 eps_m))))
(if (<= x -1.32e+66)
(/
(/
(*
x
(+
-1.0
(*
x
(+ 0.5 (* x (- (* x 0.041666666666666664) 0.16666666666666666))))))
eps_m)
2.0)
(if (<= x -6.6e-6)
t_1
(if (<= x 7.5e-105)
(/ (- 2.0 (* x (- (* (+ 1.0 eps_m) t_0) (* (+ -1.0 eps_m) t_2)))) 2.0)
(if (<= x 4.8e+34)
t_1
(if (<= x 8.8e+184)
(/ (+ t_2 t_0) 2.0)
(/
(/ (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666))))) eps_m)
2.0))))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = 1.0 - (1.0 / eps_m);
double t_1 = eps_m * (1.0 + (eps_m * (-1.0 + eps_m)));
double t_2 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= -1.32e+66) {
tmp = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0;
} else if (x <= -6.6e-6) {
tmp = t_1;
} else if (x <= 7.5e-105) {
tmp = (2.0 - (x * (((1.0 + eps_m) * t_0) - ((-1.0 + eps_m) * t_2)))) / 2.0;
} else if (x <= 4.8e+34) {
tmp = t_1;
} else if (x <= 8.8e+184) {
tmp = (t_2 + t_0) / 2.0;
} else {
tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / 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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 1.0d0 - (1.0d0 / eps_m)
t_1 = eps_m * (1.0d0 + (eps_m * ((-1.0d0) + eps_m)))
t_2 = 1.0d0 + (1.0d0 / eps_m)
if (x <= (-1.32d+66)) then
tmp = ((x * ((-1.0d0) + (x * (0.5d0 + (x * ((x * 0.041666666666666664d0) - 0.16666666666666666d0)))))) / eps_m) / 2.0d0
else if (x <= (-6.6d-6)) then
tmp = t_1
else if (x <= 7.5d-105) then
tmp = (2.0d0 - (x * (((1.0d0 + eps_m) * t_0) - (((-1.0d0) + eps_m) * t_2)))) / 2.0d0
else if (x <= 4.8d+34) then
tmp = t_1
else if (x <= 8.8d+184) then
tmp = (t_2 + t_0) / 2.0d0
else
tmp = ((x * (1.0d0 + (x * (0.5d0 + (x * 0.16666666666666666d0))))) / 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 t_0 = 1.0 - (1.0 / eps_m);
double t_1 = eps_m * (1.0 + (eps_m * (-1.0 + eps_m)));
double t_2 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= -1.32e+66) {
tmp = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0;
} else if (x <= -6.6e-6) {
tmp = t_1;
} else if (x <= 7.5e-105) {
tmp = (2.0 - (x * (((1.0 + eps_m) * t_0) - ((-1.0 + eps_m) * t_2)))) / 2.0;
} else if (x <= 4.8e+34) {
tmp = t_1;
} else if (x <= 8.8e+184) {
tmp = (t_2 + t_0) / 2.0;
} else {
tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = 1.0 - (1.0 / eps_m) t_1 = eps_m * (1.0 + (eps_m * (-1.0 + eps_m))) t_2 = 1.0 + (1.0 / eps_m) tmp = 0 if x <= -1.32e+66: tmp = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0 elif x <= -6.6e-6: tmp = t_1 elif x <= 7.5e-105: tmp = (2.0 - (x * (((1.0 + eps_m) * t_0) - ((-1.0 + eps_m) * t_2)))) / 2.0 elif x <= 4.8e+34: tmp = t_1 elif x <= 8.8e+184: tmp = (t_2 + t_0) / 2.0 else: tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(1.0 - Float64(1.0 / eps_m)) t_1 = Float64(eps_m * Float64(1.0 + Float64(eps_m * Float64(-1.0 + eps_m)))) t_2 = Float64(1.0 + Float64(1.0 / eps_m)) tmp = 0.0 if (x <= -1.32e+66) 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 <= -6.6e-6) tmp = t_1; elseif (x <= 7.5e-105) tmp = Float64(Float64(2.0 - Float64(x * Float64(Float64(Float64(1.0 + eps_m) * t_0) - Float64(Float64(-1.0 + eps_m) * t_2)))) / 2.0); elseif (x <= 4.8e+34) tmp = t_1; elseif (x <= 8.8e+184) tmp = Float64(Float64(t_2 + t_0) / 2.0); else tmp = Float64(Float64(Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666))))) / eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = 1.0 - (1.0 / eps_m); t_1 = eps_m * (1.0 + (eps_m * (-1.0 + eps_m))); t_2 = 1.0 + (1.0 / eps_m); tmp = 0.0; if (x <= -1.32e+66) tmp = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0; elseif (x <= -6.6e-6) tmp = t_1; elseif (x <= 7.5e-105) tmp = (2.0 - (x * (((1.0 + eps_m) * t_0) - ((-1.0 + eps_m) * t_2)))) / 2.0; elseif (x <= 4.8e+34) tmp = t_1; elseif (x <= 8.8e+184) tmp = (t_2 + t_0) / 2.0; else tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(eps$95$m * N[(1.0 + N[(eps$95$m * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.32e+66], 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, -6.6e-6], t$95$1, If[LessEqual[x, 7.5e-105], N[(N[(2.0 - N[(x * N[(N[(N[(1.0 + eps$95$m), $MachinePrecision] * t$95$0), $MachinePrecision] - N[(N[(-1.0 + eps$95$m), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.8e+34], t$95$1, If[LessEqual[x, 8.8e+184], N[(N[(t$95$2 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(x * N[(1.0 + N[(x * N[(0.5 + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := 1 - \frac{1}{eps\_m}\\
t_1 := eps\_m \cdot \left(1 + eps\_m \cdot \left(-1 + eps\_m\right)\right)\\
t_2 := 1 + \frac{1}{eps\_m}\\
\mathbf{if}\;x \leq -1.32 \cdot 10^{+66}:\\
\;\;\;\;\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 -6.6 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-105}:\\
\;\;\;\;\frac{2 - x \cdot \left(\left(1 + eps\_m\right) \cdot t\_0 - \left(-1 + eps\_m\right) \cdot t\_2\right)}{2}\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+34}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{+184}:\\
\;\;\;\;\frac{t\_2 + t\_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -1.32000000000000009e66Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 56.6%
Taylor expanded in eps around 0 44.8%
expm1-define44.8%
neg-mul-144.8%
Simplified44.8%
Taylor expanded in x around 0 44.8%
if -1.32000000000000009e66 < x < -6.60000000000000034e-6 or 7.5000000000000006e-105 < x < 4.79999999999999974e34Initial program 77.8%
Simplified77.8%
Taylor expanded in x around 0 36.3%
Taylor expanded in x around 0 11.4%
add-sqr-sqrt7.2%
sqrt-unprod8.7%
frac-times8.7%
metadata-eval8.7%
metadata-eval8.7%
frac-times8.7%
sqrt-unprod1.7%
add-sqr-sqrt7.9%
div-inv7.9%
mul-1-neg7.9%
sub-neg7.9%
flip--7.8%
Applied egg-rr7.5%
Taylor expanded in eps around 0 30.5%
if -6.60000000000000034e-6 < x < 7.5000000000000006e-105Initial program 53.3%
Simplified24.6%
Taylor expanded in x around 0 81.7%
if 4.79999999999999974e34 < x < 8.8e184Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 24.4%
Taylor expanded in x around 0 65.6%
if 8.8e184 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 31.2%
*-commutative31.2%
sub-neg31.2%
distribute-rgt-in31.2%
*-un-lft-identity31.2%
add-sqr-sqrt0.0%
sqrt-unprod37.9%
sqr-neg37.9%
sqrt-unprod31.0%
add-sqr-sqrt31.0%
add-sqr-sqrt0.0%
sqrt-unprod47.2%
sqr-neg47.2%
sqrt-unprod47.1%
add-sqr-sqrt47.1%
Applied egg-rr47.1%
Taylor expanded in eps around 0 29.6%
expm1-define29.6%
Simplified29.6%
Taylor expanded in x around 0 29.6%
Final simplification63.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* eps_m (+ 1.0 (* eps_m (+ -1.0 eps_m))))))
(if (<= x -1.32e+66)
(/
(/
(*
x
(+
-1.0
(*
x
(+ 0.5 (* x (- (* x 0.041666666666666664) 0.16666666666666666))))))
eps_m)
2.0)
(if (<= x -5.8e-8)
t_0
(if (<= x 2.1e-103)
1.0
(if (<= x 1.12e+32)
t_0
(if (<= x 1.1e+185)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(/
(/ (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666))))) eps_m)
2.0))))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = eps_m * (1.0 + (eps_m * (-1.0 + eps_m)));
double tmp;
if (x <= -1.32e+66) {
tmp = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0;
} else if (x <= -5.8e-8) {
tmp = t_0;
} else if (x <= 2.1e-103) {
tmp = 1.0;
} else if (x <= 1.12e+32) {
tmp = t_0;
} else if (x <= 1.1e+185) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / 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) :: t_0
real(8) :: tmp
t_0 = eps_m * (1.0d0 + (eps_m * ((-1.0d0) + eps_m)))
if (x <= (-1.32d+66)) then
tmp = ((x * ((-1.0d0) + (x * (0.5d0 + (x * ((x * 0.041666666666666664d0) - 0.16666666666666666d0)))))) / eps_m) / 2.0d0
else if (x <= (-5.8d-8)) then
tmp = t_0
else if (x <= 2.1d-103) then
tmp = 1.0d0
else if (x <= 1.12d+32) then
tmp = t_0
else if (x <= 1.1d+185) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 - (1.0d0 / eps_m))) / 2.0d0
else
tmp = ((x * (1.0d0 + (x * (0.5d0 + (x * 0.16666666666666666d0))))) / 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 t_0 = eps_m * (1.0 + (eps_m * (-1.0 + eps_m)));
double tmp;
if (x <= -1.32e+66) {
tmp = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0;
} else if (x <= -5.8e-8) {
tmp = t_0;
} else if (x <= 2.1e-103) {
tmp = 1.0;
} else if (x <= 1.12e+32) {
tmp = t_0;
} else if (x <= 1.1e+185) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = eps_m * (1.0 + (eps_m * (-1.0 + eps_m))) tmp = 0 if x <= -1.32e+66: tmp = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0 elif x <= -5.8e-8: tmp = t_0 elif x <= 2.1e-103: tmp = 1.0 elif x <= 1.12e+32: tmp = t_0 elif x <= 1.1e+185: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 else: tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(eps_m * Float64(1.0 + Float64(eps_m * Float64(-1.0 + eps_m)))) tmp = 0.0 if (x <= -1.32e+66) 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.8e-8) tmp = t_0; elseif (x <= 2.1e-103) tmp = 1.0; elseif (x <= 1.12e+32) tmp = t_0; elseif (x <= 1.1e+185) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666))))) / eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = eps_m * (1.0 + (eps_m * (-1.0 + eps_m))); tmp = 0.0; if (x <= -1.32e+66) tmp = ((x * (-1.0 + (x * (0.5 + (x * ((x * 0.041666666666666664) - 0.16666666666666666)))))) / eps_m) / 2.0; elseif (x <= -5.8e-8) tmp = t_0; elseif (x <= 2.1e-103) tmp = 1.0; elseif (x <= 1.12e+32) tmp = t_0; elseif (x <= 1.1e+185) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0; else tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(eps$95$m * N[(1.0 + N[(eps$95$m * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.32e+66], 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.8e-8], t$95$0, If[LessEqual[x, 2.1e-103], 1.0, If[LessEqual[x, 1.12e+32], t$95$0, If[LessEqual[x, 1.1e+185], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(x * N[(1.0 + N[(x * N[(0.5 + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := eps\_m \cdot \left(1 + eps\_m \cdot \left(-1 + eps\_m\right)\right)\\
\mathbf{if}\;x \leq -1.32 \cdot 10^{+66}:\\
\;\;\;\;\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.8 \cdot 10^{-8}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{-103}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{+32}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+185}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -1.32000000000000009e66Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 56.6%
Taylor expanded in eps around 0 44.8%
expm1-define44.8%
neg-mul-144.8%
Simplified44.8%
Taylor expanded in x around 0 44.8%
if -1.32000000000000009e66 < x < -5.8000000000000003e-8 or 2.10000000000000005e-103 < x < 1.12000000000000007e32Initial program 77.8%
Simplified77.8%
Taylor expanded in x around 0 36.3%
Taylor expanded in x around 0 11.4%
add-sqr-sqrt7.2%
sqrt-unprod8.7%
frac-times8.7%
metadata-eval8.7%
metadata-eval8.7%
frac-times8.7%
sqrt-unprod1.7%
add-sqr-sqrt7.9%
div-inv7.9%
mul-1-neg7.9%
sub-neg7.9%
flip--7.8%
Applied egg-rr7.5%
Taylor expanded in eps around 0 30.5%
if -5.8000000000000003e-8 < x < 2.10000000000000005e-103Initial program 53.3%
Simplified53.3%
Taylor expanded in x around 0 45.0%
Taylor expanded in x around 0 35.1%
Taylor expanded in eps around 0 81.7%
if 1.12000000000000007e32 < x < 1.1e185Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 24.4%
Taylor expanded in x around 0 65.6%
if 1.1e185 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 31.2%
*-commutative31.2%
sub-neg31.2%
distribute-rgt-in31.2%
*-un-lft-identity31.2%
add-sqr-sqrt0.0%
sqrt-unprod37.9%
sqr-neg37.9%
sqrt-unprod31.0%
add-sqr-sqrt31.0%
add-sqr-sqrt0.0%
sqrt-unprod47.2%
sqr-neg47.2%
sqrt-unprod47.1%
add-sqr-sqrt47.1%
Applied egg-rr47.1%
Taylor expanded in eps around 0 29.6%
expm1-define29.6%
Simplified29.6%
Taylor expanded in x around 0 29.6%
Final simplification63.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* eps_m (+ 1.0 (* eps_m (+ -1.0 eps_m))))))
(if (<= x -1e+103)
(/ (/ (* x (+ -1.0 (* x (+ 0.5 (* x -0.16666666666666666))))) eps_m) 2.0)
(if (<= x -8e-8)
t_0
(if (<= x 9e-103)
1.0
(if (<= x 4.8e+34)
t_0
(if (<= x 1.1e+185)
(/ (+ (+ 1.0 (/ 1.0 eps_m)) (- 1.0 (/ 1.0 eps_m))) 2.0)
(/
(/ (* x (+ 1.0 (* x (+ 0.5 (* x 0.16666666666666666))))) eps_m)
2.0))))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = eps_m * (1.0 + (eps_m * (-1.0 + eps_m)));
double tmp;
if (x <= -1e+103) {
tmp = ((x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666))))) / eps_m) / 2.0;
} else if (x <= -8e-8) {
tmp = t_0;
} else if (x <= 9e-103) {
tmp = 1.0;
} else if (x <= 4.8e+34) {
tmp = t_0;
} else if (x <= 1.1e+185) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / 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) :: t_0
real(8) :: tmp
t_0 = eps_m * (1.0d0 + (eps_m * ((-1.0d0) + eps_m)))
if (x <= (-1d+103)) then
tmp = ((x * ((-1.0d0) + (x * (0.5d0 + (x * (-0.16666666666666666d0)))))) / eps_m) / 2.0d0
else if (x <= (-8d-8)) then
tmp = t_0
else if (x <= 9d-103) then
tmp = 1.0d0
else if (x <= 4.8d+34) then
tmp = t_0
else if (x <= 1.1d+185) then
tmp = ((1.0d0 + (1.0d0 / eps_m)) + (1.0d0 - (1.0d0 / eps_m))) / 2.0d0
else
tmp = ((x * (1.0d0 + (x * (0.5d0 + (x * 0.16666666666666666d0))))) / 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 t_0 = eps_m * (1.0 + (eps_m * (-1.0 + eps_m)));
double tmp;
if (x <= -1e+103) {
tmp = ((x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666))))) / eps_m) / 2.0;
} else if (x <= -8e-8) {
tmp = t_0;
} else if (x <= 9e-103) {
tmp = 1.0;
} else if (x <= 4.8e+34) {
tmp = t_0;
} else if (x <= 1.1e+185) {
tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0;
} else {
tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = eps_m * (1.0 + (eps_m * (-1.0 + eps_m))) tmp = 0 if x <= -1e+103: tmp = ((x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666))))) / eps_m) / 2.0 elif x <= -8e-8: tmp = t_0 elif x <= 9e-103: tmp = 1.0 elif x <= 4.8e+34: tmp = t_0 elif x <= 1.1e+185: tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0 else: tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(eps_m * Float64(1.0 + Float64(eps_m * Float64(-1.0 + eps_m)))) tmp = 0.0 if (x <= -1e+103) tmp = Float64(Float64(Float64(x * Float64(-1.0 + Float64(x * Float64(0.5 + Float64(x * -0.16666666666666666))))) / eps_m) / 2.0); elseif (x <= -8e-8) tmp = t_0; elseif (x <= 9e-103) tmp = 1.0; elseif (x <= 4.8e+34) tmp = t_0; elseif (x <= 1.1e+185) tmp = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 - Float64(1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64(x * 0.16666666666666666))))) / eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = eps_m * (1.0 + (eps_m * (-1.0 + eps_m))); tmp = 0.0; if (x <= -1e+103) tmp = ((x * (-1.0 + (x * (0.5 + (x * -0.16666666666666666))))) / eps_m) / 2.0; elseif (x <= -8e-8) tmp = t_0; elseif (x <= 9e-103) tmp = 1.0; elseif (x <= 4.8e+34) tmp = t_0; elseif (x <= 1.1e+185) tmp = ((1.0 + (1.0 / eps_m)) + (1.0 - (1.0 / eps_m))) / 2.0; else tmp = ((x * (1.0 + (x * (0.5 + (x * 0.16666666666666666))))) / eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(eps$95$m * N[(1.0 + N[(eps$95$m * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1e+103], N[(N[(N[(x * N[(-1.0 + N[(x * N[(0.5 + N[(x * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -8e-8], t$95$0, If[LessEqual[x, 9e-103], 1.0, If[LessEqual[x, 4.8e+34], t$95$0, If[LessEqual[x, 1.1e+185], N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(x * N[(1.0 + N[(x * N[(0.5 + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := eps\_m \cdot \left(1 + eps\_m \cdot \left(-1 + eps\_m\right)\right)\\
\mathbf{if}\;x \leq -1 \cdot 10^{+103}:\\
\;\;\;\;\frac{\frac{x \cdot \left(-1 + x \cdot \left(0.5 + x \cdot -0.16666666666666666\right)\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq -8 \cdot 10^{-8}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-103}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+34}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+185}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 - \frac{1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot \left(1 + x \cdot \left(0.5 + x \cdot 0.16666666666666666\right)\right)}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -1e103Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 55.3%
Taylor expanded in eps around 0 46.2%
expm1-define46.2%
neg-mul-146.2%
Simplified46.2%
Taylor expanded in x around 0 46.2%
if -1e103 < x < -8.0000000000000002e-8 or 9e-103 < x < 4.79999999999999974e34Initial program 79.5%
Simplified79.5%
Taylor expanded in x around 0 38.8%
Taylor expanded in x around 0 10.7%
add-sqr-sqrt6.8%
sqrt-unprod8.3%
frac-times8.3%
metadata-eval8.3%
metadata-eval8.3%
frac-times8.3%
sqrt-unprod1.7%
add-sqr-sqrt7.5%
div-inv7.5%
mul-1-neg7.5%
sub-neg7.5%
flip--7.5%
Applied egg-rr7.1%
Taylor expanded in eps around 0 30.8%
if -8.0000000000000002e-8 < x < 9e-103Initial program 53.3%
Simplified53.3%
Taylor expanded in x around 0 45.0%
Taylor expanded in x around 0 35.1%
Taylor expanded in eps around 0 81.7%
if 4.79999999999999974e34 < x < 1.1e185Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 24.4%
Taylor expanded in x around 0 65.6%
if 1.1e185 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 31.2%
*-commutative31.2%
sub-neg31.2%
distribute-rgt-in31.2%
*-un-lft-identity31.2%
add-sqr-sqrt0.0%
sqrt-unprod37.9%
sqr-neg37.9%
sqrt-unprod31.0%
add-sqr-sqrt31.0%
add-sqr-sqrt0.0%
sqrt-unprod47.2%
sqr-neg47.2%
sqrt-unprod47.1%
add-sqr-sqrt47.1%
Applied egg-rr47.1%
Taylor expanded in eps around 0 29.6%
expm1-define29.6%
Simplified29.6%
Taylor expanded in x around 0 29.6%
Final simplification63.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= eps_m 2e+103) 1.0 (* eps_m (+ 1.0 (* eps_m (+ -1.0 eps_m))))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 2e+103) {
tmp = 1.0;
} else {
tmp = eps_m * (1.0 + (eps_m * (-1.0 + eps_m)));
}
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 <= 2d+103) then
tmp = 1.0d0
else
tmp = eps_m * (1.0d0 + (eps_m * ((-1.0d0) + eps_m)))
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 <= 2e+103) {
tmp = 1.0;
} else {
tmp = eps_m * (1.0 + (eps_m * (-1.0 + eps_m)));
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 2e+103: tmp = 1.0 else: tmp = eps_m * (1.0 + (eps_m * (-1.0 + eps_m))) return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 2e+103) tmp = 1.0; else tmp = Float64(eps_m * Float64(1.0 + Float64(eps_m * Float64(-1.0 + eps_m)))); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 2e+103) tmp = 1.0; else tmp = eps_m * (1.0 + (eps_m * (-1.0 + eps_m))); end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 2e+103], 1.0, N[(eps$95$m * N[(1.0 + N[(eps$95$m * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 2 \cdot 10^{+103}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;eps\_m \cdot \left(1 + eps\_m \cdot \left(-1 + eps\_m\right)\right)\\
\end{array}
\end{array}
if eps < 2e103Initial program 64.7%
Simplified64.7%
Taylor expanded in x around 0 35.2%
Taylor expanded in x around 0 30.9%
Taylor expanded in eps around 0 52.8%
if 2e103 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 64.8%
Taylor expanded in x around 0 30.5%
add-sqr-sqrt30.5%
sqrt-unprod30.5%
frac-times30.5%
metadata-eval30.5%
metadata-eval30.5%
frac-times30.5%
sqrt-unprod0.0%
add-sqr-sqrt30.5%
div-inv30.5%
mul-1-neg30.5%
sub-neg30.5%
flip--30.5%
Applied egg-rr30.5%
Taylor expanded in eps around 0 72.6%
Final simplification56.9%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 1.0)
eps_m = fabs(eps);
double code(double x, double eps_m) {
return 1.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = 1.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return 1.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return 1.0
eps_m = abs(eps) function code(x, eps_m) return 1.0 end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = 1.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := 1.0
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
1
\end{array}
Initial program 72.0%
Simplified72.0%
Taylor expanded in x around 0 41.3%
Taylor expanded in x around 0 30.8%
Taylor expanded in eps around 0 48.2%
herbie shell --seed 2024132
(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))