expax (section 3.5)

Percentage Accurate: 54.5% → 100.0%
Time: 7.5s
Alternatives: 13
Speedup: 18.2×

Specification

?
\[710 > a \cdot x\]
\[\begin{array}{l} \\ e^{a \cdot x} - 1 \end{array} \]
(FPCore (a x) :precision binary64 (- (exp (* a x)) 1.0))
double code(double a, double x) {
	return exp((a * x)) - 1.0;
}
real(8) function code(a, x)
    real(8), intent (in) :: a
    real(8), intent (in) :: x
    code = exp((a * x)) - 1.0d0
end function
public static double code(double a, double x) {
	return Math.exp((a * x)) - 1.0;
}
def code(a, x):
	return math.exp((a * x)) - 1.0
function code(a, x)
	return Float64(exp(Float64(a * x)) - 1.0)
end
function tmp = code(a, x)
	tmp = exp((a * x)) - 1.0;
end
code[a_, x_] := N[(N[Exp[N[(a * x), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision]
\begin{array}{l}

\\
e^{a \cdot x} - 1
\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 13 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: 54.5% accurate, 1.0× speedup?

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

\\
e^{a \cdot x} - 1
\end{array}

Alternative 1: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \mathsf{expm1}\left(a \cdot x\right) \end{array} \]
(FPCore (a x) :precision binary64 (expm1 (* a x)))
double code(double a, double x) {
	return expm1((a * x));
}
public static double code(double a, double x) {
	return Math.expm1((a * x));
}
def code(a, x):
	return math.expm1((a * x))
function code(a, x)
	return expm1(Float64(a * x))
end
code[a_, x_] := N[(Exp[N[(a * x), $MachinePrecision]] - 1), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{expm1}\left(a \cdot x\right)
\end{array}
Derivation
  1. Initial program 52.7%

    \[e^{a \cdot x} - 1 \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \color{blue}{e^{a \cdot x} - 1} \]
    2. lift-exp.f64N/A

      \[\leadsto \color{blue}{e^{a \cdot x}} - 1 \]
    3. lower-expm1.f64100.0

      \[\leadsto \color{blue}{\mathsf{expm1}\left(a \cdot x\right)} \]
    4. lift-*.f64N/A

      \[\leadsto \mathsf{expm1}\left(\color{blue}{a \cdot x}\right) \]
    5. *-commutativeN/A

      \[\leadsto \mathsf{expm1}\left(\color{blue}{x \cdot a}\right) \]
    6. lower-*.f64100.0

      \[\leadsto \mathsf{expm1}\left(\color{blue}{x \cdot a}\right) \]
  4. Applied rewrites100.0%

    \[\leadsto \color{blue}{\mathsf{expm1}\left(x \cdot a\right)} \]
  5. Final simplification100.0%

    \[\leadsto \mathsf{expm1}\left(a \cdot x\right) \]
  6. Add Preprocessing

Alternative 2: 99.2% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\left(-a\right) \cdot x, a, a\right), x, -1\right) \cdot x, a, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664 \cdot x, a, 0.16666666666666666\right), a \cdot x, 0.5\right) \cdot x, a, 1\right) \cdot \left(a \cdot x\right)\\ \end{array} \end{array} \]
(FPCore (a x)
 :precision binary64
 (if (<= (* a x) -200.0)
   (- (/ 1.0 (fma (* (fma (fma (* (- a) x) a a) x -1.0) x) a 1.0)) 1.0)
   (*
    (fma
     (*
      (fma (fma (* 0.041666666666666664 x) a 0.16666666666666666) (* a x) 0.5)
      x)
     a
     1.0)
    (* a x))))
double code(double a, double x) {
	double tmp;
	if ((a * x) <= -200.0) {
		tmp = (1.0 / fma((fma(fma((-a * x), a, a), x, -1.0) * x), a, 1.0)) - 1.0;
	} else {
		tmp = fma((fma(fma((0.041666666666666664 * x), a, 0.16666666666666666), (a * x), 0.5) * x), a, 1.0) * (a * x);
	}
	return tmp;
}
function code(a, x)
	tmp = 0.0
	if (Float64(a * x) <= -200.0)
		tmp = Float64(Float64(1.0 / fma(Float64(fma(fma(Float64(Float64(-a) * x), a, a), x, -1.0) * x), a, 1.0)) - 1.0);
	else
		tmp = Float64(fma(Float64(fma(fma(Float64(0.041666666666666664 * x), a, 0.16666666666666666), Float64(a * x), 0.5) * x), a, 1.0) * Float64(a * x));
	end
	return tmp
