exp neg sub

Percentage Accurate: 100.0% → 100.0%
Time: 12.1s
Alternatives: 24
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 24 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^{x \cdot x + -1} \end{array} \]
(FPCore (x) :precision binary64 (exp (+ (* x x) -1.0)))
double code(double x) {
	return exp(((x * x) + -1.0));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = exp(((x * x) + (-1.0d0)))
end function
public static double code(double x) {
	return Math.exp(((x * x) + -1.0));
}
def code(x):
	return math.exp(((x * x) + -1.0))
function code(x)
	return exp(Float64(Float64(x * x) + -1.0))
end
function tmp = code(x)
	tmp = exp(((x * x) + -1.0));
end
code[x_] := N[Exp[N[(N[(x * x), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
e^{x \cdot x + -1}
\end{array}
Derivation
  1. Initial program 100.0%

    \[e^{-\left(1 - x \cdot x\right)} \]
  2. Step-by-step derivation
    1. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
    2. neg-sub0N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
    3. associate--r-N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
    5. +-commutativeN/A

      \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
    6. +-lowering-+.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
    7. *-lowering-*.f64100.0%

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
  4. Add Preprocessing
  5. Add Preprocessing

Alternative 2: 99.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot x\right)\\
\mathbf{if}\;x \cdot x \leq 0.001:\\
\;\;\;\;\frac{1}{e} \cdot \left(1 + x \cdot \left(x \cdot \left(1 + x \cdot \frac{x \cdot \left(0.125 + \left(t\_0 \cdot t\_0\right) \cdot 0.004629629629629629\right)}{0.25 + x \cdot \left(x \cdot -0.08333333333333333\right)}\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;e^{x \cdot x}\\


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

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. 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)} \]
    6. Simplified99.9%

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\left(\left({\frac{1}{2}}^{3} + {\left(\left(x \cdot x\right) \cdot \frac{1}{6}\right)}^{3}\right) \cdot x\right), \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{2} + \left(\left(\left(x \cdot x\right) \cdot \frac{1}{6}\right) \cdot \left(\left(x \cdot x\right) \cdot \frac{1}{6}\right) - \frac{1}{2} \cdot \left(\left(x \cdot x\right) \cdot \frac{1}{6}\right)\right)\right)}\right)\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr99.9%

      \[\leadsto \frac{1}{e} \cdot \left(1 + x \cdot \left(x \cdot \left(1 + x \cdot \color{blue}{\frac{\left(0.125 + \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)\right) \cdot 0.004629629629629629\right) \cdot x}{0.25 + \left(x \cdot \left(x \cdot 0.16666666666666666\right)\right) \cdot \left(x \cdot \left(x \cdot 0.16666666666666666\right) - 0.5\right)}}\right)\right)\right) \]
    9. Taylor expanded in x around 0

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right), \frac{1}{216}\right)\right), x\right), \mathsf{+.f64}\left(\frac{1}{4}, \left(\frac{-1}{12} \cdot \left(x \cdot \color{blue}{x}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
      2. associate-*r*N/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right), \frac{1}{216}\right)\right), x\right), \mathsf{+.f64}\left(\frac{1}{4}, \left(x \cdot \color{blue}{\left(\frac{-1}{12} \cdot x\right)}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right), \frac{1}{216}\right)\right), x\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{-1}{12} \cdot x\right)}\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right), \frac{1}{216}\right)\right), x\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(x, \left(x \cdot \color{blue}{\frac{-1}{12}}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f6499.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(\frac{1}{8}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right), \frac{1}{216}\right)\right), x\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\frac{-1}{12}}\right)\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
    11. Simplified99.9%

      \[\leadsto \frac{1}{e} \cdot \left(1 + x \cdot \left(x \cdot \left(1 + x \cdot \frac{\left(0.125 + \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)\right) \cdot 0.004629629629629629\right) \cdot x}{0.25 + \color{blue}{x \cdot \left(x \cdot -0.08333333333333333\right)}}\right)\right)\right) \]

    if 1e-3 < (*.f64 x x)

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf

      \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left({x}^{2}\right)}\right) \]
    6. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x\right)\right) \]
      2. *-lowering-*.f6499.4%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(x, x\right)\right) \]
    7. Simplified99.4%

      \[\leadsto e^{\color{blue}{x \cdot x}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 0.001:\\ \;\;\;\;\frac{1}{e} \cdot \left(1 + x \cdot \left(x \cdot \left(1 + x \cdot \frac{x \cdot \left(0.125 + \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)\right) \cdot 0.004629629629629629\right)}{0.25 + x \cdot \left(x \cdot -0.08333333333333333\right)}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;e^{x \cdot x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 95.8% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\\
t_1 := x \cdot \left(x \cdot 0.16666666666666666\right)\\
\mathbf{if}\;x \cdot x \leq 4 \cdot 10^{+100}:\\
\;\;\;\;\frac{1}{e} \cdot \left(1 + x \cdot \left(x \cdot \left(1 + x \cdot \frac{\left(0.015625 - 2.143347050754458 \cdot 10^{-5} \cdot \left(t\_0 \cdot t\_0\right)\right) \cdot \frac{x}{0.25 + t\_1 \cdot \left(t\_1 + -0.5\right)}}{0.125 + t\_0 \cdot -0.004629629629629629}\right)\right)\right)\\

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


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

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. 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)} \]
    6. Simplified85.0%

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{/.f64}\left(\left(\left({\frac{1}{2}}^{3} + {\left(\left(x \cdot x\right) \cdot \frac{1}{6}\right)}^{3}\right) \cdot x\right), \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{2} + \left(\left(\left(x \cdot x\right) \cdot \frac{1}{6}\right) \cdot \left(\left(x \cdot x\right) \cdot \frac{1}{6}\right) - \frac{1}{2} \cdot \left(\left(x \cdot x\right) \cdot \frac{1}{6}\right)\right)\right)}\right)\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr87.5%

      \[\leadsto \frac{1}{e} \cdot \left(1 + x \cdot \left(x \cdot \left(1 + x \cdot \color{blue}{\frac{\left(0.125 + \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)\right) \cdot 0.004629629629629629\right) \cdot x}{0.25 + \left(x \cdot \left(x \cdot 0.16666666666666666\right)\right) \cdot \left(x \cdot \left(x \cdot 0.16666666666666666\right) - 0.5\right)}}\right)\right)\right) \]
    9. Applied egg-rr93.4%

      \[\leadsto \frac{1}{e} \cdot \left(1 + x \cdot \left(x \cdot \left(1 + x \cdot \color{blue}{\frac{\left(0.015625 - 2.143347050754458 \cdot 10^{-5} \cdot \left(\left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right)\right) \cdot \frac{x}{0.25 + \left(x \cdot \left(x \cdot 0.16666666666666666\right)\right) \cdot \left(x \cdot \left(x \cdot 0.16666666666666666\right) + -0.5\right)}}{0.125 + -0.004629629629629629 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)}}\right)\right)\right) \]

    if 4.00000000000000006e100 < (*.f64 x x)

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. 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)} \]
    6. Simplified99.2%

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

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

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

        \[\leadsto \frac{1}{6} \cdot \frac{{x}^{6} \cdot 1}{e^{1}} \]
      3. associate-*r/N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \color{blue}{\left({x}^{6} \cdot \frac{1}{\mathsf{E}\left(\right)}\right)}\right) \]
      6. exp-1-eN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \left({x}^{6} \cdot \frac{1}{e^{1}}\right)\right) \]
      7. associate-*r/N/A

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \left(\frac{{x}^{6}}{e^{\color{blue}{1}}}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \mathsf{/.f64}\left(\left({x}^{6}\right), \color{blue}{\left(e^{1}\right)}\right)\right) \]
    9. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 4 \cdot 10^{+100}:\\ \;\;\;\;\frac{1}{e} \cdot \left(1 + x \cdot \left(x \cdot \left(1 + x \cdot \frac{\left(0.015625 - 2.143347050754458 \cdot 10^{-5} \cdot \left(\left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right)\right) \cdot \frac{x}{0.25 + \left(x \cdot \left(x \cdot 0.16666666666666666\right)\right) \cdot \left(x \cdot \left(x \cdot 0.16666666666666666\right) + -0.5\right)}}{0.125 + \left(\left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right) \cdot -0.004629629629629629}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.16666666666666666 \cdot \frac{\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)}{e}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 95.7% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot \left(x \cdot \left(x \cdot 0.16666666666666666\right) + 0.5\right)\right)\\
t_1 := -1 - t\_0\\
\mathbf{if}\;x \cdot x \leq 4 \cdot 10^{+100}:\\
\;\;\;\;\frac{\frac{1}{e} \cdot \left(1 + \left(x \cdot x\right) \cdot \left(\left(\left(x \cdot x\right) \cdot \left(1 + t\_0\right)\right) \cdot t\_1\right)\right)}{1 + \left(x \cdot x\right) \cdot t\_1}\\

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


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

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. 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)} \]
    6. Simplified85.0%

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

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

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

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

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

    if 4.00000000000000006e100 < (*.f64 x x)

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. 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)} \]
    6. Simplified99.2%

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

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

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

        \[\leadsto \frac{1}{6} \cdot \frac{{x}^{6} \cdot 1}{e^{1}} \]
      3. associate-*r/N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \color{blue}{\left({x}^{6} \cdot \frac{1}{\mathsf{E}\left(\right)}\right)}\right) \]
      6. exp-1-eN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \left({x}^{6} \cdot \frac{1}{e^{1}}\right)\right) \]
      7. associate-*r/N/A

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \left(\frac{{x}^{6}}{e^{\color{blue}{1}}}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \mathsf{/.f64}\left(\left({x}^{6}\right), \color{blue}{\left(e^{1}\right)}\right)\right) \]
    9. Simplified100.0%

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

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

