exp neg sub

Percentage Accurate: 100.0% → 100.0%
Time: 13.2s
Alternatives: 22
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 22 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, 0.5× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ {\left(e^{x\_m + -1}\right)}^{\left(x\_m + 1\right)} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m) :precision binary64 (pow (exp (+ x_m -1.0)) (+ x_m 1.0)))
x_m = fabs(x);
double code(double x_m) {
	return pow(exp((x_m + -1.0)), (x_m + 1.0));
}
x_m = abs(x)
real(8) function code(x_m)
    real(8), intent (in) :: x_m
    code = exp((x_m + (-1.0d0))) ** (x_m + 1.0d0)
end function
x_m = Math.abs(x);
public static double code(double x_m) {
	return Math.pow(Math.exp((x_m + -1.0)), (x_m + 1.0));
}
x_m = math.fabs(x)
def code(x_m):
	return math.pow(math.exp((x_m + -1.0)), (x_m + 1.0))
x_m = abs(x)
function code(x_m)
	return exp(Float64(x_m + -1.0)) ^ Float64(x_m + 1.0)
end
x_m = abs(x);
function tmp = code(x_m)
	tmp = exp((x_m + -1.0)) ^ (x_m + 1.0);
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := N[Power[N[Exp[N[(x$95$m + -1.0), $MachinePrecision]], $MachinePrecision], N[(x$95$m + 1.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|

\\
{\left(e^{x\_m + -1}\right)}^{\left(x\_m + 1\right)}
\end{array}
Derivation
  1. Initial program 99.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{e^{-1} \cdot e^{x \cdot x}} \]
    7. metadata-evalN/A

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

      \[\leadsto \color{blue}{\frac{1}{e^{1}}} \cdot e^{x \cdot x} \]
    9. associate-/r/N/A

      \[\leadsto \color{blue}{\frac{1}{\frac{e^{1}}{e^{x \cdot x}}}} \]
    10. clear-numN/A

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

      \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e^{1}}} \]
    12. lower-exp.f64N/A

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

      \[\leadsto \frac{e^{x \cdot x}}{\color{blue}{\mathsf{E}\left(\right)}} \]
    14. lower-E.f6499.9

      \[\leadsto \frac{e^{x \cdot x}}{\color{blue}{e}} \]
  4. Applied rewrites99.9%

    \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e}} \]
  5. Step-by-step derivation
    1. lift-*.f64N/A

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

      \[\leadsto \frac{e^{x \cdot x}}{\color{blue}{e^{1}}} \]
    3. div-expN/A

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

      \[\leadsto e^{\color{blue}{x \cdot x} - 1} \]
    5. difference-of-sqr-1N/A

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

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

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

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

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

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

      \[\leadsto {\left(e^{x + 1}\right)}^{\left(x + \color{blue}{-1}\right)} \]
    12. lower-+.f64100.0

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{{\left(e^{x + -1}\right)}^{\left(x + 1\right)}} \]
  9. Add Preprocessing

Alternative 2: 95.2% accurate, 0.6× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} t_0 := x\_m \cdot \left(x\_m \cdot x\_m\right)\\ \mathbf{if}\;e^{-1 + x\_m \cdot x\_m} \leq 0.5:\\ \;\;\;\;\frac{\mathsf{fma}\left(x\_m \cdot \mathsf{fma}\left(x\_m, \left(x\_m \cdot x\_m\right) \cdot 0.5, x\_m\right), e, e\right)}{e \cdot e}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x\_m \cdot x\_m, \mathsf{fma}\left(x\_m \cdot x\_m, \mathsf{fma}\left(t\_0, t\_0 \cdot 0.004629629629629629, 0.125\right) \cdot 4, 1\right), 1\right)\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m)
 :precision binary64
 (let* ((t_0 (* x_m (* x_m x_m))))
   (if (<= (exp (+ -1.0 (* x_m x_m))) 0.5)
     (/ (fma (* x_m (fma x_m (* (* x_m x_m) 0.5) x_m)) E E) (* E E))
     (fma
      (* x_m x_m)
      (fma
       (* x_m x_m)
       (* (fma t_0 (* t_0 0.004629629629629629) 0.125) 4.0)
       1.0)
      1.0))))
