
(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 15 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 (exp (* x (- -1.0 eps)))))
(if (<=
(+
(* (+ 1.0 (/ 1.0 eps)) (exp (* x (+ eps -1.0))))
(* t_0 (+ 1.0 (/ -1.0 eps))))
0.0)
(* 0.5 (* (exp (- x)) (+ x (+ x 2.0))))
(* 0.5 (+ t_0 (exp (* x eps)))))))
double code(double x, double eps) {
double t_0 = exp((x * (-1.0 - eps)));
double tmp;
if ((((1.0 + (1.0 / eps)) * exp((x * (eps + -1.0)))) + (t_0 * (1.0 + (-1.0 / eps)))) <= 0.0) {
tmp = 0.5 * (exp(-x) * (x + (x + 2.0)));
} else {
tmp = 0.5 * (t_0 + exp((x * eps)));
}
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 = exp((x * ((-1.0d0) - eps)))
if ((((1.0d0 + (1.0d0 / eps)) * exp((x * (eps + (-1.0d0))))) + (t_0 * (1.0d0 + ((-1.0d0) / eps)))) <= 0.0d0) then
tmp = 0.5d0 * (exp(-x) * (x + (x + 2.0d0)))
else
tmp = 0.5d0 * (t_0 + exp((x * eps)))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.exp((x * (-1.0 - eps)));
double tmp;
if ((((1.0 + (1.0 / eps)) * Math.exp((x * (eps + -1.0)))) + (t_0 * (1.0 + (-1.0 / eps)))) <= 0.0) {
tmp = 0.5 * (Math.exp(-x) * (x + (x + 2.0)));
} else {
tmp = 0.5 * (t_0 + Math.exp((x * eps)));
}
return tmp;
}
def code(x, eps): t_0 = math.exp((x * (-1.0 - eps))) tmp = 0 if (((1.0 + (1.0 / eps)) * math.exp((x * (eps + -1.0)))) + (t_0 * (1.0 + (-1.0 / eps)))) <= 0.0: tmp = 0.5 * (math.exp(-x) * (x + (x + 2.0))) else: tmp = 0.5 * (t_0 + math.exp((x * eps))) return tmp
function code(x, eps) t_0 = exp(Float64(x * Float64(-1.0 - eps))) tmp = 0.0 if (Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(x * Float64(eps + -1.0)))) + Float64(t_0 * Float64(1.0 + Float64(-1.0 / eps)))) <= 0.0) tmp = Float64(0.5 * Float64(exp(Float64(-x)) * Float64(x + Float64(x + 2.0)))); else tmp = Float64(0.5 * Float64(t_0 + exp(Float64(x * eps)))); end return tmp end
function tmp_2 = code(x, eps) t_0 = exp((x * (-1.0 - eps))); tmp = 0.0; if ((((1.0 + (1.0 / eps)) * exp((x * (eps + -1.0)))) + (t_0 * (1.0 + (-1.0 / eps)))) <= 0.0) tmp = 0.5 * (exp(-x) * (x + (x + 2.0))); else tmp = 0.5 * (t_0 + exp((x * eps))); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[(1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(0.5 * N[(N[Exp[(-x)], $MachinePrecision] * N[(x + N[(x + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(t$95$0 + N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{x \cdot \left(-1 - \varepsilon\right)}\\
\mathbf{if}\;\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{x \cdot \left(\varepsilon + -1\right)} + t\_0 \cdot \left(1 + \frac{-1}{\varepsilon}\right) \leq 0:\\
\;\;\;\;0.5 \cdot \left(e^{-x} \cdot \left(x + \left(x + 2\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(t\_0 + e^{x \cdot \varepsilon}\right)\\
\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))))) < 0.0Initial program 31.6%
Taylor expanded in eps around 0
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
*-commutativeN/A
distribute-rgt1-inN/A
distribute-rgt-out--N/A
distribute-lft-outN/A
lower-*.f64N/A
Applied rewrites99.9%
if 0.0 < (-.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 100.0%
Taylor expanded in eps around inf
lower-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites100.0%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
Final simplification100.0%
(FPCore (x eps)
:precision binary64
(if (<=
(+
(* (+ 1.0 (/ 1.0 eps)) (exp (* x (+ eps -1.0))))
(* (exp (* x (- -1.0 eps))) (+ 1.0 (/ -1.0 eps))))
2.0)
(* 0.5 (* (exp (- x)) (+ x (+ x 2.0))))
(fma (* (* eps (- (* eps (* x eps)) x)) (* 0.5 x)) (/ 1.0 eps) 1.0)))
double code(double x, double eps) {
double tmp;
if ((((1.0 + (1.0 / eps)) * exp((x * (eps + -1.0)))) + (exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) <= 2.0) {
tmp = 0.5 * (exp(-x) * (x + (x + 2.0)));
} else {
tmp = fma(((eps * ((eps * (x * eps)) - x)) * (0.5 * x)), (1.0 / eps), 1.0);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (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)))) <= 2.0) tmp = Float64(0.5 * Float64(exp(Float64(-x)) * Float64(x + Float64(x + 2.0)))); else tmp = fma(Float64(Float64(eps * Float64(Float64(eps * Float64(x * eps)) - x)) * Float64(0.5 * x)), Float64(1.0 / eps), 1.0); end return tmp end
code[x_, eps_] := If[LessEqual[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], 2.0], N[(0.5 * N[(N[Exp[(-x)], $MachinePrecision] * N[(x + N[(x + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(eps * N[(N[(eps * N[(x * eps), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] * N[(0.5 * x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\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) \leq 2:\\
\;\;\;\;0.5 \cdot \left(e^{-x} \cdot \left(x + \left(x + 2\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\varepsilon \cdot \left(\varepsilon \cdot \left(x \cdot \varepsilon\right) - x\right)\right) \cdot \left(0.5 \cdot x\right), \frac{1}{\varepsilon}, 1\right)\\
\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))))) < 2Initial program 50.5%
Taylor expanded in eps around 0
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
*-commutativeN/A
distribute-rgt1-inN/A
distribute-rgt-out--N/A
distribute-lft-outN/A
lower-*.f64N/A
Applied rewrites100.0%
if 2 < (-.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 100.0%
Taylor expanded in x around 0
Applied rewrites86.9%
Taylor expanded in eps around 0
lower-/.f64N/A
Applied rewrites91.0%
lift-*.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
+-lft-identityN/A
div-invN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites92.6%
Final simplification96.7%
(FPCore (x eps)
:precision binary64
(if (<=
(+
(* (+ 1.0 (/ 1.0 eps)) (exp (* x (+ eps -1.0))))
(* (exp (* x (- -1.0 eps))) (+ 1.0 (/ -1.0 eps))))
2.0)
(exp (- x))
(fma (* (* eps (- (* eps (* x eps)) x)) (* 0.5 x)) (/ 1.0 eps) 1.0)))
double code(double x, double eps) {
double tmp;
if ((((1.0 + (1.0 / eps)) * exp((x * (eps + -1.0)))) + (exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) <= 2.0) {
tmp = exp(-x);
} else {
tmp = fma(((eps * ((eps * (x * eps)) - x)) * (0.5 * x)), (1.0 / eps), 1.0);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (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)))) <= 2.0) tmp = exp(Float64(-x)); else tmp = fma(Float64(Float64(eps * Float64(Float64(eps * Float64(x * eps)) - x)) * Float64(0.5 * x)), Float64(1.0 / eps), 1.0); end return tmp end
code[x_, eps_] := If[LessEqual[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], 2.0], N[Exp[(-x)], $MachinePrecision], N[(N[(N[(eps * N[(N[(eps * N[(x * eps), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] * N[(0.5 * x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\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) \leq 2:\\
\;\;\;\;e^{-x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\varepsilon \cdot \left(\varepsilon \cdot \left(x \cdot \varepsilon\right) - x\right)\right) \cdot \left(0.5 \cdot x\right), \frac{1}{\varepsilon}, 1\right)\\
\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))))) < 2Initial program 50.5%
Taylor expanded in eps around inf
lower-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites97.9%
Taylor expanded in eps around 0
distribute-rgt-inN/A
neg-mul-1N/A
distribute-lft-outN/A
metadata-evalN/A
lower-*.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6497.9
Applied rewrites97.9%
if 2 < (-.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 100.0%
Taylor expanded in x around 0
Applied rewrites86.9%
Taylor expanded in eps around 0
lower-/.f64N/A
Applied rewrites91.0%
lift-*.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
+-lft-identityN/A
div-invN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites92.6%
Final simplification95.5%
(FPCore (x eps)
:precision binary64
(if (<=
(+
(* (+ 1.0 (/ 1.0 eps)) (exp (* x (+ eps -1.0))))
(* (exp (* x (- -1.0 eps))) (+ 1.0 (/ -1.0 eps))))
4.0)
(fma (* x x) (fma x 0.3333333333333333 -0.5) 1.0)
(* 0.5 (* x (* x (* eps eps))))))
double code(double x, double eps) {
double tmp;
if ((((1.0 + (1.0 / eps)) * exp((x * (eps + -1.0)))) + (exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) <= 4.0) {
tmp = fma((x * x), fma(x, 0.3333333333333333, -0.5), 1.0);
} else {
tmp = 0.5 * (x * (x * (eps * eps)));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (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)))) <= 4.0) tmp = fma(Float64(x * x), fma(x, 0.3333333333333333, -0.5), 1.0); else tmp = Float64(0.5 * Float64(x * Float64(x * Float64(eps * eps)))); end return tmp end
code[x_, eps_] := If[LessEqual[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], 4.0], N[(N[(x * x), $MachinePrecision] * N[(x * 0.3333333333333333 + -0.5), $MachinePrecision] + 1.0), $MachinePrecision], N[(0.5 * N[(x * N[(x * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\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) \leq 4:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, 0.3333333333333333, -0.5\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)\\
\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 51.5%
Taylor expanded in eps around 0
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
*-commutativeN/A
distribute-rgt1-inN/A
distribute-rgt-out--N/A
distribute-lft-outN/A
lower-*.f64N/A
Applied rewrites98.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6477.6
Applied rewrites77.6%
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 100.0%
Taylor expanded in x around 0
Applied rewrites87.4%
Taylor expanded in eps around 0
lower-/.f64N/A
Applied rewrites91.6%
Taylor expanded in eps around inf
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.4
Applied rewrites87.4%
Final simplification81.9%
(FPCore (x eps) :precision binary64 (* 0.5 (+ (/ 1.0 (exp (fma x (- eps) x))) (exp (* x (- -1.0 eps))))))
double code(double x, double eps) {
return 0.5 * ((1.0 / exp(fma(x, -eps, x))) + exp((x * (-1.0 - eps))));
}
function code(x, eps) return Float64(0.5 * Float64(Float64(1.0 / exp(fma(x, Float64(-eps), x))) + exp(Float64(x * Float64(-1.0 - eps))))) end
code[x_, eps_] := N[(0.5 * N[(N[(1.0 / N[Exp[N[(x * (-eps) + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(\frac{1}{e^{\mathsf{fma}\left(x, -\varepsilon, x\right)}} + e^{x \cdot \left(-1 - \varepsilon\right)}\right)
\end{array}
Initial program 72.7%
Taylor expanded in eps around inf
lower-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites98.8%
Applied rewrites98.8%
(FPCore (x eps) :precision binary64 (* 0.5 (+ (exp (fma x eps (- x))) (exp (* x (- -1.0 eps))))))
double code(double x, double eps) {
return 0.5 * (exp(fma(x, eps, -x)) + exp((x * (-1.0 - eps))));
}
function code(x, eps) return Float64(0.5 * Float64(exp(fma(x, eps, Float64(-x))) + exp(Float64(x * Float64(-1.0 - eps))))) end
code[x_, eps_] := N[(0.5 * N[(N[Exp[N[(x * eps + (-x)), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(e^{\mathsf{fma}\left(x, \varepsilon, -x\right)} + e^{x \cdot \left(-1 - \varepsilon\right)}\right)
\end{array}
Initial program 72.7%
Taylor expanded in eps around inf
lower-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites98.8%
(FPCore (x eps) :precision binary64 (if (<= x 9.5e-5) (fma (* (* eps (- (* eps (* x eps)) x)) (* 0.5 x)) (/ 1.0 eps) 1.0) (/ (* (* 0.5 x) (* x (* eps (* eps eps)))) eps)))
double code(double x, double eps) {
double tmp;
if (x <= 9.5e-5) {
tmp = fma(((eps * ((eps * (x * eps)) - x)) * (0.5 * x)), (1.0 / eps), 1.0);
} else {
tmp = ((0.5 * x) * (x * (eps * (eps * eps)))) / eps;
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= 9.5e-5) tmp = fma(Float64(Float64(eps * Float64(Float64(eps * Float64(x * eps)) - x)) * Float64(0.5 * x)), Float64(1.0 / eps), 1.0); else tmp = Float64(Float64(Float64(0.5 * x) * Float64(x * Float64(eps * Float64(eps * eps)))) / eps); end return tmp end
code[x_, eps_] := If[LessEqual[x, 9.5e-5], N[(N[(N[(eps * N[(N[(eps * N[(x * eps), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] * N[(0.5 * x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(N[(0.5 * x), $MachinePrecision] * N[(x * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.5 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(\left(\varepsilon \cdot \left(\varepsilon \cdot \left(x \cdot \varepsilon\right) - x\right)\right) \cdot \left(0.5 \cdot x\right), \frac{1}{\varepsilon}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(0.5 \cdot x\right) \cdot \left(x \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)}{\varepsilon}\\
\end{array}
\end{array}
if x < 9.5000000000000005e-5Initial program 62.7%
Taylor expanded in x around 0
Applied rewrites92.0%
Taylor expanded in eps around 0
lower-/.f64N/A
Applied rewrites96.6%
lift-*.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
+-lft-identityN/A
div-invN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites97.1%
if 9.5000000000000005e-5 < x Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites46.4%
Taylor expanded in eps around 0
lower-/.f64N/A
Applied rewrites47.9%
Taylor expanded in eps around inf
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6472.2
Applied rewrites72.2%
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
pow2N/A
metadata-evalN/A
pow-prod-upN/A
cube-unmultN/A
lift-*.f64N/A
lift-*.f64N/A
inv-powN/A
div-invN/A
associate-*r*N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites81.9%
Final simplification93.0%
(FPCore (x eps) :precision binary64 (if (<= x 9.5e-5) (fma (* 0.5 x) (* x (* eps eps)) 1.0) (/ (* (* 0.5 x) (* x (* eps (* eps eps)))) eps)))
double code(double x, double eps) {
double tmp;
if (x <= 9.5e-5) {
tmp = fma((0.5 * x), (x * (eps * eps)), 1.0);
} else {
tmp = ((0.5 * x) * (x * (eps * (eps * eps)))) / eps;
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= 9.5e-5) tmp = fma(Float64(0.5 * x), Float64(x * Float64(eps * eps)), 1.0); else tmp = Float64(Float64(Float64(0.5 * x) * Float64(x * Float64(eps * Float64(eps * eps)))) / eps); end return tmp end
code[x_, eps_] := If[LessEqual[x, 9.5e-5], N[(N[(0.5 * x), $MachinePrecision] * N[(x * N[(eps * eps), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(N[(0.5 * x), $MachinePrecision] * N[(x * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.5 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(0.5 \cdot x, x \cdot \left(\varepsilon \cdot \varepsilon\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(0.5 \cdot x\right) \cdot \left(x \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)}{\varepsilon}\\
\end{array}
\end{array}
if x < 9.5000000000000005e-5Initial program 62.7%
Taylor expanded in x around 0
Applied rewrites92.0%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6492.2
Applied rewrites92.2%
if 9.5000000000000005e-5 < x Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites46.4%
Taylor expanded in eps around 0
lower-/.f64N/A
Applied rewrites47.9%
Taylor expanded in eps around inf
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6472.2
Applied rewrites72.2%
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
pow2N/A
metadata-evalN/A
pow-prod-upN/A
cube-unmultN/A
lift-*.f64N/A
lift-*.f64N/A
inv-powN/A
div-invN/A
associate-*r*N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites81.9%
Final simplification89.4%
(FPCore (x eps) :precision binary64 (if (<= x 1.6) (fma x (fma x (fma x -0.16666666666666666 0.5) -1.0) 1.0) (if (<= x 1.05e+96) 0.0 (fma (* x x) (fma x 0.3333333333333333 -0.5) 1.0))))
double code(double x, double eps) {
double tmp;
if (x <= 1.6) {
tmp = fma(x, fma(x, fma(x, -0.16666666666666666, 0.5), -1.0), 1.0);
} else if (x <= 1.05e+96) {
tmp = 0.0;
} else {
tmp = fma((x * x), fma(x, 0.3333333333333333, -0.5), 1.0);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= 1.6) tmp = fma(x, fma(x, fma(x, -0.16666666666666666, 0.5), -1.0), 1.0); elseif (x <= 1.05e+96) tmp = 0.0; else tmp = fma(Float64(x * x), fma(x, 0.3333333333333333, -0.5), 1.0); end return tmp end
code[x_, eps_] := If[LessEqual[x, 1.6], N[(x * N[(x * N[(x * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 1.05e+96], 0.0, N[(N[(x * x), $MachinePrecision] * N[(x * 0.3333333333333333 + -0.5), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.6:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, -0.16666666666666666, 0.5\right), -1\right), 1\right)\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+96}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, 0.3333333333333333, -0.5\right), 1\right)\\
\end{array}
\end{array}
if x < 1.6000000000000001Initial program 62.9%
Taylor expanded in eps around inf
lower-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites98.4%
Taylor expanded in eps around 0
distribute-rgt-inN/A
neg-mul-1N/A
distribute-lft-outN/A
metadata-evalN/A
lower-*.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6477.5
Applied rewrites77.5%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6473.5
Applied rewrites73.5%
if 1.6000000000000001 < x < 1.0500000000000001e96Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites28.3%
Taylor expanded in eps around 0
associate-*r/N/A
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
mul0-rgtN/A
metadata-evalN/A
+-inversesN/A
div-subN/A
+-inverses52.6
Applied rewrites52.6%
if 1.0500000000000001e96 < x Initial program 100.0%
Taylor expanded in eps around 0
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
*-commutativeN/A
distribute-rgt1-inN/A
distribute-rgt-out--N/A
distribute-lft-outN/A
lower-*.f64N/A
Applied rewrites40.0%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6457.2
Applied rewrites57.2%
(FPCore (x eps) :precision binary64 (if (<= x 520.0) (fma x (fma x 0.5 -1.0) 1.0) (if (<= x 1.05e+96) 0.0 (fma (* x x) (fma x 0.3333333333333333 -0.5) 1.0))))
double code(double x, double eps) {
double tmp;
if (x <= 520.0) {
tmp = fma(x, fma(x, 0.5, -1.0), 1.0);
} else if (x <= 1.05e+96) {
tmp = 0.0;
} else {
tmp = fma((x * x), fma(x, 0.3333333333333333, -0.5), 1.0);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= 520.0) tmp = fma(x, fma(x, 0.5, -1.0), 1.0); elseif (x <= 1.05e+96) tmp = 0.0; else tmp = fma(Float64(x * x), fma(x, 0.3333333333333333, -0.5), 1.0); end return tmp end
code[x_, eps_] := If[LessEqual[x, 520.0], N[(x * N[(x * 0.5 + -1.0), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 1.05e+96], 0.0, N[(N[(x * x), $MachinePrecision] * N[(x * 0.3333333333333333 + -0.5), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 520:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.5, -1\right), 1\right)\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+96}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, 0.3333333333333333, -0.5\right), 1\right)\\
\end{array}
\end{array}
if x < 520Initial program 62.9%
Taylor expanded in eps around inf
lower-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites98.4%
Taylor expanded in eps around 0
distribute-rgt-inN/A
neg-mul-1N/A
distribute-lft-outN/A
metadata-evalN/A
lower-*.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6477.5
Applied rewrites77.5%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6471.5
Applied rewrites71.5%
if 520 < x < 1.0500000000000001e96Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites28.3%
Taylor expanded in eps around 0
associate-*r/N/A
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
mul0-rgtN/A
metadata-evalN/A
+-inversesN/A
div-subN/A
+-inverses52.6
Applied rewrites52.6%
if 1.0500000000000001e96 < x Initial program 100.0%
Taylor expanded in eps around 0
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
*-commutativeN/A
distribute-rgt1-inN/A
distribute-rgt-out--N/A
distribute-lft-outN/A
lower-*.f64N/A
Applied rewrites40.0%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6457.2
Applied rewrites57.2%
(FPCore (x eps) :precision binary64 (let* ((t_0 (* x (* eps eps)))) (if (<= x 9.5e-5) (fma (* 0.5 x) t_0 1.0) (* 0.5 (* x t_0)))))
double code(double x, double eps) {
double t_0 = x * (eps * eps);
double tmp;
if (x <= 9.5e-5) {
tmp = fma((0.5 * x), t_0, 1.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 <= 9.5e-5) tmp = fma(Float64(0.5 * x), t_0, 1.0); else tmp = Float64(0.5 * Float64(x * t_0)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(x * N[(eps * eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 9.5e-5], N[(N[(0.5 * x), $MachinePrecision] * t$95$0 + 1.0), $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 9.5 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(0.5 \cdot x, t\_0, 1\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot t\_0\right)\\
\end{array}
\end{array}
if x < 9.5000000000000005e-5Initial program 62.7%
Taylor expanded in x around 0
Applied rewrites92.0%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6492.2
Applied rewrites92.2%
if 9.5000000000000005e-5 < x Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites46.4%
Taylor expanded in eps around 0
lower-/.f64N/A
Applied rewrites47.9%
Taylor expanded in eps around inf
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6472.2
Applied rewrites72.2%
(FPCore (x eps) :precision binary64 (let* ((t_0 (fma x (fma x 0.5 -1.0) 1.0))) (if (<= x 520.0) t_0 (if (<= x 5e+154) 0.0 t_0))))
double code(double x, double eps) {
double t_0 = fma(x, fma(x, 0.5, -1.0), 1.0);
double tmp;
if (x <= 520.0) {
tmp = t_0;
} else if (x <= 5e+154) {
tmp = 0.0;
} else {
tmp = t_0;
}
return tmp;
}
function code(x, eps) t_0 = fma(x, fma(x, 0.5, -1.0), 1.0) tmp = 0.0 if (x <= 520.0) tmp = t_0; elseif (x <= 5e+154) tmp = 0.0; else tmp = t_0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(x * N[(x * 0.5 + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, 520.0], t$95$0, If[LessEqual[x, 5e+154], 0.0, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.5, -1\right), 1\right)\\
\mathbf{if}\;x \leq 520:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+154}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < 520 or 5.00000000000000004e154 < x Initial program 67.8%
Taylor expanded in eps around inf
lower-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites98.6%
Taylor expanded in eps around 0
distribute-rgt-inN/A
neg-mul-1N/A
distribute-lft-outN/A
metadata-evalN/A
lower-*.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6472.8
Applied rewrites72.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6469.8
Applied rewrites69.8%
if 520 < x < 5.00000000000000004e154Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites37.9%
Taylor expanded in eps around 0
associate-*r/N/A
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
mul0-rgtN/A
metadata-evalN/A
+-inversesN/A
div-subN/A
+-inverses47.0
Applied rewrites47.0%
(FPCore (x eps) :precision binary64 (if (<= x 1.0) (- 1.0 x) 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 1.0) {
tmp = 1.0 - x;
} 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 = 1.0d0 - x
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 = 1.0 - x;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 1.0: tmp = 1.0 - x else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 1.0) tmp = Float64(1.0 - x); else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 1.0) tmp = 1.0 - x; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 1.0], N[(1.0 - x), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;1 - x\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 1Initial program 62.9%
Taylor expanded in eps around inf
lower-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f64N/A
Applied rewrites98.4%
Taylor expanded in eps around 0
distribute-rgt-inN/A
neg-mul-1N/A
distribute-lft-outN/A
metadata-evalN/A
lower-*.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6477.5
Applied rewrites77.5%
Taylor expanded in x around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6460.0
Applied rewrites60.0%
if 1 < x Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites47.0%
Taylor expanded in eps around 0
associate-*r/N/A
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
mul0-rgtN/A
metadata-evalN/A
+-inversesN/A
div-subN/A
+-inverses45.0
Applied rewrites45.0%
(FPCore (x eps) :precision binary64 (if (<= x 520.0) 1.0 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 520.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 <= 520.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 <= 520.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 520.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 520.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 520.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 520.0], 1.0, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 520:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 520Initial program 62.9%
Taylor expanded in x around 0
Applied rewrites59.9%
if 520 < x Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites47.0%
Taylor expanded in eps around 0
associate-*r/N/A
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
mul0-rgtN/A
metadata-evalN/A
+-inversesN/A
div-subN/A
+-inverses45.0
Applied rewrites45.0%
(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.7%
Taylor expanded in x around 0
Applied rewrites79.7%
Taylor expanded in eps around 0
associate-*r/N/A
distribute-rgt-outN/A
metadata-evalN/A
mul0-rgtN/A
mul0-rgtN/A
metadata-evalN/A
+-inversesN/A
div-subN/A
+-inverses13.8
Applied rewrites13.8%
herbie shell --seed 2024216
(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))