
(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 13 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}
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (+ x 1.0) (exp (- x)))))
(if (<= eps 1e-29)
(/ (+ t_0 t_0) 2.0)
(/ (+ (exp (* x (+ eps -1.0))) (exp (* eps (- x)))) 2.0))))eps = abs(eps);
double code(double x, double eps) {
double t_0 = (x + 1.0) * exp(-x);
double tmp;
if (eps <= 1e-29) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (exp((x * (eps + -1.0))) + exp((eps * -x))) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = (x + 1.0d0) * exp(-x)
if (eps <= 1d-29) then
tmp = (t_0 + t_0) / 2.0d0
else
tmp = (exp((x * (eps + (-1.0d0)))) + exp((eps * -x))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double t_0 = (x + 1.0) * Math.exp(-x);
double tmp;
if (eps <= 1e-29) {
tmp = (t_0 + t_0) / 2.0;
} else {
tmp = (Math.exp((x * (eps + -1.0))) + Math.exp((eps * -x))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): t_0 = (x + 1.0) * math.exp(-x) tmp = 0 if eps <= 1e-29: tmp = (t_0 + t_0) / 2.0 else: tmp = (math.exp((x * (eps + -1.0))) + math.exp((eps * -x))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) t_0 = Float64(Float64(x + 1.0) * exp(Float64(-x))) tmp = 0.0 if (eps <= 1e-29) tmp = Float64(Float64(t_0 + t_0) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(eps * Float64(-x)))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) t_0 = (x + 1.0) * exp(-x); tmp = 0.0; if (eps <= 1e-29) tmp = (t_0 + t_0) / 2.0; else tmp = (exp((x * (eps + -1.0))) + exp((eps * -x))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function
code[x_, eps_] := Block[{t$95$0 = N[(N[(x + 1.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, 1e-29], N[(N[(t$95$0 + t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(eps * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
t_0 := \left(x + 1\right) \cdot e^{-x}\\
\mathbf{if}\;\varepsilon \leq 10^{-29}:\\
\;\;\;\;\frac{t_0 + t_0}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{\varepsilon \cdot \left(-x\right)}}{2}\\
\end{array}
\end{array}
if eps < 9.99999999999999943e-30Initial program 67.1%
sub-neg67.1%
neg-sub067.1%
associate-+r-67.1%
Simplified67.1%
Taylor expanded in eps around 0 64.5%
distribute-rgt1-in64.5%
neg-mul-164.5%
distribute-lft-out64.5%
distribute-rgt1-in65.0%
neg-mul-165.0%
Simplified65.0%
if 9.99999999999999943e-30 < eps Initial program 98.8%
Simplified72.6%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification76.2%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(if (<= x -120000000.0)
(/ (/ 2.0 (exp x)) 2.0)
(if (<= x -1.1e-196)
(/
(+
2.0
(*
x
(-
(* (+ eps -1.0) (+ 1.0 (/ 1.0 eps)))
(/ (- 1.0 (* eps eps)) (/ (- 1.0 eps) (+ 1.0 (/ -1.0 eps)))))))
2.0)
(/ (+ (exp (- x)) (exp (* x (+ eps -1.0)))) 2.0))))eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= -120000000.0) {
tmp = (2.0 / exp(x)) / 2.0;
} else if (x <= -1.1e-196) {
tmp = (2.0 + (x * (((eps + -1.0) * (1.0 + (1.0 / eps))) - ((1.0 - (eps * eps)) / ((1.0 - eps) / (1.0 + (-1.0 / eps))))))) / 2.0;
} else {
tmp = (exp(-x) + exp((x * (eps + -1.0)))) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-120000000.0d0)) then
tmp = (2.0d0 / exp(x)) / 2.0d0
else if (x <= (-1.1d-196)) then
tmp = (2.0d0 + (x * (((eps + (-1.0d0)) * (1.0d0 + (1.0d0 / eps))) - ((1.0d0 - (eps * eps)) / ((1.0d0 - eps) / (1.0d0 + ((-1.0d0) / eps))))))) / 2.0d0
else
tmp = (exp(-x) + exp((x * (eps + (-1.0d0))))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= -120000000.0) {
tmp = (2.0 / Math.exp(x)) / 2.0;
} else if (x <= -1.1e-196) {
tmp = (2.0 + (x * (((eps + -1.0) * (1.0 + (1.0 / eps))) - ((1.0 - (eps * eps)) / ((1.0 - eps) / (1.0 + (-1.0 / eps))))))) / 2.0;
} else {
tmp = (Math.exp(-x) + Math.exp((x * (eps + -1.0)))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= -120000000.0: tmp = (2.0 / math.exp(x)) / 2.0 elif x <= -1.1e-196: tmp = (2.0 + (x * (((eps + -1.0) * (1.0 + (1.0 / eps))) - ((1.0 - (eps * eps)) / ((1.0 - eps) / (1.0 + (-1.0 / eps))))))) / 2.0 else: tmp = (math.exp(-x) + math.exp((x * (eps + -1.0)))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= -120000000.0) tmp = Float64(Float64(2.0 / exp(x)) / 2.0); elseif (x <= -1.1e-196) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(Float64(eps + -1.0) * Float64(1.0 + Float64(1.0 / eps))) - Float64(Float64(1.0 - Float64(eps * eps)) / Float64(Float64(1.0 - eps) / Float64(1.0 + Float64(-1.0 / eps))))))) / 2.0); else tmp = Float64(Float64(exp(Float64(-x)) + exp(Float64(x * Float64(eps + -1.0)))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -120000000.0) tmp = (2.0 / exp(x)) / 2.0; elseif (x <= -1.1e-196) tmp = (2.0 + (x * (((eps + -1.0) * (1.0 + (1.0 / eps))) - ((1.0 - (eps * eps)) / ((1.0 - eps) / (1.0 + (-1.0 / eps))))))) / 2.0; else tmp = (exp(-x) + exp((x * (eps + -1.0)))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, -120000000.0], N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -1.1e-196], N[(N[(2.0 + N[(x * N[(N[(N[(eps + -1.0), $MachinePrecision] * N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 - eps), $MachinePrecision] / N[(1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[(-x)], $MachinePrecision] + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -120000000:\\
\;\;\;\;\frac{\frac{2}{e^{x}}}{2}\\
\mathbf{elif}\;x \leq -1.1 \cdot 10^{-196}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(\varepsilon + -1\right) \cdot \left(1 + \frac{1}{\varepsilon}\right) - \frac{1 - \varepsilon \cdot \varepsilon}{\frac{1 - \varepsilon}{1 + \frac{-1}{\varepsilon}}}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{-x} + e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\end{array}
\end{array}
if x < -1.2e8Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around 0 100.0%
Taylor expanded in eps around 0 100.0%
cancel-sign-sub-inv100.0%
neg-mul-1100.0%
metadata-eval100.0%
neg-mul-1100.0%
distribute-rgt1-in100.0%
metadata-eval100.0%
exp-neg100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
if -1.2e8 < x < -1.10000000000000007e-196Initial program 59.0%
Simplified59.0%
Taylor expanded in x around 0 54.7%
*-commutative54.7%
flip-+69.2%
associate-*r/69.2%
sub-neg69.2%
distribute-neg-frac69.2%
metadata-eval69.2%
metadata-eval69.2%
Applied egg-rr69.2%
*-commutative69.2%
associate-/l*69.2%
+-commutative69.2%
Simplified69.2%
if -1.10000000000000007e-196 < x Initial program 75.6%
Simplified55.7%
Taylor expanded in eps around inf 98.3%
Taylor expanded in eps around 0 81.2%
Taylor expanded in eps around -inf 81.2%
cancel-sign-sub-inv81.2%
associate-*r*81.2%
neg-mul-181.2%
mul-1-neg81.2%
metadata-eval81.2%
neg-mul-181.2%
*-lft-identity81.2%
Simplified81.2%
Final simplification82.6%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= eps 1e-29) (/ (+ (/ (+ x 2.0) (exp x)) (/ x (exp x))) 2.0) (/ (+ (exp (* x (+ eps -1.0))) (exp (* eps (- x)))) 2.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (eps <= 1e-29) {
tmp = (((x + 2.0) / exp(x)) + (x / exp(x))) / 2.0;
} else {
tmp = (exp((x * (eps + -1.0))) + exp((eps * -x))) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= 1d-29) then
tmp = (((x + 2.0d0) / exp(x)) + (x / exp(x))) / 2.0d0
else
tmp = (exp((x * (eps + (-1.0d0)))) + exp((eps * -x))) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (eps <= 1e-29) {
tmp = (((x + 2.0) / Math.exp(x)) + (x / Math.exp(x))) / 2.0;
} else {
tmp = (Math.exp((x * (eps + -1.0))) + Math.exp((eps * -x))) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if eps <= 1e-29: tmp = (((x + 2.0) / math.exp(x)) + (x / math.exp(x))) / 2.0 else: tmp = (math.exp((x * (eps + -1.0))) + math.exp((eps * -x))) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (eps <= 1e-29) tmp = Float64(Float64(Float64(Float64(x + 2.0) / exp(x)) + Float64(x / exp(x))) / 2.0); else tmp = Float64(Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(eps * Float64(-x)))) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 1e-29) tmp = (((x + 2.0) / exp(x)) + (x / exp(x))) / 2.0; else tmp = (exp((x * (eps + -1.0))) + exp((eps * -x))) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[eps, 1e-29], N[(N[(N[(N[(x + 2.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] + N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(eps * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 10^{-29}:\\
\;\;\;\;\frac{\frac{x + 2}{e^{x}} + \frac{x}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \left(\varepsilon + -1\right)} + e^{\varepsilon \cdot \left(-x\right)}}{2}\\
\end{array}
\end{array}
if eps < 9.99999999999999943e-30Initial program 67.1%
sub-neg67.1%
neg-sub067.1%
associate-+r-67.1%
Simplified67.1%
Taylor expanded in eps around 0 64.5%
associate--r+64.5%
cancel-sign-sub-inv64.5%
distribute-rgt1-in64.4%
distribute-rgt-out--65.0%
neg-mul-165.0%
neg-mul-165.0%
rec-exp65.0%
associate-*r/65.0%
*-rgt-identity65.0%
metadata-eval65.0%
*-lft-identity65.0%
Simplified65.0%
Taylor expanded in x around inf 64.4%
distribute-rgt-out65.0%
rec-exp65.0%
+-commutative65.0%
associate-*l/65.0%
*-lft-identity65.0%
Simplified65.0%
if 9.99999999999999943e-30 < eps Initial program 98.8%
Simplified72.6%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification76.2%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= eps 0.76) (/ (+ (/ (+ x 2.0) (exp x)) (/ x (exp x))) 2.0) (/ (+ 2.0 (- (* (* eps eps) (* x x)) x)) 2.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (eps <= 0.76) {
tmp = (((x + 2.0) / exp(x)) + (x / exp(x))) / 2.0;
} else {
tmp = (2.0 + (((eps * eps) * (x * x)) - x)) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= 0.76d0) then
tmp = (((x + 2.0d0) / exp(x)) + (x / exp(x))) / 2.0d0
else
tmp = (2.0d0 + (((eps * eps) * (x * x)) - x)) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (eps <= 0.76) {
tmp = (((x + 2.0) / Math.exp(x)) + (x / Math.exp(x))) / 2.0;
} else {
tmp = (2.0 + (((eps * eps) * (x * x)) - x)) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if eps <= 0.76: tmp = (((x + 2.0) / math.exp(x)) + (x / math.exp(x))) / 2.0 else: tmp = (2.0 + (((eps * eps) * (x * x)) - x)) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (eps <= 0.76) tmp = Float64(Float64(Float64(Float64(x + 2.0) / exp(x)) + Float64(x / exp(x))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(Float64(Float64(eps * eps) * Float64(x * x)) - x)) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 0.76) tmp = (((x + 2.0) / exp(x)) + (x / exp(x))) / 2.0; else tmp = (2.0 + (((eps * eps) * (x * x)) - x)) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[eps, 0.76], N[(N[(N[(N[(x + 2.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] + N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(N[(N[(eps * eps), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 0.76:\\
\;\;\;\;\frac{\frac{x + 2}{e^{x}} + \frac{x}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(x \cdot x\right) - x\right)}{2}\\
\end{array}
\end{array}
if eps < 0.76000000000000001Initial program 67.1%
sub-neg67.1%
neg-sub067.1%
associate-+r-67.1%
Simplified67.1%
Taylor expanded in eps around 0 65.1%
associate--r+65.1%
cancel-sign-sub-inv65.1%
distribute-rgt1-in65.0%
distribute-rgt-out--65.6%
neg-mul-165.6%
neg-mul-165.6%
rec-exp65.6%
associate-*r/65.6%
*-rgt-identity65.6%
metadata-eval65.6%
*-lft-identity65.6%
Simplified65.6%
Taylor expanded in x around inf 65.0%
distribute-rgt-out65.6%
rec-exp65.6%
+-commutative65.6%
associate-*l/65.6%
*-lft-identity65.6%
Simplified65.6%
if 0.76000000000000001 < eps Initial program 100.0%
Simplified72.8%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 75.2%
+-commutative75.2%
mul-1-neg75.2%
unsub-neg75.2%
unpow275.2%
cancel-sign-sub-inv75.2%
metadata-eval75.2%
distribute-lft-out75.2%
sub-neg75.2%
metadata-eval75.2%
+-commutative75.2%
unpow275.2%
Simplified75.2%
Taylor expanded in eps around inf 75.2%
unpow275.2%
*-commutative75.2%
unpow275.2%
Simplified75.2%
Final simplification68.6%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= eps 4.7e+30) (/ (/ 2.0 (exp x)) 2.0) (/ (+ 2.0 (- (* (* eps eps) (* x x)) x)) 2.0)))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (eps <= 4.7e+30) {
tmp = (2.0 / exp(x)) / 2.0;
} else {
tmp = (2.0 + (((eps * eps) * (x * x)) - x)) / 2.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= 4.7d+30) then
tmp = (2.0d0 / exp(x)) / 2.0d0
else
tmp = (2.0d0 + (((eps * eps) * (x * x)) - x)) / 2.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (eps <= 4.7e+30) {
tmp = (2.0 / Math.exp(x)) / 2.0;
} else {
tmp = (2.0 + (((eps * eps) * (x * x)) - x)) / 2.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if eps <= 4.7e+30: tmp = (2.0 / math.exp(x)) / 2.0 else: tmp = (2.0 + (((eps * eps) * (x * x)) - x)) / 2.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (eps <= 4.7e+30) tmp = Float64(Float64(2.0 / exp(x)) / 2.0); else tmp = Float64(Float64(2.0 + Float64(Float64(Float64(eps * eps) * Float64(x * x)) - x)) / 2.0); end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 4.7e+30) tmp = (2.0 / exp(x)) / 2.0; else tmp = (2.0 + (((eps * eps) * (x * x)) - x)) / 2.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[eps, 4.7e+30], N[(N[(2.0 / N[Exp[x], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(N[(N[(eps * eps), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 4.7 \cdot 10^{+30}:\\
\;\;\;\;\frac{\frac{2}{e^{x}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(x \cdot x\right) - x\right)}{2}\\
\end{array}
\end{array}
if eps < 4.6999999999999999e30Initial program 68.2%
Simplified54.0%
Taylor expanded in eps around inf 97.7%
Taylor expanded in eps around 0 83.3%
Taylor expanded in eps around 0 78.1%
cancel-sign-sub-inv78.1%
neg-mul-178.1%
metadata-eval78.1%
neg-mul-178.1%
distribute-rgt1-in78.1%
metadata-eval78.1%
exp-neg78.1%
associate-*r/78.1%
metadata-eval78.1%
Simplified78.1%
if 4.6999999999999999e30 < eps Initial program 100.0%
Simplified74.3%
Taylor expanded in eps around inf 100.0%
Taylor expanded in eps around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 75.7%
+-commutative75.7%
mul-1-neg75.7%
unsub-neg75.7%
unpow275.7%
cancel-sign-sub-inv75.7%
metadata-eval75.7%
distribute-lft-out75.7%
sub-neg75.7%
metadata-eval75.7%
+-commutative75.7%
unpow275.7%
Simplified75.7%
Taylor expanded in eps around inf 75.7%
unpow275.7%
*-commutative75.7%
unpow275.7%
Simplified75.7%
Final simplification77.4%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(if (<= x 580.0)
1.0
(if (<= x 6.3e+102)
0.0
(if (<= x 1.7e+234) (/ (* x (+ 2.0 (* x (+ x -2.0)))) 2.0) 0.0))))eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 580.0) {
tmp = 1.0;
} else if (x <= 6.3e+102) {
tmp = 0.0;
} else if (x <= 1.7e+234) {
tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 580.0d0) then
tmp = 1.0d0
else if (x <= 6.3d+102) then
tmp = 0.0d0
else if (x <= 1.7d+234) then
tmp = (x * (2.0d0 + (x * (x + (-2.0d0))))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 580.0) {
tmp = 1.0;
} else if (x <= 6.3e+102) {
tmp = 0.0;
} else if (x <= 1.7e+234) {
tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 580.0: tmp = 1.0 elif x <= 6.3e+102: tmp = 0.0 elif x <= 1.7e+234: tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0 else: tmp = 0.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 580.0) tmp = 1.0; elseif (x <= 6.3e+102) tmp = 0.0; elseif (x <= 1.7e+234) tmp = Float64(Float64(x * Float64(2.0 + Float64(x * Float64(x + -2.0)))) / 2.0); else tmp = 0.0; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 580.0) tmp = 1.0; elseif (x <= 6.3e+102) tmp = 0.0; elseif (x <= 1.7e+234) tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 580.0], 1.0, If[LessEqual[x, 6.3e+102], 0.0, If[LessEqual[x, 1.7e+234], N[(N[(x * N[(2.0 + N[(x * N[(x + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 580:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 6.3 \cdot 10^{+102}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{+234}:\\
\;\;\;\;\frac{x \cdot \left(2 + x \cdot \left(x + -2\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 580Initial program 68.6%
sub-neg68.6%
neg-sub068.6%
associate-+r-68.6%
Simplified68.6%
Taylor expanded in x around 0 50.6%
if 580 < x < 6.30000000000000029e102 or 1.7e234 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 61.6%
neg-mul-161.6%
rec-exp61.6%
neg-mul-161.6%
div-sub61.6%
+-inverses61.6%
Simplified61.6%
if 6.30000000000000029e102 < x < 1.7e234Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in eps around 0 37.7%
associate--r+37.7%
cancel-sign-sub-inv37.7%
distribute-rgt1-in37.7%
distribute-rgt-out--37.7%
neg-mul-137.7%
neg-mul-137.7%
rec-exp37.7%
associate-*r/37.7%
*-rgt-identity37.7%
metadata-eval37.7%
*-lft-identity37.7%
Simplified37.7%
Taylor expanded in x around inf 37.7%
rec-exp37.7%
count-237.7%
rec-exp37.7%
associate-*r/37.7%
metadata-eval37.7%
Simplified37.7%
Taylor expanded in x around 0 63.9%
+-commutative63.9%
unpow263.9%
distribute-rgt-out63.9%
Simplified63.9%
Final simplification53.9%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(if (<= x 540.0)
(/ (+ 2.0 (* x (+ 4.0 (* x 3.0)))) 2.0)
(if (<= x 1.7e+102)
0.0
(if (<= x 4.4e+232) (/ (* x (+ 2.0 (* x (+ x -2.0)))) 2.0) 0.0))))eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 540.0) {
tmp = (2.0 + (x * (4.0 + (x * 3.0)))) / 2.0;
} else if (x <= 1.7e+102) {
tmp = 0.0;
} else if (x <= 4.4e+232) {
tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 540.0d0) then
tmp = (2.0d0 + (x * (4.0d0 + (x * 3.0d0)))) / 2.0d0
else if (x <= 1.7d+102) then
tmp = 0.0d0
else if (x <= 4.4d+232) then
tmp = (x * (2.0d0 + (x * (x + (-2.0d0))))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 540.0) {
tmp = (2.0 + (x * (4.0 + (x * 3.0)))) / 2.0;
} else if (x <= 1.7e+102) {
tmp = 0.0;
} else if (x <= 4.4e+232) {
tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 540.0: tmp = (2.0 + (x * (4.0 + (x * 3.0)))) / 2.0 elif x <= 1.7e+102: tmp = 0.0 elif x <= 4.4e+232: tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0 else: tmp = 0.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 540.0) tmp = Float64(Float64(2.0 + Float64(x * Float64(4.0 + Float64(x * 3.0)))) / 2.0); elseif (x <= 1.7e+102) tmp = 0.0; elseif (x <= 4.4e+232) tmp = Float64(Float64(x * Float64(2.0 + Float64(x * Float64(x + -2.0)))) / 2.0); else tmp = 0.0; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 540.0) tmp = (2.0 + (x * (4.0 + (x * 3.0)))) / 2.0; elseif (x <= 1.7e+102) tmp = 0.0; elseif (x <= 4.4e+232) tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 540.0], N[(N[(2.0 + N[(x * N[(4.0 + N[(x * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.7e+102], 0.0, If[LessEqual[x, 4.4e+232], N[(N[(x * N[(2.0 + N[(x * N[(x + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 540:\\
\;\;\;\;\frac{2 + x \cdot \left(4 + x \cdot 3\right)}{2}\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{+102}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{+232}:\\
\;\;\;\;\frac{x \cdot \left(2 + x \cdot \left(x + -2\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 540Initial program 68.6%
sub-neg68.6%
neg-sub068.6%
associate-+r-68.6%
Simplified68.6%
Taylor expanded in eps around 0 50.8%
associate--r+50.8%
cancel-sign-sub-inv50.8%
distribute-rgt1-in50.8%
distribute-rgt-out--51.3%
neg-mul-151.3%
neg-mul-151.3%
rec-exp51.3%
associate-*r/51.3%
*-rgt-identity51.3%
metadata-eval51.3%
*-lft-identity51.3%
Simplified51.3%
*-commutative51.3%
div-inv51.3%
exp-neg51.3%
distribute-rgt-out51.3%
add-sqr-sqrt24.1%
sqrt-unprod49.9%
sqr-neg49.9%
sqrt-unprod25.7%
add-sqr-sqrt49.4%
associate--l+49.4%
metadata-eval49.4%
Applied egg-rr49.4%
Taylor expanded in x around 0 64.2%
+-commutative64.2%
*-commutative64.2%
*-commutative64.2%
unpow264.2%
associate-*l*64.2%
distribute-lft-out64.2%
Simplified64.2%
if 540 < x < 1.7e102 or 4.4e232 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 61.6%
neg-mul-161.6%
rec-exp61.6%
neg-mul-161.6%
div-sub61.6%
+-inverses61.6%
Simplified61.6%
if 1.7e102 < x < 4.4e232Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in eps around 0 37.7%
associate--r+37.7%
cancel-sign-sub-inv37.7%
distribute-rgt1-in37.7%
distribute-rgt-out--37.7%
neg-mul-137.7%
neg-mul-137.7%
rec-exp37.7%
associate-*r/37.7%
*-rgt-identity37.7%
metadata-eval37.7%
*-lft-identity37.7%
Simplified37.7%
Taylor expanded in x around inf 37.7%
rec-exp37.7%
count-237.7%
rec-exp37.7%
associate-*r/37.7%
metadata-eval37.7%
Simplified37.7%
Taylor expanded in x around 0 63.9%
+-commutative63.9%
unpow263.9%
distribute-rgt-out63.9%
Simplified63.9%
Final simplification63.8%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(if (<= x 540.0)
(/ (- (+ 2.0 (* x (* x 0.5))) x) 2.0)
(if (<= x 5e+92)
0.0
(if (<= x 1.05e+234) (/ (* x (+ 2.0 (* x (+ x -2.0)))) 2.0) 0.0))))eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 540.0) {
tmp = ((2.0 + (x * (x * 0.5))) - x) / 2.0;
} else if (x <= 5e+92) {
tmp = 0.0;
} else if (x <= 1.05e+234) {
tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 540.0d0) then
tmp = ((2.0d0 + (x * (x * 0.5d0))) - x) / 2.0d0
else if (x <= 5d+92) then
tmp = 0.0d0
else if (x <= 1.05d+234) then
tmp = (x * (2.0d0 + (x * (x + (-2.0d0))))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 540.0) {
tmp = ((2.0 + (x * (x * 0.5))) - x) / 2.0;
} else if (x <= 5e+92) {
tmp = 0.0;
} else if (x <= 1.05e+234) {
tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 540.0: tmp = ((2.0 + (x * (x * 0.5))) - x) / 2.0 elif x <= 5e+92: tmp = 0.0 elif x <= 1.05e+234: tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0 else: tmp = 0.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 540.0) tmp = Float64(Float64(Float64(2.0 + Float64(x * Float64(x * 0.5))) - x) / 2.0); elseif (x <= 5e+92) tmp = 0.0; elseif (x <= 1.05e+234) tmp = Float64(Float64(x * Float64(2.0 + Float64(x * Float64(x + -2.0)))) / 2.0); else tmp = 0.0; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 540.0) tmp = ((2.0 + (x * (x * 0.5))) - x) / 2.0; elseif (x <= 5e+92) tmp = 0.0; elseif (x <= 1.05e+234) tmp = (x * (2.0 + (x * (x + -2.0)))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 540.0], N[(N[(N[(2.0 + N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5e+92], 0.0, If[LessEqual[x, 1.05e+234], N[(N[(x * N[(2.0 + N[(x * N[(x + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 540:\\
\;\;\;\;\frac{\left(2 + x \cdot \left(x \cdot 0.5\right)\right) - x}{2}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+92}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+234}:\\
\;\;\;\;\frac{x \cdot \left(2 + x \cdot \left(x + -2\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 540Initial program 68.6%
Simplified44.4%
Taylor expanded in eps around inf 97.7%
Taylor expanded in eps around inf 97.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in x around 0 79.5%
+-commutative79.5%
mul-1-neg79.5%
unsub-neg79.5%
unpow279.5%
cancel-sign-sub-inv79.5%
metadata-eval79.5%
distribute-lft-out79.5%
sub-neg79.5%
metadata-eval79.5%
+-commutative79.5%
unpow279.5%
Simplified79.5%
Taylor expanded in eps around 0 64.3%
*-commutative64.3%
unpow264.3%
associate-*l*64.3%
Simplified64.3%
if 540 < x < 5.00000000000000022e92 or 1.05e234 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 61.6%
neg-mul-161.6%
rec-exp61.6%
neg-mul-161.6%
div-sub61.6%
+-inverses61.6%
Simplified61.6%
if 5.00000000000000022e92 < x < 1.05e234Initial program 100.0%
sub-neg100.0%
neg-sub0100.0%
associate-+r-100.0%
Simplified100.0%
Taylor expanded in eps around 0 37.7%
associate--r+37.7%
cancel-sign-sub-inv37.7%
distribute-rgt1-in37.7%
distribute-rgt-out--37.7%
neg-mul-137.7%
neg-mul-137.7%
rec-exp37.7%
associate-*r/37.7%
*-rgt-identity37.7%
metadata-eval37.7%
*-lft-identity37.7%
Simplified37.7%
Taylor expanded in x around inf 37.7%
rec-exp37.7%
count-237.7%
rec-exp37.7%
associate-*r/37.7%
metadata-eval37.7%
Simplified37.7%
Taylor expanded in x around 0 63.9%
+-commutative63.9%
unpow263.9%
distribute-rgt-out63.9%
Simplified63.9%
Final simplification63.8%
NOTE: eps should be positive before calling this function
(FPCore (x eps)
:precision binary64
(if (<= x 580.0)
1.0
(if (<= x 1.25e+195)
0.0
(if (<= x 6.2e+232) (/ (+ 2.0 (* eps x)) 2.0) 0.0))))eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 580.0) {
tmp = 1.0;
} else if (x <= 1.25e+195) {
tmp = 0.0;
} else if (x <= 6.2e+232) {
tmp = (2.0 + (eps * x)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 580.0d0) then
tmp = 1.0d0
else if (x <= 1.25d+195) then
tmp = 0.0d0
else if (x <= 6.2d+232) then
tmp = (2.0d0 + (eps * x)) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 580.0) {
tmp = 1.0;
} else if (x <= 1.25e+195) {
tmp = 0.0;
} else if (x <= 6.2e+232) {
tmp = (2.0 + (eps * x)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 580.0: tmp = 1.0 elif x <= 1.25e+195: tmp = 0.0 elif x <= 6.2e+232: tmp = (2.0 + (eps * x)) / 2.0 else: tmp = 0.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 580.0) tmp = 1.0; elseif (x <= 1.25e+195) tmp = 0.0; elseif (x <= 6.2e+232) tmp = Float64(Float64(2.0 + Float64(eps * x)) / 2.0); else tmp = 0.0; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 580.0) tmp = 1.0; elseif (x <= 1.25e+195) tmp = 0.0; elseif (x <= 6.2e+232) tmp = (2.0 + (eps * x)) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 580.0], 1.0, If[LessEqual[x, 1.25e+195], 0.0, If[LessEqual[x, 6.2e+232], N[(N[(2.0 + N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 580:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{+195}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{+232}:\\
\;\;\;\;\frac{2 + \varepsilon \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 580Initial program 68.6%
sub-neg68.6%
neg-sub068.6%
associate-+r-68.6%
Simplified68.6%
Taylor expanded in x around 0 50.6%
if 580 < x < 1.2499999999999999e195 or 6.19999999999999966e232 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 57.1%
neg-mul-157.1%
rec-exp57.1%
neg-mul-157.1%
div-sub57.1%
+-inverses57.1%
Simplified57.1%
if 1.2499999999999999e195 < x < 6.19999999999999966e232Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 3.1%
*-commutative3.1%
flip-+45.5%
associate-*r/45.5%
sub-neg45.5%
distribute-neg-frac45.5%
metadata-eval45.5%
metadata-eval45.5%
Applied egg-rr45.5%
*-commutative45.5%
associate-/l*45.5%
+-commutative45.5%
Simplified45.5%
Taylor expanded in eps around 0 24.2%
Taylor expanded in eps around 0 24.1%
Final simplification51.2%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (/ (+ 2.0 (- (* (* eps x) (* eps x)) x)) 2.0))
eps = abs(eps);
double code(double x, double eps) {
return (2.0 + (((eps * x) * (eps * x)) - x)) / 2.0;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (2.0d0 + (((eps * x) * (eps * x)) - x)) / 2.0d0
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
return (2.0 + (((eps * x) * (eps * x)) - x)) / 2.0;
}
eps = abs(eps) def code(x, eps): return (2.0 + (((eps * x) * (eps * x)) - x)) / 2.0
eps = abs(eps) function code(x, eps) return Float64(Float64(2.0 + Float64(Float64(Float64(eps * x) * Float64(eps * x)) - x)) / 2.0) end
eps = abs(eps) function tmp = code(x, eps) tmp = (2.0 + (((eps * x) * (eps * x)) - x)) / 2.0; end
NOTE: eps should be positive before calling this function code[x_, eps_] := N[(N[(2.0 + N[(N[(N[(eps * x), $MachinePrecision] * N[(eps * x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps = |eps|\\
\\
\frac{2 + \left(\left(\varepsilon \cdot x\right) \cdot \left(\varepsilon \cdot x\right) - x\right)}{2}
\end{array}
Initial program 77.3%
Simplified59.8%
Taylor expanded in eps around inf 98.3%
Taylor expanded in eps around inf 88.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in x around 0 69.9%
+-commutative69.9%
mul-1-neg69.9%
unsub-neg69.9%
unpow269.9%
cancel-sign-sub-inv69.9%
metadata-eval69.9%
distribute-lft-out69.9%
sub-neg69.9%
metadata-eval69.9%
+-commutative69.9%
unpow269.9%
Simplified69.9%
Taylor expanded in eps around inf 69.8%
unpow269.8%
*-commutative69.8%
unpow269.8%
unswap-sqr68.5%
Simplified68.5%
Final simplification68.5%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (/ (+ 2.0 (- (* (* eps eps) (* x x)) x)) 2.0))
eps = abs(eps);
double code(double x, double eps) {
return (2.0 + (((eps * eps) * (x * x)) - x)) / 2.0;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (2.0d0 + (((eps * eps) * (x * x)) - x)) / 2.0d0
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
return (2.0 + (((eps * eps) * (x * x)) - x)) / 2.0;
}
eps = abs(eps) def code(x, eps): return (2.0 + (((eps * eps) * (x * x)) - x)) / 2.0
eps = abs(eps) function code(x, eps) return Float64(Float64(2.0 + Float64(Float64(Float64(eps * eps) * Float64(x * x)) - x)) / 2.0) end
eps = abs(eps) function tmp = code(x, eps) tmp = (2.0 + (((eps * eps) * (x * x)) - x)) / 2.0; end
NOTE: eps should be positive before calling this function code[x_, eps_] := N[(N[(2.0 + N[(N[(N[(eps * eps), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
eps = |eps|\\
\\
\frac{2 + \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(x \cdot x\right) - x\right)}{2}
\end{array}
Initial program 77.3%
Simplified59.8%
Taylor expanded in eps around inf 98.3%
Taylor expanded in eps around inf 88.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in x around 0 69.9%
+-commutative69.9%
mul-1-neg69.9%
unsub-neg69.9%
unpow269.9%
cancel-sign-sub-inv69.9%
metadata-eval69.9%
distribute-lft-out69.9%
sub-neg69.9%
metadata-eval69.9%
+-commutative69.9%
unpow269.9%
Simplified69.9%
Taylor expanded in eps around inf 69.8%
unpow269.8%
*-commutative69.8%
unpow269.8%
Simplified69.8%
Final simplification69.8%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 (if (<= x 450.0) 1.0 0.0))
eps = abs(eps);
double code(double x, double eps) {
double tmp;
if (x <= 450.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 450.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
double tmp;
if (x <= 450.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
eps = abs(eps) def code(x, eps): tmp = 0 if x <= 450.0: tmp = 1.0 else: tmp = 0.0 return tmp
eps = abs(eps) function code(x, eps) tmp = 0.0 if (x <= 450.0) tmp = 1.0; else tmp = 0.0; end return tmp end
eps = abs(eps) function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 450.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
NOTE: eps should be positive before calling this function code[x_, eps_] := If[LessEqual[x, 450.0], 1.0, 0.0]
\begin{array}{l}
eps = |eps|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 450:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 450Initial program 68.6%
sub-neg68.6%
neg-sub068.6%
associate-+r-68.6%
Simplified68.6%
Taylor expanded in x around 0 50.6%
if 450 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 51.5%
neg-mul-151.5%
rec-exp51.5%
neg-mul-151.5%
div-sub51.5%
+-inverses51.5%
Simplified51.5%
Final simplification50.8%
NOTE: eps should be positive before calling this function (FPCore (x eps) :precision binary64 0.0)
eps = abs(eps);
double code(double x, double eps) {
return 0.0;
}
NOTE: eps should be positive before calling this function
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 0.0d0
end function
eps = Math.abs(eps);
public static double code(double x, double eps) {
return 0.0;
}
eps = abs(eps) def code(x, eps): return 0.0
eps = abs(eps) function code(x, eps) return 0.0 end
eps = abs(eps) function tmp = code(x, eps) tmp = 0.0; end
NOTE: eps should be positive before calling this function code[x_, eps_] := 0.0
\begin{array}{l}
eps = |eps|\\
\\
0
\end{array}
Initial program 77.3%
Simplified77.3%
Taylor expanded in eps around 0 15.7%
neg-mul-115.7%
rec-exp15.7%
neg-mul-115.7%
div-sub15.7%
+-inverses16.0%
Simplified16.0%
Final simplification16.0%
herbie shell --seed 2023275
(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))