
(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 16 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
(if (<=
(+
(* (+ 1.0 (/ 1.0 eps)) (exp (* x (+ eps -1.0))))
(* (exp (* x (- -1.0 eps))) (+ 1.0 (/ -1.0 eps))))
0.0)
(* 0.5 (* (exp (- x)) (fma x 2.0 2.0)))
(* 0.5 (* 2.0 (cosh (* x 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)))) <= 0.0) {
tmp = 0.5 * (exp(-x) * fma(x, 2.0, 2.0));
} else {
tmp = 0.5 * (2.0 * cosh((x * 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)))) <= 0.0) tmp = Float64(0.5 * Float64(exp(Float64(-x)) * fma(x, 2.0, 2.0))); else tmp = Float64(0.5 * Float64(2.0 * cosh(Float64(x * 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], 0.0], N[(0.5 * N[(N[Exp[(-x)], $MachinePrecision] * N[(x * 2.0 + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(2.0 * N[Cosh[N[(x * 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 0:\\
\;\;\;\;0.5 \cdot \left(e^{-x} \cdot \mathsf{fma}\left(x, 2, 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(2 \cdot \cosh \left(x \cdot \varepsilon\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))))) < 0.0Initial program 39.7%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
distribute-rgt1-inN/A
distribute-rgt-out--N/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
neg-lowering-neg.f64N/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64100.0
Simplified100.0%
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
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified99.8%
Taylor expanded in eps around inf
*-commutativeN/A
*-lowering-*.f6499.8
Simplified99.8%
Taylor expanded in eps around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f64100.0
Simplified100.0%
*-commutativeN/A
*-lowering-*.f64N/A
distribute-rgt-neg-outN/A
cosh-undefN/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f64N/A
*-lowering-*.f64100.0
Applied egg-rr100.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))))
0.0)
(* 0.5 (* (exp (- x)) (+ x (+ x 2.0))))
(* 0.5 (* 2.0 (cosh (* x 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)))) <= 0.0) {
tmp = 0.5 * (exp(-x) * (x + (x + 2.0)));
} else {
tmp = 0.5 * (2.0 * cosh((x * eps)));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((((1.0d0 + (1.0d0 / eps)) * exp((x * (eps + (-1.0d0))))) + (exp((x * ((-1.0d0) - eps))) * (1.0d0 + ((-1.0d0) / eps)))) <= 0.0d0) then
tmp = 0.5d0 * (exp(-x) * (x + (x + 2.0d0)))
else
tmp = 0.5d0 * (2.0d0 * cosh((x * eps)))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((((1.0 + (1.0 / eps)) * Math.exp((x * (eps + -1.0)))) + (Math.exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) <= 0.0) {
tmp = 0.5 * (Math.exp(-x) * (x + (x + 2.0)));
} else {
tmp = 0.5 * (2.0 * Math.cosh((x * eps)));
}
return tmp;
}
def code(x, eps): tmp = 0 if (((1.0 + (1.0 / eps)) * math.exp((x * (eps + -1.0)))) + (math.exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) <= 0.0: tmp = 0.5 * (math.exp(-x) * (x + (x + 2.0))) else: tmp = 0.5 * (2.0 * math.cosh((x * 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)))) <= 0.0) tmp = Float64(0.5 * Float64(exp(Float64(-x)) * Float64(x + Float64(x + 2.0)))); else tmp = Float64(0.5 * Float64(2.0 * cosh(Float64(x * eps)))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((((1.0 + (1.0 / eps)) * exp((x * (eps + -1.0)))) + (exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) <= 0.0) tmp = 0.5 * (exp(-x) * (x + (x + 2.0))); else tmp = 0.5 * (2.0 * cosh((x * eps))); end tmp_2 = 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], 0.0], N[(0.5 * N[(N[Exp[(-x)], $MachinePrecision] * N[(x + N[(x + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(2.0 * N[Cosh[N[(x * 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 0:\\
\;\;\;\;0.5 \cdot \left(e^{-x} \cdot \left(x + \left(x + 2\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(2 \cdot \cosh \left(x \cdot \varepsilon\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))))) < 0.0Initial program 39.7%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
distribute-rgt1-inN/A
distribute-rgt-out--N/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
neg-lowering-neg.f64N/A
+-lowering-+.f64N/A
Simplified100.0%
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
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified99.8%
Taylor expanded in eps around inf
*-commutativeN/A
*-lowering-*.f6499.8
Simplified99.8%
Taylor expanded in eps around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f64100.0
Simplified100.0%
*-commutativeN/A
*-lowering-*.f64N/A
distribute-rgt-neg-outN/A
cosh-undefN/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f64N/A
*-lowering-*.f64100.0
Applied egg-rr100.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))))
0.0)
(exp (- x))
(* 0.5 (* 2.0 (cosh (* x 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)))) <= 0.0) {
tmp = exp(-x);
} else {
tmp = 0.5 * (2.0 * cosh((x * eps)));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((((1.0d0 + (1.0d0 / eps)) * exp((x * (eps + (-1.0d0))))) + (exp((x * ((-1.0d0) - eps))) * (1.0d0 + ((-1.0d0) / eps)))) <= 0.0d0) then
tmp = exp(-x)
else
tmp = 0.5d0 * (2.0d0 * cosh((x * eps)))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((((1.0 + (1.0 / eps)) * Math.exp((x * (eps + -1.0)))) + (Math.exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) <= 0.0) {
tmp = Math.exp(-x);
} else {
tmp = 0.5 * (2.0 * Math.cosh((x * eps)));
}
return tmp;
}
def code(x, eps): tmp = 0 if (((1.0 + (1.0 / eps)) * math.exp((x * (eps + -1.0)))) + (math.exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) <= 0.0: tmp = math.exp(-x) else: tmp = 0.5 * (2.0 * math.cosh((x * 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)))) <= 0.0) tmp = exp(Float64(-x)); else tmp = Float64(0.5 * Float64(2.0 * cosh(Float64(x * eps)))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((((1.0 + (1.0 / eps)) * exp((x * (eps + -1.0)))) + (exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) <= 0.0) tmp = exp(-x); else tmp = 0.5 * (2.0 * cosh((x * eps))); end tmp_2 = 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], 0.0], N[Exp[(-x)], $MachinePrecision], N[(0.5 * N[(2.0 * N[Cosh[N[(x * 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 0:\\
\;\;\;\;e^{-x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(2 \cdot \cosh \left(x \cdot \varepsilon\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))))) < 0.0Initial program 39.7%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified96.5%
Taylor expanded in eps around 0
distribute-rgt-inN/A
neg-mul-1N/A
distribute-lft-outN/A
metadata-evalN/A
*-lowering-*.f64N/A
neg-mul-1N/A
exp-lowering-exp.f64N/A
neg-mul-1N/A
neg-lowering-neg.f6496.5
Simplified96.5%
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
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified99.8%
Taylor expanded in eps around inf
*-commutativeN/A
*-lowering-*.f6499.8
Simplified99.8%
Taylor expanded in eps around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f64100.0
Simplified100.0%
*-commutativeN/A
*-lowering-*.f64N/A
distribute-rgt-neg-outN/A
cosh-undefN/A
*-lowering-*.f64N/A
cosh-lowering-cosh.f64N/A
*-lowering-*.f64100.0
Applied egg-rr100.0%
Final simplification98.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))))
4.0)
(exp (- x))
(* x (* x (/ (fma eps (fma eps (fma eps 0.25 0.25) -0.25) -0.25) 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 = exp(-x);
} else {
tmp = x * (x * (fma(eps, fma(eps, fma(eps, 0.25, 0.25), -0.25), -0.25) / 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 = exp(Float64(-x)); else tmp = Float64(x * Float64(x * Float64(fma(eps, fma(eps, fma(eps, 0.25, 0.25), -0.25), -0.25) / 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[Exp[(-x)], $MachinePrecision], N[(x * N[(x * N[(N[(eps * N[(eps * N[(eps * 0.25 + 0.25), $MachinePrecision] + -0.25), $MachinePrecision] + -0.25), $MachinePrecision] / eps), $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:\\
\;\;\;\;e^{-x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{\mathsf{fma}\left(\varepsilon, \mathsf{fma}\left(\varepsilon, \mathsf{fma}\left(\varepsilon, 0.25, 0.25\right), -0.25\right), -0.25\right)}{\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))))) < 4Initial program 58.1%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified97.3%
Taylor expanded in eps around 0
distribute-rgt-inN/A
neg-mul-1N/A
distribute-lft-outN/A
metadata-evalN/A
*-lowering-*.f64N/A
neg-mul-1N/A
exp-lowering-exp.f64N/A
neg-mul-1N/A
neg-lowering-neg.f6496.5
Simplified96.5%
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
+-commutativeN/A
associate-+r+N/A
*-commutativeN/A
associate-*r*N/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
distribute-rgt-neg-inN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
Simplified42.7%
Taylor expanded in x around 0
Simplified71.8%
Taylor expanded in eps around 0
/-lowering-/.f64N/A
Simplified86.8%
Taylor expanded in x around -inf
Simplified87.7%
Final simplification92.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.25 (* 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.25 * (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.25 * 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.25 * 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.25 \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 58.1%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
distribute-rgt1-inN/A
distribute-rgt-out--N/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
neg-lowering-neg.f64N/A
+-lowering-+.f64N/A
Simplified99.1%
Taylor expanded in x around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f6472.0
Simplified72.0%
if 4 < (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
associate-+r+N/A
*-commutativeN/A
associate-*r*N/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
distribute-rgt-neg-inN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
Simplified42.7%
Taylor expanded in x around 0
Simplified71.8%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6481.9
Simplified81.9%
Final simplification76.4%
(FPCore (x eps) :precision binary64 (* 0.5 (+ (exp (- (* x eps) x)) (exp (* x (- -1.0 eps))))))
double code(double x, double eps) {
return 0.5 * (exp(((x * eps) - x)) + 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) - x)) + exp((x * ((-1.0d0) - eps))))
end function
public static double code(double x, double eps) {
return 0.5 * (Math.exp(((x * eps) - x)) + Math.exp((x * (-1.0 - eps))));
}
def code(x, eps): return 0.5 * (math.exp(((x * eps) - x)) + math.exp((x * (-1.0 - eps))))
function code(x, eps) return Float64(0.5 * Float64(exp(Float64(Float64(x * eps) - x)) + exp(Float64(x * Float64(-1.0 - eps))))) end
function tmp = code(x, eps) tmp = 0.5 * (exp(((x * eps) - x)) + exp((x * (-1.0 - eps)))); end
code[x_, eps_] := N[(0.5 * N[(N[Exp[N[(N[(x * eps), $MachinePrecision] - x), $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 \varepsilon - x} + e^{x \cdot \left(-1 - \varepsilon\right)}\right)
\end{array}
Initial program 76.9%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified98.5%
(FPCore (x eps)
:precision binary64
(if (<= x -6.8e-257)
(fma
x
(fma
x
(*
(* (+ eps 1.0) (+ eps 1.0))
(fma (* x -0.08333333333333333) (+ eps 1.0) 0.25))
(fma eps -0.5 -0.5))
1.0)
(if (<= x 8.8e-187)
(fma 0.5 (* eps (* x (* x eps))) 1.0)
(if (<= x 720.0)
(fma
x
(fma
x
(fma
eps
(* eps 0.25)
(* (* x (* eps (* eps eps))) 0.08333333333333333))
(* 0.5 eps))
1.0)
(* 0.25 (* x (* x (* eps eps))))))))
double code(double x, double eps) {
double tmp;
if (x <= -6.8e-257) {
tmp = fma(x, fma(x, (((eps + 1.0) * (eps + 1.0)) * fma((x * -0.08333333333333333), (eps + 1.0), 0.25)), fma(eps, -0.5, -0.5)), 1.0);
} else if (x <= 8.8e-187) {
tmp = fma(0.5, (eps * (x * (x * eps))), 1.0);
} else if (x <= 720.0) {
tmp = fma(x, fma(x, fma(eps, (eps * 0.25), ((x * (eps * (eps * eps))) * 0.08333333333333333)), (0.5 * eps)), 1.0);
} else {
tmp = 0.25 * (x * (x * (eps * eps)));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -6.8e-257) tmp = fma(x, fma(x, Float64(Float64(Float64(eps + 1.0) * Float64(eps + 1.0)) * fma(Float64(x * -0.08333333333333333), Float64(eps + 1.0), 0.25)), fma(eps, -0.5, -0.5)), 1.0); elseif (x <= 8.8e-187) tmp = fma(0.5, Float64(eps * Float64(x * Float64(x * eps))), 1.0); elseif (x <= 720.0) tmp = fma(x, fma(x, fma(eps, Float64(eps * 0.25), Float64(Float64(x * Float64(eps * Float64(eps * eps))) * 0.08333333333333333)), Float64(0.5 * eps)), 1.0); else tmp = Float64(0.25 * Float64(x * Float64(x * Float64(eps * eps)))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -6.8e-257], N[(x * N[(x * N[(N[(N[(eps + 1.0), $MachinePrecision] * N[(eps + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(x * -0.08333333333333333), $MachinePrecision] * N[(eps + 1.0), $MachinePrecision] + 0.25), $MachinePrecision]), $MachinePrecision] + N[(eps * -0.5 + -0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 8.8e-187], N[(0.5 * N[(eps * N[(x * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 720.0], N[(x * N[(x * N[(eps * N[(eps * 0.25), $MachinePrecision] + N[(N[(x * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision] + N[(0.5 * eps), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(0.25 * N[(x * N[(x * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-257}:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, \left(\left(\varepsilon + 1\right) \cdot \left(\varepsilon + 1\right)\right) \cdot \mathsf{fma}\left(x \cdot -0.08333333333333333, \varepsilon + 1, 0.25\right), \mathsf{fma}\left(\varepsilon, -0.5, -0.5\right)\right), 1\right)\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{-187}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \varepsilon \cdot \left(x \cdot \left(x \cdot \varepsilon\right)\right), 1\right)\\
\mathbf{elif}\;x \leq 720:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(\varepsilon, \varepsilon \cdot 0.25, \left(x \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right) \cdot 0.08333333333333333\right), 0.5 \cdot \varepsilon\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(x \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)\\
\end{array}
\end{array}
if x < -6.7999999999999996e-257Initial program 74.1%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified96.6%
Taylor expanded in x around 0
Simplified63.2%
Taylor expanded in x around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified61.1%
if -6.7999999999999996e-257 < x < 8.80000000000000032e-187Initial program 54.0%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in eps around inf
*-commutativeN/A
*-lowering-*.f64100.0
Simplified100.0%
Taylor expanded in eps around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f64100.0
Simplified100.0%
Taylor expanded in x around 0
Simplified97.6%
if 8.80000000000000032e-187 < x < 720Initial program 60.0%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified98.2%
Taylor expanded in eps around inf
*-commutativeN/A
*-lowering-*.f6498.1
Simplified98.1%
Taylor expanded in x around 0
Simplified72.8%
Taylor expanded in x around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified65.8%
if 720 < x Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
associate-+r+N/A
*-commutativeN/A
associate-*r*N/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
distribute-rgt-neg-inN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
Simplified24.2%
Taylor expanded in x around 0
Simplified54.4%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6475.7
Simplified75.7%
Final simplification72.4%
(FPCore (x eps)
:precision binary64
(if (<= x -3.2e-262)
(fma
x
(fma
x
(*
(* (+ eps 1.0) (+ eps 1.0))
(fma (* x -0.08333333333333333) (+ eps 1.0) 0.25))
(fma eps -0.5 -0.5))
1.0)
(if (<= x 5.2e-187)
(fma 0.5 (* eps (* x (* x eps))) 1.0)
(if (<= x 800.0)
(fma x (/ (* eps (* x (* 0.25 (* eps eps)))) eps) 1.0)
(* 0.25 (* x (* x (* eps eps))))))))
double code(double x, double eps) {
double tmp;
if (x <= -3.2e-262) {
tmp = fma(x, fma(x, (((eps + 1.0) * (eps + 1.0)) * fma((x * -0.08333333333333333), (eps + 1.0), 0.25)), fma(eps, -0.5, -0.5)), 1.0);
} else if (x <= 5.2e-187) {
tmp = fma(0.5, (eps * (x * (x * eps))), 1.0);
} else if (x <= 800.0) {
tmp = fma(x, ((eps * (x * (0.25 * (eps * eps)))) / eps), 1.0);
} else {
tmp = 0.25 * (x * (x * (eps * eps)));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -3.2e-262) tmp = fma(x, fma(x, Float64(Float64(Float64(eps + 1.0) * Float64(eps + 1.0)) * fma(Float64(x * -0.08333333333333333), Float64(eps + 1.0), 0.25)), fma(eps, -0.5, -0.5)), 1.0); elseif (x <= 5.2e-187) tmp = fma(0.5, Float64(eps * Float64(x * Float64(x * eps))), 1.0); elseif (x <= 800.0) tmp = fma(x, Float64(Float64(eps * Float64(x * Float64(0.25 * Float64(eps * eps)))) / eps), 1.0); else tmp = Float64(0.25 * Float64(x * Float64(x * Float64(eps * eps)))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -3.2e-262], N[(x * N[(x * N[(N[(N[(eps + 1.0), $MachinePrecision] * N[(eps + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(x * -0.08333333333333333), $MachinePrecision] * N[(eps + 1.0), $MachinePrecision] + 0.25), $MachinePrecision]), $MachinePrecision] + N[(eps * -0.5 + -0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 5.2e-187], N[(0.5 * N[(eps * N[(x * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 800.0], N[(x * N[(N[(eps * N[(x * N[(0.25 * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision] + 1.0), $MachinePrecision], N[(0.25 * N[(x * N[(x * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-262}:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, \left(\left(\varepsilon + 1\right) \cdot \left(\varepsilon + 1\right)\right) \cdot \mathsf{fma}\left(x \cdot -0.08333333333333333, \varepsilon + 1, 0.25\right), \mathsf{fma}\left(\varepsilon, -0.5, -0.5\right)\right), 1\right)\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-187}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \varepsilon \cdot \left(x \cdot \left(x \cdot \varepsilon\right)\right), 1\right)\\
\mathbf{elif}\;x \leq 800:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{\varepsilon \cdot \left(x \cdot \left(0.25 \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)}{\varepsilon}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(x \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)\\
\end{array}
\end{array}
if x < -3.2e-262Initial program 74.1%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified96.6%
Taylor expanded in x around 0
Simplified63.2%
Taylor expanded in x around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified61.1%
if -3.2e-262 < x < 5.1999999999999999e-187Initial program 54.0%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in eps around inf
*-commutativeN/A
*-lowering-*.f64100.0
Simplified100.0%
Taylor expanded in eps around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f64100.0
Simplified100.0%
Taylor expanded in x around 0
Simplified97.6%
if 5.1999999999999999e-187 < x < 800Initial program 60.0%
Taylor expanded in x around 0
+-commutativeN/A
associate-+r+N/A
*-commutativeN/A
associate-*r*N/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
distribute-rgt-neg-inN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
Simplified39.1%
Taylor expanded in x around 0
Simplified61.0%
Taylor expanded in eps around 0
/-lowering-/.f64N/A
Simplified77.7%
Taylor expanded in eps around inf
*-commutativeN/A
associate-*r*N/A
cube-multN/A
unpow2N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6485.5
Simplified85.5%
if 800 < x Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
associate-+r+N/A
*-commutativeN/A
associate-*r*N/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
distribute-rgt-neg-inN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
Simplified24.2%
Taylor expanded in x around 0
Simplified54.4%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6475.7
Simplified75.7%
Final simplification76.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (fma x (/ (* eps (* x (* 0.25 (* eps eps)))) eps) 1.0)))
(if (<= x -2.05e-262)
t_0
(if (<= x 4.2e-187)
(fma 0.5 (* eps (* x (* x eps))) 1.0)
(if (<= x 1050.0) t_0 (* 0.25 (* x (* x (* eps eps)))))))))
double code(double x, double eps) {
double t_0 = fma(x, ((eps * (x * (0.25 * (eps * eps)))) / eps), 1.0);
double tmp;
if (x <= -2.05e-262) {
tmp = t_0;
} else if (x <= 4.2e-187) {
tmp = fma(0.5, (eps * (x * (x * eps))), 1.0);
} else if (x <= 1050.0) {
tmp = t_0;
} else {
tmp = 0.25 * (x * (x * (eps * eps)));
}
return tmp;
}
function code(x, eps) t_0 = fma(x, Float64(Float64(eps * Float64(x * Float64(0.25 * Float64(eps * eps)))) / eps), 1.0) tmp = 0.0 if (x <= -2.05e-262) tmp = t_0; elseif (x <= 4.2e-187) tmp = fma(0.5, Float64(eps * Float64(x * Float64(x * eps))), 1.0); elseif (x <= 1050.0) tmp = t_0; else tmp = Float64(0.25 * Float64(x * Float64(x * Float64(eps * eps)))); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(x * N[(N[(eps * N[(x * N[(0.25 * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -2.05e-262], t$95$0, If[LessEqual[x, 4.2e-187], N[(0.5 * N[(eps * N[(x * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 1050.0], t$95$0, N[(0.25 * N[(x * N[(x * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x, \frac{\varepsilon \cdot \left(x \cdot \left(0.25 \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)}{\varepsilon}, 1\right)\\
\mathbf{if}\;x \leq -2.05 \cdot 10^{-262}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-187}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \varepsilon \cdot \left(x \cdot \left(x \cdot \varepsilon\right)\right), 1\right)\\
\mathbf{elif}\;x \leq 1050:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(x \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)\\
\end{array}
\end{array}
if x < -2.05000000000000013e-262 or 4.19999999999999985e-187 < x < 1050Initial program 69.2%
Taylor expanded in x around 0
+-commutativeN/A
associate-+r+N/A
*-commutativeN/A
associate-*r*N/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
distribute-rgt-neg-inN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
Simplified39.2%
Taylor expanded in x around 0
Simplified64.3%
Taylor expanded in eps around 0
/-lowering-/.f64N/A
Simplified76.7%
Taylor expanded in eps around inf
*-commutativeN/A
associate-*r*N/A
cube-multN/A
unpow2N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6487.2
Simplified87.2%
if -2.05000000000000013e-262 < x < 4.19999999999999985e-187Initial program 54.0%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in eps around inf
*-commutativeN/A
*-lowering-*.f64100.0
Simplified100.0%
Taylor expanded in eps around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f64100.0
Simplified100.0%
Taylor expanded in x around 0
Simplified97.6%
if 1050 < x Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
associate-+r+N/A
*-commutativeN/A
associate-*r*N/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
distribute-rgt-neg-inN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
Simplified24.2%
Taylor expanded in x around 0
Simplified54.4%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6475.7
Simplified75.7%
Final simplification85.1%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (fma x (* x (* 0.25 (* eps eps))) 1.0)))
(if (<= x -2e-256)
t_0
(if (<= x 4.5e-187)
(fma 0.5 (* eps (* x (* x eps))) 1.0)
(if (<= x 240.0) t_0 (* 0.25 (* x (* x (* eps eps)))))))))
double code(double x, double eps) {
double t_0 = fma(x, (x * (0.25 * (eps * eps))), 1.0);
double tmp;
if (x <= -2e-256) {
tmp = t_0;
} else if (x <= 4.5e-187) {
tmp = fma(0.5, (eps * (x * (x * eps))), 1.0);
} else if (x <= 240.0) {
tmp = t_0;
} else {
tmp = 0.25 * (x * (x * (eps * eps)));
}
return tmp;
}
function code(x, eps) t_0 = fma(x, Float64(x * Float64(0.25 * Float64(eps * eps))), 1.0) tmp = 0.0 if (x <= -2e-256) tmp = t_0; elseif (x <= 4.5e-187) tmp = fma(0.5, Float64(eps * Float64(x * Float64(x * eps))), 1.0); elseif (x <= 240.0) tmp = t_0; else tmp = Float64(0.25 * Float64(x * Float64(x * Float64(eps * eps)))); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(x * N[(x * N[(0.25 * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -2e-256], t$95$0, If[LessEqual[x, 4.5e-187], N[(0.5 * N[(eps * N[(x * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 240.0], t$95$0, N[(0.25 * N[(x * N[(x * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x, x \cdot \left(0.25 \cdot \left(\varepsilon \cdot \varepsilon\right)\right), 1\right)\\
\mathbf{if}\;x \leq -2 \cdot 10^{-256}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-187}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \varepsilon \cdot \left(x \cdot \left(x \cdot \varepsilon\right)\right), 1\right)\\
\mathbf{elif}\;x \leq 240:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(x \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)\\
\end{array}
\end{array}
if x < -1.99999999999999995e-256 or 4.4999999999999998e-187 < x < 240Initial program 69.2%
Taylor expanded in x around 0
+-commutativeN/A
associate-+r+N/A
*-commutativeN/A
associate-*r*N/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
distribute-rgt-neg-inN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
Simplified39.2%
Taylor expanded in x around 0
Simplified64.3%
Taylor expanded in eps around inf
associate-*r*N/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-*r*N/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6482.9
Simplified82.9%
if -1.99999999999999995e-256 < x < 4.4999999999999998e-187Initial program 54.0%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in eps around inf
*-commutativeN/A
*-lowering-*.f64100.0
Simplified100.0%
Taylor expanded in eps around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f64100.0
Simplified100.0%
Taylor expanded in x around 0
Simplified97.6%
if 240 < x Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
associate-+r+N/A
*-commutativeN/A
associate-*r*N/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
distribute-rgt-neg-inN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
Simplified24.2%
Taylor expanded in x around 0
Simplified54.4%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6475.7
Simplified75.7%
Final simplification82.8%
(FPCore (x eps) :precision binary64 (if (<= x 220.0) (fma 0.5 (* eps (* x (* x eps))) 1.0) (* 0.25 (* x (* x (* eps eps))))))
double code(double x, double eps) {
double tmp;
if (x <= 220.0) {
tmp = fma(0.5, (eps * (x * (x * eps))), 1.0);
} else {
tmp = 0.25 * (x * (x * (eps * eps)));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= 220.0) tmp = fma(0.5, Float64(eps * Float64(x * Float64(x * eps))), 1.0); else tmp = Float64(0.25 * Float64(x * Float64(x * Float64(eps * eps)))); end return tmp end
code[x_, eps_] := If[LessEqual[x, 220.0], N[(0.5 * N[(eps * N[(x * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(0.25 * N[(x * N[(x * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 220:\\
\;\;\;\;\mathsf{fma}\left(0.5, \varepsilon \cdot \left(x \cdot \left(x \cdot \varepsilon\right)\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(x \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)\\
\end{array}
\end{array}
if x < 220Initial program 65.6%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified97.8%
Taylor expanded in eps around inf
*-commutativeN/A
*-lowering-*.f6497.8
Simplified97.8%
Taylor expanded in eps around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f6498.4
Simplified98.4%
Taylor expanded in x around 0
Simplified77.6%
if 220 < x Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
associate-+r+N/A
*-commutativeN/A
associate-*r*N/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
distribute-rgt-neg-inN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
Simplified24.2%
Taylor expanded in x around 0
Simplified54.4%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6475.7
Simplified75.7%
(FPCore (x eps) :precision binary64 (if (<= x -90.0) (fma (fma x eps x) -0.5 1.0) (fma (* x x) (fma x 0.3333333333333333 -0.5) 1.0)))
double code(double x, double eps) {
double tmp;
if (x <= -90.0) {
tmp = fma(fma(x, eps, x), -0.5, 1.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 <= -90.0) tmp = fma(fma(x, eps, x), -0.5, 1.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, -90.0], N[(N[(x * eps + x), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision], 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 -90:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x, \varepsilon, x\right), -0.5, 1\right)\\
\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 < -90Initial program 100.0%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in x around 0
Simplified41.2%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f6429.4
Simplified29.4%
if -90 < x Initial program 74.1%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
distribute-rgt1-inN/A
distribute-rgt-out--N/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
neg-lowering-neg.f64N/A
+-lowering-+.f64N/A
Simplified62.2%
Taylor expanded in x around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f6459.4
Simplified59.4%
(FPCore (x eps) :precision binary64 (if (<= x -1.75) (fma (fma x eps x) -0.5 1.0) (fma 0.5 (* x eps) 1.0)))
double code(double x, double eps) {
double tmp;
if (x <= -1.75) {
tmp = fma(fma(x, eps, x), -0.5, 1.0);
} else {
tmp = fma(0.5, (x * eps), 1.0);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -1.75) tmp = fma(fma(x, eps, x), -0.5, 1.0); else tmp = fma(0.5, Float64(x * eps), 1.0); end return tmp end
code[x_, eps_] := If[LessEqual[x, -1.75], N[(N[(x * eps + x), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision], N[(0.5 * N[(x * eps), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x, \varepsilon, x\right), -0.5, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.5, x \cdot \varepsilon, 1\right)\\
\end{array}
\end{array}
if x < -1.75Initial program 100.0%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified100.0%
Taylor expanded in x around 0
Simplified41.2%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f6429.4
Simplified29.4%
if -1.75 < x Initial program 74.1%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified98.4%
Taylor expanded in eps around inf
*-commutativeN/A
*-lowering-*.f6486.0
Simplified86.0%
Taylor expanded in x around 0
Simplified63.0%
Taylor expanded in x around 0
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6449.6
Simplified49.6%
(FPCore (x eps) :precision binary64 (if (<= x 4e-16) 1.0 (* 0.5 (* x eps))))
double code(double x, double eps) {
double tmp;
if (x <= 4e-16) {
tmp = 1.0;
} else {
tmp = 0.5 * (x * eps);
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= 4d-16) then
tmp = 1.0d0
else
tmp = 0.5d0 * (x * eps)
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= 4e-16) {
tmp = 1.0;
} else {
tmp = 0.5 * (x * eps);
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 4e-16: tmp = 1.0 else: tmp = 0.5 * (x * eps) return tmp
function code(x, eps) tmp = 0.0 if (x <= 4e-16) tmp = 1.0; else tmp = Float64(0.5 * Float64(x * eps)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 4e-16) tmp = 1.0; else tmp = 0.5 * (x * eps); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 4e-16], 1.0, N[(0.5 * N[(x * eps), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4 \cdot 10^{-16}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \varepsilon\right)\\
\end{array}
\end{array}
if x < 3.9999999999999999e-16Initial program 65.2%
Taylor expanded in x around 0
Simplified61.1%
if 3.9999999999999999e-16 < x Initial program 98.9%
Taylor expanded in x around 0
+-commutativeN/A
associate-+r+N/A
*-commutativeN/A
associate-*r*N/A
sub-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
distribute-rgt-neg-inN/A
distribute-rgt1-inN/A
*-lowering-*.f64N/A
Simplified25.2%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6415.8
Simplified15.8%
(FPCore (x eps) :precision binary64 (fma 0.5 (* x eps) 1.0))
double code(double x, double eps) {
return fma(0.5, (x * eps), 1.0);
}
function code(x, eps) return fma(0.5, Float64(x * eps), 1.0) end
code[x_, eps_] := N[(0.5 * N[(x * eps), $MachinePrecision] + 1.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(0.5, x \cdot \varepsilon, 1\right)
\end{array}
Initial program 76.9%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f64N/A
Simplified98.5%
Taylor expanded in eps around inf
*-commutativeN/A
*-lowering-*.f6487.5
Simplified87.5%
Taylor expanded in x around 0
Simplified62.9%
Taylor expanded in x around 0
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6446.7
Simplified46.7%
(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%
Taylor expanded in x around 0
Simplified41.0%
herbie shell --seed 2024199
(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))