
(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 (<= eps_m 2e-89) (/ (+ (/ (+ x 1.0) (exp x)) (* (+ x 1.0) (exp (- x)))) 2.0) (/ (+ (exp (* x (+ -1.0 eps_m))) (exp (* x (- eps_m)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (eps_m <= 2e-89) {
tmp = (((x + 1.0) / exp(x)) + ((x + 1.0) * exp(-x))) / 2.0;
} else {
tmp = (exp((x * (-1.0 + eps_m))) + exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (eps_m <= 2d-89) then
tmp = (((x + 1.0d0) / exp(x)) + ((x + 1.0d0) * exp(-x))) / 2.0d0
else
tmp = (exp((x * ((-1.0d0) + eps_m))) + exp((x * -eps_m))) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (eps_m <= 2e-89) {
tmp = (((x + 1.0) / Math.exp(x)) + ((x + 1.0) * Math.exp(-x))) / 2.0;
} else {
tmp = (Math.exp((x * (-1.0 + eps_m))) + Math.exp((x * -eps_m))) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if eps_m <= 2e-89: tmp = (((x + 1.0) / math.exp(x)) + ((x + 1.0) * math.exp(-x))) / 2.0 else: tmp = (math.exp((x * (-1.0 + eps_m))) + math.exp((x * -eps_m))) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (eps_m <= 2e-89) tmp = Float64(Float64(Float64(Float64(x + 1.0) / exp(x)) + Float64(Float64(x + 1.0) * exp(Float64(-x)))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + exp(Float64(x * Float64(-eps_m)))) / 2.0); end return tmp end
eps_m = abs(eps); function tmp_2 = code(x, eps_m) tmp = 0.0; if (eps_m <= 2e-89) tmp = (((x + 1.0) / exp(x)) + ((x + 1.0) * exp(-x))) / 2.0; else tmp = (exp((x * (-1.0 + eps_m))) + exp((x * -eps_m))) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 2e-89], N[(N[(N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] + N[(N[(x + 1.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 2 \cdot 10^{-89}:\\
\;\;\;\;\frac{\frac{x + 1}{e^{x}} + \left(x + 1\right) \cdot e^{-x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + e^{x \cdot \left(-eps\_m\right)}}{2}\\
\end{array}
\end{array}
if eps < 2.00000000000000008e-89Initial program 59.3%
fma-neg59.3%
/-rgt-identity59.3%
fma-neg59.3%
/-rgt-identity59.3%
distribute-rgt-neg-in59.3%
sub-neg59.3%
metadata-eval59.3%
distribute-rgt-neg-in59.3%
Simplified59.3%
Taylor expanded in eps around 0 68.6%
Simplified68.6%
exp-neg68.6%
un-div-inv68.6%
Applied egg-rr68.6%
if 2.00000000000000008e-89 < eps Initial program 93.6%
fma-neg93.6%
/-rgt-identity93.6%
fma-neg93.6%
/-rgt-identity93.6%
distribute-rgt-neg-in93.6%
sub-neg93.6%
metadata-eval93.6%
distribute-rgt-neg-in93.6%
Simplified93.6%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification81.6%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ (exp (* x (+ -1.0 eps_m))) (pow (exp -1.0) (* x (+ eps_m 1.0)))) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (exp((x * (-1.0 + eps_m))) + pow(exp(-1.0), (x * (eps_m + 1.0)))) / 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((-1.0d0)) ** (x * (eps_m + 1.0d0)))) / 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.pow(Math.exp(-1.0), (x * (eps_m + 1.0)))) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (math.exp((x * (-1.0 + eps_m))) + math.pow(math.exp(-1.0), (x * (eps_m + 1.0)))) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(exp(Float64(x * Float64(-1.0 + eps_m))) + (exp(-1.0) ^ Float64(x * Float64(eps_m + 1.0)))) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (exp((x * (-1.0 + eps_m))) + (exp(-1.0) ^ (x * (eps_m + 1.0)))) / 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[Power[N[Exp[-1.0], $MachinePrecision], N[(x * N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{e^{x \cdot \left(-1 + eps\_m\right)} + {\left(e^{-1}\right)}^{\left(x \cdot \left(eps\_m + 1\right)\right)}}{2}
\end{array}
Initial program 73.5%
fma-neg73.5%
/-rgt-identity73.5%
fma-neg73.5%
/-rgt-identity73.5%
distribute-rgt-neg-in73.5%
sub-neg73.5%
metadata-eval73.5%
distribute-rgt-neg-in73.5%
Simplified73.5%
Taylor expanded in eps around inf 99.2%
exp-prod99.2%
Applied egg-rr99.2%
Final simplification99.2%
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 73.5%
fma-neg73.5%
/-rgt-identity73.5%
fma-neg73.5%
/-rgt-identity73.5%
distribute-rgt-neg-in73.5%
sub-neg73.5%
metadata-eval73.5%
distribute-rgt-neg-in73.5%
Simplified73.5%
Taylor expanded in eps around inf 99.2%
Final simplification99.2%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -0.27)
(/ (* (* x eps_m) (+ -1.0 (/ -1.0 eps_m))) 2.0)
(if (<= x 580.0)
1.0
(if (or (<= x 8.3e+68)
(and (not (<= x 1.1e+87))
(or (<= x 4.6e+129)
(and (not (<= x 1.65e+210)) (<= x 1.58e+261)))))
(/ (/ (expm1 x) eps_m) 2.0)
(/ (+ (/ -1.0 eps_m) (+ (- 1.0 (/ -1.0 eps_m)) 1.0)) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.27) {
tmp = ((x * eps_m) * (-1.0 + (-1.0 / eps_m))) / 2.0;
} else if (x <= 580.0) {
tmp = 1.0;
} else if ((x <= 8.3e+68) || (!(x <= 1.1e+87) && ((x <= 4.6e+129) || (!(x <= 1.65e+210) && (x <= 1.58e+261))))) {
tmp = (expm1(x) / eps_m) / 2.0;
} else {
tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -0.27) {
tmp = ((x * eps_m) * (-1.0 + (-1.0 / eps_m))) / 2.0;
} else if (x <= 580.0) {
tmp = 1.0;
} else if ((x <= 8.3e+68) || (!(x <= 1.1e+87) && ((x <= 4.6e+129) || (!(x <= 1.65e+210) && (x <= 1.58e+261))))) {
tmp = (Math.expm1(x) / eps_m) / 2.0;
} else {
tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.27: tmp = ((x * eps_m) * (-1.0 + (-1.0 / eps_m))) / 2.0 elif x <= 580.0: tmp = 1.0 elif (x <= 8.3e+68) or (not (x <= 1.1e+87) and ((x <= 4.6e+129) or (not (x <= 1.65e+210) and (x <= 1.58e+261)))): tmp = (math.expm1(x) / eps_m) / 2.0 else: tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.27) tmp = Float64(Float64(Float64(x * eps_m) * Float64(-1.0 + Float64(-1.0 / eps_m))) / 2.0); elseif (x <= 580.0) tmp = 1.0; elseif ((x <= 8.3e+68) || (!(x <= 1.1e+87) && ((x <= 4.6e+129) || (!(x <= 1.65e+210) && (x <= 1.58e+261))))) tmp = Float64(Float64(expm1(x) / eps_m) / 2.0); else tmp = Float64(Float64(Float64(-1.0 / eps_m) + Float64(Float64(1.0 - Float64(-1.0 / eps_m)) + 1.0)) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.27], N[(N[(N[(x * eps$95$m), $MachinePrecision] * N[(-1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 580.0], 1.0, If[Or[LessEqual[x, 8.3e+68], And[N[Not[LessEqual[x, 1.1e+87]], $MachinePrecision], Or[LessEqual[x, 4.6e+129], And[N[Not[LessEqual[x, 1.65e+210]], $MachinePrecision], LessEqual[x, 1.58e+261]]]]], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(-1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.27:\\
\;\;\;\;\frac{\left(x \cdot eps\_m\right) \cdot \left(-1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{elif}\;x \leq 580:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 8.3 \cdot 10^{+68} \lor \neg \left(x \leq 1.1 \cdot 10^{+87}\right) \land \left(x \leq 4.6 \cdot 10^{+129} \lor \neg \left(x \leq 1.65 \cdot 10^{+210}\right) \land x \leq 1.58 \cdot 10^{+261}\right):\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-1}{eps\_m} + \left(\left(1 - \frac{-1}{eps\_m}\right) + 1\right)}{2}\\
\end{array}
\end{array}
if x < -0.27000000000000002Initial 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 42.6%
Taylor expanded in x around inf 13.2%
mul-1-neg13.2%
*-commutative13.2%
associate-*l*13.2%
distribute-rgt-neg-in13.2%
distribute-neg-in13.2%
metadata-eval13.2%
distribute-neg-frac13.2%
metadata-eval13.2%
Simplified13.2%
Taylor expanded in eps around inf 13.2%
neg-mul-113.2%
distribute-lft-neg-in13.2%
*-commutative13.2%
Simplified13.2%
/-rgt-identity13.2%
clear-num13.2%
add-sqr-sqrt0.1%
sqrt-unprod0.1%
frac-times0.1%
metadata-eval0.1%
metadata-eval0.1%
frac-times0.1%
sqrt-unprod0.0%
add-sqr-sqrt40.2%
clear-num40.2%
div-inv40.2%
metadata-eval40.2%
Applied egg-rr40.2%
*-commutative40.2%
neg-mul-140.2%
Simplified40.2%
if -0.27000000000000002 < x < 580Initial program 54.5%
fma-neg54.5%
/-rgt-identity54.5%
fma-neg54.5%
/-rgt-identity54.5%
distribute-rgt-neg-in54.5%
sub-neg54.5%
metadata-eval54.5%
distribute-rgt-neg-in54.5%
Simplified54.5%
Taylor expanded in x around 0 74.0%
if 580 < x < 8.30000000000000041e68 or 1.1e87 < x < 4.59999999999999981e129 or 1.64999999999999997e210 < x < 1.5800000000000001e261Initial 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 47.5%
Taylor expanded in eps around 0 1.7%
expm1-def1.7%
neg-mul-11.7%
Simplified1.7%
expm1-log1p-u1.5%
expm1-udef1.5%
div-inv1.5%
div-inv1.5%
add-sqr-sqrt0.0%
sqrt-unprod46.0%
sqr-neg46.0%
sqrt-unprod46.0%
add-sqr-sqrt46.0%
Applied egg-rr46.0%
expm1-def46.0%
expm1-log1p46.2%
Simplified46.2%
if 8.30000000000000041e68 < x < 1.1e87 or 4.59999999999999981e129 < x < 1.64999999999999997e210 or 1.5800000000000001e261 < 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.1%
Taylor expanded in x around 0 70.4%
+-commutative70.4%
associate--l+70.4%
metadata-eval70.4%
add-sqr-sqrt26.0%
sqrt-unprod29.6%
sqr-neg29.6%
sqrt-unprod0.9%
add-sqr-sqrt2.6%
frac-2neg2.6%
*-rgt-identity2.6%
+-commutative2.6%
metadata-eval2.6%
add-sqr-sqrt1.6%
sqrt-unprod18.8%
sqr-neg18.8%
sqrt-unprod14.5%
add-sqr-sqrt70.4%
frac-2neg70.4%
Applied egg-rr70.4%
Final simplification65.0%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -560.0)
(/ (/ (expm1 (- x)) eps_m) 2.0)
(if (<= x 680.0)
1.0
(if (or (<= x 1.32e+68)
(and (not (<= x 2.6e+82))
(or (<= x 1.26e+129)
(and (not (<= x 2.9e+206)) (<= x 3.75e+258)))))
(/ (/ (expm1 x) eps_m) 2.0)
(/ (+ (/ -1.0 eps_m) (+ (- 1.0 (/ -1.0 eps_m)) 1.0)) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -560.0) {
tmp = (expm1(-x) / eps_m) / 2.0;
} else if (x <= 680.0) {
tmp = 1.0;
} else if ((x <= 1.32e+68) || (!(x <= 2.6e+82) && ((x <= 1.26e+129) || (!(x <= 2.9e+206) && (x <= 3.75e+258))))) {
tmp = (expm1(x) / eps_m) / 2.0;
} else {
tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -560.0) {
tmp = (Math.expm1(-x) / eps_m) / 2.0;
} else if (x <= 680.0) {
tmp = 1.0;
} else if ((x <= 1.32e+68) || (!(x <= 2.6e+82) && ((x <= 1.26e+129) || (!(x <= 2.9e+206) && (x <= 3.75e+258))))) {
tmp = (Math.expm1(x) / eps_m) / 2.0;
} else {
tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -560.0: tmp = (math.expm1(-x) / eps_m) / 2.0 elif x <= 680.0: tmp = 1.0 elif (x <= 1.32e+68) or (not (x <= 2.6e+82) and ((x <= 1.26e+129) or (not (x <= 2.9e+206) and (x <= 3.75e+258)))): tmp = (math.expm1(x) / eps_m) / 2.0 else: tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -560.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps_m) / 2.0); elseif (x <= 680.0) tmp = 1.0; elseif ((x <= 1.32e+68) || (!(x <= 2.6e+82) && ((x <= 1.26e+129) || (!(x <= 2.9e+206) && (x <= 3.75e+258))))) tmp = Float64(Float64(expm1(x) / eps_m) / 2.0); else tmp = Float64(Float64(Float64(-1.0 / eps_m) + Float64(Float64(1.0 - Float64(-1.0 / eps_m)) + 1.0)) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -560.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 680.0], 1.0, If[Or[LessEqual[x, 1.32e+68], And[N[Not[LessEqual[x, 2.6e+82]], $MachinePrecision], Or[LessEqual[x, 1.26e+129], And[N[Not[LessEqual[x, 2.9e+206]], $MachinePrecision], LessEqual[x, 3.75e+258]]]]], N[(N[(N[(Exp[x] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(-1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -560:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 680:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+68} \lor \neg \left(x \leq 2.6 \cdot 10^{+82}\right) \land \left(x \leq 1.26 \cdot 10^{+129} \lor \neg \left(x \leq 2.9 \cdot 10^{+206}\right) \land x \leq 3.75 \cdot 10^{+258}\right):\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(x\right)}{eps\_m}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-1}{eps\_m} + \left(\left(1 - \frac{-1}{eps\_m}\right) + 1\right)}{2}\\
\end{array}
\end{array}
if x < -560Initial 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 34.5%
Taylor expanded in eps around 0 67.6%
expm1-def67.6%
neg-mul-167.6%
Simplified67.6%
if -560 < x < 680Initial program 54.5%
fma-neg54.5%
/-rgt-identity54.5%
fma-neg54.5%
/-rgt-identity54.5%
distribute-rgt-neg-in54.5%
sub-neg54.5%
metadata-eval54.5%
distribute-rgt-neg-in54.5%
Simplified54.5%
Taylor expanded in x around 0 74.0%
if 680 < x < 1.3200000000000001e68 or 2.5999999999999998e82 < x < 1.26e129 or 2.9e206 < x < 3.75000000000000016e258Initial 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 47.5%
Taylor expanded in eps around 0 1.7%
expm1-def1.7%
neg-mul-11.7%
Simplified1.7%
expm1-log1p-u1.5%
expm1-udef1.5%
div-inv1.5%
div-inv1.5%
add-sqr-sqrt0.0%
sqrt-unprod46.0%
sqr-neg46.0%
sqrt-unprod46.0%
add-sqr-sqrt46.0%
Applied egg-rr46.0%
expm1-def46.0%
expm1-log1p46.2%
Simplified46.2%
if 1.3200000000000001e68 < x < 2.5999999999999998e82 or 1.26e129 < x < 2.9e206 or 3.75000000000000016e258 < 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.1%
Taylor expanded in x around 0 70.4%
+-commutative70.4%
associate--l+70.4%
metadata-eval70.4%
add-sqr-sqrt26.0%
sqrt-unprod29.6%
sqr-neg29.6%
sqrt-unprod0.9%
add-sqr-sqrt2.6%
frac-2neg2.6%
*-rgt-identity2.6%
+-commutative2.6%
metadata-eval2.6%
add-sqr-sqrt1.6%
sqrt-unprod18.8%
sqr-neg18.8%
sqrt-unprod14.5%
add-sqr-sqrt70.4%
frac-2neg70.4%
Applied egg-rr70.4%
Final simplification68.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -480.0)
(/ (/ (expm1 (- x)) eps_m) 2.0)
(if (or (<= x 6.7e+69)
(and (not (<= x 1.4e+80))
(or (<= x 2.8e+129)
(and (not (<= x 2.1e+206)) (<= x 4.65e+266)))))
(/ (+ (exp (+ x (* x eps_m))) 1.0) 2.0)
(/ (+ (/ -1.0 eps_m) (+ (- 1.0 (/ -1.0 eps_m)) 1.0)) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -480.0) {
tmp = (expm1(-x) / eps_m) / 2.0;
} else if ((x <= 6.7e+69) || (!(x <= 1.4e+80) && ((x <= 2.8e+129) || (!(x <= 2.1e+206) && (x <= 4.65e+266))))) {
tmp = (exp((x + (x * eps_m))) + 1.0) / 2.0;
} else {
tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0;
}
return tmp;
}
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -480.0) {
tmp = (Math.expm1(-x) / eps_m) / 2.0;
} else if ((x <= 6.7e+69) || (!(x <= 1.4e+80) && ((x <= 2.8e+129) || (!(x <= 2.1e+206) && (x <= 4.65e+266))))) {
tmp = (Math.exp((x + (x * eps_m))) + 1.0) / 2.0;
} else {
tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -480.0: tmp = (math.expm1(-x) / eps_m) / 2.0 elif (x <= 6.7e+69) or (not (x <= 1.4e+80) and ((x <= 2.8e+129) or (not (x <= 2.1e+206) and (x <= 4.65e+266)))): tmp = (math.exp((x + (x * eps_m))) + 1.0) / 2.0 else: tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -480.0) tmp = Float64(Float64(expm1(Float64(-x)) / eps_m) / 2.0); elseif ((x <= 6.7e+69) || (!(x <= 1.4e+80) && ((x <= 2.8e+129) || (!(x <= 2.1e+206) && (x <= 4.65e+266))))) tmp = Float64(Float64(exp(Float64(x + Float64(x * eps_m))) + 1.0) / 2.0); else tmp = Float64(Float64(Float64(-1.0 / eps_m) + Float64(Float64(1.0 - Float64(-1.0 / eps_m)) + 1.0)) / 2.0); end return tmp end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -480.0], N[(N[(N[(Exp[(-x)] - 1), $MachinePrecision] / eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 6.7e+69], And[N[Not[LessEqual[x, 1.4e+80]], $MachinePrecision], Or[LessEqual[x, 2.8e+129], And[N[Not[LessEqual[x, 2.1e+206]], $MachinePrecision], LessEqual[x, 4.65e+266]]]]], N[(N[(N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(-1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -480:\\
\;\;\;\;\frac{\frac{\mathsf{expm1}\left(-x\right)}{eps\_m}}{2}\\
\mathbf{elif}\;x \leq 6.7 \cdot 10^{+69} \lor \neg \left(x \leq 1.4 \cdot 10^{+80}\right) \land \left(x \leq 2.8 \cdot 10^{+129} \lor \neg \left(x \leq 2.1 \cdot 10^{+206}\right) \land x \leq 4.65 \cdot 10^{+266}\right):\\
\;\;\;\;\frac{e^{x + x \cdot eps\_m} + 1}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-1}{eps\_m} + \left(\left(1 - \frac{-1}{eps\_m}\right) + 1\right)}{2}\\
\end{array}
\end{array}
if x < -480Initial 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 34.5%
Taylor expanded in eps around 0 67.6%
expm1-def67.6%
neg-mul-167.6%
Simplified67.6%
if -480 < x < 6.7000000000000001e69 or 1.39999999999999992e80 < x < 2.79999999999999975e129 or 2.09999999999999987e206 < x < 4.65e266Initial program 63.5%
fma-neg63.5%
/-rgt-identity63.5%
fma-neg63.5%
/-rgt-identity63.5%
distribute-rgt-neg-in63.5%
sub-neg63.5%
metadata-eval63.5%
distribute-rgt-neg-in63.5%
Simplified63.5%
Taylor expanded in x around 0 44.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%
associate-*r*79.6%
neg-mul-179.6%
distribute-rgt-neg-in79.6%
Simplified79.6%
add-sqr-sqrt26.4%
sqrt-unprod81.5%
sqr-neg81.5%
sqrt-unprod58.8%
add-sqr-sqrt74.7%
sub-neg74.7%
distribute-rgt-in74.7%
*-un-lft-identity74.7%
add-sqr-sqrt39.7%
sqrt-unprod81.5%
sqr-neg81.5%
sqrt-unprod45.4%
add-sqr-sqrt79.6%
*-commutative79.6%
Applied egg-rr79.6%
if 6.7000000000000001e69 < x < 1.39999999999999992e80 or 2.79999999999999975e129 < x < 2.09999999999999987e206 or 4.65e266 < 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.1%
Taylor expanded in x around 0 70.4%
+-commutative70.4%
associate--l+70.4%
metadata-eval70.4%
add-sqr-sqrt26.0%
sqrt-unprod29.6%
sqr-neg29.6%
sqrt-unprod0.9%
add-sqr-sqrt2.6%
frac-2neg2.6%
*-rgt-identity2.6%
+-commutative2.6%
metadata-eval2.6%
add-sqr-sqrt1.6%
sqrt-unprod18.8%
sqr-neg18.8%
sqrt-unprod14.5%
add-sqr-sqrt70.4%
frac-2neg70.4%
Applied egg-rr70.4%
Final simplification76.7%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1e-281)
(/ (+ (exp (* x (- 1.0 eps_m))) 1.0) 2.0)
(if (or (<= x 1.85e+69)
(and (not (<= x 8e+84))
(or (<= x 9.5e+128)
(and (not (<= x 6e+211)) (<= x 1.22e+266)))))
(/ (+ (exp (+ x (* x eps_m))) 1.0) 2.0)
(/ (+ (/ -1.0 eps_m) (+ (- 1.0 (/ -1.0 eps_m)) 1.0)) 2.0))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1e-281) {
tmp = (exp((x * (1.0 - eps_m))) + 1.0) / 2.0;
} else if ((x <= 1.85e+69) || (!(x <= 8e+84) && ((x <= 9.5e+128) || (!(x <= 6e+211) && (x <= 1.22e+266))))) {
tmp = (exp((x + (x * eps_m))) + 1.0) / 2.0;
} else {
tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1d-281)) then
tmp = (exp((x * (1.0d0 - eps_m))) + 1.0d0) / 2.0d0
else if ((x <= 1.85d+69) .or. (.not. (x <= 8d+84)) .and. (x <= 9.5d+128) .or. (.not. (x <= 6d+211)) .and. (x <= 1.22d+266)) then
tmp = (exp((x + (x * eps_m))) + 1.0d0) / 2.0d0
else
tmp = (((-1.0d0) / eps_m) + ((1.0d0 - ((-1.0d0) / eps_m)) + 1.0d0)) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1e-281) {
tmp = (Math.exp((x * (1.0 - eps_m))) + 1.0) / 2.0;
} else if ((x <= 1.85e+69) || (!(x <= 8e+84) && ((x <= 9.5e+128) || (!(x <= 6e+211) && (x <= 1.22e+266))))) {
tmp = (Math.exp((x + (x * eps_m))) + 1.0) / 2.0;
} else {
tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1e-281: tmp = (math.exp((x * (1.0 - eps_m))) + 1.0) / 2.0 elif (x <= 1.85e+69) or (not (x <= 8e+84) and ((x <= 9.5e+128) or (not (x <= 6e+211) and (x <= 1.22e+266)))): tmp = (math.exp((x + (x * eps_m))) + 1.0) / 2.0 else: tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1e-281) tmp = Float64(Float64(exp(Float64(x * Float64(1.0 - eps_m))) + 1.0) / 2.0); elseif ((x <= 1.85e+69) || (!(x <= 8e+84) && ((x <= 9.5e+128) || (!(x <= 6e+211) && (x <= 1.22e+266))))) tmp = Float64(Float64(exp(Float64(x + Float64(x * eps_m))) + 1.0) / 2.0); else tmp = Float64(Float64(Float64(-1.0 / eps_m) + Float64(Float64(1.0 - Float64(-1.0 / 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-281) tmp = (exp((x * (1.0 - eps_m))) + 1.0) / 2.0; elseif ((x <= 1.85e+69) || (~((x <= 8e+84)) && ((x <= 9.5e+128) || (~((x <= 6e+211)) && (x <= 1.22e+266))))) tmp = (exp((x + (x * eps_m))) + 1.0) / 2.0; else tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / 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-281], N[(N[(N[Exp[N[(x * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 1.85e+69], And[N[Not[LessEqual[x, 8e+84]], $MachinePrecision], Or[LessEqual[x, 9.5e+128], And[N[Not[LessEqual[x, 6e+211]], $MachinePrecision], LessEqual[x, 1.22e+266]]]]], N[(N[(N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(-1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-281}:\\
\;\;\;\;\frac{e^{x \cdot \left(1 - eps\_m\right)} + 1}{2}\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{+69} \lor \neg \left(x \leq 8 \cdot 10^{+84}\right) \land \left(x \leq 9.5 \cdot 10^{+128} \lor \neg \left(x \leq 6 \cdot 10^{+211}\right) \land x \leq 1.22 \cdot 10^{+266}\right):\\
\;\;\;\;\frac{e^{x + x \cdot eps\_m} + 1}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-1}{eps\_m} + \left(\left(1 - \frac{-1}{eps\_m}\right) + 1\right)}{2}\\
\end{array}
\end{array}
if x < -1e-281Initial program 71.6%
fma-neg71.6%
/-rgt-identity71.6%
fma-neg71.6%
/-rgt-identity71.6%
distribute-rgt-neg-in71.6%
sub-neg71.6%
metadata-eval71.6%
distribute-rgt-neg-in71.6%
Simplified71.6%
Taylor expanded in x around 0 40.7%
Taylor expanded in eps around inf 68.9%
associate-*r*68.9%
sub-neg68.9%
neg-mul-168.9%
associate-*r*68.9%
associate-*r*68.9%
neg-mul-168.9%
sub-neg68.9%
associate-*r*68.9%
neg-mul-168.9%
distribute-rgt-neg-in68.9%
Simplified68.9%
distribute-rgt-neg-out68.9%
add-sqr-sqrt61.8%
sqrt-unprod97.2%
sqr-neg97.2%
sqrt-unprod37.4%
add-sqr-sqrt77.4%
neg-sub077.4%
associate--r-77.4%
metadata-eval77.4%
Applied egg-rr77.4%
if -1e-281 < x < 1.8499999999999999e69 or 8.00000000000000046e84 < x < 9.50000000000000014e128 or 6e211 < x < 1.22e266Initial program 67.2%
fma-neg67.2%
/-rgt-identity67.2%
fma-neg67.2%
/-rgt-identity67.2%
distribute-rgt-neg-in67.2%
sub-neg67.2%
metadata-eval67.2%
distribute-rgt-neg-in67.2%
Simplified67.2%
Taylor expanded in x around 0 44.3%
Taylor expanded in eps around inf 75.7%
associate-*r*75.7%
sub-neg75.7%
neg-mul-175.7%
associate-*r*75.7%
associate-*r*75.7%
neg-mul-175.7%
sub-neg75.7%
associate-*r*75.7%
neg-mul-175.7%
distribute-rgt-neg-in75.7%
Simplified75.7%
add-sqr-sqrt35.3%
sqrt-unprod89.0%
sqr-neg89.0%
sqrt-unprod57.9%
add-sqr-sqrt70.8%
sub-neg70.8%
distribute-rgt-in70.8%
*-un-lft-identity70.8%
add-sqr-sqrt40.8%
sqrt-unprod89.0%
sqr-neg89.0%
sqrt-unprod52.5%
add-sqr-sqrt75.6%
*-commutative75.6%
Applied egg-rr75.6%
if 1.8499999999999999e69 < x < 8.00000000000000046e84 or 9.50000000000000014e128 < x < 6e211 or 1.22e266 < 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.1%
Taylor expanded in x around 0 70.4%
+-commutative70.4%
associate--l+70.4%
metadata-eval70.4%
add-sqr-sqrt26.0%
sqrt-unprod29.6%
sqr-neg29.6%
sqrt-unprod0.9%
add-sqr-sqrt2.6%
frac-2neg2.6%
*-rgt-identity2.6%
+-commutative2.6%
metadata-eval2.6%
add-sqr-sqrt1.6%
sqrt-unprod18.8%
sqr-neg18.8%
sqrt-unprod14.5%
add-sqr-sqrt70.4%
frac-2neg70.4%
Applied egg-rr70.4%
Final simplification75.6%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.8e-282)
(/ (+ (exp (* x (- 1.0 eps_m))) 1.0) 2.0)
(if (<= x 1.42e+68)
(/ (+ (exp (+ x (* x eps_m))) 1.0) 2.0)
(if (or (<= x 7.5e+83) (not (<= x 9.6e+263)))
(/ (+ (/ -1.0 eps_m) (+ (- 1.0 (/ -1.0 eps_m)) 1.0)) 2.0)
(/ (+ (exp (* x (+ -1.0 eps_m))) 1.0) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.8e-282) {
tmp = (exp((x * (1.0 - eps_m))) + 1.0) / 2.0;
} else if (x <= 1.42e+68) {
tmp = (exp((x + (x * eps_m))) + 1.0) / 2.0;
} else if ((x <= 7.5e+83) || !(x <= 9.6e+263)) {
tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0;
} else {
tmp = (exp((x * (-1.0 + eps_m))) + 1.0) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.8d-282)) then
tmp = (exp((x * (1.0d0 - eps_m))) + 1.0d0) / 2.0d0
else if (x <= 1.42d+68) then
tmp = (exp((x + (x * eps_m))) + 1.0d0) / 2.0d0
else if ((x <= 7.5d+83) .or. (.not. (x <= 9.6d+263))) then
tmp = (((-1.0d0) / eps_m) + ((1.0d0 - ((-1.0d0) / eps_m)) + 1.0d0)) / 2.0d0
else
tmp = (exp((x * ((-1.0d0) + eps_m))) + 1.0d0) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.8e-282) {
tmp = (Math.exp((x * (1.0 - eps_m))) + 1.0) / 2.0;
} else if (x <= 1.42e+68) {
tmp = (Math.exp((x + (x * eps_m))) + 1.0) / 2.0;
} else if ((x <= 7.5e+83) || !(x <= 9.6e+263)) {
tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0;
} else {
tmp = (Math.exp((x * (-1.0 + eps_m))) + 1.0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.8e-282: tmp = (math.exp((x * (1.0 - eps_m))) + 1.0) / 2.0 elif x <= 1.42e+68: tmp = (math.exp((x + (x * eps_m))) + 1.0) / 2.0 elif (x <= 7.5e+83) or not (x <= 9.6e+263): tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0 else: tmp = (math.exp((x * (-1.0 + eps_m))) + 1.0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.8e-282) tmp = Float64(Float64(exp(Float64(x * Float64(1.0 - eps_m))) + 1.0) / 2.0); elseif (x <= 1.42e+68) tmp = Float64(Float64(exp(Float64(x + Float64(x * eps_m))) + 1.0) / 2.0); elseif ((x <= 7.5e+83) || !(x <= 9.6e+263)) tmp = Float64(Float64(Float64(-1.0 / eps_m) + Float64(Float64(1.0 - Float64(-1.0 / eps_m)) + 1.0)) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + 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 <= -1.8e-282) tmp = (exp((x * (1.0 - eps_m))) + 1.0) / 2.0; elseif (x <= 1.42e+68) tmp = (exp((x + (x * eps_m))) + 1.0) / 2.0; elseif ((x <= 7.5e+83) || ~((x <= 9.6e+263))) tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0; else tmp = (exp((x * (-1.0 + 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, -1.8e-282], N[(N[(N[Exp[N[(x * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.42e+68], N[(N[(N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 7.5e+83], N[Not[LessEqual[x, 9.6e+263]], $MachinePrecision]], N[(N[(N[(-1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{-282}:\\
\;\;\;\;\frac{e^{x \cdot \left(1 - eps\_m\right)} + 1}{2}\\
\mathbf{elif}\;x \leq 1.42 \cdot 10^{+68}:\\
\;\;\;\;\frac{e^{x + x \cdot eps\_m} + 1}{2}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{+83} \lor \neg \left(x \leq 9.6 \cdot 10^{+263}\right):\\
\;\;\;\;\frac{\frac{-1}{eps\_m} + \left(\left(1 - \frac{-1}{eps\_m}\right) + 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + 1}{2}\\
\end{array}
\end{array}
if x < -1.7999999999999999e-282Initial program 71.6%
fma-neg71.6%
/-rgt-identity71.6%
fma-neg71.6%
/-rgt-identity71.6%
distribute-rgt-neg-in71.6%
sub-neg71.6%
metadata-eval71.6%
distribute-rgt-neg-in71.6%
Simplified71.6%
Taylor expanded in x around 0 40.7%
Taylor expanded in eps around inf 68.9%
associate-*r*68.9%
sub-neg68.9%
neg-mul-168.9%
associate-*r*68.9%
associate-*r*68.9%
neg-mul-168.9%
sub-neg68.9%
associate-*r*68.9%
neg-mul-168.9%
distribute-rgt-neg-in68.9%
Simplified68.9%
distribute-rgt-neg-out68.9%
add-sqr-sqrt61.8%
sqrt-unprod97.2%
sqr-neg97.2%
sqrt-unprod37.4%
add-sqr-sqrt77.4%
neg-sub077.4%
associate--r-77.4%
metadata-eval77.4%
Applied egg-rr77.4%
if -1.7999999999999999e-282 < x < 1.41999999999999998e68Initial program 57.3%
fma-neg57.3%
/-rgt-identity57.3%
fma-neg57.3%
/-rgt-identity57.3%
distribute-rgt-neg-in57.3%
sub-neg57.3%
metadata-eval57.3%
distribute-rgt-neg-in57.3%
Simplified57.3%
Taylor expanded in x around 0 43.2%
Taylor expanded in eps around inf 84.0%
associate-*r*84.0%
sub-neg84.0%
neg-mul-184.0%
associate-*r*84.0%
associate-*r*84.0%
neg-mul-184.0%
sub-neg84.0%
associate-*r*84.0%
neg-mul-184.0%
distribute-rgt-neg-in84.0%
Simplified84.0%
add-sqr-sqrt32.0%
sqrt-unprod91.0%
sqr-neg91.0%
sqrt-unprod64.5%
add-sqr-sqrt80.9%
sub-neg80.9%
distribute-rgt-in80.9%
*-un-lft-identity80.9%
add-sqr-sqrt42.3%
sqrt-unprod91.0%
sqr-neg91.0%
sqrt-unprod54.2%
add-sqr-sqrt84.0%
*-commutative84.0%
Applied egg-rr84.0%
if 1.41999999999999998e68 < x < 7.49999999999999989e83 or 9.6000000000000002e263 < 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 18.7%
Taylor expanded in x around 0 78.5%
+-commutative78.5%
associate--l+78.5%
metadata-eval78.5%
add-sqr-sqrt28.7%
sqrt-unprod35.0%
sqr-neg35.0%
sqrt-unprod1.0%
add-sqr-sqrt2.6%
frac-2neg2.6%
*-rgt-identity2.6%
+-commutative2.6%
metadata-eval2.6%
add-sqr-sqrt1.6%
sqrt-unprod24.1%
sqr-neg24.1%
sqrt-unprod17.2%
add-sqr-sqrt78.5%
frac-2neg78.5%
Applied egg-rr78.5%
if 7.49999999999999989e83 < x < 9.6000000000000002e263Initial 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 40.7%
Taylor expanded in eps around inf 41.0%
associate-*r*41.0%
sub-neg41.0%
neg-mul-141.0%
associate-*r*41.0%
associate-*r*41.0%
neg-mul-141.0%
sub-neg41.0%
associate-*r*41.0%
neg-mul-141.0%
distribute-rgt-neg-in41.0%
Simplified41.0%
Final simplification73.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -1.7e-282)
(/ (+ (exp (* x (+ -1.0 (/ 1.0 (/ -1.0 eps_m))))) 1.0) 2.0)
(if (<= x 2e+71)
(/ (+ (exp (+ x (* x eps_m))) 1.0) 2.0)
(if (or (<= x 4.6e+80) (not (<= x 2.36e+266)))
(/ (+ (/ -1.0 eps_m) (+ (- 1.0 (/ -1.0 eps_m)) 1.0)) 2.0)
(/ (+ (exp (* x (+ -1.0 eps_m))) 1.0) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -1.7e-282) {
tmp = (exp((x * (-1.0 + (1.0 / (-1.0 / eps_m))))) + 1.0) / 2.0;
} else if (x <= 2e+71) {
tmp = (exp((x + (x * eps_m))) + 1.0) / 2.0;
} else if ((x <= 4.6e+80) || !(x <= 2.36e+266)) {
tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0;
} else {
tmp = (exp((x * (-1.0 + eps_m))) + 1.0) / 2.0;
}
return tmp;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
real(8) :: tmp
if (x <= (-1.7d-282)) then
tmp = (exp((x * ((-1.0d0) + (1.0d0 / ((-1.0d0) / eps_m))))) + 1.0d0) / 2.0d0
else if (x <= 2d+71) then
tmp = (exp((x + (x * eps_m))) + 1.0d0) / 2.0d0
else if ((x <= 4.6d+80) .or. (.not. (x <= 2.36d+266))) then
tmp = (((-1.0d0) / eps_m) + ((1.0d0 - ((-1.0d0) / eps_m)) + 1.0d0)) / 2.0d0
else
tmp = (exp((x * ((-1.0d0) + eps_m))) + 1.0d0) / 2.0d0
end if
code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
double tmp;
if (x <= -1.7e-282) {
tmp = (Math.exp((x * (-1.0 + (1.0 / (-1.0 / eps_m))))) + 1.0) / 2.0;
} else if (x <= 2e+71) {
tmp = (Math.exp((x + (x * eps_m))) + 1.0) / 2.0;
} else if ((x <= 4.6e+80) || !(x <= 2.36e+266)) {
tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0;
} else {
tmp = (Math.exp((x * (-1.0 + eps_m))) + 1.0) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -1.7e-282: tmp = (math.exp((x * (-1.0 + (1.0 / (-1.0 / eps_m))))) + 1.0) / 2.0 elif x <= 2e+71: tmp = (math.exp((x + (x * eps_m))) + 1.0) / 2.0 elif (x <= 4.6e+80) or not (x <= 2.36e+266): tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0 else: tmp = (math.exp((x * (-1.0 + eps_m))) + 1.0) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -1.7e-282) tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + Float64(1.0 / Float64(-1.0 / eps_m))))) + 1.0) / 2.0); elseif (x <= 2e+71) tmp = Float64(Float64(exp(Float64(x + Float64(x * eps_m))) + 1.0) / 2.0); elseif ((x <= 4.6e+80) || !(x <= 2.36e+266)) tmp = Float64(Float64(Float64(-1.0 / eps_m) + Float64(Float64(1.0 - Float64(-1.0 / eps_m)) + 1.0)) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(-1.0 + 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 <= -1.7e-282) tmp = (exp((x * (-1.0 + (1.0 / (-1.0 / eps_m))))) + 1.0) / 2.0; elseif (x <= 2e+71) tmp = (exp((x + (x * eps_m))) + 1.0) / 2.0; elseif ((x <= 4.6e+80) || ~((x <= 2.36e+266))) tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0; else tmp = (exp((x * (-1.0 + 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, -1.7e-282], N[(N[(N[Exp[N[(x * N[(-1.0 + N[(1.0 / N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2e+71], N[(N[(N[Exp[N[(x + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 4.6e+80], N[Not[LessEqual[x, 2.36e+266]], $MachinePrecision]], N[(N[(N[(-1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(-1.0 + eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{-282}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + \frac{1}{\frac{-1}{eps\_m}}\right)} + 1}{2}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+71}:\\
\;\;\;\;\frac{e^{x + x \cdot eps\_m} + 1}{2}\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+80} \lor \neg \left(x \leq 2.36 \cdot 10^{+266}\right):\\
\;\;\;\;\frac{\frac{-1}{eps\_m} + \left(\left(1 - \frac{-1}{eps\_m}\right) + 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(-1 + eps\_m\right)} + 1}{2}\\
\end{array}
\end{array}
if x < -1.69999999999999999e-282Initial program 71.6%
fma-neg71.6%
/-rgt-identity71.6%
fma-neg71.6%
/-rgt-identity71.6%
distribute-rgt-neg-in71.6%
sub-neg71.6%
metadata-eval71.6%
distribute-rgt-neg-in71.6%
Simplified71.6%
Taylor expanded in x around 0 40.7%
Taylor expanded in eps around inf 68.9%
associate-*r*68.9%
sub-neg68.9%
neg-mul-168.9%
associate-*r*68.9%
associate-*r*68.9%
neg-mul-168.9%
sub-neg68.9%
associate-*r*68.9%
neg-mul-168.9%
distribute-rgt-neg-in68.9%
Simplified68.9%
/-rgt-identity68.9%
clear-num68.9%
add-sqr-sqrt22.0%
sqrt-unprod45.4%
frac-times45.4%
metadata-eval45.4%
metadata-eval45.4%
frac-times45.4%
sqrt-unprod25.1%
add-sqr-sqrt77.4%
Applied egg-rr77.4%
if -1.69999999999999999e-282 < x < 2.0000000000000001e71Initial program 57.3%
fma-neg57.3%
/-rgt-identity57.3%
fma-neg57.3%
/-rgt-identity57.3%
distribute-rgt-neg-in57.3%
sub-neg57.3%
metadata-eval57.3%
distribute-rgt-neg-in57.3%
Simplified57.3%
Taylor expanded in x around 0 43.2%
Taylor expanded in eps around inf 84.0%
associate-*r*84.0%
sub-neg84.0%
neg-mul-184.0%
associate-*r*84.0%
associate-*r*84.0%
neg-mul-184.0%
sub-neg84.0%
associate-*r*84.0%
neg-mul-184.0%
distribute-rgt-neg-in84.0%
Simplified84.0%
add-sqr-sqrt32.0%
sqrt-unprod91.0%
sqr-neg91.0%
sqrt-unprod64.5%
add-sqr-sqrt80.9%
sub-neg80.9%
distribute-rgt-in80.9%
*-un-lft-identity80.9%
add-sqr-sqrt42.3%
sqrt-unprod91.0%
sqr-neg91.0%
sqrt-unprod54.2%
add-sqr-sqrt84.0%
*-commutative84.0%
Applied egg-rr84.0%
if 2.0000000000000001e71 < x < 4.60000000000000008e80 or 2.36e266 < 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 18.7%
Taylor expanded in x around 0 78.5%
+-commutative78.5%
associate--l+78.5%
metadata-eval78.5%
add-sqr-sqrt28.7%
sqrt-unprod35.0%
sqr-neg35.0%
sqrt-unprod1.0%
add-sqr-sqrt2.6%
frac-2neg2.6%
*-rgt-identity2.6%
+-commutative2.6%
metadata-eval2.6%
add-sqr-sqrt1.6%
sqrt-unprod24.1%
sqr-neg24.1%
sqrt-unprod17.2%
add-sqr-sqrt78.5%
frac-2neg78.5%
Applied egg-rr78.5%
if 4.60000000000000008e80 < x < 2.36e266Initial 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 40.7%
Taylor expanded in eps around inf 41.0%
associate-*r*41.0%
sub-neg41.0%
neg-mul-141.0%
associate-*r*41.0%
associate-*r*41.0%
neg-mul-141.0%
sub-neg41.0%
associate-*r*41.0%
neg-mul-141.0%
distribute-rgt-neg-in41.0%
Simplified41.0%
Final simplification73.3%
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
:precision binary64
(if (<= x -0.27)
(/ (* (* x eps_m) (+ -1.0 (/ -1.0 eps_m))) 2.0)
(if (<= x 17.0)
1.0
(if (or (<= x 2.35e+212) (not (<= x 2.25e+265)))
(/ (+ (/ -1.0 eps_m) (+ (- 1.0 (/ -1.0 eps_m)) 1.0)) 2.0)
(/ (* x eps_m) 2.0)))))eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.27) {
tmp = ((x * eps_m) * (-1.0 + (-1.0 / eps_m))) / 2.0;
} else if (x <= 17.0) {
tmp = 1.0;
} else if ((x <= 2.35e+212) || !(x <= 2.25e+265)) {
tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0;
} else {
tmp = (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 <= (-0.27d0)) then
tmp = ((x * eps_m) * ((-1.0d0) + ((-1.0d0) / eps_m))) / 2.0d0
else if (x <= 17.0d0) then
tmp = 1.0d0
else if ((x <= 2.35d+212) .or. (.not. (x <= 2.25d+265))) then
tmp = (((-1.0d0) / eps_m) + ((1.0d0 - ((-1.0d0) / eps_m)) + 1.0d0)) / 2.0d0
else
tmp = (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 <= -0.27) {
tmp = ((x * eps_m) * (-1.0 + (-1.0 / eps_m))) / 2.0;
} else if (x <= 17.0) {
tmp = 1.0;
} else if ((x <= 2.35e+212) || !(x <= 2.25e+265)) {
tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.27: tmp = ((x * eps_m) * (-1.0 + (-1.0 / eps_m))) / 2.0 elif x <= 17.0: tmp = 1.0 elif (x <= 2.35e+212) or not (x <= 2.25e+265): tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.27) tmp = Float64(Float64(Float64(x * eps_m) * Float64(-1.0 + Float64(-1.0 / eps_m))) / 2.0); elseif (x <= 17.0) tmp = 1.0; elseif ((x <= 2.35e+212) || !(x <= 2.25e+265)) tmp = Float64(Float64(Float64(-1.0 / eps_m) + Float64(Float64(1.0 - Float64(-1.0 / eps_m)) + 1.0)) / 2.0); else tmp = Float64(Float64(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 <= -0.27) tmp = ((x * eps_m) * (-1.0 + (-1.0 / eps_m))) / 2.0; elseif (x <= 17.0) tmp = 1.0; elseif ((x <= 2.35e+212) || ~((x <= 2.25e+265))) tmp = ((-1.0 / eps_m) + ((1.0 - (-1.0 / eps_m)) + 1.0)) / 2.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.27], N[(N[(N[(x * eps$95$m), $MachinePrecision] * N[(-1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 17.0], 1.0, If[Or[LessEqual[x, 2.35e+212], N[Not[LessEqual[x, 2.25e+265]], $MachinePrecision]], N[(N[(N[(-1.0 / eps$95$m), $MachinePrecision] + N[(N[(1.0 - N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.27:\\
\;\;\;\;\frac{\left(x \cdot eps\_m\right) \cdot \left(-1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{elif}\;x \leq 17:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.35 \cdot 10^{+212} \lor \neg \left(x \leq 2.25 \cdot 10^{+265}\right):\\
\;\;\;\;\frac{\frac{-1}{eps\_m} + \left(\left(1 - \frac{-1}{eps\_m}\right) + 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -0.27000000000000002Initial 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 42.6%
Taylor expanded in x around inf 13.2%
mul-1-neg13.2%
*-commutative13.2%
associate-*l*13.2%
distribute-rgt-neg-in13.2%
distribute-neg-in13.2%
metadata-eval13.2%
distribute-neg-frac13.2%
metadata-eval13.2%
Simplified13.2%
Taylor expanded in eps around inf 13.2%
neg-mul-113.2%
distribute-lft-neg-in13.2%
*-commutative13.2%
Simplified13.2%
/-rgt-identity13.2%
clear-num13.2%
add-sqr-sqrt0.1%
sqrt-unprod0.1%
frac-times0.1%
metadata-eval0.1%
metadata-eval0.1%
frac-times0.1%
sqrt-unprod0.0%
add-sqr-sqrt40.2%
clear-num40.2%
div-inv40.2%
metadata-eval40.2%
Applied egg-rr40.2%
*-commutative40.2%
neg-mul-140.2%
Simplified40.2%
if -0.27000000000000002 < x < 17Initial program 53.8%
fma-neg53.9%
/-rgt-identity53.9%
fma-neg53.8%
/-rgt-identity53.8%
distribute-rgt-neg-in53.8%
sub-neg53.8%
metadata-eval53.8%
distribute-rgt-neg-in53.8%
Simplified53.8%
Taylor expanded in x around 0 75.0%
if 17 < x < 2.34999999999999996e212 or 2.24999999999999993e265 < 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 35.0%
Taylor expanded in x around 0 48.3%
+-commutative48.3%
associate--l+48.3%
metadata-eval48.3%
add-sqr-sqrt17.9%
sqrt-unprod20.6%
sqr-neg20.6%
sqrt-unprod1.1%
add-sqr-sqrt2.8%
frac-2neg2.8%
*-rgt-identity2.8%
+-commutative2.8%
metadata-eval2.8%
add-sqr-sqrt1.7%
sqrt-unprod14.1%
sqr-neg14.1%
sqrt-unprod9.2%
add-sqr-sqrt48.3%
frac-2neg48.3%
Applied egg-rr48.3%
if 2.34999999999999996e212 < x < 2.24999999999999993e265Initial 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 34.6%
Taylor expanded in x around inf 27.9%
mul-1-neg27.9%
*-commutative27.9%
associate-*l*27.9%
distribute-rgt-neg-in27.9%
distribute-neg-in27.9%
metadata-eval27.9%
distribute-neg-frac27.9%
metadata-eval27.9%
Simplified27.9%
Taylor expanded in eps around inf 28.1%
*-commutative28.1%
Simplified28.1%
Final simplification61.4%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x -0.48) (/ (* (* x eps_m) (+ -1.0 (/ -1.0 eps_m))) 2.0) (/ (+ 2.0 (* x eps_m)) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= -0.48) {
tmp = ((x * eps_m) * (-1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (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 <= (-0.48d0)) then
tmp = ((x * eps_m) * ((-1.0d0) + ((-1.0d0) / eps_m))) / 2.0d0
else
tmp = (2.0d0 + (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 <= -0.48) {
tmp = ((x * eps_m) * (-1.0 + (-1.0 / eps_m))) / 2.0;
} else {
tmp = (2.0 + (x * eps_m)) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= -0.48: tmp = ((x * eps_m) * (-1.0 + (-1.0 / eps_m))) / 2.0 else: tmp = (2.0 + (x * eps_m)) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= -0.48) tmp = Float64(Float64(Float64(x * eps_m) * Float64(-1.0 + Float64(-1.0 / eps_m))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(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 <= -0.48) tmp = ((x * eps_m) * (-1.0 + (-1.0 / eps_m))) / 2.0; else tmp = (2.0 + (x * eps_m)) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, -0.48], N[(N[(N[(x * eps$95$m), $MachinePrecision] * N[(-1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.48:\\
\;\;\;\;\frac{\left(x \cdot eps\_m\right) \cdot \left(-1 + \frac{-1}{eps\_m}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < -0.47999999999999998Initial 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 42.6%
Taylor expanded in x around inf 13.2%
mul-1-neg13.2%
*-commutative13.2%
associate-*l*13.2%
distribute-rgt-neg-in13.2%
distribute-neg-in13.2%
metadata-eval13.2%
distribute-neg-frac13.2%
metadata-eval13.2%
Simplified13.2%
Taylor expanded in eps around inf 13.2%
neg-mul-113.2%
distribute-lft-neg-in13.2%
*-commutative13.2%
Simplified13.2%
/-rgt-identity13.2%
clear-num13.2%
add-sqr-sqrt0.1%
sqrt-unprod0.1%
frac-times0.1%
metadata-eval0.1%
metadata-eval0.1%
frac-times0.1%
sqrt-unprod0.0%
add-sqr-sqrt40.2%
clear-num40.2%
div-inv40.2%
metadata-eval40.2%
Applied egg-rr40.2%
*-commutative40.2%
neg-mul-140.2%
Simplified40.2%
if -0.47999999999999998 < x Initial program 69.4%
fma-neg69.5%
/-rgt-identity69.5%
fma-neg69.4%
/-rgt-identity69.4%
distribute-rgt-neg-in69.4%
sub-neg69.4%
metadata-eval69.4%
distribute-rgt-neg-in69.4%
Simplified69.4%
Taylor expanded in x around 0 40.9%
Taylor expanded in x around 0 38.4%
mul-1-neg38.4%
*-commutative38.4%
associate-*l*38.4%
distribute-rgt-neg-in38.4%
distribute-neg-in38.4%
metadata-eval38.4%
distribute-neg-frac38.4%
metadata-eval38.4%
Simplified38.4%
Taylor expanded in eps around inf 55.9%
*-commutative8.9%
Simplified55.9%
Final simplification53.8%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (if (<= x 15.2) 1.0 (/ (* x eps_m) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
double tmp;
if (x <= 15.2) {
tmp = 1.0;
} else {
tmp = (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 <= 15.2d0) then
tmp = 1.0d0
else
tmp = (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 <= 15.2) {
tmp = 1.0;
} else {
tmp = (x * eps_m) / 2.0;
}
return tmp;
}
eps_m = math.fabs(eps) def code(x, eps_m): tmp = 0 if x <= 15.2: tmp = 1.0 else: tmp = (x * eps_m) / 2.0 return tmp
eps_m = abs(eps) function code(x, eps_m) tmp = 0.0 if (x <= 15.2) tmp = 1.0; else tmp = Float64(Float64(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 <= 15.2) tmp = 1.0; else tmp = (x * eps_m) / 2.0; end tmp_2 = tmp; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := If[LessEqual[x, 15.2], 1.0, N[(N[(x * eps$95$m), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\begin{array}{l}
\mathbf{if}\;x \leq 15.2:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot eps\_m}{2}\\
\end{array}
\end{array}
if x < 15.199999999999999Initial program 62.5%
fma-neg62.5%
/-rgt-identity62.5%
fma-neg62.5%
/-rgt-identity62.5%
distribute-rgt-neg-in62.5%
sub-neg62.5%
metadata-eval62.5%
distribute-rgt-neg-in62.5%
Simplified62.5%
Taylor expanded in x around 0 61.5%
if 15.199999999999999 < 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 31.0%
Taylor expanded in x around inf 19.0%
mul-1-neg19.0%
*-commutative19.0%
associate-*l*19.0%
distribute-rgt-neg-in19.0%
distribute-neg-in19.0%
metadata-eval19.0%
distribute-neg-frac19.0%
metadata-eval19.0%
Simplified19.0%
Taylor expanded in eps around inf 19.6%
*-commutative19.6%
Simplified19.6%
Final simplification49.2%
eps_m = (fabs.f64 eps) (FPCore (x eps_m) :precision binary64 (/ (+ 2.0 (* x eps_m)) 2.0))
eps_m = fabs(eps);
double code(double x, double eps_m) {
return (2.0 + (x * eps_m)) / 2.0;
}
eps_m = abs(eps)
real(8) function code(x, eps_m)
real(8), intent (in) :: x
real(8), intent (in) :: eps_m
code = (2.0d0 + (x * eps_m)) / 2.0d0
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
return (2.0 + (x * eps_m)) / 2.0;
}
eps_m = math.fabs(eps) def code(x, eps_m): return (2.0 + (x * eps_m)) / 2.0
eps_m = abs(eps) function code(x, eps_m) return Float64(Float64(2.0 + Float64(x * eps_m)) / 2.0) end
eps_m = abs(eps); function tmp = code(x, eps_m) tmp = (2.0 + (x * eps_m)) / 2.0; end
eps_m = N[Abs[eps], $MachinePrecision] code[x_, eps$95$m_] := N[(N[(2.0 + N[(x * eps$95$m), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps_m = \left|\varepsilon\right|
\\
\frac{2 + x \cdot eps\_m}{2}
\end{array}
Initial program 73.5%
fma-neg73.5%
/-rgt-identity73.5%
fma-neg73.5%
/-rgt-identity73.5%
distribute-rgt-neg-in73.5%
sub-neg73.5%
metadata-eval73.5%
distribute-rgt-neg-in73.5%
Simplified73.5%
Taylor expanded in x around 0 40.1%
Taylor expanded in x around 0 35.1%
mul-1-neg35.1%
*-commutative35.1%
associate-*l*35.1%
distribute-rgt-neg-in35.1%
distribute-neg-in35.1%
metadata-eval35.1%
distribute-neg-frac35.1%
metadata-eval35.1%
Simplified35.1%
Taylor expanded in eps around inf 50.2%
*-commutative9.5%
Simplified50.2%
Final simplification50.2%
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 73.5%
fma-neg73.5%
/-rgt-identity73.5%
fma-neg73.5%
/-rgt-identity73.5%
distribute-rgt-neg-in73.5%
sub-neg73.5%
metadata-eval73.5%
distribute-rgt-neg-in73.5%
Simplified73.5%
Taylor expanded in x around 0 44.4%
Final simplification44.4%
herbie shell --seed 2024096
(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))