x_m = fabs(x);
double code(double x_m) {
	double t_0 = x_m * (x_m * x_m);
	double tmp;
	if (exp((-1.0 + (x_m * x_m))) <= 0.5) {
		tmp = fma((x_m * fma(x_m, ((x_m * x_m) * 0.5), x_m)), ((double) M_E), ((double) M_E)) / (((double) M_E) * ((double) M_E));
	} else {
		tmp = fma((x_m * x_m), fma((x_m * x_m), (fma(t_0, (t_0 * 0.004629629629629629), 0.125) * 4.0), 1.0), 1.0);
	}
	return tmp;
}
x_m = abs(x)
function code(x_m)
	t_0 = Float64(x_m * Float64(x_m * x_m))
	tmp = 0.0
	if (exp(Float64(-1.0 + Float64(x_m * x_m))) <= 0.5)
		tmp = Float64(fma(Float64(x_m * fma(x_m, Float64(Float64(x_m * x_m) * 0.5), x_m)), exp(1), exp(1)) / Float64(exp(1) * exp(1)));
	else
		tmp = fma(Float64(x_m * x_m), fma(Float64(x_m * x_m), Float64(fma(t_0, Float64(t_0 * 0.004629629629629629), 0.125) * 4.0), 1.0), 1.0);
	end
	return tmp
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := Block[{t$95$0 = N[(x$95$m * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Exp[N[(-1.0 + N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.5], N[(N[(N[(x$95$m * N[(x$95$m * N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.5), $MachinePrecision] + x$95$m), $MachinePrecision]), $MachinePrecision] * E + E), $MachinePrecision] / N[(E * E), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(N[(t$95$0 * N[(t$95$0 * 0.004629629629629629), $MachinePrecision] + 0.125), $MachinePrecision] * 4.0), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x\_m \cdot x\_m, \mathsf{fma}\left(x\_m \cdot x\_m, \mathsf{fma}\left(t\_0, t\_0 \cdot 0.004629629629629629, 0.125\right) \cdot 4, 1\right), 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. *-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. Step-by-step derivation
      1. lift-E.f64N/A

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

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

        \[\leadsto \frac{\color{blue}{-1}}{\mathsf{neg}\left(\mathsf{E}\left(\right)\right)} \cdot \left(x \cdot \left(x \cdot \left(x \cdot \left(x \cdot \frac{1}{2}\right)\right) + x\right) + 1\right) \]
      4. lift-*.f64N/A

        \[\leadsto \frac{-1}{\mathsf{neg}\left(\mathsf{E}\left(\right)\right)} \cdot \left(x \cdot \left(x \cdot \left(x \cdot \color{blue}{\left(x \cdot \frac{1}{2}\right)}\right) + x\right) + 1\right) \]
      5. lift-*.f64N/A

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\mathsf{E}\left(\right)}} \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right), 1\right) \]
      10. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\mathsf{E}\left(\right)}} \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right), 1\right) \]
      11. lift-fma.f64N/A

        \[\leadsto \frac{1}{\mathsf{E}\left(\right)} \cdot \color{blue}{\left(x \cdot \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right) + 1\right)} \]
      12. distribute-rgt-inN/A

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

        \[\leadsto \left(x \cdot \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right)\right) \cdot \color{blue}{\frac{1}{\mathsf{E}\left(\right)}} + 1 \cdot \frac{1}{\mathsf{E}\left(\right)} \]
      14. un-div-invN/A

        \[\leadsto \color{blue}{\frac{x \cdot \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right)}{\mathsf{E}\left(\right)}} + 1 \cdot \frac{1}{\mathsf{E}\left(\right)} \]
    7. Applied rewrites100.0%

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

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

    1. Initial program 99.9%

      \[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-*.f6499.3

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

      \[\leadsto e^{\color{blue}{x \cdot x}} \]
    6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{6}, \frac{1}{2}\right)}, 1\right), 1\right) \]
      14. lower-*.f6481.8

        \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, \color{blue}{x \cdot 0.16666666666666666}, 0.5\right), 1\right), 1\right) \]
    8. Applied rewrites81.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right), 1\right), 1\right)} \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, x \cdot \color{blue}{\left(x \cdot \frac{1}{6}\right)} + \frac{1}{2}, 1\right), 1\right) \]
      2. flip3-+N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \color{blue}{\frac{{\left(x \cdot \left(x \cdot \frac{1}{6}\right)\right)}^{3} + {\frac{1}{2}}^{3}}{\left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) + \left(\frac{1}{2} \cdot \frac{1}{2} - \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \frac{1}{2}\right)}}, 1\right), 1\right) \]
      3. div-invN/A

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

        \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \color{blue}{\left({\left(x \cdot \left(x \cdot \frac{1}{6}\right)\right)}^{3} + {\frac{1}{2}}^{3}\right) \cdot \frac{1}{\left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) + \left(\frac{1}{2} \cdot \frac{1}{2} - \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \frac{1}{2}\right)}}, 1\right), 1\right) \]
      5. unpow-prod-downN/A

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

        \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left({x}^{3}, {\left(x \cdot \frac{1}{6}\right)}^{3}, {\frac{1}{2}}^{3}\right)} \cdot \frac{1}{\left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) + \left(\frac{1}{2} \cdot \frac{1}{2} - \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \frac{1}{2}\right)}, 1\right), 1\right) \]
      7. cube-multN/A

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

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

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

        \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot \left(x \cdot x\right), {\color{blue}{\left(x \cdot \frac{1}{6}\right)}}^{3}, {\frac{1}{2}}^{3}\right) \cdot \frac{1}{\left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) + \left(\frac{1}{2} \cdot \frac{1}{2} - \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \frac{1}{2}\right)}, 1\right), 1\right) \]
      11. unpow-prod-downN/A

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

        \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot \left(x \cdot x\right), \color{blue}{{x}^{3} \cdot {\frac{1}{6}}^{3}}, {\frac{1}{2}}^{3}\right) \cdot \frac{1}{\left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) + \left(\frac{1}{2} \cdot \frac{1}{2} - \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \frac{1}{2}\right)}, 1\right), 1\right) \]
      13. cube-multN/A

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

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

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

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

        \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot \left(x \cdot x\right), \left(x \cdot \left(x \cdot x\right)\right) \cdot \frac{1}{216}, \color{blue}{\frac{1}{8}}\right) \cdot \frac{1}{\left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) + \left(\frac{1}{2} \cdot \frac{1}{2} - \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \frac{1}{2}\right)}, 1\right), 1\right) \]
    10. Applied rewrites11.7%

      \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x \cdot \left(x \cdot x\right), \left(x \cdot \left(x \cdot x\right)\right) \cdot 0.004629629629629629, 0.125\right) \cdot \frac{1}{\mathsf{fma}\left(x \cdot x, \left(x \cdot x\right) \cdot 0.027777777777777776, 0.25\right) - \left(x \cdot x\right) \cdot 0.08333333333333333}}, 1\right), 1\right) \]
    11. Taylor expanded in x around 0

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

        \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot \left(x \cdot x\right), \left(x \cdot \left(x \cdot x\right)\right) \cdot 0.004629629629629629, 0.125\right) \cdot \color{blue}{4}, 1\right), 1\right) \]
    13. Recombined 2 regimes into one program.
    14. Final simplification95.5%

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

    Alternative 3: 91.8% accurate, 0.7× speedup?

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

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

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

          \[\leadsto \frac{\color{blue}{-1}}{\mathsf{neg}\left(\mathsf{E}\left(\right)\right)} \cdot \left(x \cdot \left(x \cdot \left(x \cdot \left(x \cdot \frac{1}{2}\right)\right) + x\right) + 1\right) \]
        4. lift-*.f64N/A

          \[\leadsto \frac{-1}{\mathsf{neg}\left(\mathsf{E}\left(\right)\right)} \cdot \left(x \cdot \left(x \cdot \left(x \cdot \color{blue}{\left(x \cdot \frac{1}{2}\right)}\right) + x\right) + 1\right) \]
        5. lift-*.f64N/A

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

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

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

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

          \[\leadsto \color{blue}{\frac{1}{\mathsf{E}\left(\right)}} \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right), 1\right) \]
        10. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{1}{\mathsf{E}\left(\right)}} \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right), 1\right) \]
        11. lift-fma.f64N/A

          \[\leadsto \frac{1}{\mathsf{E}\left(\right)} \cdot \color{blue}{\left(x \cdot \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right) + 1\right)} \]
        12. distribute-rgt-inN/A

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

          \[\leadsto \left(x \cdot \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right)\right) \cdot \color{blue}{\frac{1}{\mathsf{E}\left(\right)}} + 1 \cdot \frac{1}{\mathsf{E}\left(\right)} \]
        14. un-div-invN/A

          \[\leadsto \color{blue}{\frac{x \cdot \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right)}{\mathsf{E}\left(\right)}} + 1 \cdot \frac{1}{\mathsf{E}\left(\right)} \]
      7. Applied rewrites100.0%

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

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

      1. Initial program 99.9%

        \[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-*.f6499.3

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

        \[\leadsto e^{\color{blue}{x \cdot x}} \]
      6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{6}, \frac{1}{2}\right)}, 1\right), 1\right) \]
        14. lower-*.f6481.8

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, \color{blue}{x \cdot 0.16666666666666666}, 0.5\right), 1\right), 1\right) \]
      8. Applied rewrites81.8%

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

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

    Alternative 4: 91.8% accurate, 0.7× speedup?

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

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

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

          \[\leadsto \frac{\color{blue}{-1}}{\mathsf{neg}\left(\mathsf{E}\left(\right)\right)} \cdot \left(x \cdot \left(x \cdot \left(x \cdot \left(x \cdot \frac{1}{2}\right)\right) + x\right) + 1\right) \]
        4. lift-*.f64N/A

          \[\leadsto \frac{-1}{\mathsf{neg}\left(\mathsf{E}\left(\right)\right)} \cdot \left(x \cdot \left(x \cdot \left(x \cdot \color{blue}{\left(x \cdot \frac{1}{2}\right)}\right) + x\right) + 1\right) \]
        5. lift-*.f64N/A

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

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

          \[\leadsto \frac{-1}{\mathsf{neg}\left(\mathsf{E}\left(\right)\right)} \cdot \color{blue}{\mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right), 1\right)} \]
        8. associate-*l/N/A

          \[\leadsto \color{blue}{\frac{-1 \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right), 1\right)}{\mathsf{neg}\left(\mathsf{E}\left(\right)\right)}} \]
        9. neg-mul-1N/A

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

          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right), 1\right)}{\mathsf{E}\left(\right)}} \]
        11. lower-/.f64100.0

          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot \left(x \cdot 0.5\right), x\right), 1\right)}{e}} \]
      7. Applied rewrites100.0%

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

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

      1. Initial program 99.9%

        \[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-*.f6499.3

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

        \[\leadsto e^{\color{blue}{x \cdot x}} \]
      6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{6}, \frac{1}{2}\right)}, 1\right), 1\right) \]
        14. lower-*.f6481.8

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, \color{blue}{x \cdot 0.16666666666666666}, 0.5\right), 1\right), 1\right) \]
      8. Applied rewrites81.8%

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

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

    Alternative 5: 91.8% accurate, 0.7× speedup?

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

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

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

          \[\leadsto \frac{\color{blue}{-1}}{\mathsf{neg}\left(\mathsf{E}\left(\right)\right)} \cdot \left(x \cdot \left(x \cdot \left(x \cdot \left(x \cdot \frac{1}{2}\right)\right) + x\right) + 1\right) \]
        4. lift-*.f64N/A

          \[\leadsto \frac{-1}{\mathsf{neg}\left(\mathsf{E}\left(\right)\right)} \cdot \left(x \cdot \left(x \cdot \left(x \cdot \color{blue}{\left(x \cdot \frac{1}{2}\right)}\right) + x\right) + 1\right) \]
        5. lift-*.f64N/A

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

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

          \[\leadsto \frac{-1}{\mathsf{neg}\left(\mathsf{E}\left(\right)\right)} \cdot \color{blue}{\mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right), 1\right)} \]
        8. associate-*l/N/A

          \[\leadsto \color{blue}{\frac{-1 \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right), 1\right)}{\mathsf{neg}\left(\mathsf{E}\left(\right)\right)}} \]
        9. neg-mul-1N/A

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

          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right), 1\right)}{\mathsf{E}\left(\right)}} \]
        11. lower-/.f64100.0

          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot \left(x \cdot 0.5\right), x\right), 1\right)}{e}} \]
      7. Applied rewrites100.0%

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

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

      1. Initial program 99.9%

        \[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-*.f6499.3

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

        \[\leadsto e^{\color{blue}{x \cdot x}} \]
      6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{6}, \frac{1}{2}\right)}, 1\right), 1\right) \]
        14. lower-*.f6481.8

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, \color{blue}{x \cdot 0.16666666666666666}, 0.5\right), 1\right), 1\right) \]
      8. Applied rewrites81.8%

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \left(\frac{1}{6} \cdot {x}^{2}\right) \cdot {x}^{2} + \frac{1}{2} \cdot \color{blue}{\frac{1 \cdot {x}^{4}}{{x}^{2}}}, 1\right) \]
        7. *-lft-identityN/A

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \left(\frac{1}{6} \cdot {x}^{2}\right) \cdot {x}^{2} + \frac{1}{2} \cdot \frac{{x}^{\color{blue}{\left(3 + 1\right)}}}{{x}^{2}}, 1\right) \]
        9. pow-plusN/A

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \left(\frac{1}{6} \cdot {x}^{2}\right) \cdot {x}^{2} + \frac{1}{2} \cdot \color{blue}{\left(\frac{{x}^{3}}{{x}^{2}} \cdot x\right)}, 1\right) \]
        11. *-lft-identityN/A

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \left(\frac{1}{6} \cdot {x}^{2}\right) \cdot {x}^{2} + \frac{1}{2} \cdot \left(\color{blue}{\left(\left(\frac{1}{{x}^{2}} \cdot {x}^{2}\right) \cdot x\right)} \cdot x\right), 1\right) \]
        16. lft-mult-inverseN/A

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

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \left(\frac{1}{6} \cdot {x}^{2}\right) \cdot {x}^{2} + \frac{1}{2} \cdot \color{blue}{{x}^{2}}, 1\right) \]
      11. Applied rewrites81.8%

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

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

    Alternative 6: 88.1% accurate, 0.8× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;e^{-1 + x\_m \cdot x\_m} \leq 0.5:\\ \;\;\;\;\frac{\mathsf{fma}\left(x\_m, x\_m, 1\right)}{e}\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot \left(x\_m \cdot \left(x\_m \cdot \left(x\_m \cdot 0.5\right)\right)\right)\\ \end{array} \end{array} \]
    x_m = (fabs.f64 x)
    (FPCore (x_m)
     :precision binary64
     (if (<= (exp (+ -1.0 (* x_m x_m))) 0.5)
       (/ (fma x_m x_m 1.0) E)
       (* x_m (* x_m (* x_m (* x_m 0.5))))))
    x_m = fabs(x);
    double code(double x_m) {
    	double tmp;
    	if (exp((-1.0 + (x_m * x_m))) <= 0.5) {
    		tmp = fma(x_m, x_m, 1.0) / ((double) M_E);
    	} else {
    		tmp = x_m * (x_m * (x_m * (x_m * 0.5)));
    	}
    	return tmp;
    }
    
    x_m = abs(x)
    function code(x_m)
    	tmp = 0.0
    	if (exp(Float64(-1.0 + Float64(x_m * x_m))) <= 0.5)
    		tmp = Float64(fma(x_m, x_m, 1.0) / exp(1));
    	else
    		tmp = Float64(x_m * Float64(x_m * Float64(x_m * Float64(x_m * 0.5))));
    	end
    	return tmp
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    code[x$95$m_] := If[LessEqual[N[Exp[N[(-1.0 + N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.5], N[(N[(x$95$m * x$95$m + 1.0), $MachinePrecision] / E), $MachinePrecision], N[(x$95$m * N[(x$95$m * N[(x$95$m * N[(x$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    x_m = \left|x\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;e^{-1 + x\_m \cdot x\_m} \leq 0.5:\\
    \;\;\;\;\frac{\mathsf{fma}\left(x\_m, x\_m, 1\right)}{e}\\
    
    \mathbf{else}:\\
    \;\;\;\;x\_m \cdot \left(x\_m \cdot \left(x\_m \cdot \left(x\_m \cdot 0.5\right)\right)\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. Step-by-step derivation
        1. lift-*.f64N/A

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

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

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

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

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

          \[\leadsto \color{blue}{e^{-1} \cdot e^{x \cdot x}} \]
        7. metadata-evalN/A

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

          \[\leadsto \color{blue}{\frac{1}{e^{1}}} \cdot e^{x \cdot x} \]
        9. associate-/r/N/A

          \[\leadsto \color{blue}{\frac{1}{\frac{e^{1}}{e^{x \cdot x}}}} \]
        10. clear-numN/A

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

          \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e^{1}}} \]
        12. lower-exp.f64N/A

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

          \[\leadsto \frac{e^{x \cdot x}}{\color{blue}{\mathsf{E}\left(\right)}} \]
        14. lower-E.f64100.0

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

        \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e}} \]
      5. Taylor expanded in x around 0

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

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

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

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

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

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

          \[\leadsto e^{-1} + {x}^{2} \cdot \frac{1}{\color{blue}{e^{1}}} \]
        7. rec-expN/A

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

          \[\leadsto e^{-1} + {x}^{2} \cdot e^{\color{blue}{-1}} \]
        9. distribute-rgt1-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      1. Initial program 99.9%

        \[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-*.f6499.3

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

        \[\leadsto e^{\color{blue}{x \cdot x}} \]
      6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{2}, 1\right), 1\right) \]
        10. lower-*.f6471.8

          \[\leadsto \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(\color{blue}{x \cdot x}, 0.5, 1\right), 1\right) \]
      8. Applied rewrites71.8%

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

        \[\leadsto \color{blue}{\frac{1}{2} \cdot {x}^{4}} \]
      10. Step-by-step derivation
        1. metadata-evalN/A

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

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

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

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

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

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

          \[\leadsto \left(\frac{1}{2} \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot x\right)\right) \cdot x \]
        8. unpow3N/A

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

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

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

          \[\leadsto x \cdot \left(\frac{1}{2} \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)}\right) \]
        12. unpow2N/A

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

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

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

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

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

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

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

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

          \[\leadsto x \cdot \left(x \cdot \left(x \cdot \color{blue}{\left(x \cdot \frac{1}{2}\right)}\right)\right) \]
        21. lower-*.f6471.8

          \[\leadsto x \cdot \left(x \cdot \left(x \cdot \color{blue}{\left(x \cdot 0.5\right)}\right)\right) \]
      11. Applied rewrites71.8%

        \[\leadsto \color{blue}{x \cdot \left(x \cdot \left(x \cdot \left(x \cdot 0.5\right)\right)\right)} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification86.3%

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

    Alternative 7: 100.0% accurate, 0.9× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ \frac{e^{x\_m \cdot x\_m}}{e} \end{array} \]
    x_m = (fabs.f64 x)
    (FPCore (x_m) :precision binary64 (/ (exp (* x_m x_m)) E))
    x_m = fabs(x);
    double code(double x_m) {
    	return exp((x_m * x_m)) / ((double) M_E);
    }
    
    x_m = Math.abs(x);
    public static double code(double x_m) {
    	return Math.exp((x_m * x_m)) / Math.E;
    }
    
    x_m = math.fabs(x)
    def code(x_m):
    	return math.exp((x_m * x_m)) / math.e
    
    x_m = abs(x)
    function code(x_m)
    	return Float64(exp(Float64(x_m * x_m)) / exp(1))
    end
    
    x_m = abs(x);
    function tmp = code(x_m)
    	tmp = exp((x_m * x_m)) / 2.71828182845904523536;
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    code[x$95$m_] := N[(N[Exp[N[(x$95$m * x$95$m), $MachinePrecision]], $MachinePrecision] / E), $MachinePrecision]
    
    \begin{array}{l}
    x_m = \left|x\right|
    
    \\
    \frac{e^{x\_m \cdot x\_m}}{e}
    \end{array}
    
    Derivation
    1. Initial program 99.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{e^{-1} \cdot e^{x \cdot x}} \]
      7. metadata-evalN/A

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

        \[\leadsto \color{blue}{\frac{1}{e^{1}}} \cdot e^{x \cdot x} \]
      9. associate-/r/N/A

        \[\leadsto \color{blue}{\frac{1}{\frac{e^{1}}{e^{x \cdot x}}}} \]
      10. clear-numN/A

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

        \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e^{1}}} \]
      12. lower-exp.f64N/A

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

        \[\leadsto \frac{e^{x \cdot x}}{\color{blue}{\mathsf{E}\left(\right)}} \]
      14. lower-E.f6499.9

        \[\leadsto \frac{e^{x \cdot x}}{\color{blue}{e}} \]
    4. Applied rewrites99.9%

      \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e}} \]
    5. Add Preprocessing

    Alternative 8: 100.0% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

    Alternative 9: 98.5% accurate, 1.1× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ {e}^{\left(x\_m + -1\right)} \end{array} \]
    x_m = (fabs.f64 x)
    (FPCore (x_m) :precision binary64 (pow E (+ x_m -1.0)))
    x_m = fabs(x);
    double code(double x_m) {
    	return pow(((double) M_E), (x_m + -1.0));
    }
    
    x_m = Math.abs(x);
    public static double code(double x_m) {
    	return Math.pow(Math.E, (x_m + -1.0));
    }
    
    x_m = math.fabs(x)
    def code(x_m):
    	return math.pow(math.e, (x_m + -1.0))
    
    x_m = abs(x)
    function code(x_m)
    	return exp(1) ^ Float64(x_m + -1.0)
    end
    
    x_m = abs(x);
    function tmp = code(x_m)
    	tmp = 2.71828182845904523536 ^ (x_m + -1.0);
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    code[x$95$m_] := N[Power[E, N[(x$95$m + -1.0), $MachinePrecision]], $MachinePrecision]
    
    \begin{array}{l}
    x_m = \left|x\right|
    
    \\
    {e}^{\left(x\_m + -1\right)}
    \end{array}
    
    Derivation
    1. Initial program 99.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{e^{-1} \cdot e^{x \cdot x}} \]
      7. metadata-evalN/A

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

        \[\leadsto \color{blue}{\frac{1}{e^{1}}} \cdot e^{x \cdot x} \]
      9. associate-/r/N/A

        \[\leadsto \color{blue}{\frac{1}{\frac{e^{1}}{e^{x \cdot x}}}} \]
      10. clear-numN/A

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

        \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e^{1}}} \]
      12. lower-exp.f64N/A

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

        \[\leadsto \frac{e^{x \cdot x}}{\color{blue}{\mathsf{E}\left(\right)}} \]
      14. lower-E.f6499.9

        \[\leadsto \frac{e^{x \cdot x}}{\color{blue}{e}} \]
    4. Applied rewrites99.9%

      \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto \frac{e^{x \cdot x}}{\color{blue}{e^{1}}} \]
      3. div-expN/A

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

        \[\leadsto e^{\color{blue}{x \cdot x} - 1} \]
      5. difference-of-sqr-1N/A

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

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

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

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

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

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

        \[\leadsto {\left(e^{x + 1}\right)}^{\left(x + \color{blue}{-1}\right)} \]
      12. lower-+.f64100.0

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

      \[\leadsto \color{blue}{{\left(e^{x + 1}\right)}^{\left(x + -1\right)}} \]
    7. Taylor expanded in x around 0

      \[\leadsto {\color{blue}{\left(e^{1}\right)}}^{\left(x + -1\right)} \]
    8. Step-by-step derivation
      1. exp-1-eN/A

        \[\leadsto {\color{blue}{\mathsf{E}\left(\right)}}^{\left(x + -1\right)} \]
      2. lower-E.f6474.4

        \[\leadsto {\color{blue}{e}}^{\left(x + -1\right)} \]
    9. Applied rewrites74.4%

      \[\leadsto {\color{blue}{e}}^{\left(x + -1\right)} \]
    10. Add Preprocessing

    Alternative 10: 95.7% accurate, 1.4× speedup?

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

      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. Step-by-step derivation
        1. lift-E.f64N/A

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

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

          \[\leadsto \frac{\color{blue}{-1}}{\mathsf{neg}\left(\mathsf{E}\left(\right)\right)} \cdot \left(x \cdot \left(x \cdot \left(x \cdot \left(x \cdot \frac{1}{2}\right)\right) + x\right) + 1\right) \]
        4. lift-*.f64N/A

          \[\leadsto \frac{-1}{\mathsf{neg}\left(\mathsf{E}\left(\right)\right)} \cdot \left(x \cdot \left(x \cdot \left(x \cdot \color{blue}{\left(x \cdot \frac{1}{2}\right)}\right) + x\right) + 1\right) \]
        5. lift-*.f64N/A

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

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

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

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

          \[\leadsto \color{blue}{\frac{1}{\mathsf{E}\left(\right)}} \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right), 1\right) \]
        10. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{1}{\mathsf{E}\left(\right)}} \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right), 1\right) \]
        11. lift-fma.f64N/A

          \[\leadsto \frac{1}{\mathsf{E}\left(\right)} \cdot \color{blue}{\left(x \cdot \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right) + 1\right)} \]
        12. distribute-rgt-inN/A

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

          \[\leadsto \left(x \cdot \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right)\right) \cdot \color{blue}{\frac{1}{\mathsf{E}\left(\right)}} + 1 \cdot \frac{1}{\mathsf{E}\left(\right)} \]
        14. un-div-invN/A

          \[\leadsto \color{blue}{\frac{x \cdot \mathsf{fma}\left(x, x \cdot \left(x \cdot \frac{1}{2}\right), x\right)}{\mathsf{E}\left(\right)}} + 1 \cdot \frac{1}{\mathsf{E}\left(\right)} \]
      7. Applied rewrites100.0%

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

      if 9.99999999999999955e-7 < (*.f64 x x)

      1. Initial program 99.9%

        \[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-*.f6499.3

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

        \[\leadsto e^{\color{blue}{x \cdot x}} \]
      6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{6}, \frac{1}{2}\right)}, 1\right), 1\right) \]
        14. lower-*.f6481.8

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, \color{blue}{x \cdot 0.16666666666666666}, 0.5\right), 1\right), 1\right) \]
      8. Applied rewrites81.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right), 1\right), 1\right)} \]
      9. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, x \cdot \color{blue}{\left(x \cdot \frac{1}{6}\right)} + \frac{1}{2}, 1\right), 1\right) \]
        2. flip3-+N/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \color{blue}{\frac{{\left(x \cdot \left(x \cdot \frac{1}{6}\right)\right)}^{3} + {\frac{1}{2}}^{3}}{\left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) + \left(\frac{1}{2} \cdot \frac{1}{2} - \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \frac{1}{2}\right)}}, 1\right), 1\right) \]
        3. div-invN/A

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \color{blue}{\left({\left(x \cdot \left(x \cdot \frac{1}{6}\right)\right)}^{3} + {\frac{1}{2}}^{3}\right) \cdot \frac{1}{\left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) + \left(\frac{1}{2} \cdot \frac{1}{2} - \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \frac{1}{2}\right)}}, 1\right), 1\right) \]
        5. unpow-prod-downN/A

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left({x}^{3}, {\left(x \cdot \frac{1}{6}\right)}^{3}, {\frac{1}{2}}^{3}\right)} \cdot \frac{1}{\left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) + \left(\frac{1}{2} \cdot \frac{1}{2} - \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \frac{1}{2}\right)}, 1\right), 1\right) \]
        7. cube-multN/A

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

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

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot \left(x \cdot x\right), {\color{blue}{\left(x \cdot \frac{1}{6}\right)}}^{3}, {\frac{1}{2}}^{3}\right) \cdot \frac{1}{\left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) + \left(\frac{1}{2} \cdot \frac{1}{2} - \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \frac{1}{2}\right)}, 1\right), 1\right) \]
        11. unpow-prod-downN/A

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot \left(x \cdot x\right), \color{blue}{{x}^{3} \cdot {\frac{1}{6}}^{3}}, {\frac{1}{2}}^{3}\right) \cdot \frac{1}{\left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) + \left(\frac{1}{2} \cdot \frac{1}{2} - \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \frac{1}{2}\right)}, 1\right), 1\right) \]
        13. cube-multN/A

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot \left(x \cdot x\right), \left(x \cdot \left(x \cdot x\right)\right) \cdot \frac{1}{216}, \color{blue}{\frac{1}{8}}\right) \cdot \frac{1}{\left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) + \left(\frac{1}{2} \cdot \frac{1}{2} - \left(x \cdot \left(x \cdot \frac{1}{6}\right)\right) \cdot \frac{1}{2}\right)}, 1\right), 1\right) \]
      10. Applied rewrites11.7%

        \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x \cdot \left(x \cdot x\right), \left(x \cdot \left(x \cdot x\right)\right) \cdot 0.004629629629629629, 0.125\right) \cdot \frac{1}{\mathsf{fma}\left(x \cdot x, \left(x \cdot x\right) \cdot 0.027777777777777776, 0.25\right) - \left(x \cdot x\right) \cdot 0.08333333333333333}}, 1\right), 1\right) \]
      11. Taylor expanded in x around 0

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

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot \left(x \cdot x\right), \left(x \cdot \left(x \cdot x\right)\right) \cdot \frac{1}{216}, \frac{1}{8}\right) \cdot \left(\color{blue}{{x}^{2} \cdot \frac{4}{3}} + 4\right), 1\right), 1\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot \left(x \cdot x\right), \left(x \cdot \left(x \cdot x\right)\right) \cdot \frac{1}{216}, \frac{1}{8}\right) \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot \frac{4}{3} + 4\right), 1\right), 1\right) \]
        4. associate-*l*N/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot \left(x \cdot x\right), \left(x \cdot \left(x \cdot x\right)\right) \cdot \frac{1}{216}, \frac{1}{8}\right) \cdot \left(\color{blue}{x \cdot \left(x \cdot \frac{4}{3}\right)} + 4\right), 1\right), 1\right) \]
        5. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot \left(x \cdot x\right), \left(x \cdot \left(x \cdot x\right)\right) \cdot \frac{1}{216}, \frac{1}{8}\right) \cdot \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{4}{3}, 4\right)}, 1\right), 1\right) \]
        6. lower-*.f6492.3

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot \left(x \cdot x\right), \left(x \cdot \left(x \cdot x\right)\right) \cdot 0.004629629629629629, 0.125\right) \cdot \mathsf{fma}\left(x, \color{blue}{x \cdot 1.3333333333333333}, 4\right), 1\right), 1\right) \]
      13. Applied rewrites92.3%

        \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot \left(x \cdot x\right), \left(x \cdot \left(x \cdot x\right)\right) \cdot 0.004629629629629629, 0.125\right) \cdot \color{blue}{\mathsf{fma}\left(x, x \cdot 1.3333333333333333, 4\right)}, 1\right), 1\right) \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 11: 91.9% accurate, 2.2× speedup?

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

      \[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 rewrites91.2%

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

    Alternative 12: 91.8% accurate, 2.4× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\ \;\;\;\;\mathsf{fma}\left(x\_m \cdot x\_m, x\_m \cdot \left(x\_m \cdot \mathsf{fma}\left(x\_m \cdot x\_m, 0.16666666666666666, 0.5\right)\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{e}{\mathsf{fma}\left(x\_m, x\_m, 1\right)}}\\ \end{array} \end{array} \]
    x_m = (fabs.f64 x)
    (FPCore (x_m)
     :precision binary64
     (if (<= (- 1.0 (* x_m x_m)) -500.0)
       (fma
        (* x_m x_m)
        (* x_m (* x_m (fma (* x_m x_m) 0.16666666666666666 0.5)))
        1.0)
       (/ 1.0 (/ E (fma x_m x_m 1.0)))))
    x_m = fabs(x);
    double code(double x_m) {
    	double tmp;
    	if ((1.0 - (x_m * x_m)) <= -500.0) {
    		tmp = fma((x_m * x_m), (x_m * (x_m * fma((x_m * x_m), 0.16666666666666666, 0.5))), 1.0);
    	} else {
    		tmp = 1.0 / (((double) M_E) / fma(x_m, x_m, 1.0));
    	}
    	return tmp;
    }
    
    x_m = abs(x)
    function code(x_m)
    	tmp = 0.0
    	if (Float64(1.0 - Float64(x_m * x_m)) <= -500.0)
    		tmp = fma(Float64(x_m * x_m), Float64(x_m * Float64(x_m * fma(Float64(x_m * x_m), 0.16666666666666666, 0.5))), 1.0);
    	else
    		tmp = Float64(1.0 / Float64(exp(1) / fma(x_m, x_m, 1.0)));
    	end
    	return tmp
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    code[x$95$m_] := If[LessEqual[N[(1.0 - N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision], -500.0], N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(x$95$m * N[(x$95$m * N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.16666666666666666 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(1.0 / N[(E / N[(x$95$m * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    x_m = \left|x\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\
    \;\;\;\;\mathsf{fma}\left(x\_m \cdot x\_m, x\_m \cdot \left(x\_m \cdot \mathsf{fma}\left(x\_m \cdot x\_m, 0.16666666666666666, 0.5\right)\right), 1\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{\frac{e}{\mathsf{fma}\left(x\_m, x\_m, 1\right)}}\\
    
    
    \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 99.9%

        \[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-*.f6499.3

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

        \[\leadsto e^{\color{blue}{x \cdot x}} \]
      6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{6}, \frac{1}{2}\right)}, 1\right), 1\right) \]
        14. lower-*.f6481.8

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, \color{blue}{x \cdot 0.16666666666666666}, 0.5\right), 1\right), 1\right) \]
      8. Applied rewrites81.8%

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \left(\frac{1}{6} \cdot {x}^{2}\right) \cdot {x}^{2} + \frac{1}{2} \cdot \color{blue}{\frac{1 \cdot {x}^{4}}{{x}^{2}}}, 1\right) \]
        7. *-lft-identityN/A

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \left(\frac{1}{6} \cdot {x}^{2}\right) \cdot {x}^{2} + \frac{1}{2} \cdot \frac{{x}^{\color{blue}{\left(3 + 1\right)}}}{{x}^{2}}, 1\right) \]
        9. pow-plusN/A

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \left(\frac{1}{6} \cdot {x}^{2}\right) \cdot {x}^{2} + \frac{1}{2} \cdot \color{blue}{\left(\frac{{x}^{3}}{{x}^{2}} \cdot x\right)}, 1\right) \]
        11. *-lft-identityN/A

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \left(\frac{1}{6} \cdot {x}^{2}\right) \cdot {x}^{2} + \frac{1}{2} \cdot \left(\color{blue}{\left(\left(\frac{1}{{x}^{2}} \cdot {x}^{2}\right) \cdot x\right)} \cdot x\right), 1\right) \]
        16. lft-mult-inverseN/A

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

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \left(\frac{1}{6} \cdot {x}^{2}\right) \cdot {x}^{2} + \frac{1}{2} \cdot \color{blue}{{x}^{2}}, 1\right) \]
      11. Applied rewrites81.8%

        \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{x \cdot \left(x \cdot \mathsf{fma}\left(x \cdot x, 0.16666666666666666, 0.5\right)\right)}, 1\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. Step-by-step derivation
        1. lift-*.f64N/A

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

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

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

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

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

          \[\leadsto \color{blue}{e^{-1} \cdot e^{x \cdot x}} \]
        7. metadata-evalN/A

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

          \[\leadsto \color{blue}{\frac{1}{e^{1}}} \cdot e^{x \cdot x} \]
        9. associate-/r/N/A

          \[\leadsto \color{blue}{\frac{1}{\frac{e^{1}}{e^{x \cdot x}}}} \]
        10. clear-numN/A

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

          \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e^{1}}} \]
        12. lower-exp.f64N/A

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

          \[\leadsto \frac{e^{x \cdot x}}{\color{blue}{\mathsf{E}\left(\right)}} \]
        14. lower-E.f64100.0

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

        \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e}} \]
      5. Taylor expanded in x around 0

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

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

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

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

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

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

          \[\leadsto e^{-1} + {x}^{2} \cdot \frac{1}{\color{blue}{e^{1}}} \]
        7. rec-expN/A

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

          \[\leadsto e^{-1} + {x}^{2} \cdot e^{\color{blue}{-1}} \]
        9. distribute-rgt1-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, x, 1\right)}}{\mathsf{E}\left(\right)} \]
        2. lift-E.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(x, x, 1\right)}{\color{blue}{\mathsf{E}\left(\right)}} \]
        3. clear-numN/A

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

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

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

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

    Alternative 13: 91.8% accurate, 2.4× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\ \;\;\;\;\mathsf{fma}\left(x\_m \cdot x\_m, \left(x\_m \cdot x\_m\right) \cdot \left(\left(x\_m \cdot x\_m\right) \cdot 0.16666666666666666\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{e}{\mathsf{fma}\left(x\_m, x\_m, 1\right)}}\\ \end{array} \end{array} \]
    x_m = (fabs.f64 x)
    (FPCore (x_m)
     :precision binary64
     (if (<= (- 1.0 (* x_m x_m)) -500.0)
       (fma (* x_m x_m) (* (* x_m x_m) (* (* x_m x_m) 0.16666666666666666)) 1.0)
       (/ 1.0 (/ E (fma x_m x_m 1.0)))))
    x_m = fabs(x);
    double code(double x_m) {
    	double tmp;
    	if ((1.0 - (x_m * x_m)) <= -500.0) {
    		tmp = fma((x_m * x_m), ((x_m * x_m) * ((x_m * x_m) * 0.16666666666666666)), 1.0);
    	} else {
    		tmp = 1.0 / (((double) M_E) / fma(x_m, x_m, 1.0));
    	}
    	return tmp;
    }
    
    x_m = abs(x)
    function code(x_m)
    	tmp = 0.0
    	if (Float64(1.0 - Float64(x_m * x_m)) <= -500.0)
    		tmp = fma(Float64(x_m * x_m), Float64(Float64(x_m * x_m) * Float64(Float64(x_m * x_m) * 0.16666666666666666)), 1.0);
    	else
    		tmp = Float64(1.0 / Float64(exp(1) / fma(x_m, x_m, 1.0)));
    	end
    	return tmp
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    code[x$95$m_] := If[LessEqual[N[(1.0 - N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision], -500.0], N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(N[(x$95$m * x$95$m), $MachinePrecision] * N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(1.0 / N[(E / N[(x$95$m * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    x_m = \left|x\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\
    \;\;\;\;\mathsf{fma}\left(x\_m \cdot x\_m, \left(x\_m \cdot x\_m\right) \cdot \left(\left(x\_m \cdot x\_m\right) \cdot 0.16666666666666666\right), 1\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{\frac{e}{\mathsf{fma}\left(x\_m, x\_m, 1\right)}}\\
    
    
    \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 99.9%

        \[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-*.f6499.3

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

        \[\leadsto e^{\color{blue}{x \cdot x}} \]
      6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{6}, \frac{1}{2}\right)}, 1\right), 1\right) \]
        14. lower-*.f6481.8

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, \color{blue}{x \cdot 0.16666666666666666}, 0.5\right), 1\right), 1\right) \]
      8. Applied rewrites81.8%

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

        \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{\frac{1}{6} \cdot {x}^{4}}, 1\right) \]
      10. Step-by-step derivation
        1. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \left(x \cdot x\right) \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot 0.16666666666666666\right), 1\right) \]
      11. Applied rewrites81.8%

        \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot 0.16666666666666666\right)}, 1\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. Step-by-step derivation
        1. lift-*.f64N/A

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

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

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

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

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

          \[\leadsto \color{blue}{e^{-1} \cdot e^{x \cdot x}} \]
        7. metadata-evalN/A

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

          \[\leadsto \color{blue}{\frac{1}{e^{1}}} \cdot e^{x \cdot x} \]
        9. associate-/r/N/A

          \[\leadsto \color{blue}{\frac{1}{\frac{e^{1}}{e^{x \cdot x}}}} \]
        10. clear-numN/A

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

          \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e^{1}}} \]
        12. lower-exp.f64N/A

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

          \[\leadsto \frac{e^{x \cdot x}}{\color{blue}{\mathsf{E}\left(\right)}} \]
        14. lower-E.f64100.0

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

        \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e}} \]
      5. Taylor expanded in x around 0

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

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

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

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

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

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

          \[\leadsto e^{-1} + {x}^{2} \cdot \frac{1}{\color{blue}{e^{1}}} \]
        7. rec-expN/A

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

          \[\leadsto e^{-1} + {x}^{2} \cdot e^{\color{blue}{-1}} \]
        9. distribute-rgt1-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, x, 1\right)}}{\mathsf{E}\left(\right)} \]
        2. lift-E.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(x, x, 1\right)}{\color{blue}{\mathsf{E}\left(\right)}} \]
        3. clear-numN/A

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

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

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

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

    Alternative 14: 91.8% accurate, 2.5× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} t_0 := x\_m \cdot \left(x\_m \cdot x\_m\right)\\ \mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\ \;\;\;\;0.16666666666666666 \cdot \left(t\_0 \cdot t\_0\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{e}{\mathsf{fma}\left(x\_m, x\_m, 1\right)}}\\ \end{array} \end{array} \]
    x_m = (fabs.f64 x)
    (FPCore (x_m)
     :precision binary64
     (let* ((t_0 (* x_m (* x_m x_m))))
       (if (<= (- 1.0 (* x_m x_m)) -500.0)
         (* 0.16666666666666666 (* t_0 t_0))
         (/ 1.0 (/ E (fma x_m x_m 1.0))))))
    x_m = fabs(x);
    double code(double x_m) {
    	double t_0 = x_m * (x_m * x_m);
    	double tmp;
    	if ((1.0 - (x_m * x_m)) <= -500.0) {
    		tmp = 0.16666666666666666 * (t_0 * t_0);
    	} else {
    		tmp = 1.0 / (((double) M_E) / fma(x_m, x_m, 1.0));
    	}
    	return tmp;
    }
    
    x_m = abs(x)
    function code(x_m)
    	t_0 = Float64(x_m * Float64(x_m * x_m))
    	tmp = 0.0
    	if (Float64(1.0 - Float64(x_m * x_m)) <= -500.0)
    		tmp = Float64(0.16666666666666666 * Float64(t_0 * t_0));
    	else
    		tmp = Float64(1.0 / Float64(exp(1) / fma(x_m, x_m, 1.0)));
    	end
    	return tmp
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    code[x$95$m_] := Block[{t$95$0 = N[(x$95$m * N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 - N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision], -500.0], N[(0.16666666666666666 * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(E / N[(x$95$m * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    x_m = \left|x\right|
    
    \\
    \begin{array}{l}
    t_0 := x\_m \cdot \left(x\_m \cdot x\_m\right)\\
    \mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\
    \;\;\;\;0.16666666666666666 \cdot \left(t\_0 \cdot t\_0\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{\frac{e}{\mathsf{fma}\left(x\_m, x\_m, 1\right)}}\\
    
    
    \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 99.9%

        \[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-*.f6499.3

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

        \[\leadsto e^{\color{blue}{x \cdot x}} \]
      6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, x \cdot \frac{1}{6}, \frac{1}{2}\right)}, 1\right), 1\right) \]
        14. lower-*.f6481.8

          \[\leadsto \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, \color{blue}{x \cdot 0.16666666666666666}, 0.5\right), 1\right), 1\right) \]
      8. Applied rewrites81.8%

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

        \[\leadsto \color{blue}{\frac{1}{6} \cdot {x}^{6}} \]
      10. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \color{blue}{\frac{1}{6} \cdot {x}^{6}} \]
        2. metadata-evalN/A

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

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

          \[\leadsto \frac{1}{6} \cdot \color{blue}{\left({x}^{3} \cdot {x}^{3}\right)} \]
        5. cube-multN/A

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

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

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

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

          \[\leadsto \frac{1}{6} \cdot \left(\left(x \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot {x}^{3}\right) \]
        10. cube-multN/A

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

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

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

          \[\leadsto \frac{1}{6} \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)\right) \]
        14. lower-*.f6481.8

          \[\leadsto 0.16666666666666666 \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)\right) \]
      11. Applied rewrites81.8%

        \[\leadsto \color{blue}{0.16666666666666666 \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)\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. Step-by-step derivation
        1. lift-*.f64N/A

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

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

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

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

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

          \[\leadsto \color{blue}{e^{-1} \cdot e^{x \cdot x}} \]
        7. metadata-evalN/A

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

          \[\leadsto \color{blue}{\frac{1}{e^{1}}} \cdot e^{x \cdot x} \]
        9. associate-/r/N/A

          \[\leadsto \color{blue}{\frac{1}{\frac{e^{1}}{e^{x \cdot x}}}} \]
        10. clear-numN/A

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

          \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e^{1}}} \]
        12. lower-exp.f64N/A

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

          \[\leadsto \frac{e^{x \cdot x}}{\color{blue}{\mathsf{E}\left(\right)}} \]
        14. lower-E.f64100.0

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

        \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e}} \]
      5. Taylor expanded in x around 0

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

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

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

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

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

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

          \[\leadsto e^{-1} + {x}^{2} \cdot \frac{1}{\color{blue}{e^{1}}} \]
        7. rec-expN/A

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

          \[\leadsto e^{-1} + {x}^{2} \cdot e^{\color{blue}{-1}} \]
        9. distribute-rgt1-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, x, 1\right)}}{\mathsf{E}\left(\right)} \]
        2. lift-E.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(x, x, 1\right)}{\color{blue}{\mathsf{E}\left(\right)}} \]
        3. clear-numN/A

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

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

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

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

    Alternative 15: 88.1% accurate, 2.6× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\ \;\;\;\;\mathsf{fma}\left(x\_m, x\_m \cdot \mathsf{fma}\left(x\_m \cdot x\_m, 0.5, 1\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{e}{\mathsf{fma}\left(x\_m, x\_m, 1\right)}}\\ \end{array} \end{array} \]
    x_m = (fabs.f64 x)
    (FPCore (x_m)
     :precision binary64
     (if (<= (- 1.0 (* x_m x_m)) -500.0)
       (fma x_m (* x_m (fma (* x_m x_m) 0.5 1.0)) 1.0)
       (/ 1.0 (/ E (fma x_m x_m 1.0)))))
    x_m = fabs(x);
    double code(double x_m) {
    	double tmp;
    	if ((1.0 - (x_m * x_m)) <= -500.0) {
    		tmp = fma(x_m, (x_m * fma((x_m * x_m), 0.5, 1.0)), 1.0);
    	} else {
    		tmp = 1.0 / (((double) M_E) / fma(x_m, x_m, 1.0));
    	}
    	return tmp;
    }
    
    x_m = abs(x)
    function code(x_m)
    	tmp = 0.0
    	if (Float64(1.0 - Float64(x_m * x_m)) <= -500.0)
    		tmp = fma(x_m, Float64(x_m * fma(Float64(x_m * x_m), 0.5, 1.0)), 1.0);
    	else
    		tmp = Float64(1.0 / Float64(exp(1) / fma(x_m, x_m, 1.0)));
    	end
    	return tmp
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    code[x$95$m_] := If[LessEqual[N[(1.0 - N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision], -500.0], N[(x$95$m * N[(x$95$m * N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(1.0 / N[(E / N[(x$95$m * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    x_m = \left|x\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\
    \;\;\;\;\mathsf{fma}\left(x\_m, x\_m \cdot \mathsf{fma}\left(x\_m \cdot x\_m, 0.5, 1\right), 1\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{1}{\frac{e}{\mathsf{fma}\left(x\_m, x\_m, 1\right)}}\\
    
    
    \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 99.9%

        \[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-*.f6499.3

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

        \[\leadsto e^{\color{blue}{x \cdot x}} \]
      6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{2}, 1\right), 1\right) \]
        10. lower-*.f6471.8

          \[\leadsto \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(\color{blue}{x \cdot x}, 0.5, 1\right), 1\right) \]
      8. Applied rewrites71.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x \cdot x, 0.5, 1\right), 1\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. Step-by-step derivation
        1. lift-*.f64N/A

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

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

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

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

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

          \[\leadsto \color{blue}{e^{-1} \cdot e^{x \cdot x}} \]
        7. metadata-evalN/A

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

          \[\leadsto \color{blue}{\frac{1}{e^{1}}} \cdot e^{x \cdot x} \]
        9. associate-/r/N/A

          \[\leadsto \color{blue}{\frac{1}{\frac{e^{1}}{e^{x \cdot x}}}} \]
        10. clear-numN/A

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

          \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e^{1}}} \]
        12. lower-exp.f64N/A

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

          \[\leadsto \frac{e^{x \cdot x}}{\color{blue}{\mathsf{E}\left(\right)}} \]
        14. lower-E.f64100.0

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

        \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e}} \]
      5. Taylor expanded in x around 0

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

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

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

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

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

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

          \[\leadsto e^{-1} + {x}^{2} \cdot \frac{1}{\color{blue}{e^{1}}} \]
        7. rec-expN/A

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

          \[\leadsto e^{-1} + {x}^{2} \cdot e^{\color{blue}{-1}} \]
        9. distribute-rgt1-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, x, 1\right)}}{\mathsf{E}\left(\right)} \]
        2. lift-E.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(x, x, 1\right)}{\color{blue}{\mathsf{E}\left(\right)}} \]
        3. clear-numN/A

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

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

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

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

    Alternative 16: 88.1% accurate, 3.0× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\ \;\;\;\;\mathsf{fma}\left(x\_m, x\_m \cdot \mathsf{fma}\left(x\_m \cdot x\_m, 0.5, 1\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x\_m, x\_m, 1\right)}{e}\\ \end{array} \end{array} \]
    x_m = (fabs.f64 x)
    (FPCore (x_m)
     :precision binary64
     (if (<= (- 1.0 (* x_m x_m)) -500.0)
       (fma x_m (* x_m (fma (* x_m x_m) 0.5 1.0)) 1.0)
       (/ (fma x_m x_m 1.0) E)))
    x_m = fabs(x);
    double code(double x_m) {
    	double tmp;
    	if ((1.0 - (x_m * x_m)) <= -500.0) {
    		tmp = fma(x_m, (x_m * fma((x_m * x_m), 0.5, 1.0)), 1.0);
    	} else {
    		tmp = fma(x_m, x_m, 1.0) / ((double) M_E);
    	}
    	return tmp;
    }
    
    x_m = abs(x)
    function code(x_m)
    	tmp = 0.0
    	if (Float64(1.0 - Float64(x_m * x_m)) <= -500.0)
    		tmp = fma(x_m, Float64(x_m * fma(Float64(x_m * x_m), 0.5, 1.0)), 1.0);
    	else
    		tmp = Float64(fma(x_m, x_m, 1.0) / exp(1));
    	end
    	return tmp
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    code[x$95$m_] := If[LessEqual[N[(1.0 - N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision], -500.0], N[(x$95$m * N[(x$95$m * N[(N[(x$95$m * x$95$m), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(x$95$m * x$95$m + 1.0), $MachinePrecision] / E), $MachinePrecision]]
    
    \begin{array}{l}
    x_m = \left|x\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\
    \;\;\;\;\mathsf{fma}\left(x\_m, x\_m \cdot \mathsf{fma}\left(x\_m \cdot x\_m, 0.5, 1\right), 1\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(x\_m, x\_m, 1\right)}{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 99.9%

        \[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-*.f6499.3

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

        \[\leadsto e^{\color{blue}{x \cdot x}} \]
      6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{2}, 1\right), 1\right) \]
        10. lower-*.f6471.8

          \[\leadsto \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(\color{blue}{x \cdot x}, 0.5, 1\right), 1\right) \]
      8. Applied rewrites71.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x \cdot x, 0.5, 1\right), 1\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. Step-by-step derivation
        1. lift-*.f64N/A

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

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

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

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

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

          \[\leadsto \color{blue}{e^{-1} \cdot e^{x \cdot x}} \]
        7. metadata-evalN/A

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

          \[\leadsto \color{blue}{\frac{1}{e^{1}}} \cdot e^{x \cdot x} \]
        9. associate-/r/N/A

          \[\leadsto \color{blue}{\frac{1}{\frac{e^{1}}{e^{x \cdot x}}}} \]
        10. clear-numN/A

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

          \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e^{1}}} \]
        12. lower-exp.f64N/A

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

          \[\leadsto \frac{e^{x \cdot x}}{\color{blue}{\mathsf{E}\left(\right)}} \]
        14. lower-E.f64100.0

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

        \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e}} \]
      5. Taylor expanded in x around 0

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

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

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

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

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

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

          \[\leadsto e^{-1} + {x}^{2} \cdot \frac{1}{\color{blue}{e^{1}}} \]
        7. rec-expN/A

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

          \[\leadsto e^{-1} + {x}^{2} \cdot e^{\color{blue}{-1}} \]
        9. distribute-rgt1-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 17: 88.1% accurate, 3.1× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\ \;\;\;\;x\_m \cdot \mathsf{fma}\left(x\_m, x\_m \cdot \left(x\_m \cdot 0.5\right), x\_m\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x\_m, x\_m, 1\right)}{e}\\ \end{array} \end{array} \]
    x_m = (fabs.f64 x)
    (FPCore (x_m)
     :precision binary64
     (if (<= (- 1.0 (* x_m x_m)) -500.0)
       (* x_m (fma x_m (* x_m (* x_m 0.5)) x_m))
       (/ (fma x_m x_m 1.0) E)))
    x_m = fabs(x);
    double code(double x_m) {
    	double tmp;
    	if ((1.0 - (x_m * x_m)) <= -500.0) {
    		tmp = x_m * fma(x_m, (x_m * (x_m * 0.5)), x_m);
    	} else {
    		tmp = fma(x_m, x_m, 1.0) / ((double) M_E);
    	}
    	return tmp;
    }
    
    x_m = abs(x)
    function code(x_m)
    	tmp = 0.0
    	if (Float64(1.0 - Float64(x_m * x_m)) <= -500.0)
    		tmp = Float64(x_m * fma(x_m, Float64(x_m * Float64(x_m * 0.5)), x_m));
    	else
    		tmp = Float64(fma(x_m, x_m, 1.0) / exp(1));
    	end
    	return tmp
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    code[x$95$m_] := If[LessEqual[N[(1.0 - N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision], -500.0], N[(x$95$m * N[(x$95$m * N[(x$95$m * N[(x$95$m * 0.5), $MachinePrecision]), $MachinePrecision] + x$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * x$95$m + 1.0), $MachinePrecision] / E), $MachinePrecision]]
    
    \begin{array}{l}
    x_m = \left|x\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\
    \;\;\;\;x\_m \cdot \mathsf{fma}\left(x\_m, x\_m \cdot \left(x\_m \cdot 0.5\right), x\_m\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(x\_m, x\_m, 1\right)}{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 99.9%

        \[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-*.f6499.3

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

        \[\leadsto e^{\color{blue}{x \cdot x}} \]
      6. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{2}, 1\right), 1\right) \]
        10. lower-*.f6471.8

          \[\leadsto \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(\color{blue}{x \cdot x}, 0.5, 1\right), 1\right) \]
      8. Applied rewrites71.8%

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

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

          \[\leadsto \color{blue}{\frac{1}{2} \cdot {x}^{4} + \frac{1}{{x}^{2}} \cdot {x}^{4}} \]
        2. +-commutativeN/A

          \[\leadsto \color{blue}{\frac{1}{{x}^{2}} \cdot {x}^{4} + \frac{1}{2} \cdot {x}^{4}} \]
        3. associate-*l/N/A

          \[\leadsto \color{blue}{\frac{1 \cdot {x}^{4}}{{x}^{2}}} + \frac{1}{2} \cdot {x}^{4} \]
        4. *-lft-identityN/A

          \[\leadsto \frac{\color{blue}{{x}^{4}}}{{x}^{2}} + \frac{1}{2} \cdot {x}^{4} \]
        5. metadata-evalN/A

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

          \[\leadsto \frac{\color{blue}{{x}^{3} \cdot x}}{{x}^{2}} + \frac{1}{2} \cdot {x}^{4} \]
        7. associate-*l/N/A

          \[\leadsto \color{blue}{\frac{{x}^{3}}{{x}^{2}} \cdot x} + \frac{1}{2} \cdot {x}^{4} \]
        8. *-lft-identityN/A

          \[\leadsto \frac{\color{blue}{1 \cdot {x}^{3}}}{{x}^{2}} \cdot x + \frac{1}{2} \cdot {x}^{4} \]
        9. associate-*l/N/A

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

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

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

          \[\leadsto \color{blue}{\left(\left(\frac{1}{{x}^{2}} \cdot {x}^{2}\right) \cdot x\right)} \cdot x + \frac{1}{2} \cdot {x}^{4} \]
        13. lft-mult-inverseN/A

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

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

          \[\leadsto 1 \cdot \color{blue}{{x}^{2}} + \frac{1}{2} \cdot {x}^{4} \]
        16. metadata-evalN/A

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

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

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

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

          \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot \left(1 + \frac{1}{2} \cdot {x}^{2}\right) \]
      11. Applied rewrites71.8%

        \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(x, x \cdot \left(x \cdot 0.5\right), 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. Step-by-step derivation
        1. lift-*.f64N/A

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

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

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

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

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

          \[\leadsto \color{blue}{e^{-1} \cdot e^{x \cdot x}} \]
        7. metadata-evalN/A

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

          \[\leadsto \color{blue}{\frac{1}{e^{1}}} \cdot e^{x \cdot x} \]
        9. associate-/r/N/A

          \[\leadsto \color{blue}{\frac{1}{\frac{e^{1}}{e^{x \cdot x}}}} \]
        10. clear-numN/A

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

          \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e^{1}}} \]
        12. lower-exp.f64N/A

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

          \[\leadsto \frac{e^{x \cdot x}}{\color{blue}{\mathsf{E}\left(\right)}} \]
        14. lower-E.f64100.0

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

        \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e}} \]
      5. Taylor expanded in x around 0

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

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

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

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

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

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

          \[\leadsto e^{-1} + {x}^{2} \cdot \frac{1}{\color{blue}{e^{1}}} \]
        7. rec-expN/A

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

          \[\leadsto e^{-1} + {x}^{2} \cdot e^{\color{blue}{-1}} \]
        9. distribute-rgt1-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 18: 76.0% accurate, 4.8× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;x\_m \cdot x\_m \leq 10^{-6}:\\ \;\;\;\;\frac{1}{e}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x\_m, x\_m, 1\right)\\ \end{array} \end{array} \]
    x_m = (fabs.f64 x)
    (FPCore (x_m)
     :precision binary64
     (if (<= (* x_m x_m) 1e-6) (/ 1.0 E) (fma x_m x_m 1.0)))
    x_m = fabs(x);
    double code(double x_m) {
    	double tmp;
    	if ((x_m * x_m) <= 1e-6) {
    		tmp = 1.0 / ((double) M_E);
    	} else {
    		tmp = fma(x_m, x_m, 1.0);
    	}
    	return tmp;
    }
    
    x_m = abs(x)
    function code(x_m)
    	tmp = 0.0
    	if (Float64(x_m * x_m) <= 1e-6)
    		tmp = Float64(1.0 / exp(1));
    	else
    		tmp = fma(x_m, x_m, 1.0);
    	end
    	return tmp
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    code[x$95$m_] := If[LessEqual[N[(x$95$m * x$95$m), $MachinePrecision], 1e-6], N[(1.0 / E), $MachinePrecision], N[(x$95$m * x$95$m + 1.0), $MachinePrecision]]
    
    \begin{array}{l}
    x_m = \left|x\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x\_m \cdot x\_m \leq 10^{-6}:\\
    \;\;\;\;\frac{1}{e}\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(x\_m, x\_m, 1\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 x x) < 9.99999999999999955e-7

      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.f6499.3

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

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

      if 9.99999999999999955e-7 < (*.f64 x x)

      1. Initial program 99.9%

        \[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-*.f6499.3

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

        \[\leadsto e^{\color{blue}{x \cdot x}} \]
      6. Taylor expanded in x around 0

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

          \[\leadsto \color{blue}{{x}^{2} + 1} \]
        2. unpow2N/A

          \[\leadsto \color{blue}{x \cdot x} + 1 \]
        3. lower-fma.f6447.2

          \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, 1\right)} \]
      8. Applied rewrites47.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, 1\right)} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 19: 35.1% accurate, 5.5× speedup?

    \[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\ \;\;\;\;x\_m \cdot x\_m\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
    x_m = (fabs.f64 x)
    (FPCore (x_m)
     :precision binary64
     (if (<= (- 1.0 (* x_m x_m)) -500.0) (* x_m x_m) 1.0))
    x_m = fabs(x);
    double code(double x_m) {
    	double tmp;
    	if ((1.0 - (x_m * x_m)) <= -500.0) {
    		tmp = x_m * x_m;
    	} else {
    		tmp = 1.0;
    	}
    	return tmp;
    }
    
    x_m = abs(x)
    real(8) function code(x_m)
        real(8), intent (in) :: x_m
        real(8) :: tmp
        if ((1.0d0 - (x_m * x_m)) <= (-500.0d0)) then
            tmp = x_m * x_m
        else
            tmp = 1.0d0
        end if
        code = tmp
    end function
    
    x_m = Math.abs(x);
    public static double code(double x_m) {
    	double tmp;
    	if ((1.0 - (x_m * x_m)) <= -500.0) {
    		tmp = x_m * x_m;
    	} else {
    		tmp = 1.0;
    	}
    	return tmp;
    }
    
    x_m = math.fabs(x)
    def code(x_m):
    	tmp = 0
    	if (1.0 - (x_m * x_m)) <= -500.0:
    		tmp = x_m * x_m
    	else:
    		tmp = 1.0
    	return tmp
    
    x_m = abs(x)
    function code(x_m)
    	tmp = 0.0
    	if (Float64(1.0 - Float64(x_m * x_m)) <= -500.0)
    		tmp = Float64(x_m * x_m);
    	else
    		tmp = 1.0;
    	end
    	return tmp
    end
    
    x_m = abs(x);
    function tmp_2 = code(x_m)
    	tmp = 0.0;
    	if ((1.0 - (x_m * x_m)) <= -500.0)
    		tmp = x_m * x_m;
    	else
    		tmp = 1.0;
    	end
    	tmp_2 = tmp;
    end
    
    x_m = N[Abs[x], $MachinePrecision]
    code[x$95$m_] := If[LessEqual[N[(1.0 - N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision], -500.0], N[(x$95$m * x$95$m), $MachinePrecision], 1.0]
    
    \begin{array}{l}
    x_m = \left|x\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;1 - x\_m \cdot x\_m \leq -500:\\
    \;\;\;\;x\_m \cdot x\_m\\
    
    \mathbf{else}:\\
    \;\;\;\;1\\
    
    
    \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 99.9%

        \[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-*.f6499.3

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

        \[\leadsto e^{\color{blue}{x \cdot x}} \]
      6. Taylor expanded in x around 0

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

          \[\leadsto \color{blue}{{x}^{2} + 1} \]
        2. unpow2N/A

          \[\leadsto \color{blue}{x \cdot x} + 1 \]
        3. lower-fma.f6447.2

          \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, 1\right)} \]
      8. Applied rewrites47.2%

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

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

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

          \[\leadsto \color{blue}{x \cdot x} \]
      11. Applied rewrites47.2%

        \[\leadsto \color{blue}{x \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 inf

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

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

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

        \[\leadsto e^{\color{blue}{x \cdot x}} \]
      6. Taylor expanded in x around 0

        \[\leadsto \color{blue}{1} \]
      7. Step-by-step derivation
        1. Applied rewrites17.8%

          \[\leadsto \color{blue}{1} \]
      8. Recombined 2 regimes into one program.
      9. Add Preprocessing

      Alternative 20: 76.3% accurate, 6.2× speedup?

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{e^{-1} \cdot e^{x \cdot x}} \]
        7. metadata-evalN/A

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

          \[\leadsto \color{blue}{\frac{1}{e^{1}}} \cdot e^{x \cdot x} \]
        9. associate-/r/N/A

          \[\leadsto \color{blue}{\frac{1}{\frac{e^{1}}{e^{x \cdot x}}}} \]
        10. clear-numN/A

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

          \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e^{1}}} \]
        12. lower-exp.f64N/A

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

          \[\leadsto \frac{e^{x \cdot x}}{\color{blue}{\mathsf{E}\left(\right)}} \]
        14. lower-E.f6499.9

          \[\leadsto \frac{e^{x \cdot x}}{\color{blue}{e}} \]
      4. Applied rewrites99.9%

        \[\leadsto \color{blue}{\frac{e^{x \cdot x}}{e}} \]
      5. Taylor expanded in x around 0

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

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

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

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

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

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

          \[\leadsto e^{-1} + {x}^{2} \cdot \frac{1}{\color{blue}{e^{1}}} \]
        7. rec-expN/A

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

          \[\leadsto e^{-1} + {x}^{2} \cdot e^{\color{blue}{-1}} \]
        9. distribute-rgt1-inN/A

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, x, 1\right)}}{\mathsf{E}\left(\right)} \]
        21. lower-E.f6474.4

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

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

      Alternative 21: 35.1% accurate, 15.9× speedup?

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

        \[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-*.f6457.3

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

        \[\leadsto e^{\color{blue}{x \cdot x}} \]
      6. Taylor expanded in x around 0

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

          \[\leadsto \color{blue}{{x}^{2} + 1} \]
        2. unpow2N/A

          \[\leadsto \color{blue}{x \cdot x} + 1 \]
        3. lower-fma.f6432.1

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

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

      Alternative 22: 10.5% accurate, 111.0× speedup?

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

        \[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-*.f6457.3

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

        \[\leadsto e^{\color{blue}{x \cdot x}} \]
      6. Taylor expanded in x around 0

        \[\leadsto \color{blue}{1} \]
      7. Step-by-step derivation
        1. Applied rewrites10.7%

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

        Reproduce

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