end
code[a_, x_] := If[LessEqual[N[(a * x), $MachinePrecision], -200.0], N[(N[(1.0 / N[(N[(N[(N[(N[((-a) * x), $MachinePrecision] * a + a), $MachinePrecision] * x + -1.0), $MachinePrecision] * x), $MachinePrecision] * a + 1.0), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision], N[(N[(N[(N[(N[(N[(0.041666666666666664 * x), $MachinePrecision] * a + 0.16666666666666666), $MachinePrecision] * N[(a * x), $MachinePrecision] + 0.5), $MachinePrecision] * x), $MachinePrecision] * a + 1.0), $MachinePrecision] * N[(a * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;a \cdot x \leq -200:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\left(-a\right) \cdot x, a, a\right), x, -1\right) \cdot x, a, 1\right)} - 1\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664 \cdot x, a, 0.16666666666666666\right), a \cdot x, 0.5\right) \cdot x, a, 1\right) \cdot \left(a \cdot x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 a x) < -200

    1. Initial program 100.0%

      \[e^{a \cdot x} - 1 \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0

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

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

        \[\leadsto \left(\color{blue}{x \cdot a} + 1\right) - 1 \]
      3. lower-fma.f645.1

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
    5. Applied rewrites5.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
    6. Step-by-step derivation
      1. Applied rewrites8.4%

        \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot x, x, 1 - a \cdot x\right)}{\mathsf{fma}\left(\left(\left(a \cdot a\right) \cdot x\right) \cdot x, a \cdot x, 1\right)}}} - 1 \]
      2. Taylor expanded in a around 0

        \[\leadsto \frac{1}{1 + \color{blue}{a \cdot \left(-1 \cdot x + a \cdot \left(-1 \cdot \left(a \cdot {x}^{3}\right) + {x}^{2}\right)\right)}} - 1 \]
      3. Step-by-step derivation
        1. Applied rewrites99.5%

          \[\leadsto \frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\left(\left(-x\right) \cdot x\right) \cdot x, a, x \cdot x\right), a, -x\right), \color{blue}{a}, 1\right)} - 1 \]
        2. Taylor expanded in x around 0

          \[\leadsto \frac{1}{\mathsf{fma}\left(x \cdot \left(x \cdot \left(a + -1 \cdot \left({a}^{2} \cdot x\right)\right) - 1\right), a, 1\right)} - 1 \]
        3. Step-by-step derivation
          1. Applied rewrites99.5%

            \[\leadsto \frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\left(-a\right) \cdot x, a, a\right), x, -1\right) \cdot x, a, 1\right)} - 1 \]

          if -200 < (*.f64 a x)

          1. Initial program 30.9%

            \[e^{a \cdot x} - 1 \]
          2. Add Preprocessing
          3. Taylor expanded in a around 0

            \[\leadsto \color{blue}{a \cdot \left(x + a \cdot \left(\frac{1}{2} \cdot {x}^{2} + a \cdot \left(\frac{1}{24} \cdot \left(a \cdot {x}^{4}\right) + \frac{1}{6} \cdot {x}^{3}\right)\right)\right)} \]
          4. Applied rewrites100.0%

            \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664 \cdot x, a, 0.16666666666666666\right), x \cdot a, 0.5\right) \cdot x, a, 1\right) \cdot \left(x \cdot a\right)} \]
        4. Recombined 2 regimes into one program.
        5. Final simplification99.8%

          \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\left(-a\right) \cdot x, a, a\right), x, -1\right) \cdot x, a, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664 \cdot x, a, 0.16666666666666666\right), a \cdot x, 0.5\right) \cdot x, a, 1\right) \cdot \left(a \cdot x\right)\\ \end{array} \]
        6. Add Preprocessing

        Alternative 3: 99.2% accurate, 2.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\left(\left(\left(\left(-a\right) \cdot x\right) \cdot x\right) \cdot a\right) \cdot x, a, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664 \cdot x, a, 0.16666666666666666\right), a \cdot x, 0.5\right) \cdot x, a, 1\right) \cdot \left(a \cdot x\right)\\ \end{array} \end{array} \]
        (FPCore (a x)
         :precision binary64
         (if (<= (* a x) -200.0)
           (- (/ 1.0 (fma (* (* (* (* (- a) x) x) a) x) a 1.0)) 1.0)
           (*
            (fma
             (*
              (fma (fma (* 0.041666666666666664 x) a 0.16666666666666666) (* a x) 0.5)
              x)
             a
             1.0)
            (* a x))))
        double code(double a, double x) {
        	double tmp;
        	if ((a * x) <= -200.0) {
        		tmp = (1.0 / fma(((((-a * x) * x) * a) * x), a, 1.0)) - 1.0;
        	} else {
        		tmp = fma((fma(fma((0.041666666666666664 * x), a, 0.16666666666666666), (a * x), 0.5) * x), a, 1.0) * (a * x);
        	}
        	return tmp;
        }
        
        function code(a, x)
        	tmp = 0.0
        	if (Float64(a * x) <= -200.0)
        		tmp = Float64(Float64(1.0 / fma(Float64(Float64(Float64(Float64(Float64(-a) * x) * x) * a) * x), a, 1.0)) - 1.0);
        	else
        		tmp = Float64(fma(Float64(fma(fma(Float64(0.041666666666666664 * x), a, 0.16666666666666666), Float64(a * x), 0.5) * x), a, 1.0) * Float64(a * x));
        	end
        	return tmp
        end
        
        code[a_, x_] := If[LessEqual[N[(a * x), $MachinePrecision], -200.0], N[(N[(1.0 / N[(N[(N[(N[(N[((-a) * x), $MachinePrecision] * x), $MachinePrecision] * a), $MachinePrecision] * x), $MachinePrecision] * a + 1.0), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision], N[(N[(N[(N[(N[(N[(0.041666666666666664 * x), $MachinePrecision] * a + 0.16666666666666666), $MachinePrecision] * N[(a * x), $MachinePrecision] + 0.5), $MachinePrecision] * x), $MachinePrecision] * a + 1.0), $MachinePrecision] * N[(a * x), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;a \cdot x \leq -200:\\
        \;\;\;\;\frac{1}{\mathsf{fma}\left(\left(\left(\left(\left(-a\right) \cdot x\right) \cdot x\right) \cdot a\right) \cdot x, a, 1\right)} - 1\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664 \cdot x, a, 0.16666666666666666\right), a \cdot x, 0.5\right) \cdot x, a, 1\right) \cdot \left(a \cdot x\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (*.f64 a x) < -200

          1. Initial program 100.0%

            \[e^{a \cdot x} - 1 \]
          2. Add Preprocessing
          3. Taylor expanded in a around 0

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

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

              \[\leadsto \left(\color{blue}{x \cdot a} + 1\right) - 1 \]
            3. lower-fma.f645.1

              \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
          5. Applied rewrites5.1%

            \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
          6. Step-by-step derivation
            1. Applied rewrites8.4%

              \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot x, x, 1 - a \cdot x\right)}{\mathsf{fma}\left(\left(\left(a \cdot a\right) \cdot x\right) \cdot x, a \cdot x, 1\right)}}} - 1 \]
            2. Taylor expanded in a around 0

              \[\leadsto \frac{1}{1 + \color{blue}{a \cdot \left(-1 \cdot x + a \cdot \left(-1 \cdot \left(a \cdot {x}^{3}\right) + {x}^{2}\right)\right)}} - 1 \]
            3. Step-by-step derivation
              1. Applied rewrites99.5%

                \[\leadsto \frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\left(\left(-x\right) \cdot x\right) \cdot x, a, x \cdot x\right), a, -x\right), \color{blue}{a}, 1\right)} - 1 \]
              2. Taylor expanded in x around inf

                \[\leadsto \frac{1}{\mathsf{fma}\left(-1 \cdot \left({a}^{2} \cdot {x}^{3}\right), a, 1\right)} - 1 \]
              3. Step-by-step derivation
                1. Applied rewrites99.5%

                  \[\leadsto \frac{1}{\mathsf{fma}\left(\left(\left(\left(\left(-a\right) \cdot x\right) \cdot x\right) \cdot a\right) \cdot x, a, 1\right)} - 1 \]

                if -200 < (*.f64 a x)

                1. Initial program 30.9%

                  \[e^{a \cdot x} - 1 \]
                2. Add Preprocessing
                3. Taylor expanded in a around 0

                  \[\leadsto \color{blue}{a \cdot \left(x + a \cdot \left(\frac{1}{2} \cdot {x}^{2} + a \cdot \left(\frac{1}{24} \cdot \left(a \cdot {x}^{4}\right) + \frac{1}{6} \cdot {x}^{3}\right)\right)\right)} \]
                4. Applied rewrites100.0%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664 \cdot x, a, 0.16666666666666666\right), x \cdot a, 0.5\right) \cdot x, a, 1\right) \cdot \left(x \cdot a\right)} \]
              4. Recombined 2 regimes into one program.
              5. Final simplification99.8%

                \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\left(\left(\left(\left(-a\right) \cdot x\right) \cdot x\right) \cdot a\right) \cdot x, a, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664 \cdot x, a, 0.16666666666666666\right), a \cdot x, 0.5\right) \cdot x, a, 1\right) \cdot \left(a \cdot x\right)\\ \end{array} \]
              6. Add Preprocessing

              Alternative 4: 99.0% accurate, 2.0× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\left(\left(\left(\left(-a\right) \cdot x\right) \cdot x\right) \cdot a\right) \cdot x, a, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a\right) \cdot x, a \cdot x, a \cdot x\right)\\ \end{array} \end{array} \]
              (FPCore (a x)
               :precision binary64
               (if (<= (* a x) -200.0)
                 (- (/ 1.0 (fma (* (* (* (* (- a) x) x) a) x) a 1.0)) 1.0)
                 (fma (* (* (fma (* 0.16666666666666666 x) a 0.5) a) x) (* a x) (* a x))))
              double code(double a, double x) {
              	double tmp;
              	if ((a * x) <= -200.0) {
              		tmp = (1.0 / fma(((((-a * x) * x) * a) * x), a, 1.0)) - 1.0;
              	} else {
              		tmp = fma(((fma((0.16666666666666666 * x), a, 0.5) * a) * x), (a * x), (a * x));
              	}
              	return tmp;
              }
              
              function code(a, x)
              	tmp = 0.0
              	if (Float64(a * x) <= -200.0)
              		tmp = Float64(Float64(1.0 / fma(Float64(Float64(Float64(Float64(Float64(-a) * x) * x) * a) * x), a, 1.0)) - 1.0);
              	else
              		tmp = fma(Float64(Float64(fma(Float64(0.16666666666666666 * x), a, 0.5) * a) * x), Float64(a * x), Float64(a * x));
              	end
              	return tmp
              end
              
              code[a_, x_] := If[LessEqual[N[(a * x), $MachinePrecision], -200.0], N[(N[(1.0 / N[(N[(N[(N[(N[((-a) * x), $MachinePrecision] * x), $MachinePrecision] * a), $MachinePrecision] * x), $MachinePrecision] * a + 1.0), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision], N[(N[(N[(N[(N[(0.16666666666666666 * x), $MachinePrecision] * a + 0.5), $MachinePrecision] * a), $MachinePrecision] * x), $MachinePrecision] * N[(a * x), $MachinePrecision] + N[(a * x), $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;a \cdot x \leq -200:\\
              \;\;\;\;\frac{1}{\mathsf{fma}\left(\left(\left(\left(\left(-a\right) \cdot x\right) \cdot x\right) \cdot a\right) \cdot x, a, 1\right)} - 1\\
              
              \mathbf{else}:\\
              \;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a\right) \cdot x, a \cdot x, a \cdot x\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (*.f64 a x) < -200

                1. Initial program 100.0%

                  \[e^{a \cdot x} - 1 \]
                2. Add Preprocessing
                3. Taylor expanded in a around 0

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

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

                    \[\leadsto \left(\color{blue}{x \cdot a} + 1\right) - 1 \]
                  3. lower-fma.f645.1

                    \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
                5. Applied rewrites5.1%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
                6. Step-by-step derivation
                  1. Applied rewrites8.4%

                    \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot x, x, 1 - a \cdot x\right)}{\mathsf{fma}\left(\left(\left(a \cdot a\right) \cdot x\right) \cdot x, a \cdot x, 1\right)}}} - 1 \]
                  2. Taylor expanded in a around 0

                    \[\leadsto \frac{1}{1 + \color{blue}{a \cdot \left(-1 \cdot x + a \cdot \left(-1 \cdot \left(a \cdot {x}^{3}\right) + {x}^{2}\right)\right)}} - 1 \]
                  3. Step-by-step derivation
                    1. Applied rewrites99.5%

                      \[\leadsto \frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\left(\left(-x\right) \cdot x\right) \cdot x, a, x \cdot x\right), a, -x\right), \color{blue}{a}, 1\right)} - 1 \]
                    2. Taylor expanded in x around inf

                      \[\leadsto \frac{1}{\mathsf{fma}\left(-1 \cdot \left({a}^{2} \cdot {x}^{3}\right), a, 1\right)} - 1 \]
                    3. Step-by-step derivation
                      1. Applied rewrites99.5%

                        \[\leadsto \frac{1}{\mathsf{fma}\left(\left(\left(\left(\left(-a\right) \cdot x\right) \cdot x\right) \cdot a\right) \cdot x, a, 1\right)} - 1 \]

                      if -200 < (*.f64 a x)

                      1. Initial program 30.9%

                        \[e^{a \cdot x} - 1 \]
                      2. Add Preprocessing
                      3. Taylor expanded in a around 0

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

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

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

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

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

                          \[\leadsto a \cdot \left(\color{blue}{\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{3}} + \left(a \cdot \left(\frac{1}{2} \cdot {x}^{2}\right) + x\right)\right) \]
                        6. unpow3N/A

                          \[\leadsto a \cdot \left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} + \left(a \cdot \left(\frac{1}{2} \cdot {x}^{2}\right) + x\right)\right) \]
                        7. unpow2N/A

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

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

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

                          \[\leadsto a \cdot \left(\left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2}\right) \cdot x + \left(\color{blue}{\left(\frac{1}{2} \cdot a\right)} \cdot {x}^{2} + x\right)\right) \]
                        11. unpow2N/A

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

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

                          \[\leadsto a \cdot \left(\left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2}\right) \cdot x + \color{blue}{\left(\left(\frac{1}{2} \cdot a\right) \cdot x + 1\right) \cdot x}\right) \]
                        14. distribute-rgt-outN/A

                          \[\leadsto a \cdot \color{blue}{\left(x \cdot \left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2} + \left(\left(\frac{1}{2} \cdot a\right) \cdot x + 1\right)\right)\right)} \]
                      5. Applied rewrites99.9%

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a, x, 1\right) \cdot \left(x \cdot a\right)} \]
                      6. Step-by-step derivation
                        1. Applied rewrites99.9%

                          \[\leadsto \mathsf{fma}\left(\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a\right) \cdot x, \color{blue}{x \cdot a}, x \cdot a\right) \]
                      7. Recombined 2 regimes into one program.
                      8. Final simplification99.7%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\left(\left(\left(\left(-a\right) \cdot x\right) \cdot x\right) \cdot a\right) \cdot x, a, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a\right) \cdot x, a \cdot x, a \cdot x\right)\\ \end{array} \]
                      9. Add Preprocessing

                      Alternative 5: 99.0% accurate, 2.1× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\left(\left(\left(\left(\left(-a\right) \cdot x\right) \cdot x\right) \cdot a\right) \cdot x\right) \cdot a} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a\right) \cdot x, a \cdot x, a \cdot x\right)\\ \end{array} \end{array} \]
                      (FPCore (a x)
                       :precision binary64
                       (if (<= (* a x) -200.0)
                         (- (/ 1.0 (* (* (* (* (* (- a) x) x) a) x) a)) 1.0)
                         (fma (* (* (fma (* 0.16666666666666666 x) a 0.5) a) x) (* a x) (* a x))))
                      double code(double a, double x) {
                      	double tmp;
                      	if ((a * x) <= -200.0) {
                      		tmp = (1.0 / (((((-a * x) * x) * a) * x) * a)) - 1.0;
                      	} else {
                      		tmp = fma(((fma((0.16666666666666666 * x), a, 0.5) * a) * x), (a * x), (a * x));
                      	}
                      	return tmp;
                      }
                      
                      function code(a, x)
                      	tmp = 0.0
                      	if (Float64(a * x) <= -200.0)
                      		tmp = Float64(Float64(1.0 / Float64(Float64(Float64(Float64(Float64(Float64(-a) * x) * x) * a) * x) * a)) - 1.0);
                      	else
                      		tmp = fma(Float64(Float64(fma(Float64(0.16666666666666666 * x), a, 0.5) * a) * x), Float64(a * x), Float64(a * x));
                      	end
                      	return tmp
                      end
                      
                      code[a_, x_] := If[LessEqual[N[(a * x), $MachinePrecision], -200.0], N[(N[(1.0 / N[(N[(N[(N[(N[((-a) * x), $MachinePrecision] * x), $MachinePrecision] * a), $MachinePrecision] * x), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision], N[(N[(N[(N[(N[(0.16666666666666666 * x), $MachinePrecision] * a + 0.5), $MachinePrecision] * a), $MachinePrecision] * x), $MachinePrecision] * N[(a * x), $MachinePrecision] + N[(a * x), $MachinePrecision]), $MachinePrecision]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;a \cdot x \leq -200:\\
                      \;\;\;\;\frac{1}{\left(\left(\left(\left(\left(-a\right) \cdot x\right) \cdot x\right) \cdot a\right) \cdot x\right) \cdot a} - 1\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a\right) \cdot x, a \cdot x, a \cdot x\right)\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if (*.f64 a x) < -200

                        1. Initial program 100.0%

                          \[e^{a \cdot x} - 1 \]
                        2. Add Preprocessing
                        3. Taylor expanded in a around 0

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

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

                            \[\leadsto \left(\color{blue}{x \cdot a} + 1\right) - 1 \]
                          3. lower-fma.f645.1

                            \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
                        5. Applied rewrites5.1%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
                        6. Step-by-step derivation
                          1. Applied rewrites8.4%

                            \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot x, x, 1 - a \cdot x\right)}{\mathsf{fma}\left(\left(\left(a \cdot a\right) \cdot x\right) \cdot x, a \cdot x, 1\right)}}} - 1 \]
                          2. Taylor expanded in a around 0

                            \[\leadsto \frac{1}{1 + \color{blue}{a \cdot \left(-1 \cdot x + a \cdot \left(-1 \cdot \left(a \cdot {x}^{3}\right) + {x}^{2}\right)\right)}} - 1 \]
                          3. Step-by-step derivation
                            1. Applied rewrites99.5%

                              \[\leadsto \frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\left(\left(-x\right) \cdot x\right) \cdot x, a, x \cdot x\right), a, -x\right), \color{blue}{a}, 1\right)} - 1 \]
                            2. Taylor expanded in x around inf

                              \[\leadsto \frac{1}{-1 \cdot \left({a}^{3} \cdot \color{blue}{{x}^{3}}\right)} - 1 \]
                            3. Step-by-step derivation
                              1. Applied rewrites99.5%

                                \[\leadsto \frac{1}{\left(\left(\left(\left(\left(-a\right) \cdot x\right) \cdot x\right) \cdot a\right) \cdot x\right) \cdot a} - 1 \]

                              if -200 < (*.f64 a x)

                              1. Initial program 30.9%

                                \[e^{a \cdot x} - 1 \]
                              2. Add Preprocessing
                              3. Taylor expanded in a around 0

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

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

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

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

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

                                  \[\leadsto a \cdot \left(\color{blue}{\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{3}} + \left(a \cdot \left(\frac{1}{2} \cdot {x}^{2}\right) + x\right)\right) \]
                                6. unpow3N/A

                                  \[\leadsto a \cdot \left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} + \left(a \cdot \left(\frac{1}{2} \cdot {x}^{2}\right) + x\right)\right) \]
                                7. unpow2N/A

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

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

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

                                  \[\leadsto a \cdot \left(\left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2}\right) \cdot x + \left(\color{blue}{\left(\frac{1}{2} \cdot a\right)} \cdot {x}^{2} + x\right)\right) \]
                                11. unpow2N/A

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

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

                                  \[\leadsto a \cdot \left(\left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2}\right) \cdot x + \color{blue}{\left(\left(\frac{1}{2} \cdot a\right) \cdot x + 1\right) \cdot x}\right) \]
                                14. distribute-rgt-outN/A

                                  \[\leadsto a \cdot \color{blue}{\left(x \cdot \left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2} + \left(\left(\frac{1}{2} \cdot a\right) \cdot x + 1\right)\right)\right)} \]
                              5. Applied rewrites99.9%

                                \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a, x, 1\right) \cdot \left(x \cdot a\right)} \]
                              6. Step-by-step derivation
                                1. Applied rewrites99.9%

                                  \[\leadsto \mathsf{fma}\left(\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a\right) \cdot x, \color{blue}{x \cdot a}, x \cdot a\right) \]
                              7. Recombined 2 regimes into one program.
                              8. Final simplification99.7%

                                \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\left(\left(\left(\left(\left(-a\right) \cdot x\right) \cdot x\right) \cdot a\right) \cdot x\right) \cdot a} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a\right) \cdot x, a \cdot x, a \cdot x\right)\\ \end{array} \]
                              9. Add Preprocessing

                              Alternative 6: 98.9% accurate, 2.2× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, x, -a\right), x, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a\right) \cdot x, a \cdot x, a \cdot x\right)\\ \end{array} \end{array} \]
                              (FPCore (a x)
                               :precision binary64
                               (if (<= (* a x) -200.0)
                                 (- (/ 1.0 (fma (fma (* a a) x (- a)) x 1.0)) 1.0)
                                 (fma (* (* (fma (* 0.16666666666666666 x) a 0.5) a) x) (* a x) (* a x))))
                              double code(double a, double x) {
                              	double tmp;
                              	if ((a * x) <= -200.0) {
                              		tmp = (1.0 / fma(fma((a * a), x, -a), x, 1.0)) - 1.0;
                              	} else {
                              		tmp = fma(((fma((0.16666666666666666 * x), a, 0.5) * a) * x), (a * x), (a * x));
                              	}
                              	return tmp;
                              }
                              
                              function code(a, x)
                              	tmp = 0.0
                              	if (Float64(a * x) <= -200.0)
                              		tmp = Float64(Float64(1.0 / fma(fma(Float64(a * a), x, Float64(-a)), x, 1.0)) - 1.0);
                              	else
                              		tmp = fma(Float64(Float64(fma(Float64(0.16666666666666666 * x), a, 0.5) * a) * x), Float64(a * x), Float64(a * x));
                              	end
                              	return tmp
                              end
                              
                              code[a_, x_] := If[LessEqual[N[(a * x), $MachinePrecision], -200.0], N[(N[(1.0 / N[(N[(N[(a * a), $MachinePrecision] * x + (-a)), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision], N[(N[(N[(N[(N[(0.16666666666666666 * x), $MachinePrecision] * a + 0.5), $MachinePrecision] * a), $MachinePrecision] * x), $MachinePrecision] * N[(a * x), $MachinePrecision] + N[(a * x), $MachinePrecision]), $MachinePrecision]]
                              
                              \begin{array}{l}
                              
                              \\
                              \begin{array}{l}
                              \mathbf{if}\;a \cdot x \leq -200:\\
                              \;\;\;\;\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, x, -a\right), x, 1\right)} - 1\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a\right) \cdot x, a \cdot x, a \cdot x\right)\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 2 regimes
                              2. if (*.f64 a x) < -200

                                1. Initial program 100.0%

                                  \[e^{a \cdot x} - 1 \]
                                2. Add Preprocessing
                                3. Taylor expanded in a around 0

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

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

                                    \[\leadsto \left(\color{blue}{x \cdot a} + 1\right) - 1 \]
                                  3. lower-fma.f645.1

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
                                5. Applied rewrites5.1%

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
                                6. Step-by-step derivation
                                  1. Applied rewrites8.4%

                                    \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot x, x, 1 - a \cdot x\right)}{\mathsf{fma}\left(\left(\left(a \cdot a\right) \cdot x\right) \cdot x, a \cdot x, 1\right)}}} - 1 \]
                                  2. Taylor expanded in a around 0

                                    \[\leadsto \frac{1}{1 + \color{blue}{a \cdot \left(-1 \cdot x + a \cdot {x}^{2}\right)}} - 1 \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites98.4%

                                      \[\leadsto \frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, x, -a\right), \color{blue}{x}, 1\right)} - 1 \]

                                    if -200 < (*.f64 a x)

                                    1. Initial program 30.9%

                                      \[e^{a \cdot x} - 1 \]
                                    2. Add Preprocessing
                                    3. Taylor expanded in a around 0

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

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

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

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

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

                                        \[\leadsto a \cdot \left(\color{blue}{\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{3}} + \left(a \cdot \left(\frac{1}{2} \cdot {x}^{2}\right) + x\right)\right) \]
                                      6. unpow3N/A

                                        \[\leadsto a \cdot \left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} + \left(a \cdot \left(\frac{1}{2} \cdot {x}^{2}\right) + x\right)\right) \]
                                      7. unpow2N/A

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

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

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

                                        \[\leadsto a \cdot \left(\left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2}\right) \cdot x + \left(\color{blue}{\left(\frac{1}{2} \cdot a\right)} \cdot {x}^{2} + x\right)\right) \]
                                      11. unpow2N/A

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

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

                                        \[\leadsto a \cdot \left(\left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2}\right) \cdot x + \color{blue}{\left(\left(\frac{1}{2} \cdot a\right) \cdot x + 1\right) \cdot x}\right) \]
                                      14. distribute-rgt-outN/A

                                        \[\leadsto a \cdot \color{blue}{\left(x \cdot \left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2} + \left(\left(\frac{1}{2} \cdot a\right) \cdot x + 1\right)\right)\right)} \]
                                    5. Applied rewrites99.9%

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a, x, 1\right) \cdot \left(x \cdot a\right)} \]
                                    6. Step-by-step derivation
                                      1. Applied rewrites99.9%

                                        \[\leadsto \mathsf{fma}\left(\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a\right) \cdot x, \color{blue}{x \cdot a}, x \cdot a\right) \]
                                    7. Recombined 2 regimes into one program.
                                    8. Final simplification99.4%

                                      \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, x, -a\right), x, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a\right) \cdot x, a \cdot x, a \cdot x\right)\\ \end{array} \]
                                    9. Add Preprocessing

                                    Alternative 7: 98.9% accurate, 2.4× speedup?

                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, x, -a\right), x, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a, x, 1\right) \cdot \left(a \cdot x\right)\\ \end{array} \end{array} \]
                                    (FPCore (a x)
                                     :precision binary64
                                     (if (<= (* a x) -200.0)
                                       (- (/ 1.0 (fma (fma (* a a) x (- a)) x 1.0)) 1.0)
                                       (* (fma (* (fma (* 0.16666666666666666 x) a 0.5) a) x 1.0) (* a x))))
                                    double code(double a, double x) {
                                    	double tmp;
                                    	if ((a * x) <= -200.0) {
                                    		tmp = (1.0 / fma(fma((a * a), x, -a), x, 1.0)) - 1.0;
                                    	} else {
                                    		tmp = fma((fma((0.16666666666666666 * x), a, 0.5) * a), x, 1.0) * (a * x);
                                    	}
                                    	return tmp;
                                    }
                                    
                                    function code(a, x)
                                    	tmp = 0.0
                                    	if (Float64(a * x) <= -200.0)
                                    		tmp = Float64(Float64(1.0 / fma(fma(Float64(a * a), x, Float64(-a)), x, 1.0)) - 1.0);
                                    	else
                                    		tmp = Float64(fma(Float64(fma(Float64(0.16666666666666666 * x), a, 0.5) * a), x, 1.0) * Float64(a * x));
                                    	end
                                    	return tmp
                                    end
                                    
                                    code[a_, x_] := If[LessEqual[N[(a * x), $MachinePrecision], -200.0], N[(N[(1.0 / N[(N[(N[(a * a), $MachinePrecision] * x + (-a)), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision], N[(N[(N[(N[(N[(0.16666666666666666 * x), $MachinePrecision] * a + 0.5), $MachinePrecision] * a), $MachinePrecision] * x + 1.0), $MachinePrecision] * N[(a * x), $MachinePrecision]), $MachinePrecision]]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \begin{array}{l}
                                    \mathbf{if}\;a \cdot x \leq -200:\\
                                    \;\;\;\;\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, x, -a\right), x, 1\right)} - 1\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a, x, 1\right) \cdot \left(a \cdot x\right)\\
                                    
                                    
                                    \end{array}
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 2 regimes
                                    2. if (*.f64 a x) < -200

                                      1. Initial program 100.0%

                                        \[e^{a \cdot x} - 1 \]
                                      2. Add Preprocessing
                                      3. Taylor expanded in a around 0

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

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

                                          \[\leadsto \left(\color{blue}{x \cdot a} + 1\right) - 1 \]
                                        3. lower-fma.f645.1

                                          \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
                                      5. Applied rewrites5.1%

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
                                      6. Step-by-step derivation
                                        1. Applied rewrites8.4%

                                          \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot x, x, 1 - a \cdot x\right)}{\mathsf{fma}\left(\left(\left(a \cdot a\right) \cdot x\right) \cdot x, a \cdot x, 1\right)}}} - 1 \]
                                        2. Taylor expanded in a around 0

                                          \[\leadsto \frac{1}{1 + \color{blue}{a \cdot \left(-1 \cdot x + a \cdot {x}^{2}\right)}} - 1 \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites98.4%

                                            \[\leadsto \frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, x, -a\right), \color{blue}{x}, 1\right)} - 1 \]

                                          if -200 < (*.f64 a x)

                                          1. Initial program 30.9%

                                            \[e^{a \cdot x} - 1 \]
                                          2. Add Preprocessing
                                          3. Taylor expanded in a around 0

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

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

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

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

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

                                              \[\leadsto a \cdot \left(\color{blue}{\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{3}} + \left(a \cdot \left(\frac{1}{2} \cdot {x}^{2}\right) + x\right)\right) \]
                                            6. unpow3N/A

                                              \[\leadsto a \cdot \left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} + \left(a \cdot \left(\frac{1}{2} \cdot {x}^{2}\right) + x\right)\right) \]
                                            7. unpow2N/A

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

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

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

                                              \[\leadsto a \cdot \left(\left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2}\right) \cdot x + \left(\color{blue}{\left(\frac{1}{2} \cdot a\right)} \cdot {x}^{2} + x\right)\right) \]
                                            11. unpow2N/A

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

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

                                              \[\leadsto a \cdot \left(\left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2}\right) \cdot x + \color{blue}{\left(\left(\frac{1}{2} \cdot a\right) \cdot x + 1\right) \cdot x}\right) \]
                                            14. distribute-rgt-outN/A

                                              \[\leadsto a \cdot \color{blue}{\left(x \cdot \left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2} + \left(\left(\frac{1}{2} \cdot a\right) \cdot x + 1\right)\right)\right)} \]
                                          5. Applied rewrites99.9%

                                            \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a, x, 1\right) \cdot \left(x \cdot a\right)} \]
                                        4. Recombined 2 regimes into one program.
                                        5. Final simplification99.4%

                                          \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, x, -a\right), x, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a, x, 1\right) \cdot \left(a \cdot x\right)\\ \end{array} \]
                                        6. Add Preprocessing

                                        Alternative 8: 98.9% accurate, 2.5× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(x, a, -1\right) \cdot x, a, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a, x, 1\right) \cdot \left(a \cdot x\right)\\ \end{array} \end{array} \]
                                        (FPCore (a x)
                                         :precision binary64
                                         (if (<= (* a x) -200.0)
                                           (- (/ 1.0 (fma (* (fma x a -1.0) x) a 1.0)) 1.0)
                                           (* (fma (* (fma (* 0.16666666666666666 x) a 0.5) a) x 1.0) (* a x))))
                                        double code(double a, double x) {
                                        	double tmp;
                                        	if ((a * x) <= -200.0) {
                                        		tmp = (1.0 / fma((fma(x, a, -1.0) * x), a, 1.0)) - 1.0;
                                        	} else {
                                        		tmp = fma((fma((0.16666666666666666 * x), a, 0.5) * a), x, 1.0) * (a * x);
                                        	}
                                        	return tmp;
                                        }
                                        
                                        function code(a, x)
                                        	tmp = 0.0
                                        	if (Float64(a * x) <= -200.0)
                                        		tmp = Float64(Float64(1.0 / fma(Float64(fma(x, a, -1.0) * x), a, 1.0)) - 1.0);
                                        	else
                                        		tmp = Float64(fma(Float64(fma(Float64(0.16666666666666666 * x), a, 0.5) * a), x, 1.0) * Float64(a * x));
                                        	end
                                        	return tmp
                                        end
                                        
                                        code[a_, x_] := If[LessEqual[N[(a * x), $MachinePrecision], -200.0], N[(N[(1.0 / N[(N[(N[(x * a + -1.0), $MachinePrecision] * x), $MachinePrecision] * a + 1.0), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision], N[(N[(N[(N[(N[(0.16666666666666666 * x), $MachinePrecision] * a + 0.5), $MachinePrecision] * a), $MachinePrecision] * x + 1.0), $MachinePrecision] * N[(a * x), $MachinePrecision]), $MachinePrecision]]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        \mathbf{if}\;a \cdot x \leq -200:\\
                                        \;\;\;\;\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(x, a, -1\right) \cdot x, a, 1\right)} - 1\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a, x, 1\right) \cdot \left(a \cdot x\right)\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 2 regimes
                                        2. if (*.f64 a x) < -200

                                          1. Initial program 100.0%

                                            \[e^{a \cdot x} - 1 \]
                                          2. Add Preprocessing
                                          3. Taylor expanded in a around 0

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

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

                                              \[\leadsto \left(\color{blue}{x \cdot a} + 1\right) - 1 \]
                                            3. lower-fma.f645.1

                                              \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
                                          5. Applied rewrites5.1%

                                            \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
                                          6. Step-by-step derivation
                                            1. Applied rewrites8.4%

                                              \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot x, x, 1 - a \cdot x\right)}{\mathsf{fma}\left(\left(\left(a \cdot a\right) \cdot x\right) \cdot x, a \cdot x, 1\right)}}} - 1 \]
                                            2. Taylor expanded in a around 0

                                              \[\leadsto \frac{1}{1 + \color{blue}{-1 \cdot \left(a \cdot x\right)}} - 1 \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites97.5%

                                                \[\leadsto \frac{1}{\mathsf{fma}\left(-x, \color{blue}{a}, 1\right)} - 1 \]
                                              2. Taylor expanded in a around 0

                                                \[\leadsto \frac{1}{1 + \color{blue}{a \cdot \left(-1 \cdot x + a \cdot {x}^{2}\right)}} - 1 \]
                                              3. Step-by-step derivation
                                                1. Applied rewrites99.1%

                                                  \[\leadsto \frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(x, a, -1\right) \cdot x, \color{blue}{a}, 1\right)} - 1 \]

                                                if -200 < (*.f64 a x)

                                                1. Initial program 30.9%

                                                  \[e^{a \cdot x} - 1 \]
                                                2. Add Preprocessing
                                                3. Taylor expanded in a around 0

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

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

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

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

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

                                                    \[\leadsto a \cdot \left(\color{blue}{\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{3}} + \left(a \cdot \left(\frac{1}{2} \cdot {x}^{2}\right) + x\right)\right) \]
                                                  6. unpow3N/A

                                                    \[\leadsto a \cdot \left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} + \left(a \cdot \left(\frac{1}{2} \cdot {x}^{2}\right) + x\right)\right) \]
                                                  7. unpow2N/A

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

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

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

                                                    \[\leadsto a \cdot \left(\left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2}\right) \cdot x + \left(\color{blue}{\left(\frac{1}{2} \cdot a\right)} \cdot {x}^{2} + x\right)\right) \]
                                                  11. unpow2N/A

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

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

                                                    \[\leadsto a \cdot \left(\left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2}\right) \cdot x + \color{blue}{\left(\left(\frac{1}{2} \cdot a\right) \cdot x + 1\right) \cdot x}\right) \]
                                                  14. distribute-rgt-outN/A

                                                    \[\leadsto a \cdot \color{blue}{\left(x \cdot \left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2} + \left(\left(\frac{1}{2} \cdot a\right) \cdot x + 1\right)\right)\right)} \]
                                                5. Applied rewrites99.9%

                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a, x, 1\right) \cdot \left(x \cdot a\right)} \]
                                              4. Recombined 2 regimes into one program.
                                              5. Final simplification99.6%

                                                \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(x, a, -1\right) \cdot x, a, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a, x, 1\right) \cdot \left(a \cdot x\right)\\ \end{array} \]
                                              6. Add Preprocessing

                                              Alternative 9: 98.6% accurate, 2.5× speedup?

                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(x, a, -1\right) \cdot x, a, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot a, x, 1\right) \cdot \left(a \cdot x\right)\\ \end{array} \end{array} \]
                                              (FPCore (a x)
                                               :precision binary64
                                               (if (<= (* a x) -200.0)
                                                 (- (/ 1.0 (fma (* (fma x a -1.0) x) a 1.0)) 1.0)
                                                 (* (fma (* 0.5 a) x 1.0) (* a x))))
                                              double code(double a, double x) {
                                              	double tmp;
                                              	if ((a * x) <= -200.0) {
                                              		tmp = (1.0 / fma((fma(x, a, -1.0) * x), a, 1.0)) - 1.0;
                                              	} else {
                                              		tmp = fma((0.5 * a), x, 1.0) * (a * x);
                                              	}
                                              	return tmp;
                                              }
                                              
                                              function code(a, x)
                                              	tmp = 0.0
                                              	if (Float64(a * x) <= -200.0)
                                              		tmp = Float64(Float64(1.0 / fma(Float64(fma(x, a, -1.0) * x), a, 1.0)) - 1.0);
                                              	else
                                              		tmp = Float64(fma(Float64(0.5 * a), x, 1.0) * Float64(a * x));
                                              	end
                                              	return tmp
                                              end
                                              
                                              code[a_, x_] := If[LessEqual[N[(a * x), $MachinePrecision], -200.0], N[(N[(1.0 / N[(N[(N[(x * a + -1.0), $MachinePrecision] * x), $MachinePrecision] * a + 1.0), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision], N[(N[(N[(0.5 * a), $MachinePrecision] * x + 1.0), $MachinePrecision] * N[(a * x), $MachinePrecision]), $MachinePrecision]]
                                              
                                              \begin{array}{l}
                                              
                                              \\
                                              \begin{array}{l}
                                              \mathbf{if}\;a \cdot x \leq -200:\\
                                              \;\;\;\;\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(x, a, -1\right) \cdot x, a, 1\right)} - 1\\
                                              
                                              \mathbf{else}:\\
                                              \;\;\;\;\mathsf{fma}\left(0.5 \cdot a, x, 1\right) \cdot \left(a \cdot x\right)\\
                                              
                                              
                                              \end{array}
                                              \end{array}
                                              
                                              Derivation
                                              1. Split input into 2 regimes
                                              2. if (*.f64 a x) < -200

                                                1. Initial program 100.0%

                                                  \[e^{a \cdot x} - 1 \]
                                                2. Add Preprocessing
                                                3. Taylor expanded in a around 0

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

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

                                                    \[\leadsto \left(\color{blue}{x \cdot a} + 1\right) - 1 \]
                                                  3. lower-fma.f645.1

                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
                                                5. Applied rewrites5.1%

                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
                                                6. Step-by-step derivation
                                                  1. Applied rewrites8.4%

                                                    \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot x, x, 1 - a \cdot x\right)}{\mathsf{fma}\left(\left(\left(a \cdot a\right) \cdot x\right) \cdot x, a \cdot x, 1\right)}}} - 1 \]
                                                  2. Taylor expanded in a around 0

                                                    \[\leadsto \frac{1}{1 + \color{blue}{-1 \cdot \left(a \cdot x\right)}} - 1 \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites97.5%

                                                      \[\leadsto \frac{1}{\mathsf{fma}\left(-x, \color{blue}{a}, 1\right)} - 1 \]
                                                    2. Taylor expanded in a around 0

                                                      \[\leadsto \frac{1}{1 + \color{blue}{a \cdot \left(-1 \cdot x + a \cdot {x}^{2}\right)}} - 1 \]
                                                    3. Step-by-step derivation
                                                      1. Applied rewrites99.1%

                                                        \[\leadsto \frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(x, a, -1\right) \cdot x, \color{blue}{a}, 1\right)} - 1 \]

                                                      if -200 < (*.f64 a x)

                                                      1. Initial program 30.9%

                                                        \[e^{a \cdot x} - 1 \]
                                                      2. Add Preprocessing
                                                      3. Taylor expanded in a around 0

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

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

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

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

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

                                                          \[\leadsto a \cdot \left(\color{blue}{\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{3}} + \left(a \cdot \left(\frac{1}{2} \cdot {x}^{2}\right) + x\right)\right) \]
                                                        6. unpow3N/A

                                                          \[\leadsto a \cdot \left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} + \left(a \cdot \left(\frac{1}{2} \cdot {x}^{2}\right) + x\right)\right) \]
                                                        7. unpow2N/A

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

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

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

                                                          \[\leadsto a \cdot \left(\left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2}\right) \cdot x + \left(\color{blue}{\left(\frac{1}{2} \cdot a\right)} \cdot {x}^{2} + x\right)\right) \]
                                                        11. unpow2N/A

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

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

                                                          \[\leadsto a \cdot \left(\left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2}\right) \cdot x + \color{blue}{\left(\left(\frac{1}{2} \cdot a\right) \cdot x + 1\right) \cdot x}\right) \]
                                                        14. distribute-rgt-outN/A

                                                          \[\leadsto a \cdot \color{blue}{\left(x \cdot \left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2} + \left(\left(\frac{1}{2} \cdot a\right) \cdot x + 1\right)\right)\right)} \]
                                                      5. Applied rewrites99.9%

                                                        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a, x, 1\right) \cdot \left(x \cdot a\right)} \]
                                                      6. Taylor expanded in x around 0

                                                        \[\leadsto \mathsf{fma}\left(\frac{1}{2} \cdot a, x, 1\right) \cdot \left(x \cdot a\right) \]
                                                      7. Step-by-step derivation
                                                        1. Applied rewrites99.4%

                                                          \[\leadsto \mathsf{fma}\left(0.5 \cdot a, x, 1\right) \cdot \left(x \cdot a\right) \]
                                                      8. Recombined 2 regimes into one program.
                                                      9. Final simplification99.3%

                                                        \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(\mathsf{fma}\left(x, a, -1\right) \cdot x, a, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot a, x, 1\right) \cdot \left(a \cdot x\right)\\ \end{array} \]
                                                      10. Add Preprocessing

                                                      Alternative 10: 98.3% accurate, 3.3× speedup?

                                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, x, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot a, x, 1\right) \cdot \left(a \cdot x\right)\\ \end{array} \end{array} \]
                                                      (FPCore (a x)
                                                       :precision binary64
                                                       (if (<= (* a x) -200.0)
                                                         (- (/ 1.0 (fma a x 1.0)) 1.0)
                                                         (* (fma (* 0.5 a) x 1.0) (* a x))))
                                                      double code(double a, double x) {
                                                      	double tmp;
                                                      	if ((a * x) <= -200.0) {
                                                      		tmp = (1.0 / fma(a, x, 1.0)) - 1.0;
                                                      	} else {
                                                      		tmp = fma((0.5 * a), x, 1.0) * (a * x);
                                                      	}
                                                      	return tmp;
                                                      }
                                                      
                                                      function code(a, x)
                                                      	tmp = 0.0
                                                      	if (Float64(a * x) <= -200.0)
                                                      		tmp = Float64(Float64(1.0 / fma(a, x, 1.0)) - 1.0);
                                                      	else
                                                      		tmp = Float64(fma(Float64(0.5 * a), x, 1.0) * Float64(a * x));
                                                      	end
                                                      	return tmp
                                                      end
                                                      
                                                      code[a_, x_] := If[LessEqual[N[(a * x), $MachinePrecision], -200.0], N[(N[(1.0 / N[(a * x + 1.0), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision], N[(N[(N[(0.5 * a), $MachinePrecision] * x + 1.0), $MachinePrecision] * N[(a * x), $MachinePrecision]), $MachinePrecision]]
                                                      
                                                      \begin{array}{l}
                                                      
                                                      \\
                                                      \begin{array}{l}
                                                      \mathbf{if}\;a \cdot x \leq -200:\\
                                                      \;\;\;\;\frac{1}{\mathsf{fma}\left(a, x, 1\right)} - 1\\
                                                      
                                                      \mathbf{else}:\\
                                                      \;\;\;\;\mathsf{fma}\left(0.5 \cdot a, x, 1\right) \cdot \left(a \cdot x\right)\\
                                                      
                                                      
                                                      \end{array}
                                                      \end{array}
                                                      
                                                      Derivation
                                                      1. Split input into 2 regimes
                                                      2. if (*.f64 a x) < -200

                                                        1. Initial program 100.0%

                                                          \[e^{a \cdot x} - 1 \]
                                                        2. Add Preprocessing
                                                        3. Taylor expanded in a around 0

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

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

                                                            \[\leadsto \left(\color{blue}{x \cdot a} + 1\right) - 1 \]
                                                          3. lower-fma.f645.1

                                                            \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
                                                        5. Applied rewrites5.1%

                                                          \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
                                                        6. Step-by-step derivation
                                                          1. Applied rewrites8.4%

                                                            \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot x, x, 1 - a \cdot x\right)}{\mathsf{fma}\left(\left(\left(a \cdot a\right) \cdot x\right) \cdot x, a \cdot x, 1\right)}}} - 1 \]
                                                          2. Taylor expanded in a around 0

                                                            \[\leadsto \frac{1}{1 + \color{blue}{-1 \cdot \left(a \cdot x\right)}} - 1 \]
                                                          3. Step-by-step derivation
                                                            1. Applied rewrites97.5%

                                                              \[\leadsto \frac{1}{\mathsf{fma}\left(-x, \color{blue}{a}, 1\right)} - 1 \]
                                                            2. Applied rewrites97.6%

                                                              \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(a, x, 1\right)} - 1} \]

                                                            if -200 < (*.f64 a x)

                                                            1. Initial program 30.9%

                                                              \[e^{a \cdot x} - 1 \]
                                                            2. Add Preprocessing
                                                            3. Taylor expanded in a around 0

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

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

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

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

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

                                                                \[\leadsto a \cdot \left(\color{blue}{\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{3}} + \left(a \cdot \left(\frac{1}{2} \cdot {x}^{2}\right) + x\right)\right) \]
                                                              6. unpow3N/A

                                                                \[\leadsto a \cdot \left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} + \left(a \cdot \left(\frac{1}{2} \cdot {x}^{2}\right) + x\right)\right) \]
                                                              7. unpow2N/A

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

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

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

                                                                \[\leadsto a \cdot \left(\left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2}\right) \cdot x + \left(\color{blue}{\left(\frac{1}{2} \cdot a\right)} \cdot {x}^{2} + x\right)\right) \]
                                                              11. unpow2N/A

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

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

                                                                \[\leadsto a \cdot \left(\left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2}\right) \cdot x + \color{blue}{\left(\left(\frac{1}{2} \cdot a\right) \cdot x + 1\right) \cdot x}\right) \]
                                                              14. distribute-rgt-outN/A

                                                                \[\leadsto a \cdot \color{blue}{\left(x \cdot \left(\left(a \cdot \left(\frac{1}{6} \cdot a\right)\right) \cdot {x}^{2} + \left(\left(\frac{1}{2} \cdot a\right) \cdot x + 1\right)\right)\right)} \]
                                                            5. Applied rewrites99.9%

                                                              \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot x, a, 0.5\right) \cdot a, x, 1\right) \cdot \left(x \cdot a\right)} \]
                                                            6. Taylor expanded in x around 0

                                                              \[\leadsto \mathsf{fma}\left(\frac{1}{2} \cdot a, x, 1\right) \cdot \left(x \cdot a\right) \]
                                                            7. Step-by-step derivation
                                                              1. Applied rewrites99.4%

                                                                \[\leadsto \mathsf{fma}\left(0.5 \cdot a, x, 1\right) \cdot \left(x \cdot a\right) \]
                                                            8. Recombined 2 regimes into one program.
                                                            9. Final simplification98.8%

                                                              \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, x, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot a, x, 1\right) \cdot \left(a \cdot x\right)\\ \end{array} \]
                                                            10. Add Preprocessing

                                                            Alternative 11: 97.6% accurate, 3.4× speedup?

                                                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, x, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;a \cdot x\\ \end{array} \end{array} \]
                                                            (FPCore (a x)
                                                             :precision binary64
                                                             (if (<= (* a x) -200.0) (- (/ 1.0 (fma a x 1.0)) 1.0) (* a x)))
                                                            double code(double a, double x) {
                                                            	double tmp;
                                                            	if ((a * x) <= -200.0) {
                                                            		tmp = (1.0 / fma(a, x, 1.0)) - 1.0;
                                                            	} else {
                                                            		tmp = a * x;
                                                            	}
                                                            	return tmp;
                                                            }
                                                            
                                                            function code(a, x)
                                                            	tmp = 0.0
                                                            	if (Float64(a * x) <= -200.0)
                                                            		tmp = Float64(Float64(1.0 / fma(a, x, 1.0)) - 1.0);
                                                            	else
                                                            		tmp = Float64(a * x);
                                                            	end
                                                            	return tmp
                                                            end
                                                            
                                                            code[a_, x_] := If[LessEqual[N[(a * x), $MachinePrecision], -200.0], N[(N[(1.0 / N[(a * x + 1.0), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision], N[(a * x), $MachinePrecision]]
                                                            
                                                            \begin{array}{l}
                                                            
                                                            \\
                                                            \begin{array}{l}
                                                            \mathbf{if}\;a \cdot x \leq -200:\\
                                                            \;\;\;\;\frac{1}{\mathsf{fma}\left(a, x, 1\right)} - 1\\
                                                            
                                                            \mathbf{else}:\\
                                                            \;\;\;\;a \cdot x\\
                                                            
                                                            
                                                            \end{array}
                                                            \end{array}
                                                            
                                                            Derivation
                                                            1. Split input into 2 regimes
                                                            2. if (*.f64 a x) < -200

                                                              1. Initial program 100.0%

                                                                \[e^{a \cdot x} - 1 \]
                                                              2. Add Preprocessing
                                                              3. Taylor expanded in a around 0

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

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

                                                                  \[\leadsto \left(\color{blue}{x \cdot a} + 1\right) - 1 \]
                                                                3. lower-fma.f645.1

                                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
                                                              5. Applied rewrites5.1%

                                                                \[\leadsto \color{blue}{\mathsf{fma}\left(x, a, 1\right)} - 1 \]
                                                              6. Step-by-step derivation
                                                                1. Applied rewrites8.4%

                                                                  \[\leadsto \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(\left(a \cdot a\right) \cdot x, x, 1 - a \cdot x\right)}{\mathsf{fma}\left(\left(\left(a \cdot a\right) \cdot x\right) \cdot x, a \cdot x, 1\right)}}} - 1 \]
                                                                2. Taylor expanded in a around 0

                                                                  \[\leadsto \frac{1}{1 + \color{blue}{-1 \cdot \left(a \cdot x\right)}} - 1 \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites97.5%

                                                                    \[\leadsto \frac{1}{\mathsf{fma}\left(-x, \color{blue}{a}, 1\right)} - 1 \]
                                                                  2. Applied rewrites97.6%

                                                                    \[\leadsto \color{blue}{\frac{1}{\mathsf{fma}\left(a, x, 1\right)} - 1} \]

                                                                  if -200 < (*.f64 a x)

                                                                  1. Initial program 30.9%

                                                                    \[e^{a \cdot x} - 1 \]
                                                                  2. Add Preprocessing
                                                                  3. Taylor expanded in a around 0

                                                                    \[\leadsto \color{blue}{a \cdot x} \]
                                                                  4. Step-by-step derivation
                                                                    1. *-commutativeN/A

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

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

                                                                    \[\leadsto \color{blue}{x \cdot a} \]
                                                                4. Recombined 2 regimes into one program.
                                                                5. Final simplification98.1%

                                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot x \leq -200:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(a, x, 1\right)} - 1\\ \mathbf{else}:\\ \;\;\;\;a \cdot x\\ \end{array} \]
                                                                6. Add Preprocessing

                                                                Alternative 12: 66.6% accurate, 18.2× speedup?

                                                                \[\begin{array}{l} \\ a \cdot x \end{array} \]
                                                                (FPCore (a x) :precision binary64 (* a x))
                                                                double code(double a, double x) {
                                                                	return a * x;
                                                                }
                                                                
                                                                real(8) function code(a, x)
                                                                    real(8), intent (in) :: a
                                                                    real(8), intent (in) :: x
                                                                    code = a * x
                                                                end function
                                                                
                                                                public static double code(double a, double x) {
                                                                	return a * x;
                                                                }
                                                                
                                                                def code(a, x):
                                                                	return a * x
                                                                
                                                                function code(a, x)
                                                                	return Float64(a * x)
                                                                end
                                                                
                                                                function tmp = code(a, x)
                                                                	tmp = a * x;
                                                                end
                                                                
                                                                code[a_, x_] := N[(a * x), $MachinePrecision]
                                                                
                                                                \begin{array}{l}
                                                                
                                                                \\
                                                                a \cdot x
                                                                \end{array}
                                                                
                                                                Derivation
                                                                1. Initial program 52.7%

                                                                  \[e^{a \cdot x} - 1 \]
                                                                2. Add Preprocessing
                                                                3. Taylor expanded in a around 0

                                                                  \[\leadsto \color{blue}{a \cdot x} \]
                                                                4. Step-by-step derivation
                                                                  1. *-commutativeN/A

                                                                    \[\leadsto \color{blue}{x \cdot a} \]
                                                                  2. lower-*.f6468.8

                                                                    \[\leadsto \color{blue}{x \cdot a} \]
                                                                5. Applied rewrites68.8%

                                                                  \[\leadsto \color{blue}{x \cdot a} \]
                                                                6. Final simplification68.8%

                                                                  \[\leadsto a \cdot x \]
                                                                7. Add Preprocessing

                                                                Alternative 13: 19.6% accurate, 27.3× speedup?

                                                                \[\begin{array}{l} \\ 1 - 1 \end{array} \]
                                                                (FPCore (a x) :precision binary64 (- 1.0 1.0))
                                                                double code(double a, double x) {
                                                                	return 1.0 - 1.0;
                                                                }
                                                                
                                                                real(8) function code(a, x)
                                                                    real(8), intent (in) :: a
                                                                    real(8), intent (in) :: x
                                                                    code = 1.0d0 - 1.0d0
                                                                end function
                                                                
                                                                public static double code(double a, double x) {
                                                                	return 1.0 - 1.0;
                                                                }
                                                                
                                                                def code(a, x):
                                                                	return 1.0 - 1.0
                                                                
                                                                function code(a, x)
                                                                	return Float64(1.0 - 1.0)
                                                                end
                                                                
                                                                function tmp = code(a, x)
                                                                	tmp = 1.0 - 1.0;
                                                                end
                                                                
                                                                code[a_, x_] := N[(1.0 - 1.0), $MachinePrecision]
                                                                
                                                                \begin{array}{l}
                                                                
                                                                \\
                                                                1 - 1
                                                                \end{array}
                                                                
                                                                Derivation
                                                                1. Initial program 52.7%

                                                                  \[e^{a \cdot x} - 1 \]
                                                                2. Add Preprocessing
                                                                3. Taylor expanded in a around 0

                                                                  \[\leadsto \color{blue}{1} - 1 \]
                                                                4. Step-by-step derivation
                                                                  1. Applied rewrites20.3%

                                                                    \[\leadsto \color{blue}{1} - 1 \]
                                                                  2. Add Preprocessing

                                                                  Developer Target 1: 100.0% accurate, 1.0× speedup?

                                                                  \[\begin{array}{l} \\ \mathsf{expm1}\left(a \cdot x\right) \end{array} \]
                                                                  (FPCore (a x) :precision binary64 (expm1 (* a x)))
                                                                  double code(double a, double x) {
                                                                  	return expm1((a * x));
                                                                  }
                                                                  
                                                                  public static double code(double a, double x) {
                                                                  	return Math.expm1((a * x));
                                                                  }
                                                                  
                                                                  def code(a, x):
                                                                  	return math.expm1((a * x))
                                                                  
                                                                  function code(a, x)
                                                                  	return expm1(Float64(a * x))
                                                                  end
                                                                  
                                                                  code[a_, x_] := N[(Exp[N[(a * x), $MachinePrecision]] - 1), $MachinePrecision]
                                                                  
                                                                  \begin{array}{l}
                                                                  
                                                                  \\
                                                                  \mathsf{expm1}\left(a \cdot x\right)
                                                                  \end{array}
                                                                  

                                                                  Reproduce

                                                                  ?
                                                                  herbie shell --seed 2024235 
                                                                  (FPCore (a x)
                                                                    :name "expax (section 3.5)"
                                                                    :precision binary64
                                                                    :pre (> 710.0 (* a x))
                                                                  
                                                                    :alt
                                                                    (! :herbie-platform default (expm1 (* a x)))
                                                                  
                                                                    (- (exp (* a x)) 1.0))