
(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 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))
double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps): return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps) return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0) end
function tmp = code(x, eps) tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0; end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}
(FPCore (x eps)
:precision binary64
(let* ((t_0
(-
(* (+ (/ 1.0 eps) 1.0) (exp (* (- eps 1.0) x)))
(* (exp (* (- -1.0 eps) x)) (- (/ 1.0 eps) 1.0)))))
(if (<= t_0 5.0) (* (exp (- x)) (+ x 1.0)) (/ t_0 2.0))))
double code(double x, double eps) {
double t_0 = (((1.0 / eps) + 1.0) * exp(((eps - 1.0) * x))) - (exp(((-1.0 - eps) * x)) * ((1.0 / eps) - 1.0));
double tmp;
if (t_0 <= 5.0) {
tmp = exp(-x) * (x + 1.0);
} else {
tmp = t_0 / 2.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 = (((1.0d0 / eps) + 1.0d0) * exp(((eps - 1.0d0) * x))) - (exp((((-1.0d0) - eps) * x)) * ((1.0d0 / eps) - 1.0d0))
if (t_0 <= 5.0d0) then
tmp = exp(-x) * (x + 1.0d0)
else
tmp = t_0 / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = (((1.0 / eps) + 1.0) * Math.exp(((eps - 1.0) * x))) - (Math.exp(((-1.0 - eps) * x)) * ((1.0 / eps) - 1.0));
double tmp;
if (t_0 <= 5.0) {
tmp = Math.exp(-x) * (x + 1.0);
} else {
tmp = t_0 / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = (((1.0 / eps) + 1.0) * math.exp(((eps - 1.0) * x))) - (math.exp(((-1.0 - eps) * x)) * ((1.0 / eps) - 1.0)) tmp = 0 if t_0 <= 5.0: tmp = math.exp(-x) * (x + 1.0) else: tmp = t_0 / 2.0 return tmp
function code(x, eps) t_0 = Float64(Float64(Float64(Float64(1.0 / eps) + 1.0) * exp(Float64(Float64(eps - 1.0) * x))) - Float64(exp(Float64(Float64(-1.0 - eps) * x)) * Float64(Float64(1.0 / eps) - 1.0))) tmp = 0.0 if (t_0 <= 5.0) tmp = Float64(exp(Float64(-x)) * Float64(x + 1.0)); else tmp = Float64(t_0 / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = (((1.0 / eps) + 1.0) * exp(((eps - 1.0) * x))) - (exp(((-1.0 - eps) * x)) * ((1.0 / eps) - 1.0)); tmp = 0.0; if (t_0 <= 5.0) tmp = exp(-x) * (x + 1.0); else tmp = t_0 / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision] * N[Exp[N[(N[(eps - 1.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5.0], N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\frac{1}{\varepsilon} + 1\right) \cdot e^{\left(\varepsilon - 1\right) \cdot x} - e^{\left(-1 - \varepsilon\right) \cdot x} \cdot \left(\frac{1}{\varepsilon} - 1\right)\\
\mathbf{if}\;t\_0 \leq 5:\\
\;\;\;\;e^{-x} \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) < 5Initial program 53.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Applied rewrites100.0%
if 5 < (-.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%
Final simplification100.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (/ 1.0 eps) 1.0)) (t_1 (exp (* (- eps 1.0) x))))
(if (<=
(- (* (+ (/ 1.0 eps) 1.0) t_1) (* (exp (* (- -1.0 eps) x)) t_0))
5.0)
(* (exp (- x)) (+ x 1.0))
(/ (- (* 1.0 t_1) t_0) 2.0))))
double code(double x, double eps) {
double t_0 = (1.0 / eps) - 1.0;
double t_1 = exp(((eps - 1.0) * x));
double tmp;
if (((((1.0 / eps) + 1.0) * t_1) - (exp(((-1.0 - eps) * x)) * t_0)) <= 5.0) {
tmp = exp(-x) * (x + 1.0);
} else {
tmp = ((1.0 * t_1) - t_0) / 2.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) :: t_1
real(8) :: tmp
t_0 = (1.0d0 / eps) - 1.0d0
t_1 = exp(((eps - 1.0d0) * x))
if (((((1.0d0 / eps) + 1.0d0) * t_1) - (exp((((-1.0d0) - eps) * x)) * t_0)) <= 5.0d0) then
tmp = exp(-x) * (x + 1.0d0)
else
tmp = ((1.0d0 * t_1) - t_0) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = (1.0 / eps) - 1.0;
double t_1 = Math.exp(((eps - 1.0) * x));
double tmp;
if (((((1.0 / eps) + 1.0) * t_1) - (Math.exp(((-1.0 - eps) * x)) * t_0)) <= 5.0) {
tmp = Math.exp(-x) * (x + 1.0);
} else {
tmp = ((1.0 * t_1) - t_0) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = (1.0 / eps) - 1.0 t_1 = math.exp(((eps - 1.0) * x)) tmp = 0 if ((((1.0 / eps) + 1.0) * t_1) - (math.exp(((-1.0 - eps) * x)) * t_0)) <= 5.0: tmp = math.exp(-x) * (x + 1.0) else: tmp = ((1.0 * t_1) - t_0) / 2.0 return tmp
function code(x, eps) t_0 = Float64(Float64(1.0 / eps) - 1.0) t_1 = exp(Float64(Float64(eps - 1.0) * x)) tmp = 0.0 if (Float64(Float64(Float64(Float64(1.0 / eps) + 1.0) * t_1) - Float64(exp(Float64(Float64(-1.0 - eps) * x)) * t_0)) <= 5.0) tmp = Float64(exp(Float64(-x)) * Float64(x + 1.0)); else tmp = Float64(Float64(Float64(1.0 * t_1) - t_0) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = (1.0 / eps) - 1.0; t_1 = exp(((eps - 1.0) * x)); tmp = 0.0; if (((((1.0 / eps) + 1.0) * t_1) - (exp(((-1.0 - eps) * x)) * t_0)) <= 5.0) tmp = exp(-x) * (x + 1.0); else tmp = ((1.0 * t_1) - t_0) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[(eps - 1.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision] - N[(N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 5.0], N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 * t$95$1), $MachinePrecision] - t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\varepsilon} - 1\\
t_1 := e^{\left(\varepsilon - 1\right) \cdot x}\\
\mathbf{if}\;\left(\frac{1}{\varepsilon} + 1\right) \cdot t\_1 - e^{\left(-1 - \varepsilon\right) \cdot x} \cdot t\_0 \leq 5:\\
\;\;\;\;e^{-x} \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 \cdot t\_1 - t\_0}{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) < 5Initial program 53.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Applied rewrites100.0%
if 5 < (-.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
lower--.f64N/A
lower-/.f6460.5
Applied rewrites60.5%
Taylor expanded in eps around inf
Applied rewrites60.5%
Final simplification80.7%
(FPCore (x eps)
:precision binary64
(if (<=
(-
(* (+ (/ 1.0 eps) 1.0) (exp (* (- eps 1.0) x)))
(* (exp (* (- -1.0 eps) x)) (- (/ 1.0 eps) 1.0)))
0.0)
(/ -1.0 (* (- x 1.0) (fma (fma 0.5 x 1.0) x 1.0)))
(* 1.0 (fma (fma x 0.5 -1.0) x 1.0))))
double code(double x, double eps) {
double tmp;
if (((((1.0 / eps) + 1.0) * exp(((eps - 1.0) * x))) - (exp(((-1.0 - eps) * x)) * ((1.0 / eps) - 1.0))) <= 0.0) {
tmp = -1.0 / ((x - 1.0) * fma(fma(0.5, x, 1.0), x, 1.0));
} else {
tmp = 1.0 * fma(fma(x, 0.5, -1.0), x, 1.0);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (Float64(Float64(Float64(Float64(1.0 / eps) + 1.0) * exp(Float64(Float64(eps - 1.0) * x))) - Float64(exp(Float64(Float64(-1.0 - eps) * x)) * Float64(Float64(1.0 / eps) - 1.0))) <= 0.0) tmp = Float64(-1.0 / Float64(Float64(x - 1.0) * fma(fma(0.5, x, 1.0), x, 1.0))); else tmp = Float64(1.0 * fma(fma(x, 0.5, -1.0), x, 1.0)); end return tmp end
code[x_, eps_] := If[LessEqual[N[(N[(N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision] * N[Exp[N[(N[(eps - 1.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(-1.0 / N[(N[(x - 1.0), $MachinePrecision] * N[(N[(0.5 * x + 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 * N[(N[(x * 0.5 + -1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\frac{1}{\varepsilon} + 1\right) \cdot e^{\left(\varepsilon - 1\right) \cdot x} - e^{\left(-1 - \varepsilon\right) \cdot x} \cdot \left(\frac{1}{\varepsilon} - 1\right) \leq 0:\\
\;\;\;\;\frac{-1}{\left(x - 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.5, x, 1\right), x, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \mathsf{fma}\left(\mathsf{fma}\left(x, 0.5, -1\right), x, 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))))) < 0.0Initial program 38.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites83.4%
Applied rewrites64.6%
Taylor expanded in x around 0
Applied rewrites86.8%
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 99.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites22.6%
Applied rewrites22.6%
Taylor expanded in x around 0
Applied rewrites45.3%
Taylor expanded in x around 0
Applied rewrites47.8%
Final simplification62.6%
(FPCore (x eps)
:precision binary64
(if (<=
(-
(* (+ (/ 1.0 eps) 1.0) (exp (* (- eps 1.0) x)))
(* (exp (* (- -1.0 eps) x)) (- (/ 1.0 eps) 1.0)))
0.0)
(/ (+ x 1.0) (fma (fma 0.5 x 1.0) x 1.0))
(* 1.0 (fma (fma x 0.5 -1.0) x 1.0))))
double code(double x, double eps) {
double tmp;
if (((((1.0 / eps) + 1.0) * exp(((eps - 1.0) * x))) - (exp(((-1.0 - eps) * x)) * ((1.0 / eps) - 1.0))) <= 0.0) {
tmp = (x + 1.0) / fma(fma(0.5, x, 1.0), x, 1.0);
} else {
tmp = 1.0 * fma(fma(x, 0.5, -1.0), x, 1.0);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (Float64(Float64(Float64(Float64(1.0 / eps) + 1.0) * exp(Float64(Float64(eps - 1.0) * x))) - Float64(exp(Float64(Float64(-1.0 - eps) * x)) * Float64(Float64(1.0 / eps) - 1.0))) <= 0.0) tmp = Float64(Float64(x + 1.0) / fma(fma(0.5, x, 1.0), x, 1.0)); else tmp = Float64(1.0 * fma(fma(x, 0.5, -1.0), x, 1.0)); end return tmp end
code[x_, eps_] := If[LessEqual[N[(N[(N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision] * N[Exp[N[(N[(eps - 1.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(x + 1.0), $MachinePrecision] / N[(N[(0.5 * x + 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 * N[(N[(x * 0.5 + -1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\frac{1}{\varepsilon} + 1\right) \cdot e^{\left(\varepsilon - 1\right) \cdot x} - e^{\left(-1 - \varepsilon\right) \cdot x} \cdot \left(\frac{1}{\varepsilon} - 1\right) \leq 0:\\
\;\;\;\;\frac{x + 1}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, x, 1\right), x, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \mathsf{fma}\left(\mathsf{fma}\left(x, 0.5, -1\right), x, 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))))) < 0.0Initial program 38.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites83.4%
Applied rewrites83.4%
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 99.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites22.6%
Applied rewrites22.6%
Taylor expanded in x around 0
Applied rewrites45.3%
Taylor expanded in x around 0
Applied rewrites47.8%
Final simplification61.2%
(FPCore (x eps)
:precision binary64
(if (<= eps 1.0)
(* (exp (- x)) (+ x 1.0))
(if (<= eps 6e+25)
(* (fma (fma x 0.5 -1.0) x 1.0) (+ x 1.0))
(/ (- 1.0 (* (exp (* (- -1.0 eps) x)) (- (/ 1.0 eps) 1.0))) 2.0))))
double code(double x, double eps) {
double tmp;
if (eps <= 1.0) {
tmp = exp(-x) * (x + 1.0);
} else if (eps <= 6e+25) {
tmp = fma(fma(x, 0.5, -1.0), x, 1.0) * (x + 1.0);
} else {
tmp = (1.0 - (exp(((-1.0 - eps) * x)) * ((1.0 / eps) - 1.0))) / 2.0;
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (eps <= 1.0) tmp = Float64(exp(Float64(-x)) * Float64(x + 1.0)); elseif (eps <= 6e+25) tmp = Float64(fma(fma(x, 0.5, -1.0), x, 1.0) * Float64(x + 1.0)); else tmp = Float64(Float64(1.0 - Float64(exp(Float64(Float64(-1.0 - eps) * x)) * Float64(Float64(1.0 / eps) - 1.0))) / 2.0); end return tmp end
code[x_, eps_] := If[LessEqual[eps, 1.0], N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 6e+25], N[(N[(N[(x * 0.5 + -1.0), $MachinePrecision] * x + 1.0), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 1:\\
\;\;\;\;e^{-x} \cdot \left(x + 1\right)\\
\mathbf{elif}\;\varepsilon \leq 6 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x, 0.5, -1\right), x, 1\right) \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - e^{\left(-1 - \varepsilon\right) \cdot x} \cdot \left(\frac{1}{\varepsilon} - 1\right)}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 66.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites62.0%
Applied rewrites62.0%
if 1 < eps < 6.00000000000000011e25Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites23.3%
Applied rewrites23.3%
Taylor expanded in x around 0
Applied rewrites79.1%
if 6.00000000000000011e25 < eps Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
lower-/.f6453.8
Applied rewrites53.8%
Taylor expanded in eps around inf
Applied rewrites53.8%
Final simplification60.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= x -720.0)
(* 1.0 t_0)
(if (<= x -9.2e-229)
(fma
(* 0.5 x)
(fma (- eps 1.0) (/ 1.0 eps) (/ (- 1.0 (* eps eps)) eps))
1.0)
(if (<= x 9.5e+113)
(* t_0 (+ x 1.0))
(fma (fma 0.3333333333333333 x -0.5) (* x x) 1.0))))))
double code(double x, double eps) {
double t_0 = exp(-x);
double tmp;
if (x <= -720.0) {
tmp = 1.0 * t_0;
} else if (x <= -9.2e-229) {
tmp = fma((0.5 * x), fma((eps - 1.0), (1.0 / eps), ((1.0 - (eps * eps)) / eps)), 1.0);
} else if (x <= 9.5e+113) {
tmp = t_0 * (x + 1.0);
} else {
tmp = fma(fma(0.3333333333333333, x, -0.5), (x * x), 1.0);
}
return tmp;
}
function code(x, eps) t_0 = exp(Float64(-x)) tmp = 0.0 if (x <= -720.0) tmp = Float64(1.0 * t_0); elseif (x <= -9.2e-229) tmp = fma(Float64(0.5 * x), fma(Float64(eps - 1.0), Float64(1.0 / eps), Float64(Float64(1.0 - Float64(eps * eps)) / eps)), 1.0); elseif (x <= 9.5e+113) tmp = Float64(t_0 * Float64(x + 1.0)); else tmp = fma(fma(0.3333333333333333, x, -0.5), Float64(x * x), 1.0); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[x, -720.0], N[(1.0 * t$95$0), $MachinePrecision], If[LessEqual[x, -9.2e-229], N[(N[(0.5 * x), $MachinePrecision] * N[(N[(eps - 1.0), $MachinePrecision] * N[(1.0 / eps), $MachinePrecision] + N[(N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 9.5e+113], N[(t$95$0 * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;x \leq -720:\\
\;\;\;\;1 \cdot t\_0\\
\mathbf{elif}\;x \leq -9.2 \cdot 10^{-229}:\\
\;\;\;\;\mathsf{fma}\left(0.5 \cdot x, \mathsf{fma}\left(\varepsilon - 1, \frac{1}{\varepsilon}, \frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon}\right), 1\right)\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+113}:\\
\;\;\;\;t\_0 \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right), x \cdot x, 1\right)\\
\end{array}
\end{array}
if x < -720Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites0.0%
Applied rewrites0.0%
Taylor expanded in x around 0
Applied rewrites100.0%
if -720 < x < -9.19999999999999983e-229Initial program 48.0%
Taylor expanded in x around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites56.2%
Taylor expanded in eps around 0
Applied rewrites55.9%
Taylor expanded in eps around 0
Applied rewrites69.2%
if -9.19999999999999983e-229 < x < 9.5000000000000001e113Initial program 69.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.3%
Applied rewrites66.3%
if 9.5000000000000001e113 < x Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites45.3%
Taylor expanded in x around 0
Applied rewrites56.3%
Final simplification69.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* 1.0 (exp (- x)))))
(if (<= x -720.0)
t_0
(if (<= x -9.2e-229)
(fma
(* 0.5 x)
(fma (- eps 1.0) (/ 1.0 eps) (/ (- 1.0 (* eps eps)) eps))
1.0)
(if (<= x 9.5e+113)
t_0
(fma (fma 0.3333333333333333 x -0.5) (* x x) 1.0))))))
double code(double x, double eps) {
double t_0 = 1.0 * exp(-x);
double tmp;
if (x <= -720.0) {
tmp = t_0;
} else if (x <= -9.2e-229) {
tmp = fma((0.5 * x), fma((eps - 1.0), (1.0 / eps), ((1.0 - (eps * eps)) / eps)), 1.0);
} else if (x <= 9.5e+113) {
tmp = t_0;
} else {
tmp = fma(fma(0.3333333333333333, x, -0.5), (x * x), 1.0);
}
return tmp;
}
function code(x, eps) t_0 = Float64(1.0 * exp(Float64(-x))) tmp = 0.0 if (x <= -720.0) tmp = t_0; elseif (x <= -9.2e-229) tmp = fma(Float64(0.5 * x), fma(Float64(eps - 1.0), Float64(1.0 / eps), Float64(Float64(1.0 - Float64(eps * eps)) / eps)), 1.0); elseif (x <= 9.5e+113) tmp = t_0; else tmp = fma(fma(0.3333333333333333, x, -0.5), Float64(x * x), 1.0); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(1.0 * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -720.0], t$95$0, If[LessEqual[x, -9.2e-229], N[(N[(0.5 * x), $MachinePrecision] * N[(N[(eps - 1.0), $MachinePrecision] * N[(1.0 / eps), $MachinePrecision] + N[(N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 9.5e+113], t$95$0, N[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 \cdot e^{-x}\\
\mathbf{if}\;x \leq -720:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -9.2 \cdot 10^{-229}:\\
\;\;\;\;\mathsf{fma}\left(0.5 \cdot x, \mathsf{fma}\left(\varepsilon - 1, \frac{1}{\varepsilon}, \frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon}\right), 1\right)\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+113}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right), x \cdot x, 1\right)\\
\end{array}
\end{array}
if x < -720 or -9.19999999999999983e-229 < x < 9.5000000000000001e113Initial program 77.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites50.6%
Applied rewrites50.6%
Taylor expanded in x around 0
Applied rewrites73.5%
if -720 < x < -9.19999999999999983e-229Initial program 48.0%
Taylor expanded in x around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites56.2%
Taylor expanded in eps around 0
Applied rewrites55.9%
Taylor expanded in eps around 0
Applied rewrites69.2%
if 9.5000000000000001e113 < x Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites45.3%
Taylor expanded in x around 0
Applied rewrites56.3%
(FPCore (x eps)
:precision binary64
(if (<= x -2.5e+100)
(* (fma (fma (fma -0.16666666666666666 x 0.5) x -1.0) x 1.0) 1.0)
(if (<= x -9.2e-229)
(fma
(* 0.5 x)
(fma (- eps 1.0) (/ 1.0 eps) (/ (- 1.0 (* eps eps)) eps))
1.0)
(if (<= x 1.8)
(fma (fma (fma -0.125 x 0.3333333333333333) x -0.5) (* x x) 1.0)
(if (<= x 9.5e+113)
(/ (- (+ (/ 1.0 eps) 1.0) (- (/ 1.0 eps) 1.0)) 2.0)
(fma (fma 0.3333333333333333 x -0.5) (* x x) 1.0))))))
double code(double x, double eps) {
double tmp;
if (x <= -2.5e+100) {
tmp = fma(fma(fma(-0.16666666666666666, x, 0.5), x, -1.0), x, 1.0) * 1.0;
} else if (x <= -9.2e-229) {
tmp = fma((0.5 * x), fma((eps - 1.0), (1.0 / eps), ((1.0 - (eps * eps)) / eps)), 1.0);
} else if (x <= 1.8) {
tmp = fma(fma(fma(-0.125, x, 0.3333333333333333), x, -0.5), (x * x), 1.0);
} else if (x <= 9.5e+113) {
tmp = (((1.0 / eps) + 1.0) - ((1.0 / eps) - 1.0)) / 2.0;
} else {
tmp = fma(fma(0.3333333333333333, x, -0.5), (x * x), 1.0);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -2.5e+100) tmp = Float64(fma(fma(fma(-0.16666666666666666, x, 0.5), x, -1.0), x, 1.0) * 1.0); elseif (x <= -9.2e-229) tmp = fma(Float64(0.5 * x), fma(Float64(eps - 1.0), Float64(1.0 / eps), Float64(Float64(1.0 - Float64(eps * eps)) / eps)), 1.0); elseif (x <= 1.8) tmp = fma(fma(fma(-0.125, x, 0.3333333333333333), x, -0.5), Float64(x * x), 1.0); elseif (x <= 9.5e+113) tmp = Float64(Float64(Float64(Float64(1.0 / eps) + 1.0) - Float64(Float64(1.0 / eps) - 1.0)) / 2.0); else tmp = fma(fma(0.3333333333333333, x, -0.5), Float64(x * x), 1.0); end return tmp end
code[x_, eps_] := If[LessEqual[x, -2.5e+100], N[(N[(N[(N[(-0.16666666666666666 * x + 0.5), $MachinePrecision] * x + -1.0), $MachinePrecision] * x + 1.0), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[x, -9.2e-229], N[(N[(0.5 * x), $MachinePrecision] * N[(N[(eps - 1.0), $MachinePrecision] * N[(1.0 / eps), $MachinePrecision] + N[(N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 1.8], N[(N[(N[(-0.125 * x + 0.3333333333333333), $MachinePrecision] * x + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 9.5e+113], N[(N[(N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision] - N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{+100}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, x, 0.5\right), x, -1\right), x, 1\right) \cdot 1\\
\mathbf{elif}\;x \leq -9.2 \cdot 10^{-229}:\\
\;\;\;\;\mathsf{fma}\left(0.5 \cdot x, \mathsf{fma}\left(\varepsilon - 1, \frac{1}{\varepsilon}, \frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon}\right), 1\right)\\
\mathbf{elif}\;x \leq 1.8:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.125, x, 0.3333333333333333\right), x, -0.5\right), x \cdot x, 1\right)\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+113}:\\
\;\;\;\;\frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right), x \cdot x, 1\right)\\
\end{array}
\end{array}
if x < -2.4999999999999999e100Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites0.0%
Applied rewrites0.0%
Taylor expanded in x around 0
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites96.0%
if -2.4999999999999999e100 < x < -9.19999999999999983e-229Initial program 59.4%
Taylor expanded in x around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites44.6%
Taylor expanded in eps around 0
Applied rewrites44.2%
Taylor expanded in eps around 0
Applied rewrites60.4%
if -9.19999999999999983e-229 < x < 1.80000000000000004Initial program 58.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites78.1%
Taylor expanded in x around 0
Applied rewrites77.6%
if 1.80000000000000004 < x < 9.5000000000000001e113Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
lower-/.f6445.2
Applied rewrites45.2%
Taylor expanded in x around 0
lower--.f64N/A
lower-/.f6436.4
Applied rewrites36.4%
if 9.5000000000000001e113 < x Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites45.3%
Taylor expanded in x around 0
Applied rewrites56.3%
Final simplification65.2%
(FPCore (x eps) :precision binary64 (if (<= x -5800.0) (* (fma (fma (fma -0.16666666666666666 x 0.5) x -1.0) x 1.0) 1.0) (fma (fma 0.3333333333333333 x -0.5) (* x x) 1.0)))
double code(double x, double eps) {
double tmp;
if (x <= -5800.0) {
tmp = fma(fma(fma(-0.16666666666666666, x, 0.5), x, -1.0), x, 1.0) * 1.0;
} else {
tmp = fma(fma(0.3333333333333333, x, -0.5), (x * x), 1.0);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -5800.0) tmp = Float64(fma(fma(fma(-0.16666666666666666, x, 0.5), x, -1.0), x, 1.0) * 1.0); else tmp = fma(fma(0.3333333333333333, x, -0.5), Float64(x * x), 1.0); end return tmp end
code[x_, eps_] := If[LessEqual[x, -5800.0], N[(N[(N[(N[(-0.16666666666666666 * x + 0.5), $MachinePrecision] * x + -1.0), $MachinePrecision] * x + 1.0), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5800:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, x, 0.5\right), x, -1\right), x, 1\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right), x \cdot x, 1\right)\\
\end{array}
\end{array}
if x < -5800Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites0.0%
Applied rewrites0.0%
Taylor expanded in x around 0
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites60.6%
if -5800 < x Initial program 72.3%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites60.4%
Taylor expanded in x around 0
Applied rewrites57.7%
Final simplification58.1%
(FPCore (x eps) :precision binary64 (if (<= x -5800.0) (* 1.0 (fma (fma x 0.5 -1.0) x 1.0)) (fma (fma 0.3333333333333333 x -0.5) (* x x) 1.0)))
double code(double x, double eps) {
double tmp;
if (x <= -5800.0) {
tmp = 1.0 * fma(fma(x, 0.5, -1.0), x, 1.0);
} else {
tmp = fma(fma(0.3333333333333333, x, -0.5), (x * x), 1.0);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -5800.0) tmp = Float64(1.0 * fma(fma(x, 0.5, -1.0), x, 1.0)); else tmp = fma(fma(0.3333333333333333, x, -0.5), Float64(x * x), 1.0); end return tmp end
code[x_, eps_] := If[LessEqual[x, -5800.0], N[(1.0 * N[(N[(x * 0.5 + -1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5800:\\
\;\;\;\;1 \cdot \mathsf{fma}\left(\mathsf{fma}\left(x, 0.5, -1\right), x, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right), x \cdot x, 1\right)\\
\end{array}
\end{array}
if x < -5800Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites0.0%
Applied rewrites0.0%
Taylor expanded in x around 0
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites39.6%
if -5800 < x Initial program 72.3%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites60.4%
Taylor expanded in x around 0
Applied rewrites57.7%
(FPCore (x eps) :precision binary64 (fma (fma 0.3333333333333333 x -0.5) (* x x) 1.0))
double code(double x, double eps) {
return fma(fma(0.3333333333333333, x, -0.5), (x * x), 1.0);
}
function code(x, eps) return fma(fma(0.3333333333333333, x, -0.5), Float64(x * x), 1.0) end
code[x_, eps_] := N[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right), x \cdot x, 1\right)
\end{array}
Initial program 76.2%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites51.9%
Taylor expanded in x around 0
Applied rewrites49.6%
(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.2%
Taylor expanded in x around 0
Applied rewrites37.8%
herbie shell --seed 2024284
(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))