Alternative 5: 95.7% accurate, 1.6× speedup?

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

\\
\begin{array}{l}
t_0 := 1 + \left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot 0.16666666666666666\right) + 0.5\right)\\
t_1 := \left(x \cdot x\right) \cdot t\_0\\
\mathbf{if}\;x \cdot x \leq 4 \cdot 10^{+100}:\\
\;\;\;\;\frac{\frac{-1 + \left(x \cdot x\right) \cdot \left(t\_0 \cdot t\_1\right)}{-1 + t\_1}}{e}\\

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


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

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. 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)} \]
    6. Simplified85.0%

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

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

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

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

      \[\leadsto \color{blue}{\frac{1 + \left(x \cdot x\right) \cdot \left(1 + x \cdot \left(x \cdot \left(0.5 + x \cdot \left(x \cdot 0.16666666666666666\right)\right)\right)\right)}{e}} \]
    9. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(\left(x \cdot x\right) \cdot \left(1 + x \cdot \left(x \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{6}\right)\right)\right)\right) + 1\right), \mathsf{E.f64}\left(\right)\right) \]
      2. flip-+N/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\left(\left(x \cdot x\right) \cdot \left(1 + x \cdot \left(x \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{6}\right)\right)\right)\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \left(1 + x \cdot \left(x \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{6}\right)\right)\right)\right)\right) - 1 \cdot 1\right), \left(\left(x \cdot x\right) \cdot \left(1 + x \cdot \left(x \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{6}\right)\right)\right)\right) - 1\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    10. Applied egg-rr93.3%

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

    if 4.00000000000000006e100 < (*.f64 x x)

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. 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)} \]
    6. Simplified99.2%

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

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

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

        \[\leadsto \frac{1}{6} \cdot \frac{{x}^{6} \cdot 1}{e^{1}} \]
      3. associate-*r/N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \color{blue}{\left({x}^{6} \cdot \frac{1}{\mathsf{E}\left(\right)}\right)}\right) \]
      6. exp-1-eN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \left({x}^{6} \cdot \frac{1}{e^{1}}\right)\right) \]
      7. associate-*r/N/A

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \left(\frac{{x}^{6}}{e^{\color{blue}{1}}}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \mathsf{/.f64}\left(\left({x}^{6}\right), \color{blue}{\left(e^{1}\right)}\right)\right) \]
    9. Simplified100.0%

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

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

