exp neg sub

Percentage Accurate: 100.0% → 100.0%
Time: 13.3s
Alternatives: 15
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 1.0× speedup?

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

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

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

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

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

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

      \[\leadsto e^{\color{blue}{x \cdot x + -1}} \]
    5. accelerator-lowering-fma.f64100.0

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

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

Alternative 2: 93.5% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;x \cdot x \leq 10^{+143}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), t\_0, 0\right) \cdot \left(x \cdot \left(x \cdot \frac{\mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right)}{e}\right)\right)}{t\_0}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x x) < 5.00000000000000018e-11

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{E}\left(\right)} \cdot \left(\color{blue}{x \cdot x} + 1\right) \]
      10. accelerator-lowering-fma.f64100.0

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

      \[\leadsto \color{blue}{\frac{1}{e} \cdot \mathsf{fma}\left(x, x, 1\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-inN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x, x, 0\right)}{e} + \frac{1}{\color{blue}{e}} \]
    7. Applied egg-rr100.0%

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

    if 5.00000000000000018e-11 < (*.f64 x x) < 1e143

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(x \cdot \left(x \cdot \left(x \cdot \frac{\mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right)}{e}\right)\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*N/A

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

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

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

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

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

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

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

        \[\leadsto \frac{\left({\left(x \cdot x\right)}^{3} + {0}^{3}\right) \cdot \left(x \cdot \left(x \cdot \frac{x \cdot \left(x \cdot \frac{1}{6}\right) + \frac{1}{2}}{\mathsf{E}\left(\right)}\right)\right)}{\left(x \cdot x + 0\right) \cdot \left(x \cdot x + 0\right) + \color{blue}{\left(\mathsf{neg}\left(\left(x \cdot x\right) \cdot 0\right)\right)}} \]
      9. mul0-rgtN/A

        \[\leadsto \frac{\left({\left(x \cdot x\right)}^{3} + {0}^{3}\right) \cdot \left(x \cdot \left(x \cdot \frac{x \cdot \left(x \cdot \frac{1}{6}\right) + \frac{1}{2}}{\mathsf{E}\left(\right)}\right)\right)}{\left(x \cdot x + 0\right) \cdot \left(x \cdot x + 0\right) + \left(\mathsf{neg}\left(\color{blue}{0}\right)\right)} \]
      10. sub-negN/A

        \[\leadsto \frac{\left({\left(x \cdot x\right)}^{3} + {0}^{3}\right) \cdot \left(x \cdot \left(x \cdot \frac{x \cdot \left(x \cdot \frac{1}{6}\right) + \frac{1}{2}}{\mathsf{E}\left(\right)}\right)\right)}{\color{blue}{\left(x \cdot x + 0\right) \cdot \left(x \cdot x + 0\right) - 0}} \]
      11. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left({\left(x \cdot x\right)}^{3} + {0}^{3}\right) \cdot \left(x \cdot \left(x \cdot \frac{x \cdot \left(x \cdot \frac{1}{6}\right) + \frac{1}{2}}{\mathsf{E}\left(\right)}\right)\right)}{\left(x \cdot x + 0\right) \cdot \left(x \cdot x + 0\right) - 0}} \]
    8. Applied egg-rr78.3%

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

    if 1e143 < (*.f64 x x)

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto x \cdot \left(x \cdot \left(x \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{x}{\mathsf{E}\left(\right)}\right)}\right)\right) \]
    8. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

        \[\leadsto x \cdot \left(x \cdot \left(x \cdot \frac{\color{blue}{x \cdot \frac{1}{2}}}{\mathsf{E}\left(\right)}\right)\right) \]
      5. E-lowering-E.f64100.0

        \[\leadsto x \cdot \left(x \cdot \left(x \cdot \frac{x \cdot 0.5}{\color{blue}{e}}\right)\right) \]
    9. Simplified100.0%

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

