NMSE Section 6.1 mentioned, A

Percentage Accurate: 73.8% → 99.8%
Time: 16.3s
Alternatives: 19
Speedup: 5.5×

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 19 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.8% 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.8% accurate, 0.6× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;\left(1 + \frac{1}{eps\_m}\right) \cdot e^{x \cdot \left(eps\_m + -1\right)} + e^{x \cdot \left(-1 - eps\_m\right)} \cdot \left(1 + \frac{-1}{eps\_m}\right) \leq 0:\\ \;\;\;\;\frac{e^{-x} \cdot \mathsf{fma}\left(x, 2, 2\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{x \cdot eps\_m - x} + e^{eps\_m \cdot \left(-x\right)}}{2}\\ \end{array} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (if (<=
      (+
       (* (+ 1.0 (/ 1.0 eps_m)) (exp (* x (+ eps_m -1.0))))
       (* (exp (* x (- -1.0 eps_m))) (+ 1.0 (/ -1.0 eps_m))))
      0.0)
   (/ (* (exp (- x)) (fma x 2.0 2.0)) 2.0)
   (/ (+ (exp (- (* x eps_m) x)) (exp (* eps_m (- x)))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	double tmp;
	if ((((1.0 + (1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) <= 0.0) {
		tmp = (exp(-x) * fma(x, 2.0, 2.0)) / 2.0;
	} else {
		tmp = (exp(((x * eps_m) - x)) + exp((eps_m * -x))) / 2.0;
	}
	return tmp;
}
eps_m = abs(eps)
function code(x, eps_m)
	tmp = 0.0
	if (Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * exp(Float64(x * Float64(eps_m + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(1.0 + Float64(-1.0 / eps_m)))) <= 0.0)
		tmp = Float64(Float64(exp(Float64(-x)) * fma(x, 2.0, 2.0)) / 2.0);
	else
		tmp = Float64(Float64(exp(Float64(Float64(x * eps_m) - x)) + exp(Float64(eps_m * Float64(-x)))) / 2.0);
	end
	return tmp
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := If[LessEqual[N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(x * 2.0 + 2.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(N[(x * eps$95$m), $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

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

\mathbf{else}:\\
\;\;\;\;\frac{e^{x \cdot eps\_m - x} + e^{eps\_m \cdot \left(-x\right)}}{2}\\


\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 35.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 0

      \[\leadsto \frac{\color{blue}{\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)}}{2} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\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)}{2} \]
      2. unsub-negN/A

        \[\leadsto \frac{\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)}}{2} \]
      3. associate-+l-N/A

        \[\leadsto \frac{\color{blue}{\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)}}}{2} \]
      4. distribute-rgt1-inN/A

        \[\leadsto \frac{\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)}}{2} \]
      5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\left(x + \color{blue}{2}\right) + x\right)}{2} \]
      14. lower-+.f6499.0

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

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

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

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

        \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\color{blue}{x \cdot 2} + 2\right)}{2} \]
      3. lower-fma.f6499.1

        \[\leadsto \frac{e^{-x} \cdot \color{blue}{\mathsf{fma}\left(x, 2, 2\right)}}{2} \]
    8. Simplified99.1%

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

    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 \frac{\color{blue}{e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \frac{\color{blue}{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)}}}{2} \]
      2. metadata-evalN/A

        \[\leadsto \frac{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)}}{2} \]
      3. *-lft-identityN/A

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

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

      \[\leadsto \frac{\color{blue}{e^{x \cdot \varepsilon - x} + e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}}}{2} \]
    6. Taylor expanded in eps around inf

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

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

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

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

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

        \[\leadsto \frac{e^{x \cdot \varepsilon - x} + e^{x \cdot \color{blue}{\left(-\varepsilon\right)}}}{2} \]
    8. Simplified99.8%

      \[\leadsto \frac{e^{x \cdot \varepsilon - x} + e^{\color{blue}{x \cdot \left(-\varepsilon\right)}}}{2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.5%

    \[\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:\\ \;\;\;\;\frac{e^{-x} \cdot \mathsf{fma}\left(x, 2, 2\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{x \cdot \varepsilon - x} + e^{\varepsilon \cdot \left(-x\right)}}{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 99.8% accurate, 0.6× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;\left(1 + \frac{1}{eps\_m}\right) \cdot e^{x \cdot \left(eps\_m + -1\right)} + e^{x \cdot \left(-1 - eps\_m\right)} \cdot \left(1 + \frac{-1}{eps\_m}\right) \leq 0:\\ \;\;\;\;\frac{e^{-x} \cdot \mathsf{fma}\left(x, 2, 2\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{-\mathsf{fma}\left(x, eps\_m, x\right)} + e^{x \cdot eps\_m}}{2}\\ \end{array} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (if (<=
      (+
       (* (+ 1.0 (/ 1.0 eps_m)) (exp (* x (+ eps_m -1.0))))
       (* (exp (* x (- -1.0 eps_m))) (+ 1.0 (/ -1.0 eps_m))))
      0.0)
   (/ (* (exp (- x)) (fma x 2.0 2.0)) 2.0)
   (/ (+ (exp (- (fma x eps_m x))) (exp (* x eps_m))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	double tmp;
	if ((((1.0 + (1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) <= 0.0) {
		tmp = (exp(-x) * fma(x, 2.0, 2.0)) / 2.0;
	} else {
		tmp = (exp(-fma(x, eps_m, x)) + exp((x * eps_m))) / 2.0;
	}
	return tmp;
}
eps_m = abs(eps)
function code(x, eps_m)
	tmp = 0.0
	if (Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * exp(Float64(x * Float64(eps_m + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(1.0 + Float64(-1.0 / eps_m)))) <= 0.0)
		tmp = Float64(Float64(exp(Float64(-x)) * fma(x, 2.0, 2.0)) / 2.0);
	else
		tmp = Float64(Float64(exp(Float64(-fma(x, eps_m, x))) + exp(Float64(x * eps_m))) / 2.0);
	end
	return tmp
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := If[LessEqual[N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(x * 2.0 + 2.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[(-N[(x * eps$95$m + x), $MachinePrecision])], $MachinePrecision] + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

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

\mathbf{else}:\\
\;\;\;\;\frac{e^{-\mathsf{fma}\left(x, eps\_m, x\right)} + e^{x \cdot eps\_m}}{2}\\


\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 35.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 0

      \[\leadsto \frac{\color{blue}{\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)}}{2} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\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)}{2} \]
      2. unsub-negN/A

        \[\leadsto \frac{\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)}}{2} \]
      3. associate-+l-N/A

        \[\leadsto \frac{\color{blue}{\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)}}}{2} \]
      4. distribute-rgt1-inN/A

        \[\leadsto \frac{\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)}}{2} \]
      5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\left(x + \color{blue}{2}\right) + x\right)}{2} \]
      14. lower-+.f6499.0

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

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

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

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

        \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\color{blue}{x \cdot 2} + 2\right)}{2} \]
      3. lower-fma.f6499.1

        \[\leadsto \frac{e^{-x} \cdot \color{blue}{\mathsf{fma}\left(x, 2, 2\right)}}{2} \]
    8. Simplified99.1%

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

    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 \frac{\color{blue}{e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \frac{\color{blue}{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)}}}{2} \]
      2. metadata-evalN/A

        \[\leadsto \frac{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)}}{2} \]
      3. *-lft-identityN/A

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

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

      \[\leadsto \frac{\color{blue}{e^{x \cdot \varepsilon - x} + e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}}}{2} \]
    6. Taylor expanded in eps around inf

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

        \[\leadsto \frac{e^{\color{blue}{x \cdot \varepsilon}} + e^{\mathsf{neg}\left(\mathsf{fma}\left(x, \varepsilon, x\right)\right)}}{2} \]
      2. lower-*.f6499.8

        \[\leadsto \frac{e^{\color{blue}{x \cdot \varepsilon}} + e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}}{2} \]
    8. Simplified99.8%

      \[\leadsto \frac{e^{\color{blue}{x \cdot \varepsilon}} + e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}}{2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.5%

    \[\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:\\ \;\;\;\;\frac{e^{-x} \cdot \mathsf{fma}\left(x, 2, 2\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{-\mathsf{fma}\left(x, \varepsilon, x\right)} + e^{x \cdot \varepsilon}}{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.9% accurate, 0.6× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;\left(1 + \frac{1}{eps\_m}\right) \cdot e^{x \cdot \left(eps\_m + -1\right)} + e^{x \cdot \left(-1 - eps\_m\right)} \cdot \left(1 + \frac{-1}{eps\_m}\right) \leq 0:\\ \;\;\;\;\frac{e^{-x} \cdot \mathsf{fma}\left(x, 2, 2\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{eps\_m \cdot \left(-x\right)} + e^{x \cdot eps\_m}}{2}\\ \end{array} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (if (<=
      (+
       (* (+ 1.0 (/ 1.0 eps_m)) (exp (* x (+ eps_m -1.0))))
       (* (exp (* x (- -1.0 eps_m))) (+ 1.0 (/ -1.0 eps_m))))
      0.0)
   (/ (* (exp (- x)) (fma x 2.0 2.0)) 2.0)
   (/ (+ (exp (* eps_m (- x))) (exp (* x eps_m))) 2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	double tmp;
	if ((((1.0 + (1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) <= 0.0) {
		tmp = (exp(-x) * fma(x, 2.0, 2.0)) / 2.0;
	} else {
		tmp = (exp((eps_m * -x)) + exp((x * eps_m))) / 2.0;
	}
	return tmp;
}
eps_m = abs(eps)
function code(x, eps_m)
	tmp = 0.0
	if (Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * exp(Float64(x * Float64(eps_m + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(1.0 + Float64(-1.0 / eps_m)))) <= 0.0)
		tmp = Float64(Float64(exp(Float64(-x)) * fma(x, 2.0, 2.0)) / 2.0);
	else
		tmp = Float64(Float64(exp(Float64(eps_m * Float64(-x))) + exp(Float64(x * eps_m))) / 2.0);
	end
	return tmp
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := If[LessEqual[N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(x * 2.0 + 2.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(eps$95$m * (-x)), $MachinePrecision]], $MachinePrecision] + N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

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

\mathbf{else}:\\
\;\;\;\;\frac{e^{eps\_m \cdot \left(-x\right)} + e^{x \cdot eps\_m}}{2}\\


\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 35.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 0

      \[\leadsto \frac{\color{blue}{\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)}}{2} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\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)}{2} \]
      2. unsub-negN/A

        \[\leadsto \frac{\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)}}{2} \]
      3. associate-+l-N/A

        \[\leadsto \frac{\color{blue}{\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)}}}{2} \]
      4. distribute-rgt1-inN/A

        \[\leadsto \frac{\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)}}{2} \]
      5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\left(x + \color{blue}{2}\right) + x\right)}{2} \]
      14. lower-+.f6499.0

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

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

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

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

        \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\color{blue}{x \cdot 2} + 2\right)}{2} \]
      3. lower-fma.f6499.1

        \[\leadsto \frac{e^{-x} \cdot \color{blue}{\mathsf{fma}\left(x, 2, 2\right)}}{2} \]
    8. Simplified99.1%

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

    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 \frac{\color{blue}{e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \frac{\color{blue}{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)}}}{2} \]
      2. metadata-evalN/A

        \[\leadsto \frac{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)}}{2} \]
      3. *-lft-identityN/A

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

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

      \[\leadsto \frac{\color{blue}{e^{x \cdot \varepsilon - x} + e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}}}{2} \]
    6. Taylor expanded in eps around inf

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

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

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

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

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

        \[\leadsto \frac{e^{x \cdot \varepsilon - x} + e^{x \cdot \color{blue}{\left(-\varepsilon\right)}}}{2} \]
    8. Simplified99.8%

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

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

        \[\leadsto \frac{e^{\color{blue}{\varepsilon \cdot x}} + e^{x \cdot \left(-\varepsilon\right)}}{2} \]
    11. Simplified99.8%

      \[\leadsto \frac{e^{\color{blue}{\varepsilon \cdot x}} + e^{x \cdot \left(-\varepsilon\right)}}{2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.5%

    \[\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:\\ \;\;\;\;\frac{e^{-x} \cdot \mathsf{fma}\left(x, 2, 2\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{\varepsilon \cdot \left(-x\right)} + e^{x \cdot \varepsilon}}{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 92.3% accurate, 0.7× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.5 \cdot \mathsf{fma}\left(eps\_m + 1, \left(eps\_m + 1\right) \cdot t\_0, t\_1 \cdot \left(\left(1 - eps\_m\right) \cdot \left(1 - eps\_m\right)\right)\right), \mathsf{fma}\left(eps\_m + 1, \frac{1}{eps\_m} + -1, t\_1 \cdot \left(eps\_m + -1\right)\right)\right), 2\right)}{2}\\


\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

    1. Initial program 50.3%

      \[\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 \frac{\color{blue}{\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)}}{2} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\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)}{2} \]
      2. unsub-negN/A

        \[\leadsto \frac{\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)}}{2} \]
      3. associate-+l-N/A

        \[\leadsto \frac{\color{blue}{\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)}}}{2} \]
      4. distribute-rgt1-inN/A

        \[\leadsto \frac{\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)}}{2} \]
      5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\left(x + \color{blue}{2}\right) + x\right)}{2} \]
      14. lower-+.f6499.3

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

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

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

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

        \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\color{blue}{x \cdot 2} + 2\right)}{2} \]
      3. lower-fma.f6499.3

        \[\leadsto \frac{e^{-x} \cdot \color{blue}{\mathsf{fma}\left(x, 2, 2\right)}}{2} \]
    8. Simplified99.3%

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

    if 2 < (-.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 x around 0

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

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

    \[\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:\\ \;\;\;\;\frac{e^{-x} \cdot \mathsf{fma}\left(x, 2, 2\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.5 \cdot \mathsf{fma}\left(\varepsilon + 1, \left(\varepsilon + 1\right) \cdot \left(1 + \frac{-1}{\varepsilon}\right), \left(1 + \frac{1}{\varepsilon}\right) \cdot \left(\left(1 - \varepsilon\right) \cdot \left(1 - \varepsilon\right)\right)\right), \mathsf{fma}\left(\varepsilon + 1, \frac{1}{\varepsilon} + -1, \left(1 + \frac{1}{\varepsilon}\right) \cdot \left(\varepsilon + -1\right)\right)\right), 2\right)}{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 92.3% accurate, 0.7× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;\left(1 + \frac{1}{eps\_m}\right) \cdot e^{x \cdot \left(eps\_m + -1\right)} + e^{x \cdot \left(-1 - eps\_m\right)} \cdot \left(1 + \frac{-1}{eps\_m}\right) \leq 2:\\ \;\;\;\;\frac{e^{-x} \cdot \mathsf{fma}\left(x, 2, 2\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot 0.5, \mathsf{fma}\left(eps\_m, eps\_m, \left(1 - eps\_m\right) \cdot \left(1 - eps\_m\right)\right), -1\right), 2\right)}{2}\\ \end{array} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (if (<=
      (+
       (* (+ 1.0 (/ 1.0 eps_m)) (exp (* x (+ eps_m -1.0))))
       (* (exp (* x (- -1.0 eps_m))) (+ 1.0 (/ -1.0 eps_m))))
      2.0)
   (/ (* (exp (- x)) (fma x 2.0 2.0)) 2.0)
   (/
    (fma
     x
     (fma (* x 0.5) (fma eps_m eps_m (* (- 1.0 eps_m) (- 1.0 eps_m))) -1.0)
     2.0)
    2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	double tmp;
	if ((((1.0 + (1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) <= 2.0) {
		tmp = (exp(-x) * fma(x, 2.0, 2.0)) / 2.0;
	} else {
		tmp = fma(x, fma((x * 0.5), fma(eps_m, eps_m, ((1.0 - eps_m) * (1.0 - eps_m))), -1.0), 2.0) / 2.0;
	}
	return tmp;
}
eps_m = abs(eps)
function code(x, eps_m)
	tmp = 0.0
	if (Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * exp(Float64(x * Float64(eps_m + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(1.0 + Float64(-1.0 / eps_m)))) <= 2.0)
		tmp = Float64(Float64(exp(Float64(-x)) * fma(x, 2.0, 2.0)) / 2.0);
	else
		tmp = Float64(fma(x, fma(Float64(x * 0.5), fma(eps_m, eps_m, Float64(Float64(1.0 - eps_m) * Float64(1.0 - eps_m))), -1.0), 2.0) / 2.0);
	end
	return tmp
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := If[LessEqual[N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(x * 2.0 + 2.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * N[(N[(x * 0.5), $MachinePrecision] * N[(eps$95$m * eps$95$m + N[(N[(1.0 - eps$95$m), $MachinePrecision] * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] + 2.0), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

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

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot 0.5, \mathsf{fma}\left(eps\_m, eps\_m, \left(1 - eps\_m\right) \cdot \left(1 - eps\_m\right)\right), -1\right), 2\right)}{2}\\


\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

    1. Initial program 50.3%

      \[\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 \frac{\color{blue}{\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)}}{2} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\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)}{2} \]
      2. unsub-negN/A

        \[\leadsto \frac{\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)}}{2} \]
      3. associate-+l-N/A

        \[\leadsto \frac{\color{blue}{\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)}}}{2} \]
      4. distribute-rgt1-inN/A

        \[\leadsto \frac{\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)}}{2} \]
      5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\left(x + \color{blue}{2}\right) + x\right)}{2} \]
      14. lower-+.f6499.3

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

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

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

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

        \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\color{blue}{x \cdot 2} + 2\right)}{2} \]
      3. lower-fma.f6499.3

        \[\leadsto \frac{e^{-x} \cdot \color{blue}{\mathsf{fma}\left(x, 2, 2\right)}}{2} \]
    8. Simplified99.3%

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

    if 2 < (-.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 \frac{\color{blue}{e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \frac{\color{blue}{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)}}}{2} \]
      2. metadata-evalN/A

        \[\leadsto \frac{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)}}{2} \]
      3. *-lft-identityN/A

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

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

      \[\leadsto \frac{\color{blue}{e^{x \cdot \varepsilon - x} + e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}}}{2} \]
    6. Taylor expanded in eps around inf

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

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

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

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

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

        \[\leadsto \frac{e^{x \cdot \varepsilon - x} + e^{x \cdot \color{blue}{\left(-\varepsilon\right)}}}{2} \]
    8. Simplified99.8%

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

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

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

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

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

        \[\leadsto \frac{x \cdot \left(\left(\color{blue}{0} \cdot \varepsilon + x \cdot \left(\frac{1}{2} \cdot {\varepsilon}^{2} + \frac{1}{2} \cdot {\left(\varepsilon - 1\right)}^{2}\right)\right) - 1\right) + 2}{2} \]
      5. mul0-lftN/A

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

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

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

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

    \[\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:\\ \;\;\;\;\frac{e^{-x} \cdot \mathsf{fma}\left(x, 2, 2\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot 0.5, \mathsf{fma}\left(\varepsilon, \varepsilon, \left(1 - \varepsilon\right) \cdot \left(1 - \varepsilon\right)\right), -1\right), 2\right)}{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 92.3% accurate, 0.7× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;\left(1 + \frac{1}{eps\_m}\right) \cdot e^{x \cdot \left(eps\_m + -1\right)} + e^{x \cdot \left(-1 - eps\_m\right)} \cdot \left(1 + \frac{-1}{eps\_m}\right) \leq 2:\\ \;\;\;\;\frac{e^{-x} \cdot \left(x + \left(x + 2\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot 0.5, \mathsf{fma}\left(eps\_m, eps\_m, \left(1 - eps\_m\right) \cdot \left(1 - eps\_m\right)\right), -1\right), 2\right)}{2}\\ \end{array} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (if (<=
      (+
       (* (+ 1.0 (/ 1.0 eps_m)) (exp (* x (+ eps_m -1.0))))
       (* (exp (* x (- -1.0 eps_m))) (+ 1.0 (/ -1.0 eps_m))))
      2.0)
   (/ (* (exp (- x)) (+ x (+ x 2.0))) 2.0)
   (/
    (fma
     x
     (fma (* x 0.5) (fma eps_m eps_m (* (- 1.0 eps_m) (- 1.0 eps_m))) -1.0)
     2.0)
    2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	double tmp;
	if ((((1.0 + (1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) <= 2.0) {
		tmp = (exp(-x) * (x + (x + 2.0))) / 2.0;
	} else {
		tmp = fma(x, fma((x * 0.5), fma(eps_m, eps_m, ((1.0 - eps_m) * (1.0 - eps_m))), -1.0), 2.0) / 2.0;
	}
	return tmp;
}
eps_m = abs(eps)
function code(x, eps_m)
	tmp = 0.0
	if (Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * exp(Float64(x * Float64(eps_m + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(1.0 + Float64(-1.0 / eps_m)))) <= 2.0)
		tmp = Float64(Float64(exp(Float64(-x)) * Float64(x + Float64(x + 2.0))) / 2.0);
	else
		tmp = Float64(fma(x, fma(Float64(x * 0.5), fma(eps_m, eps_m, Float64(Float64(1.0 - eps_m) * Float64(1.0 - eps_m))), -1.0), 2.0) / 2.0);
	end
	return tmp
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := If[LessEqual[N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(x + N[(x + 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * N[(N[(x * 0.5), $MachinePrecision] * N[(eps$95$m * eps$95$m + N[(N[(1.0 - eps$95$m), $MachinePrecision] * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] + 2.0), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

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

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot 0.5, \mathsf{fma}\left(eps\_m, eps\_m, \left(1 - eps\_m\right) \cdot \left(1 - eps\_m\right)\right), -1\right), 2\right)}{2}\\


\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

    1. Initial program 50.3%

      \[\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 \frac{\color{blue}{\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)}}{2} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\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)}{2} \]
      2. unsub-negN/A

        \[\leadsto \frac{\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)}}{2} \]
      3. associate-+l-N/A

        \[\leadsto \frac{\color{blue}{\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)}}}{2} \]
      4. distribute-rgt1-inN/A

        \[\leadsto \frac{\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)}}{2} \]
      5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\left(x + \color{blue}{2}\right) + x\right)}{2} \]
      14. lower-+.f6499.3

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

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

    if 2 < (-.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 \frac{\color{blue}{e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
    4. Step-by-step derivation
      1. cancel-sign-sub-invN/A

        \[\leadsto \frac{\color{blue}{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)}}}{2} \]
      2. metadata-evalN/A

        \[\leadsto \frac{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)}}{2} \]
      3. *-lft-identityN/A

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

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

      \[\leadsto \frac{\color{blue}{e^{x \cdot \varepsilon - x} + e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}}}{2} \]
    6. Taylor expanded in eps around inf

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

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

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

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

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

        \[\leadsto \frac{e^{x \cdot \varepsilon - x} + e^{x \cdot \color{blue}{\left(-\varepsilon\right)}}}{2} \]
    8. Simplified99.8%

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

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

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

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

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

        \[\leadsto \frac{x \cdot \left(\left(\color{blue}{0} \cdot \varepsilon + x \cdot \left(\frac{1}{2} \cdot {\varepsilon}^{2} + \frac{1}{2} \cdot {\left(\varepsilon - 1\right)}^{2}\right)\right) - 1\right) + 2}{2} \]
      5. mul0-lftN/A

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

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

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

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

    \[\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:\\ \;\;\;\;\frac{e^{-x} \cdot \left(x + \left(x + 2\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot 0.5, \mathsf{fma}\left(\varepsilon, \varepsilon, \left(1 - \varepsilon\right) \cdot \left(1 - \varepsilon\right)\right), -1\right), 2\right)}{2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 91.4% accurate, 0.7× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;\left(1 + \frac{1}{eps\_m}\right) \cdot e^{x \cdot \left(eps\_m + -1\right)} + e^{x \cdot \left(-1 - eps\_m\right)} \cdot \left(1 + \frac{-1}{eps\_m}\right) \leq 2:\\ \;\;\;\;e^{-x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot 0.5, \mathsf{fma}\left(eps\_m, eps\_m, \left(1 - eps\_m\right) \cdot \left(1 - eps\_m\right)\right), -1\right), 2\right)}{2}\\ \end{array} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (if (<=
      (+
       (* (+ 1.0 (/ 1.0 eps_m)) (exp (* x (+ eps_m -1.0))))
       (* (exp (* x (- -1.0 eps_m))) (+ 1.0 (/ -1.0 eps_m))))
      2.0)
   (exp (- x))
   (/
    (fma
     x
     (fma (* x 0.5) (fma eps_m eps_m (* (- 1.0 eps_m) (- 1.0 eps_m))) -1.0)
     2.0)
    2.0)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	double tmp;
	if ((((1.0 + (1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) <= 2.0) {
		tmp = exp(-x);
	} else {
		tmp = fma(x, fma((x * 0.5), fma(eps_m, eps_m, ((1.0 - eps_m) * (1.0 - eps_m))), -1.0), 2.0) / 2.0;
	}
	return tmp;
}
eps_m = abs(eps)
function code(x, eps_m)
	tmp = 0.0
	if (Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * exp(Float64(x * Float64(eps_m + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(1.0 + Float64(-1.0 / eps_m)))) <= 2.0)
		tmp = exp(Float64(-x));
	else
		tmp = Float64(fma(x, fma(Float64(x * 0.5), fma(eps_m, eps_m, Float64(Float64(1.0 - eps_m) * Float64(1.0 - eps_m))), -1.0), 2.0) / 2.0);
	end
	return tmp
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := If[LessEqual[N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], N[Exp[(-x)], $MachinePrecision], N[(N[(x * N[(N[(x * 0.5), $MachinePrecision] * N[(eps$95$m * eps$95$m + N[(N[(1.0 - eps$95$m), $MachinePrecision] * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] + 2.0), $MachinePrecision] / 2.0), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

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

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot 0.5, \mathsf{fma}\left(eps\_m, eps\_m, \left(1 - eps\_m\right) \cdot \left(1 - eps\_m\right)\right), -1\right), 2\right)}{2}\\


\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

    1. Initial program 50.3%

      \[\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 \frac{\color{blue}{\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)}}{2} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \frac{\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)}{2} \]
      2. unsub-negN/A

        \[\leadsto \frac{\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)}}{2} \]
      3. associate-+l-N/A

        \[\leadsto \frac{\color{blue}{\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)}}}{2} \]
      4. distribute-rgt1-inN/A

        \[\leadsto \frac{\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)}}{2} \]
      5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\left(x + \color{blue}{2}\right) + x\right)}{2} \]
      14. lower-+.f6499.3

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

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

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

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

        \[\leadsto \color{blue}{e^{\mathsf{neg}\left(x\right)}} \]
      3. Step-by-step derivation
        1. neg-mul-1N/A

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

          \[\leadsto \color{blue}{e^{-1 \cdot x}} \]
        3. neg-mul-1N/A

          \[\leadsto e^{\color{blue}{\mathsf{neg}\left(x\right)}} \]
        4. lower-neg.f6497.1

          \[\leadsto e^{\color{blue}{-x}} \]
      4. Simplified97.1%

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

      if 2 < (-.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 \frac{\color{blue}{e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
      4. Step-by-step derivation
        1. cancel-sign-sub-invN/A

          \[\leadsto \frac{\color{blue}{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)}}}{2} \]
        2. metadata-evalN/A

          \[\leadsto \frac{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)}}{2} \]
        3. *-lft-identityN/A

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

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

        \[\leadsto \frac{\color{blue}{e^{x \cdot \varepsilon - x} + e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}}}{2} \]
      6. Taylor expanded in eps around inf

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

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

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

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

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

          \[\leadsto \frac{e^{x \cdot \varepsilon - x} + e^{x \cdot \color{blue}{\left(-\varepsilon\right)}}}{2} \]
      8. Simplified99.8%

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

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

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

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

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

          \[\leadsto \frac{x \cdot \left(\left(\color{blue}{0} \cdot \varepsilon + x \cdot \left(\frac{1}{2} \cdot {\varepsilon}^{2} + \frac{1}{2} \cdot {\left(\varepsilon - 1\right)}^{2}\right)\right) - 1\right) + 2}{2} \]
        5. mul0-lftN/A

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

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

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

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

      \[\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:\\ \;\;\;\;e^{-x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot 0.5, \mathsf{fma}\left(\varepsilon, \varepsilon, \left(1 - \varepsilon\right) \cdot \left(1 - \varepsilon\right)\right), -1\right), 2\right)}{2}\\ \end{array} \]
    10. Add Preprocessing

    Alternative 8: 78.0% accurate, 0.9× speedup?

    \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;\left(1 + \frac{1}{eps\_m}\right) \cdot e^{x \cdot \left(eps\_m + -1\right)} + e^{x \cdot \left(-1 - eps\_m\right)} \cdot \left(1 + \frac{-1}{eps\_m}\right) \leq 2:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, -0.25, 0.6666666666666666\right), -1\right), 2\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot 0.5, \mathsf{fma}\left(eps\_m, eps\_m, \left(1 - eps\_m\right) \cdot \left(1 - eps\_m\right)\right), -1\right), 2\right)}{2}\\ \end{array} \end{array} \]
    eps_m = (fabs.f64 eps)
    (FPCore (x eps_m)
     :precision binary64
     (if (<=
          (+
           (* (+ 1.0 (/ 1.0 eps_m)) (exp (* x (+ eps_m -1.0))))
           (* (exp (* x (- -1.0 eps_m))) (+ 1.0 (/ -1.0 eps_m))))
          2.0)
       (/ (fma x (* x (fma x (fma x -0.25 0.6666666666666666) -1.0)) 2.0) 2.0)
       (/
        (fma
         x
         (fma (* x 0.5) (fma eps_m eps_m (* (- 1.0 eps_m) (- 1.0 eps_m))) -1.0)
         2.0)
        2.0)))
    eps_m = fabs(eps);
    double code(double x, double eps_m) {
    	double tmp;
    	if ((((1.0 + (1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) <= 2.0) {
    		tmp = fma(x, (x * fma(x, fma(x, -0.25, 0.6666666666666666), -1.0)), 2.0) / 2.0;
    	} else {
    		tmp = fma(x, fma((x * 0.5), fma(eps_m, eps_m, ((1.0 - eps_m) * (1.0 - eps_m))), -1.0), 2.0) / 2.0;
    	}
    	return tmp;
    }
    
    eps_m = abs(eps)
    function code(x, eps_m)
    	tmp = 0.0
    	if (Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * exp(Float64(x * Float64(eps_m + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(1.0 + Float64(-1.0 / eps_m)))) <= 2.0)
    		tmp = Float64(fma(x, Float64(x * fma(x, fma(x, -0.25, 0.6666666666666666), -1.0)), 2.0) / 2.0);
    	else
    		tmp = Float64(fma(x, fma(Float64(x * 0.5), fma(eps_m, eps_m, Float64(Float64(1.0 - eps_m) * Float64(1.0 - eps_m))), -1.0), 2.0) / 2.0);
    	end
    	return tmp
    end
    
    eps_m = N[Abs[eps], $MachinePrecision]
    code[x_, eps$95$m_] := If[LessEqual[N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], N[(N[(x * N[(x * N[(x * N[(x * -0.25 + 0.6666666666666666), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(x * N[(N[(x * 0.5), $MachinePrecision] * N[(eps$95$m * eps$95$m + N[(N[(1.0 - eps$95$m), $MachinePrecision] * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] + 2.0), $MachinePrecision] / 2.0), $MachinePrecision]]
    
    \begin{array}{l}
    eps_m = \left|\varepsilon\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\left(1 + \frac{1}{eps\_m}\right) \cdot e^{x \cdot \left(eps\_m + -1\right)} + e^{x \cdot \left(-1 - eps\_m\right)} \cdot \left(1 + \frac{-1}{eps\_m}\right) \leq 2:\\
    \;\;\;\;\frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, -0.25, 0.6666666666666666\right), -1\right), 2\right)}{2}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot 0.5, \mathsf{fma}\left(eps\_m, eps\_m, \left(1 - eps\_m\right) \cdot \left(1 - eps\_m\right)\right), -1\right), 2\right)}{2}\\
    
    
    \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

      1. Initial program 50.3%

        \[\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 \frac{\color{blue}{\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)}}{2} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \frac{\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)}{2} \]
        2. unsub-negN/A

          \[\leadsto \frac{\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)}}{2} \]
        3. associate-+l-N/A

          \[\leadsto \frac{\color{blue}{\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)}}}{2} \]
        4. distribute-rgt1-inN/A

          \[\leadsto \frac{\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)}}{2} \]
        5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

          \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\left(x + \color{blue}{2}\right) + x\right)}{2} \]
        14. lower-+.f6499.3

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \color{blue}{x \cdot \frac{-1}{4}} + \frac{2}{3}, -1\right), 2\right)}{2} \]
        11. lower-fma.f6473.2

          \[\leadsto \frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, -0.25, 0.6666666666666666\right)}, -1\right), 2\right)}{2} \]
      8. Simplified73.2%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, -0.25, 0.6666666666666666\right), -1\right), 2\right)}}{2} \]

      if 2 < (-.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 \frac{\color{blue}{e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
      4. Step-by-step derivation
        1. cancel-sign-sub-invN/A

          \[\leadsto \frac{\color{blue}{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)}}}{2} \]
        2. metadata-evalN/A

          \[\leadsto \frac{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)}}{2} \]
        3. *-lft-identityN/A

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

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

        \[\leadsto \frac{\color{blue}{e^{x \cdot \varepsilon - x} + e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}}}{2} \]
      6. Taylor expanded in eps around inf

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

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

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

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

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

          \[\leadsto \frac{e^{x \cdot \varepsilon - x} + e^{x \cdot \color{blue}{\left(-\varepsilon\right)}}}{2} \]
      8. Simplified99.8%

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

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

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

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

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

          \[\leadsto \frac{x \cdot \left(\left(\color{blue}{0} \cdot \varepsilon + x \cdot \left(\frac{1}{2} \cdot {\varepsilon}^{2} + \frac{1}{2} \cdot {\left(\varepsilon - 1\right)}^{2}\right)\right) - 1\right) + 2}{2} \]
        5. mul0-lftN/A

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

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

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

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

      \[\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:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, -0.25, 0.6666666666666666\right), -1\right), 2\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot 0.5, \mathsf{fma}\left(\varepsilon, \varepsilon, \left(1 - \varepsilon\right) \cdot \left(1 - \varepsilon\right)\right), -1\right), 2\right)}{2}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 9: 75.0% accurate, 0.9× speedup?

    \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;\left(1 + \frac{1}{eps\_m}\right) \cdot e^{x \cdot \left(eps\_m + -1\right)} + e^{x \cdot \left(-1 - eps\_m\right)} \cdot \left(1 + \frac{-1}{eps\_m}\right) \leq 10000:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, -0.25, 0.6666666666666666\right), -1\right), 2\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \left(eps\_m \cdot eps\_m\right)\right)}{2}\\ \end{array} \end{array} \]
    eps_m = (fabs.f64 eps)
    (FPCore (x eps_m)
     :precision binary64
     (if (<=
          (+
           (* (+ 1.0 (/ 1.0 eps_m)) (exp (* x (+ eps_m -1.0))))
           (* (exp (* x (- -1.0 eps_m))) (+ 1.0 (/ -1.0 eps_m))))
          10000.0)
       (/ (fma x (* x (fma x (fma x -0.25 0.6666666666666666) -1.0)) 2.0) 2.0)
       (/ (* (* x x) (* 0.5 (* eps_m eps_m))) 2.0)))
    eps_m = fabs(eps);
    double code(double x, double eps_m) {
    	double tmp;
    	if ((((1.0 + (1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) <= 10000.0) {
    		tmp = fma(x, (x * fma(x, fma(x, -0.25, 0.6666666666666666), -1.0)), 2.0) / 2.0;
    	} else {
    		tmp = ((x * x) * (0.5 * (eps_m * eps_m))) / 2.0;
    	}
    	return tmp;
    }
    
    eps_m = abs(eps)
    function code(x, eps_m)
    	tmp = 0.0
    	if (Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * exp(Float64(x * Float64(eps_m + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(1.0 + Float64(-1.0 / eps_m)))) <= 10000.0)
    		tmp = Float64(fma(x, Float64(x * fma(x, fma(x, -0.25, 0.6666666666666666), -1.0)), 2.0) / 2.0);
    	else
    		tmp = Float64(Float64(Float64(x * x) * Float64(0.5 * Float64(eps_m * eps_m))) / 2.0);
    	end
    	return tmp
    end
    
    eps_m = N[Abs[eps], $MachinePrecision]
    code[x_, eps$95$m_] := If[LessEqual[N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 10000.0], N[(N[(x * N[(x * N[(x * N[(x * -0.25 + 0.6666666666666666), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(x * x), $MachinePrecision] * N[(0.5 * N[(eps$95$m * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
    
    \begin{array}{l}
    eps_m = \left|\varepsilon\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\left(1 + \frac{1}{eps\_m}\right) \cdot e^{x \cdot \left(eps\_m + -1\right)} + e^{x \cdot \left(-1 - eps\_m\right)} \cdot \left(1 + \frac{-1}{eps\_m}\right) \leq 10000:\\
    \;\;\;\;\frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, -0.25, 0.6666666666666666\right), -1\right), 2\right)}{2}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \left(eps\_m \cdot eps\_m\right)\right)}{2}\\
    
    
    \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))))) < 1e4

      1. Initial program 51.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 \frac{\color{blue}{\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)}}{2} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \frac{\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)}{2} \]
        2. unsub-negN/A

          \[\leadsto \frac{\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)}}{2} \]
        3. associate-+l-N/A

          \[\leadsto \frac{\color{blue}{\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)}}}{2} \]
        4. distribute-rgt1-inN/A

          \[\leadsto \frac{\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)}}{2} \]
        5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

          \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\left(x + \color{blue}{2}\right) + x\right)}{2} \]
        14. lower-+.f6496.8

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \color{blue}{x \cdot \frac{-1}{4}} + \frac{2}{3}, -1\right), 2\right)}{2} \]
        11. lower-fma.f6471.6

          \[\leadsto \frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, -0.25, 0.6666666666666666\right)}, -1\right), 2\right)}{2} \]
      8. Simplified71.6%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, -0.25, 0.6666666666666666\right), -1\right), 2\right)}}{2} \]

      if 1e4 < (-.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 x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\mathsf{neg}\left(\left(1 - \varepsilon\right) \cdot x\right)} - \left(\frac{1}{\varepsilon} - 1\right) \cdot \mathsf{fma}\left(x, \left(\varepsilon + 1\right) \cdot \mathsf{fma}\left(x \cdot \frac{1}{2}, \color{blue}{\varepsilon + 1}, -1\right), 1\right)}{2} \]
        15. lower-+.f6489.6

          \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot \mathsf{fma}\left(x, \left(\varepsilon + 1\right) \cdot \mathsf{fma}\left(x \cdot 0.5, \color{blue}{\varepsilon + 1}, -1\right), 1\right)}{2} \]
      5. Simplified89.6%

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}\right)}{2} \]
      8. Simplified81.8%

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

      \[\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 10000:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, x \cdot \mathsf{fma}\left(x, \mathsf{fma}\left(x, -0.25, 0.6666666666666666\right), -1\right), 2\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right)}{2}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 10: 75.0% accurate, 0.9× speedup?

    \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;\left(1 + \frac{1}{eps\_m}\right) \cdot e^{x \cdot \left(eps\_m + -1\right)} + e^{x \cdot \left(-1 - eps\_m\right)} \cdot \left(1 + \frac{-1}{eps\_m}\right) \leq 10000:\\ \;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, 0.3333333333333333, -0.5\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \left(eps\_m \cdot eps\_m\right)\right)}{2}\\ \end{array} \end{array} \]
    eps_m = (fabs.f64 eps)
    (FPCore (x eps_m)
     :precision binary64
     (if (<=
          (+
           (* (+ 1.0 (/ 1.0 eps_m)) (exp (* x (+ eps_m -1.0))))
           (* (exp (* x (- -1.0 eps_m))) (+ 1.0 (/ -1.0 eps_m))))
          10000.0)
       (fma (* x x) (fma x 0.3333333333333333 -0.5) 1.0)
       (/ (* (* x x) (* 0.5 (* eps_m eps_m))) 2.0)))
    eps_m = fabs(eps);
    double code(double x, double eps_m) {
    	double tmp;
    	if ((((1.0 + (1.0 / eps_m)) * exp((x * (eps_m + -1.0)))) + (exp((x * (-1.0 - eps_m))) * (1.0 + (-1.0 / eps_m)))) <= 10000.0) {
    		tmp = fma((x * x), fma(x, 0.3333333333333333, -0.5), 1.0);
    	} else {
    		tmp = ((x * x) * (0.5 * (eps_m * eps_m))) / 2.0;
    	}
    	return tmp;
    }
    
    eps_m = abs(eps)
    function code(x, eps_m)
    	tmp = 0.0
    	if (Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * exp(Float64(x * Float64(eps_m + -1.0)))) + Float64(exp(Float64(x * Float64(-1.0 - eps_m))) * Float64(1.0 + Float64(-1.0 / eps_m)))) <= 10000.0)
    		tmp = fma(Float64(x * x), fma(x, 0.3333333333333333, -0.5), 1.0);
    	else
    		tmp = Float64(Float64(Float64(x * x) * Float64(0.5 * Float64(eps_m * eps_m))) / 2.0);
    	end
    	return tmp
    end
    
    eps_m = N[Abs[eps], $MachinePrecision]
    code[x_, eps$95$m_] := If[LessEqual[N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * N[(eps$95$m + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Exp[N[(x * N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 10000.0], N[(N[(x * x), $MachinePrecision] * N[(x * 0.3333333333333333 + -0.5), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(N[(x * x), $MachinePrecision] * N[(0.5 * N[(eps$95$m * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
    
    \begin{array}{l}
    eps_m = \left|\varepsilon\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\left(1 + \frac{1}{eps\_m}\right) \cdot e^{x \cdot \left(eps\_m + -1\right)} + e^{x \cdot \left(-1 - eps\_m\right)} \cdot \left(1 + \frac{-1}{eps\_m}\right) \leq 10000:\\
    \;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, 0.3333333333333333, -0.5\right), 1\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \left(eps\_m \cdot eps\_m\right)\right)}{2}\\
    
    
    \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))))) < 1e4

      1. Initial program 51.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 \frac{\color{blue}{\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)}}{2} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \frac{\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)}{2} \]
        2. unsub-negN/A

          \[\leadsto \frac{\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)}}{2} \]
        3. associate-+l-N/A

          \[\leadsto \frac{\color{blue}{\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)}}}{2} \]
        4. distribute-rgt1-inN/A

          \[\leadsto \frac{\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)}}{2} \]
        5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

          \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\left(x + \color{blue}{2}\right) + x\right)}{2} \]
        14. lower-+.f6496.8

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, 0.6666666666666666, -1\right)}, 2\right)}{2} \]
      8. Simplified71.3%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, 0.6666666666666666, -1\right), 2\right)}}{2} \]
      9. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{2}, x \cdot \left(\frac{1}{3} - \frac{1}{2} \cdot \frac{1}{x}\right), 1\right)} \]
      11. Simplified71.3%

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

      if 1e4 < (-.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 x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\mathsf{neg}\left(\left(1 - \varepsilon\right) \cdot x\right)} - \left(\frac{1}{\varepsilon} - 1\right) \cdot \mathsf{fma}\left(x, \left(\varepsilon + 1\right) \cdot \mathsf{fma}\left(x \cdot \frac{1}{2}, \color{blue}{\varepsilon + 1}, -1\right), 1\right)}{2} \]
        15. lower-+.f6489.6

          \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot \mathsf{fma}\left(x, \left(\varepsilon + 1\right) \cdot \mathsf{fma}\left(x \cdot 0.5, \color{blue}{\varepsilon + 1}, -1\right), 1\right)}{2} \]
      5. Simplified89.6%

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}\right)}{2} \]
      8. Simplified81.8%

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

      \[\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 10000:\\ \;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, 0.3333333333333333, -0.5\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right)}{2}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 11: 99.0% accurate, 1.2× speedup?

    \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \frac{e^{x \cdot eps\_m - x} + e^{-\mathsf{fma}\left(x, eps\_m, x\right)}}{2} \end{array} \]
    eps_m = (fabs.f64 eps)
    (FPCore (x eps_m)
     :precision binary64
     (/ (+ (exp (- (* x eps_m) x)) (exp (- (fma x eps_m x)))) 2.0))
    eps_m = fabs(eps);
    double code(double x, double eps_m) {
    	return (exp(((x * eps_m) - x)) + exp(-fma(x, eps_m, x))) / 2.0;
    }
    
    eps_m = abs(eps)
    function code(x, eps_m)
    	return Float64(Float64(exp(Float64(Float64(x * eps_m) - x)) + exp(Float64(-fma(x, eps_m, x)))) / 2.0)
    end
    
    eps_m = N[Abs[eps], $MachinePrecision]
    code[x_, eps$95$m_] := N[(N[(N[Exp[N[(N[(x * eps$95$m), $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision] + N[Exp[(-N[(x * eps$95$m + x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
    
    \begin{array}{l}
    eps_m = \left|\varepsilon\right|
    
    \\
    \frac{e^{x \cdot eps\_m - x} + e^{-\mathsf{fma}\left(x, eps\_m, x\right)}}{2}
    \end{array}
    
    Derivation
    1. Initial program 70.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 inf

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

        \[\leadsto \frac{\color{blue}{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)}}}{2} \]
      2. metadata-evalN/A

        \[\leadsto \frac{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)}}{2} \]
      3. *-lft-identityN/A

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

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

      \[\leadsto \frac{\color{blue}{e^{x \cdot \varepsilon - x} + e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}}}{2} \]
    6. Add Preprocessing

    Alternative 12: 93.8% accurate, 1.7× speedup?

    \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;eps\_m \leq 2.6 \cdot 10^{-13}:\\ \;\;\;\;\frac{e^{-x} \cdot \mathsf{fma}\left(x, 2, 2\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{x \cdot eps\_m - x} + \mathsf{fma}\left(x, \mathsf{fma}\left(0.5, \mathsf{fma}\left(x, eps\_m, x\right) \cdot \left(eps\_m + 1\right), -1 - eps\_m\right), 1\right)}{2}\\ \end{array} \end{array} \]
    eps_m = (fabs.f64 eps)
    (FPCore (x eps_m)
     :precision binary64
     (if (<= eps_m 2.6e-13)
       (/ (* (exp (- x)) (fma x 2.0 2.0)) 2.0)
       (/
        (+
         (exp (- (* x eps_m) x))
         (fma x (fma 0.5 (* (fma x eps_m x) (+ eps_m 1.0)) (- -1.0 eps_m)) 1.0))
        2.0)))
    eps_m = fabs(eps);
    double code(double x, double eps_m) {
    	double tmp;
    	if (eps_m <= 2.6e-13) {
    		tmp = (exp(-x) * fma(x, 2.0, 2.0)) / 2.0;
    	} else {
    		tmp = (exp(((x * eps_m) - x)) + fma(x, fma(0.5, (fma(x, eps_m, x) * (eps_m + 1.0)), (-1.0 - eps_m)), 1.0)) / 2.0;
    	}
    	return tmp;
    }
    
    eps_m = abs(eps)
    function code(x, eps_m)
    	tmp = 0.0
    	if (eps_m <= 2.6e-13)
    		tmp = Float64(Float64(exp(Float64(-x)) * fma(x, 2.0, 2.0)) / 2.0);
    	else
    		tmp = Float64(Float64(exp(Float64(Float64(x * eps_m) - x)) + fma(x, fma(0.5, Float64(fma(x, eps_m, x) * Float64(eps_m + 1.0)), Float64(-1.0 - eps_m)), 1.0)) / 2.0);
    	end
    	return tmp
    end
    
    eps_m = N[Abs[eps], $MachinePrecision]
    code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 2.6e-13], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(x * 2.0 + 2.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(N[(x * eps$95$m), $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision] + N[(x * N[(0.5 * N[(N[(x * eps$95$m + x), $MachinePrecision] * N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision] + N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
    
    \begin{array}{l}
    eps_m = \left|\varepsilon\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;eps\_m \leq 2.6 \cdot 10^{-13}:\\
    \;\;\;\;\frac{e^{-x} \cdot \mathsf{fma}\left(x, 2, 2\right)}{2}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{e^{x \cdot eps\_m - x} + \mathsf{fma}\left(x, \mathsf{fma}\left(0.5, \mathsf{fma}\left(x, eps\_m, x\right) \cdot \left(eps\_m + 1\right), -1 - eps\_m\right), 1\right)}{2}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if eps < 2.6e-13

      1. Initial program 60.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 \frac{\color{blue}{\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)}}{2} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \frac{\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)}{2} \]
        2. unsub-negN/A

          \[\leadsto \frac{\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)}}{2} \]
        3. associate-+l-N/A

          \[\leadsto \frac{\color{blue}{\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)}}}{2} \]
        4. distribute-rgt1-inN/A

          \[\leadsto \frac{\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)}}{2} \]
        5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

          \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\left(x + \color{blue}{2}\right) + x\right)}{2} \]
        14. lower-+.f6469.5

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

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

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

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

          \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\color{blue}{x \cdot 2} + 2\right)}{2} \]
        3. lower-fma.f6469.5

          \[\leadsto \frac{e^{-x} \cdot \color{blue}{\mathsf{fma}\left(x, 2, 2\right)}}{2} \]
      8. Simplified69.5%

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

      if 2.6e-13 < 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 \frac{\color{blue}{e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
      4. Step-by-step derivation
        1. cancel-sign-sub-invN/A

          \[\leadsto \frac{\color{blue}{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)}}}{2} \]
        2. metadata-evalN/A

          \[\leadsto \frac{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)}}{2} \]
        3. *-lft-identityN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{e^{x \cdot \varepsilon - x} + \mathsf{fma}\left(x, \mathsf{fma}\left(\frac{1}{2}, \left(1 + \varepsilon\right) \cdot \mathsf{fma}\left(x, \varepsilon, x\right), \color{blue}{-1 - \varepsilon}\right), 1\right)}{2} \]
        19. lower--.f6488.4

          \[\leadsto \frac{e^{x \cdot \varepsilon - x} + \mathsf{fma}\left(x, \mathsf{fma}\left(0.5, \left(1 + \varepsilon\right) \cdot \mathsf{fma}\left(x, \varepsilon, x\right), \color{blue}{-1 - \varepsilon}\right), 1\right)}{2} \]
      8. Simplified88.4%

        \[\leadsto \frac{e^{x \cdot \varepsilon - x} + \color{blue}{\mathsf{fma}\left(x, \mathsf{fma}\left(0.5, \left(1 + \varepsilon\right) \cdot \mathsf{fma}\left(x, \varepsilon, x\right), -1 - \varepsilon\right), 1\right)}}{2} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification74.3%

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

    Alternative 13: 77.1% accurate, 3.5× speedup?

    \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} t_0 := \frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\ \mathbf{if}\;x \leq 760:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(0.5, \mathsf{fma}\left(x, eps\_m, x\right) \cdot \left(eps\_m + 1\right), -1 - eps\_m\right), 1\right) + \mathsf{fma}\left(x, \left(eps\_m + -1\right) \cdot \mathsf{fma}\left(x \cdot 0.5, eps\_m + -1, 1\right), 1\right)}{2}\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{+24}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{+268}:\\ \;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \left(eps\_m \cdot eps\_m\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    eps_m = (fabs.f64 eps)
    (FPCore (x eps_m)
     :precision binary64
     (let* ((t_0 (/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)))
       (if (<= x 760.0)
         (/
          (+
           (fma x (fma 0.5 (* (fma x eps_m x) (+ eps_m 1.0)) (- -1.0 eps_m)) 1.0)
           (fma x (* (+ eps_m -1.0) (fma (* x 0.5) (+ eps_m -1.0) 1.0)) 1.0))
          2.0)
         (if (<= x 1.6e+24)
           t_0
           (if (<= x 9.5e+268) (/ (* (* x x) (* 0.5 (* eps_m eps_m))) 2.0) t_0)))))
    eps_m = fabs(eps);
    double code(double x, double eps_m) {
    	double t_0 = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
    	double tmp;
    	if (x <= 760.0) {
    		tmp = (fma(x, fma(0.5, (fma(x, eps_m, x) * (eps_m + 1.0)), (-1.0 - eps_m)), 1.0) + fma(x, ((eps_m + -1.0) * fma((x * 0.5), (eps_m + -1.0), 1.0)), 1.0)) / 2.0;
    	} else if (x <= 1.6e+24) {
    		tmp = t_0;
    	} else if (x <= 9.5e+268) {
    		tmp = ((x * x) * (0.5 * (eps_m * eps_m))) / 2.0;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    eps_m = abs(eps)
    function code(x, eps_m)
    	t_0 = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0)
    	tmp = 0.0
    	if (x <= 760.0)
    		tmp = Float64(Float64(fma(x, fma(0.5, Float64(fma(x, eps_m, x) * Float64(eps_m + 1.0)), Float64(-1.0 - eps_m)), 1.0) + fma(x, Float64(Float64(eps_m + -1.0) * fma(Float64(x * 0.5), Float64(eps_m + -1.0), 1.0)), 1.0)) / 2.0);
    	elseif (x <= 1.6e+24)
    		tmp = t_0;
    	elseif (x <= 9.5e+268)
    		tmp = Float64(Float64(Float64(x * x) * Float64(0.5 * Float64(eps_m * eps_m))) / 2.0);
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    eps_m = N[Abs[eps], $MachinePrecision]
    code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, 760.0], N[(N[(N[(x * N[(0.5 * N[(N[(x * eps$95$m + x), $MachinePrecision] * N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision] + N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] + N[(x * N[(N[(eps$95$m + -1.0), $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] * N[(eps$95$m + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.6e+24], t$95$0, If[LessEqual[x, 9.5e+268], N[(N[(N[(x * x), $MachinePrecision] * N[(0.5 * N[(eps$95$m * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], t$95$0]]]]
    
    \begin{array}{l}
    eps_m = \left|\varepsilon\right|
    
    \\
    \begin{array}{l}
    t_0 := \frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
    \mathbf{if}\;x \leq 760:\\
    \;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(0.5, \mathsf{fma}\left(x, eps\_m, x\right) \cdot \left(eps\_m + 1\right), -1 - eps\_m\right), 1\right) + \mathsf{fma}\left(x, \left(eps\_m + -1\right) \cdot \mathsf{fma}\left(x \cdot 0.5, eps\_m + -1, 1\right), 1\right)}{2}\\
    
    \mathbf{elif}\;x \leq 1.6 \cdot 10^{+24}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;x \leq 9.5 \cdot 10^{+268}:\\
    \;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \left(eps\_m \cdot eps\_m\right)\right)}{2}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if x < 760

      1. Initial program 58.5%

        \[\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 \frac{\color{blue}{e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
      4. Step-by-step derivation
        1. cancel-sign-sub-invN/A

          \[\leadsto \frac{\color{blue}{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)}}}{2} \]
        2. metadata-evalN/A

          \[\leadsto \frac{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)}}{2} \]
        3. *-lft-identityN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{e^{x \cdot \varepsilon - x} + \mathsf{fma}\left(x, \mathsf{fma}\left(\frac{1}{2}, \left(1 + \varepsilon\right) \cdot \mathsf{fma}\left(x, \varepsilon, x\right), \color{blue}{-1 - \varepsilon}\right), 1\right)}{2} \]
        19. lower--.f6489.9

          \[\leadsto \frac{e^{x \cdot \varepsilon - x} + \mathsf{fma}\left(x, \mathsf{fma}\left(0.5, \left(1 + \varepsilon\right) \cdot \mathsf{fma}\left(x, \varepsilon, x\right), \color{blue}{-1 - \varepsilon}\right), 1\right)}{2} \]
      8. Simplified89.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot \frac{1}{2}, -1 + \varepsilon, 1\right) \cdot \color{blue}{\left(-1 + \varepsilon\right)}, 1\right) + \mathsf{fma}\left(x, \mathsf{fma}\left(\frac{1}{2}, \left(1 + \varepsilon\right) \cdot \mathsf{fma}\left(x, \varepsilon, x\right), -1 - \varepsilon\right), 1\right)}{2} \]
        20. lower-+.f6486.3

          \[\leadsto \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot 0.5, -1 + \varepsilon, 1\right) \cdot \color{blue}{\left(-1 + \varepsilon\right)}, 1\right) + \mathsf{fma}\left(x, \mathsf{fma}\left(0.5, \left(1 + \varepsilon\right) \cdot \mathsf{fma}\left(x, \varepsilon, x\right), -1 - \varepsilon\right), 1\right)}{2} \]
      11. Simplified86.3%

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

      if 760 < x < 1.5999999999999999e24 or 9.49999999999999956e268 < 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 x around 0

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

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

          \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot 1 - \color{blue}{\left(\frac{1}{\varepsilon} - 1\right)}}{2} \]
        3. Step-by-step derivation
          1. sub-negN/A

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

            \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot 1 - \left(\frac{1}{\varepsilon} + \color{blue}{-1}\right)}{2} \]
          3. +-commutativeN/A

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

            \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot 1 - \color{blue}{\left(-1 + \frac{1}{\varepsilon}\right)}}{2} \]
          5. lower-/.f6480.6

            \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot 1 - \left(-1 + \color{blue}{\frac{1}{\varepsilon}}\right)}{2} \]
        4. Simplified80.6%

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

        if 1.5999999999999999e24 < x < 9.49999999999999956e268

        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 x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\mathsf{neg}\left(\left(1 - \varepsilon\right) \cdot x\right)} - \left(\frac{1}{\varepsilon} - 1\right) \cdot \mathsf{fma}\left(x, \left(\varepsilon + 1\right) \cdot \mathsf{fma}\left(x \cdot \frac{1}{2}, \color{blue}{\varepsilon + 1}, -1\right), 1\right)}{2} \]
          15. lower-+.f6461.4

            \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot \mathsf{fma}\left(x, \left(\varepsilon + 1\right) \cdot \mathsf{fma}\left(x \cdot 0.5, \color{blue}{\varepsilon + 1}, -1\right), 1\right)}{2} \]
        5. Simplified61.4%

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}\right)}{2} \]
        8. Simplified72.0%

          \[\leadsto \frac{\color{blue}{\left(x \cdot x\right) \cdot \left(0.5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right)}}{2} \]
      5. Recombined 3 regimes into one program.
      6. Final simplification82.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 760:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(0.5, \mathsf{fma}\left(x, \varepsilon, x\right) \cdot \left(\varepsilon + 1\right), -1 - \varepsilon\right), 1\right) + \mathsf{fma}\left(x, \left(\varepsilon + -1\right) \cdot \mathsf{fma}\left(x \cdot 0.5, \varepsilon + -1, 1\right), 1\right)}{2}\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{+24}:\\ \;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{+268}:\\ \;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\ \end{array} \]
      7. Add Preprocessing

      Alternative 14: 77.8% accurate, 4.1× speedup?

      \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} t_0 := \frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\ \mathbf{if}\;x \leq -3.3 \cdot 10^{-159}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot 0.5, \mathsf{fma}\left(eps\_m, eps\_m, \left(1 - eps\_m\right) \cdot \left(1 - eps\_m\right)\right), -1\right), 2\right)}{2}\\ \mathbf{elif}\;x \leq 760:\\ \;\;\;\;\frac{1 + \mathsf{fma}\left(x, \mathsf{fma}\left(0.5, \mathsf{fma}\left(x, eps\_m, x\right) \cdot \left(eps\_m + 1\right), -1 - eps\_m\right), 1\right)}{2}\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{+24}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{+268}:\\ \;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \left(eps\_m \cdot eps\_m\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      eps_m = (fabs.f64 eps)
      (FPCore (x eps_m)
       :precision binary64
       (let* ((t_0 (/ (+ (+ 1.0 (/ 1.0 eps_m)) (+ 1.0 (/ -1.0 eps_m))) 2.0)))
         (if (<= x -3.3e-159)
           (/
            (fma
             x
             (fma (* x 0.5) (fma eps_m eps_m (* (- 1.0 eps_m) (- 1.0 eps_m))) -1.0)
             2.0)
            2.0)
           (if (<= x 760.0)
             (/
              (+
               1.0
               (fma
                x
                (fma 0.5 (* (fma x eps_m x) (+ eps_m 1.0)) (- -1.0 eps_m))
                1.0))
              2.0)
             (if (<= x 1.6e+24)
               t_0
               (if (<= x 9.5e+268)
                 (/ (* (* x x) (* 0.5 (* eps_m eps_m))) 2.0)
                 t_0))))))
      eps_m = fabs(eps);
      double code(double x, double eps_m) {
      	double t_0 = ((1.0 + (1.0 / eps_m)) + (1.0 + (-1.0 / eps_m))) / 2.0;
      	double tmp;
      	if (x <= -3.3e-159) {
      		tmp = fma(x, fma((x * 0.5), fma(eps_m, eps_m, ((1.0 - eps_m) * (1.0 - eps_m))), -1.0), 2.0) / 2.0;
      	} else if (x <= 760.0) {
      		tmp = (1.0 + fma(x, fma(0.5, (fma(x, eps_m, x) * (eps_m + 1.0)), (-1.0 - eps_m)), 1.0)) / 2.0;
      	} else if (x <= 1.6e+24) {
      		tmp = t_0;
      	} else if (x <= 9.5e+268) {
      		tmp = ((x * x) * (0.5 * (eps_m * eps_m))) / 2.0;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      eps_m = abs(eps)
      function code(x, eps_m)
      	t_0 = Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) + Float64(1.0 + Float64(-1.0 / eps_m))) / 2.0)
      	tmp = 0.0
      	if (x <= -3.3e-159)
      		tmp = Float64(fma(x, fma(Float64(x * 0.5), fma(eps_m, eps_m, Float64(Float64(1.0 - eps_m) * Float64(1.0 - eps_m))), -1.0), 2.0) / 2.0);
      	elseif (x <= 760.0)
      		tmp = Float64(Float64(1.0 + fma(x, fma(0.5, Float64(fma(x, eps_m, x) * Float64(eps_m + 1.0)), Float64(-1.0 - eps_m)), 1.0)) / 2.0);
      	elseif (x <= 1.6e+24)
      		tmp = t_0;
      	elseif (x <= 9.5e+268)
      		tmp = Float64(Float64(Float64(x * x) * Float64(0.5 * Float64(eps_m * eps_m))) / 2.0);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      eps_m = N[Abs[eps], $MachinePrecision]
      code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(-1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[x, -3.3e-159], N[(N[(x * N[(N[(x * 0.5), $MachinePrecision] * N[(eps$95$m * eps$95$m + N[(N[(1.0 - eps$95$m), $MachinePrecision] * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] + 2.0), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 760.0], N[(N[(1.0 + N[(x * N[(0.5 * N[(N[(x * eps$95$m + x), $MachinePrecision] * N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision] + N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1.6e+24], t$95$0, If[LessEqual[x, 9.5e+268], N[(N[(N[(x * x), $MachinePrecision] * N[(0.5 * N[(eps$95$m * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], t$95$0]]]]]
      
      \begin{array}{l}
      eps_m = \left|\varepsilon\right|
      
      \\
      \begin{array}{l}
      t_0 := \frac{\left(1 + \frac{1}{eps\_m}\right) + \left(1 + \frac{-1}{eps\_m}\right)}{2}\\
      \mathbf{if}\;x \leq -3.3 \cdot 10^{-159}:\\
      \;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot 0.5, \mathsf{fma}\left(eps\_m, eps\_m, \left(1 - eps\_m\right) \cdot \left(1 - eps\_m\right)\right), -1\right), 2\right)}{2}\\
      
      \mathbf{elif}\;x \leq 760:\\
      \;\;\;\;\frac{1 + \mathsf{fma}\left(x, \mathsf{fma}\left(0.5, \mathsf{fma}\left(x, eps\_m, x\right) \cdot \left(eps\_m + 1\right), -1 - eps\_m\right), 1\right)}{2}\\
      
      \mathbf{elif}\;x \leq 1.6 \cdot 10^{+24}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;x \leq 9.5 \cdot 10^{+268}:\\
      \;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \left(eps\_m \cdot eps\_m\right)\right)}{2}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if x < -3.3000000000000002e-159

        1. Initial program 71.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 \frac{\color{blue}{e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
        4. Step-by-step derivation
          1. cancel-sign-sub-invN/A

            \[\leadsto \frac{\color{blue}{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)}}}{2} \]
          2. metadata-evalN/A

            \[\leadsto \frac{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)}}{2} \]
          3. *-lft-identityN/A

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

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

          \[\leadsto \frac{\color{blue}{e^{x \cdot \varepsilon - x} + e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}}}{2} \]
        6. Taylor expanded in eps around inf

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

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

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

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

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

            \[\leadsto \frac{e^{x \cdot \varepsilon - x} + e^{x \cdot \color{blue}{\left(-\varepsilon\right)}}}{2} \]
        8. Simplified96.4%

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

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

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

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

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

            \[\leadsto \frac{x \cdot \left(\left(\color{blue}{0} \cdot \varepsilon + x \cdot \left(\frac{1}{2} \cdot {\varepsilon}^{2} + \frac{1}{2} \cdot {\left(\varepsilon - 1\right)}^{2}\right)\right) - 1\right) + 2}{2} \]
          5. mul0-lftN/A

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

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

            \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x, x \cdot \left(\frac{1}{2} \cdot {\varepsilon}^{2} + \frac{1}{2} \cdot {\left(\varepsilon - 1\right)}^{2}\right) - 1, 2\right)}}{2} \]
        11. Simplified85.5%

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

        if -3.3000000000000002e-159 < x < 760

        1. Initial program 50.2%

          \[\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 \frac{\color{blue}{e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
        4. Step-by-step derivation
          1. cancel-sign-sub-invN/A

            \[\leadsto \frac{\color{blue}{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)}}}{2} \]
          2. metadata-evalN/A

            \[\leadsto \frac{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)}}{2} \]
          3. *-lft-identityN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{e^{x \cdot \varepsilon - x} + \mathsf{fma}\left(x, \mathsf{fma}\left(\frac{1}{2}, \left(1 + \varepsilon\right) \cdot \mathsf{fma}\left(x, \varepsilon, x\right), \color{blue}{-1 - \varepsilon}\right), 1\right)}{2} \]
          19. lower--.f6492.9

            \[\leadsto \frac{e^{x \cdot \varepsilon - x} + \mathsf{fma}\left(x, \mathsf{fma}\left(0.5, \left(1 + \varepsilon\right) \cdot \mathsf{fma}\left(x, \varepsilon, x\right), \color{blue}{-1 - \varepsilon}\right), 1\right)}{2} \]
        8. Simplified92.9%

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

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

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

          if 760 < x < 1.5999999999999999e24 or 9.49999999999999956e268 < 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 x around 0

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

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

              \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot 1 - \color{blue}{\left(\frac{1}{\varepsilon} - 1\right)}}{2} \]
            3. Step-by-step derivation
              1. sub-negN/A

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

                \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot 1 - \left(\frac{1}{\varepsilon} + \color{blue}{-1}\right)}{2} \]
              3. +-commutativeN/A

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

                \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot 1 - \color{blue}{\left(-1 + \frac{1}{\varepsilon}\right)}}{2} \]
              5. lower-/.f6480.6

                \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot 1 - \left(-1 + \color{blue}{\frac{1}{\varepsilon}}\right)}{2} \]
            4. Simplified80.6%

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

            if 1.5999999999999999e24 < x < 9.49999999999999956e268

            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 x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\mathsf{neg}\left(\left(1 - \varepsilon\right) \cdot x\right)} - \left(\frac{1}{\varepsilon} - 1\right) \cdot \mathsf{fma}\left(x, \left(\varepsilon + 1\right) \cdot \mathsf{fma}\left(x \cdot \frac{1}{2}, \color{blue}{\varepsilon + 1}, -1\right), 1\right)}{2} \]
              15. lower-+.f6461.4

                \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot \mathsf{fma}\left(x, \left(\varepsilon + 1\right) \cdot \mathsf{fma}\left(x \cdot 0.5, \color{blue}{\varepsilon + 1}, -1\right), 1\right)}{2} \]
            5. Simplified61.4%

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}\right)}{2} \]
            8. Simplified72.0%

              \[\leadsto \frac{\color{blue}{\left(x \cdot x\right) \cdot \left(0.5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right)}}{2} \]
          5. Recombined 4 regimes into one program.
          6. Final simplification84.0%

            \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.3 \cdot 10^{-159}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x \cdot 0.5, \mathsf{fma}\left(\varepsilon, \varepsilon, \left(1 - \varepsilon\right) \cdot \left(1 - \varepsilon\right)\right), -1\right), 2\right)}{2}\\ \mathbf{elif}\;x \leq 760:\\ \;\;\;\;\frac{1 + \mathsf{fma}\left(x, \mathsf{fma}\left(0.5, \mathsf{fma}\left(x, \varepsilon, x\right) \cdot \left(\varepsilon + 1\right), -1 - \varepsilon\right), 1\right)}{2}\\ \mathbf{elif}\;x \leq 1.6 \cdot 10^{+24}:\\ \;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{+268}:\\ \;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) + \left(1 + \frac{-1}{\varepsilon}\right)}{2}\\ \end{array} \]
          7. Add Preprocessing

          Alternative 15: 76.9% accurate, 5.5× speedup?

          \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;x \leq 0.038:\\ \;\;\;\;\frac{1 + \mathsf{fma}\left(x, \mathsf{fma}\left(0.5, \mathsf{fma}\left(x, eps\_m, x\right) \cdot \left(eps\_m + 1\right), -1 - eps\_m\right), 1\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \left(eps\_m \cdot eps\_m\right)\right)}{2}\\ \end{array} \end{array} \]
          eps_m = (fabs.f64 eps)
          (FPCore (x eps_m)
           :precision binary64
           (if (<= x 0.038)
             (/
              (+
               1.0
               (fma x (fma 0.5 (* (fma x eps_m x) (+ eps_m 1.0)) (- -1.0 eps_m)) 1.0))
              2.0)
             (/ (* (* x x) (* 0.5 (* eps_m eps_m))) 2.0)))
          eps_m = fabs(eps);
          double code(double x, double eps_m) {
          	double tmp;
          	if (x <= 0.038) {
          		tmp = (1.0 + fma(x, fma(0.5, (fma(x, eps_m, x) * (eps_m + 1.0)), (-1.0 - eps_m)), 1.0)) / 2.0;
          	} else {
          		tmp = ((x * x) * (0.5 * (eps_m * eps_m))) / 2.0;
          	}
          	return tmp;
          }
          
          eps_m = abs(eps)
          function code(x, eps_m)
          	tmp = 0.0
          	if (x <= 0.038)
          		tmp = Float64(Float64(1.0 + fma(x, fma(0.5, Float64(fma(x, eps_m, x) * Float64(eps_m + 1.0)), Float64(-1.0 - eps_m)), 1.0)) / 2.0);
          	else
          		tmp = Float64(Float64(Float64(x * x) * Float64(0.5 * Float64(eps_m * eps_m))) / 2.0);
          	end
          	return tmp
          end
          
          eps_m = N[Abs[eps], $MachinePrecision]
          code[x_, eps$95$m_] := If[LessEqual[x, 0.038], N[(N[(1.0 + N[(x * N[(0.5 * N[(N[(x * eps$95$m + x), $MachinePrecision] * N[(eps$95$m + 1.0), $MachinePrecision]), $MachinePrecision] + N[(-1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(x * x), $MachinePrecision] * N[(0.5 * N[(eps$95$m * eps$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]
          
          \begin{array}{l}
          eps_m = \left|\varepsilon\right|
          
          \\
          \begin{array}{l}
          \mathbf{if}\;x \leq 0.038:\\
          \;\;\;\;\frac{1 + \mathsf{fma}\left(x, \mathsf{fma}\left(0.5, \mathsf{fma}\left(x, eps\_m, x\right) \cdot \left(eps\_m + 1\right), -1 - eps\_m\right), 1\right)}{2}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \left(eps\_m \cdot eps\_m\right)\right)}{2}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if x < 0.0379999999999999991

            1. Initial program 58.3%

              \[\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 \frac{\color{blue}{e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
            4. Step-by-step derivation
              1. cancel-sign-sub-invN/A

                \[\leadsto \frac{\color{blue}{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)}}}{2} \]
              2. metadata-evalN/A

                \[\leadsto \frac{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)}}{2} \]
              3. *-lft-identityN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{e^{x \cdot \varepsilon - x} + \mathsf{fma}\left(x, \mathsf{fma}\left(\frac{1}{2}, \left(1 + \varepsilon\right) \cdot \mathsf{fma}\left(x, \varepsilon, x\right), \color{blue}{-1 - \varepsilon}\right), 1\right)}{2} \]
              19. lower--.f6489.8

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

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

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

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

              if 0.0379999999999999991 < 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 x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\mathsf{neg}\left(\left(1 - \varepsilon\right) \cdot x\right)} - \left(\frac{1}{\varepsilon} - 1\right) \cdot \mathsf{fma}\left(x, \left(\varepsilon + 1\right) \cdot \mathsf{fma}\left(x \cdot \frac{1}{2}, \color{blue}{\varepsilon + 1}, -1\right), 1\right)}{2} \]
                15. lower-+.f6450.2

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{\left(x \cdot x\right) \cdot \left(0.5 \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}\right)}{2} \]
              8. Simplified58.1%

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

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

            Alternative 16: 61.8% accurate, 10.9× speedup?

            \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -460:\\ \;\;\;\;\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} \]
            eps_m = (fabs.f64 eps)
            (FPCore (x eps_m)
             :precision binary64
             (if (<= x -460.0)
               (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)))
            eps_m = fabs(eps);
            double code(double x, double eps_m) {
            	double tmp;
            	if (x <= -460.0) {
            		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;
            }
            
            eps_m = abs(eps)
            function code(x, eps_m)
            	tmp = 0.0
            	if (x <= -460.0)
            		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
            
            eps_m = N[Abs[eps], $MachinePrecision]
            code[x_, eps$95$m_] := If[LessEqual[x, -460.0], 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}
            eps_m = \left|\varepsilon\right|
            
            \\
            \begin{array}{l}
            \mathbf{if}\;x \leq -460:\\
            \;\;\;\;\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 < -460

              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 \frac{\color{blue}{\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)}}{2} \]
              4. Step-by-step derivation
                1. mul-1-negN/A

                  \[\leadsto \frac{\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)}{2} \]
                2. unsub-negN/A

                  \[\leadsto \frac{\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)}}{2} \]
                3. associate-+l-N/A

                  \[\leadsto \frac{\color{blue}{\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)}}}{2} \]
                4. distribute-rgt1-inN/A

                  \[\leadsto \frac{\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)}}{2} \]
                5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\left(x + \color{blue}{2}\right) + x\right)}{2} \]
                14. lower-+.f640.0

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left(x, x \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot x\right) - 1, 1\right)} \]
                4. Simplified63.5%

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

                if -460 < x

                1. Initial program 66.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 \frac{\color{blue}{\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)}}{2} \]
                4. Step-by-step derivation
                  1. mul-1-negN/A

                    \[\leadsto \frac{\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)}{2} \]
                  2. unsub-negN/A

                    \[\leadsto \frac{\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)}}{2} \]
                  3. associate-+l-N/A

                    \[\leadsto \frac{\color{blue}{\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)}}}{2} \]
                  4. distribute-rgt1-inN/A

                    \[\leadsto \frac{\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)}}{2} \]
                  5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\left(x + \color{blue}{2}\right) + x\right)}{2} \]
                  14. lower-+.f6467.4

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

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{\mathsf{fma}\left(x \cdot x, x \cdot \frac{2}{3} + \color{blue}{-1}, 2\right)}{2} \]
                  8. lower-fma.f6461.4

                    \[\leadsto \frac{\mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, 0.6666666666666666, -1\right)}, 2\right)}{2} \]
                8. Simplified61.4%

                  \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, 0.6666666666666666, -1\right), 2\right)}}{2} \]
                9. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{2}, x \cdot \left(\frac{1}{3} - \frac{1}{2} \cdot \frac{1}{x}\right), 1\right)} \]
                11. Simplified61.4%

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

              Alternative 17: 59.5% accurate, 11.4× speedup?

              \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -460:\\ \;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.5, -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} \]
              eps_m = (fabs.f64 eps)
              (FPCore (x eps_m)
               :precision binary64
               (if (<= x -460.0)
                 (fma x (fma x 0.5 -1.0) 1.0)
                 (fma (* x x) (fma x 0.3333333333333333 -0.5) 1.0)))
              eps_m = fabs(eps);
              double code(double x, double eps_m) {
              	double tmp;
              	if (x <= -460.0) {
              		tmp = fma(x, fma(x, 0.5, -1.0), 1.0);
              	} else {
              		tmp = fma((x * x), fma(x, 0.3333333333333333, -0.5), 1.0);
              	}
              	return tmp;
              }
              
              eps_m = abs(eps)
              function code(x, eps_m)
              	tmp = 0.0
              	if (x <= -460.0)
              		tmp = fma(x, fma(x, 0.5, -1.0), 1.0);
              	else
              		tmp = fma(Float64(x * x), fma(x, 0.3333333333333333, -0.5), 1.0);
              	end
              	return tmp
              end
              
              eps_m = N[Abs[eps], $MachinePrecision]
              code[x_, eps$95$m_] := If[LessEqual[x, -460.0], N[(x * N[(x * 0.5 + -1.0), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(x * 0.3333333333333333 + -0.5), $MachinePrecision] + 1.0), $MachinePrecision]]
              
              \begin{array}{l}
              eps_m = \left|\varepsilon\right|
              
              \\
              \begin{array}{l}
              \mathbf{if}\;x \leq -460:\\
              \;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.5, -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 < -460

                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 \frac{\color{blue}{\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)}}{2} \]
                4. Step-by-step derivation
                  1. mul-1-negN/A

                    \[\leadsto \frac{\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)}{2} \]
                  2. unsub-negN/A

                    \[\leadsto \frac{\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)}}{2} \]
                  3. associate-+l-N/A

                    \[\leadsto \frac{\color{blue}{\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)}}}{2} \]
                  4. distribute-rgt1-inN/A

                    \[\leadsto \frac{\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)}}{2} \]
                  5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\left(x + \color{blue}{2}\right) + x\right)}{2} \]
                  14. lower-+.f640.0

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.5, -1\right)}, 1\right) \]
                  4. Simplified51.0%

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

                  if -460 < x

                  1. Initial program 66.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 \frac{\color{blue}{\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)}}{2} \]
                  4. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \frac{\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)}{2} \]
                    2. unsub-negN/A

                      \[\leadsto \frac{\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)}}{2} \]
                    3. associate-+l-N/A

                      \[\leadsto \frac{\color{blue}{\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)}}}{2} \]
                    4. distribute-rgt1-inN/A

                      \[\leadsto \frac{\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)}}{2} \]
                    5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\left(x + \color{blue}{2}\right) + x\right)}{2} \]
                    14. lower-+.f6467.4

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

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{\mathsf{fma}\left(x \cdot x, x \cdot \frac{2}{3} + \color{blue}{-1}, 2\right)}{2} \]
                    8. lower-fma.f6461.4

                      \[\leadsto \frac{\mathsf{fma}\left(x \cdot x, \color{blue}{\mathsf{fma}\left(x, 0.6666666666666666, -1\right)}, 2\right)}{2} \]
                  8. Simplified61.4%

                    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x, 0.6666666666666666, -1\right), 2\right)}}{2} \]
                  9. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{2}, x \cdot \left(\frac{1}{3} - \frac{1}{2} \cdot \frac{1}{x}\right), 1\right)} \]
                  11. Simplified61.4%

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

                Alternative 18: 56.8% accurate, 21.0× speedup?

                \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.5, -1\right), 1\right) \end{array} \]
                eps_m = (fabs.f64 eps)
                (FPCore (x eps_m) :precision binary64 (fma x (fma x 0.5 -1.0) 1.0))
                eps_m = fabs(eps);
                double code(double x, double eps_m) {
                	return fma(x, fma(x, 0.5, -1.0), 1.0);
                }
                
                eps_m = abs(eps)
                function code(x, eps_m)
                	return fma(x, fma(x, 0.5, -1.0), 1.0)
                end
                
                eps_m = N[Abs[eps], $MachinePrecision]
                code[x_, eps$95$m_] := N[(x * N[(x * 0.5 + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]
                
                \begin{array}{l}
                eps_m = \left|\varepsilon\right|
                
                \\
                \mathsf{fma}\left(x, \mathsf{fma}\left(x, 0.5, -1\right), 1\right)
                \end{array}
                
                Derivation
                1. Initial program 70.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 \frac{\color{blue}{\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)}}{2} \]
                4. Step-by-step derivation
                  1. mul-1-negN/A

                    \[\leadsto \frac{\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)}{2} \]
                  2. unsub-negN/A

                    \[\leadsto \frac{\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)}}{2} \]
                  3. associate-+l-N/A

                    \[\leadsto \frac{\color{blue}{\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)}}}{2} \]
                  4. distribute-rgt1-inN/A

                    \[\leadsto \frac{\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)}}{2} \]
                  5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\left(x + \color{blue}{2}\right) + x\right)}{2} \]
                  14. lower-+.f6459.2

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(x, 0.5, -1\right)}, 1\right) \]
                  4. Simplified57.9%

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

                  Alternative 19: 43.8% accurate, 273.0× speedup?

                  \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ 1 \end{array} \]
                  eps_m = (fabs.f64 eps)
                  (FPCore (x eps_m) :precision binary64 1.0)
                  eps_m = fabs(eps);
                  double code(double x, double eps_m) {
                  	return 1.0;
                  }
                  
                  eps_m = abs(eps)
                  real(8) function code(x, eps_m)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: eps_m
                      code = 1.0d0
                  end function
                  
                  eps_m = Math.abs(eps);
                  public static double code(double x, double eps_m) {
                  	return 1.0;
                  }
                  
                  eps_m = math.fabs(eps)
                  def code(x, eps_m):
                  	return 1.0
                  
                  eps_m = abs(eps)
                  function code(x, eps_m)
                  	return 1.0
                  end
                  
                  eps_m = abs(eps);
                  function tmp = code(x, eps_m)
                  	tmp = 1.0;
                  end
                  
                  eps_m = N[Abs[eps], $MachinePrecision]
                  code[x_, eps$95$m_] := 1.0
                  
                  \begin{array}{l}
                  eps_m = \left|\varepsilon\right|
                  
                  \\
                  1
                  \end{array}
                  
                  Derivation
                  1. Initial program 70.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 \frac{\color{blue}{\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)}}{2} \]
                  4. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \frac{\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)}{2} \]
                    2. unsub-negN/A

                      \[\leadsto \frac{\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)}}{2} \]
                    3. associate-+l-N/A

                      \[\leadsto \frac{\color{blue}{\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)}}}{2} \]
                    4. distribute-rgt1-inN/A

                      \[\leadsto \frac{\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)}}{2} \]
                    5. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{e^{\mathsf{neg}\left(x\right)} \cdot \left(\left(x + \color{blue}{2}\right) + x\right)}{2} \]
                    14. lower-+.f6459.2

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

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

                    \[\leadsto \frac{\color{blue}{2 + -1 \cdot {x}^{2}}}{2} \]
                  7. Step-by-step derivation
                    1. mul-1-negN/A

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

                      \[\leadsto \frac{\color{blue}{2 - {x}^{2}}}{2} \]
                    3. lower--.f64N/A

                      \[\leadsto \frac{\color{blue}{2 - {x}^{2}}}{2} \]
                    4. unpow2N/A

                      \[\leadsto \frac{2 - \color{blue}{x \cdot x}}{2} \]
                    5. lower-*.f6443.4

                      \[\leadsto \frac{2 - \color{blue}{x \cdot x}}{2} \]
                  8. Simplified43.4%

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

                    \[\leadsto \color{blue}{1} \]
                  10. Step-by-step derivation
                    1. Simplified44.2%

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

                    Reproduce

                    ?
                    herbie shell --seed 2024215 
                    (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))