NMSE Section 6.1 mentioned, A

Percentage Accurate: 73.2% → 99.7%
Time: 12.1s
Alternatives: 15
Speedup: 9.7×

Specification

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

\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 73.2% accurate, 1.0× speedup?

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

\\
\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2}
\end{array}

Alternative 1: 99.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-1 - \varepsilon\right)} \cdot \left(1 + \frac{-1}{\varepsilon}\right) \leq 0:\\ \;\;\;\;0.5 \cdot \left(e^{-x} \cdot \left(x + \left(x + 2\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(e^{\varepsilon \cdot x} + e^{\varepsilon \cdot \left(-x\right)}\right)\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (if (<=
      (+
       (* (+ 1.0 (/ 1.0 eps)) (exp (* x (+ eps -1.0))))
       (* (exp (* x (- -1.0 eps))) (+ 1.0 (/ -1.0 eps))))
      0.0)
   (* 0.5 (* (exp (- x)) (+ x (+ x 2.0))))
   (* 0.5 (+ (exp (* eps x)) (exp (* eps (- x)))))))
double code(double x, double eps) {
	double tmp;
	if ((((1.0 + (1.0 / eps)) * exp((x * (eps + -1.0)))) + (exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) <= 0.0) {
		tmp = 0.5 * (exp(-x) * (x + (x + 2.0)));
	} else {
		tmp = 0.5 * (exp((eps * x)) + exp((eps * -x)));
	}
	return tmp;
}
real(8) function code(x, eps)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    real(8) :: tmp
    if ((((1.0d0 + (1.0d0 / eps)) * exp((x * (eps + (-1.0d0))))) + (exp((x * ((-1.0d0) - eps))) * (1.0d0 + ((-1.0d0) / eps)))) <= 0.0d0) then
        tmp = 0.5d0 * (exp(-x) * (x + (x + 2.0d0)))
    else
        tmp = 0.5d0 * (exp((eps * x)) + exp((eps * -x)))
    end if
    code = tmp
end function
public static double code(double x, double eps) {
	double tmp;
	if ((((1.0 + (1.0 / eps)) * Math.exp((x * (eps + -1.0)))) + (Math.exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) <= 0.0) {
		tmp = 0.5 * (Math.exp(-x) * (x + (x + 2.0)));
	} else {
		tmp = 0.5 * (Math.exp((eps * x)) + Math.exp((eps * -x)));
	}
	return tmp;
}
def code(x, eps):
	tmp = 0
	if (((1.0 + (1.0 / eps)) * math.exp((x * (eps + -1.0)))) + (math.exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) <= 0.0:
		tmp = 0.5 * (math.exp(-x) * (x + (x + 2.0)))
	else:
		tmp = 0.5 * (math.exp((eps * x)) + math.exp((eps * -x)))
	return tmp
function code(x, eps)
	tmp = 0.0
	if (Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(x * Float64(eps + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps))) * Float64(1.0 + Float64(-1.0 / eps)))) <= 0.0)
		tmp = Float64(0.5 * Float64(exp(Float64(-x)) * Float64(x + Float64(x + 2.0))));
	else
		tmp = Float64(0.5 * Float64(exp(Float64(eps * x)) + exp(Float64(eps * Float64(-x)))));
	end
	return tmp
end
function tmp_2 = code(x, eps)
	tmp = 0.0;
	if ((((1.0 + (1.0 / eps)) * exp((x * (eps + -1.0)))) + (exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) <= 0.0)
		tmp = 0.5 * (exp(-x) * (x + (x + 2.0)));
	else
		tmp = 0.5 * (exp((eps * x)) + exp((eps * -x)));
	end
	tmp_2 = tmp;
end
code[x_, eps_] := If[LessEqual[N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(0.5 * N[(N[Exp[(-x)], $MachinePrecision] * N[(x + N[(x + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Exp[N[(eps * x), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(eps * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(e^{\varepsilon \cdot x} + e^{\varepsilon \cdot \left(-x\right)}\right)\\


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

    1. Initial program 33.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(e^{-x} \cdot \left(\left(x + 2\right) + x\right)\right)} \]

    if 0.0 < (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x)))))

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
      2. cancel-sign-sub-invN/A

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

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

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

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

      \[\leadsto \color{blue}{0.5 \cdot \left(e^{x \cdot \varepsilon - x} + e^{x \cdot \left(-1 - \varepsilon\right)}\right)} \]
    6. Taylor expanded in eps around inf

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

        \[\leadsto 0.5 \cdot \left(e^{x \cdot \varepsilon} + e^{\color{blue}{x} \cdot \left(-1 - \varepsilon\right)}\right) \]
      2. Taylor expanded in eps around inf

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

          \[\leadsto 0.5 \cdot \left(e^{x \cdot \varepsilon} + e^{x \cdot \left(-\varepsilon\right)}\right) \]
      4. Recombined 2 regimes into one program.
      5. Final simplification100.0%

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

      Alternative 2: 92.5% accurate, 0.7× speedup?

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

        1. Initial program 53.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{0.5 \cdot \left(e^{-x} \cdot \left(\left(x + 2\right) + x\right)\right)} \]

        if 2.0049999999999999 < (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x)))))

        1. Initial program 100.0%

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

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

            \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
          2. cancel-sign-sub-invN/A

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.25 \cdot \mathsf{fma}\left(\varepsilon + 1, \varepsilon + 1, \left(1 - \varepsilon\right) \cdot \left(1 - \varepsilon\right)\right), \mathsf{fma}\left(0.5, \varepsilon + \left(-1 - \varepsilon\right), -0.5\right)\right)}, 1\right) \]
        8. Taylor expanded in eps around inf

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

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

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

        Alternative 3: 91.6% accurate, 0.7× speedup?

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

          1. Initial program 53.6%

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

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

              \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
            2. cancel-sign-sub-invN/A

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

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

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

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

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

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

              \[\leadsto e^{-x} \]

            if 2.0049999999999999 < (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x)))))

            1. Initial program 100.0%

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

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

                \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
              2. cancel-sign-sub-invN/A

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.25 \cdot \mathsf{fma}\left(\varepsilon + 1, \varepsilon + 1, \left(1 - \varepsilon\right) \cdot \left(1 - \varepsilon\right)\right), \mathsf{fma}\left(0.5, \varepsilon + \left(-1 - \varepsilon\right), -0.5\right)\right)}, 1\right) \]
            8. Taylor expanded in eps around inf

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

                \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \left(x \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}\right), 1\right) \]
            10. Recombined 2 regimes into one program.
            11. Final simplification92.9%

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

            Alternative 4: 71.7% accurate, 1.0× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-1 - \varepsilon\right)} \cdot \left(1 + \frac{-1}{\varepsilon}\right) \leq 4:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\varepsilon \cdot \left(\varepsilon \cdot \left(x \cdot \left(x \cdot 0.5\right)\right)\right)\\ \end{array} \end{array} \]
            (FPCore (x eps)
             :precision binary64
             (if (<=
                  (+
                   (* (+ 1.0 (/ 1.0 eps)) (exp (* x (+ eps -1.0))))
                   (* (exp (* x (- -1.0 eps))) (+ 1.0 (/ -1.0 eps))))
                  4.0)
               1.0
               (* eps (* eps (* x (* x 0.5))))))
            double code(double x, double eps) {
            	double tmp;
            	if ((((1.0 + (1.0 / eps)) * exp((x * (eps + -1.0)))) + (exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) <= 4.0) {
            		tmp = 1.0;
            	} else {
            		tmp = eps * (eps * (x * (x * 0.5)));
            	}
            	return tmp;
            }
            
            real(8) function code(x, eps)
                real(8), intent (in) :: x
                real(8), intent (in) :: eps
                real(8) :: tmp
                if ((((1.0d0 + (1.0d0 / eps)) * exp((x * (eps + (-1.0d0))))) + (exp((x * ((-1.0d0) - eps))) * (1.0d0 + ((-1.0d0) / eps)))) <= 4.0d0) then
                    tmp = 1.0d0
                else
                    tmp = eps * (eps * (x * (x * 0.5d0)))
                end if
                code = tmp
            end function
            
            public static double code(double x, double eps) {
            	double tmp;
            	if ((((1.0 + (1.0 / eps)) * Math.exp((x * (eps + -1.0)))) + (Math.exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) <= 4.0) {
            		tmp = 1.0;
            	} else {
            		tmp = eps * (eps * (x * (x * 0.5)));
            	}
            	return tmp;
            }
            
            def code(x, eps):
            	tmp = 0
            	if (((1.0 + (1.0 / eps)) * math.exp((x * (eps + -1.0)))) + (math.exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) <= 4.0:
            		tmp = 1.0
            	else:
            		tmp = eps * (eps * (x * (x * 0.5)))
            	return tmp
            
            function code(x, eps)
            	tmp = 0.0
            	if (Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(x * Float64(eps + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps))) * Float64(1.0 + Float64(-1.0 / eps)))) <= 4.0)
            		tmp = 1.0;
            	else
            		tmp = Float64(eps * Float64(eps * Float64(x * Float64(x * 0.5))));
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, eps)
            	tmp = 0.0;
            	if ((((1.0 + (1.0 / eps)) * exp((x * (eps + -1.0)))) + (exp((x * (-1.0 - eps))) * (1.0 + (-1.0 / eps)))) <= 4.0)
            		tmp = 1.0;
            	else
            		tmp = eps * (eps * (x * (x * 0.5)));
            	end
            	tmp_2 = tmp;
            end
            
            code[x_, eps_] := If[LessEqual[N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4.0], 1.0, N[(eps * N[(eps * N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{x \cdot \left(\varepsilon + -1\right)} + e^{x \cdot \left(-1 - \varepsilon\right)} \cdot \left(1 + \frac{-1}{\varepsilon}\right) \leq 4:\\
            \;\;\;\;1\\
            
            \mathbf{else}:\\
            \;\;\;\;\varepsilon \cdot \left(\varepsilon \cdot \left(x \cdot \left(x \cdot 0.5\right)\right)\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) < 4

              1. Initial program 53.9%

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

                \[\leadsto \color{blue}{1} \]
              4. Step-by-step derivation
                1. Applied rewrites77.1%

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

                if 4 < (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x)))))

                1. Initial program 100.0%

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

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

                    \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                  2. cancel-sign-sub-invN/A

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.25 \cdot \mathsf{fma}\left(\varepsilon + 1, \varepsilon + 1, \left(1 - \varepsilon\right) \cdot \left(1 - \varepsilon\right)\right), \mathsf{fma}\left(0.5, \varepsilon + \left(-1 - \varepsilon\right), -0.5\right)\right)}, 1\right) \]
                8. Taylor expanded in eps around inf

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

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

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

                Alternative 5: 98.9% accurate, 1.2× speedup?

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

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

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

                    \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                  2. cancel-sign-sub-invN/A

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

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

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

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

                  \[\leadsto \color{blue}{0.5 \cdot \left(e^{x \cdot \varepsilon - x} + e^{x \cdot \left(-1 - \varepsilon\right)}\right)} \]
                6. Final simplification99.6%

                  \[\leadsto 0.5 \cdot \left(e^{\varepsilon \cdot x - x} + e^{x \cdot \left(-1 - \varepsilon\right)}\right) \]
                7. Add Preprocessing

                Alternative 6: 74.8% accurate, 1.8× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\varepsilon \leq 2.8 \cdot 10^{-5}:\\ \;\;\;\;0.5 \cdot \left(e^{-x} \cdot \left(x + \left(x + 2\right)\right)\right)\\ \mathbf{elif}\;\varepsilon \leq 3.5 \cdot 10^{+162}:\\ \;\;\;\;0.5 \cdot \left(e^{\varepsilon \cdot x} + \mathsf{fma}\left(x, \left(1 + \varepsilon\right) \cdot \mathsf{fma}\left(x \cdot 0.5, 1 + \varepsilon, -1\right), 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, 0.5 \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right), 1\right)\\ \end{array} \end{array} \]
                (FPCore (x eps)
                 :precision binary64
                 (if (<= eps 2.8e-5)
                   (* 0.5 (* (exp (- x)) (+ x (+ x 2.0))))
                   (if (<= eps 3.5e+162)
                     (*
                      0.5
                      (+
                       (exp (* eps x))
                       (fma x (* (+ 1.0 eps) (fma (* x 0.5) (+ 1.0 eps) -1.0)) 1.0)))
                     (fma x (* 0.5 (* x (* eps eps))) 1.0))))
                double code(double x, double eps) {
                	double tmp;
                	if (eps <= 2.8e-5) {
                		tmp = 0.5 * (exp(-x) * (x + (x + 2.0)));
                	} else if (eps <= 3.5e+162) {
                		tmp = 0.5 * (exp((eps * x)) + fma(x, ((1.0 + eps) * fma((x * 0.5), (1.0 + eps), -1.0)), 1.0));
                	} else {
                		tmp = fma(x, (0.5 * (x * (eps * eps))), 1.0);
                	}
                	return tmp;
                }
                
                function code(x, eps)
                	tmp = 0.0
                	if (eps <= 2.8e-5)
                		tmp = Float64(0.5 * Float64(exp(Float64(-x)) * Float64(x + Float64(x + 2.0))));
                	elseif (eps <= 3.5e+162)
                		tmp = Float64(0.5 * Float64(exp(Float64(eps * x)) + fma(x, Float64(Float64(1.0 + eps) * fma(Float64(x * 0.5), Float64(1.0 + eps), -1.0)), 1.0)));
                	else
                		tmp = fma(x, Float64(0.5 * Float64(x * Float64(eps * eps))), 1.0);
                	end
                	return tmp
                end
                
                code[x_, eps_] := If[LessEqual[eps, 2.8e-5], N[(0.5 * N[(N[Exp[(-x)], $MachinePrecision] * N[(x + N[(x + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 3.5e+162], N[(0.5 * N[(N[Exp[N[(eps * x), $MachinePrecision]], $MachinePrecision] + N[(x * N[(N[(1.0 + eps), $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] * N[(1.0 + eps), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(0.5 * N[(x * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;\varepsilon \leq 2.8 \cdot 10^{-5}:\\
                \;\;\;\;0.5 \cdot \left(e^{-x} \cdot \left(x + \left(x + 2\right)\right)\right)\\
                
                \mathbf{elif}\;\varepsilon \leq 3.5 \cdot 10^{+162}:\\
                \;\;\;\;0.5 \cdot \left(e^{\varepsilon \cdot x} + \mathsf{fma}\left(x, \left(1 + \varepsilon\right) \cdot \mathsf{fma}\left(x \cdot 0.5, 1 + \varepsilon, -1\right), 1\right)\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;\mathsf{fma}\left(x, 0.5 \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right), 1\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if eps < 2.79999999999999996e-5

                  1. Initial program 64.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{0.5 \cdot \left(e^{-x} \cdot \left(\left(x + 2\right) + x\right)\right)} \]

                  if 2.79999999999999996e-5 < eps < 3.50000000000000018e162

                  1. Initial program 100.0%

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

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

                      \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                    2. cancel-sign-sub-invN/A

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

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

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

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

                    \[\leadsto \color{blue}{0.5 \cdot \left(e^{x \cdot \varepsilon - x} + e^{x \cdot \left(-1 - \varepsilon\right)}\right)} \]
                  6. Taylor expanded in eps around inf

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

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

                      \[\leadsto \frac{1}{2} \cdot \left(e^{x \cdot \varepsilon} + \left(1 + \color{blue}{x \cdot \left(-1 \cdot \left(1 + \varepsilon\right) + \frac{1}{2} \cdot \left(x \cdot {\left(1 + \varepsilon\right)}^{2}\right)\right)}\right)\right) \]
                    3. Step-by-step derivation
                      1. Applied rewrites87.6%

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

                      if 3.50000000000000018e162 < eps

                      1. Initial program 100.0%

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

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

                          \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                        2. cancel-sign-sub-invN/A

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

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

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

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

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

                        \[\leadsto 1 + \color{blue}{x \cdot \left(\frac{1}{2} \cdot \left(x \cdot \left(\frac{1}{2} \cdot {\left(1 + \varepsilon\right)}^{2} + \frac{1}{2} \cdot {\left(\varepsilon - 1\right)}^{2}\right)\right) + \frac{1}{2} \cdot \left(\left(\varepsilon + -1 \cdot \left(1 + \varepsilon\right)\right) - 1\right)\right)} \]
                      7. Applied rewrites97.3%

                        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.25 \cdot \mathsf{fma}\left(\varepsilon + 1, \varepsilon + 1, \left(1 - \varepsilon\right) \cdot \left(1 - \varepsilon\right)\right), \mathsf{fma}\left(0.5, \varepsilon + \left(-1 - \varepsilon\right), -0.5\right)\right)}, 1\right) \]
                      8. Taylor expanded in eps around inf

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

                          \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \left(x \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}\right), 1\right) \]
                      10. Recombined 3 regimes into one program.
                      11. Final simplification74.0%

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

                      Alternative 7: 70.1% accurate, 4.5× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -6.2 \cdot 10^{-70}:\\ \;\;\;\;0.5 \cdot \left(1 + \mathsf{fma}\left(x, \mathsf{fma}\left(x, \left(\left(-1 - \varepsilon\right) \cdot \left(-1 - \varepsilon\right)\right) \cdot \mathsf{fma}\left(x \cdot -0.16666666666666666, 1 + \varepsilon, 0.5\right), -1 - \varepsilon\right), 1\right)\right)\\ \mathbf{elif}\;x \leq 310:\\ \;\;\;\;\mathsf{fma}\left(x, 0.5 \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\varepsilon \cdot \left(\varepsilon \cdot \left(x \cdot \left(x \cdot 0.5\right)\right)\right)\\ \end{array} \end{array} \]
                      (FPCore (x eps)
                       :precision binary64
                       (if (<= x -6.2e-70)
                         (*
                          0.5
                          (+
                           1.0
                           (fma
                            x
                            (fma
                             x
                             (*
                              (* (- -1.0 eps) (- -1.0 eps))
                              (fma (* x -0.16666666666666666) (+ 1.0 eps) 0.5))
                             (- -1.0 eps))
                            1.0)))
                         (if (<= x 310.0)
                           (fma x (* 0.5 (* x (* eps eps))) 1.0)
                           (* eps (* eps (* x (* x 0.5)))))))
                      double code(double x, double eps) {
                      	double tmp;
                      	if (x <= -6.2e-70) {
                      		tmp = 0.5 * (1.0 + fma(x, fma(x, (((-1.0 - eps) * (-1.0 - eps)) * fma((x * -0.16666666666666666), (1.0 + eps), 0.5)), (-1.0 - eps)), 1.0));
                      	} else if (x <= 310.0) {
                      		tmp = fma(x, (0.5 * (x * (eps * eps))), 1.0);
                      	} else {
                      		tmp = eps * (eps * (x * (x * 0.5)));
                      	}
                      	return tmp;
                      }
                      
                      function code(x, eps)
                      	tmp = 0.0
                      	if (x <= -6.2e-70)
                      		tmp = Float64(0.5 * Float64(1.0 + fma(x, fma(x, Float64(Float64(Float64(-1.0 - eps) * Float64(-1.0 - eps)) * fma(Float64(x * -0.16666666666666666), Float64(1.0 + eps), 0.5)), Float64(-1.0 - eps)), 1.0)));
                      	elseif (x <= 310.0)
                      		tmp = fma(x, Float64(0.5 * Float64(x * Float64(eps * eps))), 1.0);
                      	else
                      		tmp = Float64(eps * Float64(eps * Float64(x * Float64(x * 0.5))));
                      	end
                      	return tmp
                      end
                      
                      code[x_, eps_] := If[LessEqual[x, -6.2e-70], N[(0.5 * N[(1.0 + N[(x * N[(x * N[(N[(N[(-1.0 - eps), $MachinePrecision] * N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision] * N[(N[(x * -0.16666666666666666), $MachinePrecision] * N[(1.0 + eps), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision] + N[(-1.0 - eps), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 310.0], N[(x * N[(0.5 * N[(x * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(eps * N[(eps * N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;x \leq -6.2 \cdot 10^{-70}:\\
                      \;\;\;\;0.5 \cdot \left(1 + \mathsf{fma}\left(x, \mathsf{fma}\left(x, \left(\left(-1 - \varepsilon\right) \cdot \left(-1 - \varepsilon\right)\right) \cdot \mathsf{fma}\left(x \cdot -0.16666666666666666, 1 + \varepsilon, 0.5\right), -1 - \varepsilon\right), 1\right)\right)\\
                      
                      \mathbf{elif}\;x \leq 310:\\
                      \;\;\;\;\mathsf{fma}\left(x, 0.5 \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right), 1\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\varepsilon \cdot \left(\varepsilon \cdot \left(x \cdot \left(x \cdot 0.5\right)\right)\right)\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if x < -6.2e-70

                        1. Initial program 88.4%

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

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

                            \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                          2. cancel-sign-sub-invN/A

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

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

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

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

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

                          \[\leadsto \frac{1}{2} \cdot \left(1 + e^{\color{blue}{x \cdot \left(-1 - \varepsilon\right)}}\right) \]
                        7. Step-by-step derivation
                          1. Applied rewrites47.7%

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

                            \[\leadsto \frac{1}{2} \cdot \left(1 + \left(1 + \color{blue}{x \cdot \left(-1 \cdot \left(1 + \varepsilon\right) + x \cdot \left(\frac{-1}{6} \cdot \left(x \cdot {\left(1 + \varepsilon\right)}^{3}\right) + \frac{1}{2} \cdot {\left(1 + \varepsilon\right)}^{2}\right)\right)}\right)\right) \]
                          3. Step-by-step derivation
                            1. Applied rewrites44.1%

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

                            if -6.2e-70 < x < 310

                            1. Initial program 56.7%

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

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

                                \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                              2. cancel-sign-sub-invN/A

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.25 \cdot \mathsf{fma}\left(\varepsilon + 1, \varepsilon + 1, \left(1 - \varepsilon\right) \cdot \left(1 - \varepsilon\right)\right), \mathsf{fma}\left(0.5, \varepsilon + \left(-1 - \varepsilon\right), -0.5\right)\right)}, 1\right) \]
                            8. Taylor expanded in eps around inf

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

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

                              if 310 < x

                              1. Initial program 100.0%

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

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

                                  \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                                2. cancel-sign-sub-invN/A

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

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

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

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

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

                                \[\leadsto 1 + \color{blue}{x \cdot \left(\frac{1}{2} \cdot \left(x \cdot \left(\frac{1}{2} \cdot {\left(1 + \varepsilon\right)}^{2} + \frac{1}{2} \cdot {\left(\varepsilon - 1\right)}^{2}\right)\right) + \frac{1}{2} \cdot \left(\left(\varepsilon + -1 \cdot \left(1 + \varepsilon\right)\right) - 1\right)\right)} \]
                              7. Applied rewrites47.4%

                                \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.25 \cdot \mathsf{fma}\left(\varepsilon + 1, \varepsilon + 1, \left(1 - \varepsilon\right) \cdot \left(1 - \varepsilon\right)\right), \mathsf{fma}\left(0.5, \varepsilon + \left(-1 - \varepsilon\right), -0.5\right)\right)}, 1\right) \]
                              8. Taylor expanded in eps around inf

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

                                  \[\leadsto \varepsilon \cdot \left(\varepsilon \cdot \color{blue}{\left(x \cdot \left(0.5 \cdot x\right)\right)}\right) \]
                              10. Recombined 3 regimes into one program.
                              11. Final simplification73.5%

                                \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.2 \cdot 10^{-70}:\\ \;\;\;\;0.5 \cdot \left(1 + \mathsf{fma}\left(x, \mathsf{fma}\left(x, \left(\left(-1 - \varepsilon\right) \cdot \left(-1 - \varepsilon\right)\right) \cdot \mathsf{fma}\left(x \cdot -0.16666666666666666, 1 + \varepsilon, 0.5\right), -1 - \varepsilon\right), 1\right)\right)\\ \mathbf{elif}\;x \leq 310:\\ \;\;\;\;\mathsf{fma}\left(x, 0.5 \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\varepsilon \cdot \left(\varepsilon \cdot \left(x \cdot \left(x \cdot 0.5\right)\right)\right)\\ \end{array} \]
                              12. Add Preprocessing

                              Alternative 8: 62.0% accurate, 9.1× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.85:\\ \;\;\;\;x \cdot \left(-0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{+20}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(0.5, x, -1\right), 1\right)\\ \end{array} \end{array} \]
                              (FPCore (x eps)
                               :precision binary64
                               (if (<= x -0.85)
                                 (* x (* -0.16666666666666666 (* x x)))
                                 (if (<= x 1.6e+20) 1.0 (* x (fma x (fma 0.5 x -1.0) 1.0)))))
                              double code(double x, double eps) {
                              	double tmp;
                              	if (x <= -0.85) {
                              		tmp = x * (-0.16666666666666666 * (x * x));
                              	} else if (x <= 1.6e+20) {
                              		tmp = 1.0;
                              	} else {
                              		tmp = x * fma(x, fma(0.5, x, -1.0), 1.0);
                              	}
                              	return tmp;
                              }
                              
                              function code(x, eps)
                              	tmp = 0.0
                              	if (x <= -0.85)
                              		tmp = Float64(x * Float64(-0.16666666666666666 * Float64(x * x)));
                              	elseif (x <= 1.6e+20)
                              		tmp = 1.0;
                              	else
                              		tmp = Float64(x * fma(x, fma(0.5, x, -1.0), 1.0));
                              	end
                              	return tmp
                              end
                              
                              code[x_, eps_] := If[LessEqual[x, -0.85], N[(x * N[(-0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.6e+20], 1.0, N[(x * N[(x * N[(0.5 * x + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
                              
                              \begin{array}{l}
                              
                              \\
                              \begin{array}{l}
                              \mathbf{if}\;x \leq -0.85:\\
                              \;\;\;\;x \cdot \left(-0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\
                              
                              \mathbf{elif}\;x \leq 1.6 \cdot 10^{+20}:\\
                              \;\;\;\;1\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;x \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(0.5, x, -1\right), 1\right)\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 3 regimes
                              2. if x < -0.849999999999999978

                                1. Initial program 100.0%

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

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

                                    \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                                  2. cancel-sign-sub-invN/A

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

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

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

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

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

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

                                    \[\leadsto e^{-x} \]
                                  2. Taylor expanded in x around 0

                                    \[\leadsto 1 + x \cdot \color{blue}{\left(x \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot x\right) - 1\right)} \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites58.1%

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

                                      \[\leadsto \frac{-1}{6} \cdot {x}^{3} \]
                                    3. Step-by-step derivation
                                      1. Applied rewrites58.1%

                                        \[\leadsto x \cdot \left(\left(x \cdot x\right) \cdot -0.16666666666666666\right) \]

                                      if -0.849999999999999978 < x < 1.6e20

                                      1. Initial program 59.0%

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

                                        \[\leadsto \color{blue}{1} \]
                                      4. Step-by-step derivation
                                        1. Applied rewrites69.0%

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

                                        if 1.6e20 < x

                                        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          \[\leadsto \color{blue}{0.5 \cdot \left(e^{-x} \cdot \left(\left(x + 2\right) + x\right)\right)} \]
                                        6. Taylor expanded in x around inf

                                          \[\leadsto x \cdot \color{blue}{e^{\mathsf{neg}\left(x\right)}} \]
                                        7. Step-by-step derivation
                                          1. Applied rewrites48.3%

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

                                            \[\leadsto x \cdot \left(1 + x \cdot \color{blue}{\left(\frac{1}{2} \cdot x - 1\right)}\right) \]
                                          3. Step-by-step derivation
                                            1. Applied rewrites42.0%

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

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

                                          Alternative 9: 76.8% accurate, 9.7× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 310:\\ \;\;\;\;\mathsf{fma}\left(x, 0.5 \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\varepsilon \cdot \left(\varepsilon \cdot \left(x \cdot \left(x \cdot 0.5\right)\right)\right)\\ \end{array} \end{array} \]
                                          (FPCore (x eps)
                                           :precision binary64
                                           (if (<= x 310.0)
                                             (fma x (* 0.5 (* x (* eps eps))) 1.0)
                                             (* eps (* eps (* x (* x 0.5))))))
                                          double code(double x, double eps) {
                                          	double tmp;
                                          	if (x <= 310.0) {
                                          		tmp = fma(x, (0.5 * (x * (eps * eps))), 1.0);
                                          	} else {
                                          		tmp = eps * (eps * (x * (x * 0.5)));
                                          	}
                                          	return tmp;
                                          }
                                          
                                          function code(x, eps)
                                          	tmp = 0.0
                                          	if (x <= 310.0)
                                          		tmp = fma(x, Float64(0.5 * Float64(x * Float64(eps * eps))), 1.0);
                                          	else
                                          		tmp = Float64(eps * Float64(eps * Float64(x * Float64(x * 0.5))));
                                          	end
                                          	return tmp
                                          end
                                          
                                          code[x_, eps_] := If[LessEqual[x, 310.0], N[(x * N[(0.5 * N[(x * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(eps * N[(eps * N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          \mathbf{if}\;x \leq 310:\\
                                          \;\;\;\;\mathsf{fma}\left(x, 0.5 \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right), 1\right)\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\varepsilon \cdot \left(\varepsilon \cdot \left(x \cdot \left(x \cdot 0.5\right)\right)\right)\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if x < 310

                                            1. Initial program 65.0%

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

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

                                                \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                                              2. cancel-sign-sub-invN/A

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

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

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

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

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

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

                                              \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.25 \cdot \mathsf{fma}\left(\varepsilon + 1, \varepsilon + 1, \left(1 - \varepsilon\right) \cdot \left(1 - \varepsilon\right)\right), \mathsf{fma}\left(0.5, \varepsilon + \left(-1 - \varepsilon\right), -0.5\right)\right)}, 1\right) \]
                                            8. Taylor expanded in eps around inf

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

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

                                              if 310 < x

                                              1. Initial program 100.0%

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

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

                                                  \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                                                2. cancel-sign-sub-invN/A

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

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

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

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

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

                                                \[\leadsto 1 + \color{blue}{x \cdot \left(\frac{1}{2} \cdot \left(x \cdot \left(\frac{1}{2} \cdot {\left(1 + \varepsilon\right)}^{2} + \frac{1}{2} \cdot {\left(\varepsilon - 1\right)}^{2}\right)\right) + \frac{1}{2} \cdot \left(\left(\varepsilon + -1 \cdot \left(1 + \varepsilon\right)\right) - 1\right)\right)} \]
                                              7. Applied rewrites47.4%

                                                \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.25 \cdot \mathsf{fma}\left(\varepsilon + 1, \varepsilon + 1, \left(1 - \varepsilon\right) \cdot \left(1 - \varepsilon\right)\right), \mathsf{fma}\left(0.5, \varepsilon + \left(-1 - \varepsilon\right), -0.5\right)\right)}, 1\right) \]
                                              8. Taylor expanded in eps around inf

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

                                                  \[\leadsto \varepsilon \cdot \left(\varepsilon \cdot \color{blue}{\left(x \cdot \left(0.5 \cdot x\right)\right)}\right) \]
                                              10. Recombined 2 regimes into one program.
                                              11. Final simplification81.2%

                                                \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 310:\\ \;\;\;\;\mathsf{fma}\left(x, 0.5 \cdot \left(x \cdot \left(\varepsilon \cdot \varepsilon\right)\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\varepsilon \cdot \left(\varepsilon \cdot \left(x \cdot \left(x \cdot 0.5\right)\right)\right)\\ \end{array} \]
                                              12. Add Preprocessing

                                              Alternative 10: 62.1% accurate, 10.9× speedup?

                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.00062:\\ \;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, -0.16666666666666666, 0.5\right), -1\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, 0.3333333333333333, -0.5\right), 1\right)\\ \end{array} \end{array} \]
                                              (FPCore (x eps)
                                               :precision binary64
                                               (if (<= x -0.00062)
                                                 (fma x (fma x (fma x -0.16666666666666666 0.5) -1.0) 1.0)
                                                 (fma (* x x) (fma x 0.3333333333333333 -0.5) 1.0)))
                                              double code(double x, double eps) {
                                              	double tmp;
                                              	if (x <= -0.00062) {
                                              		tmp = fma(x, fma(x, fma(x, -0.16666666666666666, 0.5), -1.0), 1.0);
                                              	} else {
                                              		tmp = fma((x * x), fma(x, 0.3333333333333333, -0.5), 1.0);
                                              	}
                                              	return tmp;
                                              }
                                              
                                              function code(x, eps)
                                              	tmp = 0.0
                                              	if (x <= -0.00062)
                                              		tmp = fma(x, fma(x, fma(x, -0.16666666666666666, 0.5), -1.0), 1.0);
                                              	else
                                              		tmp = fma(Float64(x * x), fma(x, 0.3333333333333333, -0.5), 1.0);
                                              	end
                                              	return tmp
                                              end
                                              
                                              code[x_, eps_] := If[LessEqual[x, -0.00062], N[(x * N[(x * N[(x * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(x * 0.3333333333333333 + -0.5), $MachinePrecision] + 1.0), $MachinePrecision]]
                                              
                                              \begin{array}{l}
                                              
                                              \\
                                              \begin{array}{l}
                                              \mathbf{if}\;x \leq -0.00062:\\
                                              \;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, -0.16666666666666666, 0.5\right), -1\right), 1\right)\\
                                              
                                              \mathbf{else}:\\
                                              \;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, 0.3333333333333333, -0.5\right), 1\right)\\
                                              
                                              
                                              \end{array}
                                              \end{array}
                                              
                                              Derivation
                                              1. Split input into 2 regimes
                                              2. if x < -6.2e-4

                                                1. Initial program 100.0%

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

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

                                                    \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                                                  2. cancel-sign-sub-invN/A

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

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

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

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

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

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

                                                    \[\leadsto e^{-x} \]
                                                  2. Taylor expanded in x around 0

                                                    \[\leadsto 1 + x \cdot \color{blue}{\left(x \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot x\right) - 1\right)} \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites56.6%

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

                                                    if -6.2e-4 < x

                                                    1. Initial program 69.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                      \[\leadsto \color{blue}{0.5 \cdot \left(e^{-x} \cdot \left(\left(x + 2\right) + x\right)\right)} \]
                                                    6. Taylor expanded in x around 0

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

                                                        \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, 0.3333333333333333, -0.5\right)}, 1\right) \]
                                                    8. Recombined 2 regimes into one program.
                                                    9. Add Preprocessing

                                                    Alternative 11: 62.1% accurate, 11.4× speedup?

                                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.00062:\\ \;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot -0.16666666666666666, -1\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, 0.3333333333333333, -0.5\right), 1\right)\\ \end{array} \end{array} \]
                                                    (FPCore (x eps)
                                                     :precision binary64
                                                     (if (<= x -0.00062)
                                                       (fma x (fma x (* x -0.16666666666666666) -1.0) 1.0)
                                                       (fma (* x x) (fma x 0.3333333333333333 -0.5) 1.0)))
                                                    double code(double x, double eps) {
                                                    	double tmp;
                                                    	if (x <= -0.00062) {
                                                    		tmp = fma(x, fma(x, (x * -0.16666666666666666), -1.0), 1.0);
                                                    	} else {
                                                    		tmp = fma((x * x), fma(x, 0.3333333333333333, -0.5), 1.0);
                                                    	}
                                                    	return tmp;
                                                    }
                                                    
                                                    function code(x, eps)
                                                    	tmp = 0.0
                                                    	if (x <= -0.00062)
                                                    		tmp = fma(x, fma(x, Float64(x * -0.16666666666666666), -1.0), 1.0);
                                                    	else
                                                    		tmp = fma(Float64(x * x), fma(x, 0.3333333333333333, -0.5), 1.0);
                                                    	end
                                                    	return tmp
                                                    end
                                                    
                                                    code[x_, eps_] := If[LessEqual[x, -0.00062], N[(x * N[(x * N[(x * -0.16666666666666666), $MachinePrecision] + -1.0), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(x * 0.3333333333333333 + -0.5), $MachinePrecision] + 1.0), $MachinePrecision]]
                                                    
                                                    \begin{array}{l}
                                                    
                                                    \\
                                                    \begin{array}{l}
                                                    \mathbf{if}\;x \leq -0.00062:\\
                                                    \;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, x \cdot -0.16666666666666666, -1\right), 1\right)\\
                                                    
                                                    \mathbf{else}:\\
                                                    \;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, 0.3333333333333333, -0.5\right), 1\right)\\
                                                    
                                                    
                                                    \end{array}
                                                    \end{array}
                                                    
                                                    Derivation
                                                    1. Split input into 2 regimes
                                                    2. if x < -6.2e-4

                                                      1. Initial program 100.0%

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

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

                                                          \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                                                        2. cancel-sign-sub-invN/A

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

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

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

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

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

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

                                                          \[\leadsto e^{-x} \]
                                                        2. Taylor expanded in x around 0

                                                          \[\leadsto 1 + x \cdot \color{blue}{\left(x \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot x\right) - 1\right)} \]
                                                        3. Step-by-step derivation
                                                          1. Applied rewrites56.6%

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

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

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

                                                            if -6.2e-4 < x

                                                            1. Initial program 69.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                              \[\leadsto \color{blue}{0.5 \cdot \left(e^{-x} \cdot \left(\left(x + 2\right) + x\right)\right)} \]
                                                            6. Taylor expanded in x around 0

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

                                                                \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, 0.3333333333333333, -0.5\right)}, 1\right) \]
                                                            8. Recombined 2 regimes into one program.
                                                            9. Add Preprocessing

                                                            Alternative 12: 62.2% accurate, 11.4× speedup?

                                                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -440:\\ \;\;\;\;x \cdot \left(-0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, 0.3333333333333333, -0.5\right), 1\right)\\ \end{array} \end{array} \]
                                                            (FPCore (x eps)
                                                             :precision binary64
                                                             (if (<= x -440.0)
                                                               (* x (* -0.16666666666666666 (* x x)))
                                                               (fma (* x x) (fma x 0.3333333333333333 -0.5) 1.0)))
                                                            double code(double x, double eps) {
                                                            	double tmp;
                                                            	if (x <= -440.0) {
                                                            		tmp = x * (-0.16666666666666666 * (x * x));
                                                            	} else {
                                                            		tmp = fma((x * x), fma(x, 0.3333333333333333, -0.5), 1.0);
                                                            	}
                                                            	return tmp;
                                                            }
                                                            
                                                            function code(x, eps)
                                                            	tmp = 0.0
                                                            	if (x <= -440.0)
                                                            		tmp = Float64(x * Float64(-0.16666666666666666 * Float64(x * x)));
                                                            	else
                                                            		tmp = fma(Float64(x * x), fma(x, 0.3333333333333333, -0.5), 1.0);
                                                            	end
                                                            	return tmp
                                                            end
                                                            
                                                            code[x_, eps_] := If[LessEqual[x, -440.0], N[(x * N[(-0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(x * 0.3333333333333333 + -0.5), $MachinePrecision] + 1.0), $MachinePrecision]]
                                                            
                                                            \begin{array}{l}
                                                            
                                                            \\
                                                            \begin{array}{l}
                                                            \mathbf{if}\;x \leq -440:\\
                                                            \;\;\;\;x \cdot \left(-0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\
                                                            
                                                            \mathbf{else}:\\
                                                            \;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, 0.3333333333333333, -0.5\right), 1\right)\\
                                                            
                                                            
                                                            \end{array}
                                                            \end{array}
                                                            
                                                            Derivation
                                                            1. Split input into 2 regimes
                                                            2. if x < -440

                                                              1. Initial program 100.0%

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

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

                                                                  \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                                                                2. cancel-sign-sub-invN/A

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

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

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

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

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

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

                                                                  \[\leadsto e^{-x} \]
                                                                2. Taylor expanded in x around 0

                                                                  \[\leadsto 1 + x \cdot \color{blue}{\left(x \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot x\right) - 1\right)} \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites58.1%

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

                                                                    \[\leadsto \frac{-1}{6} \cdot {x}^{3} \]
                                                                  3. Step-by-step derivation
                                                                    1. Applied rewrites58.1%

                                                                      \[\leadsto x \cdot \left(\left(x \cdot x\right) \cdot -0.16666666666666666\right) \]

                                                                    if -440 < x

                                                                    1. Initial program 69.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                      \[\leadsto \color{blue}{0.5 \cdot \left(e^{-x} \cdot \left(\left(x + 2\right) + x\right)\right)} \]
                                                                    6. Taylor expanded in x around 0

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

                                                                        \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, 0.3333333333333333, -0.5\right)}, 1\right) \]
                                                                    8. Recombined 2 regimes into one program.
                                                                    9. Final simplification61.3%

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

                                                                    Alternative 13: 59.4% accurate, 12.4× speedup?

                                                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.5:\\ \;\;\;\;x \cdot \left(-0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(0.5, x, -1\right), 1\right)\\ \end{array} \end{array} \]
                                                                    (FPCore (x eps)
                                                                     :precision binary64
                                                                     (if (<= x -4.5)
                                                                       (* x (* -0.16666666666666666 (* x x)))
                                                                       (fma x (fma 0.5 x -1.0) 1.0)))
                                                                    double code(double x, double eps) {
                                                                    	double tmp;
                                                                    	if (x <= -4.5) {
                                                                    		tmp = x * (-0.16666666666666666 * (x * x));
                                                                    	} else {
                                                                    		tmp = fma(x, fma(0.5, x, -1.0), 1.0);
                                                                    	}
                                                                    	return tmp;
                                                                    }
                                                                    
                                                                    function code(x, eps)
                                                                    	tmp = 0.0
                                                                    	if (x <= -4.5)
                                                                    		tmp = Float64(x * Float64(-0.16666666666666666 * Float64(x * x)));
                                                                    	else
                                                                    		tmp = fma(x, fma(0.5, x, -1.0), 1.0);
                                                                    	end
                                                                    	return tmp
                                                                    end
                                                                    
                                                                    code[x_, eps_] := If[LessEqual[x, -4.5], N[(x * N[(-0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(0.5 * x + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]]
                                                                    
                                                                    \begin{array}{l}
                                                                    
                                                                    \\
                                                                    \begin{array}{l}
                                                                    \mathbf{if}\;x \leq -4.5:\\
                                                                    \;\;\;\;x \cdot \left(-0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\
                                                                    
                                                                    \mathbf{else}:\\
                                                                    \;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(0.5, x, -1\right), 1\right)\\
                                                                    
                                                                    
                                                                    \end{array}
                                                                    \end{array}
                                                                    
                                                                    Derivation
                                                                    1. Split input into 2 regimes
                                                                    2. if x < -4.5

                                                                      1. Initial program 100.0%

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

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

                                                                          \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                                                                        2. cancel-sign-sub-invN/A

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

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

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

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

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

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

                                                                          \[\leadsto e^{-x} \]
                                                                        2. Taylor expanded in x around 0

                                                                          \[\leadsto 1 + x \cdot \color{blue}{\left(x \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot x\right) - 1\right)} \]
                                                                        3. Step-by-step derivation
                                                                          1. Applied rewrites58.1%

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

                                                                            \[\leadsto \frac{-1}{6} \cdot {x}^{3} \]
                                                                          3. Step-by-step derivation
                                                                            1. Applied rewrites58.1%

                                                                              \[\leadsto x \cdot \left(\left(x \cdot x\right) \cdot -0.16666666666666666\right) \]

                                                                            if -4.5 < x

                                                                            1. Initial program 69.9%

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

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

                                                                                \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                                                                              2. cancel-sign-sub-invN/A

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

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

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

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

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

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

                                                                                \[\leadsto e^{-x} \]
                                                                              2. Taylor expanded in x around 0

                                                                                \[\leadsto 1 + x \cdot \color{blue}{\left(\frac{1}{2} \cdot x - 1\right)} \]
                                                                              3. Step-by-step derivation
                                                                                1. Applied rewrites58.8%

                                                                                  \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(0.5, \color{blue}{x}, -1\right), 1\right) \]
                                                                              4. Recombined 2 regimes into one program.
                                                                              5. Final simplification58.7%

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

                                                                              Alternative 14: 57.4% accurate, 21.0× speedup?

                                                                              \[\begin{array}{l} \\ \mathsf{fma}\left(x, \mathsf{fma}\left(0.5, x, -1\right), 1\right) \end{array} \]
                                                                              (FPCore (x eps) :precision binary64 (fma x (fma 0.5 x -1.0) 1.0))
                                                                              double code(double x, double eps) {
                                                                              	return fma(x, fma(0.5, x, -1.0), 1.0);
                                                                              }
                                                                              
                                                                              function code(x, eps)
                                                                              	return fma(x, fma(0.5, x, -1.0), 1.0)
                                                                              end
                                                                              
                                                                              code[x_, eps_] := N[(x * N[(0.5 * x + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]
                                                                              
                                                                              \begin{array}{l}
                                                                              
                                                                              \\
                                                                              \mathsf{fma}\left(x, \mathsf{fma}\left(0.5, x, -1\right), 1\right)
                                                                              \end{array}
                                                                              
                                                                              Derivation
                                                                              1. Initial program 73.9%

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

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

                                                                                  \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                                                                                2. cancel-sign-sub-invN/A

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

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

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

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

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

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

                                                                                  \[\leadsto e^{-x} \]
                                                                                2. Taylor expanded in x around 0

                                                                                  \[\leadsto 1 + x \cdot \color{blue}{\left(\frac{1}{2} \cdot x - 1\right)} \]
                                                                                3. Step-by-step derivation
                                                                                  1. Applied rewrites56.5%

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

                                                                                  Alternative 15: 44.0% accurate, 273.0× speedup?

                                                                                  \[\begin{array}{l} \\ 1 \end{array} \]
                                                                                  (FPCore (x eps) :precision binary64 1.0)
                                                                                  double code(double x, double eps) {
                                                                                  	return 1.0;
                                                                                  }
                                                                                  
                                                                                  real(8) function code(x, eps)
                                                                                      real(8), intent (in) :: x
                                                                                      real(8), intent (in) :: eps
                                                                                      code = 1.0d0
                                                                                  end function
                                                                                  
                                                                                  public static double code(double x, double eps) {
                                                                                  	return 1.0;
                                                                                  }
                                                                                  
                                                                                  def code(x, eps):
                                                                                  	return 1.0
                                                                                  
                                                                                  function code(x, eps)
                                                                                  	return 1.0
                                                                                  end
                                                                                  
                                                                                  function tmp = code(x, eps)
                                                                                  	tmp = 1.0;
                                                                                  end
                                                                                  
                                                                                  code[x_, eps_] := 1.0
                                                                                  
                                                                                  \begin{array}{l}
                                                                                  
                                                                                  \\
                                                                                  1
                                                                                  \end{array}
                                                                                  
                                                                                  Derivation
                                                                                  1. Initial program 73.9%

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

                                                                                    \[\leadsto \color{blue}{1} \]
                                                                                  4. Step-by-step derivation
                                                                                    1. Applied rewrites45.0%

                                                                                      \[\leadsto \color{blue}{1} \]
                                                                                    2. Add Preprocessing

                                                                                    Reproduce

                                                                                    ?
                                                                                    herbie shell --seed 2024233 
                                                                                    (FPCore (x eps)
                                                                                      :name "NMSE Section 6.1 mentioned, A"
                                                                                      :precision binary64
                                                                                      (/ (- (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x)))) (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x))))) 2.0))