Alternative 3: 93.5% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;x \cdot x \leq 10^{+143}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), t\_0, 0\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), 0.16666666666666666, 0\right), 0\right)}{e \cdot t\_0}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x x) < 5.00000000000000018e-11

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{E}\left(\right)} \cdot \left(\color{blue}{x \cdot x} + 1\right) \]
      10. accelerator-lowering-fma.f64100.0

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

      \[\leadsto \color{blue}{\frac{1}{e} \cdot \mathsf{fma}\left(x, x, 1\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-inN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x, x, 0\right)}{e} + \frac{1}{\color{blue}{e}} \]
    7. Applied egg-rr100.0%

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

    if 5.00000000000000018e-11 < (*.f64 x x) < 1e143

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto x \cdot \left(x \cdot \color{blue}{\left(\frac{1}{6} \cdot \frac{{x}^{4}}{\mathsf{E}\left(\right)}\right)}\right) \]
    8. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(x \cdot \frac{x \cdot \left(\frac{1}{6} \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot x\right)\right)}{\mathsf{E}\left(\right)}\right) \]
      12. unpow3N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(x \cdot \frac{x \cdot \left(x \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot \frac{1}{6}\right)\right)}{\mathsf{E}\left(\right)}\right) \]
      22. *-lowering-*.f64N/A

        \[\leadsto x \cdot \left(x \cdot \frac{x \cdot \left(x \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot \frac{1}{6}\right)\right)}{\mathsf{E}\left(\right)}\right) \]
      23. E-lowering-E.f6445.2

        \[\leadsto x \cdot \left(x \cdot \frac{x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.16666666666666666\right)\right)}{\color{blue}{e}}\right) \]
    9. Simplified45.2%

      \[\leadsto x \cdot \left(x \cdot \color{blue}{\frac{x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.16666666666666666\right)\right)}{e}}\right) \]
    10. Applied egg-rr78.3%

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

    if 1e143 < (*.f64 x x)

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto x \cdot \left(x \cdot \left(x \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{x}{\mathsf{E}\left(\right)}\right)}\right)\right) \]
    8. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

        \[\leadsto x \cdot \left(x \cdot \left(x \cdot \frac{\color{blue}{x \cdot \frac{1}{2}}}{\mathsf{E}\left(\right)}\right)\right) \]
      5. E-lowering-E.f64100.0

        \[\leadsto x \cdot \left(x \cdot \left(x \cdot \frac{x \cdot 0.5}{\color{blue}{e}}\right)\right) \]
    9. Simplified100.0%

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

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

Alternative 4: 91.3% accurate, 2.0× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{E}\left(\right)} \cdot \left(\color{blue}{x \cdot x} + 1\right) \]
      10. accelerator-lowering-fma.f64100.0

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

      \[\leadsto \color{blue}{\frac{1}{e} \cdot \mathsf{fma}\left(x, x, 1\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-inN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x, x, 0\right)}{e} + \frac{1}{\color{blue}{e}} \]
    7. Applied egg-rr100.0%

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

    if 5.00000000000000018e-11 < (*.f64 x x)

    1. Initial program 100.0%

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

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

      \[\leadsto \color{blue}{\frac{1}{e} \cdot \mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), 0.16666666666666666, 0.5\right), 1\right), 1\right)} \]
    5. Step-by-step derivation
      1. flip-+N/A

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{E}\left(\right)} \cdot \mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{1}{6}, \frac{1}{2}\right), 1\right), 1\right) \]
      5. *-lowering-*.f6487.9

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

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

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

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

Alternative 5: 91.3% accurate, 2.1× speedup?

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{E}\left(\right)} \cdot \left(\color{blue}{x \cdot x} + 1\right) \]
      10. accelerator-lowering-fma.f64100.0

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

      \[\leadsto \color{blue}{\frac{1}{e} \cdot \mathsf{fma}\left(x, x, 1\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-inN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x, x, 0\right)}{e} + \frac{1}{\color{blue}{e}} \]
    7. Applied egg-rr100.0%

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

    if 5.00000000000000018e-11 < (*.f64 x x)

    1. Initial program 100.0%

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

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

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

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

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

