exp neg sub

Percentage Accurate: 100.0% → 100.0%
Time: 10.4s
Alternatives: 17
Speedup: 1.0×

Specification

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

\\
e^{-\left(1 - x \cdot x\right)}
\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 17 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: 100.0% accurate, 1.0× speedup?

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

\\
e^{-\left(1 - x \cdot x\right)}
\end{array}

Alternative 1: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ e^{\mathsf{fma}\left(x, x, -1\right)} \end{array} \]
(FPCore (x) :precision binary64 (exp (fma x x -1.0)))
double code(double x) {
	return exp(fma(x, x, -1.0));
}
function code(x)
	return exp(fma(x, x, -1.0))
end
code[x_] := N[Exp[N[(x * x + -1.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
e^{\mathsf{fma}\left(x, x, -1\right)}
\end{array}
Derivation
  1. Initial program 100.0%

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

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

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

      \[\leadsto e^{0 - \color{blue}{\left(1 - x \cdot x\right)}} \]
    4. associate--r-N/A

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

      \[\leadsto e^{\color{blue}{-1} + x \cdot x} \]
    6. +-commutativeN/A

      \[\leadsto e^{\color{blue}{x \cdot x + -1}} \]
    7. lift-*.f64N/A

      \[\leadsto e^{\color{blue}{x \cdot x} + -1} \]
    8. lower-fma.f64100.0

      \[\leadsto e^{\color{blue}{\mathsf{fma}\left(x, x, -1\right)}} \]
  4. Applied rewrites100.0%

    \[\leadsto e^{\color{blue}{\mathsf{fma}\left(x, x, -1\right)}} \]
  5. Add Preprocessing

Alternative 2: 87.7% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;e^{-1 + x \cdot x} \leq 0.5:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x \cdot e, e\right)}{e \cdot e}\\

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \mathsf{fma}\left(x, x \cdot \left(x \cdot 0.5\right), x\right)}{e}\\


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

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{e^{-1} + {x}^{2} \cdot e^{-1}} \]
    4. Step-by-step derivation
      1. distribute-rgt1-inN/A

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\mathsf{E}\left(\right)}} \cdot \left({x}^{2} + 1\right) \]
      9. unpow2N/A

        \[\leadsto \frac{1}{\mathsf{E}\left(\right)} \cdot \left(\color{blue}{x \cdot x} + 1\right) \]
      10. lower-fma.f6498.9

        \[\leadsto \frac{1}{e} \cdot \color{blue}{\mathsf{fma}\left(x, x, 1\right)} \]
    5. Applied rewrites98.9%

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

        \[\leadsto \frac{x \cdot x}{e} - \color{blue}{\frac{-1}{e}} \]
      2. Step-by-step derivation
        1. Applied rewrites98.9%

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

        if 0.5 < (exp.f64 (neg.f64 (-.f64 #s(literal 1 binary64) (*.f64 x x))))

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto {x}^{4} \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{\mathsf{E}\left(\right)} + \frac{1}{{x}^{2} \cdot \mathsf{E}\left(\right)}\right)} \]
        7. Step-by-step derivation
          1. Applied rewrites81.9%

            \[\leadsto \frac{x \cdot \mathsf{fma}\left(x, x \cdot \left(x \cdot 0.5\right), x\right)}{\color{blue}{e}} \]
        8. Recombined 2 regimes into one program.
        9. Final simplification89.5%

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

        Alternative 3: 99.5% accurate, 0.9× speedup?

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

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right)\right), x \cdot x, \mathsf{fma}\left(x, x, 1\right)\right)}{e} \]

              if 5.00000000000000024e-5 < (*.f64 x x)

              1. Initial program 100.0%

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

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

                  \[\leadsto e^{\color{blue}{x \cdot x}} \]
                2. lower-*.f64100.0

                  \[\leadsto e^{\color{blue}{x \cdot x}} \]
              5. Applied rewrites100.0%

                \[\leadsto e^{\color{blue}{x \cdot x}} \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 4: 93.6% accurate, 1.1× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(x, x \cdot \left(x \cdot 0.5\right), x\right)\\ \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+152}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, t\_0 \cdot \left(x \cdot t\_0\right), -1\right)}{e \cdot \mathsf{fma}\left(x, t\_0, -1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.5\right)\right)}{e}\\ \end{array} \end{array} \]
            (FPCore (x)
             :precision binary64
             (let* ((t_0 (fma x (* x (* x 0.5)) x)))
               (if (<= (* x x) 2e+152)
                 (/ (fma x (* t_0 (* x t_0)) -1.0) (* E (fma x t_0 -1.0)))
                 (/ (* x (* x (* (* x x) 0.5))) E))))
            double code(double x) {
            	double t_0 = fma(x, (x * (x * 0.5)), x);
            	double tmp;
            	if ((x * x) <= 2e+152) {
            		tmp = fma(x, (t_0 * (x * t_0)), -1.0) / (((double) M_E) * fma(x, t_0, -1.0));
            	} else {
            		tmp = (x * (x * ((x * x) * 0.5))) / ((double) M_E);
            	}
            	return tmp;
            }
            
            function code(x)
            	t_0 = fma(x, Float64(x * Float64(x * 0.5)), x)
            	tmp = 0.0
            	if (Float64(x * x) <= 2e+152)
            		tmp = Float64(fma(x, Float64(t_0 * Float64(x * t_0)), -1.0) / Float64(exp(1) * fma(x, t_0, -1.0)));
            	else
            		tmp = Float64(Float64(x * Float64(x * Float64(Float64(x * x) * 0.5))) / exp(1));
            	end
            	return tmp
            end
            
            code[x_] := Block[{t$95$0 = N[(x * N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 2e+152], N[(N[(x * N[(t$95$0 * N[(x * t$95$0), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] / N[(E * N[(x * t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(x * N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / E), $MachinePrecision]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := \mathsf{fma}\left(x, x \cdot \left(x \cdot 0.5\right), x\right)\\
            \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+152}:\\
            \;\;\;\;\frac{\mathsf{fma}\left(x, t\_0 \cdot \left(x \cdot t\_0\right), -1\right)}{e \cdot \mathsf{fma}\left(x, t\_0, -1\right)}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.5\right)\right)}{e}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (*.f64 x x) < 2.0000000000000001e152

              1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{e^{-1} \cdot \left(\left({x}^{2} + 1\right) + {x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2}\right)\right)} \]
              5. Applied rewrites81.8%

                \[\leadsto \color{blue}{\frac{1}{e} \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot \left(x \cdot 0.5\right), x\right), 1\right)} \]
              6. Step-by-step derivation
                1. Applied rewrites89.0%

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

                if 2.0000000000000001e152 < (*.f64 x x)

                1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{e^{-1} \cdot \left(\left({x}^{2} + 1\right) + {x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2}\right)\right)} \]
                5. Applied rewrites100.0%

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

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

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

                    \[\leadsto \frac{\frac{1}{2} \cdot {x}^{4}}{\mathsf{E}\left(\right)} \]
                  3. Step-by-step derivation
                    1. Applied rewrites100.0%

                      \[\leadsto \frac{x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.5\right)\right)}{e} \]
                  4. Recombined 2 regimes into one program.
                  5. Final simplification93.9%

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

                  Alternative 5: 91.7% accurate, 1.9× speedup?

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

                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto {x}^{6} \cdot \color{blue}{\left(\frac{1}{6} \cdot \frac{1}{\mathsf{E}\left(\right)} + \frac{1}{2} \cdot \frac{1}{{x}^{2} \cdot \mathsf{E}\left(\right)}\right)} \]
                    7. Applied rewrites85.9%

                      \[\leadsto \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right) \cdot \color{blue}{\frac{\mathsf{fma}\left(x \cdot x, 0.16666666666666666, 0.5\right)}{e}} \]

                    if -2e9 < (-.f64 #s(literal 1 binary64) (*.f64 x x))

                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right)\right), x \cdot x, \mathsf{fma}\left(x, x, 1\right)\right)}{e} \]
                        2. Taylor expanded in x around 0

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

                            \[\leadsto \frac{\mathsf{fma}\left(x \cdot \left(x \cdot 0.5\right), x \cdot x, \mathsf{fma}\left(x, x, 1\right)\right)}{e} \]
                        4. Recombined 2 regimes into one program.
                        5. Add Preprocessing

                        Alternative 6: 91.7% accurate, 2.0× speedup?

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

                          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \frac{1}{6} \cdot \color{blue}{\frac{{x}^{6}}{\mathsf{E}\left(\right)}} \]
                          7. Step-by-step derivation
                            1. Applied rewrites85.9%

                              \[\leadsto \left(x \cdot x\right) \cdot \color{blue}{\frac{\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot 0.16666666666666666\right)}{e}} \]
                            2. Step-by-step derivation
                              1. Applied rewrites85.9%

                                \[\leadsto \left(x \cdot x\right) \cdot \left(x \cdot \frac{x \cdot \left(x \cdot \left(x \cdot 0.16666666666666666\right)\right)}{\color{blue}{e}}\right) \]

                              if -2e9 < (-.f64 #s(literal 1 binary64) (*.f64 x x))

                              1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right)\right), x \cdot x, \mathsf{fma}\left(x, x, 1\right)\right)}{e} \]
                                  2. Taylor expanded in x around 0

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

                                      \[\leadsto \frac{\mathsf{fma}\left(x \cdot \left(x \cdot 0.5\right), x \cdot x, \mathsf{fma}\left(x, x, 1\right)\right)}{e} \]
                                  4. Recombined 2 regimes into one program.
                                  5. Add Preprocessing

                                  Alternative 7: 91.7% accurate, 2.2× speedup?

                                  \[\begin{array}{l} \\ \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right)\right), x \cdot x, \mathsf{fma}\left(x, x, 1\right)\right)}{e} \end{array} \]
                                  (FPCore (x)
                                   :precision binary64
                                   (/
                                    (fma (* x (* x (fma x (* x 0.16666666666666666) 0.5))) (* x x) (fma x x 1.0))
                                    E))
                                  double code(double x) {
                                  	return fma((x * (x * fma(x, (x * 0.16666666666666666), 0.5))), (x * x), fma(x, x, 1.0)) / ((double) M_E);
                                  }
                                  
                                  function code(x)
                                  	return Float64(fma(Float64(x * Float64(x * fma(x, Float64(x * 0.16666666666666666), 0.5))), Float64(x * x), fma(x, x, 1.0)) / exp(1))
                                  end
                                  
                                  code[x_] := N[(N[(N[(x * N[(x * N[(x * N[(x * 0.16666666666666666), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision] + N[(x * x + 1.0), $MachinePrecision]), $MachinePrecision] / E), $MachinePrecision]
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right)\right), x \cdot x, \mathsf{fma}\left(x, x, 1\right)\right)}{e}
                                  \end{array}
                                  
                                  Derivation
                                  1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot x, x \cdot \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right), x\right), 1\right)}{\color{blue}{e}} \]
                                    2. Step-by-step derivation
                                      1. Applied rewrites92.2%

                                        \[\leadsto \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right)\right), x \cdot x, \mathsf{fma}\left(x, x, 1\right)\right)}{e} \]
                                      2. Add Preprocessing

                                      Alternative 8: 91.7% accurate, 2.5× speedup?

                                      \[\begin{array}{l} \\ \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot x, x \cdot \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right), x\right), 1\right)}{e} \end{array} \]
                                      (FPCore (x)
                                       :precision binary64
                                       (/ (fma x (fma (* x x) (* x (fma x (* x 0.16666666666666666) 0.5)) x) 1.0) E))
                                      double code(double x) {
                                      	return fma(x, fma((x * x), (x * fma(x, (x * 0.16666666666666666), 0.5)), x), 1.0) / ((double) M_E);
                                      }
                                      
                                      function code(x)
                                      	return Float64(fma(x, fma(Float64(x * x), Float64(x * fma(x, Float64(x * 0.16666666666666666), 0.5)), x), 1.0) / exp(1))
                                      end
                                      
                                      code[x_] := N[(N[(x * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * N[(x * 0.16666666666666666), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision] + 1.0), $MachinePrecision] / E), $MachinePrecision]
                                      
                                      \begin{array}{l}
                                      
                                      \\
                                      \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot x, x \cdot \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right), x\right), 1\right)}{e}
                                      \end{array}
                                      
                                      Derivation
                                      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

                                          \[\leadsto \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot x, x \cdot \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right), x\right), 1\right)}{\color{blue}{e}} \]
                                        2. Add Preprocessing

                                        Alternative 9: 91.3% accurate, 2.5× speedup?

                                        \[\begin{array}{l} \\ \frac{\mathsf{fma}\left(x, x \cdot \left(\left(x \cdot x\right) \cdot \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right)\right), 1\right)}{e} \end{array} \]
                                        (FPCore (x)
                                         :precision binary64
                                         (/ (fma x (* x (* (* x x) (fma x (* x 0.16666666666666666) 0.5))) 1.0) E))
                                        double code(double x) {
                                        	return fma(x, (x * ((x * x) * fma(x, (x * 0.16666666666666666), 0.5))), 1.0) / ((double) M_E);
                                        }
                                        
                                        function code(x)
                                        	return Float64(fma(x, Float64(x * Float64(Float64(x * x) * fma(x, Float64(x * 0.16666666666666666), 0.5))), 1.0) / exp(1))
                                        end
                                        
                                        code[x_] := N[(N[(x * N[(x * N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.16666666666666666), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / E), $MachinePrecision]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \frac{\mathsf{fma}\left(x, x \cdot \left(\left(x \cdot x\right) \cdot \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right)\right), 1\right)}{e}
                                        \end{array}
                                        
                                        Derivation
                                        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                            \[\leadsto \frac{\mathsf{fma}\left(x, {x}^{5} \cdot \left(\frac{1}{6} + \frac{1}{2} \cdot \frac{1}{{x}^{2}}\right), 1\right)}{\mathsf{E}\left(\right)} \]
                                          3. Applied rewrites91.1%

                                            \[\leadsto \frac{\mathsf{fma}\left(x, x \cdot \left(\left(x \cdot x\right) \cdot \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right)\right), 1\right)}{e} \]
                                          4. Add Preprocessing

                                          Alternative 10: 87.6% accurate, 2.6× speedup?

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

                                            1. Initial program 100.0%

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

                                              \[\leadsto \color{blue}{e^{-1} + {x}^{2} \cdot e^{-1}} \]
                                            4. Step-by-step derivation
                                              1. distribute-rgt1-inN/A

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

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

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

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

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

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

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

                                                \[\leadsto \frac{1}{\color{blue}{\mathsf{E}\left(\right)}} \cdot \left({x}^{2} + 1\right) \]
                                              9. unpow2N/A

                                                \[\leadsto \frac{1}{\mathsf{E}\left(\right)} \cdot \left(\color{blue}{x \cdot x} + 1\right) \]
                                              10. lower-fma.f6498.9

                                                \[\leadsto \frac{1}{e} \cdot \color{blue}{\mathsf{fma}\left(x, x, 1\right)} \]
                                            5. Applied rewrites98.9%

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

                                                \[\leadsto \frac{x \cdot x}{e} - \color{blue}{\frac{-1}{e}} \]
                                              2. Step-by-step derivation
                                                1. Applied rewrites98.9%

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

                                                if 5.00000000000000024e-5 < (*.f64 x x)

                                                1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                  \[\leadsto {x}^{4} \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{\mathsf{E}\left(\right)} + \frac{1}{{x}^{2} \cdot \mathsf{E}\left(\right)}\right)} \]
                                                7. Step-by-step derivation
                                                  1. Applied rewrites81.9%

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

                                                    \[\leadsto \frac{\frac{1}{2} \cdot {x}^{4}}{\mathsf{E}\left(\right)} \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites81.9%

                                                      \[\leadsto \frac{x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.5\right)\right)}{e} \]
                                                  4. Recombined 2 regimes into one program.
                                                  5. Add Preprocessing

                                                  Alternative 11: 87.5% accurate, 2.6× speedup?

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

                                                    1. Initial program 100.0%

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

                                                      \[\leadsto \color{blue}{e^{-1} + {x}^{2} \cdot e^{-1}} \]
                                                    4. Step-by-step derivation
                                                      1. distribute-rgt1-inN/A

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

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

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

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

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

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

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

                                                        \[\leadsto \frac{1}{\color{blue}{\mathsf{E}\left(\right)}} \cdot \left({x}^{2} + 1\right) \]
                                                      9. unpow2N/A

                                                        \[\leadsto \frac{1}{\mathsf{E}\left(\right)} \cdot \left(\color{blue}{x \cdot x} + 1\right) \]
                                                      10. lower-fma.f6498.9

                                                        \[\leadsto \frac{1}{e} \cdot \color{blue}{\mathsf{fma}\left(x, x, 1\right)} \]
                                                    5. Applied rewrites98.9%

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

                                                        \[\leadsto \frac{x \cdot x}{e} - \color{blue}{\frac{-1}{e}} \]
                                                      2. Step-by-step derivation
                                                        1. Applied rewrites98.9%

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

                                                        if 5.00000000000000024e-5 < (*.f64 x x)

                                                        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                            \[\leadsto x \cdot \color{blue}{\frac{x \cdot \left(x \cdot \left(x \cdot 0.5\right)\right)}{e}} \]
                                                        8. Recombined 2 regimes into one program.
                                                        9. Add Preprocessing

                                                        Alternative 12: 87.7% accurate, 2.8× speedup?

                                                        \[\begin{array}{l} \\ \frac{\mathsf{fma}\left(x \cdot \left(x \cdot 0.5\right), x \cdot x, \mathsf{fma}\left(x, x, 1\right)\right)}{e} \end{array} \]
                                                        (FPCore (x)
                                                         :precision binary64
                                                         (/ (fma (* x (* x 0.5)) (* x x) (fma x x 1.0)) E))
                                                        double code(double x) {
                                                        	return fma((x * (x * 0.5)), (x * x), fma(x, x, 1.0)) / ((double) M_E);
                                                        }
                                                        
                                                        function code(x)
                                                        	return Float64(fma(Float64(x * Float64(x * 0.5)), Float64(x * x), fma(x, x, 1.0)) / exp(1))
                                                        end
                                                        
                                                        code[x_] := N[(N[(N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision] + N[(x * x + 1.0), $MachinePrecision]), $MachinePrecision] / E), $MachinePrecision]
                                                        
                                                        \begin{array}{l}
                                                        
                                                        \\
                                                        \frac{\mathsf{fma}\left(x \cdot \left(x \cdot 0.5\right), x \cdot x, \mathsf{fma}\left(x, x, 1\right)\right)}{e}
                                                        \end{array}
                                                        
                                                        Derivation
                                                        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

                                                            \[\leadsto \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot x, x \cdot \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right), x\right), 1\right)}{\color{blue}{e}} \]
                                                          2. Step-by-step derivation
                                                            1. Applied rewrites92.2%

                                                              \[\leadsto \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right)\right), x \cdot x, \mathsf{fma}\left(x, x, 1\right)\right)}{e} \]
                                                            2. Taylor expanded in x around 0

                                                              \[\leadsto \frac{\mathsf{fma}\left(x \cdot \left(x \cdot \frac{1}{2}\right), x \cdot x, \mathsf{fma}\left(x, x, 1\right)\right)}{\mathsf{E}\left(\right)} \]
                                                            3. Step-by-step derivation
                                                              1. Applied rewrites89.9%

                                                                \[\leadsto \frac{\mathsf{fma}\left(x \cdot \left(x \cdot 0.5\right), x \cdot x, \mathsf{fma}\left(x, x, 1\right)\right)}{e} \]
                                                              2. Add Preprocessing

                                                              Alternative 13: 87.7% accurate, 3.3× speedup?

                                                              \[\begin{array}{l} \\ \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.5, 1\right), 1\right)}{e} \end{array} \]
                                                              (FPCore (x) :precision binary64 (/ (fma (* x x) (fma x (* x 0.5) 1.0) 1.0) E))
                                                              double code(double x) {
                                                              	return fma((x * x), fma(x, (x * 0.5), 1.0), 1.0) / ((double) M_E);
                                                              }
                                                              
                                                              function code(x)
                                                              	return Float64(fma(Float64(x * x), fma(x, Float64(x * 0.5), 1.0), 1.0) / exp(1))
                                                              end
                                                              
                                                              code[x_] := N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] / E), $MachinePrecision]
                                                              
                                                              \begin{array}{l}
                                                              
                                                              \\
                                                              \frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.5, 1\right), 1\right)}{e}
                                                              \end{array}
                                                              
                                                              Derivation
                                                              1. Initial program 100.0%

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

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

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

                                                                  \[\leadsto e^{0 - \color{blue}{\left(1 - x \cdot x\right)}} \]
                                                                4. associate--r-N/A

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

                                                                  \[\leadsto e^{\color{blue}{-1} + x \cdot x} \]
                                                                6. +-commutativeN/A

                                                                  \[\leadsto e^{\color{blue}{x \cdot x + -1}} \]
                                                                7. lift-*.f64N/A

                                                                  \[\leadsto e^{\color{blue}{x \cdot x} + -1} \]
                                                                8. lower-fma.f64100.0

                                                                  \[\leadsto e^{\color{blue}{\mathsf{fma}\left(x, x, -1\right)}} \]
                                                              4. Applied rewrites100.0%

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

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

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

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

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

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

                                                                  \[\leadsto \frac{1}{\mathsf{E}\left(\right)} + {x}^{2} \cdot \left(\frac{1}{2} \cdot \left({x}^{2} \cdot e^{-1}\right) + e^{\color{blue}{\mathsf{neg}\left(1\right)}}\right) \]
                                                                6. rec-expN/A

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

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

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

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

                                                                  \[\leadsto \frac{1}{\mathsf{E}\left(\right)} + \left({x}^{2} \cdot \left(\left(\frac{1}{2} \cdot {x}^{2}\right) \cdot e^{\color{blue}{\mathsf{neg}\left(1\right)}}\right) + {x}^{2} \cdot \frac{1}{\mathsf{E}\left(\right)}\right) \]
                                                                11. rec-expN/A

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

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

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

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

                                                                  \[\leadsto \frac{1}{\mathsf{E}\left(\right)} + \left(\color{blue}{\left(\frac{1}{2} \cdot {x}^{2}\right)} \cdot \left({x}^{2} \cdot \frac{1}{\mathsf{E}\left(\right)}\right) + {x}^{2} \cdot \frac{1}{\mathsf{E}\left(\right)}\right) \]
                                                              7. Applied rewrites89.9%

                                                                \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.5, 1\right), 1\right)}{e}} \]
                                                              8. Add Preprocessing

                                                              Alternative 14: 75.4% accurate, 3.6× speedup?

                                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;1 - x \cdot x \leq -2000000000:\\ \;\;\;\;x \cdot \frac{x}{e}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{e}\\ \end{array} \end{array} \]
                                                              (FPCore (x)
                                                               :precision binary64
                                                               (if (<= (- 1.0 (* x x)) -2000000000.0) (* x (/ x E)) (/ 1.0 E)))
                                                              double code(double x) {
                                                              	double tmp;
                                                              	if ((1.0 - (x * x)) <= -2000000000.0) {
                                                              		tmp = x * (x / ((double) M_E));
                                                              	} else {
                                                              		tmp = 1.0 / ((double) M_E);
                                                              	}
                                                              	return tmp;
                                                              }
                                                              
                                                              public static double code(double x) {
                                                              	double tmp;
                                                              	if ((1.0 - (x * x)) <= -2000000000.0) {
                                                              		tmp = x * (x / Math.E);
                                                              	} else {
                                                              		tmp = 1.0 / Math.E;
                                                              	}
                                                              	return tmp;
                                                              }
                                                              
                                                              def code(x):
                                                              	tmp = 0
                                                              	if (1.0 - (x * x)) <= -2000000000.0:
                                                              		tmp = x * (x / math.e)
                                                              	else:
                                                              		tmp = 1.0 / math.e
                                                              	return tmp
                                                              
                                                              function code(x)
                                                              	tmp = 0.0
                                                              	if (Float64(1.0 - Float64(x * x)) <= -2000000000.0)
                                                              		tmp = Float64(x * Float64(x / exp(1)));
                                                              	else
                                                              		tmp = Float64(1.0 / exp(1));
                                                              	end
                                                              	return tmp
                                                              end
                                                              
                                                              function tmp_2 = code(x)
                                                              	tmp = 0.0;
                                                              	if ((1.0 - (x * x)) <= -2000000000.0)
                                                              		tmp = x * (x / 2.71828182845904523536);
                                                              	else
                                                              		tmp = 1.0 / 2.71828182845904523536;
                                                              	end
                                                              	tmp_2 = tmp;
                                                              end
                                                              
                                                              code[x_] := If[LessEqual[N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision], -2000000000.0], N[(x * N[(x / E), $MachinePrecision]), $MachinePrecision], N[(1.0 / E), $MachinePrecision]]
                                                              
                                                              \begin{array}{l}
                                                              
                                                              \\
                                                              \begin{array}{l}
                                                              \mathbf{if}\;1 - x \cdot x \leq -2000000000:\\
                                                              \;\;\;\;x \cdot \frac{x}{e}\\
                                                              
                                                              \mathbf{else}:\\
                                                              \;\;\;\;\frac{1}{e}\\
                                                              
                                                              
                                                              \end{array}
                                                              \end{array}
                                                              
                                                              Derivation
                                                              1. Split input into 2 regimes
                                                              2. if (-.f64 #s(literal 1 binary64) (*.f64 x x)) < -2e9

                                                                1. Initial program 100.0%

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

                                                                  \[\leadsto \color{blue}{e^{-1} + {x}^{2} \cdot e^{-1}} \]
                                                                4. Step-by-step derivation
                                                                  1. distribute-rgt1-inN/A

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

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

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

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

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

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

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

                                                                    \[\leadsto \frac{1}{\color{blue}{\mathsf{E}\left(\right)}} \cdot \left({x}^{2} + 1\right) \]
                                                                  9. unpow2N/A

                                                                    \[\leadsto \frac{1}{\mathsf{E}\left(\right)} \cdot \left(\color{blue}{x \cdot x} + 1\right) \]
                                                                  10. lower-fma.f6456.9

                                                                    \[\leadsto \frac{1}{e} \cdot \color{blue}{\mathsf{fma}\left(x, x, 1\right)} \]
                                                                5. Applied rewrites56.9%

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

                                                                  \[\leadsto \frac{{x}^{2}}{\color{blue}{\mathsf{E}\left(\right)}} \]
                                                                7. Step-by-step derivation
                                                                  1. Applied rewrites56.9%

                                                                    \[\leadsto \frac{x \cdot x}{\color{blue}{e}} \]
                                                                  2. Step-by-step derivation
                                                                    1. Applied rewrites56.9%

                                                                      \[\leadsto \frac{x}{e} \cdot x \]

                                                                    if -2e9 < (-.f64 #s(literal 1 binary64) (*.f64 x x))

                                                                    1. Initial program 100.0%

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

                                                                      \[\leadsto \color{blue}{e^{-1}} \]
                                                                    4. Step-by-step derivation
                                                                      1. metadata-evalN/A

                                                                        \[\leadsto e^{\color{blue}{\mathsf{neg}\left(1\right)}} \]
                                                                      2. rec-expN/A

                                                                        \[\leadsto \color{blue}{\frac{1}{e^{1}}} \]
                                                                      3. lower-/.f64N/A

                                                                        \[\leadsto \color{blue}{\frac{1}{e^{1}}} \]
                                                                      4. exp-1-eN/A

                                                                        \[\leadsto \frac{1}{\color{blue}{\mathsf{E}\left(\right)}} \]
                                                                      5. lower-E.f6497.5

                                                                        \[\leadsto \frac{1}{\color{blue}{e}} \]
                                                                    5. Applied rewrites97.5%

                                                                      \[\leadsto \color{blue}{\frac{1}{e}} \]
                                                                  3. Recombined 2 regimes into one program.
                                                                  4. Final simplification75.2%

                                                                    \[\leadsto \begin{array}{l} \mathbf{if}\;1 - x \cdot x \leq -2000000000:\\ \;\;\;\;x \cdot \frac{x}{e}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{e}\\ \end{array} \]
                                                                  5. Add Preprocessing

                                                                  Alternative 15: 75.7% accurate, 4.0× speedup?

                                                                  \[\begin{array}{l} \\ \frac{\mathsf{fma}\left(x, x \cdot e, e\right)}{e \cdot e} \end{array} \]
                                                                  (FPCore (x) :precision binary64 (/ (fma x (* x E) E) (* E E)))
                                                                  double code(double x) {
                                                                  	return fma(x, (x * ((double) M_E)), ((double) M_E)) / (((double) M_E) * ((double) M_E));
                                                                  }
                                                                  
                                                                  function code(x)
                                                                  	return Float64(fma(x, Float64(x * exp(1)), exp(1)) / Float64(exp(1) * exp(1)))
                                                                  end
                                                                  
                                                                  code[x_] := N[(N[(x * N[(x * E), $MachinePrecision] + E), $MachinePrecision] / N[(E * E), $MachinePrecision]), $MachinePrecision]
                                                                  
                                                                  \begin{array}{l}
                                                                  
                                                                  \\
                                                                  \frac{\mathsf{fma}\left(x, x \cdot e, e\right)}{e \cdot e}
                                                                  \end{array}
                                                                  
                                                                  Derivation
                                                                  1. Initial program 100.0%

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

                                                                    \[\leadsto \color{blue}{e^{-1} + {x}^{2} \cdot e^{-1}} \]
                                                                  4. Step-by-step derivation
                                                                    1. distribute-rgt1-inN/A

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

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

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

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

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

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

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

                                                                      \[\leadsto \frac{1}{\color{blue}{\mathsf{E}\left(\right)}} \cdot \left({x}^{2} + 1\right) \]
                                                                    9. unpow2N/A

                                                                      \[\leadsto \frac{1}{\mathsf{E}\left(\right)} \cdot \left(\color{blue}{x \cdot x} + 1\right) \]
                                                                    10. lower-fma.f6475.8

                                                                      \[\leadsto \frac{1}{e} \cdot \color{blue}{\mathsf{fma}\left(x, x, 1\right)} \]
                                                                  5. Applied rewrites75.8%

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

                                                                      \[\leadsto \frac{x \cdot x}{e} - \color{blue}{\frac{-1}{e}} \]
                                                                    2. Step-by-step derivation
                                                                      1. Applied rewrites75.8%

                                                                        \[\leadsto \frac{\mathsf{fma}\left(x, x \cdot e, e\right)}{\color{blue}{e \cdot e}} \]
                                                                      2. Add Preprocessing

                                                                      Alternative 16: 75.7% accurate, 6.2× speedup?

                                                                      \[\begin{array}{l} \\ \frac{\mathsf{fma}\left(x, x, 1\right)}{e} \end{array} \]
                                                                      (FPCore (x) :precision binary64 (/ (fma x x 1.0) E))
                                                                      double code(double x) {
                                                                      	return fma(x, x, 1.0) / ((double) M_E);
                                                                      }
                                                                      
                                                                      function code(x)
                                                                      	return Float64(fma(x, x, 1.0) / exp(1))
                                                                      end
                                                                      
                                                                      code[x_] := N[(N[(x * x + 1.0), $MachinePrecision] / E), $MachinePrecision]
                                                                      
                                                                      \begin{array}{l}
                                                                      
                                                                      \\
                                                                      \frac{\mathsf{fma}\left(x, x, 1\right)}{e}
                                                                      \end{array}
                                                                      
                                                                      Derivation
                                                                      1. Initial program 100.0%

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

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

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

                                                                          \[\leadsto e^{0 - \color{blue}{\left(1 - x \cdot x\right)}} \]
                                                                        4. associate--r-N/A

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

                                                                          \[\leadsto e^{\color{blue}{-1} + x \cdot x} \]
                                                                        6. +-commutativeN/A

                                                                          \[\leadsto e^{\color{blue}{x \cdot x + -1}} \]
                                                                        7. lift-*.f64N/A

                                                                          \[\leadsto e^{\color{blue}{x \cdot x} + -1} \]
                                                                        8. lower-fma.f64100.0

                                                                          \[\leadsto e^{\color{blue}{\mathsf{fma}\left(x, x, -1\right)}} \]
                                                                      4. Applied rewrites100.0%

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

                                                                        \[\leadsto \color{blue}{e^{-1} + {x}^{2} \cdot e^{-1}} \]
                                                                      6. Step-by-step derivation
                                                                        1. distribute-rgt1-inN/A

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

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

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

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

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

                                                                          \[\leadsto \frac{\color{blue}{{x}^{2} + 1}}{\mathsf{E}\left(\right)} \]
                                                                        7. lower-/.f64N/A

                                                                          \[\leadsto \color{blue}{\frac{{x}^{2} + 1}{\mathsf{E}\left(\right)}} \]
                                                                        8. unpow2N/A

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

                                                                          \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, x, 1\right)}}{\mathsf{E}\left(\right)} \]
                                                                        10. lower-E.f6475.8

                                                                          \[\leadsto \frac{\mathsf{fma}\left(x, x, 1\right)}{\color{blue}{e}} \]
                                                                      7. Applied rewrites75.8%

                                                                        \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, x, 1\right)}{e}} \]
                                                                      8. Add Preprocessing

                                                                      Alternative 17: 50.8% accurate, 9.3× speedup?

                                                                      \[\begin{array}{l} \\ \frac{1}{e} \end{array} \]
                                                                      (FPCore (x) :precision binary64 (/ 1.0 E))
                                                                      double code(double x) {
                                                                      	return 1.0 / ((double) M_E);
                                                                      }
                                                                      
                                                                      public static double code(double x) {
                                                                      	return 1.0 / Math.E;
                                                                      }
                                                                      
                                                                      def code(x):
                                                                      	return 1.0 / math.e
                                                                      
                                                                      function code(x)
                                                                      	return Float64(1.0 / exp(1))
                                                                      end
                                                                      
                                                                      function tmp = code(x)
                                                                      	tmp = 1.0 / 2.71828182845904523536;
                                                                      end
                                                                      
                                                                      code[x_] := N[(1.0 / E), $MachinePrecision]
                                                                      
                                                                      \begin{array}{l}
                                                                      
                                                                      \\
                                                                      \frac{1}{e}
                                                                      \end{array}
                                                                      
                                                                      Derivation
                                                                      1. Initial program 100.0%

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

                                                                        \[\leadsto \color{blue}{e^{-1}} \]
                                                                      4. Step-by-step derivation
                                                                        1. metadata-evalN/A

                                                                          \[\leadsto e^{\color{blue}{\mathsf{neg}\left(1\right)}} \]
                                                                        2. rec-expN/A

                                                                          \[\leadsto \color{blue}{\frac{1}{e^{1}}} \]
                                                                        3. lower-/.f64N/A

                                                                          \[\leadsto \color{blue}{\frac{1}{e^{1}}} \]
                                                                        4. exp-1-eN/A

                                                                          \[\leadsto \frac{1}{\color{blue}{\mathsf{E}\left(\right)}} \]
                                                                        5. lower-E.f6445.5

                                                                          \[\leadsto \frac{1}{\color{blue}{e}} \]
                                                                      5. Applied rewrites45.5%

                                                                        \[\leadsto \color{blue}{\frac{1}{e}} \]
                                                                      6. Add Preprocessing

                                                                      Reproduce

                                                                      ?
                                                                      herbie shell --seed 2024226 
                                                                      (FPCore (x)
                                                                        :name "exp neg sub"
                                                                        :precision binary64
                                                                        (exp (- (- 1.0 (* x x)))))