
(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)) (t_1 (+ (/ 1.0 eps) 1.0)))
(if (<=
(- (* (exp (* (+ -1.0 eps) x)) t_1) (* (exp (* (- -1.0 eps) x)) t_0))
0.0)
(* (exp (- x)) (+ x 1.0))
(/ (- (* (exp (* x eps)) t_1) (* (exp (- (* x eps))) t_0)) 2.0))))
double code(double x, double eps) {
double t_0 = (1.0 / eps) - 1.0;
double t_1 = (1.0 / eps) + 1.0;
double tmp;
if (((exp(((-1.0 + eps) * x)) * t_1) - (exp(((-1.0 - eps) * x)) * t_0)) <= 0.0) {
tmp = exp(-x) * (x + 1.0);
} else {
tmp = ((exp((x * eps)) * t_1) - (exp(-(x * eps)) * 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 = (1.0d0 / eps) + 1.0d0
if (((exp((((-1.0d0) + eps) * x)) * t_1) - (exp((((-1.0d0) - eps) * x)) * t_0)) <= 0.0d0) then
tmp = exp(-x) * (x + 1.0d0)
else
tmp = ((exp((x * eps)) * t_1) - (exp(-(x * eps)) * 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 = (1.0 / eps) + 1.0;
double tmp;
if (((Math.exp(((-1.0 + eps) * x)) * t_1) - (Math.exp(((-1.0 - eps) * x)) * t_0)) <= 0.0) {
tmp = Math.exp(-x) * (x + 1.0);
} else {
tmp = ((Math.exp((x * eps)) * t_1) - (Math.exp(-(x * eps)) * t_0)) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = (1.0 / eps) - 1.0 t_1 = (1.0 / eps) + 1.0 tmp = 0 if ((math.exp(((-1.0 + eps) * x)) * t_1) - (math.exp(((-1.0 - eps) * x)) * t_0)) <= 0.0: tmp = math.exp(-x) * (x + 1.0) else: tmp = ((math.exp((x * eps)) * t_1) - (math.exp(-(x * eps)) * t_0)) / 2.0 return tmp
function code(x, eps) t_0 = Float64(Float64(1.0 / eps) - 1.0) t_1 = Float64(Float64(1.0 / eps) + 1.0) tmp = 0.0 if (Float64(Float64(exp(Float64(Float64(-1.0 + eps) * x)) * t_1) - Float64(exp(Float64(Float64(-1.0 - eps) * x)) * t_0)) <= 0.0) tmp = Float64(exp(Float64(-x)) * Float64(x + 1.0)); else tmp = Float64(Float64(Float64(exp(Float64(x * eps)) * t_1) - Float64(exp(Float64(-Float64(x * eps))) * t_0)) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = (1.0 / eps) - 1.0; t_1 = (1.0 / eps) + 1.0; tmp = 0.0; if (((exp(((-1.0 + eps) * x)) * t_1) - (exp(((-1.0 - eps) * x)) * t_0)) <= 0.0) tmp = exp(-x) * (x + 1.0); else tmp = ((exp((x * eps)) * t_1) - (exp(-(x * eps)) * 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[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[N[(N[(N[Exp[N[(N[(-1.0 + eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision] - N[(N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 0.0], N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision] - N[(N[Exp[(-N[(x * eps), $MachinePrecision])], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\varepsilon} - 1\\
t_1 := \frac{1}{\varepsilon} + 1\\
\mathbf{if}\;e^{\left(-1 + \varepsilon\right) \cdot x} \cdot t\_1 - e^{\left(-1 - \varepsilon\right) \cdot x} \cdot t\_0 \leq 0:\\
\;\;\;\;e^{-x} \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon} \cdot t\_1 - e^{-x \cdot \varepsilon} \cdot 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))))) < 0.0Initial program 32.8%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Applied rewrites100.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
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in eps around inf
lower-*.f64100.0
Applied rewrites100.0%
Final simplification100.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (/ 1.0 eps) 1.0)))
(if (<=
(-
(* (exp (* (+ -1.0 eps) x)) (+ (/ 1.0 eps) 1.0))
(* (exp (* (- -1.0 eps) x)) t_0))
2.0)
(* (exp (- x)) (+ x 1.0))
(/ (- (* 1.0 (exp (* x eps))) (* (exp (- (* x eps))) t_0)) 2.0))))
double code(double x, double eps) {
double t_0 = (1.0 / eps) - 1.0;
double tmp;
if (((exp(((-1.0 + eps) * x)) * ((1.0 / eps) + 1.0)) - (exp(((-1.0 - eps) * x)) * t_0)) <= 2.0) {
tmp = exp(-x) * (x + 1.0);
} else {
tmp = ((1.0 * exp((x * eps))) - (exp(-(x * eps)) * 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
if (((exp((((-1.0d0) + eps) * x)) * ((1.0d0 / eps) + 1.0d0)) - (exp((((-1.0d0) - eps) * x)) * t_0)) <= 2.0d0) then
tmp = exp(-x) * (x + 1.0d0)
else
tmp = ((1.0d0 * exp((x * eps))) - (exp(-(x * eps)) * 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 tmp;
if (((Math.exp(((-1.0 + eps) * x)) * ((1.0 / eps) + 1.0)) - (Math.exp(((-1.0 - eps) * x)) * t_0)) <= 2.0) {
tmp = Math.exp(-x) * (x + 1.0);
} else {
tmp = ((1.0 * Math.exp((x * eps))) - (Math.exp(-(x * eps)) * t_0)) / 2.0;
}
return tmp;
}
def code(x, eps): t_0 = (1.0 / eps) - 1.0 tmp = 0 if ((math.exp(((-1.0 + eps) * x)) * ((1.0 / eps) + 1.0)) - (math.exp(((-1.0 - eps) * x)) * t_0)) <= 2.0: tmp = math.exp(-x) * (x + 1.0) else: tmp = ((1.0 * math.exp((x * eps))) - (math.exp(-(x * eps)) * t_0)) / 2.0 return tmp
function code(x, eps) t_0 = Float64(Float64(1.0 / eps) - 1.0) tmp = 0.0 if (Float64(Float64(exp(Float64(Float64(-1.0 + eps) * x)) * Float64(Float64(1.0 / eps) + 1.0)) - Float64(exp(Float64(Float64(-1.0 - eps) * x)) * t_0)) <= 2.0) tmp = Float64(exp(Float64(-x)) * Float64(x + 1.0)); else tmp = Float64(Float64(Float64(1.0 * exp(Float64(x * eps))) - Float64(exp(Float64(-Float64(x * eps))) * t_0)) / 2.0); end return tmp end
function tmp_2 = code(x, eps) t_0 = (1.0 / eps) - 1.0; tmp = 0.0; if (((exp(((-1.0 + eps) * x)) * ((1.0 / eps) + 1.0)) - (exp(((-1.0 - eps) * x)) * t_0)) <= 2.0) tmp = exp(-x) * (x + 1.0); else tmp = ((1.0 * exp((x * eps))) - (exp(-(x * eps)) * 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]}, If[LessEqual[N[(N[(N[Exp[N[(N[(-1.0 + eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 * N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Exp[(-N[(x * eps), $MachinePrecision])], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\varepsilon} - 1\\
\mathbf{if}\;e^{\left(-1 + \varepsilon\right) \cdot x} \cdot \left(\frac{1}{\varepsilon} + 1\right) - e^{\left(-1 - \varepsilon\right) \cdot x} \cdot t\_0 \leq 2:\\
\;\;\;\;e^{-x} \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 \cdot e^{x \cdot \varepsilon} - e^{-x \cdot \varepsilon} \cdot 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))))) < 2Initial program 48.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Applied rewrites100.0%
if 2 < (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) Initial program 100.0%
Taylor expanded in eps around inf
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in eps around inf
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in eps around inf
Applied rewrites100.0%
Final simplification100.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (/ 1.0 eps) 1.0)))
(if (<=
(-
(* (exp (* (+ -1.0 eps) x)) t_0)
(* (exp (* (- -1.0 eps) x)) (- (/ 1.0 eps) 1.0)))
4.0)
(* (exp (- x)) (+ x 1.0))
(/
(- t_0 (fma (fma (* -0.5 (pow (- eps -1.0) 2.0)) x (- eps -1.0)) x -1.0))
2.0))))
double code(double x, double eps) {
double t_0 = (1.0 / eps) + 1.0;
double tmp;
if (((exp(((-1.0 + eps) * x)) * t_0) - (exp(((-1.0 - eps) * x)) * ((1.0 / eps) - 1.0))) <= 4.0) {
tmp = exp(-x) * (x + 1.0);
} else {
tmp = (t_0 - fma(fma((-0.5 * pow((eps - -1.0), 2.0)), x, (eps - -1.0)), x, -1.0)) / 2.0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(Float64(1.0 / eps) + 1.0) tmp = 0.0 if (Float64(Float64(exp(Float64(Float64(-1.0 + eps) * x)) * t_0) - Float64(exp(Float64(Float64(-1.0 - eps) * x)) * Float64(Float64(1.0 / eps) - 1.0))) <= 4.0) tmp = Float64(exp(Float64(-x)) * Float64(x + 1.0)); else tmp = Float64(Float64(t_0 - fma(fma(Float64(-0.5 * (Float64(eps - -1.0) ^ 2.0)), x, Float64(eps - -1.0)), x, -1.0)) / 2.0); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[N[(N[(N[Exp[N[(N[(-1.0 + eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] - N[(N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4.0], N[(N[Exp[(-x)], $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 - N[(N[(N[(-0.5 * N[Power[N[(eps - -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * x + N[(eps - -1.0), $MachinePrecision]), $MachinePrecision] * x + -1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\varepsilon} + 1\\
\mathbf{if}\;e^{\left(-1 + \varepsilon\right) \cdot x} \cdot t\_0 - e^{\left(-1 - \varepsilon\right) \cdot x} \cdot \left(\frac{1}{\varepsilon} - 1\right) \leq 4:\\
\;\;\;\;e^{-x} \cdot \left(x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 - \mathsf{fma}\left(\mathsf{fma}\left(-0.5 \cdot {\left(\varepsilon - -1\right)}^{2}, x, \varepsilon - -1\right), x, -1\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 50.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.9%
Applied rewrites98.9%
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 eps around inf
exp-negN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-exp.f64N/A
distribute-rgt-inN/A
*-lft-identityN/A
+-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites51.7%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
lower-/.f643.2
Applied rewrites3.2%
Taylor expanded in x around 0
Applied rewrites79.6%
Final simplification89.5%
(FPCore (x eps) :precision binary64 (if (<= x -5e-257) (/ (- 1.0 (/ -1.0 (exp (fma eps x x)))) 2.0) (/ (- (* 1.0 (exp (* (+ -1.0 eps) x))) -1.0) 2.0)))
double code(double x, double eps) {
double tmp;
if (x <= -5e-257) {
tmp = (1.0 - (-1.0 / exp(fma(eps, x, x)))) / 2.0;
} else {
tmp = ((1.0 * exp(((-1.0 + eps) * x))) - -1.0) / 2.0;
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -5e-257) tmp = Float64(Float64(1.0 - Float64(-1.0 / exp(fma(eps, x, x)))) / 2.0); else tmp = Float64(Float64(Float64(1.0 * exp(Float64(Float64(-1.0 + eps) * x))) - -1.0) / 2.0); end return tmp end
code[x_, eps_] := If[LessEqual[x, -5e-257], N[(N[(1.0 - N[(-1.0 / N[Exp[N[(eps * x + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 * N[Exp[N[(N[(-1.0 + eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-257}:\\
\;\;\;\;\frac{1 - \frac{-1}{e^{\mathsf{fma}\left(\varepsilon, x, x\right)}}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - -1}{2}\\
\end{array}
\end{array}
if x < -4.99999999999999989e-257Initial program 67.4%
Taylor expanded in eps around inf
exp-negN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-exp.f64N/A
distribute-rgt-inN/A
*-lft-identityN/A
+-commutativeN/A
lower-fma.f6467.0
Applied rewrites67.0%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
lower-/.f6438.2
Applied rewrites38.2%
Taylor expanded in eps around inf
Applied rewrites68.9%
if -4.99999999999999989e-257 < x Initial program 79.0%
Taylor expanded in eps around inf
exp-negN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-exp.f64N/A
distribute-rgt-inN/A
*-lft-identityN/A
+-commutativeN/A
lower-fma.f6477.8
Applied rewrites77.8%
Taylor expanded in x around 0
Applied rewrites38.5%
Taylor expanded in eps around inf
Applied rewrites60.7%
Final simplification64.0%
(FPCore (x eps) :precision binary64 (if (<= x -220.0) (/ (- (/ (exp (- x)) eps) -1.0) 2.0) (/ (- (* 1.0 (exp (* (+ -1.0 eps) x))) -1.0) 2.0)))
double code(double x, double eps) {
double tmp;
if (x <= -220.0) {
tmp = ((exp(-x) / eps) - -1.0) / 2.0;
} else {
tmp = ((1.0 * exp(((-1.0 + eps) * x))) - -1.0) / 2.0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-220.0d0)) then
tmp = ((exp(-x) / eps) - (-1.0d0)) / 2.0d0
else
tmp = ((1.0d0 * exp((((-1.0d0) + eps) * x))) - (-1.0d0)) / 2.0d0
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -220.0) {
tmp = ((Math.exp(-x) / eps) - -1.0) / 2.0;
} else {
tmp = ((1.0 * Math.exp(((-1.0 + eps) * x))) - -1.0) / 2.0;
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -220.0: tmp = ((math.exp(-x) / eps) - -1.0) / 2.0 else: tmp = ((1.0 * math.exp(((-1.0 + eps) * x))) - -1.0) / 2.0 return tmp
function code(x, eps) tmp = 0.0 if (x <= -220.0) tmp = Float64(Float64(Float64(exp(Float64(-x)) / eps) - -1.0) / 2.0); else tmp = Float64(Float64(Float64(1.0 * exp(Float64(Float64(-1.0 + eps) * x))) - -1.0) / 2.0); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -220.0) tmp = ((exp(-x) / eps) - -1.0) / 2.0; else tmp = ((1.0 * exp(((-1.0 + eps) * x))) - -1.0) / 2.0; end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -220.0], N[(N[(N[(N[Exp[(-x)], $MachinePrecision] / eps), $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(1.0 * N[Exp[N[(N[(-1.0 + eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -220:\\
\;\;\;\;\frac{\frac{e^{-x}}{\varepsilon} - -1}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - -1}{2}\\
\end{array}
\end{array}
if x < -220Initial program 100.0%
Taylor expanded in eps around inf
exp-negN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-exp.f64N/A
distribute-rgt-inN/A
*-lft-identityN/A
+-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites46.5%
Taylor expanded in eps around 0
lower-/.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6455.3
Applied rewrites55.3%
if -220 < x Initial program 69.8%
Taylor expanded in eps around inf
exp-negN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-exp.f64N/A
distribute-rgt-inN/A
*-lft-identityN/A
+-commutativeN/A
lower-fma.f6468.8
Applied rewrites68.8%
Taylor expanded in x around 0
Applied rewrites36.1%
Taylor expanded in eps around inf
Applied rewrites66.2%
Final simplification64.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (exp (- x))))
(if (<= x -700.0)
(/ (- (/ t_0 eps) -1.0) 2.0)
(if (<= x 1e+204)
(* 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 <= -700.0) {
tmp = ((t_0 / eps) - -1.0) / 2.0;
} else if (x <= 1e+204) {
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 <= -700.0) tmp = Float64(Float64(Float64(t_0 / eps) - -1.0) / 2.0); elseif (x <= 1e+204) 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, -700.0], N[(N[(N[(t$95$0 / eps), $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1e+204], 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 -700:\\
\;\;\;\;\frac{\frac{t\_0}{\varepsilon} - -1}{2}\\
\mathbf{elif}\;x \leq 10^{+204}:\\
\;\;\;\;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 < -700Initial program 100.0%
Taylor expanded in eps around inf
exp-negN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-exp.f64N/A
distribute-rgt-inN/A
*-lft-identityN/A
+-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites46.5%
Taylor expanded in eps around 0
lower-/.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6455.3
Applied rewrites55.3%
if -700 < x < 9.99999999999999989e203Initial program 66.2%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.9%
Applied rewrites64.9%
if 9.99999999999999989e203 < x Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites27.2%
Taylor expanded in x around 0
Applied rewrites74.3%
Final simplification64.3%
(FPCore (x eps)
:precision binary64
(if (<= eps 1.0)
(* (exp (- x)) (+ x 1.0))
(if (<= eps 3.7e+161)
(fma (fma 0.3333333333333333 x -0.5) (* x x) 1.0)
(/ (- (+ (/ 1.0 eps) 1.0) (fma (- eps -1.0) x -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 <= 3.7e+161) {
tmp = fma(fma(0.3333333333333333, x, -0.5), (x * x), 1.0);
} else {
tmp = (((1.0 / eps) + 1.0) - fma((eps - -1.0), x, -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 <= 3.7e+161) tmp = fma(fma(0.3333333333333333, x, -0.5), Float64(x * x), 1.0); else tmp = Float64(Float64(Float64(Float64(1.0 / eps) + 1.0) - fma(Float64(eps - -1.0), x, -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, 3.7e+161], N[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision] - N[(N[(eps - -1.0), $MachinePrecision] * x + -1.0), $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 3.7 \cdot 10^{+161}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right), x \cdot x, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\frac{1}{\varepsilon} + 1\right) - \mathsf{fma}\left(\varepsilon - -1, x, -1\right)}{2}\\
\end{array}
\end{array}
if eps < 1Initial program 61.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites65.9%
Applied rewrites65.9%
if 1 < eps < 3.69999999999999979e161Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites35.8%
Taylor expanded in x around 0
Applied rewrites60.1%
if 3.69999999999999979e161 < eps Initial program 100.0%
Taylor expanded in eps around inf
exp-negN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-exp.f64N/A
distribute-rgt-inN/A
*-lft-identityN/A
+-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites48.7%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
lower-/.f648.2
Applied rewrites8.2%
Taylor expanded in x around 0
Applied rewrites32.7%
Final simplification60.0%
(FPCore (x eps)
:precision binary64
(if (<= eps 420000.0)
(*
(*
(/ (+ x 1.0) (fma (fma (fma 0.16666666666666666 x 0.5) x 1.0) x 1.0))
2.0)
0.5)
(if (<= eps 3.7e+161)
(fma (fma 0.3333333333333333 x -0.5) (* x x) 1.0)
(/ (- (+ (/ 1.0 eps) 1.0) (fma (- eps -1.0) x -1.0)) 2.0))))
double code(double x, double eps) {
double tmp;
if (eps <= 420000.0) {
tmp = (((x + 1.0) / fma(fma(fma(0.16666666666666666, x, 0.5), x, 1.0), x, 1.0)) * 2.0) * 0.5;
} else if (eps <= 3.7e+161) {
tmp = fma(fma(0.3333333333333333, x, -0.5), (x * x), 1.0);
} else {
tmp = (((1.0 / eps) + 1.0) - fma((eps - -1.0), x, -1.0)) / 2.0;
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (eps <= 420000.0) tmp = Float64(Float64(Float64(Float64(x + 1.0) / fma(fma(fma(0.16666666666666666, x, 0.5), x, 1.0), x, 1.0)) * 2.0) * 0.5); elseif (eps <= 3.7e+161) tmp = fma(fma(0.3333333333333333, x, -0.5), Float64(x * x), 1.0); else tmp = Float64(Float64(Float64(Float64(1.0 / eps) + 1.0) - fma(Float64(eps - -1.0), x, -1.0)) / 2.0); end return tmp end
code[x_, eps_] := If[LessEqual[eps, 420000.0], N[(N[(N[(N[(x + 1.0), $MachinePrecision] / N[(N[(N[(0.16666666666666666 * x + 0.5), $MachinePrecision] * x + 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[eps, 3.7e+161], N[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision] - N[(N[(eps - -1.0), $MachinePrecision] * x + -1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 420000:\\
\;\;\;\;\left(\frac{x + 1}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right), x, 1\right), x, 1\right)} \cdot 2\right) \cdot 0.5\\
\mathbf{elif}\;\varepsilon \leq 3.7 \cdot 10^{+161}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right), x \cdot x, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\frac{1}{\varepsilon} + 1\right) - \mathsf{fma}\left(\varepsilon - -1, x, -1\right)}{2}\\
\end{array}
\end{array}
if eps < 4.2e5Initial program 62.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.1%
Taylor expanded in x around 0
Applied rewrites60.1%
if 4.2e5 < eps < 3.69999999999999979e161Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites34.3%
Taylor expanded in x around 0
Applied rewrites59.2%
if 3.69999999999999979e161 < eps Initial program 100.0%
Taylor expanded in eps around inf
exp-negN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-exp.f64N/A
distribute-rgt-inN/A
*-lft-identityN/A
+-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites48.7%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
lower-/.f648.2
Applied rewrites8.2%
Taylor expanded in x around 0
Applied rewrites32.7%
Final simplification55.9%
(FPCore (x eps) :precision binary64 (if (<= x -60.0) (/ (- (+ (/ 1.0 eps) 1.0) (fma (- eps -1.0) x -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 <= -60.0) {
tmp = (((1.0 / eps) + 1.0) - fma((eps - -1.0), x, -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 <= -60.0) tmp = Float64(Float64(Float64(Float64(1.0 / eps) + 1.0) - fma(Float64(eps - -1.0), x, -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, -60.0], N[(N[(N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision] - N[(N[(eps - -1.0), $MachinePrecision] * x + -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 -60:\\
\;\;\;\;\frac{\left(\frac{1}{\varepsilon} + 1\right) - \mathsf{fma}\left(\varepsilon - -1, x, -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 < -60Initial program 100.0%
Taylor expanded in eps around inf
exp-negN/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-exp.f64N/A
distribute-rgt-inN/A
*-lft-identityN/A
+-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites46.5%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
lower-/.f643.1
Applied rewrites3.1%
Taylor expanded in x around 0
Applied rewrites28.5%
if -60 < x Initial program 69.8%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites60.9%
Taylor expanded in x around 0
Applied rewrites58.9%
(FPCore (x eps) :precision binary64 (if (<= eps 420000.0) (/ (+ 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 (eps <= 420000.0) {
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 (eps <= 420000.0) 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[eps, 420000.0], 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}\;\varepsilon \leq 420000:\\
\;\;\;\;\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 eps < 4.2e5Initial program 62.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.1%
Taylor expanded in x around 0
Applied rewrites57.2%
Applied rewrites57.2%
if 4.2e5 < eps Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites21.6%
Taylor expanded in x around 0
Applied rewrites41.2%
(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 74.3%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites51.9%
Taylor expanded in x around 0
Applied rewrites50.2%
(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 74.3%
Taylor expanded in x around 0
Applied rewrites40.5%
herbie shell --seed 2024268
(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))