exp2 (problem 3.3.7)

Percentage Accurate: 53.4% → 99.7%
Time: 12.8s
Alternatives: 9
Speedup: 34.8×

Specification

?
\[\left|x\right| \leq 710\]
\[\begin{array}{l} \\ \left(e^{x} - 2\right) + e^{-x} \end{array} \]
(FPCore (x) :precision binary64 (+ (- (exp x) 2.0) (exp (- x))))
double code(double x) {
	return (exp(x) - 2.0) + exp(-x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (exp(x) - 2.0d0) + exp(-x)
end function
public static double code(double x) {
	return (Math.exp(x) - 2.0) + Math.exp(-x);
}
def code(x):
	return (math.exp(x) - 2.0) + math.exp(-x)
function code(x)
	return Float64(Float64(exp(x) - 2.0) + exp(Float64(-x)))
end
function tmp = code(x)
	tmp = (exp(x) - 2.0) + exp(-x);
end
code[x_] := N[(N[(N[Exp[x], $MachinePrecision] - 2.0), $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(e^{x} - 2\right) + e^{-x}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 53.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(e^{x} - 2\right) + e^{-x} \end{array} \]
(FPCore (x) :precision binary64 (+ (- (exp x) 2.0) (exp (- x))))
double code(double x) {
	return (exp(x) - 2.0) + exp(-x);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = (exp(x) - 2.0d0) + exp(-x)
end function
public static double code(double x) {
	return (Math.exp(x) - 2.0) + Math.exp(-x);
}
def code(x):
	return (math.exp(x) - 2.0) + math.exp(-x)
function code(x)
	return Float64(Float64(exp(x) - 2.0) + exp(Float64(-x)))
end
function tmp = code(x)
	tmp = (exp(x) - 2.0) + exp(-x);
end
code[x_] := N[(N[(N[Exp[x], $MachinePrecision] - 2.0), $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(e^{x} - 2\right) + e^{-x}
\end{array}

Alternative 1: 99.7% accurate, 0.2× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} t_0 := e^{x\_m} - 2\\ \mathbf{if}\;e^{-x\_m} + t\_0 \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(x\_m, x\_m, \left(\left(0.08333333333333333 \cdot \left(x\_m \cdot x\_m\right)\right) \cdot x\_m\right) \cdot x\_m\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{{t\_0}^{3} + {\left(e^{x\_m}\right)}^{-3}}{\mathsf{fma}\left(t\_0, \sinh x\_m \cdot 2 + -2, e^{-2 \cdot x\_m}\right)}\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m)
 :precision binary64
 (let* ((t_0 (- (exp x_m) 2.0)))
   (if (<= (+ (exp (- x_m)) t_0) 2e-7)
     (fma x_m x_m (* (* (* 0.08333333333333333 (* x_m x_m)) x_m) x_m))
     (/
      (+ (pow t_0 3.0) (pow (exp x_m) -3.0))
      (fma t_0 (+ (* (sinh x_m) 2.0) -2.0) (exp (* -2.0 x_m)))))))
x_m = fabs(x);
double code(double x_m) {
	double t_0 = exp(x_m) - 2.0;
	double tmp;
	if ((exp(-x_m) + t_0) <= 2e-7) {
		tmp = fma(x_m, x_m, (((0.08333333333333333 * (x_m * x_m)) * x_m) * x_m));
	} else {
		tmp = (pow(t_0, 3.0) + pow(exp(x_m), -3.0)) / fma(t_0, ((sinh(x_m) * 2.0) + -2.0), exp((-2.0 * x_m)));
	}
	return tmp;
}
x_m = abs(x)
function code(x_m)
	t_0 = Float64(exp(x_m) - 2.0)
	tmp = 0.0
	if (Float64(exp(Float64(-x_m)) + t_0) <= 2e-7)
		tmp = fma(x_m, x_m, Float64(Float64(Float64(0.08333333333333333 * Float64(x_m * x_m)) * x_m) * x_m));
	else
		tmp = Float64(Float64((t_0 ^ 3.0) + (exp(x_m) ^ -3.0)) / fma(t_0, Float64(Float64(sinh(x_m) * 2.0) + -2.0), exp(Float64(-2.0 * x_m))));
	end
	return tmp
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := Block[{t$95$0 = N[(N[Exp[x$95$m], $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[N[(N[Exp[(-x$95$m)], $MachinePrecision] + t$95$0), $MachinePrecision], 2e-7], N[(x$95$m * x$95$m + N[(N[(N[(0.08333333333333333 * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[t$95$0, 3.0], $MachinePrecision] + N[Power[N[Exp[x$95$m], $MachinePrecision], -3.0], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * N[(N[(N[Sinh[x$95$m], $MachinePrecision] * 2.0), $MachinePrecision] + -2.0), $MachinePrecision] + N[Exp[N[(-2.0 * x$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|

\\
\begin{array}{l}
t_0 := e^{x\_m} - 2\\
\mathbf{if}\;e^{-x\_m} + t\_0 \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(x\_m, x\_m, \left(\left(0.08333333333333333 \cdot \left(x\_m \cdot x\_m\right)\right) \cdot x\_m\right) \cdot x\_m\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{{t\_0}^{3} + {\left(e^{x\_m}\right)}^{-3}}{\mathsf{fma}\left(t\_0, \sinh x\_m \cdot 2 + -2, e^{-2 \cdot x\_m}\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (-.f64 (exp.f64 x) #s(literal 2 binary64)) (exp.f64 (neg.f64 x))) < 1.9999999999999999e-7

    1. Initial program 47.8%

      \[\left(e^{x} - 2\right) + e^{-x} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{{x}^{2} \cdot \left(1 + \frac{1}{12} \cdot {x}^{2}\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto {x}^{2} \cdot \color{blue}{\left(\frac{1}{12} \cdot {x}^{2} + 1\right)} \]
      2. distribute-lft-inN/A

        \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{12} \cdot {x}^{2}\right) + {x}^{2} \cdot 1} \]
      3. *-commutativeN/A

        \[\leadsto {x}^{2} \cdot \color{blue}{\left({x}^{2} \cdot \frac{1}{12}\right)} + {x}^{2} \cdot 1 \]
      4. associate-*r*N/A

        \[\leadsto \color{blue}{\left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{1}{12}} + {x}^{2} \cdot 1 \]
      5. *-rgt-identityN/A

        \[\leadsto \left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{1}{12} + \color{blue}{{x}^{2}} \]
      6. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{2} \cdot {x}^{2}, \frac{1}{12}, {x}^{2}\right)} \]
      7. pow-sqrN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{{x}^{\left(2 \cdot 2\right)}}, \frac{1}{12}, {x}^{2}\right) \]
      8. lower-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{{x}^{\left(2 \cdot 2\right)}}, \frac{1}{12}, {x}^{2}\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left({x}^{\color{blue}{4}}, \frac{1}{12}, {x}^{2}\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{fma}\left({x}^{4}, \frac{1}{12}, \color{blue}{x \cdot x}\right) \]
      11. lower-*.f64100.0

        \[\leadsto \mathsf{fma}\left({x}^{4}, 0.08333333333333333, \color{blue}{x \cdot x}\right) \]
    5. Applied rewrites100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{4}, 0.08333333333333333, x \cdot x\right)} \]
    6. Step-by-step derivation
      1. Applied rewrites100.0%

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{x}, 0.08333333333333333 \cdot {x}^{4}\right) \]
      2. Step-by-step derivation
        1. Applied rewrites100.0%

          \[\leadsto \mathsf{fma}\left(x, x, x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.08333333333333333\right)\right)\right) \]

        if 1.9999999999999999e-7 < (+.f64 (-.f64 (exp.f64 x) #s(literal 2 binary64)) (exp.f64 (neg.f64 x)))

        1. Initial program 98.8%

          \[\left(e^{x} - 2\right) + e^{-x} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \color{blue}{\left(e^{x} - 2\right) + e^{-x}} \]
          2. flip3-+N/A

            \[\leadsto \color{blue}{\frac{{\left(e^{x} - 2\right)}^{3} + {\left(e^{-x}\right)}^{3}}{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) + \left(e^{-x} \cdot e^{-x} - \left(e^{x} - 2\right) \cdot e^{-x}\right)}} \]
          3. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{{\left(e^{x} - 2\right)}^{3} + {\left(e^{-x}\right)}^{3}}{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) + \left(e^{-x} \cdot e^{-x} - \left(e^{x} - 2\right) \cdot e^{-x}\right)}} \]
          4. +-commutativeN/A

            \[\leadsto \frac{\color{blue}{{\left(e^{-x}\right)}^{3} + {\left(e^{x} - 2\right)}^{3}}}{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) + \left(e^{-x} \cdot e^{-x} - \left(e^{x} - 2\right) \cdot e^{-x}\right)} \]
          5. lower-+.f64N/A

            \[\leadsto \frac{\color{blue}{{\left(e^{-x}\right)}^{3} + {\left(e^{x} - 2\right)}^{3}}}{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) + \left(e^{-x} \cdot e^{-x} - \left(e^{x} - 2\right) \cdot e^{-x}\right)} \]
          6. lift-exp.f64N/A

            \[\leadsto \frac{{\color{blue}{\left(e^{-x}\right)}}^{3} + {\left(e^{x} - 2\right)}^{3}}{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) + \left(e^{-x} \cdot e^{-x} - \left(e^{x} - 2\right) \cdot e^{-x}\right)} \]
          7. lift-neg.f64N/A

            \[\leadsto \frac{{\left(e^{\color{blue}{\mathsf{neg}\left(x\right)}}\right)}^{3} + {\left(e^{x} - 2\right)}^{3}}{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) + \left(e^{-x} \cdot e^{-x} - \left(e^{x} - 2\right) \cdot e^{-x}\right)} \]
          8. exp-negN/A

            \[\leadsto \frac{{\color{blue}{\left(\frac{1}{e^{x}}\right)}}^{3} + {\left(e^{x} - 2\right)}^{3}}{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) + \left(e^{-x} \cdot e^{-x} - \left(e^{x} - 2\right) \cdot e^{-x}\right)} \]
          9. lift-exp.f64N/A

            \[\leadsto \frac{{\left(\frac{1}{\color{blue}{e^{x}}}\right)}^{3} + {\left(e^{x} - 2\right)}^{3}}{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) + \left(e^{-x} \cdot e^{-x} - \left(e^{x} - 2\right) \cdot e^{-x}\right)} \]
          10. inv-powN/A

            \[\leadsto \frac{{\color{blue}{\left({\left(e^{x}\right)}^{-1}\right)}}^{3} + {\left(e^{x} - 2\right)}^{3}}{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) + \left(e^{-x} \cdot e^{-x} - \left(e^{x} - 2\right) \cdot e^{-x}\right)} \]
          11. pow-powN/A

            \[\leadsto \frac{\color{blue}{{\left(e^{x}\right)}^{\left(-1 \cdot 3\right)}} + {\left(e^{x} - 2\right)}^{3}}{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) + \left(e^{-x} \cdot e^{-x} - \left(e^{x} - 2\right) \cdot e^{-x}\right)} \]
          12. lower-pow.f64N/A

            \[\leadsto \frac{\color{blue}{{\left(e^{x}\right)}^{\left(-1 \cdot 3\right)}} + {\left(e^{x} - 2\right)}^{3}}{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) + \left(e^{-x} \cdot e^{-x} - \left(e^{x} - 2\right) \cdot e^{-x}\right)} \]
          13. metadata-evalN/A

            \[\leadsto \frac{{\left(e^{x}\right)}^{\color{blue}{-3}} + {\left(e^{x} - 2\right)}^{3}}{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) + \left(e^{-x} \cdot e^{-x} - \left(e^{x} - 2\right) \cdot e^{-x}\right)} \]
          14. lower-pow.f64N/A

            \[\leadsto \frac{{\left(e^{x}\right)}^{-3} + \color{blue}{{\left(e^{x} - 2\right)}^{3}}}{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) + \left(e^{-x} \cdot e^{-x} - \left(e^{x} - 2\right) \cdot e^{-x}\right)} \]
          15. associate-+r-N/A

            \[\leadsto \frac{{\left(e^{x}\right)}^{-3} + {\left(e^{x} - 2\right)}^{3}}{\color{blue}{\left(\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) + e^{-x} \cdot e^{-x}\right) - \left(e^{x} - 2\right) \cdot e^{-x}}} \]
        4. Applied rewrites98.6%

          \[\leadsto \color{blue}{\frac{{\left(e^{x}\right)}^{-3} + {\left(e^{x} - 2\right)}^{3}}{\mathsf{fma}\left(e^{x} - 2, -2 + 2 \cdot \sinh x, {\left(e^{x}\right)}^{-2}\right)}} \]
        5. Step-by-step derivation
          1. lift-pow.f64N/A

            \[\leadsto \frac{{\left(e^{x}\right)}^{-3} + {\left(e^{x} - 2\right)}^{3}}{\mathsf{fma}\left(e^{x} - 2, -2 + 2 \cdot \sinh x, \color{blue}{{\left(e^{x}\right)}^{-2}}\right)} \]
          2. lift-exp.f64N/A

            \[\leadsto \frac{{\left(e^{x}\right)}^{-3} + {\left(e^{x} - 2\right)}^{3}}{\mathsf{fma}\left(e^{x} - 2, -2 + 2 \cdot \sinh x, {\color{blue}{\left(e^{x}\right)}}^{-2}\right)} \]
          3. pow-expN/A

            \[\leadsto \frac{{\left(e^{x}\right)}^{-3} + {\left(e^{x} - 2\right)}^{3}}{\mathsf{fma}\left(e^{x} - 2, -2 + 2 \cdot \sinh x, \color{blue}{e^{x \cdot -2}}\right)} \]
          4. lower-exp.f64N/A

            \[\leadsto \frac{{\left(e^{x}\right)}^{-3} + {\left(e^{x} - 2\right)}^{3}}{\mathsf{fma}\left(e^{x} - 2, -2 + 2 \cdot \sinh x, \color{blue}{e^{x \cdot -2}}\right)} \]
          5. *-commutativeN/A

            \[\leadsto \frac{{\left(e^{x}\right)}^{-3} + {\left(e^{x} - 2\right)}^{3}}{\mathsf{fma}\left(e^{x} - 2, -2 + 2 \cdot \sinh x, e^{\color{blue}{-2 \cdot x}}\right)} \]
          6. lower-*.f6498.3

            \[\leadsto \frac{{\left(e^{x}\right)}^{-3} + {\left(e^{x} - 2\right)}^{3}}{\mathsf{fma}\left(e^{x} - 2, -2 + 2 \cdot \sinh x, e^{\color{blue}{-2 \cdot x}}\right)} \]
        6. Applied rewrites98.3%

          \[\leadsto \frac{{\left(e^{x}\right)}^{-3} + {\left(e^{x} - 2\right)}^{3}}{\mathsf{fma}\left(e^{x} - 2, -2 + 2 \cdot \sinh x, \color{blue}{e^{-2 \cdot x}}\right)} \]
      3. Recombined 2 regimes into one program.
      4. Final simplification100.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;e^{-x} + \left(e^{x} - 2\right) \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(x, x, \left(\left(0.08333333333333333 \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(e^{x} - 2\right)}^{3} + {\left(e^{x}\right)}^{-3}}{\mathsf{fma}\left(e^{x} - 2, \sinh x \cdot 2 + -2, e^{-2 \cdot x}\right)}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 2: 99.7% accurate, 0.3× speedup?

      \[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} t_0 := e^{x\_m} - 2\\ \mathbf{if}\;e^{-x\_m} + t\_0 \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(x\_m, x\_m, \left(\left(0.08333333333333333 \cdot \left(x\_m \cdot x\_m\right)\right) \cdot x\_m\right) \cdot x\_m\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(t\_0, t\_0, -{\left(e^{x\_m}\right)}^{-2}\right)}{\sinh x\_m \cdot 2 + -2}\\ \end{array} \end{array} \]
      x_m = (fabs.f64 x)
      (FPCore (x_m)
       :precision binary64
       (let* ((t_0 (- (exp x_m) 2.0)))
         (if (<= (+ (exp (- x_m)) t_0) 2e-7)
           (fma x_m x_m (* (* (* 0.08333333333333333 (* x_m x_m)) x_m) x_m))
           (/ (fma t_0 t_0 (- (pow (exp x_m) -2.0))) (+ (* (sinh x_m) 2.0) -2.0)))))
      x_m = fabs(x);
      double code(double x_m) {
      	double t_0 = exp(x_m) - 2.0;
      	double tmp;
      	if ((exp(-x_m) + t_0) <= 2e-7) {
      		tmp = fma(x_m, x_m, (((0.08333333333333333 * (x_m * x_m)) * x_m) * x_m));
      	} else {
      		tmp = fma(t_0, t_0, -pow(exp(x_m), -2.0)) / ((sinh(x_m) * 2.0) + -2.0);
      	}
      	return tmp;
      }
      
      x_m = abs(x)
      function code(x_m)
      	t_0 = Float64(exp(x_m) - 2.0)
      	tmp = 0.0
      	if (Float64(exp(Float64(-x_m)) + t_0) <= 2e-7)
      		tmp = fma(x_m, x_m, Float64(Float64(Float64(0.08333333333333333 * Float64(x_m * x_m)) * x_m) * x_m));
      	else
      		tmp = Float64(fma(t_0, t_0, Float64(-(exp(x_m) ^ -2.0))) / Float64(Float64(sinh(x_m) * 2.0) + -2.0));
      	end
      	return tmp
      end
      
      x_m = N[Abs[x], $MachinePrecision]
      code[x$95$m_] := Block[{t$95$0 = N[(N[Exp[x$95$m], $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[N[(N[Exp[(-x$95$m)], $MachinePrecision] + t$95$0), $MachinePrecision], 2e-7], N[(x$95$m * x$95$m + N[(N[(N[(0.08333333333333333 * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * t$95$0 + (-N[Power[N[Exp[x$95$m], $MachinePrecision], -2.0], $MachinePrecision])), $MachinePrecision] / N[(N[(N[Sinh[x$95$m], $MachinePrecision] * 2.0), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]]]
      
      \begin{array}{l}
      x_m = \left|x\right|
      
      \\
      \begin{array}{l}
      t_0 := e^{x\_m} - 2\\
      \mathbf{if}\;e^{-x\_m} + t\_0 \leq 2 \cdot 10^{-7}:\\
      \;\;\;\;\mathsf{fma}\left(x\_m, x\_m, \left(\left(0.08333333333333333 \cdot \left(x\_m \cdot x\_m\right)\right) \cdot x\_m\right) \cdot x\_m\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\mathsf{fma}\left(t\_0, t\_0, -{\left(e^{x\_m}\right)}^{-2}\right)}{\sinh x\_m \cdot 2 + -2}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (+.f64 (-.f64 (exp.f64 x) #s(literal 2 binary64)) (exp.f64 (neg.f64 x))) < 1.9999999999999999e-7

        1. Initial program 47.8%

          \[\left(e^{x} - 2\right) + e^{-x} \]
        2. Add Preprocessing
        3. Taylor expanded in x around 0

          \[\leadsto \color{blue}{{x}^{2} \cdot \left(1 + \frac{1}{12} \cdot {x}^{2}\right)} \]
        4. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto {x}^{2} \cdot \color{blue}{\left(\frac{1}{12} \cdot {x}^{2} + 1\right)} \]
          2. distribute-lft-inN/A

            \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{12} \cdot {x}^{2}\right) + {x}^{2} \cdot 1} \]
          3. *-commutativeN/A

            \[\leadsto {x}^{2} \cdot \color{blue}{\left({x}^{2} \cdot \frac{1}{12}\right)} + {x}^{2} \cdot 1 \]
          4. associate-*r*N/A

            \[\leadsto \color{blue}{\left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{1}{12}} + {x}^{2} \cdot 1 \]
          5. *-rgt-identityN/A

            \[\leadsto \left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{1}{12} + \color{blue}{{x}^{2}} \]
          6. lower-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{2} \cdot {x}^{2}, \frac{1}{12}, {x}^{2}\right)} \]
          7. pow-sqrN/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{{x}^{\left(2 \cdot 2\right)}}, \frac{1}{12}, {x}^{2}\right) \]
          8. lower-pow.f64N/A

            \[\leadsto \mathsf{fma}\left(\color{blue}{{x}^{\left(2 \cdot 2\right)}}, \frac{1}{12}, {x}^{2}\right) \]
          9. metadata-evalN/A

            \[\leadsto \mathsf{fma}\left({x}^{\color{blue}{4}}, \frac{1}{12}, {x}^{2}\right) \]
          10. unpow2N/A

            \[\leadsto \mathsf{fma}\left({x}^{4}, \frac{1}{12}, \color{blue}{x \cdot x}\right) \]
          11. lower-*.f64100.0

            \[\leadsto \mathsf{fma}\left({x}^{4}, 0.08333333333333333, \color{blue}{x \cdot x}\right) \]
        5. Applied rewrites100.0%

          \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{4}, 0.08333333333333333, x \cdot x\right)} \]
        6. Step-by-step derivation
          1. Applied rewrites100.0%

            \[\leadsto \mathsf{fma}\left(x, \color{blue}{x}, 0.08333333333333333 \cdot {x}^{4}\right) \]
          2. Step-by-step derivation
            1. Applied rewrites100.0%

              \[\leadsto \mathsf{fma}\left(x, x, x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.08333333333333333\right)\right)\right) \]

            if 1.9999999999999999e-7 < (+.f64 (-.f64 (exp.f64 x) #s(literal 2 binary64)) (exp.f64 (neg.f64 x)))

            1. Initial program 98.8%

              \[\left(e^{x} - 2\right) + e^{-x} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-+.f64N/A

                \[\leadsto \color{blue}{\left(e^{x} - 2\right) + e^{-x}} \]
              2. flip-+N/A

                \[\leadsto \color{blue}{\frac{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) - e^{-x} \cdot e^{-x}}{\left(e^{x} - 2\right) - e^{-x}}} \]
              3. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) - e^{-x} \cdot e^{-x}}{\left(e^{x} - 2\right) - e^{-x}}} \]
              4. lower--.f64N/A

                \[\leadsto \frac{\color{blue}{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) - e^{-x} \cdot e^{-x}}}{\left(e^{x} - 2\right) - e^{-x}} \]
              5. pow2N/A

                \[\leadsto \frac{\color{blue}{{\left(e^{x} - 2\right)}^{2}} - e^{-x} \cdot e^{-x}}{\left(e^{x} - 2\right) - e^{-x}} \]
              6. lower-pow.f64N/A

                \[\leadsto \frac{\color{blue}{{\left(e^{x} - 2\right)}^{2}} - e^{-x} \cdot e^{-x}}{\left(e^{x} - 2\right) - e^{-x}} \]
              7. pow2N/A

                \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - \color{blue}{{\left(e^{-x}\right)}^{2}}}{\left(e^{x} - 2\right) - e^{-x}} \]
              8. lift-exp.f64N/A

                \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - {\color{blue}{\left(e^{-x}\right)}}^{2}}{\left(e^{x} - 2\right) - e^{-x}} \]
              9. lift-neg.f64N/A

                \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - {\left(e^{\color{blue}{\mathsf{neg}\left(x\right)}}\right)}^{2}}{\left(e^{x} - 2\right) - e^{-x}} \]
              10. exp-negN/A

                \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - {\color{blue}{\left(\frac{1}{e^{x}}\right)}}^{2}}{\left(e^{x} - 2\right) - e^{-x}} \]
              11. lift-exp.f64N/A

                \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - {\left(\frac{1}{\color{blue}{e^{x}}}\right)}^{2}}{\left(e^{x} - 2\right) - e^{-x}} \]
              12. inv-powN/A

                \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - {\color{blue}{\left({\left(e^{x}\right)}^{-1}\right)}}^{2}}{\left(e^{x} - 2\right) - e^{-x}} \]
              13. pow-powN/A

                \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - \color{blue}{{\left(e^{x}\right)}^{\left(-1 \cdot 2\right)}}}{\left(e^{x} - 2\right) - e^{-x}} \]
              14. metadata-evalN/A

                \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - {\left(e^{x}\right)}^{\color{blue}{-2}}}{\left(e^{x} - 2\right) - e^{-x}} \]
              15. metadata-evalN/A

                \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - {\left(e^{x}\right)}^{\color{blue}{\left(\mathsf{neg}\left(2\right)\right)}}}{\left(e^{x} - 2\right) - e^{-x}} \]
              16. lower-pow.f64N/A

                \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - \color{blue}{{\left(e^{x}\right)}^{\left(\mathsf{neg}\left(2\right)\right)}}}{\left(e^{x} - 2\right) - e^{-x}} \]
              17. metadata-evalN/A

                \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - {\left(e^{x}\right)}^{\color{blue}{-2}}}{\left(e^{x} - 2\right) - e^{-x}} \]
            4. Applied rewrites97.9%

              \[\leadsto \color{blue}{\frac{{\left(e^{x} - 2\right)}^{2} - {\left(e^{x}\right)}^{-2}}{-2 + 2 \cdot \sinh x}} \]
            5. Step-by-step derivation
              1. lift--.f64N/A

                \[\leadsto \frac{\color{blue}{{\left(e^{x} - 2\right)}^{2} - {\left(e^{x}\right)}^{-2}}}{-2 + 2 \cdot \sinh x} \]
              2. sub-negN/A

                \[\leadsto \frac{\color{blue}{{\left(e^{x} - 2\right)}^{2} + \left(\mathsf{neg}\left({\left(e^{x}\right)}^{-2}\right)\right)}}{-2 + 2 \cdot \sinh x} \]
              3. lift-pow.f64N/A

                \[\leadsto \frac{\color{blue}{{\left(e^{x} - 2\right)}^{2}} + \left(\mathsf{neg}\left({\left(e^{x}\right)}^{-2}\right)\right)}{-2 + 2 \cdot \sinh x} \]
              4. unpow2N/A

                \[\leadsto \frac{\color{blue}{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right)} + \left(\mathsf{neg}\left({\left(e^{x}\right)}^{-2}\right)\right)}{-2 + 2 \cdot \sinh x} \]
              5. lower-fma.f64N/A

                \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(e^{x} - 2, e^{x} - 2, \mathsf{neg}\left({\left(e^{x}\right)}^{-2}\right)\right)}}{-2 + 2 \cdot \sinh x} \]
              6. lower-neg.f6498.2

                \[\leadsto \frac{\mathsf{fma}\left(e^{x} - 2, e^{x} - 2, \color{blue}{-{\left(e^{x}\right)}^{-2}}\right)}{-2 + 2 \cdot \sinh x} \]
            6. Applied rewrites98.2%

              \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(e^{x} - 2, e^{x} - 2, -{\left(e^{x}\right)}^{-2}\right)}}{-2 + 2 \cdot \sinh x} \]
          3. Recombined 2 regimes into one program.
          4. Final simplification100.0%

            \[\leadsto \begin{array}{l} \mathbf{if}\;e^{-x} + \left(e^{x} - 2\right) \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(x, x, \left(\left(0.08333333333333333 \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(e^{x} - 2, e^{x} - 2, -{\left(e^{x}\right)}^{-2}\right)}{\sinh x \cdot 2 + -2}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 3: 99.7% accurate, 0.3× speedup?

          \[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} t_0 := e^{x\_m} - 2\\ \mathbf{if}\;e^{-x\_m} + t\_0 \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(x\_m, x\_m, \left(\left(0.08333333333333333 \cdot \left(x\_m \cdot x\_m\right)\right) \cdot x\_m\right) \cdot x\_m\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{{t\_0}^{2} - e^{-2 \cdot x\_m}}{\sinh x\_m \cdot 2 + -2}\\ \end{array} \end{array} \]
          x_m = (fabs.f64 x)
          (FPCore (x_m)
           :precision binary64
           (let* ((t_0 (- (exp x_m) 2.0)))
             (if (<= (+ (exp (- x_m)) t_0) 2e-7)
               (fma x_m x_m (* (* (* 0.08333333333333333 (* x_m x_m)) x_m) x_m))
               (/ (- (pow t_0 2.0) (exp (* -2.0 x_m))) (+ (* (sinh x_m) 2.0) -2.0)))))
          x_m = fabs(x);
          double code(double x_m) {
          	double t_0 = exp(x_m) - 2.0;
          	double tmp;
          	if ((exp(-x_m) + t_0) <= 2e-7) {
          		tmp = fma(x_m, x_m, (((0.08333333333333333 * (x_m * x_m)) * x_m) * x_m));
          	} else {
          		tmp = (pow(t_0, 2.0) - exp((-2.0 * x_m))) / ((sinh(x_m) * 2.0) + -2.0);
          	}
          	return tmp;
          }
          
          x_m = abs(x)
          function code(x_m)
          	t_0 = Float64(exp(x_m) - 2.0)
          	tmp = 0.0
          	if (Float64(exp(Float64(-x_m)) + t_0) <= 2e-7)
          		tmp = fma(x_m, x_m, Float64(Float64(Float64(0.08333333333333333 * Float64(x_m * x_m)) * x_m) * x_m));
          	else
          		tmp = Float64(Float64((t_0 ^ 2.0) - exp(Float64(-2.0 * x_m))) / Float64(Float64(sinh(x_m) * 2.0) + -2.0));
          	end
          	return tmp
          end
          
          x_m = N[Abs[x], $MachinePrecision]
          code[x$95$m_] := Block[{t$95$0 = N[(N[Exp[x$95$m], $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[N[(N[Exp[(-x$95$m)], $MachinePrecision] + t$95$0), $MachinePrecision], 2e-7], N[(x$95$m * x$95$m + N[(N[(N[(0.08333333333333333 * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[t$95$0, 2.0], $MachinePrecision] - N[Exp[N[(-2.0 * x$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Sinh[x$95$m], $MachinePrecision] * 2.0), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]]]
          
          \begin{array}{l}
          x_m = \left|x\right|
          
          \\
          \begin{array}{l}
          t_0 := e^{x\_m} - 2\\
          \mathbf{if}\;e^{-x\_m} + t\_0 \leq 2 \cdot 10^{-7}:\\
          \;\;\;\;\mathsf{fma}\left(x\_m, x\_m, \left(\left(0.08333333333333333 \cdot \left(x\_m \cdot x\_m\right)\right) \cdot x\_m\right) \cdot x\_m\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{{t\_0}^{2} - e^{-2 \cdot x\_m}}{\sinh x\_m \cdot 2 + -2}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (+.f64 (-.f64 (exp.f64 x) #s(literal 2 binary64)) (exp.f64 (neg.f64 x))) < 1.9999999999999999e-7

            1. Initial program 47.8%

              \[\left(e^{x} - 2\right) + e^{-x} \]
            2. Add Preprocessing
            3. Taylor expanded in x around 0

              \[\leadsto \color{blue}{{x}^{2} \cdot \left(1 + \frac{1}{12} \cdot {x}^{2}\right)} \]
            4. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto {x}^{2} \cdot \color{blue}{\left(\frac{1}{12} \cdot {x}^{2} + 1\right)} \]
              2. distribute-lft-inN/A

                \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{12} \cdot {x}^{2}\right) + {x}^{2} \cdot 1} \]
              3. *-commutativeN/A

                \[\leadsto {x}^{2} \cdot \color{blue}{\left({x}^{2} \cdot \frac{1}{12}\right)} + {x}^{2} \cdot 1 \]
              4. associate-*r*N/A

                \[\leadsto \color{blue}{\left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{1}{12}} + {x}^{2} \cdot 1 \]
              5. *-rgt-identityN/A

                \[\leadsto \left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{1}{12} + \color{blue}{{x}^{2}} \]
              6. lower-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{2} \cdot {x}^{2}, \frac{1}{12}, {x}^{2}\right)} \]
              7. pow-sqrN/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{{x}^{\left(2 \cdot 2\right)}}, \frac{1}{12}, {x}^{2}\right) \]
              8. lower-pow.f64N/A

                \[\leadsto \mathsf{fma}\left(\color{blue}{{x}^{\left(2 \cdot 2\right)}}, \frac{1}{12}, {x}^{2}\right) \]
              9. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left({x}^{\color{blue}{4}}, \frac{1}{12}, {x}^{2}\right) \]
              10. unpow2N/A

                \[\leadsto \mathsf{fma}\left({x}^{4}, \frac{1}{12}, \color{blue}{x \cdot x}\right) \]
              11. lower-*.f64100.0

                \[\leadsto \mathsf{fma}\left({x}^{4}, 0.08333333333333333, \color{blue}{x \cdot x}\right) \]
            5. Applied rewrites100.0%

              \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{4}, 0.08333333333333333, x \cdot x\right)} \]
            6. Step-by-step derivation
              1. Applied rewrites100.0%

                \[\leadsto \mathsf{fma}\left(x, \color{blue}{x}, 0.08333333333333333 \cdot {x}^{4}\right) \]
              2. Step-by-step derivation
                1. Applied rewrites100.0%

                  \[\leadsto \mathsf{fma}\left(x, x, x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.08333333333333333\right)\right)\right) \]

                if 1.9999999999999999e-7 < (+.f64 (-.f64 (exp.f64 x) #s(literal 2 binary64)) (exp.f64 (neg.f64 x)))

                1. Initial program 98.8%

                  \[\left(e^{x} - 2\right) + e^{-x} \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. lift-+.f64N/A

                    \[\leadsto \color{blue}{\left(e^{x} - 2\right) + e^{-x}} \]
                  2. flip-+N/A

                    \[\leadsto \color{blue}{\frac{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) - e^{-x} \cdot e^{-x}}{\left(e^{x} - 2\right) - e^{-x}}} \]
                  3. lower-/.f64N/A

                    \[\leadsto \color{blue}{\frac{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) - e^{-x} \cdot e^{-x}}{\left(e^{x} - 2\right) - e^{-x}}} \]
                  4. lower--.f64N/A

                    \[\leadsto \frac{\color{blue}{\left(e^{x} - 2\right) \cdot \left(e^{x} - 2\right) - e^{-x} \cdot e^{-x}}}{\left(e^{x} - 2\right) - e^{-x}} \]
                  5. pow2N/A

                    \[\leadsto \frac{\color{blue}{{\left(e^{x} - 2\right)}^{2}} - e^{-x} \cdot e^{-x}}{\left(e^{x} - 2\right) - e^{-x}} \]
                  6. lower-pow.f64N/A

                    \[\leadsto \frac{\color{blue}{{\left(e^{x} - 2\right)}^{2}} - e^{-x} \cdot e^{-x}}{\left(e^{x} - 2\right) - e^{-x}} \]
                  7. pow2N/A

                    \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - \color{blue}{{\left(e^{-x}\right)}^{2}}}{\left(e^{x} - 2\right) - e^{-x}} \]
                  8. lift-exp.f64N/A

                    \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - {\color{blue}{\left(e^{-x}\right)}}^{2}}{\left(e^{x} - 2\right) - e^{-x}} \]
                  9. lift-neg.f64N/A

                    \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - {\left(e^{\color{blue}{\mathsf{neg}\left(x\right)}}\right)}^{2}}{\left(e^{x} - 2\right) - e^{-x}} \]
                  10. exp-negN/A

                    \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - {\color{blue}{\left(\frac{1}{e^{x}}\right)}}^{2}}{\left(e^{x} - 2\right) - e^{-x}} \]
                  11. lift-exp.f64N/A

                    \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - {\left(\frac{1}{\color{blue}{e^{x}}}\right)}^{2}}{\left(e^{x} - 2\right) - e^{-x}} \]
                  12. inv-powN/A

                    \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - {\color{blue}{\left({\left(e^{x}\right)}^{-1}\right)}}^{2}}{\left(e^{x} - 2\right) - e^{-x}} \]
                  13. pow-powN/A

                    \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - \color{blue}{{\left(e^{x}\right)}^{\left(-1 \cdot 2\right)}}}{\left(e^{x} - 2\right) - e^{-x}} \]
                  14. metadata-evalN/A

                    \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - {\left(e^{x}\right)}^{\color{blue}{-2}}}{\left(e^{x} - 2\right) - e^{-x}} \]
                  15. metadata-evalN/A

                    \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - {\left(e^{x}\right)}^{\color{blue}{\left(\mathsf{neg}\left(2\right)\right)}}}{\left(e^{x} - 2\right) - e^{-x}} \]
                  16. lower-pow.f64N/A

                    \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - \color{blue}{{\left(e^{x}\right)}^{\left(\mathsf{neg}\left(2\right)\right)}}}{\left(e^{x} - 2\right) - e^{-x}} \]
                  17. metadata-evalN/A

                    \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - {\left(e^{x}\right)}^{\color{blue}{-2}}}{\left(e^{x} - 2\right) - e^{-x}} \]
                4. Applied rewrites97.9%

                  \[\leadsto \color{blue}{\frac{{\left(e^{x} - 2\right)}^{2} - {\left(e^{x}\right)}^{-2}}{-2 + 2 \cdot \sinh x}} \]
                5. Step-by-step derivation
                  1. lift-pow.f64N/A

                    \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - \color{blue}{{\left(e^{x}\right)}^{-2}}}{-2 + 2 \cdot \sinh x} \]
                  2. lift-exp.f64N/A

                    \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - {\color{blue}{\left(e^{x}\right)}}^{-2}}{-2 + 2 \cdot \sinh x} \]
                  3. pow-expN/A

                    \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - \color{blue}{e^{x \cdot -2}}}{-2 + 2 \cdot \sinh x} \]
                  4. lower-exp.f64N/A

                    \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - \color{blue}{e^{x \cdot -2}}}{-2 + 2 \cdot \sinh x} \]
                  5. *-commutativeN/A

                    \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - e^{\color{blue}{-2 \cdot x}}}{-2 + 2 \cdot \sinh x} \]
                  6. lower-*.f6498.9

                    \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - e^{\color{blue}{-2 \cdot x}}}{-2 + 2 \cdot \sinh x} \]
                6. Applied rewrites98.9%

                  \[\leadsto \frac{{\left(e^{x} - 2\right)}^{2} - \color{blue}{e^{-2 \cdot x}}}{-2 + 2 \cdot \sinh x} \]
              3. Recombined 2 regimes into one program.
              4. Final simplification100.0%

                \[\leadsto \begin{array}{l} \mathbf{if}\;e^{-x} + \left(e^{x} - 2\right) \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(x, x, \left(\left(0.08333333333333333 \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(e^{x} - 2\right)}^{2} - e^{-2 \cdot x}}{\sinh x \cdot 2 + -2}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 4: 99.7% accurate, 0.4× speedup?

              \[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;e^{-x\_m} + \left(e^{x\_m} - 2\right) \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(x\_m, x\_m, \left(\left(0.08333333333333333 \cdot \left(x\_m \cdot x\_m\right)\right) \cdot x\_m\right) \cdot x\_m\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(\cosh x\_m, 2, 2\right)}{\mathsf{fma}\left({\cosh x\_m}^{2}, 4, -4\right)}}\\ \end{array} \end{array} \]
              x_m = (fabs.f64 x)
              (FPCore (x_m)
               :precision binary64
               (if (<= (+ (exp (- x_m)) (- (exp x_m) 2.0)) 2e-7)
                 (fma x_m x_m (* (* (* 0.08333333333333333 (* x_m x_m)) x_m) x_m))
                 (/ 1.0 (/ (fma (cosh x_m) 2.0 2.0) (fma (pow (cosh x_m) 2.0) 4.0 -4.0)))))
              x_m = fabs(x);
              double code(double x_m) {
              	double tmp;
              	if ((exp(-x_m) + (exp(x_m) - 2.0)) <= 2e-7) {
              		tmp = fma(x_m, x_m, (((0.08333333333333333 * (x_m * x_m)) * x_m) * x_m));
              	} else {
              		tmp = 1.0 / (fma(cosh(x_m), 2.0, 2.0) / fma(pow(cosh(x_m), 2.0), 4.0, -4.0));
              	}
              	return tmp;
              }
              
              x_m = abs(x)
              function code(x_m)
              	tmp = 0.0
              	if (Float64(exp(Float64(-x_m)) + Float64(exp(x_m) - 2.0)) <= 2e-7)
              		tmp = fma(x_m, x_m, Float64(Float64(Float64(0.08333333333333333 * Float64(x_m * x_m)) * x_m) * x_m));
              	else
              		tmp = Float64(1.0 / Float64(fma(cosh(x_m), 2.0, 2.0) / fma((cosh(x_m) ^ 2.0), 4.0, -4.0)));
              	end
              	return tmp
              end
              
              x_m = N[Abs[x], $MachinePrecision]
              code[x$95$m_] := If[LessEqual[N[(N[Exp[(-x$95$m)], $MachinePrecision] + N[(N[Exp[x$95$m], $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision], 2e-7], N[(x$95$m * x$95$m + N[(N[(N[(0.08333333333333333 * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[Cosh[x$95$m], $MachinePrecision] * 2.0 + 2.0), $MachinePrecision] / N[(N[Power[N[Cosh[x$95$m], $MachinePrecision], 2.0], $MachinePrecision] * 4.0 + -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              x_m = \left|x\right|
              
              \\
              \begin{array}{l}
              \mathbf{if}\;e^{-x\_m} + \left(e^{x\_m} - 2\right) \leq 2 \cdot 10^{-7}:\\
              \;\;\;\;\mathsf{fma}\left(x\_m, x\_m, \left(\left(0.08333333333333333 \cdot \left(x\_m \cdot x\_m\right)\right) \cdot x\_m\right) \cdot x\_m\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(\cosh x\_m, 2, 2\right)}{\mathsf{fma}\left({\cosh x\_m}^{2}, 4, -4\right)}}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (+.f64 (-.f64 (exp.f64 x) #s(literal 2 binary64)) (exp.f64 (neg.f64 x))) < 1.9999999999999999e-7

                1. Initial program 47.8%

                  \[\left(e^{x} - 2\right) + e^{-x} \]
                2. Add Preprocessing
                3. Taylor expanded in x around 0

                  \[\leadsto \color{blue}{{x}^{2} \cdot \left(1 + \frac{1}{12} \cdot {x}^{2}\right)} \]
                4. Step-by-step derivation
                  1. +-commutativeN/A

                    \[\leadsto {x}^{2} \cdot \color{blue}{\left(\frac{1}{12} \cdot {x}^{2} + 1\right)} \]
                  2. distribute-lft-inN/A

                    \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{12} \cdot {x}^{2}\right) + {x}^{2} \cdot 1} \]
                  3. *-commutativeN/A

                    \[\leadsto {x}^{2} \cdot \color{blue}{\left({x}^{2} \cdot \frac{1}{12}\right)} + {x}^{2} \cdot 1 \]
                  4. associate-*r*N/A

                    \[\leadsto \color{blue}{\left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{1}{12}} + {x}^{2} \cdot 1 \]
                  5. *-rgt-identityN/A

                    \[\leadsto \left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{1}{12} + \color{blue}{{x}^{2}} \]
                  6. lower-fma.f64N/A

                    \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{2} \cdot {x}^{2}, \frac{1}{12}, {x}^{2}\right)} \]
                  7. pow-sqrN/A

                    \[\leadsto \mathsf{fma}\left(\color{blue}{{x}^{\left(2 \cdot 2\right)}}, \frac{1}{12}, {x}^{2}\right) \]
                  8. lower-pow.f64N/A

                    \[\leadsto \mathsf{fma}\left(\color{blue}{{x}^{\left(2 \cdot 2\right)}}, \frac{1}{12}, {x}^{2}\right) \]
                  9. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left({x}^{\color{blue}{4}}, \frac{1}{12}, {x}^{2}\right) \]
                  10. unpow2N/A

                    \[\leadsto \mathsf{fma}\left({x}^{4}, \frac{1}{12}, \color{blue}{x \cdot x}\right) \]
                  11. lower-*.f64100.0

                    \[\leadsto \mathsf{fma}\left({x}^{4}, 0.08333333333333333, \color{blue}{x \cdot x}\right) \]
                5. Applied rewrites100.0%

                  \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{4}, 0.08333333333333333, x \cdot x\right)} \]
                6. Step-by-step derivation
                  1. Applied rewrites100.0%

                    \[\leadsto \mathsf{fma}\left(x, \color{blue}{x}, 0.08333333333333333 \cdot {x}^{4}\right) \]
                  2. Step-by-step derivation
                    1. Applied rewrites100.0%

                      \[\leadsto \mathsf{fma}\left(x, x, x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.08333333333333333\right)\right)\right) \]

                    if 1.9999999999999999e-7 < (+.f64 (-.f64 (exp.f64 x) #s(literal 2 binary64)) (exp.f64 (neg.f64 x)))

                    1. Initial program 98.8%

                      \[\left(e^{x} - 2\right) + e^{-x} \]
                    2. Add Preprocessing
                    3. Step-by-step derivation
                      1. lift-+.f64N/A

                        \[\leadsto \color{blue}{\left(e^{x} - 2\right) + e^{-x}} \]
                      2. lift--.f64N/A

                        \[\leadsto \color{blue}{\left(e^{x} - 2\right)} + e^{-x} \]
                      3. associate-+l-N/A

                        \[\leadsto \color{blue}{e^{x} - \left(2 - e^{-x}\right)} \]
                      4. sub-negN/A

                        \[\leadsto e^{x} - \color{blue}{\left(2 + \left(\mathsf{neg}\left(e^{-x}\right)\right)\right)} \]
                      5. associate--r+N/A

                        \[\leadsto \color{blue}{\left(e^{x} - 2\right) - \left(\mathsf{neg}\left(e^{-x}\right)\right)} \]
                      6. lift--.f64N/A

                        \[\leadsto \color{blue}{\left(e^{x} - 2\right)} - \left(\mathsf{neg}\left(e^{-x}\right)\right) \]
                      7. lower--.f64N/A

                        \[\leadsto \color{blue}{\left(e^{x} - 2\right) - \left(\mathsf{neg}\left(e^{-x}\right)\right)} \]
                      8. lift-exp.f64N/A

                        \[\leadsto \left(e^{x} - 2\right) - \left(\mathsf{neg}\left(\color{blue}{e^{-x}}\right)\right) \]
                      9. lift-neg.f64N/A

                        \[\leadsto \left(e^{x} - 2\right) - \left(\mathsf{neg}\left(e^{\color{blue}{\mathsf{neg}\left(x\right)}}\right)\right) \]
                      10. exp-negN/A

                        \[\leadsto \left(e^{x} - 2\right) - \left(\mathsf{neg}\left(\color{blue}{\frac{1}{e^{x}}}\right)\right) \]
                      11. lift-exp.f64N/A

                        \[\leadsto \left(e^{x} - 2\right) - \left(\mathsf{neg}\left(\frac{1}{\color{blue}{e^{x}}}\right)\right) \]
                      12. distribute-neg-fracN/A

                        \[\leadsto \left(e^{x} - 2\right) - \color{blue}{\frac{\mathsf{neg}\left(1\right)}{e^{x}}} \]
                      13. metadata-evalN/A

                        \[\leadsto \left(e^{x} - 2\right) - \frac{\color{blue}{-1}}{e^{x}} \]
                      14. lower-/.f6498.5

                        \[\leadsto \left(e^{x} - 2\right) - \color{blue}{\frac{-1}{e^{x}}} \]
                    4. Applied rewrites98.5%

                      \[\leadsto \color{blue}{\left(e^{x} - 2\right) - \frac{-1}{e^{x}}} \]
                    5. Step-by-step derivation
                      1. lift--.f64N/A

                        \[\leadsto \color{blue}{\left(e^{x} - 2\right) - \frac{-1}{e^{x}}} \]
                      2. lift--.f64N/A

                        \[\leadsto \color{blue}{\left(e^{x} - 2\right)} - \frac{-1}{e^{x}} \]
                      3. associate--l-N/A

                        \[\leadsto \color{blue}{e^{x} - \left(2 + \frac{-1}{e^{x}}\right)} \]
                      4. lift-/.f64N/A

                        \[\leadsto e^{x} - \left(2 + \color{blue}{\frac{-1}{e^{x}}}\right) \]
                      5. div-invN/A

                        \[\leadsto e^{x} - \left(2 + \color{blue}{-1 \cdot \frac{1}{e^{x}}}\right) \]
                      6. lift-exp.f64N/A

                        \[\leadsto e^{x} - \left(2 + -1 \cdot \frac{1}{\color{blue}{e^{x}}}\right) \]
                      7. exp-negN/A

                        \[\leadsto e^{x} - \left(2 + -1 \cdot \color{blue}{e^{\mathsf{neg}\left(x\right)}}\right) \]
                      8. mul-1-negN/A

                        \[\leadsto e^{x} - \left(2 + \color{blue}{\left(\mathsf{neg}\left(e^{\mathsf{neg}\left(x\right)}\right)\right)}\right) \]
                      9. sub-negN/A

                        \[\leadsto e^{x} - \color{blue}{\left(2 - e^{\mathsf{neg}\left(x\right)}\right)} \]
                      10. associate-+l-N/A

                        \[\leadsto \color{blue}{\left(e^{x} - 2\right) + e^{\mathsf{neg}\left(x\right)}} \]
                      11. lift--.f64N/A

                        \[\leadsto \color{blue}{\left(e^{x} - 2\right)} + e^{\mathsf{neg}\left(x\right)} \]
                      12. +-commutativeN/A

                        \[\leadsto \color{blue}{e^{\mathsf{neg}\left(x\right)} + \left(e^{x} - 2\right)} \]
                      13. lift--.f64N/A

                        \[\leadsto e^{\mathsf{neg}\left(x\right)} + \color{blue}{\left(e^{x} - 2\right)} \]
                      14. sub-negN/A

                        \[\leadsto e^{\mathsf{neg}\left(x\right)} + \color{blue}{\left(e^{x} + \left(\mathsf{neg}\left(2\right)\right)\right)} \]
                      15. metadata-evalN/A

                        \[\leadsto e^{\mathsf{neg}\left(x\right)} + \left(e^{x} + \color{blue}{-2}\right) \]
                      16. associate-+r+N/A

                        \[\leadsto \color{blue}{\left(e^{\mathsf{neg}\left(x\right)} + e^{x}\right) + -2} \]
                      17. +-commutativeN/A

                        \[\leadsto \color{blue}{\left(e^{x} + e^{\mathsf{neg}\left(x\right)}\right)} + -2 \]
                      18. lift-exp.f64N/A

                        \[\leadsto \left(\color{blue}{e^{x}} + e^{\mathsf{neg}\left(x\right)}\right) + -2 \]
                      19. cosh-undefN/A

                        \[\leadsto \color{blue}{2 \cdot \cosh x} + -2 \]
                      20. lift-cosh.f64N/A

                        \[\leadsto 2 \cdot \color{blue}{\cosh x} + -2 \]
                      21. *-commutativeN/A

                        \[\leadsto \color{blue}{\cosh x \cdot 2} + -2 \]
                      22. lower-fma.f6498.4

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\cosh x, 2, -2\right)} \]
                    6. Applied rewrites98.4%

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\cosh x, 2, -2\right)} \]
                    7. Step-by-step derivation
                      1. lift-fma.f64N/A

                        \[\leadsto \color{blue}{\cosh x \cdot 2 + -2} \]
                      2. flip-+N/A

                        \[\leadsto \color{blue}{\frac{\left(\cosh x \cdot 2\right) \cdot \left(\cosh x \cdot 2\right) - -2 \cdot -2}{\cosh x \cdot 2 - -2}} \]
                      3. clear-numN/A

                        \[\leadsto \color{blue}{\frac{1}{\frac{\cosh x \cdot 2 - -2}{\left(\cosh x \cdot 2\right) \cdot \left(\cosh x \cdot 2\right) - -2 \cdot -2}}} \]
                      4. lower-/.f64N/A

                        \[\leadsto \color{blue}{\frac{1}{\frac{\cosh x \cdot 2 - -2}{\left(\cosh x \cdot 2\right) \cdot \left(\cosh x \cdot 2\right) - -2 \cdot -2}}} \]
                      5. lower-/.f64N/A

                        \[\leadsto \frac{1}{\color{blue}{\frac{\cosh x \cdot 2 - -2}{\left(\cosh x \cdot 2\right) \cdot \left(\cosh x \cdot 2\right) - -2 \cdot -2}}} \]
                      6. sub-negN/A

                        \[\leadsto \frac{1}{\frac{\color{blue}{\cosh x \cdot 2 + \left(\mathsf{neg}\left(-2\right)\right)}}{\left(\cosh x \cdot 2\right) \cdot \left(\cosh x \cdot 2\right) - -2 \cdot -2}} \]
                      7. metadata-evalN/A

                        \[\leadsto \frac{1}{\frac{\cosh x \cdot 2 + \color{blue}{2}}{\left(\cosh x \cdot 2\right) \cdot \left(\cosh x \cdot 2\right) - -2 \cdot -2}} \]
                      8. lower-fma.f64N/A

                        \[\leadsto \frac{1}{\frac{\color{blue}{\mathsf{fma}\left(\cosh x, 2, 2\right)}}{\left(\cosh x \cdot 2\right) \cdot \left(\cosh x \cdot 2\right) - -2 \cdot -2}} \]
                      9. metadata-evalN/A

                        \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\cosh x, 2, 2\right)}{\left(\cosh x \cdot 2\right) \cdot \left(\cosh x \cdot 2\right) - \color{blue}{4}}} \]
                      10. sub-negN/A

                        \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\cosh x, 2, 2\right)}{\color{blue}{\left(\cosh x \cdot 2\right) \cdot \left(\cosh x \cdot 2\right) + \left(\mathsf{neg}\left(4\right)\right)}}} \]
                      11. swap-sqrN/A

                        \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\cosh x, 2, 2\right)}{\color{blue}{\left(\cosh x \cdot \cosh x\right) \cdot \left(2 \cdot 2\right)} + \left(\mathsf{neg}\left(4\right)\right)}} \]
                      12. unpow2N/A

                        \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\cosh x, 2, 2\right)}{\color{blue}{{\cosh x}^{2}} \cdot \left(2 \cdot 2\right) + \left(\mathsf{neg}\left(4\right)\right)}} \]
                      13. lift-pow.f64N/A

                        \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\cosh x, 2, 2\right)}{\color{blue}{{\cosh x}^{2}} \cdot \left(2 \cdot 2\right) + \left(\mathsf{neg}\left(4\right)\right)}} \]
                      14. metadata-evalN/A

                        \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\cosh x, 2, 2\right)}{{\cosh x}^{2} \cdot \color{blue}{4} + \left(\mathsf{neg}\left(4\right)\right)}} \]
                      15. metadata-evalN/A

                        \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\cosh x, 2, 2\right)}{{\cosh x}^{2} \cdot 4 + \color{blue}{-4}}} \]
                      16. metadata-evalN/A

                        \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\cosh x, 2, 2\right)}{{\cosh x}^{2} \cdot 4 + \color{blue}{\left(-2 + -2\right)}}} \]
                      17. lower-fma.f64N/A

                        \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\cosh x, 2, 2\right)}{\color{blue}{\mathsf{fma}\left({\cosh x}^{2}, 4, -2 + -2\right)}}} \]
                      18. metadata-eval99.0

                        \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\cosh x, 2, 2\right)}{\mathsf{fma}\left({\cosh x}^{2}, 4, \color{blue}{-4}\right)}} \]
                    8. Applied rewrites99.0%

                      \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(\cosh x, 2, 2\right)}{\mathsf{fma}\left({\cosh x}^{2}, 4, -4\right)}}} \]
                  3. Recombined 2 regimes into one program.
                  4. Final simplification100.0%

                    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{-x} + \left(e^{x} - 2\right) \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(x, x, \left(\left(0.08333333333333333 \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(\cosh x, 2, 2\right)}{\mathsf{fma}\left({\cosh x}^{2}, 4, -4\right)}}\\ \end{array} \]
                  5. Add Preprocessing

                  Alternative 5: 99.8% accurate, 0.5× speedup?

                  \[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} t_0 := e^{x\_m} - 2\\ \mathbf{if}\;e^{-x\_m} + t\_0 \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(x\_m, x\_m, \left(\left(0.08333333333333333 \cdot \left(x\_m \cdot x\_m\right)\right) \cdot x\_m\right) \cdot x\_m\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 - \frac{-1}{e^{x\_m}}\\ \end{array} \end{array} \]
                  x_m = (fabs.f64 x)
                  (FPCore (x_m)
                   :precision binary64
                   (let* ((t_0 (- (exp x_m) 2.0)))
                     (if (<= (+ (exp (- x_m)) t_0) 2e-7)
                       (fma x_m x_m (* (* (* 0.08333333333333333 (* x_m x_m)) x_m) x_m))
                       (- t_0 (/ -1.0 (exp x_m))))))
                  x_m = fabs(x);
                  double code(double x_m) {
                  	double t_0 = exp(x_m) - 2.0;
                  	double tmp;
                  	if ((exp(-x_m) + t_0) <= 2e-7) {
                  		tmp = fma(x_m, x_m, (((0.08333333333333333 * (x_m * x_m)) * x_m) * x_m));
                  	} else {
                  		tmp = t_0 - (-1.0 / exp(x_m));
                  	}
                  	return tmp;
                  }
                  
                  x_m = abs(x)
                  function code(x_m)
                  	t_0 = Float64(exp(x_m) - 2.0)
                  	tmp = 0.0
                  	if (Float64(exp(Float64(-x_m)) + t_0) <= 2e-7)
                  		tmp = fma(x_m, x_m, Float64(Float64(Float64(0.08333333333333333 * Float64(x_m * x_m)) * x_m) * x_m));
                  	else
                  		tmp = Float64(t_0 - Float64(-1.0 / exp(x_m)));
                  	end
                  	return tmp
                  end
                  
                  x_m = N[Abs[x], $MachinePrecision]
                  code[x$95$m_] := Block[{t$95$0 = N[(N[Exp[x$95$m], $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[N[(N[Exp[(-x$95$m)], $MachinePrecision] + t$95$0), $MachinePrecision], 2e-7], N[(x$95$m * x$95$m + N[(N[(N[(0.08333333333333333 * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - N[(-1.0 / N[Exp[x$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                  
                  \begin{array}{l}
                  x_m = \left|x\right|
                  
                  \\
                  \begin{array}{l}
                  t_0 := e^{x\_m} - 2\\
                  \mathbf{if}\;e^{-x\_m} + t\_0 \leq 2 \cdot 10^{-7}:\\
                  \;\;\;\;\mathsf{fma}\left(x\_m, x\_m, \left(\left(0.08333333333333333 \cdot \left(x\_m \cdot x\_m\right)\right) \cdot x\_m\right) \cdot x\_m\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;t\_0 - \frac{-1}{e^{x\_m}}\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if (+.f64 (-.f64 (exp.f64 x) #s(literal 2 binary64)) (exp.f64 (neg.f64 x))) < 1.9999999999999999e-7

                    1. Initial program 47.8%

                      \[\left(e^{x} - 2\right) + e^{-x} \]
                    2. Add Preprocessing
                    3. Taylor expanded in x around 0

                      \[\leadsto \color{blue}{{x}^{2} \cdot \left(1 + \frac{1}{12} \cdot {x}^{2}\right)} \]
                    4. Step-by-step derivation
                      1. +-commutativeN/A

                        \[\leadsto {x}^{2} \cdot \color{blue}{\left(\frac{1}{12} \cdot {x}^{2} + 1\right)} \]
                      2. distribute-lft-inN/A

                        \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{12} \cdot {x}^{2}\right) + {x}^{2} \cdot 1} \]
                      3. *-commutativeN/A

                        \[\leadsto {x}^{2} \cdot \color{blue}{\left({x}^{2} \cdot \frac{1}{12}\right)} + {x}^{2} \cdot 1 \]
                      4. associate-*r*N/A

                        \[\leadsto \color{blue}{\left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{1}{12}} + {x}^{2} \cdot 1 \]
                      5. *-rgt-identityN/A

                        \[\leadsto \left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{1}{12} + \color{blue}{{x}^{2}} \]
                      6. lower-fma.f64N/A

                        \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{2} \cdot {x}^{2}, \frac{1}{12}, {x}^{2}\right)} \]
                      7. pow-sqrN/A

                        \[\leadsto \mathsf{fma}\left(\color{blue}{{x}^{\left(2 \cdot 2\right)}}, \frac{1}{12}, {x}^{2}\right) \]
                      8. lower-pow.f64N/A

                        \[\leadsto \mathsf{fma}\left(\color{blue}{{x}^{\left(2 \cdot 2\right)}}, \frac{1}{12}, {x}^{2}\right) \]
                      9. metadata-evalN/A

                        \[\leadsto \mathsf{fma}\left({x}^{\color{blue}{4}}, \frac{1}{12}, {x}^{2}\right) \]
                      10. unpow2N/A

                        \[\leadsto \mathsf{fma}\left({x}^{4}, \frac{1}{12}, \color{blue}{x \cdot x}\right) \]
                      11. lower-*.f64100.0

                        \[\leadsto \mathsf{fma}\left({x}^{4}, 0.08333333333333333, \color{blue}{x \cdot x}\right) \]
                    5. Applied rewrites100.0%

                      \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{4}, 0.08333333333333333, x \cdot x\right)} \]
                    6. Step-by-step derivation
                      1. Applied rewrites100.0%

                        \[\leadsto \mathsf{fma}\left(x, \color{blue}{x}, 0.08333333333333333 \cdot {x}^{4}\right) \]
                      2. Step-by-step derivation
                        1. Applied rewrites100.0%

                          \[\leadsto \mathsf{fma}\left(x, x, x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.08333333333333333\right)\right)\right) \]

                        if 1.9999999999999999e-7 < (+.f64 (-.f64 (exp.f64 x) #s(literal 2 binary64)) (exp.f64 (neg.f64 x)))

                        1. Initial program 98.8%

                          \[\left(e^{x} - 2\right) + e^{-x} \]
                        2. Add Preprocessing
                        3. Step-by-step derivation
                          1. lift-+.f64N/A

                            \[\leadsto \color{blue}{\left(e^{x} - 2\right) + e^{-x}} \]
                          2. lift--.f64N/A

                            \[\leadsto \color{blue}{\left(e^{x} - 2\right)} + e^{-x} \]
                          3. associate-+l-N/A

                            \[\leadsto \color{blue}{e^{x} - \left(2 - e^{-x}\right)} \]
                          4. sub-negN/A

                            \[\leadsto e^{x} - \color{blue}{\left(2 + \left(\mathsf{neg}\left(e^{-x}\right)\right)\right)} \]
                          5. associate--r+N/A

                            \[\leadsto \color{blue}{\left(e^{x} - 2\right) - \left(\mathsf{neg}\left(e^{-x}\right)\right)} \]
                          6. lift--.f64N/A

                            \[\leadsto \color{blue}{\left(e^{x} - 2\right)} - \left(\mathsf{neg}\left(e^{-x}\right)\right) \]
                          7. lower--.f64N/A

                            \[\leadsto \color{blue}{\left(e^{x} - 2\right) - \left(\mathsf{neg}\left(e^{-x}\right)\right)} \]
                          8. lift-exp.f64N/A

                            \[\leadsto \left(e^{x} - 2\right) - \left(\mathsf{neg}\left(\color{blue}{e^{-x}}\right)\right) \]
                          9. lift-neg.f64N/A

                            \[\leadsto \left(e^{x} - 2\right) - \left(\mathsf{neg}\left(e^{\color{blue}{\mathsf{neg}\left(x\right)}}\right)\right) \]
                          10. exp-negN/A

                            \[\leadsto \left(e^{x} - 2\right) - \left(\mathsf{neg}\left(\color{blue}{\frac{1}{e^{x}}}\right)\right) \]
                          11. lift-exp.f64N/A

                            \[\leadsto \left(e^{x} - 2\right) - \left(\mathsf{neg}\left(\frac{1}{\color{blue}{e^{x}}}\right)\right) \]
                          12. distribute-neg-fracN/A

                            \[\leadsto \left(e^{x} - 2\right) - \color{blue}{\frac{\mathsf{neg}\left(1\right)}{e^{x}}} \]
                          13. metadata-evalN/A

                            \[\leadsto \left(e^{x} - 2\right) - \frac{\color{blue}{-1}}{e^{x}} \]
                          14. lower-/.f6498.5

                            \[\leadsto \left(e^{x} - 2\right) - \color{blue}{\frac{-1}{e^{x}}} \]
                        4. Applied rewrites98.5%

                          \[\leadsto \color{blue}{\left(e^{x} - 2\right) - \frac{-1}{e^{x}}} \]
                      3. Recombined 2 regimes into one program.
                      4. Final simplification100.0%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;e^{-x} + \left(e^{x} - 2\right) \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(x, x, \left(\left(0.08333333333333333 \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(e^{x} - 2\right) - \frac{-1}{e^{x}}\\ \end{array} \]
                      5. Add Preprocessing

                      Alternative 6: 99.8% accurate, 0.5× speedup?

                      \[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} t_0 := e^{-x\_m} + \left(e^{x\_m} - 2\right)\\ \mathbf{if}\;t\_0 \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(x\_m, x\_m, \left(\left(0.08333333333333333 \cdot \left(x\_m \cdot x\_m\right)\right) \cdot x\_m\right) \cdot x\_m\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                      x_m = (fabs.f64 x)
                      (FPCore (x_m)
                       :precision binary64
                       (let* ((t_0 (+ (exp (- x_m)) (- (exp x_m) 2.0))))
                         (if (<= t_0 2e-7)
                           (fma x_m x_m (* (* (* 0.08333333333333333 (* x_m x_m)) x_m) x_m))
                           t_0)))
                      x_m = fabs(x);
                      double code(double x_m) {
                      	double t_0 = exp(-x_m) + (exp(x_m) - 2.0);
                      	double tmp;
                      	if (t_0 <= 2e-7) {
                      		tmp = fma(x_m, x_m, (((0.08333333333333333 * (x_m * x_m)) * x_m) * x_m));
                      	} else {
                      		tmp = t_0;
                      	}
                      	return tmp;
                      }
                      
                      x_m = abs(x)
                      function code(x_m)
                      	t_0 = Float64(exp(Float64(-x_m)) + Float64(exp(x_m) - 2.0))
                      	tmp = 0.0
                      	if (t_0 <= 2e-7)
                      		tmp = fma(x_m, x_m, Float64(Float64(Float64(0.08333333333333333 * Float64(x_m * x_m)) * x_m) * x_m));
                      	else
                      		tmp = t_0;
                      	end
                      	return tmp
                      end
                      
                      x_m = N[Abs[x], $MachinePrecision]
                      code[x$95$m_] := Block[{t$95$0 = N[(N[Exp[(-x$95$m)], $MachinePrecision] + N[(N[Exp[x$95$m], $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e-7], N[(x$95$m * x$95$m + N[(N[(N[(0.08333333333333333 * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision], t$95$0]]
                      
                      \begin{array}{l}
                      x_m = \left|x\right|
                      
                      \\
                      \begin{array}{l}
                      t_0 := e^{-x\_m} + \left(e^{x\_m} - 2\right)\\
                      \mathbf{if}\;t\_0 \leq 2 \cdot 10^{-7}:\\
                      \;\;\;\;\mathsf{fma}\left(x\_m, x\_m, \left(\left(0.08333333333333333 \cdot \left(x\_m \cdot x\_m\right)\right) \cdot x\_m\right) \cdot x\_m\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;t\_0\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if (+.f64 (-.f64 (exp.f64 x) #s(literal 2 binary64)) (exp.f64 (neg.f64 x))) < 1.9999999999999999e-7

                        1. Initial program 47.8%

                          \[\left(e^{x} - 2\right) + e^{-x} \]
                        2. Add Preprocessing
                        3. Taylor expanded in x around 0

                          \[\leadsto \color{blue}{{x}^{2} \cdot \left(1 + \frac{1}{12} \cdot {x}^{2}\right)} \]
                        4. Step-by-step derivation
                          1. +-commutativeN/A

                            \[\leadsto {x}^{2} \cdot \color{blue}{\left(\frac{1}{12} \cdot {x}^{2} + 1\right)} \]
                          2. distribute-lft-inN/A

                            \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{12} \cdot {x}^{2}\right) + {x}^{2} \cdot 1} \]
                          3. *-commutativeN/A

                            \[\leadsto {x}^{2} \cdot \color{blue}{\left({x}^{2} \cdot \frac{1}{12}\right)} + {x}^{2} \cdot 1 \]
                          4. associate-*r*N/A

                            \[\leadsto \color{blue}{\left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{1}{12}} + {x}^{2} \cdot 1 \]
                          5. *-rgt-identityN/A

                            \[\leadsto \left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{1}{12} + \color{blue}{{x}^{2}} \]
                          6. lower-fma.f64N/A

                            \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{2} \cdot {x}^{2}, \frac{1}{12}, {x}^{2}\right)} \]
                          7. pow-sqrN/A

                            \[\leadsto \mathsf{fma}\left(\color{blue}{{x}^{\left(2 \cdot 2\right)}}, \frac{1}{12}, {x}^{2}\right) \]
                          8. lower-pow.f64N/A

                            \[\leadsto \mathsf{fma}\left(\color{blue}{{x}^{\left(2 \cdot 2\right)}}, \frac{1}{12}, {x}^{2}\right) \]
                          9. metadata-evalN/A

                            \[\leadsto \mathsf{fma}\left({x}^{\color{blue}{4}}, \frac{1}{12}, {x}^{2}\right) \]
                          10. unpow2N/A

                            \[\leadsto \mathsf{fma}\left({x}^{4}, \frac{1}{12}, \color{blue}{x \cdot x}\right) \]
                          11. lower-*.f64100.0

                            \[\leadsto \mathsf{fma}\left({x}^{4}, 0.08333333333333333, \color{blue}{x \cdot x}\right) \]
                        5. Applied rewrites100.0%

                          \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{4}, 0.08333333333333333, x \cdot x\right)} \]
                        6. Step-by-step derivation
                          1. Applied rewrites100.0%

                            \[\leadsto \mathsf{fma}\left(x, \color{blue}{x}, 0.08333333333333333 \cdot {x}^{4}\right) \]
                          2. Step-by-step derivation
                            1. Applied rewrites100.0%

                              \[\leadsto \mathsf{fma}\left(x, x, x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.08333333333333333\right)\right)\right) \]

                            if 1.9999999999999999e-7 < (+.f64 (-.f64 (exp.f64 x) #s(literal 2 binary64)) (exp.f64 (neg.f64 x)))

                            1. Initial program 98.8%

                              \[\left(e^{x} - 2\right) + e^{-x} \]
                            2. Add Preprocessing
                          3. Recombined 2 regimes into one program.
                          4. Final simplification100.0%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;e^{-x} + \left(e^{x} - 2\right) \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(x, x, \left(\left(0.08333333333333333 \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;e^{-x} + \left(e^{x} - 2\right)\\ \end{array} \]
                          5. Add Preprocessing

                          Alternative 7: 99.8% accurate, 0.7× speedup?

                          \[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;e^{-x\_m} + \left(e^{x\_m} - 2\right) \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(x\_m, x\_m, \left(\left(0.08333333333333333 \cdot \left(x\_m \cdot x\_m\right)\right) \cdot x\_m\right) \cdot x\_m\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2, \cosh x\_m, -2\right)\\ \end{array} \end{array} \]
                          x_m = (fabs.f64 x)
                          (FPCore (x_m)
                           :precision binary64
                           (if (<= (+ (exp (- x_m)) (- (exp x_m) 2.0)) 2e-7)
                             (fma x_m x_m (* (* (* 0.08333333333333333 (* x_m x_m)) x_m) x_m))
                             (fma 2.0 (cosh x_m) -2.0)))
                          x_m = fabs(x);
                          double code(double x_m) {
                          	double tmp;
                          	if ((exp(-x_m) + (exp(x_m) - 2.0)) <= 2e-7) {
                          		tmp = fma(x_m, x_m, (((0.08333333333333333 * (x_m * x_m)) * x_m) * x_m));
                          	} else {
                          		tmp = fma(2.0, cosh(x_m), -2.0);
                          	}
                          	return tmp;
                          }
                          
                          x_m = abs(x)
                          function code(x_m)
                          	tmp = 0.0
                          	if (Float64(exp(Float64(-x_m)) + Float64(exp(x_m) - 2.0)) <= 2e-7)
                          		tmp = fma(x_m, x_m, Float64(Float64(Float64(0.08333333333333333 * Float64(x_m * x_m)) * x_m) * x_m));
                          	else
                          		tmp = fma(2.0, cosh(x_m), -2.0);
                          	end
                          	return tmp
                          end
                          
                          x_m = N[Abs[x], $MachinePrecision]
                          code[x$95$m_] := If[LessEqual[N[(N[Exp[(-x$95$m)], $MachinePrecision] + N[(N[Exp[x$95$m], $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision], 2e-7], N[(x$95$m * x$95$m + N[(N[(N[(0.08333333333333333 * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[Cosh[x$95$m], $MachinePrecision] + -2.0), $MachinePrecision]]
                          
                          \begin{array}{l}
                          x_m = \left|x\right|
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;e^{-x\_m} + \left(e^{x\_m} - 2\right) \leq 2 \cdot 10^{-7}:\\
                          \;\;\;\;\mathsf{fma}\left(x\_m, x\_m, \left(\left(0.08333333333333333 \cdot \left(x\_m \cdot x\_m\right)\right) \cdot x\_m\right) \cdot x\_m\right)\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\mathsf{fma}\left(2, \cosh x\_m, -2\right)\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if (+.f64 (-.f64 (exp.f64 x) #s(literal 2 binary64)) (exp.f64 (neg.f64 x))) < 1.9999999999999999e-7

                            1. Initial program 47.8%

                              \[\left(e^{x} - 2\right) + e^{-x} \]
                            2. Add Preprocessing
                            3. Taylor expanded in x around 0

                              \[\leadsto \color{blue}{{x}^{2} \cdot \left(1 + \frac{1}{12} \cdot {x}^{2}\right)} \]
                            4. Step-by-step derivation
                              1. +-commutativeN/A

                                \[\leadsto {x}^{2} \cdot \color{blue}{\left(\frac{1}{12} \cdot {x}^{2} + 1\right)} \]
                              2. distribute-lft-inN/A

                                \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{12} \cdot {x}^{2}\right) + {x}^{2} \cdot 1} \]
                              3. *-commutativeN/A

                                \[\leadsto {x}^{2} \cdot \color{blue}{\left({x}^{2} \cdot \frac{1}{12}\right)} + {x}^{2} \cdot 1 \]
                              4. associate-*r*N/A

                                \[\leadsto \color{blue}{\left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{1}{12}} + {x}^{2} \cdot 1 \]
                              5. *-rgt-identityN/A

                                \[\leadsto \left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{1}{12} + \color{blue}{{x}^{2}} \]
                              6. lower-fma.f64N/A

                                \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{2} \cdot {x}^{2}, \frac{1}{12}, {x}^{2}\right)} \]
                              7. pow-sqrN/A

                                \[\leadsto \mathsf{fma}\left(\color{blue}{{x}^{\left(2 \cdot 2\right)}}, \frac{1}{12}, {x}^{2}\right) \]
                              8. lower-pow.f64N/A

                                \[\leadsto \mathsf{fma}\left(\color{blue}{{x}^{\left(2 \cdot 2\right)}}, \frac{1}{12}, {x}^{2}\right) \]
                              9. metadata-evalN/A

                                \[\leadsto \mathsf{fma}\left({x}^{\color{blue}{4}}, \frac{1}{12}, {x}^{2}\right) \]
                              10. unpow2N/A

                                \[\leadsto \mathsf{fma}\left({x}^{4}, \frac{1}{12}, \color{blue}{x \cdot x}\right) \]
                              11. lower-*.f64100.0

                                \[\leadsto \mathsf{fma}\left({x}^{4}, 0.08333333333333333, \color{blue}{x \cdot x}\right) \]
                            5. Applied rewrites100.0%

                              \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{4}, 0.08333333333333333, x \cdot x\right)} \]
                            6. Step-by-step derivation
                              1. Applied rewrites100.0%

                                \[\leadsto \mathsf{fma}\left(x, \color{blue}{x}, 0.08333333333333333 \cdot {x}^{4}\right) \]
                              2. Step-by-step derivation
                                1. Applied rewrites100.0%

                                  \[\leadsto \mathsf{fma}\left(x, x, x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.08333333333333333\right)\right)\right) \]

                                if 1.9999999999999999e-7 < (+.f64 (-.f64 (exp.f64 x) #s(literal 2 binary64)) (exp.f64 (neg.f64 x)))

                                1. Initial program 98.8%

                                  \[\left(e^{x} - 2\right) + e^{-x} \]
                                2. Add Preprocessing
                                3. Step-by-step derivation
                                  1. lift-+.f64N/A

                                    \[\leadsto \color{blue}{\left(e^{x} - 2\right) + e^{-x}} \]
                                  2. +-commutativeN/A

                                    \[\leadsto \color{blue}{e^{-x} + \left(e^{x} - 2\right)} \]
                                  3. lift--.f64N/A

                                    \[\leadsto e^{-x} + \color{blue}{\left(e^{x} - 2\right)} \]
                                  4. sub-negN/A

                                    \[\leadsto e^{-x} + \color{blue}{\left(e^{x} + \left(\mathsf{neg}\left(2\right)\right)\right)} \]
                                  5. associate-+r+N/A

                                    \[\leadsto \color{blue}{\left(e^{-x} + e^{x}\right) + \left(\mathsf{neg}\left(2\right)\right)} \]
                                  6. +-commutativeN/A

                                    \[\leadsto \color{blue}{\left(e^{x} + e^{-x}\right)} + \left(\mathsf{neg}\left(2\right)\right) \]
                                  7. lift-exp.f64N/A

                                    \[\leadsto \left(\color{blue}{e^{x}} + e^{-x}\right) + \left(\mathsf{neg}\left(2\right)\right) \]
                                  8. lift-exp.f64N/A

                                    \[\leadsto \left(e^{x} + \color{blue}{e^{-x}}\right) + \left(\mathsf{neg}\left(2\right)\right) \]
                                  9. lift-neg.f64N/A

                                    \[\leadsto \left(e^{x} + e^{\color{blue}{\mathsf{neg}\left(x\right)}}\right) + \left(\mathsf{neg}\left(2\right)\right) \]
                                  10. cosh-undefN/A

                                    \[\leadsto \color{blue}{2 \cdot \cosh x} + \left(\mathsf{neg}\left(2\right)\right) \]
                                  11. lower-fma.f64N/A

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(2, \cosh x, \mathsf{neg}\left(2\right)\right)} \]
                                  12. lower-cosh.f64N/A

                                    \[\leadsto \mathsf{fma}\left(2, \color{blue}{\cosh x}, \mathsf{neg}\left(2\right)\right) \]
                                  13. metadata-eval98.4

                                    \[\leadsto \mathsf{fma}\left(2, \cosh x, \color{blue}{-2}\right) \]
                                4. Applied rewrites98.4%

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(2, \cosh x, -2\right)} \]
                              3. Recombined 2 regimes into one program.
                              4. Final simplification100.0%

                                \[\leadsto \begin{array}{l} \mathbf{if}\;e^{-x} + \left(e^{x} - 2\right) \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\mathsf{fma}\left(x, x, \left(\left(0.08333333333333333 \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2, \cosh x, -2\right)\\ \end{array} \]
                              5. Add Preprocessing

                              Alternative 8: 99.0% accurate, 7.7× speedup?

                              \[\begin{array}{l} x_m = \left|x\right| \\ \mathsf{fma}\left(x\_m, x\_m, \left(\left(0.08333333333333333 \cdot \left(x\_m \cdot x\_m\right)\right) \cdot x\_m\right) \cdot x\_m\right) \end{array} \]
                              x_m = (fabs.f64 x)
                              (FPCore (x_m)
                               :precision binary64
                               (fma x_m x_m (* (* (* 0.08333333333333333 (* x_m x_m)) x_m) x_m)))
                              x_m = fabs(x);
                              double code(double x_m) {
                              	return fma(x_m, x_m, (((0.08333333333333333 * (x_m * x_m)) * x_m) * x_m));
                              }
                              
                              x_m = abs(x)
                              function code(x_m)
                              	return fma(x_m, x_m, Float64(Float64(Float64(0.08333333333333333 * Float64(x_m * x_m)) * x_m) * x_m))
                              end
                              
                              x_m = N[Abs[x], $MachinePrecision]
                              code[x$95$m_] := N[(x$95$m * x$95$m + N[(N[(N[(0.08333333333333333 * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision] * x$95$m), $MachinePrecision] * x$95$m), $MachinePrecision]), $MachinePrecision]
                              
                              \begin{array}{l}
                              x_m = \left|x\right|
                              
                              \\
                              \mathsf{fma}\left(x\_m, x\_m, \left(\left(0.08333333333333333 \cdot \left(x\_m \cdot x\_m\right)\right) \cdot x\_m\right) \cdot x\_m\right)
                              \end{array}
                              
                              Derivation
                              1. Initial program 49.2%

                                \[\left(e^{x} - 2\right) + e^{-x} \]
                              2. Add Preprocessing
                              3. Taylor expanded in x around 0

                                \[\leadsto \color{blue}{{x}^{2} \cdot \left(1 + \frac{1}{12} \cdot {x}^{2}\right)} \]
                              4. Step-by-step derivation
                                1. +-commutativeN/A

                                  \[\leadsto {x}^{2} \cdot \color{blue}{\left(\frac{1}{12} \cdot {x}^{2} + 1\right)} \]
                                2. distribute-lft-inN/A

                                  \[\leadsto \color{blue}{{x}^{2} \cdot \left(\frac{1}{12} \cdot {x}^{2}\right) + {x}^{2} \cdot 1} \]
                                3. *-commutativeN/A

                                  \[\leadsto {x}^{2} \cdot \color{blue}{\left({x}^{2} \cdot \frac{1}{12}\right)} + {x}^{2} \cdot 1 \]
                                4. associate-*r*N/A

                                  \[\leadsto \color{blue}{\left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{1}{12}} + {x}^{2} \cdot 1 \]
                                5. *-rgt-identityN/A

                                  \[\leadsto \left({x}^{2} \cdot {x}^{2}\right) \cdot \frac{1}{12} + \color{blue}{{x}^{2}} \]
                                6. lower-fma.f64N/A

                                  \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{2} \cdot {x}^{2}, \frac{1}{12}, {x}^{2}\right)} \]
                                7. pow-sqrN/A

                                  \[\leadsto \mathsf{fma}\left(\color{blue}{{x}^{\left(2 \cdot 2\right)}}, \frac{1}{12}, {x}^{2}\right) \]
                                8. lower-pow.f64N/A

                                  \[\leadsto \mathsf{fma}\left(\color{blue}{{x}^{\left(2 \cdot 2\right)}}, \frac{1}{12}, {x}^{2}\right) \]
                                9. metadata-evalN/A

                                  \[\leadsto \mathsf{fma}\left({x}^{\color{blue}{4}}, \frac{1}{12}, {x}^{2}\right) \]
                                10. unpow2N/A

                                  \[\leadsto \mathsf{fma}\left({x}^{4}, \frac{1}{12}, \color{blue}{x \cdot x}\right) \]
                                11. lower-*.f6497.8

                                  \[\leadsto \mathsf{fma}\left({x}^{4}, 0.08333333333333333, \color{blue}{x \cdot x}\right) \]
                              5. Applied rewrites97.8%

                                \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{4}, 0.08333333333333333, x \cdot x\right)} \]
                              6. Step-by-step derivation
                                1. Applied rewrites97.8%

                                  \[\leadsto \mathsf{fma}\left(x, \color{blue}{x}, 0.08333333333333333 \cdot {x}^{4}\right) \]
                                2. Step-by-step derivation
                                  1. Applied rewrites97.8%

                                    \[\leadsto \mathsf{fma}\left(x, x, x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.08333333333333333\right)\right)\right) \]
                                  2. Final simplification97.8%

                                    \[\leadsto \mathsf{fma}\left(x, x, \left(\left(0.08333333333333333 \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot x\right) \]
                                  3. Add Preprocessing

                                  Alternative 9: 98.4% accurate, 34.8× speedup?

                                  \[\begin{array}{l} x_m = \left|x\right| \\ x\_m \cdot x\_m \end{array} \]
                                  x_m = (fabs.f64 x)
                                  (FPCore (x_m) :precision binary64 (* x_m x_m))
                                  x_m = fabs(x);
                                  double code(double x_m) {
                                  	return x_m * x_m;
                                  }
                                  
                                  x_m = abs(x)
                                  real(8) function code(x_m)
                                      real(8), intent (in) :: x_m
                                      code = x_m * x_m
                                  end function
                                  
                                  x_m = Math.abs(x);
                                  public static double code(double x_m) {
                                  	return x_m * x_m;
                                  }
                                  
                                  x_m = math.fabs(x)
                                  def code(x_m):
                                  	return x_m * x_m
                                  
                                  x_m = abs(x)
                                  function code(x_m)
                                  	return Float64(x_m * x_m)
                                  end
                                  
                                  x_m = abs(x);
                                  function tmp = code(x_m)
                                  	tmp = x_m * x_m;
                                  end
                                  
                                  x_m = N[Abs[x], $MachinePrecision]
                                  code[x$95$m_] := N[(x$95$m * x$95$m), $MachinePrecision]
                                  
                                  \begin{array}{l}
                                  x_m = \left|x\right|
                                  
                                  \\
                                  x\_m \cdot x\_m
                                  \end{array}
                                  
                                  Derivation
                                  1. Initial program 49.2%

                                    \[\left(e^{x} - 2\right) + e^{-x} \]
                                  2. Add Preprocessing
                                  3. Taylor expanded in x around 0

                                    \[\leadsto \color{blue}{{x}^{2}} \]
                                  4. Step-by-step derivation
                                    1. unpow2N/A

                                      \[\leadsto \color{blue}{x \cdot x} \]
                                    2. lower-*.f6497.3

                                      \[\leadsto \color{blue}{x \cdot x} \]
                                  5. Applied rewrites97.3%

                                    \[\leadsto \color{blue}{x \cdot x} \]
                                  6. Add Preprocessing

                                  Developer Target 1: 99.9% accurate, 0.9× speedup?

                                  \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sinh \left(\frac{x}{2}\right)\\ 4 \cdot \left(t\_0 \cdot t\_0\right) \end{array} \end{array} \]
                                  (FPCore (x)
                                   :precision binary64
                                   (let* ((t_0 (sinh (/ x 2.0)))) (* 4.0 (* t_0 t_0))))
                                  double code(double x) {
                                  	double t_0 = sinh((x / 2.0));
                                  	return 4.0 * (t_0 * t_0);
                                  }
                                  
                                  real(8) function code(x)
                                      real(8), intent (in) :: x
                                      real(8) :: t_0
                                      t_0 = sinh((x / 2.0d0))
                                      code = 4.0d0 * (t_0 * t_0)
                                  end function
                                  
                                  public static double code(double x) {
                                  	double t_0 = Math.sinh((x / 2.0));
                                  	return 4.0 * (t_0 * t_0);
                                  }
                                  
                                  def code(x):
                                  	t_0 = math.sinh((x / 2.0))
                                  	return 4.0 * (t_0 * t_0)
                                  
                                  function code(x)
                                  	t_0 = sinh(Float64(x / 2.0))
                                  	return Float64(4.0 * Float64(t_0 * t_0))
                                  end
                                  
                                  function tmp = code(x)
                                  	t_0 = sinh((x / 2.0));
                                  	tmp = 4.0 * (t_0 * t_0);
                                  end
                                  
                                  code[x_] := Block[{t$95$0 = N[Sinh[N[(x / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(4.0 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  \begin{array}{l}
                                  t_0 := \sinh \left(\frac{x}{2}\right)\\
                                  4 \cdot \left(t\_0 \cdot t\_0\right)
                                  \end{array}
                                  \end{array}
                                  

                                  Reproduce

                                  ?
                                  herbie shell --seed 2024277 
                                  (FPCore (x)
                                    :name "exp2 (problem 3.3.7)"
                                    :precision binary64
                                    :pre (<= (fabs x) 710.0)
                                  
                                    :alt
                                    (! :herbie-platform default (* 4 (* (sinh (/ x 2)) (sinh (/ x 2)))))
                                  
                                    (+ (- (exp x) 2.0) (exp (- x))))