Alternative 6: 95.2% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot 0.16666666666666666\right) + 0.5\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+153}:\\
\;\;\;\;\frac{1 + \frac{\left(x \cdot x\right) \cdot \left(1 - t\_0 \cdot \left(\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right) \cdot t\_0\right)\right)}{1 - \left(x \cdot x\right) \cdot t\_0}}{e}\\

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


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

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. 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)} \]
    6. Simplified85.6%

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 + x \cdot \left(x \cdot \left(1 + x \cdot \left(x \cdot \left(\frac{1}{2} + \left(x \cdot x\right) \cdot \frac{1}{6}\right)\right)\right)\right)\right), \color{blue}{\mathsf{E}\left(\right)}\right) \]
    8. Applied egg-rr85.6%

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\left(1 + x \cdot \left(x \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{6}\right)\right)\right)\right) \cdot \left(x \cdot x\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
      2. flip-+N/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\left(\left(1 \cdot 1 - \left(x \cdot \left(x \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{6}\right)\right)\right)\right) \cdot \left(x \cdot \left(x \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{6}\right)\right)\right)\right)\right) \cdot \left(x \cdot x\right)\right), \left(1 - x \cdot \left(x \cdot \left(\frac{1}{2} + x \cdot \left(x \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    10. Applied egg-rr91.4%

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

    if 5.00000000000000018e153 < (*.f64 x x)

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

        \[\leadsto e^{-1} + \left({x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2} + 1\right)\right) \cdot \color{blue}{e^{-1}} \]
      4. *-lft-identityN/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 e^{-1} \cdot \color{blue}{\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 \left(1 + \color{blue}{\frac{1}{2} \cdot {x}^{2}}\right)\right) \]
      7. distribute-lft-inN/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(e^{-1}\right), \color{blue}{\left(\left({x}^{2} + 1\right) + {x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2}\right)\right)}\right) \]
    7. Simplified100.0%

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{{x}^{4}}{\mathsf{E}\left(\right)}} \]
    9. Step-by-step derivation
      1. exp-1-eN/A

        \[\leadsto \frac{1}{2} \cdot \frac{{x}^{4}}{e^{1}} \]
      2. associate-*r/N/A

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

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

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

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

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

        \[\leadsto \frac{{x}^{2} \cdot \frac{1}{2}}{e^{1}} \cdot {x}^{2} \]
      8. associate-*r/N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \color{blue}{\left(\frac{1}{\mathsf{E}\left(\right)} \cdot {x}^{2}\right)}\right)\right) \]
      18. exp-1-eN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \left(\frac{1}{e^{1}} \cdot {x}^{2}\right)\right)\right) \]
      19. associate-*l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \frac{1 \cdot {x}^{2}}{\color{blue}{e^{1}}}\right)\right) \]
      20. *-lft-identityN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \frac{{x}^{2}}{\mathsf{E}\left(\right)}\right)\right) \]
    10. Simplified100.0%

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

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

Alternative 7: 93.9% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot x\right)\\
t_1 := x \cdot \left(x \cdot 0.16666666666666666\right)\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+153}:\\
\;\;\;\;\frac{1}{e} \cdot \left(1 + x \cdot \left(x \cdot \left(1 + \frac{\left(x \cdot x\right) \cdot \left(0.125 + \left(t\_0 \cdot t\_0\right) \cdot 0.004629629629629629\right)}{0.25 + t\_1 \cdot \left(t\_1 - 0.5\right)}\right)\right)\right)\\

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


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

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. 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)} \]
    6. Simplified85.6%

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

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

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

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

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

      \[\leadsto \frac{1}{e} \cdot \left(1 + x \cdot \left(x \cdot \left(1 + \color{blue}{\frac{\left(x \cdot x\right) \cdot \left(0.125 + \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)\right) \cdot 0.004629629629629629\right)}{0.25 + \left(x \cdot \left(x \cdot 0.16666666666666666\right)\right) \cdot \left(x \cdot \left(x \cdot 0.16666666666666666\right) - 0.5\right)}}\right)\right)\right) \]

    if 5.00000000000000018e153 < (*.f64 x x)

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

        \[\leadsto e^{-1} + \left({x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2} + 1\right)\right) \cdot \color{blue}{e^{-1}} \]
      4. *-lft-identityN/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 e^{-1} \cdot \color{blue}{\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 \left(1 + \color{blue}{\frac{1}{2} \cdot {x}^{2}}\right)\right) \]
      7. distribute-lft-inN/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(e^{-1}\right), \color{blue}{\left(\left({x}^{2} + 1\right) + {x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2}\right)\right)}\right) \]
    7. Simplified100.0%

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{{x}^{4}}{\mathsf{E}\left(\right)}} \]
    9. Step-by-step derivation
      1. exp-1-eN/A

        \[\leadsto \frac{1}{2} \cdot \frac{{x}^{4}}{e^{1}} \]
      2. associate-*r/N/A

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

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

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

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

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

        \[\leadsto \frac{{x}^{2} \cdot \frac{1}{2}}{e^{1}} \cdot {x}^{2} \]
      8. associate-*r/N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \color{blue}{\left(\frac{1}{\mathsf{E}\left(\right)} \cdot {x}^{2}\right)}\right)\right) \]
      18. exp-1-eN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \left(\frac{1}{e^{1}} \cdot {x}^{2}\right)\right)\right) \]
      19. associate-*l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \frac{1 \cdot {x}^{2}}{\color{blue}{e^{1}}}\right)\right) \]
      20. *-lft-identityN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \frac{{x}^{2}}{\mathsf{E}\left(\right)}\right)\right) \]
    10. Simplified100.0%

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