Alternative 6: 91.3% accurate, 2.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot \left(x \cdot \left(x \cdot \left(x \cdot \frac{\left(x \cdot x\right) \cdot 0.16666666666666666}{e}\right)\right)\right)\\


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{E}\left(\right)} \cdot \left(\color{blue}{x \cdot x} + 1\right) \]
      10. accelerator-lowering-fma.f64100.0

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

      \[\leadsto \color{blue}{\frac{1}{e} \cdot \mathsf{fma}\left(x, x, 1\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-inN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x, x, 0\right)}{e} + \frac{1}{\color{blue}{e}} \]
    7. Applied egg-rr100.0%

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

    if 5.00000000000000018e-11 < (*.f64 x x)

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto x \cdot \left(x \cdot \left(x \cdot \left(x \cdot \color{blue}{\left(\frac{1}{6} \cdot \frac{{x}^{2}}{\mathsf{E}\left(\right)}\right)}\right)\right)\right) \]
    8. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

        \[\leadsto x \cdot \left(x \cdot \left(x \cdot \left(x \cdot \frac{\color{blue}{\left(x \cdot x\right)} \cdot \frac{1}{6}}{\mathsf{E}\left(\right)}\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto x \cdot \left(x \cdot \left(x \cdot \left(x \cdot \frac{\color{blue}{\left(x \cdot x\right)} \cdot \frac{1}{6}}{\mathsf{E}\left(\right)}\right)\right)\right) \]
      7. E-lowering-E.f6487.9

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

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

Alternative 7: 87.4% accurate, 2.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x, 0\right)}{e} + \frac{1}{e}\\


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

    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. *-lowering-*.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. Simplified79.1%

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

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

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

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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{E}\left(\right)} \cdot \left(\color{blue}{x \cdot x} + 1\right) \]
      10. accelerator-lowering-fma.f64100.0

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

      \[\leadsto \color{blue}{\frac{1}{e} \cdot \mathsf{fma}\left(x, x, 1\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-inN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x, x, 0\right)}{e} + \frac{1}{\color{blue}{e}} \]
    7. Applied egg-rr100.0%

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

Alternative 8: 87.4% accurate, 2.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, x, 0\right)}{e} + \frac{1}{e}\\


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

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto x \cdot \left(x \cdot \left(x \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{x}{\mathsf{E}\left(\right)}\right)}\right)\right) \]
    8. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

        \[\leadsto x \cdot \left(x \cdot \left(x \cdot \frac{\color{blue}{x \cdot \frac{1}{2}}}{\mathsf{E}\left(\right)}\right)\right) \]
      5. E-lowering-E.f6479.1

        \[\leadsto x \cdot \left(x \cdot \left(x \cdot \frac{x \cdot 0.5}{\color{blue}{e}}\right)\right) \]
    9. Simplified79.1%

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

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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{E}\left(\right)} \cdot \left(\color{blue}{x \cdot x} + 1\right) \]
      10. accelerator-lowering-fma.f64100.0

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

      \[\leadsto \color{blue}{\frac{1}{e} \cdot \mathsf{fma}\left(x, x, 1\right)} \]
    6. Step-by-step derivation
      1. distribute-lft-inN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(x, x, 0\right)}{e} + \frac{1}{\color{blue}{e}} \]
    7. Applied egg-rr100.0%

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

Alternative 9: 87.4% accurate, 2.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - x \cdot x\\ \mathbf{if}\;t\_0 \leq -100000:\\ \;\;\;\;x \cdot \left(x \cdot \left(x \cdot \frac{x \cdot 0.5}{e}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{e \cdot t\_0}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (- 1.0 (* x x))))
   (if (<= t_0 -100000.0)
     (* x (* x (* x (/ (* x 0.5) E))))
     (/ 1.0 (* E t_0)))))
double code(double x) {
	double t_0 = 1.0 - (x * x);
	double tmp;
	if (t_0 <= -100000.0) {
		tmp = x * (x * (x * ((x * 0.5) / ((double) M_E))));
	} else {
		tmp = 1.0 / (((double) M_E) * t_0);
	}
	return tmp;
}
public static double code(double x) {
	double t_0 = 1.0 - (x * x);
	double tmp;
	if (t_0 <= -100000.0) {
		tmp = x * (x * (x * ((x * 0.5) / Math.E)));
	} else {
		tmp = 1.0 / (Math.E * t_0);
	}
	return tmp;
}
def code(x):
	t_0 = 1.0 - (x * x)
	tmp = 0
	if t_0 <= -100000.0:
		tmp = x * (x * (x * ((x * 0.5) / math.e)))
	else:
		tmp = 1.0 / (math.e * t_0)
	return tmp
