exp neg sub

Percentage Accurate: 100.0% → 100.0%
Time: 9.0s
Alternatives: 15
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 15 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: 92.0% accurate, 0.7× speedup?

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

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

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


\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 \left(e^{-1} + \frac{1}{2} \cdot \left({x}^{2} \cdot e^{-1}\right)\right)} \]
    4. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, 0.5, 1\right), x \cdot x, 1\right)}{\color{blue}{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} + {x}^{2} \cdot \left(\frac{1}{6} \cdot \left({x}^{2} \cdot e^{-1}\right) + \frac{1}{2} \cdot e^{-1}\right)\right)} \]
      4. Applied rewrites82.6%

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

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

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

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

    Alternative 3: 92.0% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{x \cdot x - 1} \leq 0.5:\\ \;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, 0.5, 1\right), x \cdot x, 1\right)}{e}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{x \cdot x}{e} \cdot x\right) \cdot \left(\left(0.16666666666666666 \cdot \left(x \cdot x\right)\right) \cdot x\right)\\ \end{array} \end{array} \]
    (FPCore (x)
     :precision binary64
     (if (<= (exp (- (* x x) 1.0)) 0.5)
       (/ (fma (fma (* x x) 0.5 1.0) (* x x) 1.0) E)
       (* (* (/ (* x x) E) x) (* (* 0.16666666666666666 (* x x)) x))))
    double code(double x) {
    	double tmp;
    	if (exp(((x * x) - 1.0)) <= 0.5) {
    		tmp = fma(fma((x * x), 0.5, 1.0), (x * x), 1.0) / ((double) M_E);
    	} else {
    		tmp = (((x * x) / ((double) M_E)) * x) * ((0.16666666666666666 * (x * x)) * x);
    	}
    	return tmp;
    }
    
    function code(x)
    	tmp = 0.0
    	if (exp(Float64(Float64(x * x) - 1.0)) <= 0.5)
    		tmp = Float64(fma(fma(Float64(x * x), 0.5, 1.0), Float64(x * x), 1.0) / exp(1));
    	else
    		tmp = Float64(Float64(Float64(Float64(x * x) / exp(1)) * x) * Float64(Float64(0.16666666666666666 * Float64(x * x)) * x));
    	end
    	return tmp
    end
    
    code[x_] := If[LessEqual[N[Exp[N[(N[(x * x), $MachinePrecision] - 1.0), $MachinePrecision]], $MachinePrecision], 0.5], N[(N[(N[(N[(x * x), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] / E), $MachinePrecision], N[(N[(N[(N[(x * x), $MachinePrecision] / E), $MachinePrecision] * x), $MachinePrecision] * N[(N[(0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;e^{x \cdot x - 1} \leq 0.5:\\
    \;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, 0.5, 1\right), x \cdot x, 1\right)}{e}\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(\frac{x \cdot x}{e} \cdot x\right) \cdot \left(\left(0.16666666666666666 \cdot \left(x \cdot x\right)\right) \cdot x\right)\\
    
    
    \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 \left(e^{-1} + \frac{1}{2} \cdot \left({x}^{2} \cdot e^{-1}\right)\right)} \]
      4. Step-by-step derivation
        1. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, 0.5, 1\right), x \cdot x, 1\right)}{\color{blue}{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} + {x}^{2} \cdot \left(\frac{1}{6} \cdot \left({x}^{2} \cdot e^{-1}\right) + \frac{1}{2} \cdot e^{-1}\right)\right)} \]
        4. Applied rewrites82.6%

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

          \[\leadsto \frac{1}{6} \cdot \color{blue}{\frac{{x}^{6}}{\mathsf{E}\left(\right)}} \]
        6. Applied rewrites82.6%

          \[\leadsto \left(\left(0.16666666666666666 \cdot \left(x \cdot x\right)\right) \cdot x\right) \cdot \color{blue}{\left(\frac{x \cdot x}{e} \cdot x\right)} \]
      7. Recombined 2 regimes into one program.
      8. Final simplification91.5%

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

      Alternative 4: 99.5% accurate, 0.9× speedup?

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

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

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

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

            if 2.00000000000000016e-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. Final simplification100.0%

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

          Alternative 5: 92.0% accurate, 2.0× speedup?

          \[\begin{array}{l} \\ \mathsf{fma}\left(\frac{x}{e}, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(0.16666666666666666 \cdot x, x, 0.5\right), 1\right) \cdot x, \frac{1}{e}\right) \end{array} \]
          (FPCore (x)
           :precision binary64
           (fma
            (/ x E)
            (* (fma (* x x) (fma (* 0.16666666666666666 x) x 0.5) 1.0) x)
            (/ 1.0 E)))
          double code(double x) {
          	return fma((x / ((double) M_E)), (fma((x * x), fma((0.16666666666666666 * x), x, 0.5), 1.0) * x), (1.0 / ((double) M_E)));
          }
          
          function code(x)
          	return fma(Float64(x / exp(1)), Float64(fma(Float64(x * x), fma(Float64(0.16666666666666666 * x), x, 0.5), 1.0) * x), Float64(1.0 / exp(1)))
          end
          
          code[x_] := N[(N[(x / E), $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * N[(N[(0.16666666666666666 * x), $MachinePrecision] * x + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision] + N[(1.0 / E), $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          \mathsf{fma}\left(\frac{x}{e}, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(0.16666666666666666 \cdot x, x, 0.5\right), 1\right) \cdot x, \frac{1}{e}\right)
          \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. Applied rewrites91.5%

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

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

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

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

              Alternative 6: 91.8% accurate, 2.1× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-5}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, 0.5, 1\right), x \cdot x, 1\right)}{e}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(0.16666666666666666, x \cdot x, 0.5\right)}{e} \cdot \left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right)\\ \end{array} \end{array} \]
              (FPCore (x)
               :precision binary64
               (if (<= (* x x) 2e-5)
                 (/ (fma (fma (* x x) 0.5 1.0) (* x x) 1.0) E)
                 (* (/ (fma 0.16666666666666666 (* x x) 0.5) E) (* (* (* x x) x) x))))
              double code(double x) {
              	double tmp;
              	if ((x * x) <= 2e-5) {
              		tmp = fma(fma((x * x), 0.5, 1.0), (x * x), 1.0) / ((double) M_E);
              	} else {
              		tmp = (fma(0.16666666666666666, (x * x), 0.5) / ((double) M_E)) * (((x * x) * x) * x);
              	}
              	return tmp;
              }
              
              function code(x)
              	tmp = 0.0
              	if (Float64(x * x) <= 2e-5)
              		tmp = Float64(fma(fma(Float64(x * x), 0.5, 1.0), Float64(x * x), 1.0) / exp(1));
              	else
              		tmp = Float64(Float64(fma(0.16666666666666666, Float64(x * x), 0.5) / exp(1)) * Float64(Float64(Float64(x * x) * x) * x));
              	end
              	return tmp
              end
              
              code[x_] := If[LessEqual[N[(x * x), $MachinePrecision], 2e-5], N[(N[(N[(N[(x * x), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] / E), $MachinePrecision], N[(N[(N[(0.16666666666666666 * N[(x * x), $MachinePrecision] + 0.5), $MachinePrecision] / E), $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-5}:\\
              \;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, 0.5, 1\right), x \cdot x, 1\right)}{e}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{\mathsf{fma}\left(0.16666666666666666, x \cdot x, 0.5\right)}{e} \cdot \left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (*.f64 x x) < 2.00000000000000016e-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} + \frac{1}{2} \cdot \left({x}^{2} \cdot e^{-1}\right)\right)} \]
                4. Step-by-step derivation
                  1. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

                  if 2.00000000000000016e-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} + {x}^{2} \cdot \left(\frac{1}{6} \cdot \left({x}^{2} \cdot e^{-1}\right) + \frac{1}{2} \cdot e^{-1}\right)\right)} \]
                  4. Applied rewrites82.6%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x \cdot x, 0.5\right), x \cdot x, 1\right), x \cdot x, 1\right) \cdot \frac{1}{e}} \]
                  5. 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)} \]
                  6. Applied rewrites82.6%

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

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

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

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

                  Alternative 7: 88.2% accurate, 2.4× speedup?

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

                    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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

                      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, x \cdot x, 1\right), x \cdot x, 1\right) \cdot \frac{1}{e}} \]
                    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 rewrites76.6%

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

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

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

                          if -500 < (-.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 e^{-1}} \]
                          4. Step-by-step derivation
                            1. distribute-rgt1-inN/A

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(x, x, 1\right) \cdot \color{blue}{\frac{1}{e^{1}}} \]
                            8. exp-1-eN/A

                              \[\leadsto \mathsf{fma}\left(x, x, 1\right) \cdot \frac{1}{\color{blue}{\mathsf{E}\left(\right)}} \]
                            9. lower-E.f6499.5

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

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

                              \[\leadsto \frac{x \cdot x}{e} - \color{blue}{\frac{-1}{e}} \]
                          7. Recombined 2 regimes into one program.
                          8. Add Preprocessing

                          Alternative 8: 88.2% accurate, 2.4× speedup?

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

                            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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

                              \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, x \cdot x, 1\right), x \cdot x, 1\right) \cdot \frac{1}{e}} \]
                            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 rewrites76.6%

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

                              if -500 < (-.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 e^{-1}} \]
                              4. Step-by-step derivation
                                1. distribute-rgt1-inN/A

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

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(x, x, 1\right) \cdot \color{blue}{\frac{1}{e^{1}}} \]
                                8. exp-1-eN/A

                                  \[\leadsto \mathsf{fma}\left(x, x, 1\right) \cdot \frac{1}{\color{blue}{\mathsf{E}\left(\right)}} \]
                                9. lower-E.f6499.5

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

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

                                  \[\leadsto \frac{x \cdot x}{e} - \color{blue}{\frac{-1}{e}} \]
                              7. Recombined 2 regimes into one program.
                              8. Final simplification88.3%

                                \[\leadsto \begin{array}{l} \mathbf{if}\;1 - x \cdot x \leq -500:\\ \;\;\;\;\left(\frac{0.5}{e} \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot x}{e} - \frac{-1}{e}\\ \end{array} \]
                              9. Add Preprocessing

                              Alternative 9: 92.0% accurate, 2.5× speedup?

                              \[\begin{array}{l} \\ \frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x \cdot x, 0.5\right), x \cdot x, 1\right), x \cdot x, 1\right)}{e} \end{array} \]
                              (FPCore (x)
                               :precision binary64
                               (/
                                (fma (fma (fma 0.16666666666666666 (* x x) 0.5) (* x x) 1.0) (* x x) 1.0)
                                E))
                              double code(double x) {
                              	return fma(fma(fma(0.16666666666666666, (x * x), 0.5), (x * x), 1.0), (x * x), 1.0) / ((double) M_E);
                              }
                              
                              function code(x)
                              	return Float64(fma(fma(fma(0.16666666666666666, Float64(x * x), 0.5), Float64(x * x), 1.0), Float64(x * x), 1.0) / exp(1))
                              end
                              
                              code[x_] := N[(N[(N[(N[(0.16666666666666666 * N[(x * x), $MachinePrecision] + 0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] / E), $MachinePrecision]
                              
                              \begin{array}{l}
                              
                              \\
                              \frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x \cdot x, 0.5\right), x \cdot x, 1\right), x \cdot x, 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. Applied rewrites91.5%

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

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

                                Alternative 10: 88.4% accurate, 3.3× speedup?

                                \[\begin{array}{l} \\ \frac{\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, 0.5, 1\right), x \cdot x, 1\right)}{e} \end{array} \]
                                (FPCore (x) :precision binary64 (/ (fma (fma (* x x) 0.5 1.0) (* x x) 1.0) E))
                                double code(double x) {
                                	return fma(fma((x * x), 0.5, 1.0), (x * x), 1.0) / ((double) M_E);
                                }
                                
                                function code(x)
                                	return Float64(fma(fma(Float64(x * x), 0.5, 1.0), Float64(x * x), 1.0) / exp(1))
                                end
                                
                                code[x_] := N[(N[(N[(N[(x * x), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] / E), $MachinePrecision]
                                
                                \begin{array}{l}
                                
                                \\
                                \frac{\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, 0.5, 1\right), x \cdot x, 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} + \frac{1}{2} \cdot \left({x}^{2} \cdot e^{-1}\right)\right)} \]
                                4. Step-by-step derivation
                                  1. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

                                  Alternative 11: 75.4% accurate, 3.6× speedup?

                                  \[\begin{array}{l} \\ \frac{x \cdot x}{e} - \frac{-1}{e} \end{array} \]
                                  (FPCore (x) :precision binary64 (- (/ (* x x) E) (/ -1.0 E)))
                                  double code(double x) {
                                  	return ((x * x) / ((double) M_E)) - (-1.0 / ((double) M_E));
                                  }
                                  
                                  public static double code(double x) {
                                  	return ((x * x) / Math.E) - (-1.0 / Math.E);
                                  }
                                  
                                  def code(x):
                                  	return ((x * x) / math.e) - (-1.0 / math.e)
                                  
                                  function code(x)
                                  	return Float64(Float64(Float64(x * x) / exp(1)) - Float64(-1.0 / exp(1)))
                                  end
                                  
                                  function tmp = code(x)
                                  	tmp = ((x * x) / 2.71828182845904523536) - (-1.0 / 2.71828182845904523536);
                                  end
                                  
                                  code[x_] := N[(N[(N[(x * x), $MachinePrecision] / E), $MachinePrecision] - N[(-1.0 / E), $MachinePrecision]), $MachinePrecision]
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  \frac{x \cdot x}{e} - \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} + {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. lower-*.f64N/A

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

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

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

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

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

                                      \[\leadsto \mathsf{fma}\left(x, x, 1\right) \cdot \color{blue}{\frac{1}{e^{1}}} \]
                                    8. exp-1-eN/A

                                      \[\leadsto \mathsf{fma}\left(x, x, 1\right) \cdot \frac{1}{\color{blue}{\mathsf{E}\left(\right)}} \]
                                    9. lower-E.f6477.6

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

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

                                      \[\leadsto \frac{x \cdot x}{e} - \color{blue}{\frac{-1}{e}} \]
                                    2. Add Preprocessing

                                    Alternative 12: 75.4% accurate, 3.8× speedup?

                                    \[\begin{array}{l} \\ \frac{1}{\frac{e}{\mathsf{fma}\left(x, x, 1\right)}} \end{array} \]
                                    (FPCore (x) :precision binary64 (/ 1.0 (/ E (fma x x 1.0))))
                                    double code(double x) {
                                    	return 1.0 / (((double) M_E) / fma(x, x, 1.0));
                                    }
                                    
                                    function code(x)
                                    	return Float64(1.0 / Float64(exp(1) / fma(x, x, 1.0)))
                                    end
                                    
                                    code[x_] := N[(1.0 / N[(E / N[(x * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \frac{1}{\frac{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. 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. lower-*.f64N/A

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

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

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

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

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

                                        \[\leadsto \mathsf{fma}\left(x, x, 1\right) \cdot \color{blue}{\frac{1}{e^{1}}} \]
                                      8. exp-1-eN/A

                                        \[\leadsto \mathsf{fma}\left(x, x, 1\right) \cdot \frac{1}{\color{blue}{\mathsf{E}\left(\right)}} \]
                                      9. lower-E.f6477.6

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

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

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

                                      Alternative 13: 75.0% accurate, 4.0× speedup?

                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-5}:\\ \;\;\;\;\frac{1}{e}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{e} \cdot x\\ \end{array} \end{array} \]
                                      (FPCore (x) :precision binary64 (if (<= (* x x) 2e-5) (/ 1.0 E) (* (/ x E) x)))
                                      double code(double x) {
                                      	double tmp;
                                      	if ((x * x) <= 2e-5) {
                                      		tmp = 1.0 / ((double) M_E);
                                      	} else {
                                      		tmp = (x / ((double) M_E)) * x;
                                      	}
                                      	return tmp;
                                      }
                                      
                                      public static double code(double x) {
                                      	double tmp;
                                      	if ((x * x) <= 2e-5) {
                                      		tmp = 1.0 / Math.E;
                                      	} else {
                                      		tmp = (x / Math.E) * x;
                                      	}
                                      	return tmp;
                                      }
                                      
                                      def code(x):
                                      	tmp = 0
                                      	if (x * x) <= 2e-5:
                                      		tmp = 1.0 / math.e
                                      	else:
                                      		tmp = (x / math.e) * x
                                      	return tmp
                                      
                                      function code(x)
                                      	tmp = 0.0
                                      	if (Float64(x * x) <= 2e-5)
                                      		tmp = Float64(1.0 / exp(1));
                                      	else
                                      		tmp = Float64(Float64(x / exp(1)) * x);
                                      	end
                                      	return tmp
                                      end
                                      
                                      function tmp_2 = code(x)
                                      	tmp = 0.0;
                                      	if ((x * x) <= 2e-5)
                                      		tmp = 1.0 / 2.71828182845904523536;
                                      	else
                                      		tmp = (x / 2.71828182845904523536) * x;
                                      	end
                                      	tmp_2 = tmp;
                                      end
                                      
                                      code[x_] := If[LessEqual[N[(x * x), $MachinePrecision], 2e-5], N[(1.0 / E), $MachinePrecision], N[(N[(x / E), $MachinePrecision] * x), $MachinePrecision]]
                                      
                                      \begin{array}{l}
                                      
                                      \\
                                      \begin{array}{l}
                                      \mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-5}:\\
                                      \;\;\;\;\frac{1}{e}\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;\frac{x}{e} \cdot x\\
                                      
                                      
                                      \end{array}
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 2 regimes
                                      2. if (*.f64 x x) < 2.00000000000000016e-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}} \]
                                        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.f6498.0

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

                                          \[\leadsto \color{blue}{\frac{1}{e}} \]

                                        if 2.00000000000000016e-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 e^{-1}} \]
                                        4. Step-by-step derivation
                                          1. distribute-rgt1-inN/A

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

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

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

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

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

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

                                            \[\leadsto \mathsf{fma}\left(x, x, 1\right) \cdot \color{blue}{\frac{1}{e^{1}}} \]
                                          8. exp-1-eN/A

                                            \[\leadsto \mathsf{fma}\left(x, x, 1\right) \cdot \frac{1}{\color{blue}{\mathsf{E}\left(\right)}} \]
                                          9. lower-E.f6454.5

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

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

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

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

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

                                          Alternative 14: 75.4% 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.f6477.6

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

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

                                          Alternative 15: 50.3% 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.f6451.7

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

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

                                          Reproduce

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