Alternative 8: 93.9% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot 0.16666666666666666\right)\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+153}:\\
\;\;\;\;\frac{1 + \left(x \cdot x\right) \cdot \left(1 + \frac{x \cdot \left(x \cdot \left(0.125 + \left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.004629629629629629\right)\right)\right)\right)\right)}{0.25 + t\_0 \cdot \left(t\_0 + -0.5\right)}\right)}{e}\\

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


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

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. 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)} \]
    6. Simplified85.6%

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(1 + x \cdot \left(x \cdot \left(1 + x \cdot \left(x \cdot \left(\frac{1}{2} + \left(x \cdot x\right) \cdot \frac{1}{6}\right)\right)\right)\right)\right), \color{blue}{\mathsf{E}\left(\right)}\right) \]
    8. Applied egg-rr85.6%

      \[\leadsto \color{blue}{\frac{1 + \left(x \cdot x\right) \cdot \left(1 + x \cdot \left(x \cdot \left(0.5 + x \cdot \left(x \cdot 0.16666666666666666\right)\right)\right)\right)}{e}} \]
    9. Applied egg-rr89.0%

      \[\leadsto \frac{1 + \left(x \cdot x\right) \cdot \left(1 + \color{blue}{\frac{x \cdot \left(x \cdot \left(0.125 + \left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot 0.004629629629629629\right)\right)\right)\right)\right)}{0.25 + \left(x \cdot \left(x \cdot 0.16666666666666666\right)\right) \cdot \left(x \cdot \left(x \cdot 0.16666666666666666\right) + -0.5\right)}}\right)}{e} \]

    if 5.00000000000000018e153 < (*.f64 x x)

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

        \[\leadsto e^{-1} + \left({x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2} + 1\right)\right) \cdot \color{blue}{e^{-1}} \]
      4. *-lft-identityN/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 e^{-1} \cdot \color{blue}{\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 \left(1 + \color{blue}{\frac{1}{2} \cdot {x}^{2}}\right)\right) \]
      7. distribute-lft-inN/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(e^{-1}\right), \color{blue}{\left(\left({x}^{2} + 1\right) + {x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2}\right)\right)}\right) \]
    7. Simplified100.0%

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{{x}^{4}}{\mathsf{E}\left(\right)}} \]
    9. Step-by-step derivation
      1. exp-1-eN/A

        \[\leadsto \frac{1}{2} \cdot \frac{{x}^{4}}{e^{1}} \]
      2. associate-*r/N/A

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

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

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

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

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

        \[\leadsto \frac{{x}^{2} \cdot \frac{1}{2}}{e^{1}} \cdot {x}^{2} \]
      8. associate-*r/N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \color{blue}{\left(\frac{1}{\mathsf{E}\left(\right)} \cdot {x}^{2}\right)}\right)\right) \]
      18. exp-1-eN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \left(\frac{1}{e^{1}} \cdot {x}^{2}\right)\right)\right) \]
      19. associate-*l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \frac{1 \cdot {x}^{2}}{\color{blue}{e^{1}}}\right)\right) \]
      20. *-lft-identityN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \frac{{x}^{2}}{\mathsf{E}\left(\right)}\right)\right) \]
    10. Simplified100.0%

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

Alternative 9: 93.8% accurate, 2.2× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot x\right)\\
t_1 := \frac{x \cdot x}{2}\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+153}:\\
\;\;\;\;\frac{1}{e} \cdot \left(1 + \frac{\left(x \cdot x\right) \cdot \left(1 + \frac{t\_0 \cdot t\_0}{8}\right)}{1 + t\_1 \cdot \left(-1 + t\_1\right)}\right)\\

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


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

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

        \[\leadsto e^{-1} + \left({x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2} + 1\right)\right) \cdot \color{blue}{e^{-1}} \]
      4. *-lft-identityN/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 e^{-1} \cdot \color{blue}{\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 \left(1 + \color{blue}{\frac{1}{2} \cdot {x}^{2}}\right)\right) \]
      7. distribute-lft-inN/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(e^{-1}\right), \color{blue}{\left(\left({x}^{2} + 1\right) + {x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2}\right)\right)}\right) \]
    7. Simplified78.7%

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\left(\left(x \cdot x\right) \cdot \left({1}^{3} + {\left(\left(x \cdot x\right) \cdot \frac{1}{2}\right)}^{3}\right)\right), \color{blue}{\left(1 \cdot 1 + \left(\left(\left(x \cdot x\right) \cdot \frac{1}{2}\right) \cdot \left(\left(x \cdot x\right) \cdot \frac{1}{2}\right) - 1 \cdot \left(\left(x \cdot x\right) \cdot \frac{1}{2}\right)\right)\right)}\right)\right)\right) \]
    9. Applied egg-rr88.7%

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

    if 5.00000000000000018e153 < (*.f64 x x)

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

        \[\leadsto e^{-1} + \left({x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2} + 1\right)\right) \cdot \color{blue}{e^{-1}} \]
      4. *-lft-identityN/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 e^{-1} \cdot \color{blue}{\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 \left(1 + \color{blue}{\frac{1}{2} \cdot {x}^{2}}\right)\right) \]
      7. distribute-lft-inN/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(e^{-1}\right), \color{blue}{\left(\left({x}^{2} + 1\right) + {x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2}\right)\right)}\right) \]
    7. Simplified100.0%

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{{x}^{4}}{\mathsf{E}\left(\right)}} \]
    9. Step-by-step derivation
      1. exp-1-eN/A

        \[\leadsto \frac{1}{2} \cdot \frac{{x}^{4}}{e^{1}} \]
      2. associate-*r/N/A

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

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

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

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

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

        \[\leadsto \frac{{x}^{2} \cdot \frac{1}{2}}{e^{1}} \cdot {x}^{2} \]
      8. associate-*r/N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \color{blue}{\left(\frac{1}{\mathsf{E}\left(\right)} \cdot {x}^{2}\right)}\right)\right) \]
      18. exp-1-eN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \left(\frac{1}{e^{1}} \cdot {x}^{2}\right)\right)\right) \]
      19. associate-*l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \frac{1 \cdot {x}^{2}}{\color{blue}{e^{1}}}\right)\right) \]
      20. *-lft-identityN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \frac{{x}^{2}}{\mathsf{E}\left(\right)}\right)\right) \]
    10. Simplified100.0%

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

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

