\[\left(e^{x} - 2\right) + e^{-x}
\]
↓
\[\begin{array}{l}
t_0 := e^{\frac{x}{-2}}\\
\mathbf{if}\;\left(e^{x} - 2\right) + e^{-x} \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(0.002777777777777778, {x}^{6}, \mathsf{fma}\left(x, x, 0.08333333333333333 \cdot {x}^{4}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t_0, t_0, e^{x} + -2\right)\\
\end{array}
\]
(FPCore (x) :precision binary64 (+ (- (exp x) 2.0) (exp (- x))))
↓
(FPCore (x)
:precision binary64
(let* ((t_0 (exp (/ x -2.0))))
(if (<= (+ (- (exp x) 2.0) (exp (- x))) 5e-6)
(fma
0.002777777777777778
(pow x 6.0)
(fma x x (* 0.08333333333333333 (pow x 4.0))))
(fma t_0 t_0 (+ (exp x) -2.0)))))double code(double x) {
return (exp(x) - 2.0) + exp(-x);
}
↓
double code(double x) {
double t_0 = exp((x / -2.0));
double tmp;
if (((exp(x) - 2.0) + exp(-x)) <= 5e-6) {
tmp = fma(0.002777777777777778, pow(x, 6.0), fma(x, x, (0.08333333333333333 * pow(x, 4.0))));
} else {
tmp = fma(t_0, t_0, (exp(x) + -2.0));
}
return tmp;
}
function code(x)
return Float64(Float64(exp(x) - 2.0) + exp(Float64(-x)))
end
↓
function code(x)
t_0 = exp(Float64(x / -2.0))
tmp = 0.0
if (Float64(Float64(exp(x) - 2.0) + exp(Float64(-x))) <= 5e-6)
tmp = fma(0.002777777777777778, (x ^ 6.0), fma(x, x, Float64(0.08333333333333333 * (x ^ 4.0))));
else
tmp = fma(t_0, t_0, Float64(exp(x) + -2.0));
end
return tmp
end
code[x_] := N[(N[(N[Exp[x], $MachinePrecision] - 2.0), $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]
↓
code[x_] := Block[{t$95$0 = N[Exp[N[(x / -2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(N[Exp[x], $MachinePrecision] - 2.0), $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], 5e-6], N[(0.002777777777777778 * N[Power[x, 6.0], $MachinePrecision] + N[(x * x + N[(0.08333333333333333 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * t$95$0 + N[(N[Exp[x], $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]]]
\left(e^{x} - 2\right) + e^{-x}
↓
\begin{array}{l}
t_0 := e^{\frac{x}{-2}}\\
\mathbf{if}\;\left(e^{x} - 2\right) + e^{-x} \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(0.002777777777777778, {x}^{6}, \mathsf{fma}\left(x, x, 0.08333333333333333 \cdot {x}^{4}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t_0, t_0, e^{x} + -2\right)\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 0.1 |
|---|
| Cost | 39428 |
|---|
\[\begin{array}{l}
t_0 := \left(e^{x} - 2\right) + e^{-x}\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(0.002777777777777778, {x}^{6}, \mathsf{fma}\left(x, x, 0.08333333333333333 \cdot {x}^{4}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.1 |
|---|
| Cost | 26436 |
|---|
\[\begin{array}{l}
t_0 := \left(e^{x} - 2\right) + e^{-x}\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{-6}:\\
\;\;\;\;\left(x + \left(x \cdot x\right) \cdot \left(x \cdot 0.08333333333333333\right)\right) \cdot x + 0.002777777777777778 \cdot {x}^{6}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 0.7 |
|---|
| Cost | 7424 |
|---|
\[\left(x + \left(x \cdot x\right) \cdot \left(x \cdot 0.08333333333333333\right)\right) \cdot x + 0.002777777777777778 \cdot {x}^{6}
\]
| Alternative 4 |
|---|
| Error | 0.8 |
|---|
| Cost | 704 |
|---|
\[\left(0.08333333333333333 \cdot \left(x \cdot x\right) + 1\right) \cdot \left(x \cdot x\right)
\]
| Alternative 5 |
|---|
| Error | 1.2 |
|---|
| Cost | 192 |
|---|
\[x \cdot x
\]
| Alternative 6 |
|---|
| Error | 60.2 |
|---|
| Cost | 128 |
|---|
\[-x
\]
| Alternative 7 |
|---|
| Error | 60.2 |
|---|
| Cost | 64 |
|---|
\[x
\]