function code(x)
	t_0 = Float64(1.0 - Float64(x * x))
	tmp = 0.0
	if (t_0 <= -100000.0)
		tmp = Float64(x * Float64(x * Float64(x * Float64(Float64(x * 0.5) / exp(1)))));
	else
		tmp = Float64(1.0 / Float64(exp(1) * t_0));
	end
	return tmp
end
function tmp_2 = code(x)
	t_0 = 1.0 - (x * x);
	tmp = 0.0;
	if (t_0 <= -100000.0)
		tmp = x * (x * (x * ((x * 0.5) / 2.71828182845904523536)));
	else
		tmp = 1.0 / (2.71828182845904523536 * t_0);
	end
	tmp_2 = tmp;
end
code[x_] := Block[{t$95$0 = N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -100000.0], N[(x * N[(x * N[(x * N[(N[(x * 0.5), $MachinePrecision] / E), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(E * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 - x \cdot x\\
\mathbf{if}\;t\_0 \leq -100000:\\
\;\;\;\;x \cdot \left(x \cdot \left(x \cdot \frac{x \cdot 0.5}{e}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{e \cdot t\_0}\\


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

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto x \cdot \left(x \cdot \left(x \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{x}{\mathsf{E}\left(\right)}\right)}\right)\right) \]
    8. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

        \[\leadsto x \cdot \left(x \cdot \left(x \cdot \frac{\color{blue}{x \cdot \frac{1}{2}}}{\mathsf{E}\left(\right)}\right)\right) \]
      5. E-lowering-E.f6479.1

        \[\leadsto x \cdot \left(x \cdot \left(x \cdot \frac{x \cdot 0.5}{\color{blue}{e}}\right)\right) \]
    9. Simplified79.1%

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

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

    1. Initial program 100.0%

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

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

      \[\leadsto \color{blue}{\frac{1}{e} \cdot \mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), 0.16666666666666666, 0.5\right), 1\right), 1\right)} \]
    5. Step-by-step derivation
      1. associate-*l/N/A

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{\mathsf{E}\left(\right)}{\color{blue}{x \cdot \left(x \cdot \left(\left(x \cdot x + 0\right) \cdot \left(\left(x \cdot x + 0\right) \cdot \frac{1}{6} + \frac{1}{2}\right) + 1\right)\right)} + 1}} \]
    6. Applied egg-rr100.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\mathsf{E}\left(\right) \cdot \left(1 - \color{blue}{x \cdot x}\right)} \]
      11. *-lowering-*.f64100.0

        \[\leadsto \frac{1}{e \cdot \left(1 - \color{blue}{x \cdot x}\right)} \]
    9. Simplified100.0%

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

Alternative 10: 91.9% accurate, 2.5× speedup?

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

\\
\frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, x \cdot 0.16666666666666666, 0.5\right), 1\right), 1\right)}{e}
\end{array}
Derivation
  1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\left(x \cdot x + 0\right) \cdot \left(\left(x \cdot x + 0\right) \cdot \left(\left(x \cdot x + 0\right) \cdot \frac{1}{6} + \frac{1}{2}\right) + 1\right) + 1}{\mathsf{E}\left(\right)}} \]
  6. Applied egg-rr93.3%

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

Alternative 11: 87.5% accurate, 3.2× speedup?

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

\\
\frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), 0.5, 1\right), 1\right)}{e}
\end{array}
Derivation
  1. Initial program 100.0%

    \[e^{-\left(1 - x \cdot x\right)} \]
  2. Add Preprocessing
  3. 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. *-lowering-*.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. Simplified88.5%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(x \cdot x + 0\right) \cdot \left(x \cdot \left(x \cdot \frac{1}{2} + 0\right) + 1\right) + 1}{\mathsf{E}\left(\right)}} \]
  7. Applied egg-rr88.5%

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

