
(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
(if (<=
(-
(* (+ (/ 1.0 eps) 1.0) (exp (* (- eps 1.0) x)))
(* (exp (* (- -1.0 eps) x)) (- (/ 1.0 eps) 1.0)))
0.0)
(* 0.5 (* (/ (+ x 1.0) (exp x)) 2.0))
(/ (- (* (exp (* x eps)) 1.0) (- (exp (- (fma x eps x))))) 2.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 = 0.5 * (((x + 1.0) / exp(x)) * 2.0);
} else {
tmp = ((exp((x * eps)) * 1.0) - -exp(-fma(x, eps, x))) / 2.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(0.5 * Float64(Float64(Float64(x + 1.0) / exp(x)) * 2.0)); else tmp = Float64(Float64(Float64(exp(Float64(x * eps)) * 1.0) - Float64(-exp(Float64(-fma(x, eps, x))))) / 2.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[(0.5 * N[(N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision] - (-N[Exp[(-N[(x * eps + x), $MachinePrecision])], $MachinePrecision])), $MachinePrecision] / 2.0), $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:\\
\;\;\;\;0.5 \cdot \left(\frac{x + 1}{e^{x}} \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon} \cdot 1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\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))))) < 0.0Initial program 28.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
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
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.f6496.5
Applied rewrites96.5%
Applied rewrites96.5%
Taylor expanded in eps around inf
lower-*.f6496.5
Applied rewrites96.5%
Taylor expanded in eps around inf
Applied rewrites100.0%
Final simplification100.0%
(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))
(fma (* 0.3333333333333333 x) (* x 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 = fma((0.3333333333333333 * x), (x * 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 = fma(Float64(0.3333333333333333 * x), Float64(x * 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[(N[(0.3333333333333333 * x), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $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}:\\
\;\;\;\;\mathsf{fma}\left(0.3333333333333333 \cdot x, 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))))) < 0.0Initial program 28.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Taylor expanded in x around 0
Applied rewrites89.2%
Applied rewrites89.2%
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 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites26.0%
Taylor expanded in x around 0
Applied rewrites44.8%
Taylor expanded in x around inf
Applied rewrites44.8%
Final simplification62.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (/ 1.0 eps) 1.0)))
(if (<= x -7.6e+87)
(/ (- t_0 (fma (- eps -1.0) x -1.0)) 2.0)
(if (<= x -4.4e-227)
(fma (* 0.5 x) (fma (- eps 1.0) t_0 (/ (- 1.0 (* eps eps)) eps)) 1.0)
(if (<= x 5e+102)
(* 0.5 (* (/ (+ x 1.0) (exp x)) 2.0))
(fma (* 0.3333333333333333 x) (* x x) 1.0))))))
double code(double x, double eps) {
double t_0 = (1.0 / eps) + 1.0;
double tmp;
if (x <= -7.6e+87) {
tmp = (t_0 - fma((eps - -1.0), x, -1.0)) / 2.0;
} else if (x <= -4.4e-227) {
tmp = fma((0.5 * x), fma((eps - 1.0), t_0, ((1.0 - (eps * eps)) / eps)), 1.0);
} else if (x <= 5e+102) {
tmp = 0.5 * (((x + 1.0) / exp(x)) * 2.0);
} else {
tmp = fma((0.3333333333333333 * x), (x * x), 1.0);
}
return tmp;
}
function code(x, eps) t_0 = Float64(Float64(1.0 / eps) + 1.0) tmp = 0.0 if (x <= -7.6e+87) tmp = Float64(Float64(t_0 - fma(Float64(eps - -1.0), x, -1.0)) / 2.0); elseif (x <= -4.4e-227) tmp = fma(Float64(0.5 * x), fma(Float64(eps - 1.0), t_0, Float64(Float64(1.0 - Float64(eps * eps)) / eps)), 1.0); elseif (x <= 5e+102) tmp = Float64(0.5 * Float64(Float64(Float64(x + 1.0) / exp(x)) * 2.0)); else tmp = fma(Float64(0.3333333333333333 * x), Float64(x * x), 1.0); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -7.6e+87], N[(N[(t$95$0 - N[(N[(eps - -1.0), $MachinePrecision] * x + -1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -4.4e-227], N[(N[(0.5 * x), $MachinePrecision] * N[(N[(eps - 1.0), $MachinePrecision] * t$95$0 + N[(N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 5e+102], N[(0.5 * N[(N[(N[(x + 1.0), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.3333333333333333 * x), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\varepsilon} + 1\\
\mathbf{if}\;x \leq -7.6 \cdot 10^{+87}:\\
\;\;\;\;\frac{t\_0 - \mathsf{fma}\left(\varepsilon - -1, x, -1\right)}{2}\\
\mathbf{elif}\;x \leq -4.4 \cdot 10^{-227}:\\
\;\;\;\;\mathsf{fma}\left(0.5 \cdot x, \mathsf{fma}\left(\varepsilon - 1, t\_0, \frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon}\right), 1\right)\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+102}:\\
\;\;\;\;0.5 \cdot \left(\frac{x + 1}{e^{x}} \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.3333333333333333 \cdot x, x \cdot x, 1\right)\\
\end{array}
\end{array}
if x < -7.60000000000000022e87Initial 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.3%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
lower-/.f643.1
Applied rewrites3.1%
Taylor expanded in x around 0
Applied rewrites37.9%
if -7.60000000000000022e87 < x < -4.39999999999999962e-227Initial program 53.4%
Taylor expanded in x around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites66.7%
Taylor expanded in eps around 0
Applied rewrites80.0%
if -4.39999999999999962e-227 < x < 5e102Initial program 64.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites70.1%
if 5e102 < x Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites37.9%
Taylor expanded in x around 0
Applied rewrites63.6%
Taylor expanded in x around inf
Applied rewrites63.6%
Final simplification68.2%
(FPCore (x eps)
:precision binary64
(if (<= x -700.0)
(/ (- (/ (exp (- x)) eps) -1.0) 2.0)
(if (<= x -4.4e-227)
(fma
(* 0.5 x)
(fma (- eps 1.0) (+ (/ 1.0 eps) 1.0) (/ (- 1.0 (* eps eps)) eps))
1.0)
(/ (- (* (exp (* x eps)) 1.0) -1.0) 2.0))))
double code(double x, double eps) {
double tmp;
if (x <= -700.0) {
tmp = ((exp(-x) / eps) - -1.0) / 2.0;
} else if (x <= -4.4e-227) {
tmp = fma((0.5 * x), fma((eps - 1.0), ((1.0 / eps) + 1.0), ((1.0 - (eps * eps)) / eps)), 1.0);
} else {
tmp = ((exp((x * eps)) * 1.0) - -1.0) / 2.0;
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -700.0) tmp = Float64(Float64(Float64(exp(Float64(-x)) / eps) - -1.0) / 2.0); elseif (x <= -4.4e-227) tmp = fma(Float64(0.5 * x), fma(Float64(eps - 1.0), Float64(Float64(1.0 / eps) + 1.0), Float64(Float64(1.0 - Float64(eps * eps)) / eps)), 1.0); else tmp = Float64(Float64(Float64(exp(Float64(x * eps)) * 1.0) - -1.0) / 2.0); end return tmp end
code[x_, eps_] := If[LessEqual[x, -700.0], N[(N[(N[(N[Exp[(-x)], $MachinePrecision] / eps), $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -4.4e-227], N[(N[(0.5 * x), $MachinePrecision] * N[(N[(eps - 1.0), $MachinePrecision] * N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision] + N[(N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(N[(N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -700:\\
\;\;\;\;\frac{\frac{e^{-x}}{\varepsilon} - -1}{2}\\
\mathbf{elif}\;x \leq -4.4 \cdot 10^{-227}:\\
\;\;\;\;\mathsf{fma}\left(0.5 \cdot x, \mathsf{fma}\left(\varepsilon - 1, \frac{1}{\varepsilon} + 1, \frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon}\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon} \cdot 1 - -1}{2}\\
\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 rewrites44.6%
Taylor expanded in eps around 0
lower-/.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6457.1
Applied rewrites57.1%
if -700 < x < -4.39999999999999962e-227Initial program 45.1%
Taylor expanded in x around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites78.0%
Taylor expanded in eps around 0
Applied rewrites92.3%
if -4.39999999999999962e-227 < x Initial program 75.6%
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.f6474.4
Applied rewrites74.4%
Taylor expanded in x around 0
Applied rewrites37.3%
Taylor expanded in eps around inf
lower-*.f6437.1
Applied rewrites37.1%
Taylor expanded in eps around inf
Applied rewrites62.8%
Final simplification69.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (/ 1.0 eps) 1.0)))
(if (<= x -7.6e+87)
(/ (- t_0 (fma (- eps -1.0) x -1.0)) 2.0)
(if (<= x -4.4e-227)
(fma (* 0.5 x) (fma (- eps 1.0) t_0 (/ (- 1.0 (* eps eps)) eps)) 1.0)
(/ (- (* (exp (* x eps)) 1.0) -1.0) 2.0)))))
double code(double x, double eps) {
double t_0 = (1.0 / eps) + 1.0;
double tmp;
if (x <= -7.6e+87) {
tmp = (t_0 - fma((eps - -1.0), x, -1.0)) / 2.0;
} else if (x <= -4.4e-227) {
tmp = fma((0.5 * x), fma((eps - 1.0), t_0, ((1.0 - (eps * eps)) / eps)), 1.0);
} else {
tmp = ((exp((x * eps)) * 1.0) - -1.0) / 2.0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(Float64(1.0 / eps) + 1.0) tmp = 0.0 if (x <= -7.6e+87) tmp = Float64(Float64(t_0 - fma(Float64(eps - -1.0), x, -1.0)) / 2.0); elseif (x <= -4.4e-227) tmp = fma(Float64(0.5 * x), fma(Float64(eps - 1.0), t_0, Float64(Float64(1.0 - Float64(eps * eps)) / eps)), 1.0); else tmp = Float64(Float64(Float64(exp(Float64(x * eps)) * 1.0) - -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[x, -7.6e+87], N[(N[(t$95$0 - N[(N[(eps - -1.0), $MachinePrecision] * x + -1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -4.4e-227], N[(N[(0.5 * x), $MachinePrecision] * N[(N[(eps - 1.0), $MachinePrecision] * t$95$0 + N[(N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(N[(N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\varepsilon} + 1\\
\mathbf{if}\;x \leq -7.6 \cdot 10^{+87}:\\
\;\;\;\;\frac{t\_0 - \mathsf{fma}\left(\varepsilon - -1, x, -1\right)}{2}\\
\mathbf{elif}\;x \leq -4.4 \cdot 10^{-227}:\\
\;\;\;\;\mathsf{fma}\left(0.5 \cdot x, \mathsf{fma}\left(\varepsilon - 1, t\_0, \frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon}\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot \varepsilon} \cdot 1 - -1}{2}\\
\end{array}
\end{array}
if x < -7.60000000000000022e87Initial 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.3%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
lower-/.f643.1
Applied rewrites3.1%
Taylor expanded in x around 0
Applied rewrites37.9%
if -7.60000000000000022e87 < x < -4.39999999999999962e-227Initial program 53.4%
Taylor expanded in x around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites66.7%
Taylor expanded in eps around 0
Applied rewrites80.0%
if -4.39999999999999962e-227 < x Initial program 75.6%
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.f6474.4
Applied rewrites74.4%
Taylor expanded in x around 0
Applied rewrites37.3%
Taylor expanded in eps around inf
lower-*.f6437.1
Applied rewrites37.1%
Taylor expanded in eps around inf
Applied rewrites62.8%
Final simplification65.2%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (/ 1.0 eps) 1.0)))
(if (<= x -7.6e+87)
(/ (- t_0 (fma (- eps -1.0) x -1.0)) 2.0)
(if (<= x -4.4e-227)
(fma (* 0.5 x) (fma (- eps 1.0) t_0 (/ (- 1.0 (* eps eps)) eps)) 1.0)
(if (<= x 550.0)
(fma (* 0.5 x) (fma (- eps 1.0) t_0 (/ 1.0 eps)) 1.0)
(if (<= x 6.5e+104)
(/ (- t_0 (/ (- 1.0 eps) eps)) 2.0)
(fma (* 0.3333333333333333 x) (* x x) 1.0)))))))
double code(double x, double eps) {
double t_0 = (1.0 / eps) + 1.0;
double tmp;
if (x <= -7.6e+87) {
tmp = (t_0 - fma((eps - -1.0), x, -1.0)) / 2.0;
} else if (x <= -4.4e-227) {
tmp = fma((0.5 * x), fma((eps - 1.0), t_0, ((1.0 - (eps * eps)) / eps)), 1.0);
} else if (x <= 550.0) {
tmp = fma((0.5 * x), fma((eps - 1.0), t_0, (1.0 / eps)), 1.0);
} else if (x <= 6.5e+104) {
tmp = (t_0 - ((1.0 - eps) / eps)) / 2.0;
} else {
tmp = fma((0.3333333333333333 * x), (x * x), 1.0);
}
return tmp;
}
function code(x, eps) t_0 = Float64(Float64(1.0 / eps) + 1.0) tmp = 0.0 if (x <= -7.6e+87) tmp = Float64(Float64(t_0 - fma(Float64(eps - -1.0), x, -1.0)) / 2.0); elseif (x <= -4.4e-227) tmp = fma(Float64(0.5 * x), fma(Float64(eps - 1.0), t_0, Float64(Float64(1.0 - Float64(eps * eps)) / eps)), 1.0); elseif (x <= 550.0) tmp = fma(Float64(0.5 * x), fma(Float64(eps - 1.0), t_0, Float64(1.0 / eps)), 1.0); elseif (x <= 6.5e+104) tmp = Float64(Float64(t_0 - Float64(Float64(1.0 - eps) / eps)) / 2.0); else tmp = fma(Float64(0.3333333333333333 * x), Float64(x * x), 1.0); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -7.6e+87], N[(N[(t$95$0 - N[(N[(eps - -1.0), $MachinePrecision] * x + -1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, -4.4e-227], N[(N[(0.5 * x), $MachinePrecision] * N[(N[(eps - 1.0), $MachinePrecision] * t$95$0 + N[(N[(1.0 - N[(eps * eps), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 550.0], N[(N[(0.5 * x), $MachinePrecision] * N[(N[(eps - 1.0), $MachinePrecision] * t$95$0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 6.5e+104], N[(N[(t$95$0 - N[(N[(1.0 - eps), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(0.3333333333333333 * x), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\varepsilon} + 1\\
\mathbf{if}\;x \leq -7.6 \cdot 10^{+87}:\\
\;\;\;\;\frac{t\_0 - \mathsf{fma}\left(\varepsilon - -1, x, -1\right)}{2}\\
\mathbf{elif}\;x \leq -4.4 \cdot 10^{-227}:\\
\;\;\;\;\mathsf{fma}\left(0.5 \cdot x, \mathsf{fma}\left(\varepsilon - 1, t\_0, \frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon}\right), 1\right)\\
\mathbf{elif}\;x \leq 550:\\
\;\;\;\;\mathsf{fma}\left(0.5 \cdot x, \mathsf{fma}\left(\varepsilon - 1, t\_0, \frac{1}{\varepsilon}\right), 1\right)\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+104}:\\
\;\;\;\;\frac{t\_0 - \frac{1 - \varepsilon}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.3333333333333333 \cdot x, x \cdot x, 1\right)\\
\end{array}
\end{array}
if x < -7.60000000000000022e87Initial 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.3%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
lower-/.f643.1
Applied rewrites3.1%
Taylor expanded in x around 0
Applied rewrites37.9%
if -7.60000000000000022e87 < x < -4.39999999999999962e-227Initial program 53.4%
Taylor expanded in x around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites66.7%
Taylor expanded in eps around 0
Applied rewrites80.0%
if -4.39999999999999962e-227 < x < 550Initial program 55.7%
Taylor expanded in x around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites76.1%
Taylor expanded in eps around 0
Applied rewrites75.6%
if 550 < x < 6.5000000000000005e104Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
lower-/.f6431.9
Applied rewrites31.9%
Taylor expanded in x around 0
*-inversesN/A
div-subN/A
sub-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f6446.7
Applied rewrites46.7%
if 6.5000000000000005e104 < x Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites37.9%
Taylor expanded in x around 0
Applied rewrites63.6%
Taylor expanded in x around inf
Applied rewrites63.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (/ 1.0 eps) 1.0)))
(if (<= x -25.5)
(/ (- t_0 (fma (- eps -1.0) x -1.0)) 2.0)
(if (<= x 8e-17)
(fma (fma (fma -0.125 x 0.3333333333333333) x -0.5) (* x x) 1.0)
(if (<= x 6.5e+104)
(/ (- t_0 (/ (- 1.0 eps) eps)) 2.0)
(fma (* 0.3333333333333333 x) (* x x) 1.0))))))
double code(double x, double eps) {
double t_0 = (1.0 / eps) + 1.0;
double tmp;
if (x <= -25.5) {
tmp = (t_0 - fma((eps - -1.0), x, -1.0)) / 2.0;
} else if (x <= 8e-17) {
tmp = fma(fma(fma(-0.125, x, 0.3333333333333333), x, -0.5), (x * x), 1.0);
} else if (x <= 6.5e+104) {
tmp = (t_0 - ((1.0 - eps) / eps)) / 2.0;
} else {
tmp = fma((0.3333333333333333 * x), (x * x), 1.0);
}
return tmp;
}
function code(x, eps) t_0 = Float64(Float64(1.0 / eps) + 1.0) tmp = 0.0 if (x <= -25.5) tmp = Float64(Float64(t_0 - fma(Float64(eps - -1.0), x, -1.0)) / 2.0); elseif (x <= 8e-17) tmp = fma(fma(fma(-0.125, x, 0.3333333333333333), x, -0.5), Float64(x * x), 1.0); elseif (x <= 6.5e+104) tmp = Float64(Float64(t_0 - Float64(Float64(1.0 - eps) / eps)) / 2.0); else tmp = fma(Float64(0.3333333333333333 * x), Float64(x * x), 1.0); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -25.5], N[(N[(t$95$0 - N[(N[(eps - -1.0), $MachinePrecision] * x + -1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 8e-17], N[(N[(N[(-0.125 * x + 0.3333333333333333), $MachinePrecision] * x + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 6.5e+104], N[(N[(t$95$0 - N[(N[(1.0 - eps), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(0.3333333333333333 * x), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\varepsilon} + 1\\
\mathbf{if}\;x \leq -25.5:\\
\;\;\;\;\frac{t\_0 - \mathsf{fma}\left(\varepsilon - -1, x, -1\right)}{2}\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-17}:\\
\;\;\;\;\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 6.5 \cdot 10^{+104}:\\
\;\;\;\;\frac{t\_0 - \frac{1 - \varepsilon}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.3333333333333333 \cdot x, x \cdot x, 1\right)\\
\end{array}
\end{array}
if x < -25.5Initial 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 rewrites44.6%
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.1%
if -25.5 < x < 8.00000000000000057e-17Initial program 49.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites79.0%
Taylor expanded in x around 0
Applied rewrites79.0%
if 8.00000000000000057e-17 < x < 6.5000000000000005e104Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
lower-/.f6432.3
Applied rewrites32.3%
Taylor expanded in x around 0
*-inversesN/A
div-subN/A
sub-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f6441.0
Applied rewrites41.0%
if 6.5000000000000005e104 < x Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites37.9%
Taylor expanded in x around 0
Applied rewrites63.6%
Taylor expanded in x around inf
Applied rewrites63.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (/ 1.0 eps) 1.0)))
(if (<= x -25.5)
(/ (- t_0 (fma (- eps -1.0) x -1.0)) 2.0)
(if (<= x 1.8)
(fma (fma (fma -0.125 x 0.3333333333333333) x -0.5) (* x x) 1.0)
(if (<= x 6.5e+104)
(/ (- t_0 (/ 1.0 eps)) 2.0)
(fma (* 0.3333333333333333 x) (* x x) 1.0))))))
double code(double x, double eps) {
double t_0 = (1.0 / eps) + 1.0;
double tmp;
if (x <= -25.5) {
tmp = (t_0 - fma((eps - -1.0), x, -1.0)) / 2.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 <= 6.5e+104) {
tmp = (t_0 - (1.0 / eps)) / 2.0;
} else {
tmp = fma((0.3333333333333333 * x), (x * x), 1.0);
}
return tmp;
}
function code(x, eps) t_0 = Float64(Float64(1.0 / eps) + 1.0) tmp = 0.0 if (x <= -25.5) tmp = Float64(Float64(t_0 - fma(Float64(eps - -1.0), x, -1.0)) / 2.0); elseif (x <= 1.8) tmp = fma(fma(fma(-0.125, x, 0.3333333333333333), x, -0.5), Float64(x * x), 1.0); elseif (x <= 6.5e+104) tmp = Float64(Float64(t_0 - Float64(1.0 / eps)) / 2.0); else tmp = fma(Float64(0.3333333333333333 * x), Float64(x * x), 1.0); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -25.5], N[(N[(t$95$0 - N[(N[(eps - -1.0), $MachinePrecision] * x + -1.0), $MachinePrecision]), $MachinePrecision] / 2.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, 6.5e+104], N[(N[(t$95$0 - N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(0.3333333333333333 * x), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\varepsilon} + 1\\
\mathbf{if}\;x \leq -25.5:\\
\;\;\;\;\frac{t\_0 - \mathsf{fma}\left(\varepsilon - -1, x, -1\right)}{2}\\
\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 6.5 \cdot 10^{+104}:\\
\;\;\;\;\frac{t\_0 - \frac{1}{\varepsilon}}{2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.3333333333333333 \cdot x, x \cdot x, 1\right)\\
\end{array}
\end{array}
if x < -25.5Initial 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 rewrites44.6%
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.1%
if -25.5 < x < 1.80000000000000004Initial program 50.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.5%
Taylor expanded in x around 0
Applied rewrites77.5%
if 1.80000000000000004 < x < 6.5000000000000005e104Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
lower-+.f64N/A
lower-/.f6431.9
Applied rewrites31.9%
Taylor expanded in x around 0
*-inversesN/A
div-subN/A
sub-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f6446.7
Applied rewrites46.7%
Taylor expanded in eps around 0
Applied rewrites46.7%
if 6.5000000000000005e104 < x Initial program 100.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites37.9%
Taylor expanded in x around 0
Applied rewrites63.6%
Taylor expanded in x around inf
Applied rewrites63.6%
(FPCore (x eps) :precision binary64 (if (<= x -25.5) (/ (- (+ (/ 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 <= -25.5) {
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 <= -25.5) tmp = Float64(Float64(Float64(Float64(1.0 / eps) + 1.0) - fma(Float64(eps - -1.0), x, -1.0)) / 2.0); else tmp = fma(Float64(fma(0.3333333333333333, x, -0.5) * x), x, 1.0); end return tmp end
code[x_, eps_] := If[LessEqual[x, -25.5], 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[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * x), $MachinePrecision] * x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -25.5:\\
\;\;\;\;\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) \cdot x, x, 1\right)\\
\end{array}
\end{array}
if x < -25.5Initial 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 rewrites44.6%
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.1%
if -25.5 < x Initial program 66.0%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.0%
Taylor expanded in x around 0
Applied rewrites67.6%
Applied rewrites67.6%
(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(Float64(fma(0.3333333333333333, x, -0.5) * x), x, 1.0) end
code[x_, eps_] := N[(N[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * x), $MachinePrecision] * x + 1.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right) \cdot x, x, 1\right)
\end{array}
Initial program 71.6%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites55.2%
Taylor expanded in x around 0
Applied rewrites56.6%
Applied rewrites56.6%
(FPCore (x eps) :precision binary64 (fma (* 0.3333333333333333 x) (* x x) 1.0))
double code(double x, double eps) {
return fma((0.3333333333333333 * x), (x * x), 1.0);
}
function code(x, eps) return fma(Float64(0.3333333333333333 * x), Float64(x * x), 1.0) end
code[x_, eps_] := N[(N[(0.3333333333333333 * x), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(0.3333333333333333 \cdot x, x \cdot x, 1\right)
\end{array}
Initial program 71.6%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites55.2%
Taylor expanded in x around 0
Applied rewrites56.6%
Taylor expanded in x around inf
Applied rewrites56.3%
(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 71.6%
Taylor expanded in x around 0
Applied rewrites45.8%
herbie shell --seed 2024255
(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))