
(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 23 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}
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 1.0 eps))))
(if (<=
(+
(* t_0 (exp (* x (+ eps -1.0))))
(* (exp (* x (- -1.0 eps))) (- 1.0 (/ 1.0 eps))))
4.0)
(/ (* 2.0 (exp (- (log1p x) x))) 2.0)
(/
(pow
(exp
(*
(log
(fma
t_0
(exp (fma eps x x))
(exp (- (log1p (/ 1.0 eps)) (fma eps x x)))))
0.3333333333333333))
3.0)
2.0))))
double code(double x, double eps) {
double t_0 = 1.0 + (1.0 / eps);
double tmp;
if (((t_0 * exp((x * (eps + -1.0)))) + (exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps)))) <= 4.0) {
tmp = (2.0 * exp((log1p(x) - x))) / 2.0;
} else {
tmp = pow(exp((log(fma(t_0, exp(fma(eps, x, x)), exp((log1p((1.0 / eps)) - fma(eps, x, x))))) * 0.3333333333333333)), 3.0) / 2.0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(1.0 + Float64(1.0 / eps)) tmp = 0.0 if (Float64(Float64(t_0 * exp(Float64(x * Float64(eps + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps))) * Float64(1.0 - Float64(1.0 / eps)))) <= 4.0) tmp = Float64(Float64(2.0 * exp(Float64(log1p(x) - x))) / 2.0); else tmp = Float64((exp(Float64(log(fma(t_0, exp(fma(eps, x, x)), exp(Float64(log1p(Float64(1.0 / eps)) - fma(eps, x, x))))) * 0.3333333333333333)) ^ 3.0) / 2.0); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$0 * N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4.0], N[(N[(2.0 * N[Exp[N[(N[Log[1 + x], $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[Power[N[Exp[N[(N[Log[N[(t$95$0 * N[Exp[N[(eps * x + x), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(N[Log[1 + N[(1.0 / eps), $MachinePrecision]], $MachinePrecision] - N[(eps * x + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]], $MachinePrecision], 3.0], $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{1}{\varepsilon}\\
\mathbf{if}\;t\_0 \cdot e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-1 - \varepsilon\right)} \cdot \left(1 - \frac{1}{\varepsilon}\right) \leq 4:\\
\;\;\;\;\frac{2 \cdot e^{\mathsf{log1p}\left(x\right) - x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(e^{\log \left(\mathsf{fma}\left(t\_0, e^{\mathsf{fma}\left(\varepsilon, x, x\right)}, e^{\mathsf{log1p}\left(\frac{1}{\varepsilon}\right) - \mathsf{fma}\left(\varepsilon, x, x\right)}\right)\right) \cdot 0.3333333333333333}\right)}^{3}}{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) < 4Initial program 54.9%
Simplified27.0%
Taylor expanded in eps around 0 54.3%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
distribute-rgt-in100.0%
associate-*r*100.0%
distribute-lft-out100.0%
distribute-rgt1-in100.0%
rem-exp-log100.0%
exp-sum100.0%
unsub-neg100.0%
+-commutative100.0%
log1p-define100.0%
Simplified100.0%
if 4 < (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) Initial program 99.9%
Simplified82.2%
add-cube-cbrt82.2%
pow382.2%
Applied egg-rr99.9%
pow1/399.9%
pow-to-exp99.9%
Applied egg-rr99.9%
Final simplification100.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 1.0 eps))))
(if (<=
(+
(* t_0 (exp (* x (+ eps -1.0))))
(* (exp (* x (- -1.0 eps))) (- 1.0 (/ 1.0 eps))))
4.0)
(/ (* 2.0 (exp (- (log1p x) x))) 2.0)
(/
(pow
(pow
(fma
t_0
(exp (fma eps x x))
(exp (- (log1p (/ 1.0 eps)) (fma eps x x))))
0.3333333333333333)
3.0)
2.0))))
double code(double x, double eps) {
double t_0 = 1.0 + (1.0 / eps);
double tmp;
if (((t_0 * exp((x * (eps + -1.0)))) + (exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps)))) <= 4.0) {
tmp = (2.0 * exp((log1p(x) - x))) / 2.0;
} else {
tmp = pow(pow(fma(t_0, exp(fma(eps, x, x)), exp((log1p((1.0 / eps)) - fma(eps, x, x)))), 0.3333333333333333), 3.0) / 2.0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(1.0 + Float64(1.0 / eps)) tmp = 0.0 if (Float64(Float64(t_0 * exp(Float64(x * Float64(eps + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps))) * Float64(1.0 - Float64(1.0 / eps)))) <= 4.0) tmp = Float64(Float64(2.0 * exp(Float64(log1p(x) - x))) / 2.0); else tmp = Float64(((fma(t_0, exp(fma(eps, x, x)), exp(Float64(log1p(Float64(1.0 / eps)) - fma(eps, x, x)))) ^ 0.3333333333333333) ^ 3.0) / 2.0); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$0 * N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4.0], N[(N[(2.0 * N[Exp[N[(N[Log[1 + x], $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[Power[N[Power[N[(t$95$0 * N[Exp[N[(eps * x + x), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(N[Log[1 + N[(1.0 / eps), $MachinePrecision]], $MachinePrecision] - N[(eps * x + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.3333333333333333], $MachinePrecision], 3.0], $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{1}{\varepsilon}\\
\mathbf{if}\;t\_0 \cdot e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-1 - \varepsilon\right)} \cdot \left(1 - \frac{1}{\varepsilon}\right) \leq 4:\\
\;\;\;\;\frac{2 \cdot e^{\mathsf{log1p}\left(x\right) - x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left({\left(\mathsf{fma}\left(t\_0, e^{\mathsf{fma}\left(\varepsilon, x, x\right)}, e^{\mathsf{log1p}\left(\frac{1}{\varepsilon}\right) - \mathsf{fma}\left(\varepsilon, x, x\right)}\right)\right)}^{0.3333333333333333}\right)}^{3}}{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) < 4Initial program 54.9%
Simplified27.0%
Taylor expanded in eps around 0 54.3%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
distribute-rgt-in100.0%
associate-*r*100.0%
distribute-lft-out100.0%
distribute-rgt1-in100.0%
rem-exp-log100.0%
exp-sum100.0%
unsub-neg100.0%
+-commutative100.0%
log1p-define100.0%
Simplified100.0%
if 4 < (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) Initial program 99.9%
Simplified82.2%
add-cube-cbrt82.2%
pow382.2%
Applied egg-rr99.9%
pow1/399.9%
Applied egg-rr99.9%
Final simplification100.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ 1.0 (/ 1.0 eps))))
(if (<=
(+
(* t_0 (exp (* x (+ eps -1.0))))
(* (exp (* x (- -1.0 eps))) (- 1.0 (/ 1.0 eps))))
4.0)
(/ (* 2.0 (exp (- (log1p x) x))) 2.0)
(/
(pow
(cbrt
(fma
t_0
(exp (fma eps x x))
(exp (- (log1p (/ 1.0 eps)) (fma eps x x)))))
3.0)
2.0))))
double code(double x, double eps) {
double t_0 = 1.0 + (1.0 / eps);
double tmp;
if (((t_0 * exp((x * (eps + -1.0)))) + (exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps)))) <= 4.0) {
tmp = (2.0 * exp((log1p(x) - x))) / 2.0;
} else {
tmp = pow(cbrt(fma(t_0, exp(fma(eps, x, x)), exp((log1p((1.0 / eps)) - fma(eps, x, x))))), 3.0) / 2.0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(1.0 + Float64(1.0 / eps)) tmp = 0.0 if (Float64(Float64(t_0 * exp(Float64(x * Float64(eps + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps))) * Float64(1.0 - Float64(1.0 / eps)))) <= 4.0) tmp = Float64(Float64(2.0 * exp(Float64(log1p(x) - x))) / 2.0); else tmp = Float64((cbrt(fma(t_0, exp(fma(eps, x, x)), exp(Float64(log1p(Float64(1.0 / eps)) - fma(eps, x, x))))) ^ 3.0) / 2.0); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$0 * N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4.0], N[(N[(2.0 * N[Exp[N[(N[Log[1 + x], $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[Power[N[Power[N[(t$95$0 * N[Exp[N[(eps * x + x), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(N[Log[1 + N[(1.0 / eps), $MachinePrecision]], $MachinePrecision] - N[(eps * x + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{1}{\varepsilon}\\
\mathbf{if}\;t\_0 \cdot e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-1 - \varepsilon\right)} \cdot \left(1 - \frac{1}{\varepsilon}\right) \leq 4:\\
\;\;\;\;\frac{2 \cdot e^{\mathsf{log1p}\left(x\right) - x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\sqrt[3]{\mathsf{fma}\left(t\_0, e^{\mathsf{fma}\left(\varepsilon, x, x\right)}, e^{\mathsf{log1p}\left(\frac{1}{\varepsilon}\right) - \mathsf{fma}\left(\varepsilon, x, x\right)}\right)}\right)}^{3}}{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) < 4Initial program 54.9%
Simplified27.0%
Taylor expanded in eps around 0 54.3%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
distribute-rgt-in100.0%
associate-*r*100.0%
distribute-lft-out100.0%
distribute-rgt1-in100.0%
rem-exp-log100.0%
exp-sum100.0%
unsub-neg100.0%
+-commutative100.0%
log1p-define100.0%
Simplified100.0%
if 4 < (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) Initial program 99.9%
Simplified82.2%
add-cube-cbrt82.2%
pow382.2%
Applied egg-rr99.9%
Final simplification100.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- 1.0 (/ 1.0 eps)))
(t_1 (+ 1.0 (/ 1.0 eps)))
(t_2 (exp (* x (+ eps -1.0)))))
(if (<= (+ (* t_1 t_2) (* (exp (* x (- -1.0 eps))) t_0)) 4.0)
(/ (* 2.0 (exp (- (log1p x) x))) 2.0)
(/ (fma t_1 t_2 (* (pow (exp (+ 1.0 eps)) (- x)) t_0)) 2.0))))
double code(double x, double eps) {
double t_0 = 1.0 - (1.0 / eps);
double t_1 = 1.0 + (1.0 / eps);
double t_2 = exp((x * (eps + -1.0)));
double tmp;
if (((t_1 * t_2) + (exp((x * (-1.0 - eps))) * t_0)) <= 4.0) {
tmp = (2.0 * exp((log1p(x) - x))) / 2.0;
} else {
tmp = fma(t_1, t_2, (pow(exp((1.0 + eps)), -x) * t_0)) / 2.0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(1.0 - Float64(1.0 / eps)) t_1 = Float64(1.0 + Float64(1.0 / eps)) t_2 = exp(Float64(x * Float64(eps + -1.0))) tmp = 0.0 if (Float64(Float64(t_1 * t_2) + Float64(exp(Float64(x * Float64(-1.0 - eps))) * t_0)) <= 4.0) tmp = Float64(Float64(2.0 * exp(Float64(log1p(x) - x))) / 2.0); else tmp = Float64(fma(t_1, t_2, Float64((exp(Float64(1.0 + eps)) ^ Float64(-x)) * t_0)) / 2.0); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(1.0 - N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 * t$95$2), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 4.0], N[(N[(2.0 * N[Exp[N[(N[Log[1 + x], $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(t$95$1 * t$95$2 + N[(N[Power[N[Exp[N[(1.0 + eps), $MachinePrecision]], $MachinePrecision], (-x)], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \frac{1}{\varepsilon}\\
t_1 := 1 + \frac{1}{\varepsilon}\\
t_2 := e^{x \cdot \left(\varepsilon + -1\right)}\\
\mathbf{if}\;t\_1 \cdot t\_2 + e^{x \cdot \left(-1 - \varepsilon\right)} \cdot t\_0 \leq 4:\\
\;\;\;\;\frac{2 \cdot e^{\mathsf{log1p}\left(x\right) - x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_1, t\_2, {\left(e^{1 + \varepsilon}\right)}^{\left(-x\right)} \cdot t\_0\right)}{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) < 4Initial program 54.9%
Simplified27.0%
Taylor expanded in eps around 0 54.3%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
distribute-rgt-in100.0%
associate-*r*100.0%
distribute-lft-out100.0%
distribute-rgt1-in100.0%
rem-exp-log100.0%
exp-sum100.0%
unsub-neg100.0%
+-commutative100.0%
log1p-define100.0%
Simplified100.0%
if 4 < (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) Initial program 99.9%
Simplified99.9%
Final simplification100.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0
(+
(* (+ 1.0 (/ 1.0 eps)) (exp (* x (+ eps -1.0))))
(* (exp (* x (- -1.0 eps))) (- 1.0 (/ 1.0 eps))))))
(if (<= t_0 4.0) (/ (* 2.0 (exp (- (log1p x) x))) 2.0) (/ t_0 2.0))))
double code(double x, double eps) {
double t_0 = ((1.0 + (1.0 / eps)) * exp((x * (eps + -1.0)))) + (exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps)));
double tmp;
if (t_0 <= 4.0) {
tmp = (2.0 * exp((log1p(x) - x))) / 2.0;
} else {
tmp = t_0 / 2.0;
}
return tmp;
}
public static double code(double x, double eps) {
double t_0 = ((1.0 + (1.0 / eps)) * Math.exp((x * (eps + -1.0)))) + (Math.exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps)));
double tmp;
if (t_0 <= 4.0) {
tmp = (2.0 * Math.exp((Math.log1p(x) - x))) / 2.0;
} else {
tmp = t_0 / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = ((1.0 + (1.0 / eps)) * math.exp((x * (eps + -1.0)))) + (math.exp((x * (-1.0 - eps))) * (1.0 - (1.0 / eps))) tmp = 0 if t_0 <= 4.0: tmp = (2.0 * math.exp((math.log1p(x) - x))) / 2.0 else: tmp = t_0 / 2.0 return tmp
function code(x, eps) t_0 = Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(x * Float64(eps + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps))) * Float64(1.0 - Float64(1.0 / eps)))) tmp = 0.0 if (t_0 <= 4.0) tmp = Float64(Float64(2.0 * exp(Float64(log1p(x) - x))) / 2.0); else tmp = Float64(t_0 / 2.0); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 4.0], N[(N[(2.0 * N[Exp[N[(N[Log[1 + x], $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(t$95$0 / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + \frac{1}{\varepsilon}\right) \cdot e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-1 - \varepsilon\right)} \cdot \left(1 - \frac{1}{\varepsilon}\right)\\
\mathbf{if}\;t\_0 \leq 4:\\
\;\;\;\;\frac{2 \cdot e^{\mathsf{log1p}\left(x\right) - x}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) < 4Initial program 54.9%
Simplified27.0%
Taylor expanded in eps around 0 54.3%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
distribute-rgt-in100.0%
associate-*r*100.0%
distribute-lft-out100.0%
distribute-rgt1-in100.0%
rem-exp-log100.0%
exp-sum100.0%
unsub-neg100.0%
+-commutative100.0%
log1p-define100.0%
Simplified100.0%
if 4 < (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) Initial program 99.9%
Simplified99.9%
Final simplification100.0%
(FPCore (x eps)
:precision binary64
(if (<= eps 2900000000.0)
(/ (* 2.0 (exp (- (log1p x) x))) 2.0)
(if (<= eps 2.45e+81)
(/
(+ (* (+ 1.0 (/ 1.0 eps)) (pow E (* x (+ 1.0 eps)))) (- 1.0 (/ 1.0 eps)))
2.0)
(if (<= eps 1.12e+94)
(/ (+ 1.0 (exp (* x (- -1.0 eps)))) 2.0)
(/
(+
2.0
(* x (+ (- -1.0 eps) (* 0.5 (+ x (* eps (+ (* x 2.0) (* eps x))))))))
2.0)))))
double code(double x, double eps) {
double tmp;
if (eps <= 2900000000.0) {
tmp = (2.0 * exp((log1p(x) - x))) / 2.0;
} else if (eps <= 2.45e+81) {
tmp = (((1.0 + (1.0 / eps)) * pow(((double) M_E), (x * (1.0 + eps)))) + (1.0 - (1.0 / eps))) / 2.0;
} else if (eps <= 1.12e+94) {
tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0;
} else {
tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0;
}
return tmp;
}
public static double code(double x, double eps) {
double tmp;
if (eps <= 2900000000.0) {
tmp = (2.0 * Math.exp((Math.log1p(x) - x))) / 2.0;
} else if (eps <= 2.45e+81) {
tmp = (((1.0 + (1.0 / eps)) * Math.pow(Math.E, (x * (1.0 + eps)))) + (1.0 - (1.0 / eps))) / 2.0;
} else if (eps <= 1.12e+94) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps)))) / 2.0;
} else {
tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= 2900000000.0: tmp = (2.0 * math.exp((math.log1p(x) - x))) / 2.0 elif eps <= 2.45e+81: tmp = (((1.0 + (1.0 / eps)) * math.pow(math.e, (x * (1.0 + eps)))) + (1.0 - (1.0 / eps))) / 2.0 elif eps <= 1.12e+94: tmp = (1.0 + math.exp((x * (-1.0 - eps)))) / 2.0 else: tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (eps <= 2900000000.0) tmp = Float64(Float64(2.0 * exp(Float64(log1p(x) - x))) / 2.0); elseif (eps <= 2.45e+81) tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * (exp(1) ^ Float64(x * Float64(1.0 + eps)))) + Float64(1.0 - Float64(1.0 / eps))) / 2.0); elseif (eps <= 1.12e+94) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(-1.0 - eps) + Float64(0.5 * Float64(x + Float64(eps * Float64(Float64(x * 2.0) + Float64(eps * x)))))))) / 2.0); end return tmp end
code[x_, eps_] := If[LessEqual[eps, 2900000000.0], N[(N[(2.0 * N[Exp[N[(N[Log[1 + x], $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 2.45e+81], N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Power[E, N[(x * N[(1.0 + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 1.12e+94], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(N[(-1.0 - eps), $MachinePrecision] + N[(0.5 * N[(x + N[(eps * N[(N[(x * 2.0), $MachinePrecision] + N[(eps * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 2900000000:\\
\;\;\;\;\frac{2 \cdot e^{\mathsf{log1p}\left(x\right) - x}}{2}\\
\mathbf{elif}\;\varepsilon \leq 2.45 \cdot 10^{+81}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot {e}^{\left(x \cdot \left(1 + \varepsilon\right)\right)} + \left(1 - \frac{1}{\varepsilon}\right)}{2}\\
\mathbf{elif}\;\varepsilon \leq 1.12 \cdot 10^{+94}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(-1 - \varepsilon\right) + 0.5 \cdot \left(x + \varepsilon \cdot \left(x \cdot 2 + \varepsilon \cdot x\right)\right)\right)}{2}\\
\end{array}
\end{array}
if eps < 2.9e9Initial program 57.3%
Simplified43.3%
Taylor expanded in eps around 0 38.0%
Simplified81.3%
Taylor expanded in eps around 0 81.3%
distribute-rgt-in81.3%
associate-*r*81.3%
distribute-lft-out81.3%
distribute-rgt1-in81.3%
rem-exp-log81.3%
exp-sum81.3%
unsub-neg81.3%
+-commutative81.3%
log1p-define81.3%
Simplified81.3%
if 2.9e9 < eps < 2.45000000000000011e81Initial program 99.5%
Simplified99.5%
Taylor expanded in x around 0 82.4%
*-un-lft-identity82.4%
exp-prod82.5%
*-commutative82.5%
add-sqr-sqrt30.0%
sqrt-unprod43.4%
sqr-neg43.4%
sqrt-unprod13.4%
add-sqr-sqrt60.5%
sub-neg60.5%
add-sqr-sqrt0.0%
sqrt-unprod82.5%
sqr-neg82.5%
sqrt-unprod82.3%
add-sqr-sqrt82.5%
Applied egg-rr82.5%
exp-1-e82.5%
+-commutative82.5%
Simplified82.5%
if 2.45000000000000011e81 < eps < 1.11999999999999996e94Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 96.5%
metadata-eval96.5%
distribute-neg-frac96.5%
metadata-eval96.5%
associate-*l/96.5%
*-commutative96.5%
distribute-lft-neg-in96.5%
cancel-sign-sub-inv96.5%
*-commutative96.5%
associate-*l/96.5%
metadata-eval96.5%
Simplified96.5%
Taylor expanded in eps around inf 96.5%
*-commutative96.5%
associate-*r*96.5%
neg-mul-196.5%
exp-prod100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
*-rgt-identity100.0%
+-commutative100.0%
exp-prod96.5%
distribute-lft-in96.5%
*-rgt-identity96.5%
cancel-sign-sub-inv96.5%
neg-mul-196.5%
*-commutative96.5%
distribute-lft-out--96.5%
Simplified96.5%
if 1.11999999999999996e94 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 63.1%
metadata-eval63.1%
distribute-neg-frac63.1%
metadata-eval63.1%
associate-*l/63.1%
*-commutative63.1%
distribute-lft-neg-in63.1%
cancel-sign-sub-inv63.1%
*-commutative63.1%
associate-*l/63.1%
metadata-eval63.1%
Simplified63.1%
Taylor expanded in eps around inf 63.1%
*-commutative63.1%
associate-*r*63.1%
neg-mul-163.1%
exp-prod47.2%
+-commutative47.2%
cancel-sign-sub-inv47.2%
distribute-lft-neg-in47.2%
distribute-rgt-neg-in47.2%
metadata-eval47.2%
*-rgt-identity47.2%
+-commutative47.2%
exp-prod63.1%
distribute-lft-in63.1%
*-rgt-identity63.1%
cancel-sign-sub-inv63.1%
neg-mul-163.1%
*-commutative63.1%
distribute-lft-out--63.1%
Simplified63.1%
Taylor expanded in x around 0 85.1%
distribute-lft-in85.1%
metadata-eval85.1%
neg-mul-185.1%
sub-neg85.1%
+-commutative85.1%
Simplified85.1%
Taylor expanded in eps around 0 86.6%
Final simplification83.0%
(FPCore (x eps)
:precision binary64
(if (<= eps 2900000000.0)
(/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0)
(if (<= eps 2.9e+81)
(/
(+ (* (+ 1.0 (/ 1.0 eps)) (pow E (* x (+ 1.0 eps)))) (- 1.0 (/ 1.0 eps)))
2.0)
(if (<= eps 3.1e+94)
(/ (+ 1.0 (exp (* x (- -1.0 eps)))) 2.0)
(/
(+
2.0
(* x (+ (- -1.0 eps) (* 0.5 (+ x (* eps (+ (* x 2.0) (* eps x))))))))
2.0)))))
double code(double x, double eps) {
double tmp;
if (eps <= 2900000000.0) {
tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else if (eps <= 2.9e+81) {
tmp = (((1.0 + (1.0 / eps)) * pow(((double) M_E), (x * (1.0 + eps)))) + (1.0 - (1.0 / eps))) / 2.0;
} else if (eps <= 3.1e+94) {
tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0;
} else {
tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0;
}
return tmp;
}
public static double code(double x, double eps) {
double tmp;
if (eps <= 2900000000.0) {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else if (eps <= 2.9e+81) {
tmp = (((1.0 + (1.0 / eps)) * Math.pow(Math.E, (x * (1.0 + eps)))) + (1.0 - (1.0 / eps))) / 2.0;
} else if (eps <= 3.1e+94) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps)))) / 2.0;
} else {
tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= 2900000000.0: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 elif eps <= 2.9e+81: tmp = (((1.0 + (1.0 / eps)) * math.pow(math.e, (x * (1.0 + eps)))) + (1.0 - (1.0 / eps))) / 2.0 elif eps <= 3.1e+94: tmp = (1.0 + math.exp((x * (-1.0 - eps)))) / 2.0 else: tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (eps <= 2900000000.0) tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); elseif (eps <= 2.9e+81) tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * (exp(1) ^ Float64(x * Float64(1.0 + eps)))) + Float64(1.0 - Float64(1.0 / eps))) / 2.0); elseif (eps <= 3.1e+94) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(-1.0 - eps) + Float64(0.5 * Float64(x + Float64(eps * Float64(Float64(x * 2.0) + Float64(eps * x)))))))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 2900000000.0) tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; elseif (eps <= 2.9e+81) tmp = (((1.0 + (1.0 / eps)) * (2.71828182845904523536 ^ (x * (1.0 + eps)))) + (1.0 - (1.0 / eps))) / 2.0; elseif (eps <= 3.1e+94) tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0; else tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, 2900000000.0], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 2.9e+81], N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Power[E, N[(x * N[(1.0 + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 3.1e+94], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(N[(-1.0 - eps), $MachinePrecision] + N[(0.5 * N[(x + N[(eps * N[(N[(x * 2.0), $MachinePrecision] + N[(eps * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 2900000000:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\mathbf{elif}\;\varepsilon \leq 2.9 \cdot 10^{+81}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot {e}^{\left(x \cdot \left(1 + \varepsilon\right)\right)} + \left(1 - \frac{1}{\varepsilon}\right)}{2}\\
\mathbf{elif}\;\varepsilon \leq 3.1 \cdot 10^{+94}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(-1 - \varepsilon\right) + 0.5 \cdot \left(x + \varepsilon \cdot \left(x \cdot 2 + \varepsilon \cdot x\right)\right)\right)}{2}\\
\end{array}
\end{array}
if eps < 2.9e9Initial program 57.3%
Simplified43.3%
Taylor expanded in eps around 0 38.0%
Simplified81.3%
Taylor expanded in eps around 0 81.3%
if 2.9e9 < eps < 2.9e81Initial program 99.5%
Simplified99.5%
Taylor expanded in x around 0 82.4%
*-un-lft-identity82.4%
exp-prod82.5%
*-commutative82.5%
add-sqr-sqrt30.0%
sqrt-unprod43.4%
sqr-neg43.4%
sqrt-unprod13.4%
add-sqr-sqrt60.5%
sub-neg60.5%
add-sqr-sqrt0.0%
sqrt-unprod82.5%
sqr-neg82.5%
sqrt-unprod82.3%
add-sqr-sqrt82.5%
Applied egg-rr82.5%
exp-1-e82.5%
+-commutative82.5%
Simplified82.5%
if 2.9e81 < eps < 3.09999999999999991e94Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 96.5%
metadata-eval96.5%
distribute-neg-frac96.5%
metadata-eval96.5%
associate-*l/96.5%
*-commutative96.5%
distribute-lft-neg-in96.5%
cancel-sign-sub-inv96.5%
*-commutative96.5%
associate-*l/96.5%
metadata-eval96.5%
Simplified96.5%
Taylor expanded in eps around inf 96.5%
*-commutative96.5%
associate-*r*96.5%
neg-mul-196.5%
exp-prod100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
*-rgt-identity100.0%
+-commutative100.0%
exp-prod96.5%
distribute-lft-in96.5%
*-rgt-identity96.5%
cancel-sign-sub-inv96.5%
neg-mul-196.5%
*-commutative96.5%
distribute-lft-out--96.5%
Simplified96.5%
if 3.09999999999999991e94 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 63.1%
metadata-eval63.1%
distribute-neg-frac63.1%
metadata-eval63.1%
associate-*l/63.1%
*-commutative63.1%
distribute-lft-neg-in63.1%
cancel-sign-sub-inv63.1%
*-commutative63.1%
associate-*l/63.1%
metadata-eval63.1%
Simplified63.1%
Taylor expanded in eps around inf 63.1%
*-commutative63.1%
associate-*r*63.1%
neg-mul-163.1%
exp-prod47.2%
+-commutative47.2%
cancel-sign-sub-inv47.2%
distribute-lft-neg-in47.2%
distribute-rgt-neg-in47.2%
metadata-eval47.2%
*-rgt-identity47.2%
+-commutative47.2%
exp-prod63.1%
distribute-lft-in63.1%
*-rgt-identity63.1%
cancel-sign-sub-inv63.1%
neg-mul-163.1%
*-commutative63.1%
distribute-lft-out--63.1%
Simplified63.1%
Taylor expanded in x around 0 85.1%
distribute-lft-in85.1%
metadata-eval85.1%
neg-mul-185.1%
sub-neg85.1%
+-commutative85.1%
Simplified85.1%
Taylor expanded in eps around 0 86.6%
Final simplification83.0%
(FPCore (x eps)
:precision binary64
(if (<= eps 2900000000.0)
(/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0)
(if (<= eps 7e+80)
(/
(+ (* (+ 1.0 (/ 1.0 eps)) (exp (* x (+ eps -1.0)))) (- 1.0 (/ 1.0 eps)))
2.0)
(if (<= eps 3.4e+93)
(/ (+ 1.0 (exp (* x (- -1.0 eps)))) 2.0)
(/
(+
2.0
(* x (+ (- -1.0 eps) (* 0.5 (+ x (* eps (+ (* x 2.0) (* eps x))))))))
2.0)))))
double code(double x, double eps) {
double tmp;
if (eps <= 2900000000.0) {
tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else if (eps <= 7e+80) {
tmp = (((1.0 + (1.0 / eps)) * exp((x * (eps + -1.0)))) + (1.0 - (1.0 / eps))) / 2.0;
} else if (eps <= 3.4e+93) {
tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0;
} else {
tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= 2900000000.0d0) then
tmp = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
else if (eps <= 7d+80) then
tmp = (((1.0d0 + (1.0d0 / eps)) * exp((x * (eps + (-1.0d0))))) + (1.0d0 - (1.0d0 / eps))) / 2.0d0
else if (eps <= 3.4d+93) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps)))) / 2.0d0
else
tmp = (2.0d0 + (x * (((-1.0d0) - eps) + (0.5d0 * (x + (eps * ((x * 2.0d0) + (eps * x)))))))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= 2900000000.0) {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else if (eps <= 7e+80) {
tmp = (((1.0 + (1.0 / eps)) * Math.exp((x * (eps + -1.0)))) + (1.0 - (1.0 / eps))) / 2.0;
} else if (eps <= 3.4e+93) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps)))) / 2.0;
} else {
tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= 2900000000.0: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 elif eps <= 7e+80: tmp = (((1.0 + (1.0 / eps)) * math.exp((x * (eps + -1.0)))) + (1.0 - (1.0 / eps))) / 2.0 elif eps <= 3.4e+93: tmp = (1.0 + math.exp((x * (-1.0 - eps)))) / 2.0 else: tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (eps <= 2900000000.0) tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); elseif (eps <= 7e+80) tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(x * Float64(eps + -1.0)))) + Float64(1.0 - Float64(1.0 / eps))) / 2.0); elseif (eps <= 3.4e+93) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(-1.0 - eps) + Float64(0.5 * Float64(x + Float64(eps * Float64(Float64(x * 2.0) + Float64(eps * x)))))))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 2900000000.0) tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; elseif (eps <= 7e+80) tmp = (((1.0 + (1.0 / eps)) * exp((x * (eps + -1.0)))) + (1.0 - (1.0 / eps))) / 2.0; elseif (eps <= 3.4e+93) tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0; else tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, 2900000000.0], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 7e+80], N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(1.0 - N[(1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 3.4e+93], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(N[(-1.0 - eps), $MachinePrecision] + N[(0.5 * N[(x + N[(eps * N[(N[(x * 2.0), $MachinePrecision] + N[(eps * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 2900000000:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\mathbf{elif}\;\varepsilon \leq 7 \cdot 10^{+80}:\\
\;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{x \cdot \left(\varepsilon + -1\right)} + \left(1 - \frac{1}{\varepsilon}\right)}{2}\\
\mathbf{elif}\;\varepsilon \leq 3.4 \cdot 10^{+93}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(-1 - \varepsilon\right) + 0.5 \cdot \left(x + \varepsilon \cdot \left(x \cdot 2 + \varepsilon \cdot x\right)\right)\right)}{2}\\
\end{array}
\end{array}
if eps < 2.9e9Initial program 57.3%
Simplified43.3%
Taylor expanded in eps around 0 38.0%
Simplified81.3%
Taylor expanded in eps around 0 81.3%
if 2.9e9 < eps < 6.99999999999999987e80Initial program 99.5%
Simplified99.5%
Taylor expanded in x around 0 82.4%
if 6.99999999999999987e80 < eps < 3.4e93Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 96.5%
metadata-eval96.5%
distribute-neg-frac96.5%
metadata-eval96.5%
associate-*l/96.5%
*-commutative96.5%
distribute-lft-neg-in96.5%
cancel-sign-sub-inv96.5%
*-commutative96.5%
associate-*l/96.5%
metadata-eval96.5%
Simplified96.5%
Taylor expanded in eps around inf 96.5%
*-commutative96.5%
associate-*r*96.5%
neg-mul-196.5%
exp-prod100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
*-rgt-identity100.0%
+-commutative100.0%
exp-prod96.5%
distribute-lft-in96.5%
*-rgt-identity96.5%
cancel-sign-sub-inv96.5%
neg-mul-196.5%
*-commutative96.5%
distribute-lft-out--96.5%
Simplified96.5%
if 3.4e93 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 63.1%
metadata-eval63.1%
distribute-neg-frac63.1%
metadata-eval63.1%
associate-*l/63.1%
*-commutative63.1%
distribute-lft-neg-in63.1%
cancel-sign-sub-inv63.1%
*-commutative63.1%
associate-*l/63.1%
metadata-eval63.1%
Simplified63.1%
Taylor expanded in eps around inf 63.1%
*-commutative63.1%
associate-*r*63.1%
neg-mul-163.1%
exp-prod47.2%
+-commutative47.2%
cancel-sign-sub-inv47.2%
distribute-lft-neg-in47.2%
distribute-rgt-neg-in47.2%
metadata-eval47.2%
*-rgt-identity47.2%
+-commutative47.2%
exp-prod63.1%
distribute-lft-in63.1%
*-rgt-identity63.1%
cancel-sign-sub-inv63.1%
neg-mul-163.1%
*-commutative63.1%
distribute-lft-out--63.1%
Simplified63.1%
Taylor expanded in x around 0 85.1%
distribute-lft-in85.1%
metadata-eval85.1%
neg-mul-185.1%
sub-neg85.1%
+-commutative85.1%
Simplified85.1%
Taylor expanded in eps around 0 86.6%
Final simplification83.0%
(FPCore (x eps)
:precision binary64
(if (<= x 3e-285)
(/ (+ 1.0 (exp (* eps (- x)))) 2.0)
(if (or (<= x 5.8e+169) (not (<= x 5.5e+263)))
(/ (+ 1.0 (exp (* x (+ eps -1.0)))) 2.0)
0.0)))
double code(double x, double eps) {
double tmp;
if (x <= 3e-285) {
tmp = (1.0 + exp((eps * -x))) / 2.0;
} else if ((x <= 5.8e+169) || !(x <= 5.5e+263)) {
tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 3d-285) then
tmp = (1.0d0 + exp((eps * -x))) / 2.0d0
else if ((x <= 5.8d+169) .or. (.not. (x <= 5.5d+263))) then
tmp = (1.0d0 + exp((x * (eps + (-1.0d0))))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 3e-285) {
tmp = (1.0 + Math.exp((eps * -x))) / 2.0;
} else if ((x <= 5.8e+169) || !(x <= 5.5e+263)) {
tmp = (1.0 + Math.exp((x * (eps + -1.0)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 3e-285: tmp = (1.0 + math.exp((eps * -x))) / 2.0 elif (x <= 5.8e+169) or not (x <= 5.5e+263): tmp = (1.0 + math.exp((x * (eps + -1.0)))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 3e-285) tmp = Float64(Float64(1.0 + exp(Float64(eps * Float64(-x)))) / 2.0); elseif ((x <= 5.8e+169) || !(x <= 5.5e+263)) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps + -1.0)))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 3e-285) tmp = (1.0 + exp((eps * -x))) / 2.0; elseif ((x <= 5.8e+169) || ~((x <= 5.5e+263))) tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 3e-285], N[(N[(1.0 + N[Exp[N[(eps * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[x, 5.8e+169], N[Not[LessEqual[x, 5.5e+263]], $MachinePrecision]], N[(N[(1.0 + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3 \cdot 10^{-285}:\\
\;\;\;\;\frac{1 + e^{\varepsilon \cdot \left(-x\right)}}{2}\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{+169} \lor \neg \left(x \leq 5.5 \cdot 10^{+263}\right):\\
\;\;\;\;\frac{1 + e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 3.00000000000000003e-285Initial program 72.6%
Simplified72.6%
Taylor expanded in x around 0 58.2%
metadata-eval58.2%
distribute-neg-frac58.2%
metadata-eval58.2%
associate-*l/58.2%
*-commutative58.2%
distribute-lft-neg-in58.2%
cancel-sign-sub-inv58.2%
*-commutative58.2%
associate-*l/58.2%
metadata-eval58.2%
Simplified58.2%
Taylor expanded in eps around inf 85.2%
*-commutative85.2%
associate-*r*85.2%
neg-mul-185.2%
exp-prod76.1%
+-commutative76.1%
cancel-sign-sub-inv76.1%
distribute-lft-neg-in76.1%
distribute-rgt-neg-in76.1%
metadata-eval76.1%
*-rgt-identity76.1%
+-commutative76.1%
exp-prod85.2%
distribute-lft-in85.2%
*-rgt-identity85.2%
cancel-sign-sub-inv85.2%
neg-mul-185.2%
*-commutative85.2%
distribute-lft-out--85.2%
Simplified85.2%
Taylor expanded in eps around inf 85.4%
mul-1-neg85.4%
distribute-lft-neg-out85.4%
*-commutative85.4%
Simplified85.4%
if 3.00000000000000003e-285 < x < 5.8000000000000001e169 or 5.5e263 < x Initial program 67.4%
Simplified67.4%
Taylor expanded in x around 0 41.0%
Taylor expanded in eps around inf 72.4%
exp-prod72.5%
sub-neg72.5%
mul-1-neg72.5%
exp-prod72.4%
mul-1-neg72.4%
mul-1-neg72.4%
sub-neg72.4%
distribute-rgt-neg-in72.4%
metadata-eval72.4%
associate--r+72.4%
neg-sub072.4%
remove-double-neg72.4%
+-commutative72.4%
Simplified72.4%
if 5.8000000000000001e169 < x < 5.5e263Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 71.0%
mul-1-neg71.0%
mul-1-neg71.0%
rec-exp71.0%
sub-neg71.0%
div-sub71.0%
mul-1-neg71.0%
rec-exp71.0%
+-inverses71.0%
Simplified71.0%
Final simplification78.4%
(FPCore (x eps)
:precision binary64
(if (<= eps 2900000000.0)
(/ (* (exp (- x)) (+ 2.0 (* x 2.0))) 2.0)
(if (<= eps 1.32e+81)
(/ (+ 1.0 (exp (* x (+ eps -1.0)))) 2.0)
(if (<= eps 4.4e+93)
(/ (+ 1.0 (exp (* x (- -1.0 eps)))) 2.0)
(/
(+
2.0
(* x (+ (- -1.0 eps) (* 0.5 (+ x (* eps (+ (* x 2.0) (* eps x))))))))
2.0)))))
double code(double x, double eps) {
double tmp;
if (eps <= 2900000000.0) {
tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else if (eps <= 1.32e+81) {
tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0;
} else if (eps <= 4.4e+93) {
tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0;
} else {
tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= 2900000000.0d0) then
tmp = (exp(-x) * (2.0d0 + (x * 2.0d0))) / 2.0d0
else if (eps <= 1.32d+81) then
tmp = (1.0d0 + exp((x * (eps + (-1.0d0))))) / 2.0d0
else if (eps <= 4.4d+93) then
tmp = (1.0d0 + exp((x * ((-1.0d0) - eps)))) / 2.0d0
else
tmp = (2.0d0 + (x * (((-1.0d0) - eps) + (0.5d0 * (x + (eps * ((x * 2.0d0) + (eps * x)))))))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= 2900000000.0) {
tmp = (Math.exp(-x) * (2.0 + (x * 2.0))) / 2.0;
} else if (eps <= 1.32e+81) {
tmp = (1.0 + Math.exp((x * (eps + -1.0)))) / 2.0;
} else if (eps <= 4.4e+93) {
tmp = (1.0 + Math.exp((x * (-1.0 - eps)))) / 2.0;
} else {
tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= 2900000000.0: tmp = (math.exp(-x) * (2.0 + (x * 2.0))) / 2.0 elif eps <= 1.32e+81: tmp = (1.0 + math.exp((x * (eps + -1.0)))) / 2.0 elif eps <= 4.4e+93: tmp = (1.0 + math.exp((x * (-1.0 - eps)))) / 2.0 else: tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (eps <= 2900000000.0) tmp = Float64(Float64(exp(Float64(-x)) * Float64(2.0 + Float64(x * 2.0))) / 2.0); elseif (eps <= 1.32e+81) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(eps + -1.0)))) / 2.0); elseif (eps <= 4.4e+93) tmp = Float64(Float64(1.0 + exp(Float64(x * Float64(-1.0 - eps)))) / 2.0); else tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(-1.0 - eps) + Float64(0.5 * Float64(x + Float64(eps * Float64(Float64(x * 2.0) + Float64(eps * x)))))))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 2900000000.0) tmp = (exp(-x) * (2.0 + (x * 2.0))) / 2.0; elseif (eps <= 1.32e+81) tmp = (1.0 + exp((x * (eps + -1.0)))) / 2.0; elseif (eps <= 4.4e+93) tmp = (1.0 + exp((x * (-1.0 - eps)))) / 2.0; else tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, 2900000000.0], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(2.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 1.32e+81], N[(N[(1.0 + N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps, 4.4e+93], N[(N[(1.0 + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(2.0 + N[(x * N[(N[(-1.0 - eps), $MachinePrecision] + N[(0.5 * N[(x + N[(eps * N[(N[(x * 2.0), $MachinePrecision] + N[(eps * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 2900000000:\\
\;\;\;\;\frac{e^{-x} \cdot \left(2 + x \cdot 2\right)}{2}\\
\mathbf{elif}\;\varepsilon \leq 1.32 \cdot 10^{+81}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(\varepsilon + -1\right)}}{2}\\
\mathbf{elif}\;\varepsilon \leq 4.4 \cdot 10^{+93}:\\
\;\;\;\;\frac{1 + e^{x \cdot \left(-1 - \varepsilon\right)}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(-1 - \varepsilon\right) + 0.5 \cdot \left(x + \varepsilon \cdot \left(x \cdot 2 + \varepsilon \cdot x\right)\right)\right)}{2}\\
\end{array}
\end{array}
if eps < 2.9e9Initial program 57.3%
Simplified43.3%
Taylor expanded in eps around 0 38.0%
Simplified81.3%
Taylor expanded in eps around 0 81.3%
if 2.9e9 < eps < 1.31999999999999996e81Initial program 99.5%
Simplified99.5%
Taylor expanded in x around 0 82.4%
Taylor expanded in eps around inf 82.4%
exp-prod82.5%
sub-neg82.5%
mul-1-neg82.5%
exp-prod82.4%
mul-1-neg82.4%
mul-1-neg82.4%
sub-neg82.4%
distribute-rgt-neg-in82.4%
metadata-eval82.4%
associate--r+82.4%
neg-sub082.4%
remove-double-neg82.4%
+-commutative82.4%
Simplified82.4%
if 1.31999999999999996e81 < eps < 4.40000000000000042e93Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 96.5%
metadata-eval96.5%
distribute-neg-frac96.5%
metadata-eval96.5%
associate-*l/96.5%
*-commutative96.5%
distribute-lft-neg-in96.5%
cancel-sign-sub-inv96.5%
*-commutative96.5%
associate-*l/96.5%
metadata-eval96.5%
Simplified96.5%
Taylor expanded in eps around inf 96.5%
*-commutative96.5%
associate-*r*96.5%
neg-mul-196.5%
exp-prod100.0%
+-commutative100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
*-rgt-identity100.0%
+-commutative100.0%
exp-prod96.5%
distribute-lft-in96.5%
*-rgt-identity96.5%
cancel-sign-sub-inv96.5%
neg-mul-196.5%
*-commutative96.5%
distribute-lft-out--96.5%
Simplified96.5%
if 4.40000000000000042e93 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 63.1%
metadata-eval63.1%
distribute-neg-frac63.1%
metadata-eval63.1%
associate-*l/63.1%
*-commutative63.1%
distribute-lft-neg-in63.1%
cancel-sign-sub-inv63.1%
*-commutative63.1%
associate-*l/63.1%
metadata-eval63.1%
Simplified63.1%
Taylor expanded in eps around inf 63.1%
*-commutative63.1%
associate-*r*63.1%
neg-mul-163.1%
exp-prod47.2%
+-commutative47.2%
cancel-sign-sub-inv47.2%
distribute-lft-neg-in47.2%
distribute-rgt-neg-in47.2%
metadata-eval47.2%
*-rgt-identity47.2%
+-commutative47.2%
exp-prod63.1%
distribute-lft-in63.1%
*-rgt-identity63.1%
cancel-sign-sub-inv63.1%
neg-mul-163.1%
*-commutative63.1%
distribute-lft-out--63.1%
Simplified63.1%
Taylor expanded in x around 0 85.1%
distribute-lft-in85.1%
metadata-eval85.1%
neg-mul-185.1%
sub-neg85.1%
+-commutative85.1%
Simplified85.1%
Taylor expanded in eps around 0 86.6%
Final simplification83.0%
(FPCore (x eps)
:precision binary64
(if (<= x 3e-175)
(/ (+ 1.0 (exp (* eps (- x)))) 2.0)
(if (<= x 8e+39)
(/
(+ 2.0 (* x (+ (- -1.0 eps) (* 0.5 (* x (+ 1.0 (* eps (+ eps 2.0))))))))
2.0)
(if (<= x 4.5e+84)
0.0
(if (<= x 5.4e+169)
(/
(+
2.0
(*
x
(+ (- -1.0 eps) (* 0.5 (+ x (* eps (+ (* x 2.0) (* eps x))))))))
2.0)
(if (<= x 2.6e+265) 0.0 (/ (* eps (+ x (/ 2.0 eps))) 2.0)))))))
double code(double x, double eps) {
double tmp;
if (x <= 3e-175) {
tmp = (1.0 + exp((eps * -x))) / 2.0;
} else if (x <= 8e+39) {
tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x * (1.0 + (eps * (eps + 2.0)))))))) / 2.0;
} else if (x <= 4.5e+84) {
tmp = 0.0;
} else if (x <= 5.4e+169) {
tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0;
} else if (x <= 2.6e+265) {
tmp = 0.0;
} else {
tmp = (eps * (x + (2.0 / eps))) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 3d-175) then
tmp = (1.0d0 + exp((eps * -x))) / 2.0d0
else if (x <= 8d+39) then
tmp = (2.0d0 + (x * (((-1.0d0) - eps) + (0.5d0 * (x * (1.0d0 + (eps * (eps + 2.0d0)))))))) / 2.0d0
else if (x <= 4.5d+84) then
tmp = 0.0d0
else if (x <= 5.4d+169) then
tmp = (2.0d0 + (x * (((-1.0d0) - eps) + (0.5d0 * (x + (eps * ((x * 2.0d0) + (eps * x)))))))) / 2.0d0
else if (x <= 2.6d+265) then
tmp = 0.0d0
else
tmp = (eps * (x + (2.0d0 / eps))) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 3e-175) {
tmp = (1.0 + Math.exp((eps * -x))) / 2.0;
} else if (x <= 8e+39) {
tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x * (1.0 + (eps * (eps + 2.0)))))))) / 2.0;
} else if (x <= 4.5e+84) {
tmp = 0.0;
} else if (x <= 5.4e+169) {
tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0;
} else if (x <= 2.6e+265) {
tmp = 0.0;
} else {
tmp = (eps * (x + (2.0 / eps))) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 3e-175: tmp = (1.0 + math.exp((eps * -x))) / 2.0 elif x <= 8e+39: tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x * (1.0 + (eps * (eps + 2.0)))))))) / 2.0 elif x <= 4.5e+84: tmp = 0.0 elif x <= 5.4e+169: tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0 elif x <= 2.6e+265: tmp = 0.0 else: tmp = (eps * (x + (2.0 / eps))) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 3e-175) tmp = Float64(Float64(1.0 + exp(Float64(eps * Float64(-x)))) / 2.0); elseif (x <= 8e+39) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(-1.0 - eps) + Float64(0.5 * Float64(x * Float64(1.0 + Float64(eps * Float64(eps + 2.0)))))))) / 2.0); elseif (x <= 4.5e+84) tmp = 0.0; elseif (x <= 5.4e+169) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(-1.0 - eps) + Float64(0.5 * Float64(x + Float64(eps * Float64(Float64(x * 2.0) + Float64(eps * x)))))))) / 2.0); elseif (x <= 2.6e+265) tmp = 0.0; else tmp = Float64(Float64(eps * Float64(x + Float64(2.0 / eps))) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 3e-175) tmp = (1.0 + exp((eps * -x))) / 2.0; elseif (x <= 8e+39) tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x * (1.0 + (eps * (eps + 2.0)))))))) / 2.0; elseif (x <= 4.5e+84) tmp = 0.0; elseif (x <= 5.4e+169) tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * ((x * 2.0) + (eps * x)))))))) / 2.0; elseif (x <= 2.6e+265) tmp = 0.0; else tmp = (eps * (x + (2.0 / eps))) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 3e-175], N[(N[(1.0 + N[Exp[N[(eps * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8e+39], N[(N[(2.0 + N[(x * N[(N[(-1.0 - eps), $MachinePrecision] + N[(0.5 * N[(x * N[(1.0 + N[(eps * N[(eps + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 4.5e+84], 0.0, If[LessEqual[x, 5.4e+169], N[(N[(2.0 + N[(x * N[(N[(-1.0 - eps), $MachinePrecision] + N[(0.5 * N[(x + N[(eps * N[(N[(x * 2.0), $MachinePrecision] + N[(eps * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.6e+265], 0.0, N[(N[(eps * N[(x + N[(2.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3 \cdot 10^{-175}:\\
\;\;\;\;\frac{1 + e^{\varepsilon \cdot \left(-x\right)}}{2}\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+39}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(-1 - \varepsilon\right) + 0.5 \cdot \left(x \cdot \left(1 + \varepsilon \cdot \left(\varepsilon + 2\right)\right)\right)\right)}{2}\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{+84}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 5.4 \cdot 10^{+169}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(-1 - \varepsilon\right) + 0.5 \cdot \left(x + \varepsilon \cdot \left(x \cdot 2 + \varepsilon \cdot x\right)\right)\right)}{2}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+265}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\frac{\varepsilon \cdot \left(x + \frac{2}{\varepsilon}\right)}{2}\\
\end{array}
\end{array}
if x < 3e-175Initial program 68.2%
Simplified68.2%
Taylor expanded in x around 0 55.1%
metadata-eval55.1%
distribute-neg-frac55.1%
metadata-eval55.1%
associate-*l/55.1%
*-commutative55.1%
distribute-lft-neg-in55.1%
cancel-sign-sub-inv55.1%
*-commutative55.1%
associate-*l/55.1%
metadata-eval55.1%
Simplified55.1%
Taylor expanded in eps around inf 86.5%
*-commutative86.5%
associate-*r*86.5%
neg-mul-186.5%
exp-prod79.0%
+-commutative79.0%
cancel-sign-sub-inv79.0%
distribute-lft-neg-in79.0%
distribute-rgt-neg-in79.0%
metadata-eval79.0%
*-rgt-identity79.0%
+-commutative79.0%
exp-prod86.5%
distribute-lft-in86.5%
*-rgt-identity86.5%
cancel-sign-sub-inv86.5%
neg-mul-186.5%
*-commutative86.5%
distribute-lft-out--86.5%
Simplified86.5%
Taylor expanded in eps around inf 86.7%
mul-1-neg86.7%
distribute-lft-neg-out86.7%
*-commutative86.7%
Simplified86.7%
if 3e-175 < x < 7.99999999999999952e39Initial program 52.3%
Simplified52.3%
Taylor expanded in x around 0 30.1%
metadata-eval30.1%
distribute-neg-frac30.1%
metadata-eval30.1%
associate-*l/30.1%
*-commutative30.1%
distribute-lft-neg-in30.1%
cancel-sign-sub-inv30.1%
*-commutative30.1%
associate-*l/30.1%
metadata-eval30.1%
Simplified30.1%
Taylor expanded in eps around inf 75.0%
*-commutative75.0%
associate-*r*75.0%
neg-mul-175.0%
exp-prod70.0%
+-commutative70.0%
cancel-sign-sub-inv70.0%
distribute-lft-neg-in70.0%
distribute-rgt-neg-in70.0%
metadata-eval70.0%
*-rgt-identity70.0%
+-commutative70.0%
exp-prod75.0%
distribute-lft-in75.0%
*-rgt-identity75.0%
cancel-sign-sub-inv75.0%
neg-mul-175.0%
*-commutative75.0%
distribute-lft-out--75.0%
Simplified75.0%
Taylor expanded in x around 0 84.3%
distribute-lft-in84.3%
metadata-eval84.3%
neg-mul-184.3%
sub-neg84.3%
+-commutative84.3%
Simplified84.3%
Taylor expanded in eps around 0 84.3%
if 7.99999999999999952e39 < x < 4.4999999999999997e84 or 5.39999999999999981e169 < x < 2.6000000000000001e265Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 69.5%
mul-1-neg69.5%
mul-1-neg69.5%
rec-exp69.5%
sub-neg69.5%
div-sub69.5%
mul-1-neg69.5%
rec-exp69.5%
+-inverses69.5%
Simplified69.5%
if 4.4999999999999997e84 < x < 5.39999999999999981e169Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 8.5%
metadata-eval8.5%
distribute-neg-frac8.5%
metadata-eval8.5%
associate-*l/8.5%
*-commutative8.5%
distribute-lft-neg-in8.5%
cancel-sign-sub-inv8.5%
*-commutative8.5%
associate-*l/8.5%
metadata-eval8.5%
Simplified8.5%
Taylor expanded in eps around inf 8.8%
*-commutative8.8%
associate-*r*8.8%
neg-mul-18.8%
exp-prod8.8%
+-commutative8.8%
cancel-sign-sub-inv8.8%
distribute-lft-neg-in8.8%
distribute-rgt-neg-in8.8%
metadata-eval8.8%
*-rgt-identity8.8%
+-commutative8.8%
exp-prod8.8%
distribute-lft-in8.8%
*-rgt-identity8.8%
cancel-sign-sub-inv8.8%
neg-mul-18.8%
*-commutative8.8%
distribute-lft-out--8.8%
Simplified8.8%
Taylor expanded in x around 0 65.4%
distribute-lft-in65.4%
metadata-eval65.4%
neg-mul-165.4%
sub-neg65.4%
+-commutative65.4%
Simplified65.4%
Taylor expanded in eps around 0 65.4%
if 2.6000000000000001e265 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 37.9%
metadata-eval37.9%
distribute-neg-frac37.9%
metadata-eval37.9%
associate-*l/37.9%
*-commutative37.9%
distribute-lft-neg-in37.9%
cancel-sign-sub-inv37.9%
*-commutative37.9%
associate-*l/37.9%
metadata-eval37.9%
Simplified37.9%
Taylor expanded in x around 0 36.9%
Taylor expanded in eps around -inf 37.3%
mul-1-neg37.3%
*-commutative37.3%
distribute-rgt-neg-in37.3%
sub-neg37.3%
associate-*r/37.3%
metadata-eval37.3%
distribute-neg-frac37.3%
metadata-eval37.3%
Simplified37.3%
pow137.3%
*-commutative37.3%
add-sqr-sqrt36.9%
sqrt-unprod91.1%
sqr-neg91.1%
sqrt-unprod27.7%
add-sqr-sqrt28.2%
frac-2neg28.2%
metadata-eval28.2%
add-sqr-sqrt0.5%
sqrt-unprod27.9%
sqr-neg27.9%
sqrt-unprod27.7%
add-sqr-sqrt28.2%
Applied egg-rr28.2%
unpow128.2%
Simplified28.2%
Final simplification80.3%
(FPCore (x eps)
:precision binary64
(if (<= x -7.4e-29)
(/ (/ (+ x (* eps (- 2.0 (* eps x)))) eps) 2.0)
(if (<= x 440.0)
1.0
(if (<= x 3.05e+264)
0.0
(if (<= x 2e+290)
(/ (+ 2.0 (* (- 1.0 eps) (* x (+ -1.0 (/ -1.0 eps))))) 2.0)
0.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -7.4e-29) {
tmp = ((x + (eps * (2.0 - (eps * x)))) / eps) / 2.0;
} else if (x <= 440.0) {
tmp = 1.0;
} else if (x <= 3.05e+264) {
tmp = 0.0;
} else if (x <= 2e+290) {
tmp = (2.0 + ((1.0 - eps) * (x * (-1.0 + (-1.0 / eps))))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-7.4d-29)) then
tmp = ((x + (eps * (2.0d0 - (eps * x)))) / eps) / 2.0d0
else if (x <= 440.0d0) then
tmp = 1.0d0
else if (x <= 3.05d+264) then
tmp = 0.0d0
else if (x <= 2d+290) then
tmp = (2.0d0 + ((1.0d0 - eps) * (x * ((-1.0d0) + ((-1.0d0) / eps))))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -7.4e-29) {
tmp = ((x + (eps * (2.0 - (eps * x)))) / eps) / 2.0;
} else if (x <= 440.0) {
tmp = 1.0;
} else if (x <= 3.05e+264) {
tmp = 0.0;
} else if (x <= 2e+290) {
tmp = (2.0 + ((1.0 - eps) * (x * (-1.0 + (-1.0 / eps))))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -7.4e-29: tmp = ((x + (eps * (2.0 - (eps * x)))) / eps) / 2.0 elif x <= 440.0: tmp = 1.0 elif x <= 3.05e+264: tmp = 0.0 elif x <= 2e+290: tmp = (2.0 + ((1.0 - eps) * (x * (-1.0 + (-1.0 / eps))))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -7.4e-29) tmp = Float64(Float64(Float64(x + Float64(eps * Float64(2.0 - Float64(eps * x)))) / eps) / 2.0); elseif (x <= 440.0) tmp = 1.0; elseif (x <= 3.05e+264) tmp = 0.0; elseif (x <= 2e+290) tmp = Float64(Float64(2.0 + Float64(Float64(1.0 - eps) * Float64(x * Float64(-1.0 + Float64(-1.0 / eps))))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -7.4e-29) tmp = ((x + (eps * (2.0 - (eps * x)))) / eps) / 2.0; elseif (x <= 440.0) tmp = 1.0; elseif (x <= 3.05e+264) tmp = 0.0; elseif (x <= 2e+290) tmp = (2.0 + ((1.0 - eps) * (x * (-1.0 + (-1.0 / eps))))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -7.4e-29], N[(N[(N[(x + N[(eps * N[(2.0 - N[(eps * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 440.0], 1.0, If[LessEqual[x, 3.05e+264], 0.0, If[LessEqual[x, 2e+290], N[(N[(2.0 + N[(N[(1.0 - eps), $MachinePrecision] * N[(x * N[(-1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.4 \cdot 10^{-29}:\\
\;\;\;\;\frac{\frac{x + \varepsilon \cdot \left(2 - \varepsilon \cdot x\right)}{\varepsilon}}{2}\\
\mathbf{elif}\;x \leq 440:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3.05 \cdot 10^{+264}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+290}:\\
\;\;\;\;\frac{2 + \left(1 - \varepsilon\right) \cdot \left(x \cdot \left(-1 + \frac{-1}{\varepsilon}\right)\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -7.3999999999999995e-29Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 67.7%
metadata-eval67.7%
distribute-neg-frac67.7%
metadata-eval67.7%
associate-*l/67.7%
*-commutative67.7%
distribute-lft-neg-in67.7%
cancel-sign-sub-inv67.7%
*-commutative67.7%
associate-*l/67.7%
metadata-eval67.7%
Simplified67.7%
Taylor expanded in x around 0 46.7%
Taylor expanded in eps around 0 58.0%
+-commutative58.0%
mul-1-neg58.0%
distribute-lft-neg-out58.0%
*-commutative58.0%
Simplified58.0%
if -7.3999999999999995e-29 < x < 440Initial program 55.8%
Simplified55.8%
Taylor expanded in x around 0 79.5%
if 440 < x < 3.05000000000000014e264 or 2.00000000000000012e290 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 55.1%
mul-1-neg55.1%
mul-1-neg55.1%
rec-exp55.1%
sub-neg55.1%
div-sub55.1%
mul-1-neg55.1%
rec-exp55.1%
+-inverses55.1%
Simplified55.1%
if 3.05000000000000014e264 < x < 2.00000000000000012e290Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 51.6%
Taylor expanded in x around 0 50.0%
mul-1-neg50.0%
distribute-rgt-neg-in50.0%
mul-1-neg50.0%
associate-*r*50.0%
associate-*r*50.0%
distribute-lft-in50.0%
metadata-eval50.0%
neg-mul-150.0%
distribute-neg-frac50.0%
metadata-eval50.0%
Simplified50.0%
Final simplification70.6%
(FPCore (x eps)
:precision binary64
(if (<= x -7.6e-29)
(/ (/ (+ x (* eps (- 2.0 (* eps x)))) eps) 2.0)
(if (<= x 490.0)
1.0
(if (<= x 1e+269)
0.0
(if (<= x 9e+285)
(/ (+ 2.0 (* x (+ (- -1.0 eps) (* x 0.5)))) 2.0)
0.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -7.6e-29) {
tmp = ((x + (eps * (2.0 - (eps * x)))) / eps) / 2.0;
} else if (x <= 490.0) {
tmp = 1.0;
} else if (x <= 1e+269) {
tmp = 0.0;
} else if (x <= 9e+285) {
tmp = (2.0 + (x * ((-1.0 - eps) + (x * 0.5)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-7.6d-29)) then
tmp = ((x + (eps * (2.0d0 - (eps * x)))) / eps) / 2.0d0
else if (x <= 490.0d0) then
tmp = 1.0d0
else if (x <= 1d+269) then
tmp = 0.0d0
else if (x <= 9d+285) then
tmp = (2.0d0 + (x * (((-1.0d0) - eps) + (x * 0.5d0)))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -7.6e-29) {
tmp = ((x + (eps * (2.0 - (eps * x)))) / eps) / 2.0;
} else if (x <= 490.0) {
tmp = 1.0;
} else if (x <= 1e+269) {
tmp = 0.0;
} else if (x <= 9e+285) {
tmp = (2.0 + (x * ((-1.0 - eps) + (x * 0.5)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -7.6e-29: tmp = ((x + (eps * (2.0 - (eps * x)))) / eps) / 2.0 elif x <= 490.0: tmp = 1.0 elif x <= 1e+269: tmp = 0.0 elif x <= 9e+285: tmp = (2.0 + (x * ((-1.0 - eps) + (x * 0.5)))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -7.6e-29) tmp = Float64(Float64(Float64(x + Float64(eps * Float64(2.0 - Float64(eps * x)))) / eps) / 2.0); elseif (x <= 490.0) tmp = 1.0; elseif (x <= 1e+269) tmp = 0.0; elseif (x <= 9e+285) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(-1.0 - eps) + Float64(x * 0.5)))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -7.6e-29) tmp = ((x + (eps * (2.0 - (eps * x)))) / eps) / 2.0; elseif (x <= 490.0) tmp = 1.0; elseif (x <= 1e+269) tmp = 0.0; elseif (x <= 9e+285) tmp = (2.0 + (x * ((-1.0 - eps) + (x * 0.5)))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -7.6e-29], N[(N[(N[(x + N[(eps * N[(2.0 - N[(eps * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 490.0], 1.0, If[LessEqual[x, 1e+269], 0.0, If[LessEqual[x, 9e+285], N[(N[(2.0 + N[(x * N[(N[(-1.0 - eps), $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.6 \cdot 10^{-29}:\\
\;\;\;\;\frac{\frac{x + \varepsilon \cdot \left(2 - \varepsilon \cdot x\right)}{\varepsilon}}{2}\\
\mathbf{elif}\;x \leq 490:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 10^{+269}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 9 \cdot 10^{+285}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(-1 - \varepsilon\right) + x \cdot 0.5\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -7.59999999999999951e-29Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 67.7%
metadata-eval67.7%
distribute-neg-frac67.7%
metadata-eval67.7%
associate-*l/67.7%
*-commutative67.7%
distribute-lft-neg-in67.7%
cancel-sign-sub-inv67.7%
*-commutative67.7%
associate-*l/67.7%
metadata-eval67.7%
Simplified67.7%
Taylor expanded in x around 0 46.7%
Taylor expanded in eps around 0 58.0%
+-commutative58.0%
mul-1-neg58.0%
distribute-lft-neg-out58.0%
*-commutative58.0%
Simplified58.0%
if -7.59999999999999951e-29 < x < 490Initial program 55.8%
Simplified55.8%
Taylor expanded in x around 0 79.5%
if 490 < x < 1e269 or 9.0000000000000001e285 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 55.1%
mul-1-neg55.1%
mul-1-neg55.1%
rec-exp55.1%
sub-neg55.1%
div-sub55.1%
mul-1-neg55.1%
rec-exp55.1%
+-inverses55.1%
Simplified55.1%
if 1e269 < x < 9.0000000000000001e285Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 51.6%
metadata-eval51.6%
distribute-neg-frac51.6%
metadata-eval51.6%
associate-*l/51.6%
*-commutative51.6%
distribute-lft-neg-in51.6%
cancel-sign-sub-inv51.6%
*-commutative51.6%
associate-*l/51.6%
metadata-eval51.6%
Simplified51.6%
Taylor expanded in eps around inf 51.6%
*-commutative51.6%
associate-*r*51.6%
neg-mul-151.6%
exp-prod51.6%
+-commutative51.6%
cancel-sign-sub-inv51.6%
distribute-lft-neg-in51.6%
distribute-rgt-neg-in51.6%
metadata-eval51.6%
*-rgt-identity51.6%
+-commutative51.6%
exp-prod51.6%
distribute-lft-in51.6%
*-rgt-identity51.6%
cancel-sign-sub-inv51.6%
neg-mul-151.6%
*-commutative51.6%
distribute-lft-out--51.6%
Simplified51.6%
Taylor expanded in x around 0 100.0%
distribute-lft-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
Final simplification71.8%
(FPCore (x eps) :precision binary64 (if (or (<= x 280.0) (and (not (<= x 1.5e+264)) (<= x 3.6e+289))) (/ (+ 2.0 (* x (+ (- -1.0 eps) (* x 0.5)))) 2.0) 0.0))
double code(double x, double eps) {
double tmp;
if ((x <= 280.0) || (!(x <= 1.5e+264) && (x <= 3.6e+289))) {
tmp = (2.0 + (x * ((-1.0 - eps) + (x * 0.5)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((x <= 280.0d0) .or. (.not. (x <= 1.5d+264)) .and. (x <= 3.6d+289)) then
tmp = (2.0d0 + (x * (((-1.0d0) - eps) + (x * 0.5d0)))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((x <= 280.0) || (!(x <= 1.5e+264) && (x <= 3.6e+289))) {
tmp = (2.0 + (x * ((-1.0 - eps) + (x * 0.5)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if (x <= 280.0) or (not (x <= 1.5e+264) and (x <= 3.6e+289)): tmp = (2.0 + (x * ((-1.0 - eps) + (x * 0.5)))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if ((x <= 280.0) || (!(x <= 1.5e+264) && (x <= 3.6e+289))) tmp = Float64(Float64(2.0 + Float64(x * Float64(Float64(-1.0 - eps) + Float64(x * 0.5)))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((x <= 280.0) || (~((x <= 1.5e+264)) && (x <= 3.6e+289))) tmp = (2.0 + (x * ((-1.0 - eps) + (x * 0.5)))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[x, 280.0], And[N[Not[LessEqual[x, 1.5e+264]], $MachinePrecision], LessEqual[x, 3.6e+289]]], N[(N[(2.0 + N[(x * N[(N[(-1.0 - eps), $MachinePrecision] + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 280 \lor \neg \left(x \leq 1.5 \cdot 10^{+264}\right) \land x \leq 3.6 \cdot 10^{+289}:\\
\;\;\;\;\frac{2 + x \cdot \left(\left(-1 - \varepsilon\right) + x \cdot 0.5\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 280 or 1.5e264 < x < 3.60000000000000014e289Initial program 63.9%
Simplified63.9%
Taylor expanded in x around 0 48.4%
metadata-eval48.4%
distribute-neg-frac48.4%
metadata-eval48.4%
associate-*l/48.4%
*-commutative48.4%
distribute-lft-neg-in48.4%
cancel-sign-sub-inv48.4%
*-commutative48.4%
associate-*l/48.4%
metadata-eval48.4%
Simplified48.4%
Taylor expanded in eps around inf 83.5%
*-commutative83.5%
associate-*r*83.5%
neg-mul-183.5%
exp-prod76.6%
+-commutative76.6%
cancel-sign-sub-inv76.6%
distribute-lft-neg-in76.6%
distribute-rgt-neg-in76.6%
metadata-eval76.6%
*-rgt-identity76.6%
+-commutative76.6%
exp-prod83.5%
distribute-lft-in83.5%
*-rgt-identity83.5%
cancel-sign-sub-inv83.5%
neg-mul-183.5%
*-commutative83.5%
distribute-lft-out--83.5%
Simplified83.5%
Taylor expanded in x around 0 86.2%
distribute-lft-in86.2%
metadata-eval86.2%
neg-mul-186.2%
sub-neg86.2%
+-commutative86.2%
Simplified86.2%
Taylor expanded in eps around 0 76.0%
if 280 < x < 1.5e264 or 3.60000000000000014e289 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 55.1%
mul-1-neg55.1%
mul-1-neg55.1%
rec-exp55.1%
sub-neg55.1%
div-sub55.1%
mul-1-neg55.1%
rec-exp55.1%
+-inverses55.1%
Simplified55.1%
Final simplification71.3%
(FPCore (x eps)
:precision binary64
(if (<= x 260.0)
(/ (- 2.0 (* eps x)) 2.0)
(if (<= x 5e+263)
0.0
(if (<= x 5e+288) (/ (+ 2.0 (* x (+ -1.0 (* x 0.5)))) 2.0) 0.0))))
double code(double x, double eps) {
double tmp;
if (x <= 260.0) {
tmp = (2.0 - (eps * x)) / 2.0;
} else if (x <= 5e+263) {
tmp = 0.0;
} else if (x <= 5e+288) {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 260.0d0) then
tmp = (2.0d0 - (eps * x)) / 2.0d0
else if (x <= 5d+263) then
tmp = 0.0d0
else if (x <= 5d+288) then
tmp = (2.0d0 + (x * ((-1.0d0) + (x * 0.5d0)))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 260.0) {
tmp = (2.0 - (eps * x)) / 2.0;
} else if (x <= 5e+263) {
tmp = 0.0;
} else if (x <= 5e+288) {
tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 260.0: tmp = (2.0 - (eps * x)) / 2.0 elif x <= 5e+263: tmp = 0.0 elif x <= 5e+288: tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 260.0) tmp = Float64(Float64(2.0 - Float64(eps * x)) / 2.0); elseif (x <= 5e+263) tmp = 0.0; elseif (x <= 5e+288) tmp = Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(x * 0.5)))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 260.0) tmp = (2.0 - (eps * x)) / 2.0; elseif (x <= 5e+263) tmp = 0.0; elseif (x <= 5e+288) tmp = (2.0 + (x * (-1.0 + (x * 0.5)))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 260.0], N[(N[(2.0 - N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 5e+263], 0.0, If[LessEqual[x, 5e+288], N[(N[(2.0 + N[(x * N[(-1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 260:\\
\;\;\;\;\frac{2 - \varepsilon \cdot x}{2}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+263}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+288}:\\
\;\;\;\;\frac{2 + x \cdot \left(-1 + x \cdot 0.5\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 260Initial program 62.8%
Simplified62.8%
Taylor expanded in x around 0 48.3%
metadata-eval48.3%
distribute-neg-frac48.3%
metadata-eval48.3%
associate-*l/48.3%
*-commutative48.3%
distribute-lft-neg-in48.3%
cancel-sign-sub-inv48.3%
*-commutative48.3%
associate-*l/48.3%
metadata-eval48.3%
Simplified48.3%
Taylor expanded in x around 0 54.3%
Taylor expanded in eps around inf 73.4%
neg-mul-173.4%
+-commutative73.4%
distribute-lft-in73.4%
*-commutative73.4%
associate-*r*73.4%
rgt-mult-inverse73.5%
metadata-eval73.5%
distribute-rgt-neg-in73.5%
unsub-neg73.5%
*-commutative73.5%
Simplified73.5%
if 260 < x < 5.00000000000000022e263 or 5.0000000000000003e288 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 55.1%
mul-1-neg55.1%
mul-1-neg55.1%
rec-exp55.1%
sub-neg55.1%
div-sub55.1%
mul-1-neg55.1%
rec-exp55.1%
+-inverses55.1%
Simplified55.1%
if 5.00000000000000022e263 < x < 5.0000000000000003e288Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 51.6%
metadata-eval51.6%
distribute-neg-frac51.6%
metadata-eval51.6%
associate-*l/51.6%
*-commutative51.6%
distribute-lft-neg-in51.6%
cancel-sign-sub-inv51.6%
*-commutative51.6%
associate-*l/51.6%
metadata-eval51.6%
Simplified51.6%
Taylor expanded in eps around inf 51.6%
*-commutative51.6%
associate-*r*51.6%
neg-mul-151.6%
exp-prod51.6%
+-commutative51.6%
cancel-sign-sub-inv51.6%
distribute-lft-neg-in51.6%
distribute-rgt-neg-in51.6%
metadata-eval51.6%
*-rgt-identity51.6%
+-commutative51.6%
exp-prod51.6%
distribute-lft-in51.6%
*-rgt-identity51.6%
cancel-sign-sub-inv51.6%
neg-mul-151.6%
*-commutative51.6%
distribute-lft-out--51.6%
Simplified51.6%
Taylor expanded in x around 0 100.0%
distribute-lft-in100.0%
metadata-eval100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in eps around 0 100.0%
Final simplification70.0%
(FPCore (x eps)
:precision binary64
(if (<= x 235.0)
(/ (- 2.0 (* eps x)) 2.0)
(if (<= x 2.7e+264)
0.0
(if (<= x 1.02e+288) (/ (* eps (+ x (/ 2.0 eps))) 2.0) 0.0))))
double code(double x, double eps) {
double tmp;
if (x <= 235.0) {
tmp = (2.0 - (eps * x)) / 2.0;
} else if (x <= 2.7e+264) {
tmp = 0.0;
} else if (x <= 1.02e+288) {
tmp = (eps * (x + (2.0 / eps))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 235.0d0) then
tmp = (2.0d0 - (eps * x)) / 2.0d0
else if (x <= 2.7d+264) then
tmp = 0.0d0
else if (x <= 1.02d+288) then
tmp = (eps * (x + (2.0d0 / eps))) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 235.0) {
tmp = (2.0 - (eps * x)) / 2.0;
} else if (x <= 2.7e+264) {
tmp = 0.0;
} else if (x <= 1.02e+288) {
tmp = (eps * (x + (2.0 / eps))) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 235.0: tmp = (2.0 - (eps * x)) / 2.0 elif x <= 2.7e+264: tmp = 0.0 elif x <= 1.02e+288: tmp = (eps * (x + (2.0 / eps))) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 235.0) tmp = Float64(Float64(2.0 - Float64(eps * x)) / 2.0); elseif (x <= 2.7e+264) tmp = 0.0; elseif (x <= 1.02e+288) tmp = Float64(Float64(eps * Float64(x + Float64(2.0 / eps))) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 235.0) tmp = (2.0 - (eps * x)) / 2.0; elseif (x <= 2.7e+264) tmp = 0.0; elseif (x <= 1.02e+288) tmp = (eps * (x + (2.0 / eps))) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 235.0], N[(N[(2.0 - N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2.7e+264], 0.0, If[LessEqual[x, 1.02e+288], N[(N[(eps * N[(x + N[(2.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 235:\\
\;\;\;\;\frac{2 - \varepsilon \cdot x}{2}\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{+264}:\\
\;\;\;\;0\\
\mathbf{elif}\;x \leq 1.02 \cdot 10^{+288}:\\
\;\;\;\;\frac{\varepsilon \cdot \left(x + \frac{2}{\varepsilon}\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 235Initial program 62.8%
Simplified62.8%
Taylor expanded in x around 0 48.3%
metadata-eval48.3%
distribute-neg-frac48.3%
metadata-eval48.3%
associate-*l/48.3%
*-commutative48.3%
distribute-lft-neg-in48.3%
cancel-sign-sub-inv48.3%
*-commutative48.3%
associate-*l/48.3%
metadata-eval48.3%
Simplified48.3%
Taylor expanded in x around 0 54.3%
Taylor expanded in eps around inf 73.4%
neg-mul-173.4%
+-commutative73.4%
distribute-lft-in73.4%
*-commutative73.4%
associate-*r*73.4%
rgt-mult-inverse73.5%
metadata-eval73.5%
distribute-rgt-neg-in73.5%
unsub-neg73.5%
*-commutative73.5%
Simplified73.5%
if 235 < x < 2.7000000000000002e264 or 1.02000000000000003e288 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 55.1%
mul-1-neg55.1%
mul-1-neg55.1%
rec-exp55.1%
sub-neg55.1%
div-sub55.1%
mul-1-neg55.1%
rec-exp55.1%
+-inverses55.1%
Simplified55.1%
if 2.7000000000000002e264 < x < 1.02000000000000003e288Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 51.6%
metadata-eval51.6%
distribute-neg-frac51.6%
metadata-eval51.6%
associate-*l/51.6%
*-commutative51.6%
distribute-lft-neg-in51.6%
cancel-sign-sub-inv51.6%
*-commutative51.6%
associate-*l/51.6%
metadata-eval51.6%
Simplified51.6%
Taylor expanded in x around 0 50.0%
Taylor expanded in eps around -inf 50.0%
mul-1-neg50.0%
*-commutative50.0%
distribute-rgt-neg-in50.0%
sub-neg50.0%
associate-*r/50.0%
metadata-eval50.0%
distribute-neg-frac50.0%
metadata-eval50.0%
Simplified50.0%
pow150.0%
*-commutative50.0%
add-sqr-sqrt50.0%
sqrt-unprod100.0%
sqr-neg100.0%
sqrt-unprod50.0%
add-sqr-sqrt50.0%
frac-2neg50.0%
metadata-eval50.0%
add-sqr-sqrt0.0%
sqrt-unprod50.0%
sqr-neg50.0%
sqrt-unprod50.0%
add-sqr-sqrt50.0%
Applied egg-rr50.0%
unpow150.0%
Simplified50.0%
Final simplification68.9%
(FPCore (x eps) :precision binary64 (/ (+ 2.0 (* x (+ (- -1.0 eps) (* 0.5 (+ x (* eps (* x (+ eps 2.0)))))))) 2.0))
double code(double x, double eps) {
return (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * (x * (eps + 2.0)))))))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (2.0d0 + (x * (((-1.0d0) - eps) + (0.5d0 * (x + (eps * (x * (eps + 2.0d0)))))))) / 2.0d0
end function
public static double code(double x, double eps) {
return (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * (x * (eps + 2.0)))))))) / 2.0;
}
def code(x, eps): return (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * (x * (eps + 2.0)))))))) / 2.0
function code(x, eps) return Float64(Float64(2.0 + Float64(x * Float64(Float64(-1.0 - eps) + Float64(0.5 * Float64(x + Float64(eps * Float64(x * Float64(eps + 2.0)))))))) / 2.0) end
function tmp = code(x, eps) tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x + (eps * (x * (eps + 2.0)))))))) / 2.0; end
code[x_, eps_] := N[(N[(2.0 + N[(x * N[(N[(-1.0 - eps), $MachinePrecision] + N[(0.5 * N[(x + N[(eps * N[(x * N[(eps + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{2 + x \cdot \left(\left(-1 - \varepsilon\right) + 0.5 \cdot \left(x + \varepsilon \cdot \left(x \cdot \left(\varepsilon + 2\right)\right)\right)\right)}{2}
\end{array}
Initial program 72.0%
Simplified72.0%
Taylor expanded in x around 0 41.2%
metadata-eval41.2%
distribute-neg-frac41.2%
metadata-eval41.2%
associate-*l/41.2%
*-commutative41.2%
distribute-lft-neg-in41.2%
cancel-sign-sub-inv41.2%
*-commutative41.2%
associate-*l/41.2%
metadata-eval41.2%
Simplified41.2%
Taylor expanded in eps around inf 68.6%
*-commutative68.6%
associate-*r*68.6%
neg-mul-168.6%
exp-prod63.3%
+-commutative63.3%
cancel-sign-sub-inv63.3%
distribute-lft-neg-in63.3%
distribute-rgt-neg-in63.3%
metadata-eval63.3%
*-rgt-identity63.3%
+-commutative63.3%
exp-prod68.6%
distribute-lft-in68.6%
*-rgt-identity68.6%
cancel-sign-sub-inv68.6%
neg-mul-168.6%
*-commutative68.6%
distribute-lft-out--68.6%
Simplified68.6%
Taylor expanded in x around 0 76.6%
distribute-lft-in76.6%
metadata-eval76.6%
neg-mul-176.6%
sub-neg76.6%
+-commutative76.6%
Simplified76.6%
Taylor expanded in eps around 0 77.3%
distribute-rgt-out77.3%
Simplified77.3%
Final simplification77.3%
(FPCore (x eps) :precision binary64 (/ (+ 2.0 (* x (+ (- -1.0 eps) (* 0.5 (* x (+ 1.0 (* eps (+ eps 2.0)))))))) 2.0))
double code(double x, double eps) {
return (2.0 + (x * ((-1.0 - eps) + (0.5 * (x * (1.0 + (eps * (eps + 2.0)))))))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (2.0d0 + (x * (((-1.0d0) - eps) + (0.5d0 * (x * (1.0d0 + (eps * (eps + 2.0d0)))))))) / 2.0d0
end function
public static double code(double x, double eps) {
return (2.0 + (x * ((-1.0 - eps) + (0.5 * (x * (1.0 + (eps * (eps + 2.0)))))))) / 2.0;
}
def code(x, eps): return (2.0 + (x * ((-1.0 - eps) + (0.5 * (x * (1.0 + (eps * (eps + 2.0)))))))) / 2.0
function code(x, eps) return Float64(Float64(2.0 + Float64(x * Float64(Float64(-1.0 - eps) + Float64(0.5 * Float64(x * Float64(1.0 + Float64(eps * Float64(eps + 2.0)))))))) / 2.0) end
function tmp = code(x, eps) tmp = (2.0 + (x * ((-1.0 - eps) + (0.5 * (x * (1.0 + (eps * (eps + 2.0)))))))) / 2.0; end
code[x_, eps_] := N[(N[(2.0 + N[(x * N[(N[(-1.0 - eps), $MachinePrecision] + N[(0.5 * N[(x * N[(1.0 + N[(eps * N[(eps + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{2 + x \cdot \left(\left(-1 - \varepsilon\right) + 0.5 \cdot \left(x \cdot \left(1 + \varepsilon \cdot \left(\varepsilon + 2\right)\right)\right)\right)}{2}
\end{array}
Initial program 72.0%
Simplified72.0%
Taylor expanded in x around 0 41.2%
metadata-eval41.2%
distribute-neg-frac41.2%
metadata-eval41.2%
associate-*l/41.2%
*-commutative41.2%
distribute-lft-neg-in41.2%
cancel-sign-sub-inv41.2%
*-commutative41.2%
associate-*l/41.2%
metadata-eval41.2%
Simplified41.2%
Taylor expanded in eps around inf 68.6%
*-commutative68.6%
associate-*r*68.6%
neg-mul-168.6%
exp-prod63.3%
+-commutative63.3%
cancel-sign-sub-inv63.3%
distribute-lft-neg-in63.3%
distribute-rgt-neg-in63.3%
metadata-eval63.3%
*-rgt-identity63.3%
+-commutative63.3%
exp-prod68.6%
distribute-lft-in68.6%
*-rgt-identity68.6%
cancel-sign-sub-inv68.6%
neg-mul-168.6%
*-commutative68.6%
distribute-lft-out--68.6%
Simplified68.6%
Taylor expanded in x around 0 76.6%
distribute-lft-in76.6%
metadata-eval76.6%
neg-mul-176.6%
sub-neg76.6%
+-commutative76.6%
Simplified76.6%
Taylor expanded in eps around 0 76.6%
Final simplification76.6%
(FPCore (x eps) :precision binary64 (/ (+ 2.0 (* x (+ -1.0 (+ (* x 0.5) (* eps (+ x -1.0)))))) 2.0))
double code(double x, double eps) {
return (2.0 + (x * (-1.0 + ((x * 0.5) + (eps * (x + -1.0)))))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (2.0d0 + (x * ((-1.0d0) + ((x * 0.5d0) + (eps * (x + (-1.0d0))))))) / 2.0d0
end function
public static double code(double x, double eps) {
return (2.0 + (x * (-1.0 + ((x * 0.5) + (eps * (x + -1.0)))))) / 2.0;
}
def code(x, eps): return (2.0 + (x * (-1.0 + ((x * 0.5) + (eps * (x + -1.0)))))) / 2.0
function code(x, eps) return Float64(Float64(2.0 + Float64(x * Float64(-1.0 + Float64(Float64(x * 0.5) + Float64(eps * Float64(x + -1.0)))))) / 2.0) end
function tmp = code(x, eps) tmp = (2.0 + (x * (-1.0 + ((x * 0.5) + (eps * (x + -1.0)))))) / 2.0; end
code[x_, eps_] := N[(N[(2.0 + N[(x * N[(-1.0 + N[(N[(x * 0.5), $MachinePrecision] + N[(eps * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{2 + x \cdot \left(-1 + \left(x \cdot 0.5 + \varepsilon \cdot \left(x + -1\right)\right)\right)}{2}
\end{array}
Initial program 72.0%
Simplified72.0%
Taylor expanded in x around 0 41.2%
metadata-eval41.2%
distribute-neg-frac41.2%
metadata-eval41.2%
associate-*l/41.2%
*-commutative41.2%
distribute-lft-neg-in41.2%
cancel-sign-sub-inv41.2%
*-commutative41.2%
associate-*l/41.2%
metadata-eval41.2%
Simplified41.2%
Taylor expanded in eps around inf 68.6%
*-commutative68.6%
associate-*r*68.6%
neg-mul-168.6%
exp-prod63.3%
+-commutative63.3%
cancel-sign-sub-inv63.3%
distribute-lft-neg-in63.3%
distribute-rgt-neg-in63.3%
metadata-eval63.3%
*-rgt-identity63.3%
+-commutative63.3%
exp-prod68.6%
distribute-lft-in68.6%
*-rgt-identity68.6%
cancel-sign-sub-inv68.6%
neg-mul-168.6%
*-commutative68.6%
distribute-lft-out--68.6%
Simplified68.6%
Taylor expanded in x around 0 76.6%
distribute-lft-in76.6%
metadata-eval76.6%
neg-mul-176.6%
sub-neg76.6%
+-commutative76.6%
Simplified76.6%
Taylor expanded in eps around 0 61.8%
Final simplification61.8%
(FPCore (x eps) :precision binary64 (if (<= x 280.0) (/ (- 2.0 (* eps x)) 2.0) 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 280.0) {
tmp = (2.0 - (eps * x)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 280.0d0) then
tmp = (2.0d0 - (eps * x)) / 2.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 280.0) {
tmp = (2.0 - (eps * x)) / 2.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 280.0: tmp = (2.0 - (eps * x)) / 2.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 280.0) tmp = Float64(Float64(2.0 - Float64(eps * x)) / 2.0); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 280.0) tmp = (2.0 - (eps * x)) / 2.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 280.0], N[(N[(2.0 - N[(eps * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 280:\\
\;\;\;\;\frac{2 - \varepsilon \cdot x}{2}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 280Initial program 62.8%
Simplified62.8%
Taylor expanded in x around 0 48.3%
metadata-eval48.3%
distribute-neg-frac48.3%
metadata-eval48.3%
associate-*l/48.3%
*-commutative48.3%
distribute-lft-neg-in48.3%
cancel-sign-sub-inv48.3%
*-commutative48.3%
associate-*l/48.3%
metadata-eval48.3%
Simplified48.3%
Taylor expanded in x around 0 54.3%
Taylor expanded in eps around inf 73.4%
neg-mul-173.4%
+-commutative73.4%
distribute-lft-in73.4%
*-commutative73.4%
associate-*r*73.4%
rgt-mult-inverse73.5%
metadata-eval73.5%
distribute-rgt-neg-in73.5%
unsub-neg73.5%
*-commutative73.5%
Simplified73.5%
if 280 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 50.0%
mul-1-neg50.0%
mul-1-neg50.0%
rec-exp50.0%
sub-neg50.0%
div-sub50.0%
mul-1-neg50.0%
rec-exp50.0%
+-inverses50.0%
Simplified50.0%
Final simplification67.7%
(FPCore (x eps) :precision binary64 (if (<= x -1.0) (/ (* eps x) (- 2.0)) (if (<= x 490.0) 1.0 0.0)))
double code(double x, double eps) {
double tmp;
if (x <= -1.0) {
tmp = (eps * x) / -2.0;
} else if (x <= 490.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-1.0d0)) then
tmp = (eps * x) / -2.0d0
else if (x <= 490.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -1.0) {
tmp = (eps * x) / -2.0;
} else if (x <= 490.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -1.0: tmp = (eps * x) / -2.0 elif x <= 490.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -1.0) tmp = Float64(Float64(eps * x) / Float64(-2.0)); elseif (x <= 490.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -1.0) tmp = (eps * x) / -2.0; elseif (x <= 490.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -1.0], N[(N[(eps * x), $MachinePrecision] / (-2.0)), $MachinePrecision], If[LessEqual[x, 490.0], 1.0, 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{\varepsilon \cdot x}{-2}\\
\mathbf{elif}\;x \leq 490:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < -1Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0 70.9%
metadata-eval70.9%
distribute-neg-frac70.9%
metadata-eval70.9%
associate-*l/70.9%
*-commutative70.9%
distribute-lft-neg-in70.9%
cancel-sign-sub-inv70.9%
*-commutative70.9%
associate-*l/70.9%
metadata-eval70.9%
Simplified70.9%
Taylor expanded in x around 0 51.1%
Taylor expanded in eps around -inf 51.1%
mul-1-neg51.1%
*-commutative51.1%
distribute-rgt-neg-in51.1%
sub-neg51.1%
associate-*r/51.1%
metadata-eval51.1%
distribute-neg-frac51.1%
metadata-eval51.1%
Simplified51.1%
Taylor expanded in x around inf 51.1%
associate-*r*51.1%
mul-1-neg51.1%
Simplified51.1%
if -1 < x < 490Initial program 56.0%
Simplified56.0%
Taylor expanded in x around 0 78.5%
if 490 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 50.0%
mul-1-neg50.0%
mul-1-neg50.0%
rec-exp50.0%
sub-neg50.0%
div-sub50.0%
mul-1-neg50.0%
rec-exp50.0%
+-inverses50.0%
Simplified50.0%
Final simplification68.3%
(FPCore (x eps) :precision binary64 (if (<= x 620.0) 1.0 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 620.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 620.0d0) then
tmp = 1.0d0
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 620.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 620.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 620.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 620.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 620.0], 1.0, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 620:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 620Initial program 62.8%
Simplified62.8%
Taylor expanded in x around 0 66.7%
if 620 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around 0 50.0%
mul-1-neg50.0%
mul-1-neg50.0%
rec-exp50.0%
sub-neg50.0%
div-sub50.0%
mul-1-neg50.0%
rec-exp50.0%
+-inverses50.0%
Simplified50.0%
Final simplification62.6%
(FPCore (x eps) :precision binary64 0.0)
double code(double x, double eps) {
return 0.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 0.0d0
end function
public static double code(double x, double eps) {
return 0.0;
}
def code(x, eps): return 0.0
function code(x, eps) return 0.0 end
function tmp = code(x, eps) tmp = 0.0; end
code[x_, eps_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 72.0%
Simplified54.6%
Taylor expanded in eps around 0 14.1%
mul-1-neg14.1%
mul-1-neg14.1%
rec-exp14.1%
sub-neg14.1%
div-sub14.1%
mul-1-neg14.1%
rec-exp14.1%
+-inverses14.3%
Simplified14.3%
Final simplification14.3%
herbie shell --seed 2024103
(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))