Alternative 10: 92.0% accurate, 4.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 0.001:\\
\;\;\;\;\frac{1}{e} + \frac{x \cdot x}{e} \cdot \left(1 + \frac{x \cdot x}{2}\right)\\

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


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

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

        \[\leadsto e^{-1} + \left({x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2} + 1\right)\right) \cdot \color{blue}{e^{-1}} \]
      4. *-lft-identityN/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 e^{-1} \cdot \color{blue}{\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 \left(1 + \color{blue}{\frac{1}{2} \cdot {x}^{2}}\right)\right) \]
      7. distribute-lft-inN/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(e^{-1}\right), \color{blue}{\left(\left({x}^{2} + 1\right) + {x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2}\right)\right)}\right) \]
    7. Simplified99.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{E}\left(\right)\right), \left(1 + \left(x \cdot x\right) \cdot \frac{1}{2}\right)\right)\right) \]
      13. E-lowering-E.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{E.f64}\left(\right)\right), \left(1 + \left(x \cdot x\right) \cdot \frac{1}{2}\right)\right)\right) \]
      14. +-lowering-+.f64N/A

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

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\left(x \cdot x\right), \color{blue}{2}\right)\right)\right)\right) \]
      20. *-lowering-*.f6499.6%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{*.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), 2\right)\right)\right)\right) \]
    9. Applied egg-rr99.6%

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

    if 1e-3 < (*.f64 x x)

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. 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)} \]
    6. Simplified83.3%

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

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

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

        \[\leadsto \frac{1}{6} \cdot \frac{{x}^{6} \cdot 1}{e^{1}} \]
      3. associate-*r/N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \color{blue}{\left({x}^{6} \cdot \frac{1}{\mathsf{E}\left(\right)}\right)}\right) \]
      6. exp-1-eN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \left({x}^{6} \cdot \frac{1}{e^{1}}\right)\right) \]
      7. associate-*r/N/A

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \left(\frac{{x}^{6}}{e^{\color{blue}{1}}}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \mathsf{/.f64}\left(\left({x}^{6}\right), \color{blue}{\left(e^{1}\right)}\right)\right) \]
    9. Simplified83.9%

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

Alternative 11: 92.0% accurate, 4.4× speedup?

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

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

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


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

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

        \[\leadsto e^{-1} + \left({x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2} + 1\right)\right) \cdot \color{blue}{e^{-1}} \]
      4. *-lft-identityN/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 e^{-1} \cdot \color{blue}{\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 \left(1 + \color{blue}{\frac{1}{2} \cdot {x}^{2}}\right)\right) \]
      7. distribute-lft-inN/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(e^{-1}\right), \color{blue}{\left(\left({x}^{2} + 1\right) + {x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2}\right)\right)}\right) \]
    7. Simplified99.6%

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

    if 1e-3 < (*.f64 x x)

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. 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)} \]
    6. Simplified83.3%

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

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

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

        \[\leadsto \frac{1}{6} \cdot \frac{{x}^{6} \cdot 1}{e^{1}} \]
      3. associate-*r/N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \color{blue}{\left({x}^{6} \cdot \frac{1}{\mathsf{E}\left(\right)}\right)}\right) \]
      6. exp-1-eN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \left({x}^{6} \cdot \frac{1}{e^{1}}\right)\right) \]
      7. associate-*r/N/A

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \left(\frac{{x}^{6}}{e^{\color{blue}{1}}}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \mathsf{/.f64}\left(\left({x}^{6}\right), \color{blue}{\left(e^{1}\right)}\right)\right) \]
    9. Simplified83.9%

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

Alternative 12: 92.1% accurate, 4.6× speedup?

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

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

    \[e^{-\left(1 - x \cdot x\right)} \]
  2. Step-by-step derivation
    1. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
    2. neg-sub0N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
    3. associate--r-N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
    5. +-commutativeN/A

      \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
    6. +-lowering-+.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
    7. *-lowering-*.f64100.0%

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
  4. Add Preprocessing
  5. 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)} \]
  6. Simplified91.2%

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

