NMSE Section 6.1 mentioned, A

Percentage Accurate: 73.6% → 98.7%
Time: 10.0s
Alternatives: 10
Speedup: 1.9×

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 10 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.6% 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: 98.7% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eps < 7.5e12

    1. Initial program 60.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 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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(1 + x, e^{-x}, \frac{\color{blue}{1 + x}}{e^{x}}\right)}{2} \]
      18. lower-exp.f6471.9

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 2: 77.5% accurate, 1.1× speedup?

    \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;eps\_m \leq 82000000000000:\\ \;\;\;\;\frac{\mathsf{fma}\left(1 + x, e^{-x}, \frac{1 + x}{e^{x}}\right)}{2}\\ \mathbf{elif}\;eps\_m \leq 5.6 \cdot 10^{+125}:\\ \;\;\;\;\frac{\frac{eps\_m - -1}{eps\_m} - \left(-e^{-\mathsf{fma}\left(x, eps\_m, x\right)}\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(1 + {eps\_m}^{-1}\right) \cdot e^{x \cdot eps\_m} - -1}{2}\\ \end{array} \end{array} \]
    eps_m = (fabs.f64 eps)
    (FPCore (x eps_m)
     :precision binary64
     (if (<= eps_m 82000000000000.0)
       (/ (fma (+ 1.0 x) (exp (- x)) (/ (+ 1.0 x) (exp x))) 2.0)
       (if (<= eps_m 5.6e+125)
         (/ (- (/ (- eps_m -1.0) eps_m) (- (exp (- (fma x eps_m x))))) 2.0)
         (/ (- (* (+ 1.0 (pow eps_m -1.0)) (exp (* x eps_m))) -1.0) 2.0))))
    eps_m = fabs(eps);
    double code(double x, double eps_m) {
    	double tmp;
    	if (eps_m <= 82000000000000.0) {
    		tmp = fma((1.0 + x), exp(-x), ((1.0 + x) / exp(x))) / 2.0;
    	} else if (eps_m <= 5.6e+125) {
    		tmp = (((eps_m - -1.0) / eps_m) - -exp(-fma(x, eps_m, x))) / 2.0;
    	} else {
    		tmp = (((1.0 + pow(eps_m, -1.0)) * exp((x * eps_m))) - -1.0) / 2.0;
    	}
    	return tmp;
    }
    
    eps_m = abs(eps)
    function code(x, eps_m)
    	tmp = 0.0
    	if (eps_m <= 82000000000000.0)
    		tmp = Float64(fma(Float64(1.0 + x), exp(Float64(-x)), Float64(Float64(1.0 + x) / exp(x))) / 2.0);
    	elseif (eps_m <= 5.6e+125)
    		tmp = Float64(Float64(Float64(Float64(eps_m - -1.0) / eps_m) - Float64(-exp(Float64(-fma(x, eps_m, x))))) / 2.0);
    	else
    		tmp = Float64(Float64(Float64(Float64(1.0 + (eps_m ^ -1.0)) * exp(Float64(x * 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, 82000000000000.0], N[(N[(N[(1.0 + x), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision] + N[(N[(1.0 + x), $MachinePrecision] / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps$95$m, 5.6e+125], N[(N[(N[(N[(eps$95$m - -1.0), $MachinePrecision] / eps$95$m), $MachinePrecision] - (-N[Exp[(-N[(x * eps$95$m + x), $MachinePrecision])], $MachinePrecision])), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[(1.0 + N[Power[eps$95$m, -1.0], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision]]]
    
    \begin{array}{l}
    eps_m = \left|\varepsilon\right|
    
    \\
    \begin{array}{l}
    \mathbf{if}\;eps\_m \leq 82000000000000:\\
    \;\;\;\;\frac{\mathsf{fma}\left(1 + x, e^{-x}, \frac{1 + x}{e^{x}}\right)}{2}\\
    
    \mathbf{elif}\;eps\_m \leq 5.6 \cdot 10^{+125}:\\
    \;\;\;\;\frac{\frac{eps\_m - -1}{eps\_m} - \left(-e^{-\mathsf{fma}\left(x, eps\_m, x\right)}\right)}{2}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\left(1 + {eps\_m}^{-1}\right) \cdot e^{x \cdot eps\_m} - -1}{2}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if eps < 8.2e13

      1. Initial program 60.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 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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\mathsf{fma}\left(1 + x, e^{-x}, \frac{\color{blue}{1 + x}}{e^{x}}\right)}{2} \]
        18. lower-exp.f6471.9

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

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

      if 8.2e13 < eps < 5.6000000000000002e125

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 3: 77.5% accurate, 1.1× speedup?

        \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;eps\_m \leq 82000000000000:\\ \;\;\;\;\frac{e^{-x} \cdot \left(\left(x + 1\right) + \left(x + 1\right)\right)}{2}\\ \mathbf{elif}\;eps\_m \leq 5.6 \cdot 10^{+125}:\\ \;\;\;\;\frac{\frac{eps\_m - -1}{eps\_m} - \left(-e^{-\mathsf{fma}\left(x, eps\_m, x\right)}\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(1 + {eps\_m}^{-1}\right) \cdot e^{x \cdot eps\_m} - -1}{2}\\ \end{array} \end{array} \]
        eps_m = (fabs.f64 eps)
        (FPCore (x eps_m)
         :precision binary64
         (if (<= eps_m 82000000000000.0)
           (/ (* (exp (- x)) (+ (+ x 1.0) (+ x 1.0))) 2.0)
           (if (<= eps_m 5.6e+125)
             (/ (- (/ (- eps_m -1.0) eps_m) (- (exp (- (fma x eps_m x))))) 2.0)
             (/ (- (* (+ 1.0 (pow eps_m -1.0)) (exp (* x eps_m))) -1.0) 2.0))))
        eps_m = fabs(eps);
        double code(double x, double eps_m) {
        	double tmp;
        	if (eps_m <= 82000000000000.0) {
        		tmp = (exp(-x) * ((x + 1.0) + (x + 1.0))) / 2.0;
        	} else if (eps_m <= 5.6e+125) {
        		tmp = (((eps_m - -1.0) / eps_m) - -exp(-fma(x, eps_m, x))) / 2.0;
        	} else {
        		tmp = (((1.0 + pow(eps_m, -1.0)) * exp((x * eps_m))) - -1.0) / 2.0;
        	}
        	return tmp;
        }
        
        eps_m = abs(eps)
        function code(x, eps_m)
        	tmp = 0.0
        	if (eps_m <= 82000000000000.0)
        		tmp = Float64(Float64(exp(Float64(-x)) * Float64(Float64(x + 1.0) + Float64(x + 1.0))) / 2.0);
        	elseif (eps_m <= 5.6e+125)
        		tmp = Float64(Float64(Float64(Float64(eps_m - -1.0) / eps_m) - Float64(-exp(Float64(-fma(x, eps_m, x))))) / 2.0);
        	else
        		tmp = Float64(Float64(Float64(Float64(1.0 + (eps_m ^ -1.0)) * exp(Float64(x * 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, 82000000000000.0], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(N[(x + 1.0), $MachinePrecision] + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[eps$95$m, 5.6e+125], N[(N[(N[(N[(eps$95$m - -1.0), $MachinePrecision] / eps$95$m), $MachinePrecision] - (-N[Exp[(-N[(x * eps$95$m + x), $MachinePrecision])], $MachinePrecision])), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[(1.0 + N[Power[eps$95$m, -1.0], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision] / 2.0), $MachinePrecision]]]
        
        \begin{array}{l}
        eps_m = \left|\varepsilon\right|
        
        \\
        \begin{array}{l}
        \mathbf{if}\;eps\_m \leq 82000000000000:\\
        \;\;\;\;\frac{e^{-x} \cdot \left(\left(x + 1\right) + \left(x + 1\right)\right)}{2}\\
        
        \mathbf{elif}\;eps\_m \leq 5.6 \cdot 10^{+125}:\\
        \;\;\;\;\frac{\frac{eps\_m - -1}{eps\_m} - \left(-e^{-\mathsf{fma}\left(x, eps\_m, x\right)}\right)}{2}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\left(1 + {eps\_m}^{-1}\right) \cdot e^{x \cdot eps\_m} - -1}{2}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if eps < 8.2e13

          1. Initial program 60.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 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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\mathsf{fma}\left(1 + x, e^{-x}, \frac{\color{blue}{1 + x}}{e^{x}}\right)}{2} \]
            18. lower-exp.f6471.9

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

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

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

            if 8.2e13 < eps < 5.6000000000000002e125

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 4: 64.5% accurate, 1.2× speedup?

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

                1. Initial program 60.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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{\mathsf{fma}\left(1 + x, e^{-x}, \frac{\color{blue}{1 + x}}{e^{x}}\right)}{2} \]
                  18. lower-exp.f6461.9

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

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

                  \[\leadsto \frac{2 + \color{blue}{-1 \cdot {x}^{2}}}{2} \]
                7. Step-by-step derivation
                  1. Applied rewrites61.4%

                    \[\leadsto \frac{2 - \color{blue}{x \cdot x}}{2} \]
                  2. Step-by-step derivation
                    1. Applied rewrites72.9%

                      \[\leadsto \frac{2 - \left|\left(-x\right) \cdot -1\right| \cdot x}{2} \]

                    if 1.4800000000000001e-5 < x < 2.3000000000000001e153

                    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^{-\left(1 - \varepsilon\right) \cdot x} - \color{blue}{\left(\frac{1}{\varepsilon} - 1\right)}}{2} \]
                    4. Step-by-step derivation
                      1. lower--.f64N/A

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

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

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

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

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

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

                        \[\leadsto \frac{\left(\color{blue}{\frac{1}{\varepsilon}} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
                    8. Applied rewrites51.6%

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

                    if 2.3000000000000001e153 < x

                    1. Initial program 100.0%

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

                      \[\leadsto \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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \frac{\mathsf{fma}\left(1 + x, e^{-x}, \frac{\color{blue}{1 + x}}{e^{x}}\right)}{2} \]
                      18. lower-exp.f6440.9

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

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

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

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.48 \cdot 10^{-5}:\\ \;\;\;\;\frac{2 - \left|x\right| \cdot x}{2}\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{+153}:\\ \;\;\;\;\frac{\left({\varepsilon}^{-1} + 1\right) - \left({\varepsilon}^{-1} - 1\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.6666666666666666, x, -1\right), x \cdot x, 2\right)}{2}\\ \end{array} \]
                    10. Add Preprocessing

                    Alternative 5: 64.6% accurate, 1.2× speedup?

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

                      1. Initial program 61.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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \frac{\mathsf{fma}\left(1 + x, e^{-x}, \frac{\color{blue}{1 + x}}{e^{x}}\right)}{2} \]
                        18. lower-exp.f6461.6

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

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

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

                          \[\leadsto \frac{2 - \color{blue}{x \cdot x}}{2} \]
                        2. Step-by-step derivation
                          1. Applied rewrites72.5%

                            \[\leadsto \frac{2 - \left|\left(-x\right) \cdot -1\right| \cdot x}{2} \]

                          if 1.3999999999999999 < x < 2.3000000000000001e153

                          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^{-\left(1 - \varepsilon\right) \cdot x} - \color{blue}{\left(\frac{1}{\varepsilon} - 1\right)}}{2} \]
                          4. Step-by-step derivation
                            1. lower--.f64N/A

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

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

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

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

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

                              \[\leadsto \frac{\color{blue}{\left(\frac{1}{\varepsilon} + 1\right)} - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
                            3. lower-/.f6452.9

                              \[\leadsto \frac{\left(\color{blue}{\frac{1}{\varepsilon}} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
                          8. Applied rewrites52.9%

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

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

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

                            if 2.3000000000000001e153 < x

                            1. Initial program 100.0%

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

                              \[\leadsto \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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \frac{\mathsf{fma}\left(1 + x, e^{-x}, \frac{\color{blue}{1 + x}}{e^{x}}\right)}{2} \]
                              18. lower-exp.f6440.9

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

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

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

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

                              \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 1.4:\\ \;\;\;\;\frac{2 - \left|x\right| \cdot x}{2}\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{+153}:\\ \;\;\;\;\frac{{\varepsilon}^{-1} - \left({\varepsilon}^{-1} - 1\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.6666666666666666, x, -1\right), x \cdot x, 2\right)}{2}\\ \end{array} \]
                            10. Add Preprocessing

                            Alternative 6: 78.1% accurate, 1.9× speedup?

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

                              1. Initial program 60.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 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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \frac{\mathsf{fma}\left(1 + x, e^{-x}, \frac{\color{blue}{1 + x}}{e^{x}}\right)}{2} \]
                                18. lower-exp.f6471.9

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \frac{\frac{\color{blue}{\varepsilon - -1}}{\varepsilon} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)}{2} \]
                                  4. Applied rewrites61.3%

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

                                Alternative 7: 71.6% accurate, 2.2× speedup?

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

                                  1. Initial program 67.4%

                                    \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
                                  2. Add Preprocessing
                                  3. Taylor expanded in eps around 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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \frac{\mathsf{fma}\left(1 + x, e^{-x}, \frac{\color{blue}{1 + x}}{e^{x}}\right)}{2} \]
                                    18. lower-exp.f6460.5

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

                                    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(1 + x, e^{-x}, \frac{1 + x}{e^{x}}\right)}}{2} \]
                                  6. Step-by-step derivation
                                    1. Applied rewrites60.5%

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

                                      \[\leadsto \frac{e^{-x} \cdot 2}{2} \]
                                    3. Step-by-step derivation
                                      1. Applied rewrites73.7%

                                        \[\leadsto \frac{e^{-x} \cdot 2}{2} \]

                                      if 4e153 < x

                                      1. Initial program 100.0%

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

                                        \[\leadsto \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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          \[\leadsto \frac{\mathsf{fma}\left(1 + x, e^{-x}, \frac{\color{blue}{1 + x}}{e^{x}}\right)}{2} \]
                                        18. lower-exp.f6440.9

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

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

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

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

                                      Alternative 8: 60.2% accurate, 7.8× speedup?

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

                                        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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                            \[\leadsto \frac{\mathsf{fma}\left(1 + x, e^{-x}, \frac{\color{blue}{1 + x}}{e^{x}}\right)}{2} \]
                                          18. lower-exp.f640.0

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

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

                                          \[\leadsto \frac{2 + \color{blue}{-1 \cdot {x}^{2}}}{2} \]
                                        7. Step-by-step derivation
                                          1. Applied rewrites0.1%

                                            \[\leadsto \frac{2 - \color{blue}{x \cdot x}}{2} \]
                                          2. Step-by-step derivation
                                            1. Applied rewrites67.5%

                                              \[\leadsto \frac{2 - \left|\left(-x\right) \cdot -1\right| \cdot x}{2} \]

                                            if -3500 < x

                                            1. Initial program 67.1%

                                              \[\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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                \[\leadsto \frac{\mathsf{fma}\left(1 + x, e^{-x}, \frac{\color{blue}{1 + x}}{e^{x}}\right)}{2} \]
                                              18. lower-exp.f6466.5

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

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

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

                                                \[\leadsto \frac{\mathsf{fma}\left(\mathsf{fma}\left(0.6666666666666666, x, -1\right), \color{blue}{x \cdot x}, 2\right)}{2} \]
                                            8. Recombined 2 regimes into one program.
                                            9. Final simplification62.6%

                                              \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3500:\\ \;\;\;\;\frac{2 - \left|x\right| \cdot x}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.6666666666666666, x, -1\right), x \cdot x, 2\right)}{2}\\ \end{array} \]
                                            10. Add Preprocessing

                                            Alternative 9: 50.8% accurate, 12.4× speedup?

                                            \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \frac{2 - \left|x\right| \cdot x}{2} \end{array} \]
                                            eps_m = (fabs.f64 eps)
                                            (FPCore (x eps_m) :precision binary64 (/ (- 2.0 (* (fabs x) x)) 2.0))
                                            eps_m = fabs(eps);
                                            double code(double x, double eps_m) {
                                            	return (2.0 - (fabs(x) * x)) / 2.0;
                                            }
                                            
                                            eps_m = abs(eps)
                                            real(8) function code(x, eps_m)
                                                real(8), intent (in) :: x
                                                real(8), intent (in) :: eps_m
                                                code = (2.0d0 - (abs(x) * x)) / 2.0d0
                                            end function
                                            
                                            eps_m = Math.abs(eps);
                                            public static double code(double x, double eps_m) {
                                            	return (2.0 - (Math.abs(x) * x)) / 2.0;
                                            }
                                            
                                            eps_m = math.fabs(eps)
                                            def code(x, eps_m):
                                            	return (2.0 - (math.fabs(x) * x)) / 2.0
                                            
                                            eps_m = abs(eps)
                                            function code(x, eps_m)
                                            	return Float64(Float64(2.0 - Float64(abs(x) * x)) / 2.0)
                                            end
                                            
                                            eps_m = abs(eps);
                                            function tmp = code(x, eps_m)
                                            	tmp = (2.0 - (abs(x) * x)) / 2.0;
                                            end
                                            
                                            eps_m = N[Abs[eps], $MachinePrecision]
                                            code[x_, eps$95$m_] := N[(N[(2.0 - N[(N[Abs[x], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
                                            
                                            \begin{array}{l}
                                            eps_m = \left|\varepsilon\right|
                                            
                                            \\
                                            \frac{2 - \left|x\right| \cdot x}{2}
                                            \end{array}
                                            
                                            Derivation
                                            1. Initial program 71.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 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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                \[\leadsto \frac{\mathsf{fma}\left(1 + x, e^{-x}, \frac{\color{blue}{1 + x}}{e^{x}}\right)}{2} \]
                                              18. lower-exp.f6458.2

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

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

                                              \[\leadsto \frac{2 + \color{blue}{-1 \cdot {x}^{2}}}{2} \]
                                            7. Step-by-step derivation
                                              1. Applied rewrites45.4%

                                                \[\leadsto \frac{2 - \color{blue}{x \cdot x}}{2} \]
                                              2. Step-by-step derivation
                                                1. Applied rewrites53.8%

                                                  \[\leadsto \frac{2 - \left|\left(-x\right) \cdot -1\right| \cdot x}{2} \]
                                                2. Final simplification53.8%

                                                  \[\leadsto \frac{2 - \left|x\right| \cdot x}{2} \]
                                                3. Add Preprocessing

                                                Alternative 10: 43.9% 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 71.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{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \color{blue}{-1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}}}{2} \]
                                                4. Step-by-step derivation
                                                  1. exp-negN/A

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

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

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

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

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

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

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

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

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

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

                                                  \[\leadsto \color{blue}{1} \]
                                                7. Step-by-step derivation
                                                  1. Applied rewrites46.3%

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

                                                  Reproduce

                                                  ?
                                                  herbie shell --seed 2024305 
                                                  (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))