Alternative 12: 75.5% accurate, 3.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;1 - x \cdot x \leq -100000:\\ \;\;\;\;x \cdot \frac{x}{e}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{e}\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (- 1.0 (* x x)) -100000.0) (* x (/ x E)) (/ 1.0 E)))
double code(double x) {
	double tmp;
	if ((1.0 - (x * x)) <= -100000.0) {
		tmp = x * (x / ((double) M_E));
	} else {
		tmp = 1.0 / ((double) M_E);
	}
	return tmp;
}
public static double code(double x) {
	double tmp;
	if ((1.0 - (x * x)) <= -100000.0) {
		tmp = x * (x / Math.E);
	} else {
		tmp = 1.0 / Math.E;
	}
	return tmp;
}
def code(x):
	tmp = 0
	if (1.0 - (x * x)) <= -100000.0:
		tmp = x * (x / math.e)
	else:
		tmp = 1.0 / math.e
	return tmp
function code(x)
	tmp = 0.0
	if (Float64(1.0 - Float64(x * x)) <= -100000.0)
		tmp = Float64(x * Float64(x / exp(1)));
	else
		tmp = Float64(1.0 / exp(1));
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if ((1.0 - (x * x)) <= -100000.0)
		tmp = x * (x / 2.71828182845904523536);
	else
		tmp = 1.0 / 2.71828182845904523536;
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision], -100000.0], N[(x * N[(x / E), $MachinePrecision]), $MachinePrecision], N[(1.0 / E), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;1 - x \cdot x \leq -100000:\\
\;\;\;\;x \cdot \frac{x}{e}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{e}\\


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

    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. *-lowering-*.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. Simplified79.1%

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

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

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

      \[\leadsto x \cdot \color{blue}{\frac{x}{\mathsf{E}\left(\right)}} \]
    9. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto x \cdot \color{blue}{\frac{x}{\mathsf{E}\left(\right)}} \]
      2. E-lowering-E.f6454.9

        \[\leadsto x \cdot \frac{x}{\color{blue}{e}} \]
    10. Simplified54.9%

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

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

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{\mathsf{E}\left(\right)}} \]
      5. E-lowering-E.f6499.3

        \[\leadsto \frac{1}{\color{blue}{e}} \]
    5. Simplified99.3%

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

Alternative 13: 75.9% accurate, 3.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{x \cdot x + 0}, \mathsf{E}\left(\right), \mathsf{E}\left(\right)\right)}{\mathsf{E}\left(\right) \cdot \mathsf{E}\left(\right)} \]
    10. accelerator-lowering-fma.f64N/A

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

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \color{blue}{\mathsf{E}\left(\right)}, \mathsf{E}\left(\right)\right)}{\mathsf{E}\left(\right) \cdot \mathsf{E}\left(\right)} \]
    12. E-lowering-E.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{E}\left(\right), \color{blue}{\mathsf{E}\left(\right)}\right)}{\mathsf{E}\left(\right) \cdot \mathsf{E}\left(\right)} \]
    13. *-lowering-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{E}\left(\right), \mathsf{E}\left(\right)\right)}{\color{blue}{\mathsf{E}\left(\right) \cdot \mathsf{E}\left(\right)}} \]
    14. E-lowering-E.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), \mathsf{E}\left(\right), \mathsf{E}\left(\right)\right)}{\color{blue}{\mathsf{E}\left(\right)} \cdot \mathsf{E}\left(\right)} \]
    15. E-lowering-E.f6475.3

      \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(x, x, 0\right), e, e\right)}{e \cdot \color{blue}{e}} \]
  7. Applied egg-rr75.3%

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

Alternative 14: 75.8% accurate, 6.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{e} \cdot \mathsf{fma}\left(x, x, 1\right)} \]
  6. Step-by-step derivation
    1. *-commutativeN/A

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

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

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

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, x, 1\right)}}{\mathsf{E}\left(\right)} \]
    5. E-lowering-E.f6475.3

      \[\leadsto \frac{\mathsf{fma}\left(x, x, 1\right)}{\color{blue}{e}} \]
  7. Applied egg-rr75.3%

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

Alternative 15: 51.5% accurate, 9.3× speedup?

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

\\
\frac{1}{e}
\end{array}
Derivation
  1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{\mathsf{E}\left(\right)}} \]
    5. E-lowering-E.f6446.7

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

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

Reproduce

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