Alternative 13: 92.0% accurate, 4.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 0.001:\\
\;\;\;\;\frac{1 + x \cdot \left(x \cdot \left(1 + \frac{x \cdot x}{2}\right)\right)}{e}\\

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


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

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

        \[\leadsto e^{-1} + \left({x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2} + 1\right)\right) \cdot \color{blue}{e^{-1}} \]
      4. *-lft-identityN/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 e^{-1} \cdot \color{blue}{\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 \left(1 + \color{blue}{\frac{1}{2} \cdot {x}^{2}}\right)\right) \]
      7. distribute-lft-inN/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(e^{-1}\right), \color{blue}{\left(\left({x}^{2} + 1\right) + {x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2}\right)\right)}\right) \]
    7. Simplified99.6%

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(1 + \left(x \cdot x\right) \cdot \frac{1}{2}\right)\right)\right)\right), \mathsf{E}\left(\right)\right) \]
      7. +-lowering-+.f64N/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(x \cdot \left(x \cdot \frac{1}{2}\right)\right)\right)\right)\right)\right), \mathsf{E}\left(\right)\right) \]
      9. metadata-evalN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(x \cdot \frac{x}{2}\right)\right)\right)\right)\right), \mathsf{E}\left(\right)\right) \]
      11. associate-*r/N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(\frac{x \cdot x}{2}\right)\right)\right)\right)\right), \mathsf{E}\left(\right)\right) \]
      12. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\left(x \cdot x\right), 2\right)\right)\right)\right)\right), \mathsf{E}\left(\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), 2\right)\right)\right)\right)\right), \mathsf{E}\left(\right)\right) \]
      14. E-lowering-E.f6499.6%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), 2\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    9. Applied egg-rr99.6%

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

    if 1e-3 < (*.f64 x x)

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. 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)} \]
    6. Simplified83.3%

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

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

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

        \[\leadsto \frac{1}{6} \cdot \frac{{x}^{6} \cdot 1}{e^{1}} \]
      3. associate-*r/N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \color{blue}{\left({x}^{6} \cdot \frac{1}{\mathsf{E}\left(\right)}\right)}\right) \]
      6. exp-1-eN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \left({x}^{6} \cdot \frac{1}{e^{1}}\right)\right) \]
      7. associate-*r/N/A

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \left(\frac{{x}^{6}}{e^{\color{blue}{1}}}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \mathsf{/.f64}\left(\left({x}^{6}\right), \color{blue}{\left(e^{1}\right)}\right)\right) \]
    9. Simplified83.9%

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

Alternative 14: 91.9% accurate, 4.8× speedup?

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

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

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


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

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\left({x}^{2}\right), \color{blue}{1}\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\left(x \cdot x\right), 1\right)\right) \]
      11. *-lowering-*.f6499.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), 1\right)\right) \]
    7. Simplified99.2%

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

    if 1e-3 < (*.f64 x x)

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. 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)} \]
    6. Simplified83.3%

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

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

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

        \[\leadsto \frac{1}{6} \cdot \frac{{x}^{6} \cdot 1}{e^{1}} \]
      3. associate-*r/N/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \color{blue}{\left({x}^{6} \cdot \frac{1}{\mathsf{E}\left(\right)}\right)}\right) \]
      6. exp-1-eN/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \left({x}^{6} \cdot \frac{1}{e^{1}}\right)\right) \]
      7. associate-*r/N/A

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

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \left(\frac{{x}^{6}}{e^{\color{blue}{1}}}\right)\right) \]
      9. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\frac{1}{6}, \mathsf{/.f64}\left(\left({x}^{6}\right), \color{blue}{\left(e^{1}\right)}\right)\right) \]
    9. Simplified83.9%

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

Alternative 15: 92.1% accurate, 5.0× speedup?

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

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

    \[e^{-\left(1 - x \cdot x\right)} \]
  2. Step-by-step derivation
    1. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
    2. neg-sub0N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
    3. associate--r-N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
    5. +-commutativeN/A

      \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
    6. +-lowering-+.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
    7. *-lowering-*.f64100.0%

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
  4. Add Preprocessing
  5. 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)} \]
  6. Simplified91.2%

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\left(1 + x \cdot \left(x \cdot \left(1 + x \cdot \left(x \cdot \left(\frac{1}{2} + \left(x \cdot x\right) \cdot \frac{1}{6}\right)\right)\right)\right)\right), \color{blue}{\mathsf{E}\left(\right)}\right) \]
  8. Applied egg-rr91.2%

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

    \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(1 + {x}^{2} \cdot \left(1 + {x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot {x}^{2}\right)\right)\right)}, \mathsf{E.f64}\left(\right)\right) \]
  10. Step-by-step derivation
    1. +-lowering-+.f64N/A

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot \left(1 + {x}^{2} \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot {x}^{2}\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    7. *-lowering-*.f64N/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \left(x \cdot \left(x \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot {x}^{2}\right)\right)\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    11. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(x \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot {x}^{2}\right)\right)\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    12. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(\frac{1}{2} + \frac{1}{6} \cdot {x}^{2}\right)\right)\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    13. +-lowering-+.f64N/A

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{2}, \left(x \cdot \left(\frac{1}{6} \cdot x\right)\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    17. *-lowering-*.f64N/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \left(x \cdot \frac{1}{6}\right)\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    19. *-lowering-*.f6491.2%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \frac{1}{6}\right)\right)\right)\right)\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
  11. Simplified91.2%

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

    \[\leadsto \frac{1 + x \cdot \left(x \cdot \left(1 + x \cdot \left(x \cdot \left(x \cdot \left(x \cdot 0.16666666666666666\right) + 0.5\right)\right)\right)\right)}{e} \]
  13. Add Preprocessing

Alternative 16: 92.0% accurate, 5.0× speedup?

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

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

    \[e^{-\left(1 - x \cdot x\right)} \]
  2. Step-by-step derivation
    1. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
    2. neg-sub0N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
    3. associate--r-N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
    5. +-commutativeN/A

      \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
    6. +-lowering-+.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
    7. *-lowering-*.f64100.0%

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
  4. Add Preprocessing
  5. 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)} \]
  6. Simplified91.2%

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

    \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \color{blue}{\left(\frac{1}{6} \cdot {x}^{3}\right)}\right)\right)\right)\right)\right)\right) \]
  8. Step-by-step derivation
    1. cube-multN/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(x \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right)\right) \]
    9. *-lowering-*.f6490.9%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(x, \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right)\right) \]
  9. Simplified90.9%

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

