
(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 (- (pow eps -1.0) 1.0)) (t_1 (+ 1.0 (pow eps -1.0))))
(if (<=
(- (* t_1 (exp (* (+ -1.0 eps) x))) (* t_0 (exp (* (- -1.0 eps) x))))
1.9999999999999964)
(* (* 2.0 (/ (+ 1.0 x) (exp x))) 0.5)
(/
(- (* t_1 (exp (* (- eps 1.0) x))) (* t_0 (exp (- (fma x eps x)))))
2.0))))
double code(double x, double eps) {
double t_0 = pow(eps, -1.0) - 1.0;
double t_1 = 1.0 + pow(eps, -1.0);
double tmp;
if (((t_1 * exp(((-1.0 + eps) * x))) - (t_0 * exp(((-1.0 - eps) * x)))) <= 1.9999999999999964) {
tmp = (2.0 * ((1.0 + x) / exp(x))) * 0.5;
} else {
tmp = ((t_1 * exp(((eps - 1.0) * x))) - (t_0 * exp(-fma(x, eps, x)))) / 2.0;
}
return tmp;
}
function code(x, eps) t_0 = Float64((eps ^ -1.0) - 1.0) t_1 = Float64(1.0 + (eps ^ -1.0)) tmp = 0.0 if (Float64(Float64(t_1 * exp(Float64(Float64(-1.0 + eps) * x))) - Float64(t_0 * exp(Float64(Float64(-1.0 - eps) * x)))) <= 1.9999999999999964) tmp = Float64(Float64(2.0 * Float64(Float64(1.0 + x) / exp(x))) * 0.5); else tmp = Float64(Float64(Float64(t_1 * exp(Float64(Float64(eps - 1.0) * x))) - Float64(t_0 * exp(Float64(-fma(x, eps, x))))) / 2.0); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[eps, -1.0], $MachinePrecision] - 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[Power[eps, -1.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 * N[Exp[N[(N[(-1.0 + eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.9999999999999964], N[(N[(2.0 * N[(N[(1.0 + x), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(t$95$1 * N[Exp[N[(N[(eps - 1.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * N[Exp[(-N[(x * eps + x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\varepsilon}^{-1} - 1\\
t_1 := 1 + {\varepsilon}^{-1}\\
\mathbf{if}\;t\_1 \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - t\_0 \cdot e^{\left(-1 - \varepsilon\right) \cdot x} \leq 1.9999999999999964:\\
\;\;\;\;\left(2 \cdot \frac{1 + x}{e^{x}}\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1 \cdot e^{\left(\varepsilon - 1\right) \cdot x} - t\_0 \cdot e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}}{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) < 1.9999999999999964Initial program 27.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
if 1.9999999999999964 < (-.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%
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
neg-mul-1N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
metadata-evalN/A
div-invN/A
metadata-evalN/A
frac-2negN/A
/-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
sub-negN/A
lower--.f64100.0
Applied rewrites100.0%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
*-lft-identityN/A
lower-fma.f64100.0
Applied rewrites100.0%
Final simplification100.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow eps -1.0) 1.0)) (t_1 (+ (pow eps -1.0) 1.0)))
(if (<=
(-
(* (+ 1.0 (pow eps -1.0)) (exp (* (+ -1.0 eps) x)))
(* t_0 (exp (* (- -1.0 eps) x))))
4.0)
(* (* 2.0 (/ (+ 1.0 x) (exp x))) 0.5)
(/
(-
(fma (* t_1 (fma (* 0.5 x) (pow (- eps 1.0) 2.0) (- eps 1.0))) x t_1)
t_0)
2.0))))
double code(double x, double eps) {
double t_0 = pow(eps, -1.0) - 1.0;
double t_1 = pow(eps, -1.0) + 1.0;
double tmp;
if ((((1.0 + pow(eps, -1.0)) * exp(((-1.0 + eps) * x))) - (t_0 * exp(((-1.0 - eps) * x)))) <= 4.0) {
tmp = (2.0 * ((1.0 + x) / exp(x))) * 0.5;
} else {
tmp = (fma((t_1 * fma((0.5 * x), pow((eps - 1.0), 2.0), (eps - 1.0))), x, t_1) - t_0) / 2.0;
}
return tmp;
}
function code(x, eps) t_0 = Float64((eps ^ -1.0) - 1.0) t_1 = Float64((eps ^ -1.0) + 1.0) tmp = 0.0 if (Float64(Float64(Float64(1.0 + (eps ^ -1.0)) * exp(Float64(Float64(-1.0 + eps) * x))) - Float64(t_0 * exp(Float64(Float64(-1.0 - eps) * x)))) <= 4.0) tmp = Float64(Float64(2.0 * Float64(Float64(1.0 + x) / exp(x))) * 0.5); else tmp = Float64(Float64(fma(Float64(t_1 * fma(Float64(0.5 * x), (Float64(eps - 1.0) ^ 2.0), Float64(eps - 1.0))), x, t_1) - t_0) / 2.0); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[eps, -1.0], $MachinePrecision] - 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[eps, -1.0], $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[N[(N[(N[(1.0 + N[Power[eps, -1.0], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(-1.0 + eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4.0], N[(N[(2.0 * N[(N[(1.0 + x), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(N[(t$95$1 * N[(N[(0.5 * x), $MachinePrecision] * N[Power[N[(eps - 1.0), $MachinePrecision], 2.0], $MachinePrecision] + N[(eps - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x + t$95$1), $MachinePrecision] - t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\varepsilon}^{-1} - 1\\
t_1 := {\varepsilon}^{-1} + 1\\
\mathbf{if}\;\left(1 + {\varepsilon}^{-1}\right) \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - t\_0 \cdot e^{\left(-1 - \varepsilon\right) \cdot x} \leq 4:\\
\;\;\;\;\left(2 \cdot \frac{1 + x}{e^{x}}\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_1 \cdot \mathsf{fma}\left(0.5 \cdot x, {\left(\varepsilon - 1\right)}^{2}, \varepsilon - 1\right), x, t\_1\right) - t\_0}{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) < 4Initial program 48.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.3%
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
lower--.f64N/A
lower-/.f6454.9
Applied rewrites54.9%
Taylor expanded in x around 0
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
lower-fma.f64N/A
Applied rewrites87.8%
Final simplification94.1%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ 1.0 (pow eps -1.0))))
(if (<=
(-
(* t_0 (exp (* (+ -1.0 eps) x)))
(* (- (pow eps -1.0) 1.0) (exp (* (- -1.0 eps) x))))
2.000000002)
(* (* 2.0 (/ (+ 1.0 x) (exp x))) 0.5)
(/ (- (* t_0 (exp (* x eps))) (* -1.0 (exp (- (fma x eps x))))) 2.0))))
double code(double x, double eps) {
double t_0 = 1.0 + pow(eps, -1.0);
double tmp;
if (((t_0 * exp(((-1.0 + eps) * x))) - ((pow(eps, -1.0) - 1.0) * exp(((-1.0 - eps) * x)))) <= 2.000000002) {
tmp = (2.0 * ((1.0 + x) / exp(x))) * 0.5;
} else {
tmp = ((t_0 * exp((x * eps))) - (-1.0 * exp(-fma(x, eps, x)))) / 2.0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(1.0 + (eps ^ -1.0)) tmp = 0.0 if (Float64(Float64(t_0 * exp(Float64(Float64(-1.0 + eps) * x))) - Float64(Float64((eps ^ -1.0) - 1.0) * exp(Float64(Float64(-1.0 - eps) * x)))) <= 2.000000002) tmp = Float64(Float64(2.0 * Float64(Float64(1.0 + x) / exp(x))) * 0.5); else tmp = Float64(Float64(Float64(t_0 * exp(Float64(x * eps))) - Float64(-1.0 * exp(Float64(-fma(x, eps, x))))) / 2.0); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(1.0 + N[Power[eps, -1.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$0 * N[Exp[N[(N[(-1.0 + eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Power[eps, -1.0], $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.000000002], N[(N[(2.0 * N[(N[(1.0 + x), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(t$95$0 * N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(-1.0 * N[Exp[(-N[(x * eps + x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + {\varepsilon}^{-1}\\
\mathbf{if}\;t\_0 \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - \left({\varepsilon}^{-1} - 1\right) \cdot e^{\left(-1 - \varepsilon\right) \cdot x} \leq 2.000000002:\\
\;\;\;\;\left(2 \cdot \frac{1 + x}{e^{x}}\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot e^{x \cdot \varepsilon} - -1 \cdot e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}}{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) < 2.0000000020000002Initial program 46.4%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
if 2.0000000020000002 < (-.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%
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
neg-mul-1N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
metadata-evalN/A
div-invN/A
metadata-evalN/A
frac-2negN/A
/-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
sub-negN/A
lower--.f64100.0
Applied rewrites100.0%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
*-lft-identityN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in eps around inf
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 (pow eps -1.0)) (exp (* (+ -1.0 eps) x)))
(* (- (pow eps -1.0) 1.0) (exp (* (- -1.0 eps) x))))
4.0)
(* (* 2.0 (/ (+ 1.0 x) (exp x))) 0.5)
(/ (- (+ (pow eps -1.0) 1.0) (* -1.0 (exp (- (fma x eps x))))) 2.0)))
double code(double x, double eps) {
double tmp;
if ((((1.0 + pow(eps, -1.0)) * exp(((-1.0 + eps) * x))) - ((pow(eps, -1.0) - 1.0) * exp(((-1.0 - eps) * x)))) <= 4.0) {
tmp = (2.0 * ((1.0 + x) / exp(x))) * 0.5;
} else {
tmp = ((pow(eps, -1.0) + 1.0) - (-1.0 * exp(-fma(x, eps, x)))) / 2.0;
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (Float64(Float64(Float64(1.0 + (eps ^ -1.0)) * exp(Float64(Float64(-1.0 + eps) * x))) - Float64(Float64((eps ^ -1.0) - 1.0) * exp(Float64(Float64(-1.0 - eps) * x)))) <= 4.0) tmp = Float64(Float64(2.0 * Float64(Float64(1.0 + x) / exp(x))) * 0.5); else tmp = Float64(Float64(Float64((eps ^ -1.0) + 1.0) - Float64(-1.0 * exp(Float64(-fma(x, eps, x))))) / 2.0); end return tmp end
code[x_, eps_] := If[LessEqual[N[(N[(N[(1.0 + N[Power[eps, -1.0], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(-1.0 + eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Power[eps, -1.0], $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4.0], N[(N[(2.0 * N[(N[(1.0 + x), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(N[Power[eps, -1.0], $MachinePrecision] + 1.0), $MachinePrecision] - N[(-1.0 * N[Exp[(-N[(x * eps + x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(1 + {\varepsilon}^{-1}\right) \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - \left({\varepsilon}^{-1} - 1\right) \cdot e^{\left(-1 - \varepsilon\right) \cdot x} \leq 4:\\
\;\;\;\;\left(2 \cdot \frac{1 + x}{e^{x}}\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\left({\varepsilon}^{-1} + 1\right) - -1 \cdot e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}}{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) < 4Initial program 48.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.3%
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%
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
neg-mul-1N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
metadata-evalN/A
div-invN/A
metadata-evalN/A
frac-2negN/A
/-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
sub-negN/A
lower--.f64100.0
Applied rewrites100.0%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
*-lft-identityN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in eps around inf
Applied rewrites100.0%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
lower-/.f6448.2
Applied rewrites48.2%
Final simplification78.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ 1.0 (pow eps -1.0))))
(if (<=
(-
(* t_0 (exp (* (+ -1.0 eps) x)))
(* (- (pow eps -1.0) 1.0) (exp (* (- -1.0 eps) x))))
4.0)
(* (* 2.0 (/ (+ 1.0 x) (exp x))) 0.5)
(/ (- (* t_0 (exp (* x eps))) -1.0) 2.0))))
double code(double x, double eps) {
double t_0 = 1.0 + pow(eps, -1.0);
double tmp;
if (((t_0 * exp(((-1.0 + eps) * x))) - ((pow(eps, -1.0) - 1.0) * exp(((-1.0 - eps) * x)))) <= 4.0) {
tmp = (2.0 * ((1.0 + x) / exp(x))) * 0.5;
} else {
tmp = ((t_0 * exp((x * eps))) - -1.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))
if (((t_0 * exp((((-1.0d0) + eps) * x))) - (((eps ** (-1.0d0)) - 1.0d0) * exp((((-1.0d0) - eps) * x)))) <= 4.0d0) then
tmp = (2.0d0 * ((1.0d0 + x) / exp(x))) * 0.5d0
else
tmp = ((t_0 * exp((x * eps))) - (-1.0d0)) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = 1.0 + Math.pow(eps, -1.0);
double tmp;
if (((t_0 * Math.exp(((-1.0 + eps) * x))) - ((Math.pow(eps, -1.0) - 1.0) * Math.exp(((-1.0 - eps) * x)))) <= 4.0) {
tmp = (2.0 * ((1.0 + x) / Math.exp(x))) * 0.5;
} else {
tmp = ((t_0 * Math.exp((x * eps))) - -1.0) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = 1.0 + math.pow(eps, -1.0) tmp = 0 if ((t_0 * math.exp(((-1.0 + eps) * x))) - ((math.pow(eps, -1.0) - 1.0) * math.exp(((-1.0 - eps) * x)))) <= 4.0: tmp = (2.0 * ((1.0 + x) / math.exp(x))) * 0.5 else: tmp = ((t_0 * math.exp((x * eps))) - -1.0) / 2.0 return tmp
function code(x, eps) t_0 = Float64(1.0 + (eps ^ -1.0)) tmp = 0.0 if (Float64(Float64(t_0 * exp(Float64(Float64(-1.0 + eps) * x))) - Float64(Float64((eps ^ -1.0) - 1.0) * exp(Float64(Float64(-1.0 - eps) * x)))) <= 4.0) tmp = Float64(Float64(2.0 * Float64(Float64(1.0 + x) / exp(x))) * 0.5); else tmp = Float64(Float64(Float64(t_0 * exp(Float64(x * eps))) - -1.0) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = 1.0 + (eps ^ -1.0); tmp = 0.0; if (((t_0 * exp(((-1.0 + eps) * x))) - (((eps ^ -1.0) - 1.0) * exp(((-1.0 - eps) * x)))) <= 4.0) tmp = (2.0 * ((1.0 + x) / exp(x))) * 0.5; else tmp = ((t_0 * exp((x * eps))) - -1.0) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(1.0 + N[Power[eps, -1.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$0 * N[Exp[N[(N[(-1.0 + eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Power[eps, -1.0], $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4.0], N[(N[(2.0 * N[(N[(1.0 + x), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(t$95$0 * N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + {\varepsilon}^{-1}\\
\mathbf{if}\;t\_0 \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - \left({\varepsilon}^{-1} - 1\right) \cdot e^{\left(-1 - \varepsilon\right) \cdot x} \leq 4:\\
\;\;\;\;\left(2 \cdot \frac{1 + x}{e^{x}}\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot e^{x \cdot \varepsilon} - -1}{2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) < 4Initial program 48.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.3%
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
lower--.f64N/A
lower-/.f6454.9
Applied rewrites54.9%
Taylor expanded in eps around inf
Applied rewrites54.9%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f6454.9
Applied rewrites54.9%
Final simplification81.2%
(FPCore (x eps)
:precision binary64
(if (<=
(-
(* (+ 1.0 (pow eps -1.0)) (exp (* (+ -1.0 eps) x)))
(* (- (pow eps -1.0) 1.0) (exp (* (- -1.0 eps) x))))
1.9999999999999964)
(* (* 2.0 (/ (+ 1.0 x) (exp x))) 0.5)
(fma (fma 0.3333333333333333 x -0.5) (* x x) 1.0)))
double code(double x, double eps) {
double tmp;
if ((((1.0 + pow(eps, -1.0)) * exp(((-1.0 + eps) * x))) - ((pow(eps, -1.0) - 1.0) * exp(((-1.0 - eps) * x)))) <= 1.9999999999999964) {
tmp = (2.0 * ((1.0 + x) / exp(x))) * 0.5;
} else {
tmp = fma(fma(0.3333333333333333, x, -0.5), (x * x), 1.0);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (Float64(Float64(Float64(1.0 + (eps ^ -1.0)) * exp(Float64(Float64(-1.0 + eps) * x))) - Float64(Float64((eps ^ -1.0) - 1.0) * exp(Float64(Float64(-1.0 - eps) * x)))) <= 1.9999999999999964) tmp = Float64(Float64(2.0 * Float64(Float64(1.0 + x) / exp(x))) * 0.5); else tmp = fma(fma(0.3333333333333333, x, -0.5), Float64(x * x), 1.0); end return tmp end
code[x_, eps_] := If[LessEqual[N[(N[(N[(1.0 + N[Power[eps, -1.0], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(-1.0 + eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Power[eps, -1.0], $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.9999999999999964], N[(N[(2.0 * N[(N[(1.0 + x), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(1 + {\varepsilon}^{-1}\right) \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - \left({\varepsilon}^{-1} - 1\right) \cdot e^{\left(-1 - \varepsilon\right) \cdot x} \leq 1.9999999999999964:\\
\;\;\;\;\left(2 \cdot \frac{1 + x}{e^{x}}\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right), x \cdot 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))))) < 1.9999999999999964Initial program 27.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
if 1.9999999999999964 < (-.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 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites29.6%
Taylor expanded in x around 0
Applied rewrites48.8%
Final simplification71.0%
(FPCore (x eps)
:precision binary64
(if (<=
(-
(* (+ 1.0 (pow eps -1.0)) (exp (* (+ -1.0 eps) x)))
(* (- (pow eps -1.0) 1.0) (exp (* (- -1.0 eps) x))))
1.9999999999999964)
(*
(*
2.0
(/ (+ 1.0 x) (fma (fma (fma 0.16666666666666666 x 0.5) x 1.0) x 1.0)))
0.5)
(fma (fma 0.3333333333333333 x -0.5) (* x x) 1.0)))
double code(double x, double eps) {
double tmp;
if ((((1.0 + pow(eps, -1.0)) * exp(((-1.0 + eps) * x))) - ((pow(eps, -1.0) - 1.0) * exp(((-1.0 - eps) * x)))) <= 1.9999999999999964) {
tmp = (2.0 * ((1.0 + x) / fma(fma(fma(0.16666666666666666, x, 0.5), x, 1.0), x, 1.0))) * 0.5;
} else {
tmp = fma(fma(0.3333333333333333, x, -0.5), (x * x), 1.0);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (Float64(Float64(Float64(1.0 + (eps ^ -1.0)) * exp(Float64(Float64(-1.0 + eps) * x))) - Float64(Float64((eps ^ -1.0) - 1.0) * exp(Float64(Float64(-1.0 - eps) * x)))) <= 1.9999999999999964) tmp = Float64(Float64(2.0 * Float64(Float64(1.0 + x) / fma(fma(fma(0.16666666666666666, x, 0.5), x, 1.0), x, 1.0))) * 0.5); else tmp = fma(fma(0.3333333333333333, x, -0.5), Float64(x * x), 1.0); end return tmp end
code[x_, eps_] := If[LessEqual[N[(N[(N[(1.0 + N[Power[eps, -1.0], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(-1.0 + eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Power[eps, -1.0], $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.9999999999999964], N[(N[(2.0 * N[(N[(1.0 + x), $MachinePrecision] / N[(N[(N[(0.16666666666666666 * x + 0.5), $MachinePrecision] * x + 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(1 + {\varepsilon}^{-1}\right) \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - \left({\varepsilon}^{-1} - 1\right) \cdot e^{\left(-1 - \varepsilon\right) \cdot x} \leq 1.9999999999999964:\\
\;\;\;\;\left(2 \cdot \frac{1 + x}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right), x, 1\right), x, 1\right)}\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right), x \cdot 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))))) < 1.9999999999999964Initial program 27.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites93.1%
if 1.9999999999999964 < (-.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 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites29.6%
Taylor expanded in x around 0
Applied rewrites48.8%
Final simplification68.0%
(FPCore (x eps)
:precision binary64
(if (<=
(-
(* (+ 1.0 (pow eps -1.0)) (exp (* (+ -1.0 eps) x)))
(* (- (pow eps -1.0) 1.0) (exp (* (- -1.0 eps) x))))
1.9999999999999964)
(/ (+ x 1.0) (fma (fma 0.5 x 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 ((((1.0 + pow(eps, -1.0)) * exp(((-1.0 + eps) * x))) - ((pow(eps, -1.0) - 1.0) * exp(((-1.0 - eps) * x)))) <= 1.9999999999999964) {
tmp = (x + 1.0) / fma(fma(0.5, x, 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 (Float64(Float64(Float64(1.0 + (eps ^ -1.0)) * exp(Float64(Float64(-1.0 + eps) * x))) - Float64(Float64((eps ^ -1.0) - 1.0) * exp(Float64(Float64(-1.0 - eps) * x)))) <= 1.9999999999999964) tmp = Float64(Float64(x + 1.0) / fma(fma(0.5, x, 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[N[(N[(N[(1.0 + N[Power[eps, -1.0], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(-1.0 + eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Power[eps, -1.0], $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.9999999999999964], N[(N[(x + 1.0), $MachinePrecision] / N[(N[(0.5 * x + 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}\;\left(1 + {\varepsilon}^{-1}\right) \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - \left({\varepsilon}^{-1} - 1\right) \cdot e^{\left(-1 - \varepsilon\right) \cdot x} \leq 1.9999999999999964:\\
\;\;\;\;\frac{x + 1}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, x, 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 (-.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))))) < 1.9999999999999964Initial program 27.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites87.9%
Applied rewrites87.9%
if 1.9999999999999964 < (-.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 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites29.6%
Taylor expanded in x around 0
Applied rewrites48.8%
Final simplification65.7%
(FPCore (x eps)
:precision binary64
(if (<= eps 1.0)
(* (* 2.0 (/ (+ 1.0 x) (exp x))) 0.5)
(if (<= eps 6e+46)
(/
(-
(* (+ 1.0 (pow eps -1.0)) (exp (* (- eps 1.0) x)))
(* (fma (- -1.0 eps) x 1.0) (- (pow eps -1.0) 1.0)))
2.0)
(/
(-
(* (fma (- eps 1.0) x 1.0) (+ (pow eps -1.0) 1.0))
(* -1.0 (exp (- (fma x eps x)))))
2.0))))
double code(double x, double eps) {
double tmp;
if (eps <= 1.0) {
tmp = (2.0 * ((1.0 + x) / exp(x))) * 0.5;
} else if (eps <= 6e+46) {
tmp = (((1.0 + pow(eps, -1.0)) * exp(((eps - 1.0) * x))) - (fma((-1.0 - eps), x, 1.0) * (pow(eps, -1.0) - 1.0))) / 2.0;
} else {
tmp = ((fma((eps - 1.0), x, 1.0) * (pow(eps, -1.0) + 1.0)) - (-1.0 * exp(-fma(x, eps, x)))) / 2.0;
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (eps <= 1.0) tmp = Float64(Float64(2.0 * Float64(Float64(1.0 + x) / exp(x))) * 0.5); elseif (eps <= 6e+46) tmp = Float64(Float64(Float64(Float64(1.0 + (eps ^ -1.0)) * exp(Float64(Float64(eps - 1.0) * x))) - Float64(fma(Float64(-1.0 - eps), x, 1.0) * Float64((eps ^ -1.0) - 1.0))) / 2.0); else tmp = Float64(Float64(Float64(fma(Float64(eps - 1.0), x, 1.0) * Float64((eps ^ -1.0) + 1.0)) - Float64(-1.0 * exp(Float64(-fma(x, eps, x))))) / 2.0); end return tmp end
code[x_, eps_] := If[LessEqual[eps, 1.0], N[(N[(2.0 * N[(N[(1.0 + x), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[eps, 6e+46], N[(N[(N[(N[(1.0 + N[Power[eps, -1.0], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(eps - 1.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(-1.0 - eps), $MachinePrecision] * x + 1.0), $MachinePrecision] * N[(N[Power[eps, -1.0], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[(N[(eps - 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision] * N[(N[Power[eps, -1.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - N[(-1.0 * N[Exp[(-N[(x * eps + x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 1:\\
\;\;\;\;\left(2 \cdot \frac{1 + x}{e^{x}}\right) \cdot 0.5\\
\mathbf{elif}\;\varepsilon \leq 6 \cdot 10^{+46}:\\
\;\;\;\;\frac{\left(1 + {\varepsilon}^{-1}\right) \cdot e^{\left(\varepsilon - 1\right) \cdot x} - \mathsf{fma}\left(-1 - \varepsilon, x, 1\right) \cdot \left({\varepsilon}^{-1} - 1\right)}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\varepsilon - 1, x, 1\right) \cdot \left({\varepsilon}^{-1} + 1\right) - -1 \cdot e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 55.6%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites72.2%
if 1 < eps < 6.00000000000000047e46Initial program 100.0%
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
neg-mul-1N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
metadata-evalN/A
div-invN/A
metadata-evalN/A
frac-2negN/A
/-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
sub-negN/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
associate--l+N/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-neg-inN/A
distribute-lft1-inN/A
lower-*.f64N/A
distribute-rgt-neg-inN/A
*-commutativeN/A
lower-fma.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f64N/A
lower--.f64N/A
lower-/.f6476.0
Applied rewrites76.0%
if 6.00000000000000047e46 < eps Initial program 100.0%
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
neg-mul-1N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
metadata-evalN/A
div-invN/A
metadata-evalN/A
frac-2negN/A
/-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
sub-negN/A
lower--.f64100.0
Applied rewrites100.0%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
*-lft-identityN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in eps around inf
Applied rewrites100.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
sub-negN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
distribute-rgt1-inN/A
Applied rewrites71.6%
Final simplification72.2%
(FPCore (x eps)
:precision binary64
(if (<= eps 1.0)
(* (* 2.0 (/ (+ 1.0 x) (exp x))) 0.5)
(if (<= eps 1.7e+46)
(fma (fma 0.3333333333333333 x -0.5) (* x x) 1.0)
(/
(-
(* (fma (- eps 1.0) x 1.0) (+ (pow eps -1.0) 1.0))
(* -1.0 (exp (- (fma x eps x)))))
2.0))))
double code(double x, double eps) {
double tmp;
if (eps <= 1.0) {
tmp = (2.0 * ((1.0 + x) / exp(x))) * 0.5;
} else if (eps <= 1.7e+46) {
tmp = fma(fma(0.3333333333333333, x, -0.5), (x * x), 1.0);
} else {
tmp = ((fma((eps - 1.0), x, 1.0) * (pow(eps, -1.0) + 1.0)) - (-1.0 * exp(-fma(x, eps, x)))) / 2.0;
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (eps <= 1.0) tmp = Float64(Float64(2.0 * Float64(Float64(1.0 + x) / exp(x))) * 0.5); elseif (eps <= 1.7e+46) tmp = fma(fma(0.3333333333333333, x, -0.5), Float64(x * x), 1.0); else tmp = Float64(Float64(Float64(fma(Float64(eps - 1.0), x, 1.0) * Float64((eps ^ -1.0) + 1.0)) - Float64(-1.0 * exp(Float64(-fma(x, eps, x))))) / 2.0); end return tmp end
code[x_, eps_] := If[LessEqual[eps, 1.0], N[(N[(2.0 * N[(N[(1.0 + x), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[eps, 1.7e+46], N[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(N[(N[(N[(eps - 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision] * N[(N[Power[eps, -1.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - N[(-1.0 * N[Exp[(-N[(x * eps + x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 1:\\
\;\;\;\;\left(2 \cdot \frac{1 + x}{e^{x}}\right) \cdot 0.5\\
\mathbf{elif}\;\varepsilon \leq 1.7 \cdot 10^{+46}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right), x \cdot x, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\varepsilon - 1, x, 1\right) \cdot \left({\varepsilon}^{-1} + 1\right) - -1 \cdot e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 55.6%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites72.2%
if 1 < eps < 1.6999999999999999e46Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites50.0%
Taylor expanded in x around 0
Applied rewrites74.6%
if 1.6999999999999999e46 < eps Initial program 100.0%
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
neg-mul-1N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
metadata-evalN/A
div-invN/A
metadata-evalN/A
frac-2negN/A
/-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
sub-negN/A
lower--.f64100.0
Applied rewrites100.0%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
*-lft-identityN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in eps around inf
Applied rewrites100.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
sub-negN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
distribute-rgt1-inN/A
Applied rewrites71.6%
Final simplification72.1%
(FPCore (x eps)
:precision binary64
(if (<= x -2.0)
(/ (- (* (+ 1.0 (pow eps -1.0)) (exp (- x))) -1.0) 2.0)
(if (<= x 2e+105)
(* (* 2.0 (/ (+ 1.0 x) (exp x))) 0.5)
(fma (fma 0.3333333333333333 x -0.5) (* x x) 1.0))))
double code(double x, double eps) {
double tmp;
if (x <= -2.0) {
tmp = (((1.0 + pow(eps, -1.0)) * exp(-x)) - -1.0) / 2.0;
} else if (x <= 2e+105) {
tmp = (2.0 * ((1.0 + x) / exp(x))) * 0.5;
} 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.0) tmp = Float64(Float64(Float64(Float64(1.0 + (eps ^ -1.0)) * exp(Float64(-x))) - -1.0) / 2.0); elseif (x <= 2e+105) tmp = Float64(Float64(2.0 * Float64(Float64(1.0 + x) / exp(x))) * 0.5); 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.0], N[(N[(N[(N[(1.0 + N[Power[eps, -1.0], $MachinePrecision]), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 2e+105], N[(N[(2.0 * N[(N[(1.0 + x), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $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:\\
\;\;\;\;\frac{\left(1 + {\varepsilon}^{-1}\right) \cdot e^{-x} - -1}{2}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+105}:\\
\;\;\;\;\left(2 \cdot \frac{1 + x}{e^{x}}\right) \cdot 0.5\\
\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 < -2Initial program 100.0%
Taylor expanded in x around 0
lower--.f64N/A
lower-/.f6456.0
Applied rewrites56.0%
Taylor expanded in eps around inf
Applied rewrites56.0%
Taylor expanded in eps around 0
neg-mul-1N/A
lower-neg.f6494.1
Applied rewrites94.1%
if -2 < x < 1.9999999999999999e105Initial program 54.6%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.6%
if 1.9999999999999999e105 < x Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.1%
Taylor expanded in x around 0
Applied rewrites61.5%
Final simplification76.1%
(FPCore (x eps)
:precision binary64
(if (<= x -2.0)
(fma (* 0.5 x) (fma -1.0 (+ 1.0 eps) (/ -1.0 eps)) 1.0)
(if (<= x 480.0)
(/ (+ x 1.0) (fma (fma 0.5 x 1.0) x 1.0))
(if (<= x 2e+105)
0.0
(fma (fma 0.3333333333333333 x -0.5) (* x x) 1.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -2.0) {
tmp = fma((0.5 * x), fma(-1.0, (1.0 + eps), (-1.0 / eps)), 1.0);
} else if (x <= 480.0) {
tmp = (x + 1.0) / fma(fma(0.5, x, 1.0), x, 1.0);
} else if (x <= 2e+105) {
tmp = 0.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.0) tmp = fma(Float64(0.5 * x), fma(-1.0, Float64(1.0 + eps), Float64(-1.0 / eps)), 1.0); elseif (x <= 480.0) tmp = Float64(Float64(x + 1.0) / fma(fma(0.5, x, 1.0), x, 1.0)); elseif (x <= 2e+105) tmp = 0.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.0], N[(N[(0.5 * x), $MachinePrecision] * N[(-1.0 * N[(1.0 + eps), $MachinePrecision] + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 480.0], N[(N[(x + 1.0), $MachinePrecision] / N[(N[(0.5 * x + 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2e+105], 0.0, 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:\\
\;\;\;\;\mathsf{fma}\left(0.5 \cdot x, \mathsf{fma}\left(-1, 1 + \varepsilon, \frac{-1}{\varepsilon}\right), 1\right)\\
\mathbf{elif}\;x \leq 480:\\
\;\;\;\;\frac{x + 1}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, x, 1\right), x, 1\right)}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+105}:\\
\;\;\;\;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 < -2Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites3.0%
Taylor expanded in eps around 0
Applied rewrites16.9%
Taylor expanded in eps around inf
Applied rewrites16.9%
if -2 < x < 480Initial program 50.7%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.6%
Taylor expanded in x around 0
Applied rewrites77.6%
Applied rewrites77.6%
if 480 < x < 1.9999999999999999e105Initial program 100.0%
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
neg-mul-1N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
metadata-evalN/A
div-invN/A
metadata-evalN/A
frac-2negN/A
/-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
sub-negN/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in eps around 0
div-subN/A
neg-mul-1N/A
+-inversesN/A
metadata-eval64.8
Applied rewrites64.8%
if 1.9999999999999999e105 < x Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.1%
Taylor expanded in x around 0
Applied rewrites61.5%
Final simplification66.1%
(FPCore (x eps) :precision binary64 (if (<= x 480.0) 1.0 (if (<= x 2e+105) 0.0 (fma (fma 0.3333333333333333 x -0.5) (* x x) 1.0))))
double code(double x, double eps) {
double tmp;
if (x <= 480.0) {
tmp = 1.0;
} else if (x <= 2e+105) {
tmp = 0.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 <= 480.0) tmp = 1.0; elseif (x <= 2e+105) tmp = 0.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, 480.0], 1.0, If[LessEqual[x, 2e+105], 0.0, 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 480:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+105}:\\
\;\;\;\;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 < 480Initial program 59.0%
Taylor expanded in x around 0
Applied rewrites65.0%
if 480 < x < 1.9999999999999999e105Initial program 100.0%
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
neg-mul-1N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
metadata-evalN/A
div-invN/A
metadata-evalN/A
frac-2negN/A
/-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
sub-negN/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in eps around 0
div-subN/A
neg-mul-1N/A
+-inversesN/A
metadata-eval64.8
Applied rewrites64.8%
if 1.9999999999999999e105 < x Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites40.1%
Taylor expanded in x around 0
Applied rewrites61.5%
Final simplification64.4%
(FPCore (x eps) :precision binary64 (if (<= x 480.0) 1.0 0.0))
double code(double x, double eps) {
double tmp;
if (x <= 480.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 <= 480.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 <= 480.0) {
tmp = 1.0;
} else {
tmp = 0.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= 480.0: tmp = 1.0 else: tmp = 0.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= 480.0) tmp = 1.0; else tmp = 0.0; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= 480.0) tmp = 1.0; else tmp = 0.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, 480.0], 1.0, 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 480:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if x < 480Initial program 59.0%
Taylor expanded in x around 0
Applied rewrites65.0%
if 480 < x Initial program 100.0%
lift-neg.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
neg-mul-1N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
metadata-evalN/A
div-invN/A
metadata-evalN/A
frac-2negN/A
/-rgt-identityN/A
metadata-evalN/A
metadata-evalN/A
sub-negN/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in eps around 0
div-subN/A
neg-mul-1N/A
+-inversesN/A
metadata-eval45.9
Applied rewrites45.9%
Final simplification60.5%
(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 68.6%
Taylor expanded in x around 0
Applied rewrites50.5%
Final simplification50.5%
herbie shell --seed 2024318
(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))