
(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
(let* ((t_0 (+ 1.0 (/ 1.0 eps_m)))
(t_1 (exp (- x)))
(t_2 (+ t_1 (* x t_1)))
(t_3 (exp (fma eps_m x x))))
(if (<=
(-
(* t_0 (exp (* x (+ eps_m -1.0))))
(* (exp (* x (- -1.0 eps_m))) (+ (/ 1.0 eps_m) -1.0)))
2.0)
(/ (+ t_2 t_2) 2.0)
(/ (fma t_0 (expm1 (log1p t_3)) (/ (+ 1.0 (/ -1.0 eps_m)) t_3)) 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 = exp(-x);
double t_2 = t_1 + (x * t_1);
double t_3 = exp(fma(eps_m, x, x));
double tmp;
if (((t_0 * exp((x * (eps_m + -1.0)))) - (exp((x * (-1.0 - eps_m))) * ((1.0 / eps_m) + -1.0))) <= 2.0) {
tmp = (t_2 + t_2) / 2.0;
} else {
tmp = fma(t_0, expm1(log1p(t_3)), ((1.0 + (-1.0 / eps_m)) / t_3)) / 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 = exp(Float64(-x)) t_2 = Float64(t_1 + Float64(x * t_1)) t_3 = exp(fma(eps_m, x, x)) tmp = 0.0 if (Float64(Float64(t_0 * exp(Float64(x * Float64(eps_m + -1.0)))) - Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(Float64(1.0 / eps_m) + -1.0))) <= 2.0) tmp = Float64(Float64(t_2 + t_2) / 2.0); else tmp = Float64(fma(t_0, expm1(log1p(t_3)), Float64(Float64(1.0 + Float64(-1.0 / eps_m)) / t_3)) / 2.0); end return 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[Exp[(-x)], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[(x * t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Exp[N[(eps$95$m * x + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$0 * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 / eps$95$m), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], N[(N[(t$95$2 + t$95$2), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(t$95$0 * N[(Exp[N[Log[1 + t$95$3], $MachinePrecision]] - 1), $MachinePrecision] + N[(N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := 1 + \frac{1}{eps\_m}\\
t_1 := e^{-x}\\
t_2 := t\_1 + x \cdot t\_1\\
t_3 := e^{\mathsf{fma}\left(eps\_m, x, x\right)}\\
\mathbf{if}\;t\_0 \cdot e^{x \cdot \left(eps\_m + -1\right)} - e^{x \cdot \left(-1 - eps\_m\right)} \cdot \left(\frac{1}{eps\_m} + -1\right) \leq 2:\\
\;\;\;\;\frac{t\_2 + t\_2}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_0, \mathsf{expm1}\left(\mathsf{log1p}\left(t\_3\right)\right), \frac{1 + \frac{-1}{eps\_m}}{t\_3}\right)}{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 1 (/.f64 1 eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 1 eps) x)))) (*.f64 (-.f64 (/.f64 1 eps) 1) (exp.f64 (neg.f64 (*.f64 (+.f64 1 eps) x))))) < 2Initial program 55.5%
fma-neg55.3%
/-rgt-identity55.3%
fma-neg55.5%
/-rgt-identity55.5%
distribute-rgt-neg-in55.5%
sub-neg55.5%
metadata-eval55.5%
distribute-rgt-neg-in55.5%
Simplified55.5%
Taylor expanded in eps around 0 100.0%
if 2 < (-.f64 (*.f64 (+.f64 1 (/.f64 1 eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 1 eps) x)))) (*.f64 (-.f64 (/.f64 1 eps) 1) (exp.f64 (neg.f64 (*.f64 (+.f64 1 eps) x))))) Initial program 99.0%
Simplified74.8%
pow-exp99.0%
distribute-rgt-in99.0%
neg-mul-199.0%
add-sqr-sqrt48.6%
sqrt-unprod89.9%
sqr-neg89.9%
sqrt-unprod50.4%
add-sqr-sqrt99.0%
fma-udef99.0%
expm1-log1p-u99.0%
Applied egg-rr99.0%
Final simplification99.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -2.35e-269)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(if (<= x 2.3e+91)
(/ (+ 1.0 (- (exp (* eps_m x)) (* eps_m x))) 2.0)
(/ (/ (+ (exp (- x)) (/ -1.0 (exp x))) eps_m) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -2.35e-269) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 2.3e+91) {
tmp = (1.0 + (exp((eps_m * x)) - (eps_m * x))) / 2.0;
} else {
tmp = ((exp(-x) + (-1.0 / 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 (x <= (-2.35d-269)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if (x <= 2.3d+91) then
tmp = (1.0d0 + (exp((eps_m * x)) - (eps_m * x))) / 2.0d0
else
tmp = ((exp(-x) + ((-1.0d0) / 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 (x <= -2.35e-269) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 2.3e+91) {
tmp = (1.0 + (Math.exp((eps_m * x)) - (eps_m * x))) / 2.0;
} else {
tmp = ((Math.exp(-x) + (-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 <= -2.35e-269: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif x <= 2.3e+91: tmp = (1.0 + (math.exp((eps_m * x)) - (eps_m * x))) / 2.0 else: tmp = ((math.exp(-x) + (-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 <= -2.35e-269) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif (x <= 2.3e+91) tmp = Float64(Float64(1.0 + Float64(exp(Float64(eps_m * x)) - Float64(eps_m * x))) / 2.0); else tmp = Float64(Float64(Float64(exp(Float64(-x)) + Float64(-1.0 / exp(x))) / eps_m) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -2.35e-269) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif (x <= 2.3e+91) tmp = (1.0 + (exp((eps_m * x)) - (eps_m * x))) / 2.0; else tmp = ((exp(-x) + (-1.0 / exp(x))) / eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -2.35e-269], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.3e+91], N[(N[(1.0 + N[(N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision] - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[Exp[(-x)], $MachinePrecision] + N[(-1.0 / N[Exp[x], $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 -2.35 \cdot 10^{-269}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+91}:\\
\;\;\;\;\frac{1 + \left(e^{eps\_m \cdot x} - eps\_m \cdot x\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{e^{-x} + \frac{-1}{e^{x}}}{eps\_m}}{2}\\
\end{array}
\end{array}
if x < -2.3499999999999999e-269Initial program 67.7%
fma-neg67.8%
/-rgt-identity67.8%
fma-neg67.7%
/-rgt-identity67.7%
distribute-rgt-neg-in67.7%
sub-neg67.7%
metadata-eval67.7%
distribute-rgt-neg-in67.7%
Simplified67.7%
Taylor expanded in eps around inf 96.7%
exp-prod96.7%
Applied egg-rr96.7%
Taylor expanded in x around 0 64.8%
if -2.3499999999999999e-269 < x < 2.29999999999999991e91Initial program 65.2%
fma-neg64.8%
/-rgt-identity64.8%
fma-neg65.2%
/-rgt-identity65.2%
distribute-rgt-neg-in65.2%
sub-neg65.2%
metadata-eval65.2%
distribute-rgt-neg-in65.2%
Simplified65.2%
Taylor expanded in x around 0 46.8%
Taylor expanded in eps around inf 80.4%
+-commutative80.4%
associate-*r*80.4%
sub-neg80.4%
neg-mul-180.4%
associate-*r*80.4%
neg-mul-180.4%
distribute-lft-neg-in80.4%
*-commutative80.4%
associate-*r*80.4%
neg-mul-180.4%
sub-neg80.4%
mul-1-neg80.4%
Simplified80.4%
Taylor expanded in eps around inf 80.7%
*-commutative80.7%
Simplified80.7%
if 2.29999999999999991e91 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 65.0%
Final simplification71.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* (exp (- x)) (+ 1.0 x))))
(if (<= eps_m 2e-6)
(/ (+ t_0 t_0) 2.0)
(/ (+ (exp (* x (+ eps_m -1.0))) (exp (* eps_m (- x)))) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp(-x) * (1.0 + x);
double tmp;
if (eps_m <= 2e-6) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (exp((x * (eps_m + -1.0))) + exp((eps_m * -x))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-x) * (1.0d0 + x)
if (eps_m <= 2d-6) then
tmp = (t_0 + t_0) / 2.0d0
else
tmp = (exp((x * (eps_m + (-1.0d0)))) + exp((eps_m * -x))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp(-x) * (1.0 + x);
double tmp;
if (eps_m <= 2e-6) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (Math.exp((x * (eps_m + -1.0))) + Math.exp((eps_m * -x))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp(-x) * (1.0 + x) tmp = 0 if eps_m <= 2e-6: tmp = (t_0 + t_0) / 2.0 else: tmp = (math.exp((x * (eps_m + -1.0))) + math.exp((eps_m * -x))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(exp(Float64(-x)) * Float64(1.0 + x)) tmp = 0.0 if (eps_m <= 2e-6) tmp = Float64(Float64(t_0 + t_0) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps_m + -1.0))) + exp(Float64(eps_m * Float64(-x)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp(-x) * (1.0 + x); tmp = 0.0; if (eps_m <= 2e-6) tmp = (t_0 + t_0) / 2.0; else tmp = (exp((x * (eps_m + -1.0))) + exp((eps_m * -x))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[Exp[(-x)], $MachinePrecision] * N[(1.0 + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps$95$m, 2e-6], N[(N[(t$95$0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{-x} \cdot \left(1 + x\right)\\
\mathbf{if}\;eps\_m \leq 2 \cdot 10^{-6}:\\
\;\;\;\;\frac{t\_0 + t\_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(eps\_m + -1\right)} + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\end{array}
\end{array}
if eps < 1.99999999999999991e-6Initial program 64.7%
fma-neg64.5%
/-rgt-identity64.5%
fma-neg64.7%
/-rgt-identity64.7%
distribute-rgt-neg-in64.7%
sub-neg64.7%
metadata-eval64.7%
distribute-rgt-neg-in64.7%
Simplified64.7%
Taylor expanded in eps around 0 73.1%
Simplified73.6%
if 1.99999999999999991e-6 < eps Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification80.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 0.92) (/ (+ (exp (* x (+ 1.0 eps_m))) (exp (* x (- -1.0 eps_m)))) 2.0) (/ (+ (exp (- x)) (exp (* x (+ eps_m -1.0)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 0.92) {
tmp = (exp((x * (1.0 + eps_m))) + exp((x * (-1.0 - eps_m)))) / 2.0;
} else {
tmp = (exp(-x) + exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 0.92d0) then
tmp = (exp((x * (1.0d0 + eps_m))) + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else
tmp = (exp(-x) + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 0.92) {
tmp = (Math.exp((x * (1.0 + eps_m))) + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else {
tmp = (Math.exp(-x) + Math.exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 0.92: tmp = (math.exp((x * (1.0 + eps_m))) + math.exp((x * (-1.0 - eps_m)))) / 2.0 else: tmp = (math.exp(-x) + math.exp((x * (eps_m + -1.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 0.92) tmp = Float64(Float64(exp(Float64(x * Float64(1.0 + eps_m))) + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); else tmp = Float64(Float64(exp(Float64(-x)) + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 0.92) tmp = (exp((x * (1.0 + eps_m))) + exp((x * (-1.0 - eps_m)))) / 2.0; else tmp = (exp(-x) + exp((x * (eps_m + -1.0)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 0.92], 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], N[(N[(N[Exp[(-x)], $MachinePrecision] + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.92:\\
\;\;\;\;\frac{e^{x \cdot \left(1 + eps\_m\right)} + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{-x} + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < 0.92000000000000004Initial program 63.2%
fma-neg63.0%
/-rgt-identity63.0%
fma-neg63.2%
/-rgt-identity63.2%
distribute-rgt-neg-in63.2%
sub-neg63.2%
metadata-eval63.2%
distribute-rgt-neg-in63.2%
Simplified63.2%
Taylor expanded in eps around inf 97.9%
exp-prod97.9%
Applied egg-rr97.9%
pow-exp97.9%
mul-1-neg97.9%
distribute-lft-neg-out97.9%
*-commutative97.9%
exp-prod80.2%
sub-neg80.2%
exp-sum80.2%
add-sqr-sqrt44.7%
sqrt-unprod72.8%
sqr-neg72.8%
sqrt-unprod28.1%
add-sqr-sqrt55.9%
exp-sum55.9%
add-sqr-sqrt33.7%
sqrt-unprod76.5%
sqr-neg76.5%
sqrt-unprod31.5%
add-sqr-sqrt80.7%
exp-prod98.3%
*-commutative98.3%
Applied egg-rr98.3%
if 0.92000000000000004 < x Initial program 98.8%
fma-neg98.8%
/-rgt-identity98.8%
fma-neg98.8%
/-rgt-identity98.8%
distribute-rgt-neg-in98.8%
sub-neg98.8%
metadata-eval98.8%
distribute-rgt-neg-in98.8%
Simplified98.8%
Taylor expanded in eps around inf 98.9%
Taylor expanded in eps around 0 80.0%
mul-1-neg80.0%
Simplified80.0%
Final simplification92.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (exp (* x (+ eps_m -1.0)))))
(if (<= x 3.85)
(/ (+ t_0 (exp (* eps_m (- x)))) 2.0)
(/ (+ (exp (- x)) t_0) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = exp((x * (eps_m + -1.0)));
double tmp;
if (x <= 3.85) {
tmp = (t_0 + exp((eps_m * -x))) / 2.0;
} else {
tmp = (exp(-x) + t_0) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: t_0
real(8) :: tmp
t_0 = exp((x * (eps_m + (-1.0d0))))
if (x <= 3.85d0) then
tmp = (t_0 + exp((eps_m * -x))) / 2.0d0
else
tmp = (exp(-x) + t_0) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double t_0 = Math.exp((x * (eps_m + -1.0)));
double tmp;
if (x <= 3.85) {
tmp = (t_0 + Math.exp((eps_m * -x))) / 2.0;
} else {
tmp = (Math.exp(-x) + t_0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = math.exp((x * (eps_m + -1.0))) tmp = 0 if x <= 3.85: tmp = (t_0 + math.exp((eps_m * -x))) / 2.0 else: tmp = (math.exp(-x) + t_0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = exp(Float64(x * Float64(eps_m + -1.0))) tmp = 0.0 if (x <= 3.85) tmp = Float64(Float64(t_0 + exp(Float64(eps_m * Float64(-x)))) / 2.0); else tmp = Float64(Float64(exp(Float64(-x)) + t_0) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = exp((x * (eps_m + -1.0))); tmp = 0.0; if (x <= 3.85) tmp = (t_0 + exp((eps_m * -x))) / 2.0; else tmp = (exp(-x) + t_0) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, 3.85], N[(N[(t$95$0 + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[(-x)], $MachinePrecision] + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(eps\_m + -1\right)}\\
\mathbf{if}\;x \leq 3.85:\\
\;\;\;\;\frac{t\_0 + e^{eps\_m \cdot \left(-x\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{-x} + t\_0}{2}\\
\end{array}
\end{array}
if x < 3.85000000000000009Initial program 63.2%
fma-neg63.0%
/-rgt-identity63.0%
fma-neg63.2%
/-rgt-identity63.2%
distribute-rgt-neg-in63.2%
sub-neg63.2%
metadata-eval63.2%
distribute-rgt-neg-in63.2%
Simplified63.2%
Taylor expanded in eps around inf 97.9%
Taylor expanded in eps around inf 97.9%
*-commutative97.9%
Simplified97.9%
if 3.85000000000000009 < x Initial program 98.8%
fma-neg98.8%
/-rgt-identity98.8%
fma-neg98.8%
/-rgt-identity98.8%
distribute-rgt-neg-in98.8%
sub-neg98.8%
metadata-eval98.8%
distribute-rgt-neg-in98.8%
Simplified98.8%
Taylor expanded in eps around inf 98.9%
Taylor expanded in eps around 0 80.0%
mul-1-neg80.0%
Simplified80.0%
Final simplification92.5%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -1e-287) (/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0) (/ (+ (exp (- x)) (exp (* x (+ eps_m -1.0)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1e-287) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else {
tmp = (exp(-x) + exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1d-287)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else
tmp = (exp(-x) + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1e-287) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else {
tmp = (Math.exp(-x) + Math.exp((x * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1e-287: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 else: tmp = (math.exp(-x) + math.exp((x * (eps_m + -1.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1e-287) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); else tmp = Float64(Float64(exp(Float64(-x)) + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -1e-287) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; else tmp = (exp(-x) + exp((x * (eps_m + -1.0)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -1e-287], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[(-x)], $MachinePrecision] + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-287}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{-x} + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -1.00000000000000002e-287Initial program 66.7%
fma-neg66.8%
/-rgt-identity66.8%
fma-neg66.7%
/-rgt-identity66.7%
distribute-rgt-neg-in66.7%
sub-neg66.7%
metadata-eval66.7%
distribute-rgt-neg-in66.7%
Simplified66.7%
Taylor expanded in eps around inf 97.0%
exp-prod97.0%
Applied egg-rr97.0%
Taylor expanded in x around 0 67.0%
if -1.00000000000000002e-287 < x Initial program 78.5%
fma-neg78.2%
/-rgt-identity78.2%
fma-neg78.5%
/-rgt-identity78.5%
distribute-rgt-neg-in78.5%
sub-neg78.5%
metadata-eval78.5%
distribute-rgt-neg-in78.5%
Simplified78.5%
Taylor expanded in eps around inf 98.9%
Taylor expanded in eps around 0 85.2%
mul-1-neg85.2%
Simplified85.2%
Final simplification78.4%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* x (+ 1.0 eps_m))) (t_1 (+ 1.0 (/ 1.0 eps_m))))
(if (<= x -550000000.0)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 9.6e+91)
(/ (+ 1.0 (- (exp (* eps_m x)) (* eps_m x))) 2.0)
(if (or (<= x 6e+252) (not (<= x 8.4e+273)))
(/ (+ t_1 (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/
(+
(+ 1.0 (+ (/ 1.0 eps_m) (* x (* t_1 (+ eps_m -1.0)))))
(+ 1.0 (+ (+ t_0 (* (/ 1.0 eps_m) t_0)) (/ -1.0 eps_m))))
2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = x * (1.0 + eps_m);
double t_1 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= -550000000.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 9.6e+91) {
tmp = (1.0 + (exp((eps_m * x)) - (eps_m * x))) / 2.0;
} else if ((x <= 6e+252) || !(x <= 8.4e+273)) {
tmp = (t_1 + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = ((1.0 + ((1.0 / eps_m) + (x * (t_1 * (eps_m + -1.0))))) + (1.0 + ((t_0 + ((1.0 / eps_m) * t_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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x * (1.0d0 + eps_m)
t_1 = 1.0d0 + (1.0d0 / eps_m)
if (x <= (-550000000.0d0)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 9.6d+91) then
tmp = (1.0d0 + (exp((eps_m * x)) - (eps_m * x))) / 2.0d0
else if ((x <= 6d+252) .or. (.not. (x <= 8.4d+273))) then
tmp = (t_1 + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = ((1.0d0 + ((1.0d0 / eps_m) + (x * (t_1 * (eps_m + (-1.0d0)))))) + (1.0d0 + ((t_0 + ((1.0d0 / eps_m) * t_0)) + ((-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 t_0 = x * (1.0 + eps_m);
double t_1 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= -550000000.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 9.6e+91) {
tmp = (1.0 + (Math.exp((eps_m * x)) - (eps_m * x))) / 2.0;
} else if ((x <= 6e+252) || !(x <= 8.4e+273)) {
tmp = (t_1 + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = ((1.0 + ((1.0 / eps_m) + (x * (t_1 * (eps_m + -1.0))))) + (1.0 + ((t_0 + ((1.0 / eps_m) * t_0)) + (-1.0 / eps_m)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = x * (1.0 + eps_m) t_1 = 1.0 + (1.0 / eps_m) tmp = 0 if x <= -550000000.0: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 9.6e+91: tmp = (1.0 + (math.exp((eps_m * x)) - (eps_m * x))) / 2.0 elif (x <= 6e+252) or not (x <= 8.4e+273): tmp = (t_1 + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = ((1.0 + ((1.0 / eps_m) + (x * (t_1 * (eps_m + -1.0))))) + (1.0 + ((t_0 + ((1.0 / eps_m) * t_0)) + (-1.0 / eps_m)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(x * Float64(1.0 + eps_m)) t_1 = Float64(1.0 + Float64(1.0 / eps_m)) tmp = 0.0 if (x <= -550000000.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 9.6e+91) tmp = Float64(Float64(1.0 + Float64(exp(Float64(eps_m * x)) - Float64(eps_m * x))) / 2.0); elseif ((x <= 6e+252) || !(x <= 8.4e+273)) tmp = Float64(Float64(t_1 + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(1.0 / eps_m) + Float64(x * Float64(t_1 * Float64(eps_m + -1.0))))) + Float64(1.0 + Float64(Float64(t_0 + Float64(Float64(1.0 / eps_m) * t_0)) + Float64(-1.0 / eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = x * (1.0 + eps_m); t_1 = 1.0 + (1.0 / eps_m); tmp = 0.0; if (x <= -550000000.0) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 9.6e+91) tmp = (1.0 + (exp((eps_m * x)) - (eps_m * x))) / 2.0; elseif ((x <= 6e+252) || ~((x <= 8.4e+273))) tmp = (t_1 + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = ((1.0 + ((1.0 / eps_m) + (x * (t_1 * (eps_m + -1.0))))) + (1.0 + ((t_0 + ((1.0 / eps_m) * t_0)) + (-1.0 / 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[(x * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -550000000.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 9.6e+91], N[(N[(1.0 + N[(N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision] - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 6e+252], N[Not[LessEqual[x, 8.4e+273]], $MachinePrecision]], N[(N[(t$95$1 + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(x * N[(t$95$1 * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(t$95$0 + N[(N[(1.0 / eps$95$m), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := x \cdot \left(1 + eps\_m\right)\\
t_1 := 1 + \frac{1}{eps\_m}\\
\mathbf{if}\;x \leq -550000000:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{+91}:\\
\;\;\;\;\frac{1 + \left(e^{eps\_m \cdot x} - eps\_m \cdot x\right)}{2}\\
\mathbf{elif}\;x \leq 6 \cdot 10^{+252} \lor \neg \left(x \leq 8.4 \cdot 10^{+273}\right):\\
\;\;\;\;\frac{t\_1 + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(\frac{1}{eps\_m} + x \cdot \left(t\_1 \cdot \left(eps\_m + -1\right)\right)\right)\right) + \left(1 + \left(\left(t\_0 + \frac{1}{eps\_m} \cdot t\_0\right) + \frac{-1}{eps\_m}\right)\right)}{2}\\
\end{array}
\end{array}
if x < -5.5e8Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 61.9%
Taylor expanded in eps around inf 61.9%
+-commutative61.9%
associate-*r*61.9%
sub-neg61.9%
neg-mul-161.9%
associate-*r*61.9%
neg-mul-161.9%
distribute-lft-neg-in61.9%
*-commutative61.9%
associate-*r*61.9%
neg-mul-161.9%
sub-neg61.9%
mul-1-neg61.9%
Simplified61.9%
Taylor expanded in eps around 0 100.0%
mul-1-neg100.0%
Simplified100.0%
if -5.5e8 < x < 9.59999999999999932e91Initial program 59.5%
fma-neg59.3%
/-rgt-identity59.3%
fma-neg59.5%
/-rgt-identity59.5%
distribute-rgt-neg-in59.5%
sub-neg59.5%
metadata-eval59.5%
distribute-rgt-neg-in59.5%
Simplified59.5%
Taylor expanded in x around 0 43.7%
Taylor expanded in eps around inf 81.0%
+-commutative81.0%
associate-*r*81.0%
sub-neg81.0%
neg-mul-181.0%
associate-*r*81.0%
neg-mul-181.0%
distribute-lft-neg-in81.0%
*-commutative81.0%
associate-*r*81.0%
neg-mul-181.0%
sub-neg81.0%
mul-1-neg81.0%
Simplified81.0%
Taylor expanded in eps around inf 81.5%
*-commutative81.5%
Simplified81.5%
if 9.59999999999999932e91 < x < 5.99999999999999978e252 or 8.40000000000000007e273 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 17.4%
Taylor expanded in x around 0 68.3%
if 5.99999999999999978e252 < x < 8.40000000000000007e273Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 14.8%
Taylor expanded in x around 0 28.6%
associate-*r*28.6%
sub-neg28.6%
metadata-eval28.6%
distribute-rgt-in14.5%
add-sqr-sqrt0.0%
sqrt-unprod57.6%
mul-1-neg57.6%
mul-1-neg57.6%
sqr-neg57.6%
sqrt-unprod71.7%
add-sqr-sqrt71.7%
Applied egg-rr71.7%
Final simplification80.9%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 1.0 eps_m))) (t_1 (* x (+ 1.0 eps_m))))
(if (<= x -2.35e-269)
(/ (+ 1.0 (exp (* x (- -1.0 eps_m)))) 2.0)
(if (<= x 1.25e+91)
(/ (+ 1.0 (- (exp (* eps_m x)) (* eps_m x))) 2.0)
(if (or (<= x 8e+252) (not (<= x 2.4e+273)))
(/ (+ t_0 (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/
(+
(+ 1.0 (+ (/ 1.0 eps_m) (* x (* t_0 (+ eps_m -1.0)))))
(+ 1.0 (+ (+ t_1 (* (/ 1.0 eps_m) t_1)) (/ -1.0 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 = x * (1.0 + eps_m);
double tmp;
if (x <= -2.35e-269) {
tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 1.25e+91) {
tmp = (1.0 + (exp((eps_m * x)) - (eps_m * x))) / 2.0;
} else if ((x <= 8e+252) || !(x <= 2.4e+273)) {
tmp = (t_0 + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = ((1.0 + ((1.0 / eps_m) + (x * (t_0 * (eps_m + -1.0))))) + (1.0 + ((t_1 + ((1.0 / eps_m) * t_1)) + (-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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (1.0d0 / eps_m)
t_1 = x * (1.0d0 + eps_m)
if (x <= (-2.35d-269)) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps_m)))) / 2.0d0
else if (x <= 1.25d+91) then
tmp = (1.0d0 + (exp((eps_m * x)) - (eps_m * x))) / 2.0d0
else if ((x <= 8d+252) .or. (.not. (x <= 2.4d+273))) then
tmp = (t_0 + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = ((1.0d0 + ((1.0d0 / eps_m) + (x * (t_0 * (eps_m + (-1.0d0)))))) + (1.0d0 + ((t_1 + ((1.0d0 / eps_m) * t_1)) + ((-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 t_0 = 1.0 + (1.0 / eps_m);
double t_1 = x * (1.0 + eps_m);
double tmp;
if (x <= -2.35e-269) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps_m)))) / 2.0;
} else if (x <= 1.25e+91) {
tmp = (1.0 + (Math.exp((eps_m * x)) - (eps_m * x))) / 2.0;
} else if ((x <= 8e+252) || !(x <= 2.4e+273)) {
tmp = (t_0 + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = ((1.0 + ((1.0 / eps_m) + (x * (t_0 * (eps_m + -1.0))))) + (1.0 + ((t_1 + ((1.0 / eps_m) * t_1)) + (-1.0 / 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 = x * (1.0 + eps_m) tmp = 0 if x <= -2.35e-269: tmp = (1.0 + math.exp((x * (-1.0 - eps_m)))) / 2.0 elif x <= 1.25e+91: tmp = (1.0 + (math.exp((eps_m * x)) - (eps_m * x))) / 2.0 elif (x <= 8e+252) or not (x <= 2.4e+273): tmp = (t_0 + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = ((1.0 + ((1.0 / eps_m) + (x * (t_0 * (eps_m + -1.0))))) + (1.0 + ((t_1 + ((1.0 / eps_m) * t_1)) + (-1.0 / 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(x * Float64(1.0 + eps_m)) tmp = 0.0 if (x <= -2.35e-269) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps_m)))) / 2.0); elseif (x <= 1.25e+91) tmp = Float64(Float64(1.0 + Float64(exp(Float64(eps_m * x)) - Float64(eps_m * x))) / 2.0); elseif ((x <= 8e+252) || !(x <= 2.4e+273)) tmp = Float64(Float64(t_0 + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(1.0 / eps_m) + Float64(x * Float64(t_0 * Float64(eps_m + -1.0))))) + Float64(1.0 + Float64(Float64(t_1 + Float64(Float64(1.0 / eps_m) * t_1)) + Float64(-1.0 / 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 = x * (1.0 + eps_m); tmp = 0.0; if (x <= -2.35e-269) tmp = (1.0 + exp((x * (-1.0 - eps_m)))) / 2.0; elseif (x <= 1.25e+91) tmp = (1.0 + (exp((eps_m * x)) - (eps_m * x))) / 2.0; elseif ((x <= 8e+252) || ~((x <= 2.4e+273))) tmp = (t_0 + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = ((1.0 + ((1.0 / eps_m) + (x * (t_0 * (eps_m + -1.0))))) + (1.0 + ((t_1 + ((1.0 / eps_m) * t_1)) + (-1.0 / 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[(x * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.35e-269], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.25e+91], N[(N[(1.0 + N[(N[Exp[N[(eps$95$m * x), $MachinePrecision]], $MachinePrecision] - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 8e+252], N[Not[LessEqual[x, 2.4e+273]], $MachinePrecision]], N[(N[(t$95$0 + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(x * N[(t$95$0 * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(t$95$1 + N[(N[(1.0 / eps$95$m), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := 1 + \frac{1}{eps\_m}\\
t_1 := x \cdot \left(1 + eps\_m\right)\\
\mathbf{if}\;x \leq -2.35 \cdot 10^{-269}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - eps\_m\right)}}{2}\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{+91}:\\
\;\;\;\;\frac{1 + \left(e^{eps\_m \cdot x} - eps\_m \cdot x\right)}{2}\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+252} \lor \neg \left(x \leq 2.4 \cdot 10^{+273}\right):\\
\;\;\;\;\frac{t\_0 + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(\frac{1}{eps\_m} + x \cdot \left(t\_0 \cdot \left(eps\_m + -1\right)\right)\right)\right) + \left(1 + \left(\left(t\_1 + \frac{1}{eps\_m} \cdot t\_1\right) + \frac{-1}{eps\_m}\right)\right)}{2}\\
\end{array}
\end{array}
if x < -2.3499999999999999e-269Initial program 67.7%
fma-neg67.8%
/-rgt-identity67.8%
fma-neg67.7%
/-rgt-identity67.7%
distribute-rgt-neg-in67.7%
sub-neg67.7%
metadata-eval67.7%
distribute-rgt-neg-in67.7%
Simplified67.7%
Taylor expanded in eps around inf 96.7%
exp-prod96.7%
Applied egg-rr96.7%
Taylor expanded in x around 0 64.8%
if -2.3499999999999999e-269 < x < 1.2500000000000001e91Initial program 65.2%
fma-neg64.8%
/-rgt-identity64.8%
fma-neg65.2%
/-rgt-identity65.2%
distribute-rgt-neg-in65.2%
sub-neg65.2%
metadata-eval65.2%
distribute-rgt-neg-in65.2%
Simplified65.2%
Taylor expanded in x around 0 46.8%
Taylor expanded in eps around inf 80.4%
+-commutative80.4%
associate-*r*80.4%
sub-neg80.4%
neg-mul-180.4%
associate-*r*80.4%
neg-mul-180.4%
distribute-lft-neg-in80.4%
*-commutative80.4%
associate-*r*80.4%
neg-mul-180.4%
sub-neg80.4%
mul-1-neg80.4%
Simplified80.4%
Taylor expanded in eps around inf 80.7%
*-commutative80.7%
Simplified80.7%
if 1.2500000000000001e91 < x < 8.0000000000000008e252 or 2.4000000000000002e273 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 17.4%
Taylor expanded in x around 0 68.3%
if 8.0000000000000008e252 < x < 2.4000000000000002e273Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 14.8%
Taylor expanded in x around 0 28.6%
associate-*r*28.6%
sub-neg28.6%
metadata-eval28.6%
distribute-rgt-in14.5%
add-sqr-sqrt0.0%
sqrt-unprod57.6%
mul-1-neg57.6%
mul-1-neg57.6%
sqr-neg57.6%
sqrt-unprod71.7%
add-sqr-sqrt71.7%
Applied egg-rr71.7%
Final simplification72.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(let* ((t_0 (* x (+ 1.0 eps_m))) (t_1 (+ 1.0 (/ 1.0 eps_m))))
(if (<= x -1e-287)
(/ (+ 1.0 (exp (- x))) 2.0)
(if (<= x 1.4e+93)
(/ (+ 1.0 (exp (* x (+ eps_m -1.0)))) 2.0)
(if (or (<= x 9e+252) (not (<= x 1e+274)))
(/ (+ t_1 (+ 1.0 (/ -1.0 eps_m))) 2.0)
(/
(+
(+ 1.0 (+ (/ 1.0 eps_m) (* x (* t_1 (+ eps_m -1.0)))))
(+ 1.0 (+ (+ t_0 (* (/ 1.0 eps_m) t_0)) (/ -1.0 eps_m))))
2.0))))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double t_0 = x * (1.0 + eps_m);
double t_1 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= -1e-287) {
tmp = (1.0 + exp(-x)) / 2.0;
} else if (x <= 1.4e+93) {
tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0;
} else if ((x <= 9e+252) || !(x <= 1e+274)) {
tmp = (t_1 + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = ((1.0 + ((1.0 / eps_m) + (x * (t_1 * (eps_m + -1.0))))) + (1.0 + ((t_0 + ((1.0 / eps_m) * t_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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x * (1.0d0 + eps_m)
t_1 = 1.0d0 + (1.0d0 / eps_m)
if (x <= (-1d-287)) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else if (x <= 1.4d+93) then
tmp = (1.0d0 + exp((x * (eps_m + (-1.0d0))))) / 2.0d0
else if ((x <= 9d+252) .or. (.not. (x <= 1d+274))) then
tmp = (t_1 + (1.0d0 + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = ((1.0d0 + ((1.0d0 / eps_m) + (x * (t_1 * (eps_m + (-1.0d0)))))) + (1.0d0 + ((t_0 + ((1.0d0 / eps_m) * t_0)) + ((-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 t_0 = x * (1.0 + eps_m);
double t_1 = 1.0 + (1.0 / eps_m);
double tmp;
if (x <= -1e-287) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else if (x <= 1.4e+93) {
tmp = (1.0 + Math.exp((x * (eps_m + -1.0)))) / 2.0;
} else if ((x <= 9e+252) || !(x <= 1e+274)) {
tmp = (t_1 + (1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = ((1.0 + ((1.0 / eps_m) + (x * (t_1 * (eps_m + -1.0))))) + (1.0 + ((t_0 + ((1.0 / eps_m) * t_0)) + (-1.0 / eps_m)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): t_0 = x * (1.0 + eps_m) t_1 = 1.0 + (1.0 / eps_m) tmp = 0 if x <= -1e-287: tmp = (1.0 + math.exp(-x)) / 2.0 elif x <= 1.4e+93: tmp = (1.0 + math.exp((x * (eps_m + -1.0)))) / 2.0 elif (x <= 9e+252) or not (x <= 1e+274): tmp = (t_1 + (1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = ((1.0 + ((1.0 / eps_m) + (x * (t_1 * (eps_m + -1.0))))) + (1.0 + ((t_0 + ((1.0 / eps_m) * t_0)) + (-1.0 / eps_m)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) t_0 = Float64(x * Float64(1.0 + eps_m)) t_1 = Float64(1.0 + Float64(1.0 / eps_m)) tmp = 0.0 if (x <= -1e-287) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); elseif (x <= 1.4e+93) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps_m + -1.0)))) / 2.0); elseif ((x <= 9e+252) || !(x <= 1e+274)) tmp = Float64(Float64(t_1 + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(Float64(1.0 + Float64(Float64(1.0 / eps_m) + Float64(x * Float64(t_1 * Float64(eps_m + -1.0))))) + Float64(1.0 + Float64(Float64(t_0 + Float64(Float64(1.0 / eps_m) * t_0)) + Float64(-1.0 / eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) t_0 = x * (1.0 + eps_m); t_1 = 1.0 + (1.0 / eps_m); tmp = 0.0; if (x <= -1e-287) tmp = (1.0 + exp(-x)) / 2.0; elseif (x <= 1.4e+93) tmp = (1.0 + exp((x * (eps_m + -1.0)))) / 2.0; elseif ((x <= 9e+252) || ~((x <= 1e+274))) tmp = (t_1 + (1.0 + (-1.0 / eps_m))) / 2.0; else tmp = ((1.0 + ((1.0 / eps_m) + (x * (t_1 * (eps_m + -1.0))))) + (1.0 + ((t_0 + ((1.0 / eps_m) * t_0)) + (-1.0 / 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[(x * N[(1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1e-287], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.4e+93], N[(N[(1.0 + N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 9e+252], N[Not[LessEqual[x, 1e+274]], $MachinePrecision]], N[(N[(t$95$1 + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 + N[(N[(1.0 / eps$95$m), $MachinePrecision] + N[(x * N[(t$95$1 * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(t$95$0 + N[(N[(1.0 / eps$95$m), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
t_0 := x \cdot \left(1 + eps\_m\right)\\
t_1 := 1 + \frac{1}{eps\_m}\\
\mathbf{if}\;x \leq -1 \cdot 10^{-287}:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+93}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(eps\_m + -1\right)}}{2}\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+252} \lor \neg \left(x \leq 10^{+274}\right):\\
\;\;\;\;\frac{t\_1 + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(1 + \left(\frac{1}{eps\_m} + x \cdot \left(t\_1 \cdot \left(eps\_m + -1\right)\right)\right)\right) + \left(1 + \left(\left(t\_0 + \frac{1}{eps\_m} \cdot t\_0\right) + \frac{-1}{eps\_m}\right)\right)}{2}\\
\end{array}
\end{array}
if x < -1.00000000000000002e-287Initial program 66.7%
fma-neg66.8%
/-rgt-identity66.8%
fma-neg66.7%
/-rgt-identity66.7%
distribute-rgt-neg-in66.7%
sub-neg66.7%
metadata-eval66.7%
distribute-rgt-neg-in66.7%
Simplified66.7%
Taylor expanded in x around 0 47.1%
Taylor expanded in eps around inf 76.5%
+-commutative76.5%
associate-*r*76.5%
sub-neg76.5%
neg-mul-176.5%
associate-*r*76.5%
neg-mul-176.5%
distribute-lft-neg-in76.5%
*-commutative76.5%
associate-*r*76.5%
neg-mul-176.5%
sub-neg76.5%
mul-1-neg76.5%
Simplified76.5%
Taylor expanded in eps around 0 79.4%
mul-1-neg79.4%
Simplified79.4%
if -1.00000000000000002e-287 < x < 1.39999999999999994e93Initial program 65.9%
fma-neg65.5%
/-rgt-identity65.5%
fma-neg65.9%
/-rgt-identity65.9%
distribute-rgt-neg-in65.9%
sub-neg65.9%
metadata-eval65.9%
distribute-rgt-neg-in65.9%
Simplified65.9%
Taylor expanded in x around 0 46.2%
Taylor expanded in eps around inf 79.6%
associate-*r*79.6%
sub-neg79.6%
neg-mul-179.6%
associate-*r*79.6%
associate-*r*79.6%
neg-mul-179.6%
sub-neg79.6%
mul-1-neg79.6%
Simplified79.6%
if 1.39999999999999994e93 < x < 9.0000000000000001e252 or 9.99999999999999921e273 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 17.4%
Taylor expanded in x around 0 68.3%
if 9.0000000000000001e252 < x < 9.99999999999999921e273Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 14.8%
Taylor expanded in x around 0 28.6%
associate-*r*28.6%
sub-neg28.6%
metadata-eval28.6%
distribute-rgt-in14.5%
add-sqr-sqrt0.0%
sqrt-unprod57.6%
mul-1-neg57.6%
mul-1-neg57.6%
sqr-neg57.6%
sqrt-unprod71.7%
add-sqr-sqrt71.7%
Applied egg-rr71.7%
Final simplification77.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 1600.0)
(/ (+ 1.0 (exp (- x))) 2.0)
(/
(*
x
(+
(* (+ 1.0 eps_m) (+ (/ 1.0 eps_m) -1.0))
(* (+ 1.0 (/ 1.0 eps_m)) (+ eps_m -1.0))))
2.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 1600.0) {
tmp = (1.0 + exp(-x)) / 2.0;
} else {
tmp = (x * (((1.0 + eps_m) * ((1.0 / eps_m) + -1.0)) + ((1.0 + (1.0 / eps_m)) * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 1600.0d0) then
tmp = (1.0d0 + exp(-x)) / 2.0d0
else
tmp = (x * (((1.0d0 + eps_m) * ((1.0d0 / eps_m) + (-1.0d0))) + ((1.0d0 + (1.0d0 / eps_m)) * (eps_m + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 1600.0) {
tmp = (1.0 + Math.exp(-x)) / 2.0;
} else {
tmp = (x * (((1.0 + eps_m) * ((1.0 / eps_m) + -1.0)) + ((1.0 + (1.0 / eps_m)) * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 1600.0: tmp = (1.0 + math.exp(-x)) / 2.0 else: tmp = (x * (((1.0 + eps_m) * ((1.0 / eps_m) + -1.0)) + ((1.0 + (1.0 / eps_m)) * (eps_m + -1.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 1600.0) tmp = Float64(Float64(1.0 + exp(Float64(-x))) / 2.0); else tmp = Float64(Float64(x * Float64(Float64(Float64(1.0 + eps_m) * Float64(Float64(1.0 / eps_m) + -1.0)) + Float64(Float64(1.0 + Float64(1.0 / eps_m)) * Float64(eps_m + -1.0)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 1600.0) tmp = (1.0 + exp(-x)) / 2.0; else tmp = (x * (((1.0 + eps_m) * ((1.0 / eps_m) + -1.0)) + ((1.0 + (1.0 / eps_m)) * (eps_m + -1.0)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 1600.0], N[(N[(1.0 + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * N[(N[(N[(1.0 + eps$95$m), $MachinePrecision] * N[(N[(1.0 / eps$95$m), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1600:\\
\;\;\;\;\frac{1 + e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(\left(1 + eps\_m\right) \cdot \left(\frac{1}{eps\_m} + -1\right) + \left(1 + \frac{1}{eps\_m}\right) \cdot \left(eps\_m + -1\right)\right)}{2}\\
\end{array}
\end{array}
if x < 1600Initial program 63.1%
fma-neg62.9%
/-rgt-identity62.9%
fma-neg63.1%
/-rgt-identity63.1%
distribute-rgt-neg-in63.1%
sub-neg63.1%
metadata-eval63.1%
distribute-rgt-neg-in63.1%
Simplified63.1%
Taylor expanded in x around 0 48.7%
Taylor expanded in eps around inf 82.7%
+-commutative82.7%
associate-*r*82.7%
sub-neg82.7%
neg-mul-182.7%
associate-*r*82.7%
neg-mul-182.7%
distribute-lft-neg-in82.7%
*-commutative82.7%
associate-*r*82.7%
neg-mul-182.7%
sub-neg82.7%
mul-1-neg82.7%
Simplified82.7%
Taylor expanded in eps around 0 76.1%
mul-1-neg76.1%
Simplified76.1%
if 1600 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 23.0%
Taylor expanded in x around 0 26.8%
Taylor expanded in x around inf 57.3%
distribute-lft-out--57.3%
*-commutative57.3%
sub-neg57.3%
metadata-eval57.3%
+-commutative57.3%
Simplified57.3%
Final simplification70.5%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x 330.0)
(/ (- 2.0 (* eps_m x)) 2.0)
(/
(*
x
(+
(* (+ 1.0 eps_m) (+ (/ 1.0 eps_m) -1.0))
(* (+ 1.0 (/ 1.0 eps_m)) (+ eps_m -1.0))))
2.0)))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 330.0) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else {
tmp = (x * (((1.0 + eps_m) * ((1.0 / eps_m) + -1.0)) + ((1.0 + (1.0 / eps_m)) * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 330.0d0) then
tmp = (2.0d0 - (eps_m * x)) / 2.0d0
else
tmp = (x * (((1.0d0 + eps_m) * ((1.0d0 / eps_m) + (-1.0d0))) + ((1.0d0 + (1.0d0 / eps_m)) * (eps_m + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 330.0) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else {
tmp = (x * (((1.0 + eps_m) * ((1.0 / eps_m) + -1.0)) + ((1.0 + (1.0 / eps_m)) * (eps_m + -1.0)))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 330.0: tmp = (2.0 - (eps_m * x)) / 2.0 else: tmp = (x * (((1.0 + eps_m) * ((1.0 / eps_m) + -1.0)) + ((1.0 + (1.0 / eps_m)) * (eps_m + -1.0)))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 330.0) tmp = Float64(Float64(2.0 - Float64(eps_m * x)) / 2.0); else tmp = Float64(Float64(x * Float64(Float64(Float64(1.0 + eps_m) * Float64(Float64(1.0 / eps_m) + -1.0)) + Float64(Float64(1.0 + Float64(1.0 / eps_m)) * Float64(eps_m + -1.0)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 330.0) tmp = (2.0 - (eps_m * x)) / 2.0; else tmp = (x * (((1.0 + eps_m) * ((1.0 / eps_m) + -1.0)) + ((1.0 + (1.0 / eps_m)) * (eps_m + -1.0)))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 330.0], N[(N[(2.0 - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * N[(N[(N[(1.0 + eps$95$m), $MachinePrecision] * N[(N[(1.0 / eps$95$m), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 330:\\
\;\;\;\;\frac{2 - eps\_m \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(\left(1 + eps\_m\right) \cdot \left(\frac{1}{eps\_m} + -1\right) + \left(1 + \frac{1}{eps\_m}\right) \cdot \left(eps\_m + -1\right)\right)}{2}\\
\end{array}
\end{array}
if x < 330Initial program 62.9%
fma-neg62.7%
/-rgt-identity62.7%
fma-neg62.9%
/-rgt-identity62.9%
distribute-rgt-neg-in62.9%
sub-neg62.9%
metadata-eval62.9%
distribute-rgt-neg-in62.9%
Simplified62.9%
Taylor expanded in x around 0 48.4%
Taylor expanded in x around 0 27.7%
Taylor expanded in eps around inf 63.2%
mul-1-neg63.2%
*-commutative63.2%
unsub-neg63.2%
Simplified63.2%
if 330 < x Initial program 100.0%
fma-neg100.0%
/-rgt-identity100.0%
fma-neg100.0%
/-rgt-identity100.0%
distribute-rgt-neg-in100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around 0 24.0%
Taylor expanded in x around 0 26.5%
Taylor expanded in x around inf 56.6%
distribute-lft-out--56.6%
*-commutative56.6%
sub-neg56.6%
metadata-eval56.6%
+-commutative56.6%
Simplified56.6%
Final simplification61.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 2.25e-26) (/ (- 2.0 (* eps_m x)) 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 <= 2.25e-26) {
tmp = (2.0 - (eps_m * x)) / 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 <= 2.25d-26) then
tmp = (2.0d0 - (eps_m * x)) / 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 <= 2.25e-26) {
tmp = (2.0 - (eps_m * x)) / 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 <= 2.25e-26: tmp = (2.0 - (eps_m * x)) / 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 <= 2.25e-26) tmp = Float64(Float64(2.0 - Float64(eps_m * x)) / 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 <= 2.25e-26) tmp = (2.0 - (eps_m * x)) / 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, 2.25e-26], N[(N[(2.0 - N[(eps$95$m * x), $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.25 \cdot 10^{-26}:\\
\;\;\;\;\frac{2 - eps\_m \cdot x}{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 < 2.2499999999999999e-26Initial program 62.0%
fma-neg62.0%
/-rgt-identity62.0%
fma-neg62.0%
/-rgt-identity62.0%
distribute-rgt-neg-in62.0%
sub-neg62.0%
metadata-eval62.0%
distribute-rgt-neg-in62.0%
Simplified62.0%
Taylor expanded in x around 0 48.2%
Taylor expanded in x around 0 28.6%
Taylor expanded in eps around inf 65.2%
mul-1-neg65.2%
*-commutative65.2%
unsub-neg65.2%
Simplified65.2%
if 2.2499999999999999e-26 < x Initial program 98.3%
fma-neg97.8%
/-rgt-identity97.8%
fma-neg98.3%
/-rgt-identity98.3%
distribute-rgt-neg-in98.3%
sub-neg98.3%
metadata-eval98.3%
distribute-rgt-neg-in98.3%
Simplified98.3%
Taylor expanded in x around 0 27.0%
Taylor expanded in x around 0 51.6%
Final simplification60.7%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -0.0088) (/ (* eps_m (- x)) 2.0) (if (<= x 72.0) 1.0 (/ (* eps_m x) 2.0))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.0088) {
tmp = (eps_m * -x) / 2.0;
} else if (x <= 72.0) {
tmp = 1.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-0.0088d0)) then
tmp = (eps_m * -x) / 2.0d0
else if (x <= 72.0d0) then
tmp = 1.0d0
else
tmp = (eps_m * x) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -0.0088) {
tmp = (eps_m * -x) / 2.0;
} else if (x <= 72.0) {
tmp = 1.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.0088: tmp = (eps_m * -x) / 2.0 elif x <= 72.0: tmp = 1.0 else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.0088) tmp = Float64(Float64(eps_m * Float64(-x)) / 2.0); elseif (x <= 72.0) tmp = 1.0; else tmp = Float64(Float64(eps_m * x) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= -0.0088) tmp = (eps_m * -x) / 2.0; elseif (x <= 72.0) tmp = 1.0; else tmp = (eps_m * x) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.0088], N[(N[(eps$95$m * (-x)), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 72.0], 1.0, N[(N[(eps$95$m * x), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0088:\\
\;\;\;\;\frac{eps\_m \cdot \left(-x\right)}{2}\\
\mathbf{elif}\;x \leq 72:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < -0.00880000000000000053Initial program 94.5%
fma-neg94.6%
/-rgt-identity94.6%
fma-neg94.5%
/-rgt-identity94.5%
distribute-rgt-neg-in94.5%
sub-neg94.5%
metadata-eval94.5%
distribute-rgt-neg-in94.5%
Simplified94.5%
Taylor expanded in x around 0 59.7%
Taylor expanded in x around 0 29.1%
Taylor expanded in eps around inf 29.3%
associate-*r*29.3%
mul-1-neg29.3%
Simplified29.3%
if -0.00880000000000000053 < x < 72Initial program 55.3%
fma-neg55.0%
/-rgt-identity55.0%
fma-neg55.3%
/-rgt-identity55.3%
distribute-rgt-neg-in55.3%
sub-neg55.3%
metadata-eval55.3%
distribute-rgt-neg-in55.3%
Simplified55.3%
Taylor expanded in x around 0 73.6%
if 72 < x Initial program 98.8%
fma-neg98.8%
/-rgt-identity98.8%
fma-neg98.8%
/-rgt-identity98.8%
distribute-rgt-neg-in98.8%
sub-neg98.8%
metadata-eval98.8%
distribute-rgt-neg-in98.8%
Simplified98.8%
Taylor expanded in eps around inf 98.9%
exp-prod98.9%
Applied egg-rr98.9%
Taylor expanded in x around 0 22.9%
mul-1-neg22.9%
unsub-neg22.9%
Simplified22.9%
Taylor expanded in eps around inf 10.7%
*-commutative10.7%
Simplified10.7%
Final simplification48.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 9.0) (/ (- 2.0 (* eps_m x)) 2.0) (/ (* eps_m x) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 9.0) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 9.0d0) then
tmp = (2.0d0 - (eps_m * x)) / 2.0d0
else
tmp = (eps_m * x) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 9.0) {
tmp = (2.0 - (eps_m * x)) / 2.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 9.0: tmp = (2.0 - (eps_m * x)) / 2.0 else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 9.0) tmp = Float64(Float64(2.0 - Float64(eps_m * x)) / 2.0); else tmp = Float64(Float64(eps_m * x) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 9.0) tmp = (2.0 - (eps_m * x)) / 2.0; else tmp = (eps_m * x) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 9.0], N[(N[(2.0 - N[(eps$95$m * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(eps$95$m * x), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9:\\
\;\;\;\;\frac{2 - eps\_m \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < 9Initial program 63.2%
fma-neg63.0%
/-rgt-identity63.0%
fma-neg63.2%
/-rgt-identity63.2%
distribute-rgt-neg-in63.2%
sub-neg63.2%
metadata-eval63.2%
distribute-rgt-neg-in63.2%
Simplified63.2%
Taylor expanded in x around 0 48.6%
Taylor expanded in x around 0 27.8%
Taylor expanded in eps around inf 63.6%
mul-1-neg63.6%
*-commutative63.6%
unsub-neg63.6%
Simplified63.6%
if 9 < x Initial program 98.8%
fma-neg98.8%
/-rgt-identity98.8%
fma-neg98.8%
/-rgt-identity98.8%
distribute-rgt-neg-in98.8%
sub-neg98.8%
metadata-eval98.8%
distribute-rgt-neg-in98.8%
Simplified98.8%
Taylor expanded in eps around inf 98.9%
exp-prod98.9%
Applied egg-rr98.9%
Taylor expanded in x around 0 22.9%
mul-1-neg22.9%
unsub-neg22.9%
Simplified22.9%
Taylor expanded in eps around inf 10.7%
*-commutative10.7%
Simplified10.7%
Final simplification47.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 64.0) 1.0 (/ (* eps_m x) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 64.0) {
tmp = 1.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= 64.0d0) then
tmp = 1.0d0
else
tmp = (eps_m * x) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= 64.0) {
tmp = 1.0;
} else {
tmp = (eps_m * x) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 64.0: tmp = 1.0 else: tmp = (eps_m * x) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 64.0) tmp = 1.0; else tmp = Float64(Float64(eps_m * x) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (x <= 64.0) tmp = 1.0; else tmp = (eps_m * x) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 64.0], 1.0, N[(N[(eps$95$m * x), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 64:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{eps\_m \cdot x}{2}\\
\end{array}
\end{array}
if x < 64Initial program 63.2%
fma-neg63.0%
/-rgt-identity63.0%
fma-neg63.2%
/-rgt-identity63.2%
distribute-rgt-neg-in63.2%
sub-neg63.2%
metadata-eval63.2%
distribute-rgt-neg-in63.2%
Simplified63.2%
Taylor expanded in x around 0 59.3%
if 64 < x Initial program 98.8%
fma-neg98.8%
/-rgt-identity98.8%
fma-neg98.8%
/-rgt-identity98.8%
distribute-rgt-neg-in98.8%
sub-neg98.8%
metadata-eval98.8%
distribute-rgt-neg-in98.8%
Simplified98.8%
Taylor expanded in eps around inf 98.9%
exp-prod98.9%
Applied egg-rr98.9%
Taylor expanded in x around 0 22.9%
mul-1-neg22.9%
unsub-neg22.9%
Simplified22.9%
Taylor expanded in eps around inf 10.7%
*-commutative10.7%
Simplified10.7%
Final simplification44.5%
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 74.1%
fma-neg73.9%
/-rgt-identity73.9%
fma-neg74.1%
/-rgt-identity74.1%
distribute-rgt-neg-in74.1%
sub-neg74.1%
metadata-eval74.1%
distribute-rgt-neg-in74.1%
Simplified74.1%
Taylor expanded in x around 0 42.2%
Final simplification42.2%
herbie shell --seed 2024026
(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))