Alternative 17: 87.8% accurate, 5.3× speedup?

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

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

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


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

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\left({x}^{2}\right), \color{blue}{1}\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\left(x \cdot x\right), 1\right)\right) \]
      11. *-lowering-*.f6499.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), 1\right)\right) \]
    7. Simplified99.2%

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

    if 1e-3 < (*.f64 x x)

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

        \[\leadsto e^{-1} + \left({x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2} + 1\right)\right) \cdot \color{blue}{e^{-1}} \]
      4. *-lft-identityN/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 e^{-1} \cdot \color{blue}{\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 \left(1 + \color{blue}{\frac{1}{2} \cdot {x}^{2}}\right)\right) \]
      7. distribute-lft-inN/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(e^{-1}\right), \color{blue}{\left(\left({x}^{2} + 1\right) + {x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2}\right)\right)}\right) \]
    7. Simplified75.5%

      \[\leadsto \color{blue}{\frac{1}{e} \cdot \left(1 + x \cdot \left(x \cdot \left(1 + \left(x \cdot x\right) \cdot 0.5\right)\right)\right)} \]
    8. 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)} \]
    9. Simplified75.5%

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

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

Alternative 18: 92.0% accurate, 5.6× speedup?

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

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

    \[e^{-\left(1 - x \cdot x\right)} \]
  2. Step-by-step derivation
    1. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
    2. neg-sub0N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
    3. associate--r-N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
    5. +-commutativeN/A

      \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
    6. +-lowering-+.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
    7. *-lowering-*.f64100.0%

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
  4. Add Preprocessing
  5. 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)} \]
  6. Simplified91.2%

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\left(1 + x \cdot \left(x \cdot \left(1 + x \cdot \left(x \cdot \left(\frac{1}{2} + \left(x \cdot x\right) \cdot \frac{1}{6}\right)\right)\right)\right)\right), \color{blue}{\mathsf{E}\left(\right)}\right) \]
  8. Applied egg-rr91.2%

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

    \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{6} \cdot {x}^{4}\right)}\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
  10. Step-by-step derivation
    1. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{6}, \left({x}^{4}\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    2. metadata-evalN/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{6}, \left({x}^{2} \cdot {x}^{2}\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    4. unpow2N/A

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{6}, \left(x \cdot \left(x \cdot {x}^{2}\right)\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    6. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{6}, \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    7. cube-multN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{6}, \left(x \cdot {x}^{3}\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(x, \left({x}^{3}\right)\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    9. cube-multN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(x, \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(x, \left(x \cdot {x}^{2}\right)\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    11. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({x}^{2}\right)\right)\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    12. unpow2N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(x \cdot x\right)\right)\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
    13. *-lowering-*.f6490.9%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{6}, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right)\right)\right)\right)\right), \mathsf{E.f64}\left(\right)\right) \]
  11. Simplified90.9%

    \[\leadsto \frac{1 + \left(x \cdot x\right) \cdot \left(1 + \color{blue}{0.16666666666666666 \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)}\right)}{e} \]
  12. Final simplification90.9%

    \[\leadsto \frac{1 + \left(x \cdot x\right) \cdot \left(1 + \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right) \cdot 0.16666666666666666\right)}{e} \]
  13. Add Preprocessing

Alternative 19: 87.8% accurate, 5.9× speedup?

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

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

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


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

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\left({x}^{2}\right), \color{blue}{1}\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\left(x \cdot x\right), 1\right)\right) \]
      11. *-lowering-*.f6499.2%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), 1\right)\right) \]
    7. Simplified99.2%

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

    if 1e-3 < (*.f64 x x)

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

        \[\leadsto e^{-1} + \left({x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2} + 1\right)\right) \cdot \color{blue}{e^{-1}} \]
      4. *-lft-identityN/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 e^{-1} \cdot \color{blue}{\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 \left(1 + \color{blue}{\frac{1}{2} \cdot {x}^{2}}\right)\right) \]
      7. distribute-lft-inN/A

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(e^{-1}\right), \color{blue}{\left(\left({x}^{2} + 1\right) + {x}^{2} \cdot \left(\frac{1}{2} \cdot {x}^{2}\right)\right)}\right) \]
    7. Simplified75.5%

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{{x}^{4}}{\mathsf{E}\left(\right)}} \]
    9. Step-by-step derivation
      1. exp-1-eN/A

        \[\leadsto \frac{1}{2} \cdot \frac{{x}^{4}}{e^{1}} \]
      2. associate-*r/N/A

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

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

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

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

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

        \[\leadsto \frac{{x}^{2} \cdot \frac{1}{2}}{e^{1}} \cdot {x}^{2} \]
      8. associate-*r/N/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \color{blue}{\left(\frac{1}{\mathsf{E}\left(\right)} \cdot {x}^{2}\right)}\right)\right) \]
      18. exp-1-eN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \left(\frac{1}{e^{1}} \cdot {x}^{2}\right)\right)\right) \]
      19. associate-*l/N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \frac{1 \cdot {x}^{2}}{\color{blue}{e^{1}}}\right)\right) \]
      20. *-lft-identityN/A

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\frac{1}{2} \cdot \frac{{x}^{2}}{\mathsf{E}\left(\right)}\right)\right) \]
    10. Simplified75.5%

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

