NMSE Section 6.1 mentioned, A

Percentage Accurate: 73.5% → 99.9%
Time: 9.3s
Alternatives: 13
Speedup: 0.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 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.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 0.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot e^{-\left(-x\right) \cdot \varepsilon} - \frac{-1}{e^{\mathsf{fma}\left(x, \varepsilon, x\right)}}}{2}\\


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

    1. Initial program 63.9%

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

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

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

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

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

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

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

      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 eps around inf

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

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

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

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

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

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

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

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

    Alternative 2: 78.8% accurate, 0.5× speedup?

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

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

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

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

        \[\leadsto \color{blue}{\left(e^{-x} \cdot \left(\left(\left(1 + x\right) - -1\right) + x\right)\right) \cdot 0.5} \]
      6. Step-by-step derivation
        1. Applied rewrites99.9%

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

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

        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{\color{blue}{\left(1 + \frac{1}{\varepsilon}\right)} - \frac{-1}{e^{\mathsf{fma}\left(x, \varepsilon, x\right)}}}{2} \]
        7. Step-by-step derivation
          1. *-inversesN/A

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

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

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

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

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

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

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

      Alternative 3: 76.3% accurate, 0.5× speedup?

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

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

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

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

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

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

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

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

              Alternative 4: 70.6% accurate, 1.1× speedup?

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

                1. Initial program 100.0%

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]
                    2. Step-by-step derivation
                      1. Applied rewrites100.0%

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

                      if -1 < x < 240

                      1. Initial program 60.7%

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

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

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

                        if 240 < x < 2.5000000000000002e49

                        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

                              if 2.5000000000000002e49 < x < 1.62e180

                              1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

                              if 1.62e180 < x

                              1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{-x}{e^{x}}\\ \mathbf{elif}\;x \leq 240:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{+49}:\\ \;\;\;\;e^{x} \cdot x\\ \mathbf{elif}\;x \leq 1.62 \cdot 10^{+180}:\\ \;\;\;\;\frac{\left({\varepsilon}^{-1} + 1\right) - \left({\varepsilon}^{-1} - 1\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x\\ \end{array} \]
                                  6. Add Preprocessing

                                  Alternative 5: 66.5% accurate, 1.1× speedup?

                                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 240:\\ \;\;\;\;\mathsf{fma}\left(\left|0.3333333333333333 \cdot x\right| - 0.5, x \cdot x, 1\right)\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{+49}:\\ \;\;\;\;e^{x} \cdot x\\ \mathbf{elif}\;x \leq 1.62 \cdot 10^{+180}:\\ \;\;\;\;\frac{\left({\varepsilon}^{-1} + 1\right) - \left({\varepsilon}^{-1} - 1\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x\\ \end{array} \end{array} \]
                                  (FPCore (x eps)
                                   :precision binary64
                                   (if (<= x 240.0)
                                     (fma (- (fabs (* 0.3333333333333333 x)) 0.5) (* x x) 1.0)
                                     (if (<= x 2.5e+49)
                                       (* (exp x) x)
                                       (if (<= x 1.62e+180)
                                         (/ (- (+ (pow eps -1.0) 1.0) (- (pow eps -1.0) 1.0)) 2.0)
                                         (* (fma (- (* 0.5 x) 1.0) x 1.0) x)))))
                                  double code(double x, double eps) {
                                  	double tmp;
                                  	if (x <= 240.0) {
                                  		tmp = fma((fabs((0.3333333333333333 * x)) - 0.5), (x * x), 1.0);
                                  	} else if (x <= 2.5e+49) {
                                  		tmp = exp(x) * x;
                                  	} else if (x <= 1.62e+180) {
                                  		tmp = ((pow(eps, -1.0) + 1.0) - (pow(eps, -1.0) - 1.0)) / 2.0;
                                  	} else {
                                  		tmp = fma(((0.5 * x) - 1.0), x, 1.0) * x;
                                  	}
                                  	return tmp;
                                  }
                                  
                                  function code(x, eps)
                                  	tmp = 0.0
                                  	if (x <= 240.0)
                                  		tmp = fma(Float64(abs(Float64(0.3333333333333333 * x)) - 0.5), Float64(x * x), 1.0);
                                  	elseif (x <= 2.5e+49)
                                  		tmp = Float64(exp(x) * x);
                                  	elseif (x <= 1.62e+180)
                                  		tmp = Float64(Float64(Float64((eps ^ -1.0) + 1.0) - Float64((eps ^ -1.0) - 1.0)) / 2.0);
                                  	else
                                  		tmp = Float64(fma(Float64(Float64(0.5 * x) - 1.0), x, 1.0) * x);
                                  	end
                                  	return tmp
                                  end
                                  
                                  code[x_, eps_] := If[LessEqual[x, 240.0], N[(N[(N[Abs[N[(0.3333333333333333 * x), $MachinePrecision]], $MachinePrecision] - 0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 2.5e+49], N[(N[Exp[x], $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, 1.62e+180], N[(N[(N[(N[Power[eps, -1.0], $MachinePrecision] + 1.0), $MachinePrecision] - N[(N[Power[eps, -1.0], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[(0.5 * x), $MachinePrecision] - 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision] * x), $MachinePrecision]]]]
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  \begin{array}{l}
                                  \mathbf{if}\;x \leq 240:\\
                                  \;\;\;\;\mathsf{fma}\left(\left|0.3333333333333333 \cdot x\right| - 0.5, x \cdot x, 1\right)\\
                                  
                                  \mathbf{elif}\;x \leq 2.5 \cdot 10^{+49}:\\
                                  \;\;\;\;e^{x} \cdot x\\
                                  
                                  \mathbf{elif}\;x \leq 1.62 \cdot 10^{+180}:\\
                                  \;\;\;\;\frac{\left({\varepsilon}^{-1} + 1\right) - \left({\varepsilon}^{-1} - 1\right)}{2}\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 4 regimes
                                  2. if x < 240

                                    1. Initial program 69.6%

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

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

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

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

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

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

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

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

                                          \[\leadsto \mathsf{fma}\left(0.3333333333333333 \cdot x - 0.5, \color{blue}{x \cdot x}, 1\right) \]
                                        2. Step-by-step derivation
                                          1. Applied rewrites76.4%

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

                                          if 240 < x < 2.5000000000000002e49

                                          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

                                                if 2.5000000000000002e49 < x < 1.62e180

                                                1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

                                                if 1.62e180 < x

                                                1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

                                                      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 240:\\ \;\;\;\;\mathsf{fma}\left(\left|0.3333333333333333 \cdot x\right| - 0.5, x \cdot x, 1\right)\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{+49}:\\ \;\;\;\;e^{x} \cdot x\\ \mathbf{elif}\;x \leq 1.62 \cdot 10^{+180}:\\ \;\;\;\;\frac{\left({\varepsilon}^{-1} + 1\right) - \left({\varepsilon}^{-1} - 1\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x\\ \end{array} \]
                                                    6. Add Preprocessing

                                                    Alternative 6: 66.1% accurate, 1.2× speedup?

                                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 410000000:\\ \;\;\;\;\mathsf{fma}\left(\left|0.3333333333333333 \cdot x\right| - 0.5, x \cdot x, 1\right)\\ \mathbf{elif}\;x \leq 1.62 \cdot 10^{+180}:\\ \;\;\;\;\frac{\left({\varepsilon}^{-1} + 1\right) - \left({\varepsilon}^{-1} - 1\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x\\ \end{array} \end{array} \]
                                                    (FPCore (x eps)
                                                     :precision binary64
                                                     (if (<= x 410000000.0)
                                                       (fma (- (fabs (* 0.3333333333333333 x)) 0.5) (* x x) 1.0)
                                                       (if (<= x 1.62e+180)
                                                         (/ (- (+ (pow eps -1.0) 1.0) (- (pow eps -1.0) 1.0)) 2.0)
                                                         (* (fma (- (* 0.5 x) 1.0) x 1.0) x))))
                                                    double code(double x, double eps) {
                                                    	double tmp;
                                                    	if (x <= 410000000.0) {
                                                    		tmp = fma((fabs((0.3333333333333333 * x)) - 0.5), (x * x), 1.0);
                                                    	} else if (x <= 1.62e+180) {
                                                    		tmp = ((pow(eps, -1.0) + 1.0) - (pow(eps, -1.0) - 1.0)) / 2.0;
                                                    	} else {
                                                    		tmp = fma(((0.5 * x) - 1.0), x, 1.0) * x;
                                                    	}
                                                    	return tmp;
                                                    }
                                                    
                                                    function code(x, eps)
                                                    	tmp = 0.0
                                                    	if (x <= 410000000.0)
                                                    		tmp = fma(Float64(abs(Float64(0.3333333333333333 * x)) - 0.5), Float64(x * x), 1.0);
                                                    	elseif (x <= 1.62e+180)
                                                    		tmp = Float64(Float64(Float64((eps ^ -1.0) + 1.0) - Float64((eps ^ -1.0) - 1.0)) / 2.0);
                                                    	else
                                                    		tmp = Float64(fma(Float64(Float64(0.5 * x) - 1.0), x, 1.0) * x);
                                                    	end
                                                    	return tmp
                                                    end
                                                    
                                                    code[x_, eps_] := If[LessEqual[x, 410000000.0], N[(N[(N[Abs[N[(0.3333333333333333 * x), $MachinePrecision]], $MachinePrecision] - 0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 1.62e+180], N[(N[(N[(N[Power[eps, -1.0], $MachinePrecision] + 1.0), $MachinePrecision] - N[(N[Power[eps, -1.0], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[(0.5 * x), $MachinePrecision] - 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision] * x), $MachinePrecision]]]
                                                    
                                                    \begin{array}{l}
                                                    
                                                    \\
                                                    \begin{array}{l}
                                                    \mathbf{if}\;x \leq 410000000:\\
                                                    \;\;\;\;\mathsf{fma}\left(\left|0.3333333333333333 \cdot x\right| - 0.5, x \cdot x, 1\right)\\
                                                    
                                                    \mathbf{elif}\;x \leq 1.62 \cdot 10^{+180}:\\
                                                    \;\;\;\;\frac{\left({\varepsilon}^{-1} + 1\right) - \left({\varepsilon}^{-1} - 1\right)}{2}\\
                                                    
                                                    \mathbf{else}:\\
                                                    \;\;\;\;\mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x\\
                                                    
                                                    
                                                    \end{array}
                                                    \end{array}
                                                    
                                                    Derivation
                                                    1. Split input into 3 regimes
                                                    2. if x < 4.1e8

                                                      1. Initial program 69.9%

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

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

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

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

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

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

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

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

                                                            \[\leadsto \mathsf{fma}\left(0.3333333333333333 \cdot x - 0.5, \color{blue}{x \cdot x}, 1\right) \]
                                                          2. Step-by-step derivation
                                                            1. Applied rewrites75.6%

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

                                                            if 4.1e8 < x < 1.62e180

                                                            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

                                                            if 1.62e180 < x

                                                            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

                                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 410000000:\\ \;\;\;\;\mathsf{fma}\left(\left|0.3333333333333333 \cdot x\right| - 0.5, x \cdot x, 1\right)\\ \mathbf{elif}\;x \leq 1.62 \cdot 10^{+180}:\\ \;\;\;\;\frac{\left({\varepsilon}^{-1} + 1\right) - \left({\varepsilon}^{-1} - 1\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x\\ \end{array} \]
                                                                6. Add Preprocessing

                                                                Alternative 7: 62.1% accurate, 6.5× speedup?

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

                                                                  1. Initial program 73.8%

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

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

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

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

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

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

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

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

                                                                        \[\leadsto \mathsf{fma}\left(0.3333333333333333 \cdot x - 0.5, \color{blue}{x \cdot x}, 1\right) \]
                                                                      2. Step-by-step derivation
                                                                        1. Applied rewrites66.2%

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

                                                                        if 5e102 < x < 1.62e180

                                                                        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

                                                                              if 1.62e180 < x

                                                                              1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

                                                                                      \[\leadsto \mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x \]
                                                                                  4. Recombined 3 regimes into one program.
                                                                                  5. Add Preprocessing

                                                                                  Alternative 8: 62.0% accurate, 7.6× speedup?

                                                                                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 1.75 \cdot 10^{+154}:\\ \;\;\;\;\mathsf{fma}\left(\left|0.3333333333333333 \cdot x\right| - 0.5, x \cdot x, 1\right)\\ \mathbf{elif}\;x \leq 1.62 \cdot 10^{+180}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, x, 1\right), x, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x\\ \end{array} \end{array} \]
                                                                                  (FPCore (x eps)
                                                                                   :precision binary64
                                                                                   (if (<= x 1.75e+154)
                                                                                     (fma (- (fabs (* 0.3333333333333333 x)) 0.5) (* x x) 1.0)
                                                                                     (if (<= x 1.62e+180)
                                                                                       (/ x (fma (fma 0.5 x 1.0) x 1.0))
                                                                                       (* (fma (- (* 0.5 x) 1.0) x 1.0) x))))
                                                                                  double code(double x, double eps) {
                                                                                  	double tmp;
                                                                                  	if (x <= 1.75e+154) {
                                                                                  		tmp = fma((fabs((0.3333333333333333 * x)) - 0.5), (x * x), 1.0);
                                                                                  	} else if (x <= 1.62e+180) {
                                                                                  		tmp = x / fma(fma(0.5, x, 1.0), x, 1.0);
                                                                                  	} else {
                                                                                  		tmp = fma(((0.5 * x) - 1.0), x, 1.0) * x;
                                                                                  	}
                                                                                  	return tmp;
                                                                                  }
                                                                                  
                                                                                  function code(x, eps)
                                                                                  	tmp = 0.0
                                                                                  	if (x <= 1.75e+154)
                                                                                  		tmp = fma(Float64(abs(Float64(0.3333333333333333 * x)) - 0.5), Float64(x * x), 1.0);
                                                                                  	elseif (x <= 1.62e+180)
                                                                                  		tmp = Float64(x / fma(fma(0.5, x, 1.0), x, 1.0));
                                                                                  	else
                                                                                  		tmp = Float64(fma(Float64(Float64(0.5 * x) - 1.0), x, 1.0) * x);
                                                                                  	end
                                                                                  	return tmp
                                                                                  end
                                                                                  
                                                                                  code[x_, eps_] := If[LessEqual[x, 1.75e+154], N[(N[(N[Abs[N[(0.3333333333333333 * x), $MachinePrecision]], $MachinePrecision] - 0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 1.62e+180], N[(x / N[(N[(0.5 * x + 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(0.5 * x), $MachinePrecision] - 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision] * x), $MachinePrecision]]]
                                                                                  
                                                                                  \begin{array}{l}
                                                                                  
                                                                                  \\
                                                                                  \begin{array}{l}
                                                                                  \mathbf{if}\;x \leq 1.75 \cdot 10^{+154}:\\
                                                                                  \;\;\;\;\mathsf{fma}\left(\left|0.3333333333333333 \cdot x\right| - 0.5, x \cdot x, 1\right)\\
                                                                                  
                                                                                  \mathbf{elif}\;x \leq 1.62 \cdot 10^{+180}:\\
                                                                                  \;\;\;\;\frac{x}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, x, 1\right), x, 1\right)}\\
                                                                                  
                                                                                  \mathbf{else}:\\
                                                                                  \;\;\;\;\mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x\\
                                                                                  
                                                                                  
                                                                                  \end{array}
                                                                                  \end{array}
                                                                                  
                                                                                  Derivation
                                                                                  1. Split input into 3 regimes
                                                                                  2. if x < 1.7500000000000001e154

                                                                                    1. Initial program 75.8%

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

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

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

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

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

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

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

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

                                                                                          \[\leadsto \mathsf{fma}\left(0.3333333333333333 \cdot x - 0.5, \color{blue}{x \cdot x}, 1\right) \]
                                                                                        2. Step-by-step derivation
                                                                                          1. Applied rewrites63.7%

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

                                                                                          if 1.7500000000000001e154 < x < 1.62e180

                                                                                          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

                                                                                                if 1.62e180 < x

                                                                                                1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

                                                                                                        \[\leadsto \mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x \]
                                                                                                    4. Recombined 3 regimes into one program.
                                                                                                    5. Add Preprocessing

                                                                                                    Alternative 9: 62.0% accurate, 9.7× speedup?

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

                                                                                                      1. Initial program 70.0%

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

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

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

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

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

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

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

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

                                                                                                            \[\leadsto \mathsf{fma}\left(0.3333333333333333 \cdot x - 0.5, \color{blue}{x \cdot x}, 1\right) \]
                                                                                                          2. Step-by-step derivation
                                                                                                            1. Applied rewrites76.8%

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

                                                                                                            if 2.2000000000000002 < x

                                                                                                            1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

                                                                                                                    \[\leadsto \mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x \]
                                                                                                                4. Recombined 2 regimes into one program.
                                                                                                                5. Add Preprocessing

                                                                                                                Alternative 10: 53.0% accurate, 10.5× speedup?

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

                                                                                                                  1. Initial program 69.6%

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

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

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

                                                                                                                    if 600 < x

                                                                                                                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

                                                                                                                            \[\leadsto \mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x \]
                                                                                                                        4. Recombined 2 regimes into one program.
                                                                                                                        5. Add Preprocessing

                                                                                                                        Alternative 11: 62.1% accurate, 12.4× speedup?

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

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

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

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

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

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

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

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

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

                                                                                                                              \[\leadsto \mathsf{fma}\left(0.3333333333333333 \cdot x - 0.5, \color{blue}{x \cdot x}, 1\right) \]
                                                                                                                            2. Step-by-step derivation
                                                                                                                              1. Applied rewrites61.3%

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

                                                                                                                              Alternative 12: 52.7% accurate, 13.7× speedup?

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

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

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

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

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

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

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

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

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

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

                                                                                                                                  Alternative 13: 43.9% accurate, 273.0× speedup?

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

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

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

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

                                                                                                                                    Reproduce

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