
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
(FPCore (x eps) :precision binary64 (* 0.5 (+ (exp (* x (+ eps -1.0))) (exp (* x (- -1.0 eps))))))
double code(double x, double eps) {
return 0.5 * (exp((x * (eps + -1.0))) + exp((x * (-1.0 - eps))));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 0.5d0 * (exp((x * (eps + (-1.0d0)))) + exp((x * ((-1.0d0) - eps))))
end function
public static double code(double x, double eps) {
return 0.5 * (Math.exp((x * (eps + -1.0))) + Math.exp((x * (-1.0 - eps))));
}
def code(x, eps): return 0.5 * (math.exp((x * (eps + -1.0))) + math.exp((x * (-1.0 - eps))))
function code(x, eps) return Float64(0.5 * Float64(exp(Float64(x * Float64(eps + -1.0))) + exp(Float64(x * Float64(-1.0 - eps))))) end
function tmp = code(x, eps) tmp = 0.5 * (exp((x * (eps + -1.0))) + exp((x * (-1.0 - eps)))); end
code[x_, eps_] := N[(0.5 * N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-1 - \varepsilon\right)}\right)
\end{array}
Initial program 76.9%
Simplified76.9%
Taylor expanded in eps around inf
cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f6499.1%
Simplified99.1%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (+ eps -1.0) (+ eps -1.0)))
(t_1 (+ -0.5 (/ 0.5 eps)))
(t_2 (- 1.0 (* eps eps))))
(if (<= eps 1.0)
(* (+ x 1.0) (exp (- 0.0 x)))
(if (<= eps 6e+94)
(-
(*
(+
1.0
(*
x
(+
eps
(+
-1.0
(*
x
(+
(* (* (+ eps -1.0) (* x 0.16666666666666666)) t_0)
(* 0.5 t_0)))))))
(- 0.5 (/ -0.5 eps)))
(* (exp (* x (- -1.0 eps))) t_1))
(if (<= eps 1.1e+128)
(+
(+ 0.5 (/ 0.5 eps))
(*
t_1
(+
-1.0
(*
x
(+
(+ eps 1.0)
(* (* 0.5 x) (/ (* t_2 t_2) (* (+ eps -1.0) (- 1.0 eps)))))))))
(+ 1.0 (* x (* eps (* eps (* 0.5 x))))))))))
double code(double x, double eps) {
double t_0 = (eps + -1.0) * (eps + -1.0);
double t_1 = -0.5 + (0.5 / eps);
double t_2 = 1.0 - (eps * eps);
double tmp;
if (eps <= 1.0) {
tmp = (x + 1.0) * exp((0.0 - x));
} else if (eps <= 6e+94) {
tmp = ((1.0 + (x * (eps + (-1.0 + (x * ((((eps + -1.0) * (x * 0.16666666666666666)) * t_0) + (0.5 * t_0))))))) * (0.5 - (-0.5 / eps))) - (exp((x * (-1.0 - eps))) * t_1);
} else if (eps <= 1.1e+128) {
tmp = (0.5 + (0.5 / eps)) + (t_1 * (-1.0 + (x * ((eps + 1.0) + ((0.5 * x) * ((t_2 * t_2) / ((eps + -1.0) * (1.0 - eps))))))));
} else {
tmp = 1.0 + (x * (eps * (eps * (0.5 * x))));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (eps + (-1.0d0)) * (eps + (-1.0d0))
t_1 = (-0.5d0) + (0.5d0 / eps)
t_2 = 1.0d0 - (eps * eps)
if (eps <= 1.0d0) then
tmp = (x + 1.0d0) * exp((0.0d0 - x))
else if (eps <= 6d+94) then
tmp = ((1.0d0 + (x * (eps + ((-1.0d0) + (x * ((((eps + (-1.0d0)) * (x * 0.16666666666666666d0)) * t_0) + (0.5d0 * t_0))))))) * (0.5d0 - ((-0.5d0) / eps))) - (exp((x * ((-1.0d0) - eps))) * t_1)
else if (eps <= 1.1d+128) then
tmp = (0.5d0 + (0.5d0 / eps)) + (t_1 * ((-1.0d0) + (x * ((eps + 1.0d0) + ((0.5d0 * x) * ((t_2 * t_2) / ((eps + (-1.0d0)) * (1.0d0 - eps))))))))
else
tmp = 1.0d0 + (x * (eps * (eps * (0.5d0 * x))))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = (eps + -1.0) * (eps + -1.0);
double t_1 = -0.5 + (0.5 / eps);
double t_2 = 1.0 - (eps * eps);
double tmp;
if (eps <= 1.0) {
tmp = (x + 1.0) * Math.exp((0.0 - x));
} else if (eps <= 6e+94) {
tmp = ((1.0 + (x * (eps + (-1.0 + (x * ((((eps + -1.0) * (x * 0.16666666666666666)) * t_0) + (0.5 * t_0))))))) * (0.5 - (-0.5 / eps))) - (Math.exp((x * (-1.0 - eps))) * t_1);
} else if (eps <= 1.1e+128) {
tmp = (0.5 + (0.5 / eps)) + (t_1 * (-1.0 + (x * ((eps + 1.0) + ((0.5 * x) * ((t_2 * t_2) / ((eps + -1.0) * (1.0 - eps))))))));
} else {
tmp = 1.0 + (x * (eps * (eps * (0.5 * x))));
}
return tmp;
}
def code(x, eps): t_0 = (eps + -1.0) * (eps + -1.0) t_1 = -0.5 + (0.5 / eps) t_2 = 1.0 - (eps * eps) tmp = 0 if eps <= 1.0: tmp = (x + 1.0) * math.exp((0.0 - x)) elif eps <= 6e+94: tmp = ((1.0 + (x * (eps + (-1.0 + (x * ((((eps + -1.0) * (x * 0.16666666666666666)) * t_0) + (0.5 * t_0))))))) * (0.5 - (-0.5 / eps))) - (math.exp((x * (-1.0 - eps))) * t_1) elif eps <= 1.1e+128: tmp = (0.5 + (0.5 / eps)) + (t_1 * (-1.0 + (x * ((eps + 1.0) + ((0.5 * x) * ((t_2 * t_2) / ((eps + -1.0) * (1.0 - eps)))))))) else: tmp = 1.0 + (x * (eps * (eps * (0.5 * x)))) return tmp
function code(x, eps) t_0 = Float64(Float64(eps + -1.0) * Float64(eps + -1.0)) t_1 = Float64(-0.5 + Float64(0.5 / eps)) t_2 = Float64(1.0 - Float64(eps * eps)) tmp = 0.0 if (eps <= 1.0) tmp = Float64(Float64(x + 1.0) * exp(Float64(0.0 - x))); elseif (eps <= 6e+94) tmp = Float64(Float64(Float64(1.0 + Float64(x * Float64(eps + Float64(-1.0 + Float64(x * Float64(Float64(Float64(Float64(eps + -1.0) * Float64(x * 0.16666666666666666)) * t_0) + Float64(0.5 * t_0))))))) * Float64(0.5 - Float64(-0.5 / eps))) - Float64(exp(Float64(x * Float64(-1.0 - eps))) * t_1)); elseif (eps <= 1.1e+128) tmp = Float64(Float64(0.5 + Float64(0.5 / eps)) + Float64(t_1 * Float64(-1.0 + Float64(x * Float64(Float64(eps + 1.0) + Float64(Float64(0.5 * x) * Float64(Float64(t_2 * t_2) / Float64(Float64(eps + -1.0) * Float64(1.0 - eps))))))))); else tmp = Float64(1.0 + Float64(x * Float64(eps * Float64(eps * Float64(0.5 * x))))); end return tmp end
function tmp_2 = code(x, eps) t_0 = (eps + -1.0) * (eps + -1.0); t_1 = -0.5 + (0.5 / eps); t_2 = 1.0 - (eps * eps); tmp = 0.0; if (eps <= 1.0) tmp = (x + 1.0) * exp((0.0 - x)); elseif (eps <= 6e+94) tmp = ((1.0 + (x * (eps + (-1.0 + (x * ((((eps + -1.0) * (x * 0.16666666666666666)) * t_0) + (0.5 * t_0))))))) * (0.5 - (-0.5 / eps))) - (exp((x * (-1.0 - eps))) * t_1); elseif (eps <= 1.1e+128) tmp = (0.5 + (0.5 / eps)) + (t_1 * (-1.0 + (x * ((eps + 1.0) + ((0.5 * x) * ((t_2 * t_2) / ((eps + -1.0) * (1.0 - eps)))))))); else tmp = 1.0 + (x * (eps * (eps * (0.5 * x)))); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(eps + -1.0), $MachinePrecision] * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.5 + N[(0.5 / eps), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, 1.0], N[(N[(x + 1.0), $MachinePrecision] * N[Exp[N[(0.0 - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 6e+94], N[(N[(N[(1.0 + N[(x * N[(eps + N[(-1.0 + N[(x * N[(N[(N[(N[(eps + -1.0), $MachinePrecision] * N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 - N[(-0.5 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 1.1e+128], N[(N[(0.5 + N[(0.5 / eps), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * N[(-1.0 + N[(x * N[(N[(eps + 1.0), $MachinePrecision] + N[(N[(0.5 * x), $MachinePrecision] * N[(N[(t$95$2 * t$95$2), $MachinePrecision] / N[(N[(eps + -1.0), $MachinePrecision] * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(eps * N[(eps * N[(0.5 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\varepsilon + -1\right) \cdot \left(\varepsilon + -1\right)\\
t_1 := -0.5 + \frac{0.5}{\varepsilon}\\
t_2 := 1 - \varepsilon \cdot \varepsilon\\
\mathbf{if}\;\varepsilon \leq 1:\\
\;\;\;\;\left(x + 1\right) \cdot e^{0 - x}\\
\mathbf{elif}\;\varepsilon \leq 6 \cdot 10^{+94}:\\
\;\;\;\;\left(1 + x \cdot \left(\varepsilon + \left(-1 + x \cdot \left(\left(\left(\varepsilon + -1\right) \cdot \left(x \cdot 0.16666666666666666\right)\right) \cdot t\_0 + 0.5 \cdot t\_0\right)\right)\right)\right) \cdot \left(0.5 - \frac{-0.5}{\varepsilon}\right) - e^{x \cdot \left(-1 - \varepsilon\right)} \cdot t\_1\\
\mathbf{elif}\;\varepsilon \leq 1.1 \cdot 10^{+128}:\\
\;\;\;\;\left(0.5 + \frac{0.5}{\varepsilon}\right) + t\_1 \cdot \left(-1 + x \cdot \left(\left(\varepsilon + 1\right) + \left(0.5 \cdot x\right) \cdot \frac{t\_2 \cdot t\_2}{\left(\varepsilon + -1\right) \cdot \left(1 - \varepsilon\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \left(0.5 \cdot x\right)\right)\right)\\
\end{array}
\end{array}
if eps < 1Initial program 67.9%
Simplified67.9%
Taylor expanded in eps around 0
distribute-lft-outN/A
distribute-lft-outN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-rgt-identityN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6467.4%
Simplified67.4%
if 1 < eps < 6.0000000000000001e94Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
Simplified90.2%
if 6.0000000000000001e94 < eps < 1.10000000000000008e128Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6451.6%
Simplified51.6%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6440.9%
Simplified40.9%
flip-+N/A
flip-+N/A
frac-timesN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
--lowering--.f6487.9%
Applied egg-rr87.9%
if 1.10000000000000008e128 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified89.0%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6489.0%
Simplified89.0%
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6491.2%
Applied egg-rr91.2%
Final simplification73.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- 1.0 (* eps eps))) (t_1 (* x (+ eps -1.0))))
(if (<= eps 1.0)
(* (+ x 1.0) (exp (- 0.0 x)))
(if (<= eps 1.15e+18)
(* 0.5 (+ (exp t_1) 1.0))
(if (<= eps 6e+94)
(* 0.5 (+ (exp (* x (- -1.0 eps))) (+ t_1 1.0)))
(if (<= eps 1.15e+128)
(+
(+ 0.5 (/ 0.5 eps))
(*
(+ -0.5 (/ 0.5 eps))
(+
-1.0
(*
x
(+
(+ eps 1.0)
(* (* 0.5 x) (/ (* t_0 t_0) (* (+ eps -1.0) (- 1.0 eps)))))))))
(+ 1.0 (* x (* eps (* eps (* 0.5 x)))))))))))
double code(double x, double eps) {
double t_0 = 1.0 - (eps * eps);
double t_1 = x * (eps + -1.0);
double tmp;
if (eps <= 1.0) {
tmp = (x + 1.0) * exp((0.0 - x));
} else if (eps <= 1.15e+18) {
tmp = 0.5 * (exp(t_1) + 1.0);
} else if (eps <= 6e+94) {
tmp = 0.5 * (exp((x * (-1.0 - eps))) + (t_1 + 1.0));
} else if (eps <= 1.15e+128) {
tmp = (0.5 + (0.5 / eps)) + ((-0.5 + (0.5 / eps)) * (-1.0 + (x * ((eps + 1.0) + ((0.5 * x) * ((t_0 * t_0) / ((eps + -1.0) * (1.0 - eps))))))));
} else {
tmp = 1.0 + (x * (eps * (eps * (0.5 * x))));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (eps * eps)
t_1 = x * (eps + (-1.0d0))
if (eps <= 1.0d0) then
tmp = (x + 1.0d0) * exp((0.0d0 - x))
else if (eps <= 1.15d+18) then
tmp = 0.5d0 * (exp(t_1) + 1.0d0)
else if (eps <= 6d+94) then
tmp = 0.5d0 * (exp((x * ((-1.0d0) - eps))) + (t_1 + 1.0d0))
else if (eps <= 1.15d+128) then
tmp = (0.5d0 + (0.5d0 / eps)) + (((-0.5d0) + (0.5d0 / eps)) * ((-1.0d0) + (x * ((eps + 1.0d0) + ((0.5d0 * x) * ((t_0 * t_0) / ((eps + (-1.0d0)) * (1.0d0 - eps))))))))
else
tmp = 1.0d0 + (x * (eps * (eps * (0.5d0 * x))))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = 1.0 - (eps * eps);
double t_1 = x * (eps + -1.0);
double tmp;
if (eps <= 1.0) {
tmp = (x + 1.0) * Math.exp((0.0 - x));
} else if (eps <= 1.15e+18) {
tmp = 0.5 * (Math.exp(t_1) + 1.0);
} else if (eps <= 6e+94) {
tmp = 0.5 * (Math.exp((x * (-1.0 - eps))) + (t_1 + 1.0));
} else if (eps <= 1.15e+128) {
tmp = (0.5 + (0.5 / eps)) + ((-0.5 + (0.5 / eps)) * (-1.0 + (x * ((eps + 1.0) + ((0.5 * x) * ((t_0 * t_0) / ((eps + -1.0) * (1.0 - eps))))))));
} else {
tmp = 1.0 + (x * (eps * (eps * (0.5 * x))));
}
return tmp;
}
def code(x, eps): t_0 = 1.0 - (eps * eps) t_1 = x * (eps + -1.0) tmp = 0 if eps <= 1.0: tmp = (x + 1.0) * math.exp((0.0 - x)) elif eps <= 1.15e+18: tmp = 0.5 * (math.exp(t_1) + 1.0) elif eps <= 6e+94: tmp = 0.5 * (math.exp((x * (-1.0 - eps))) + (t_1 + 1.0)) elif eps <= 1.15e+128: tmp = (0.5 + (0.5 / eps)) + ((-0.5 + (0.5 / eps)) * (-1.0 + (x * ((eps + 1.0) + ((0.5 * x) * ((t_0 * t_0) / ((eps + -1.0) * (1.0 - eps)))))))) else: tmp = 1.0 + (x * (eps * (eps * (0.5 * x)))) return tmp
function code(x, eps) t_0 = Float64(1.0 - Float64(eps * eps)) t_1 = Float64(x * Float64(eps + -1.0)) tmp = 0.0 if (eps <= 1.0) tmp = Float64(Float64(x + 1.0) * exp(Float64(0.0 - x))); elseif (eps <= 1.15e+18) tmp = Float64(0.5 * Float64(exp(t_1) + 1.0)); elseif (eps <= 6e+94) tmp = Float64(0.5 * Float64(exp(Float64(x * Float64(-1.0 - eps))) + Float64(t_1 + 1.0))); elseif (eps <= 1.15e+128) tmp = Float64(Float64(0.5 + Float64(0.5 / eps)) + Float64(Float64(-0.5 + Float64(0.5 / eps)) * Float64(-1.0 + Float64(x * Float64(Float64(eps + 1.0) + Float64(Float64(0.5 * x) * Float64(Float64(t_0 * t_0) / Float64(Float64(eps + -1.0) * Float64(1.0 - eps))))))))); else tmp = Float64(1.0 + Float64(x * Float64(eps * Float64(eps * Float64(0.5 * x))))); end return tmp end
function tmp_2 = code(x, eps) t_0 = 1.0 - (eps * eps); t_1 = x * (eps + -1.0); tmp = 0.0; if (eps <= 1.0) tmp = (x + 1.0) * exp((0.0 - x)); elseif (eps <= 1.15e+18) tmp = 0.5 * (exp(t_1) + 1.0); elseif (eps <= 6e+94) tmp = 0.5 * (exp((x * (-1.0 - eps))) + (t_1 + 1.0)); elseif (eps <= 1.15e+128) tmp = (0.5 + (0.5 / eps)) + ((-0.5 + (0.5 / eps)) * (-1.0 + (x * ((eps + 1.0) + ((0.5 * x) * ((t_0 * t_0) / ((eps + -1.0) * (1.0 - eps)))))))); else tmp = 1.0 + (x * (eps * (eps * (0.5 * x)))); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, 1.0], N[(N[(x + 1.0), $MachinePrecision] * N[Exp[N[(0.0 - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 1.15e+18], N[(0.5 * N[(N[Exp[t$95$1], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 6e+94], N[(0.5 * N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(t$95$1 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 1.15e+128], N[(N[(0.5 + N[(0.5 / eps), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 + N[(0.5 / eps), $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(x * N[(N[(eps + 1.0), $MachinePrecision] + N[(N[(0.5 * x), $MachinePrecision] * N[(N[(t$95$0 * t$95$0), $MachinePrecision] / N[(N[(eps + -1.0), $MachinePrecision] * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(eps * N[(eps * N[(0.5 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \varepsilon \cdot \varepsilon\\
t_1 := x \cdot \left(\varepsilon + -1\right)\\
\mathbf{if}\;\varepsilon \leq 1:\\
\;\;\;\;\left(x + 1\right) \cdot e^{0 - x}\\
\mathbf{elif}\;\varepsilon \leq 1.15 \cdot 10^{+18}:\\
\;\;\;\;0.5 \cdot \left(e^{t\_1} + 1\right)\\
\mathbf{elif}\;\varepsilon \leq 6 \cdot 10^{+94}:\\
\;\;\;\;0.5 \cdot \left(e^{x \cdot \left(-1 - \varepsilon\right)} + \left(t\_1 + 1\right)\right)\\
\mathbf{elif}\;\varepsilon \leq 1.15 \cdot 10^{+128}:\\
\;\;\;\;\left(0.5 + \frac{0.5}{\varepsilon}\right) + \left(-0.5 + \frac{0.5}{\varepsilon}\right) \cdot \left(-1 + x \cdot \left(\left(\varepsilon + 1\right) + \left(0.5 \cdot x\right) \cdot \frac{t\_0 \cdot t\_0}{\left(\varepsilon + -1\right) \cdot \left(1 - \varepsilon\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \left(0.5 \cdot x\right)\right)\right)\\
\end{array}
\end{array}
if eps < 1Initial program 67.9%
Simplified67.9%
Taylor expanded in eps around 0
distribute-lft-outN/A
distribute-lft-outN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-rgt-identityN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6467.4%
Simplified67.4%
if 1 < eps < 1.15e18Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf
cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified100.0%
if 1.15e18 < eps < 6.0000000000000001e94Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf
cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f6476.6%
Simplified76.6%
if 6.0000000000000001e94 < eps < 1.14999999999999999e128Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6451.6%
Simplified51.6%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6440.9%
Simplified40.9%
flip-+N/A
flip-+N/A
frac-timesN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
--lowering--.f6487.9%
Applied egg-rr87.9%
if 1.14999999999999999e128 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified89.0%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6489.0%
Simplified89.0%
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6491.2%
Applied egg-rr91.2%
Final simplification73.1%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- 1.0 (* eps eps))))
(if (<= eps 1.0)
(* (+ x 1.0) (exp (- 0.0 x)))
(if (<= eps 3.4e+18)
(* 0.5 (+ (exp (* x (+ eps -1.0))) 1.0))
(if (<= eps 5.2e+94)
(+ 0.5 (* 0.5 (exp (* x (- -1.0 eps)))))
(if (<= eps 1.1e+128)
(+
(+ 0.5 (/ 0.5 eps))
(*
(+ -0.5 (/ 0.5 eps))
(+
-1.0
(*
x
(+
(+ eps 1.0)
(* (* 0.5 x) (/ (* t_0 t_0) (* (+ eps -1.0) (- 1.0 eps)))))))))
(+ 1.0 (* x (* eps (* eps (* 0.5 x)))))))))))
double code(double x, double eps) {
double t_0 = 1.0 - (eps * eps);
double tmp;
if (eps <= 1.0) {
tmp = (x + 1.0) * exp((0.0 - x));
} else if (eps <= 3.4e+18) {
tmp = 0.5 * (exp((x * (eps + -1.0))) + 1.0);
} else if (eps <= 5.2e+94) {
tmp = 0.5 + (0.5 * exp((x * (-1.0 - eps))));
} else if (eps <= 1.1e+128) {
tmp = (0.5 + (0.5 / eps)) + ((-0.5 + (0.5 / eps)) * (-1.0 + (x * ((eps + 1.0) + ((0.5 * x) * ((t_0 * t_0) / ((eps + -1.0) * (1.0 - eps))))))));
} else {
tmp = 1.0 + (x * (eps * (eps * (0.5 * x))));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (eps * eps)
if (eps <= 1.0d0) then
tmp = (x + 1.0d0) * exp((0.0d0 - x))
else if (eps <= 3.4d+18) then
tmp = 0.5d0 * (exp((x * (eps + (-1.0d0)))) + 1.0d0)
else if (eps <= 5.2d+94) then
tmp = 0.5d0 + (0.5d0 * exp((x * ((-1.0d0) - eps))))
else if (eps <= 1.1d+128) then
tmp = (0.5d0 + (0.5d0 / eps)) + (((-0.5d0) + (0.5d0 / eps)) * ((-1.0d0) + (x * ((eps + 1.0d0) + ((0.5d0 * x) * ((t_0 * t_0) / ((eps + (-1.0d0)) * (1.0d0 - eps))))))))
else
tmp = 1.0d0 + (x * (eps * (eps * (0.5d0 * x))))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = 1.0 - (eps * eps);
double tmp;
if (eps <= 1.0) {
tmp = (x + 1.0) * Math.exp((0.0 - x));
} else if (eps <= 3.4e+18) {
tmp = 0.5 * (Math.exp((x * (eps + -1.0))) + 1.0);
} else if (eps <= 5.2e+94) {
tmp = 0.5 + (0.5 * Math.exp((x * (-1.0 - eps))));
} else if (eps <= 1.1e+128) {
tmp = (0.5 + (0.5 / eps)) + ((-0.5 + (0.5 / eps)) * (-1.0 + (x * ((eps + 1.0) + ((0.5 * x) * ((t_0 * t_0) / ((eps + -1.0) * (1.0 - eps))))))));
} else {
tmp = 1.0 + (x * (eps * (eps * (0.5 * x))));
}
return tmp;
}
def code(x, eps): t_0 = 1.0 - (eps * eps) tmp = 0 if eps <= 1.0: tmp = (x + 1.0) * math.exp((0.0 - x)) elif eps <= 3.4e+18: tmp = 0.5 * (math.exp((x * (eps + -1.0))) + 1.0) elif eps <= 5.2e+94: tmp = 0.5 + (0.5 * math.exp((x * (-1.0 - eps)))) elif eps <= 1.1e+128: tmp = (0.5 + (0.5 / eps)) + ((-0.5 + (0.5 / eps)) * (-1.0 + (x * ((eps + 1.0) + ((0.5 * x) * ((t_0 * t_0) / ((eps + -1.0) * (1.0 - eps)))))))) else: tmp = 1.0 + (x * (eps * (eps * (0.5 * x)))) return tmp
function code(x, eps) t_0 = Float64(1.0 - Float64(eps * eps)) tmp = 0.0 if (eps <= 1.0) tmp = Float64(Float64(x + 1.0) * exp(Float64(0.0 - x))); elseif (eps <= 3.4e+18) tmp = Float64(0.5 * Float64(exp(Float64(x * Float64(eps + -1.0))) + 1.0)); elseif (eps <= 5.2e+94) tmp = Float64(0.5 + Float64(0.5 * exp(Float64(x * Float64(-1.0 - eps))))); elseif (eps <= 1.1e+128) tmp = Float64(Float64(0.5 + Float64(0.5 / eps)) + Float64(Float64(-0.5 + Float64(0.5 / eps)) * Float64(-1.0 + Float64(x * Float64(Float64(eps + 1.0) + Float64(Float64(0.5 * x) * Float64(Float64(t_0 * t_0) / Float64(Float64(eps + -1.0) * Float64(1.0 - eps))))))))); else tmp = Float64(1.0 + Float64(x * Float64(eps * Float64(eps * Float64(0.5 * x))))); end return tmp end
function tmp_2 = code(x, eps) t_0 = 1.0 - (eps * eps); tmp = 0.0; if (eps <= 1.0) tmp = (x + 1.0) * exp((0.0 - x)); elseif (eps <= 3.4e+18) tmp = 0.5 * (exp((x * (eps + -1.0))) + 1.0); elseif (eps <= 5.2e+94) tmp = 0.5 + (0.5 * exp((x * (-1.0 - eps)))); elseif (eps <= 1.1e+128) tmp = (0.5 + (0.5 / eps)) + ((-0.5 + (0.5 / eps)) * (-1.0 + (x * ((eps + 1.0) + ((0.5 * x) * ((t_0 * t_0) / ((eps + -1.0) * (1.0 - eps)))))))); else tmp = 1.0 + (x * (eps * (eps * (0.5 * x)))); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, 1.0], N[(N[(x + 1.0), $MachinePrecision] * N[Exp[N[(0.0 - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 3.4e+18], N[(0.5 * N[(N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 5.2e+94], N[(0.5 + N[(0.5 * N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 1.1e+128], N[(N[(0.5 + N[(0.5 / eps), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 + N[(0.5 / eps), $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(x * N[(N[(eps + 1.0), $MachinePrecision] + N[(N[(0.5 * x), $MachinePrecision] * N[(N[(t$95$0 * t$95$0), $MachinePrecision] / N[(N[(eps + -1.0), $MachinePrecision] * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(eps * N[(eps * N[(0.5 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \varepsilon \cdot \varepsilon\\
\mathbf{if}\;\varepsilon \leq 1:\\
\;\;\;\;\left(x + 1\right) \cdot e^{0 - x}\\
\mathbf{elif}\;\varepsilon \leq 3.4 \cdot 10^{+18}:\\
\;\;\;\;0.5 \cdot \left(e^{x \cdot \left(\varepsilon + -1\right)} + 1\right)\\
\mathbf{elif}\;\varepsilon \leq 5.2 \cdot 10^{+94}:\\
\;\;\;\;0.5 + 0.5 \cdot e^{x \cdot \left(-1 - \varepsilon\right)}\\
\mathbf{elif}\;\varepsilon \leq 1.1 \cdot 10^{+128}:\\
\;\;\;\;\left(0.5 + \frac{0.5}{\varepsilon}\right) + \left(-0.5 + \frac{0.5}{\varepsilon}\right) \cdot \left(-1 + x \cdot \left(\left(\varepsilon + 1\right) + \left(0.5 \cdot x\right) \cdot \frac{t\_0 \cdot t\_0}{\left(\varepsilon + -1\right) \cdot \left(1 - \varepsilon\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \left(0.5 \cdot x\right)\right)\right)\\
\end{array}
\end{array}
if eps < 1Initial program 67.9%
Simplified67.9%
Taylor expanded in eps around 0
distribute-lft-outN/A
distribute-lft-outN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-rgt-identityN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6467.4%
Simplified67.4%
if 1 < eps < 3.4e18Initial program 100.0%
Simplified100.0%
Taylor expanded in eps around inf
cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified100.0%
if 3.4e18 < eps < 5.1999999999999998e94Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6471.5%
Simplified71.5%
Taylor expanded in eps around inf
sub-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
sub-negN/A
distribute-rgt-neg-inN/A
+-lowering-+.f64N/A
distribute-lft-neg-inN/A
sub-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
Simplified71.5%
if 5.1999999999999998e94 < eps < 1.10000000000000008e128Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6451.6%
Simplified51.6%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6440.9%
Simplified40.9%
flip-+N/A
flip-+N/A
frac-timesN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
--lowering--.f6487.9%
Applied egg-rr87.9%
if 1.10000000000000008e128 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified89.0%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6489.0%
Simplified89.0%
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6491.2%
Applied egg-rr91.2%
Final simplification72.8%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (+ eps -1.0) (+ 0.5 (/ 0.5 eps))))
(t_1 (* (+ -0.5 (/ 0.5 eps)) (+ eps 1.0))))
(if (<= eps 1.0)
(* (+ x 1.0) (exp (- 0.0 x)))
(if (<= eps 1.06e+128)
(+
1.0
(*
x
(+
(+ t_0 t_1)
(*
(* 0.5 x)
(-
(* (- -1.0 eps) t_1)
(/
(* t_0 (+ -1.0 (* eps (* eps eps))))
(- (- -1.0 eps) (* eps eps))))))))
(+ 1.0 (* x (* eps (* eps (* 0.5 x)))))))))
double code(double x, double eps) {
double t_0 = (eps + -1.0) * (0.5 + (0.5 / eps));
double t_1 = (-0.5 + (0.5 / eps)) * (eps + 1.0);
double tmp;
if (eps <= 1.0) {
tmp = (x + 1.0) * exp((0.0 - x));
} else if (eps <= 1.06e+128) {
tmp = 1.0 + (x * ((t_0 + t_1) + ((0.5 * x) * (((-1.0 - eps) * t_1) - ((t_0 * (-1.0 + (eps * (eps * eps)))) / ((-1.0 - eps) - (eps * eps)))))));
} else {
tmp = 1.0 + (x * (eps * (eps * (0.5 * x))));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (eps + (-1.0d0)) * (0.5d0 + (0.5d0 / eps))
t_1 = ((-0.5d0) + (0.5d0 / eps)) * (eps + 1.0d0)
if (eps <= 1.0d0) then
tmp = (x + 1.0d0) * exp((0.0d0 - x))
else if (eps <= 1.06d+128) then
tmp = 1.0d0 + (x * ((t_0 + t_1) + ((0.5d0 * x) * ((((-1.0d0) - eps) * t_1) - ((t_0 * ((-1.0d0) + (eps * (eps * eps)))) / (((-1.0d0) - eps) - (eps * eps)))))))
else
tmp = 1.0d0 + (x * (eps * (eps * (0.5d0 * x))))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = (eps + -1.0) * (0.5 + (0.5 / eps));
double t_1 = (-0.5 + (0.5 / eps)) * (eps + 1.0);
double tmp;
if (eps <= 1.0) {
tmp = (x + 1.0) * Math.exp((0.0 - x));
} else if (eps <= 1.06e+128) {
tmp = 1.0 + (x * ((t_0 + t_1) + ((0.5 * x) * (((-1.0 - eps) * t_1) - ((t_0 * (-1.0 + (eps * (eps * eps)))) / ((-1.0 - eps) - (eps * eps)))))));
} else {
tmp = 1.0 + (x * (eps * (eps * (0.5 * x))));
}
return tmp;
}
def code(x, eps): t_0 = (eps + -1.0) * (0.5 + (0.5 / eps)) t_1 = (-0.5 + (0.5 / eps)) * (eps + 1.0) tmp = 0 if eps <= 1.0: tmp = (x + 1.0) * math.exp((0.0 - x)) elif eps <= 1.06e+128: tmp = 1.0 + (x * ((t_0 + t_1) + ((0.5 * x) * (((-1.0 - eps) * t_1) - ((t_0 * (-1.0 + (eps * (eps * eps)))) / ((-1.0 - eps) - (eps * eps))))))) else: tmp = 1.0 + (x * (eps * (eps * (0.5 * x)))) return tmp
function code(x, eps) t_0 = Float64(Float64(eps + -1.0) * Float64(0.5 + Float64(0.5 / eps))) t_1 = Float64(Float64(-0.5 + Float64(0.5 / eps)) * Float64(eps + 1.0)) tmp = 0.0 if (eps <= 1.0) tmp = Float64(Float64(x + 1.0) * exp(Float64(0.0 - x))); elseif (eps <= 1.06e+128) tmp = Float64(1.0 + Float64(x * Float64(Float64(t_0 + t_1) + Float64(Float64(0.5 * x) * Float64(Float64(Float64(-1.0 - eps) * t_1) - Float64(Float64(t_0 * Float64(-1.0 + Float64(eps * Float64(eps * eps)))) / Float64(Float64(-1.0 - eps) - Float64(eps * eps)))))))); else tmp = Float64(1.0 + Float64(x * Float64(eps * Float64(eps * Float64(0.5 * x))))); end return tmp end
function tmp_2 = code(x, eps) t_0 = (eps + -1.0) * (0.5 + (0.5 / eps)); t_1 = (-0.5 + (0.5 / eps)) * (eps + 1.0); tmp = 0.0; if (eps <= 1.0) tmp = (x + 1.0) * exp((0.0 - x)); elseif (eps <= 1.06e+128) tmp = 1.0 + (x * ((t_0 + t_1) + ((0.5 * x) * (((-1.0 - eps) * t_1) - ((t_0 * (-1.0 + (eps * (eps * eps)))) / ((-1.0 - eps) - (eps * eps))))))); else tmp = 1.0 + (x * (eps * (eps * (0.5 * x)))); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(eps + -1.0), $MachinePrecision] * N[(0.5 + N[(0.5 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(-0.5 + N[(0.5 / eps), $MachinePrecision]), $MachinePrecision] * N[(eps + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, 1.0], N[(N[(x + 1.0), $MachinePrecision] * N[Exp[N[(0.0 - x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 1.06e+128], N[(1.0 + N[(x * N[(N[(t$95$0 + t$95$1), $MachinePrecision] + N[(N[(0.5 * x), $MachinePrecision] * N[(N[(N[(-1.0 - eps), $MachinePrecision] * t$95$1), $MachinePrecision] - N[(N[(t$95$0 * N[(-1.0 + N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(-1.0 - eps), $MachinePrecision] - N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(eps * N[(eps * N[(0.5 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\varepsilon + -1\right) \cdot \left(0.5 + \frac{0.5}{\varepsilon}\right)\\
t_1 := \left(-0.5 + \frac{0.5}{\varepsilon}\right) \cdot \left(\varepsilon + 1\right)\\
\mathbf{if}\;\varepsilon \leq 1:\\
\;\;\;\;\left(x + 1\right) \cdot e^{0 - x}\\
\mathbf{elif}\;\varepsilon \leq 1.06 \cdot 10^{+128}:\\
\;\;\;\;1 + x \cdot \left(\left(t\_0 + t\_1\right) + \left(0.5 \cdot x\right) \cdot \left(\left(-1 - \varepsilon\right) \cdot t\_1 - \frac{t\_0 \cdot \left(-1 + \varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)}{\left(-1 - \varepsilon\right) - \varepsilon \cdot \varepsilon}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \left(0.5 \cdot x\right)\right)\right)\\
\end{array}
\end{array}
if eps < 1Initial program 67.9%
Simplified67.9%
Taylor expanded in eps around 0
distribute-lft-outN/A
distribute-lft-outN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-rgt-identityN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6467.4%
Simplified67.4%
if 1 < eps < 1.06000000000000008e128Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified66.0%
associate-*r*N/A
flip3-+N/A
associate-*r/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
Applied egg-rr72.5%
if 1.06000000000000008e128 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified89.0%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6489.0%
Simplified89.0%
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6491.2%
Applied egg-rr91.2%
Final simplification72.1%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- 1.0 (* eps eps))))
(if (<= eps 2.35e+86)
(exp (- 0.0 x))
(if (<= eps 1.15e+128)
(+
(+ 0.5 (/ 0.5 eps))
(*
(+ -0.5 (/ 0.5 eps))
(+
-1.0
(*
x
(+
(+ eps 1.0)
(* (* 0.5 x) (/ (* t_0 t_0) (* (+ eps -1.0) (- 1.0 eps)))))))))
(+ 1.0 (* x (* eps (* eps (* 0.5 x)))))))))
double code(double x, double eps) {
double t_0 = 1.0 - (eps * eps);
double tmp;
if (eps <= 2.35e+86) {
tmp = exp((0.0 - x));
} else if (eps <= 1.15e+128) {
tmp = (0.5 + (0.5 / eps)) + ((-0.5 + (0.5 / eps)) * (-1.0 + (x * ((eps + 1.0) + ((0.5 * x) * ((t_0 * t_0) / ((eps + -1.0) * (1.0 - eps))))))));
} else {
tmp = 1.0 + (x * (eps * (eps * (0.5 * x))));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (eps * eps)
if (eps <= 2.35d+86) then
tmp = exp((0.0d0 - x))
else if (eps <= 1.15d+128) then
tmp = (0.5d0 + (0.5d0 / eps)) + (((-0.5d0) + (0.5d0 / eps)) * ((-1.0d0) + (x * ((eps + 1.0d0) + ((0.5d0 * x) * ((t_0 * t_0) / ((eps + (-1.0d0)) * (1.0d0 - eps))))))))
else
tmp = 1.0d0 + (x * (eps * (eps * (0.5d0 * x))))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = 1.0 - (eps * eps);
double tmp;
if (eps <= 2.35e+86) {
tmp = Math.exp((0.0 - x));
} else if (eps <= 1.15e+128) {
tmp = (0.5 + (0.5 / eps)) + ((-0.5 + (0.5 / eps)) * (-1.0 + (x * ((eps + 1.0) + ((0.5 * x) * ((t_0 * t_0) / ((eps + -1.0) * (1.0 - eps))))))));
} else {
tmp = 1.0 + (x * (eps * (eps * (0.5 * x))));
}
return tmp;
}
def code(x, eps): t_0 = 1.0 - (eps * eps) tmp = 0 if eps <= 2.35e+86: tmp = math.exp((0.0 - x)) elif eps <= 1.15e+128: tmp = (0.5 + (0.5 / eps)) + ((-0.5 + (0.5 / eps)) * (-1.0 + (x * ((eps + 1.0) + ((0.5 * x) * ((t_0 * t_0) / ((eps + -1.0) * (1.0 - eps)))))))) else: tmp = 1.0 + (x * (eps * (eps * (0.5 * x)))) return tmp
function code(x, eps) t_0 = Float64(1.0 - Float64(eps * eps)) tmp = 0.0 if (eps <= 2.35e+86) tmp = exp(Float64(0.0 - x)); elseif (eps <= 1.15e+128) tmp = Float64(Float64(0.5 + Float64(0.5 / eps)) + Float64(Float64(-0.5 + Float64(0.5 / eps)) * Float64(-1.0 + Float64(x * Float64(Float64(eps + 1.0) + Float64(Float64(0.5 * x) * Float64(Float64(t_0 * t_0) / Float64(Float64(eps + -1.0) * Float64(1.0 - eps))))))))); else tmp = Float64(1.0 + Float64(x * Float64(eps * Float64(eps * Float64(0.5 * x))))); end return tmp end
function tmp_2 = code(x, eps) t_0 = 1.0 - (eps * eps); tmp = 0.0; if (eps <= 2.35e+86) tmp = exp((0.0 - x)); elseif (eps <= 1.15e+128) tmp = (0.5 + (0.5 / eps)) + ((-0.5 + (0.5 / eps)) * (-1.0 + (x * ((eps + 1.0) + ((0.5 * x) * ((t_0 * t_0) / ((eps + -1.0) * (1.0 - eps)))))))); else tmp = 1.0 + (x * (eps * (eps * (0.5 * x)))); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, 2.35e+86], N[Exp[N[(0.0 - x), $MachinePrecision]], $MachinePrecision], If[LessEqual[eps, 1.15e+128], N[(N[(0.5 + N[(0.5 / eps), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 + N[(0.5 / eps), $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(x * N[(N[(eps + 1.0), $MachinePrecision] + N[(N[(0.5 * x), $MachinePrecision] * N[(N[(t$95$0 * t$95$0), $MachinePrecision] / N[(N[(eps + -1.0), $MachinePrecision] * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(eps * N[(eps * N[(0.5 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \varepsilon \cdot \varepsilon\\
\mathbf{if}\;\varepsilon \leq 2.35 \cdot 10^{+86}:\\
\;\;\;\;e^{0 - x}\\
\mathbf{elif}\;\varepsilon \leq 1.15 \cdot 10^{+128}:\\
\;\;\;\;\left(0.5 + \frac{0.5}{\varepsilon}\right) + \left(-0.5 + \frac{0.5}{\varepsilon}\right) \cdot \left(-1 + x \cdot \left(\left(\varepsilon + 1\right) + \left(0.5 \cdot x\right) \cdot \frac{t\_0 \cdot t\_0}{\left(\varepsilon + -1\right) \cdot \left(1 - \varepsilon\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \left(0.5 \cdot x\right)\right)\right)\\
\end{array}
\end{array}
if eps < 2.3500000000000001e86Initial program 70.6%
Simplified70.6%
Taylor expanded in eps around inf
cancel-sign-sub-invN/A
metadata-evalN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
exp-lowering-exp.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f6498.9%
Simplified98.9%
Taylor expanded in eps around 0
exp-lowering-exp.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6473.5%
Simplified73.5%
sub0-negN/A
neg-lowering-neg.f6473.5%
Applied egg-rr73.5%
if 2.3500000000000001e86 < eps < 1.14999999999999999e128Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6453.5%
Simplified53.5%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
+-lowering-+.f6454.5%
Simplified54.5%
flip-+N/A
flip-+N/A
frac-timesN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
--lowering--.f6473.6%
Applied egg-rr73.6%
if 1.14999999999999999e128 < eps Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified89.0%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6489.0%
Simplified89.0%
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6491.2%
Applied egg-rr91.2%
Final simplification76.6%
(FPCore (x eps)
:precision binary64
(if (<= x 8.5e-10)
(+ 1.0 (* x (* eps (* eps (* 0.5 x)))))
(if (<= x 5.6e+102)
(* (* (* eps (* eps eps)) 0.08333333333333333) (* x (* x x)))
(* 0.5 (* x (* x (* eps eps)))))))
double code(double x, double eps) {
double tmp;
if (x <= 8.5e-10) {
tmp = 1.0 + (x * (eps * (eps * (0.5 * x))));
} else if (x <= 5.6e+102) {
tmp = ((eps * (eps * eps)) * 0.08333333333333333) * (x * (x * x));
} else {
tmp = 0.5 * (x * (x * (eps * eps)));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 8.5d-10) then
tmp = 1.0d0 + (x * (eps * (eps * (0.5d0 * x))))
else if (x <= 5.6d+102) then
tmp = ((eps * (eps * eps)) * 0.08333333333333333d0) * (x * (x * x))
else
tmp = 0.5d0 * (x * (x * (eps * eps)))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 8.5e-10) {
tmp = 1.0 + (x * (eps * (eps * (0.5 * x))));
} else if (x <= 5.6e+102) {
tmp = ((eps * (eps * eps)) * 0.08333333333333333) * (x * (x * x));
} else {
tmp = 0.5 * (x * (x * (eps * eps)));
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 8.5e-10: tmp = 1.0 + (x * (eps * (eps * (0.5 * x)))) elif x <= 5.6e+102: tmp = ((eps * (eps * eps)) * 0.08333333333333333) * (x * (x * x)) else: tmp = 0.5 * (x * (x * (eps * eps))) return tmp
function code(x, eps) tmp = 0.0 if (x <= 8.5e-10) tmp = Float64(1.0 + Float64(x * Float64(eps * Float64(eps * Float64(0.5 * x))))); elseif (x <= 5.6e+102) tmp = Float64(Float64(Float64(eps * Float64(eps * eps)) * 0.08333333333333333) * Float64(x * Float64(x * x))); else tmp = Float64(0.5 * Float64(x * Float64(x * Float64(eps * eps)))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 8.5e-10) tmp = 1.0 + (x * (eps * (eps * (0.5 * x)))); elseif (x <= 5.6e+102) tmp = ((eps * (eps * eps)) * 0.08333333333333333) * (x * (x * x)); else tmp = 0.5 * (x * (x * (eps * eps))); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 8.5e-10], N[(1.0 + N[(x * N[(eps * N[(eps * N[(0.5 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.6e+102], N[(N[(N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * 0.08333333333333333), $MachinePrecision] * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[(x * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.5 \cdot 10^{-10}:\\
\;\;\;\;1 + x \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \left(0.5 \cdot x\right)\right)\right)\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;\left(\left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot 0.08333333333333333\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)\\
\end{array}
\end{array}
if x < 8.4999999999999996e-10Initial program 66.8%
Simplified66.8%
Taylor expanded in x around 0
Simplified84.9%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6484.9%
Simplified84.9%
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6484.9%
Applied egg-rr84.9%
if 8.4999999999999996e-10 < x < 5.60000000000000037e102Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
associate--l+N/A
+-lowering-+.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
Simplified17.9%
Taylor expanded in eps around inf
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6450.8%
Simplified50.8%
if 5.60000000000000037e102 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified51.8%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6451.5%
Simplified51.5%
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6451.5%
Applied egg-rr51.5%
Taylor expanded in x around inf
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6473.0%
Simplified73.0%
Final simplification79.2%
(FPCore (x eps) :precision binary64 (let* ((t_0 (* 0.5 (* x (* x (* eps eps)))))) (if (<= x -2.4e-34) t_0 (if (<= x 1.25e-22) 1.0 t_0))))
double code(double x, double eps) {
double t_0 = 0.5 * (x * (x * (eps * eps)));
double tmp;
if (x <= -2.4e-34) {
tmp = t_0;
} else if (x <= 1.25e-22) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (x * (x * (eps * eps)))
if (x <= (-2.4d-34)) then
tmp = t_0
else if (x <= 1.25d-22) then
tmp = 1.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = 0.5 * (x * (x * (eps * eps)));
double tmp;
if (x <= -2.4e-34) {
tmp = t_0;
} else if (x <= 1.25e-22) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, eps): t_0 = 0.5 * (x * (x * (eps * eps))) tmp = 0 if x <= -2.4e-34: tmp = t_0 elif x <= 1.25e-22: tmp = 1.0 else: tmp = t_0 return tmp
function code(x, eps) t_0 = Float64(0.5 * Float64(x * Float64(x * Float64(eps * eps)))) tmp = 0.0 if (x <= -2.4e-34) tmp = t_0; elseif (x <= 1.25e-22) tmp = 1.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, eps) t_0 = 0.5 * (x * (x * (eps * eps))); tmp = 0.0; if (x <= -2.4e-34) tmp = t_0; elseif (x <= 1.25e-22) tmp = 1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(0.5 * N[(x * N[(x * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.4e-34], t$95$0, If[LessEqual[x, 1.25e-22], 1.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(x \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)\\
\mathbf{if}\;x \leq -2.4 \cdot 10^{-34}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-22}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.39999999999999991e-34 or 1.24999999999999988e-22 < x Initial program 97.6%
Simplified97.6%
Taylor expanded in x around 0
Simplified57.8%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6457.7%
Simplified57.7%
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6457.7%
Applied egg-rr57.7%
Taylor expanded in x around inf
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6469.6%
Simplified69.6%
if -2.39999999999999991e-34 < x < 1.24999999999999988e-22Initial program 57.8%
Simplified57.8%
Taylor expanded in x around 0
Simplified75.1%
Final simplification72.4%
(FPCore (x eps) :precision binary64 (if (<= x 4.8e-8) (+ 1.0 (* x (* eps (* eps (* 0.5 x))))) (* 0.5 (* x (* x (* eps eps))))))
double code(double x, double eps) {
double tmp;
if (x <= 4.8e-8) {
tmp = 1.0 + (x * (eps * (eps * (0.5 * x))));
} else {
tmp = 0.5 * (x * (x * (eps * eps)));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 4.8d-8) then
tmp = 1.0d0 + (x * (eps * (eps * (0.5d0 * x))))
else
tmp = 0.5d0 * (x * (x * (eps * eps)))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 4.8e-8) {
tmp = 1.0 + (x * (eps * (eps * (0.5 * x))));
} else {
tmp = 0.5 * (x * (x * (eps * eps)));
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 4.8e-8: tmp = 1.0 + (x * (eps * (eps * (0.5 * x)))) else: tmp = 0.5 * (x * (x * (eps * eps))) return tmp
function code(x, eps) tmp = 0.0 if (x <= 4.8e-8) tmp = Float64(1.0 + Float64(x * Float64(eps * Float64(eps * Float64(0.5 * x))))); else tmp = Float64(0.5 * Float64(x * Float64(x * Float64(eps * eps)))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 4.8e-8) tmp = 1.0 + (x * (eps * (eps * (0.5 * x)))); else tmp = 0.5 * (x * (x * (eps * eps))); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 4.8e-8], N[(1.0 + N[(x * N[(eps * N[(eps * N[(0.5 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[(x * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.8 \cdot 10^{-8}:\\
\;\;\;\;1 + x \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \left(0.5 \cdot x\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)\\
\end{array}
\end{array}
if x < 4.79999999999999997e-8Initial program 67.0%
Simplified67.0%
Taylor expanded in x around 0
Simplified84.4%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6484.4%
Simplified84.4%
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6484.4%
Applied egg-rr84.4%
if 4.79999999999999997e-8 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified46.2%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6446.1%
Simplified46.1%
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6446.0%
Applied egg-rr46.0%
Taylor expanded in x around inf
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6467.5%
Simplified67.5%
Final simplification79.4%
(FPCore (x eps) :precision binary64 (let* ((t_0 (* x (* eps eps)))) (if (<= x 0.0012) (+ 1.0 (* x (* 0.5 t_0))) (* 0.5 (* x t_0)))))
double code(double x, double eps) {
double t_0 = x * (eps * eps);
double tmp;
if (x <= 0.0012) {
tmp = 1.0 + (x * (0.5 * t_0));
} else {
tmp = 0.5 * (x * t_0);
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = x * (eps * eps)
if (x <= 0.0012d0) then
tmp = 1.0d0 + (x * (0.5d0 * t_0))
else
tmp = 0.5d0 * (x * t_0)
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = x * (eps * eps);
double tmp;
if (x <= 0.0012) {
tmp = 1.0 + (x * (0.5 * t_0));
} else {
tmp = 0.5 * (x * t_0);
}
return tmp;
}
def code(x, eps): t_0 = x * (eps * eps) tmp = 0 if x <= 0.0012: tmp = 1.0 + (x * (0.5 * t_0)) else: tmp = 0.5 * (x * t_0) return tmp
function code(x, eps) t_0 = Float64(x * Float64(eps * eps)) tmp = 0.0 if (x <= 0.0012) tmp = Float64(1.0 + Float64(x * Float64(0.5 * t_0))); else tmp = Float64(0.5 * Float64(x * t_0)); end return tmp end
function tmp_2 = code(x, eps) t_0 = x * (eps * eps); tmp = 0.0; if (x <= 0.0012) tmp = 1.0 + (x * (0.5 * t_0)); else tmp = 0.5 * (x * t_0); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(x * N[(eps * eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 0.0012], N[(1.0 + N[(x * N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(\varepsilon \cdot \varepsilon\right)\\
\mathbf{if}\;x \leq 0.0012:\\
\;\;\;\;1 + x \cdot \left(0.5 \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot t\_0\right)\\
\end{array}
\end{array}
if x < 0.00119999999999999989Initial program 67.1%
Simplified67.1%
Taylor expanded in x around 0
Simplified84.0%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6484.0%
Simplified84.0%
if 0.00119999999999999989 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified46.8%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6446.6%
Simplified46.6%
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6446.6%
Applied egg-rr46.6%
Taylor expanded in x around inf
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6468.4%
Simplified68.4%
Final simplification79.3%
(FPCore (x eps) :precision binary64 (if (<= x 4.8e-8) (+ 1.0 (* eps (* eps (* 0.5 (* x x))))) (* 0.5 (* x (* x (* eps eps))))))
double code(double x, double eps) {
double tmp;
if (x <= 4.8e-8) {
tmp = 1.0 + (eps * (eps * (0.5 * (x * x))));
} else {
tmp = 0.5 * (x * (x * (eps * eps)));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 4.8d-8) then
tmp = 1.0d0 + (eps * (eps * (0.5d0 * (x * x))))
else
tmp = 0.5d0 * (x * (x * (eps * eps)))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 4.8e-8) {
tmp = 1.0 + (eps * (eps * (0.5 * (x * x))));
} else {
tmp = 0.5 * (x * (x * (eps * eps)));
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 4.8e-8: tmp = 1.0 + (eps * (eps * (0.5 * (x * x)))) else: tmp = 0.5 * (x * (x * (eps * eps))) return tmp
function code(x, eps) tmp = 0.0 if (x <= 4.8e-8) tmp = Float64(1.0 + Float64(eps * Float64(eps * Float64(0.5 * Float64(x * x))))); else tmp = Float64(0.5 * Float64(x * Float64(x * Float64(eps * eps)))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 4.8e-8) tmp = 1.0 + (eps * (eps * (0.5 * (x * x)))); else tmp = 0.5 * (x * (x * (eps * eps))); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 4.8e-8], N[(1.0 + N[(eps * N[(eps * N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[(x * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.8 \cdot 10^{-8}:\\
\;\;\;\;1 + \varepsilon \cdot \left(\varepsilon \cdot \left(0.5 \cdot \left(x \cdot x\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)\\
\end{array}
\end{array}
if x < 4.79999999999999997e-8Initial program 67.0%
Simplified67.0%
Taylor expanded in x around 0
Simplified84.4%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6484.4%
Simplified84.4%
Taylor expanded in x around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
+-lowering-+.f64N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6478.2%
Simplified78.2%
if 4.79999999999999997e-8 < x Initial program 100.0%
Simplified100.0%
Taylor expanded in x around 0
Simplified46.2%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6446.1%
Simplified46.1%
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6446.0%
Applied egg-rr46.0%
Taylor expanded in x around inf
*-lowering-*.f64N/A
unpow2N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6467.5%
Simplified67.5%
Final simplification75.0%
(FPCore (x eps) :precision binary64 (if (<= x -1.52e-21) (* eps (* x -0.5)) 1.0))
double code(double x, double eps) {
double tmp;
if (x <= -1.52e-21) {
tmp = eps * (x * -0.5);
} else {
tmp = 1.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.52d-21)) then
tmp = eps * (x * (-0.5d0))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -1.52e-21) {
tmp = eps * (x * -0.5);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -1.52e-21: tmp = eps * (x * -0.5) else: tmp = 1.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -1.52e-21) tmp = Float64(eps * Float64(x * -0.5)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -1.52e-21) tmp = eps * (x * -0.5); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -1.52e-21], N[(eps * N[(x * -0.5), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.52 \cdot 10^{-21}:\\
\;\;\;\;\varepsilon \cdot \left(x \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.52000000000000009e-21Initial program 94.9%
Simplified94.9%
Taylor expanded in x around 0
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6455.2%
Simplified55.2%
Taylor expanded in x around 0
+-lowering-+.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6427.4%
Simplified27.4%
Taylor expanded in eps around inf
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6427.4%
Simplified27.4%
if -1.52000000000000009e-21 < x Initial program 73.7%
Simplified73.7%
Taylor expanded in x around 0
Simplified48.1%
(FPCore (x eps) :precision binary64 (+ 1.0 (* eps (* x -0.5))))
double code(double x, double eps) {
return 1.0 + (eps * (x * -0.5));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 1.0d0 + (eps * (x * (-0.5d0)))
end function
public static double code(double x, double eps) {
return 1.0 + (eps * (x * -0.5));
}
def code(x, eps): return 1.0 + (eps * (x * -0.5))
function code(x, eps) return Float64(1.0 + Float64(eps * Float64(x * -0.5))) end
function tmp = code(x, eps) tmp = 1.0 + (eps * (x * -0.5)); end
code[x_, eps_] := N[(1.0 + N[(eps * N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \varepsilon \cdot \left(x \cdot -0.5\right)
\end{array}
Initial program 76.9%
Simplified76.9%
Taylor expanded in x around 0
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6440.5%
Simplified40.5%
Taylor expanded in x around 0
+-lowering-+.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
associate-*r/N/A
metadata-evalN/A
/-lowering-/.f6436.5%
Simplified36.5%
Taylor expanded in eps around inf
+-commutativeN/A
distribute-lft-inN/A
rgt-mult-inverseN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6449.3%
Simplified49.3%
(FPCore (x eps) :precision binary64 1.0)
double code(double x, double eps) {
return 1.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 1.0d0
end function
public static double code(double x, double eps) {
return 1.0;
}
def code(x, eps): return 1.0
function code(x, eps) return 1.0 end
function tmp = code(x, eps) tmp = 1.0; end
code[x_, eps_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 76.9%
Simplified76.9%
Taylor expanded in x around 0
Simplified41.2%
herbie shell --seed 2024163
(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))