Alternative 20: 76.1% accurate, 7.6× speedup?

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

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

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


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

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(e^{1}\right)}\right) \]
      4. exp-1-eN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{E}\left(\right)\right) \]
      5. E-lowering-E.f6498.6%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right) \]
    7. Simplified98.6%

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

    if 1e-3 < (*.f64 x x)

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\left({x}^{2}\right), \color{blue}{1}\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\left(x \cdot x\right), 1\right)\right) \]
      11. *-lowering-*.f6457.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), 1\right)\right) \]
    7. Simplified57.0%

      \[\leadsto \color{blue}{\frac{1}{e} \cdot \left(x \cdot x + 1\right)} \]
    8. Taylor expanded in x around inf

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

        \[\leadsto \frac{{x}^{2}}{e^{1}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left({x}^{2}\right), \color{blue}{\left(e^{1}\right)}\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x\right), \left(e^{\color{blue}{1}}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(e^{\color{blue}{1}}\right)\right) \]
      5. exp-1-eN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{E}\left(\right)\right) \]
      6. E-lowering-E.f6457.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{E.f64}\left(\right)\right) \]
    10. Simplified57.0%

      \[\leadsto \color{blue}{\frac{x \cdot x}{e}} \]
    11. Step-by-step derivation
      1. clear-numN/A

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{E.f64}\left(\right), \left(\color{blue}{x} \cdot x\right)\right)\right) \]
      5. *-lowering-*.f6457.0%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{E.f64}\left(\right), \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
    12. Applied egg-rr57.0%

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

Alternative 21: 76.1% accurate, 8.8× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{x}{e}\\


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

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(e^{1}\right)}\right) \]
      4. exp-1-eN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{E}\left(\right)\right) \]
      5. E-lowering-E.f6498.6%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right) \]
    7. Simplified98.6%

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

    if 1e-3 < (*.f64 x x)

    1. Initial program 100.0%

      \[e^{-\left(1 - x \cdot x\right)} \]
    2. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
      3. associate--r-N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
      5. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
      7. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\left({x}^{2}\right), \color{blue}{1}\right)\right) \]
      10. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\left(x \cdot x\right), 1\right)\right) \]
      11. *-lowering-*.f6457.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), 1\right)\right) \]
    7. Simplified57.0%

      \[\leadsto \color{blue}{\frac{1}{e} \cdot \left(x \cdot x + 1\right)} \]
    8. Taylor expanded in x around inf

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

        \[\leadsto \frac{{x}^{2}}{e^{1}} \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left({x}^{2}\right), \color{blue}{\left(e^{1}\right)}\right) \]
      3. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x\right), \left(e^{\color{blue}{1}}\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(e^{\color{blue}{1}}\right)\right) \]
      5. exp-1-eN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{E}\left(\right)\right) \]
      6. E-lowering-E.f6457.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{E.f64}\left(\right)\right) \]
    10. Simplified57.0%

      \[\leadsto \color{blue}{\frac{x \cdot x}{e}} \]
    11. Step-by-step derivation
      1. associate-/l*N/A

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{x}{\mathsf{E}\left(\right)}\right), x\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, \mathsf{E}\left(\right)\right), x\right) \]
      9. E-lowering-E.f6457.0%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(x, \mathsf{E.f64}\left(\right)\right), x\right) \]
    12. Applied egg-rr57.0%

      \[\leadsto \color{blue}{\frac{x}{e} \cdot x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.8%

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

Alternative 22: 76.5% accurate, 11.8× speedup?

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

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

    \[e^{-\left(1 - x \cdot x\right)} \]
  2. Step-by-step derivation
    1. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
    2. neg-sub0N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
    3. associate--r-N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
    5. +-commutativeN/A

      \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
    6. +-lowering-+.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
    7. *-lowering-*.f64100.0%

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\left({x}^{2}\right), \color{blue}{1}\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\left(x \cdot x\right), 1\right)\right) \]
    11. *-lowering-*.f6477.1%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), 1\right)\right) \]
  7. Simplified77.1%

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

Alternative 23: 76.5% accurate, 15.1× speedup?

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

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

    \[e^{-\left(1 - x \cdot x\right)} \]
  2. Step-by-step derivation
    1. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
    2. neg-sub0N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
    3. associate--r-N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
    5. +-commutativeN/A

      \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
    6. +-lowering-+.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
    7. *-lowering-*.f64100.0%

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\left({x}^{2}\right), \color{blue}{1}\right)\right) \]
    10. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\left(x \cdot x\right), 1\right)\right) \]
    11. *-lowering-*.f6477.1%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), 1\right)\right) \]
  7. Simplified77.1%

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(x \cdot x\right)\right), \mathsf{E}\left(\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{E}\left(\right)\right) \]
    7. E-lowering-E.f6477.1%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, x\right)\right), \mathsf{E.f64}\left(\right)\right) \]
  9. Applied egg-rr77.1%

    \[\leadsto \color{blue}{\frac{1 + x \cdot x}{e}} \]
  10. Final simplification77.1%

    \[\leadsto \frac{x \cdot x + 1}{e} \]
  11. Add Preprocessing

Alternative 24: 50.9% accurate, 35.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. Step-by-step derivation
    1. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)\right)\right) \]
    2. neg-sub0N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(1 - x \cdot x\right)\right)\right) \]
    3. associate--r-N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\left(0 - 1\right) + x \cdot x\right)\right) \]
    4. metadata-evalN/A

      \[\leadsto \mathsf{exp.f64}\left(\left(-1 + x \cdot x\right)\right) \]
    5. +-commutativeN/A

      \[\leadsto \mathsf{exp.f64}\left(\left(x \cdot x + -1\right)\right) \]
    6. +-lowering-+.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), -1\right)\right) \]
    7. *-lowering-*.f64100.0%

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), -1\right)\right) \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{e^{x \cdot x + -1}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0

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

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

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

      \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(e^{1}\right)}\right) \]
    4. exp-1-eN/A

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{E}\left(\right)\right) \]
    5. E-lowering-E.f6448.6%

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{E.f64}\left(\right)\right) \]
  7. Simplified48.6%

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

Reproduce

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