NMSE Section 6.1 mentioned, A

Percentage Accurate: 73.0% → 99.6%
Time: 7.6s
Alternatives: 12
Speedup: 1.6×

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;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, eps)
use fmin_fmax_functions
    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 12 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.0% 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;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, eps)
use fmin_fmax_functions
    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.6% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;\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} \leq 0:\\
\;\;\;\;\mathsf{fma}\left(x - -2, t\_0, t\_0 \cdot x\right) \cdot 0.5\\

\mathbf{else}:\\
\;\;\;\;\frac{1 \cdot e^{x \cdot \varepsilon} - -1 \cdot e^{\varepsilon \cdot \left(-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)) < 0.0

    1. Initial program 41.9%

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

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

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

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(x - -2, e^{-x}, e^{-x} \cdot 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 inf

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

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

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

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

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

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

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

                    \[\leadsto \frac{1 \cdot e^{x \cdot \varepsilon} - -1 \cdot e^{-\color{blue}{\varepsilon} \cdot x}}{2} \]
                4. Recombined 2 regimes into one program.
                5. Final simplification100.0%

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

                Alternative 2: 79.7% accurate, 1.1× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-x}\\ \mathbf{if}\;\varepsilon \leq -1.45 \cdot 10^{+158}:\\ \;\;\;\;\frac{1 \cdot \mathsf{fma}\left(\varepsilon - 1, x, 1\right) - -1 \cdot e^{\varepsilon \cdot \left(-x\right)}}{2}\\ \mathbf{elif}\;\varepsilon \leq -1 \lor \neg \left(\varepsilon \leq 1\right):\\ \;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot \left(1 - \mathsf{fma}\left(x, \varepsilon, x\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x - -2, t\_0, t\_0 \cdot x\right) \cdot 0.5\\ \end{array} \end{array} \]
                (FPCore (x eps)
                 :precision binary64
                 (let* ((t_0 (exp (- x))))
                   (if (<= eps -1.45e+158)
                     (/ (- (* 1.0 (fma (- eps 1.0) x 1.0)) (* -1.0 (exp (* eps (- x))))) 2.0)
                     (if (or (<= eps -1.0) (not (<= eps 1.0)))
                       (/
                        (-
                         (* (+ 1.0 (/ 1.0 eps)) (exp (* (+ -1.0 eps) x)))
                         (* (- (/ 1.0 eps) 1.0) (- 1.0 (fma x eps x))))
                        2.0)
                       (* (fma (- x -2.0) t_0 (* t_0 x)) 0.5)))))
                double code(double x, double eps) {
                	double t_0 = exp(-x);
                	double tmp;
                	if (eps <= -1.45e+158) {
                		tmp = ((1.0 * fma((eps - 1.0), x, 1.0)) - (-1.0 * exp((eps * -x)))) / 2.0;
                	} else if ((eps <= -1.0) || !(eps <= 1.0)) {
                		tmp = (((1.0 + (1.0 / eps)) * exp(((-1.0 + eps) * x))) - (((1.0 / eps) - 1.0) * (1.0 - fma(x, eps, x)))) / 2.0;
                	} else {
                		tmp = fma((x - -2.0), t_0, (t_0 * x)) * 0.5;
                	}
                	return tmp;
                }
                
                function code(x, eps)
                	t_0 = exp(Float64(-x))
                	tmp = 0.0
                	if (eps <= -1.45e+158)
                		tmp = Float64(Float64(Float64(1.0 * fma(Float64(eps - 1.0), x, 1.0)) - Float64(-1.0 * exp(Float64(eps * Float64(-x))))) / 2.0);
                	elseif ((eps <= -1.0) || !(eps <= 1.0))
                		tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(Float64(-1.0 + eps) * x))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * Float64(1.0 - fma(x, eps, x)))) / 2.0);
                	else
                		tmp = Float64(fma(Float64(x - -2.0), t_0, Float64(t_0 * x)) * 0.5);
                	end
                	return tmp
                end
                
                code[x_, eps_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[eps, -1.45e+158], N[(N[(N[(1.0 * N[(N[(eps - 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(-1.0 * N[Exp[N[(eps * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[eps, -1.0], N[Not[LessEqual[eps, 1.0]], $MachinePrecision]], 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[(1.0 - N[(x * eps + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(x - -2.0), $MachinePrecision] * t$95$0 + N[(t$95$0 * x), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := e^{-x}\\
                \mathbf{if}\;\varepsilon \leq -1.45 \cdot 10^{+158}:\\
                \;\;\;\;\frac{1 \cdot \mathsf{fma}\left(\varepsilon - 1, x, 1\right) - -1 \cdot e^{\varepsilon \cdot \left(-x\right)}}{2}\\
                
                \mathbf{elif}\;\varepsilon \leq -1 \lor \neg \left(\varepsilon \leq 1\right):\\
                \;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot \left(1 - \mathsf{fma}\left(x, \varepsilon, x\right)\right)}{2}\\
                
                \mathbf{else}:\\
                \;\;\;\;\mathsf{fma}\left(x - -2, t\_0, t\_0 \cdot x\right) \cdot 0.5\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if eps < -1.45000000000000012e158

                  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^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
                  4. Step-by-step derivation
                    1. Applied rewrites100.0%

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

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

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

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

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

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

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

                          if -1.45000000000000012e158 < eps < -1 or 1 < eps

                          1. Initial program 100.0%

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

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

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

                            if -1 < eps < 1

                            1. Initial program 41.9%

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

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

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

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

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

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

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

                                Alternative 3: 98.9% accurate, 1.1× speedup?

                                \[\begin{array}{l} \\ \frac{1 \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - -1 \cdot e^{\left(-1 - \varepsilon\right) \cdot x}}{2} \end{array} \]
                                (FPCore (x eps)
                                 :precision binary64
                                 (/
                                  (- (* 1.0 (exp (* (+ -1.0 eps) x))) (* -1.0 (exp (* (- -1.0 eps) x))))
                                  2.0))
                                double code(double x, double eps) {
                                	return ((1.0 * exp(((-1.0 + eps) * x))) - (-1.0 * exp(((-1.0 - eps) * x)))) / 2.0;
                                }
                                
                                module fmin_fmax_functions
                                    implicit none
                                    private
                                    public fmax
                                    public fmin
                                
                                    interface fmax
                                        module procedure fmax88
                                        module procedure fmax44
                                        module procedure fmax84
                                        module procedure fmax48
                                    end interface
                                    interface fmin
                                        module procedure fmin88
                                        module procedure fmin44
                                        module procedure fmin84
                                        module procedure fmin48
                                    end interface
                                contains
                                    real(8) function fmax88(x, y) result (res)
                                        real(8), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                    end function
                                    real(4) function fmax44(x, y) result (res)
                                        real(4), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                    end function
                                    real(8) function fmax84(x, y) result(res)
                                        real(8), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                    end function
                                    real(8) function fmax48(x, y) result(res)
                                        real(4), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                    end function
                                    real(8) function fmin88(x, y) result (res)
                                        real(8), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                    end function
                                    real(4) function fmin44(x, y) result (res)
                                        real(4), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                    end function
                                    real(8) function fmin84(x, y) result(res)
                                        real(8), intent (in) :: x
                                        real(4), intent (in) :: y
                                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                    end function
                                    real(8) function fmin48(x, y) result(res)
                                        real(4), intent (in) :: x
                                        real(8), intent (in) :: y
                                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                    end function
                                end module
                                
                                real(8) function code(x, eps)
                                use fmin_fmax_functions
                                    real(8), intent (in) :: x
                                    real(8), intent (in) :: eps
                                    code = ((1.0d0 * exp((((-1.0d0) + eps) * x))) - ((-1.0d0) * exp((((-1.0d0) - eps) * x)))) / 2.0d0
                                end function
                                
                                public static double code(double x, double eps) {
                                	return ((1.0 * Math.exp(((-1.0 + eps) * x))) - (-1.0 * Math.exp(((-1.0 - eps) * x)))) / 2.0;
                                }
                                
                                def code(x, eps):
                                	return ((1.0 * math.exp(((-1.0 + eps) * x))) - (-1.0 * math.exp(((-1.0 - eps) * x)))) / 2.0
                                
                                function code(x, eps)
                                	return Float64(Float64(Float64(1.0 * exp(Float64(Float64(-1.0 + eps) * x))) - Float64(-1.0 * exp(Float64(Float64(-1.0 - eps) * x)))) / 2.0)
                                end
                                
                                function tmp = code(x, eps)
                                	tmp = ((1.0 * exp(((-1.0 + eps) * x))) - (-1.0 * exp(((-1.0 - eps) * x)))) / 2.0;
                                end
                                
                                code[x_, eps_] := N[(N[(N[(1.0 * N[Exp[N[(N[(-1.0 + eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(-1.0 * N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
                                
                                \begin{array}{l}
                                
                                \\
                                \frac{1 \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - -1 \cdot e^{\left(-1 - \varepsilon\right) \cdot x}}{2}
                                \end{array}
                                
                                Derivation
                                1. Initial program 75.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^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
                                4. Step-by-step derivation
                                  1. Applied rewrites74.2%

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

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

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

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

                                    Alternative 4: 75.1% accurate, 1.5× speedup?

                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\varepsilon \leq -1.45 \cdot 10^{+158}:\\ \;\;\;\;\frac{1 \cdot \mathsf{fma}\left(\varepsilon - 1, x, 1\right) - -1 \cdot e^{\varepsilon \cdot \left(-x\right)}}{2}\\ \mathbf{elif}\;\varepsilon \leq -1 \lor \neg \left(\varepsilon \leq 1\right):\\ \;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot \left(1 - \mathsf{fma}\left(x, \varepsilon, x\right)\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(e^{-x}, \left(1 + x\right) - -1, \frac{x}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right), x, 1\right), x, 1\right)}\right) \cdot 0.5\\ \end{array} \end{array} \]
                                    (FPCore (x eps)
                                     :precision binary64
                                     (if (<= eps -1.45e+158)
                                       (/ (- (* 1.0 (fma (- eps 1.0) x 1.0)) (* -1.0 (exp (* eps (- x))))) 2.0)
                                       (if (or (<= eps -1.0) (not (<= eps 1.0)))
                                         (/
                                          (-
                                           (* (+ 1.0 (/ 1.0 eps)) (exp (* (+ -1.0 eps) x)))
                                           (* (- (/ 1.0 eps) 1.0) (- 1.0 (fma x eps x))))
                                          2.0)
                                         (*
                                          (fma
                                           (exp (- x))
                                           (- (+ 1.0 x) -1.0)
                                           (/ x (fma (fma (fma 0.16666666666666666 x 0.5) x 1.0) x 1.0)))
                                          0.5))))
                                    double code(double x, double eps) {
                                    	double tmp;
                                    	if (eps <= -1.45e+158) {
                                    		tmp = ((1.0 * fma((eps - 1.0), x, 1.0)) - (-1.0 * exp((eps * -x)))) / 2.0;
                                    	} else if ((eps <= -1.0) || !(eps <= 1.0)) {
                                    		tmp = (((1.0 + (1.0 / eps)) * exp(((-1.0 + eps) * x))) - (((1.0 / eps) - 1.0) * (1.0 - fma(x, eps, x)))) / 2.0;
                                    	} else {
                                    		tmp = fma(exp(-x), ((1.0 + x) - -1.0), (x / fma(fma(fma(0.16666666666666666, x, 0.5), x, 1.0), x, 1.0))) * 0.5;
                                    	}
                                    	return tmp;
                                    }
                                    
                                    function code(x, eps)
                                    	tmp = 0.0
                                    	if (eps <= -1.45e+158)
                                    		tmp = Float64(Float64(Float64(1.0 * fma(Float64(eps - 1.0), x, 1.0)) - Float64(-1.0 * exp(Float64(eps * Float64(-x))))) / 2.0);
                                    	elseif ((eps <= -1.0) || !(eps <= 1.0))
                                    		tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(Float64(-1.0 + eps) * x))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * Float64(1.0 - fma(x, eps, x)))) / 2.0);
                                    	else
                                    		tmp = Float64(fma(exp(Float64(-x)), Float64(Float64(1.0 + x) - -1.0), Float64(x / fma(fma(fma(0.16666666666666666, x, 0.5), x, 1.0), x, 1.0))) * 0.5);
                                    	end
                                    	return tmp
                                    end
                                    
                                    code[x_, eps_] := If[LessEqual[eps, -1.45e+158], N[(N[(N[(1.0 * N[(N[(eps - 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(-1.0 * N[Exp[N[(eps * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[eps, -1.0], N[Not[LessEqual[eps, 1.0]], $MachinePrecision]], 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[(1.0 - N[(x * eps + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(N[(1.0 + x), $MachinePrecision] - -1.0), $MachinePrecision] + N[(x / N[(N[(N[(0.16666666666666666 * x + 0.5), $MachinePrecision] * x + 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \begin{array}{l}
                                    \mathbf{if}\;\varepsilon \leq -1.45 \cdot 10^{+158}:\\
                                    \;\;\;\;\frac{1 \cdot \mathsf{fma}\left(\varepsilon - 1, x, 1\right) - -1 \cdot e^{\varepsilon \cdot \left(-x\right)}}{2}\\
                                    
                                    \mathbf{elif}\;\varepsilon \leq -1 \lor \neg \left(\varepsilon \leq 1\right):\\
                                    \;\;\;\;\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot \left(1 - \mathsf{fma}\left(x, \varepsilon, x\right)\right)}{2}\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;\mathsf{fma}\left(e^{-x}, \left(1 + x\right) - -1, \frac{x}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right), x, 1\right), x, 1\right)}\right) \cdot 0.5\\
                                    
                                    
                                    \end{array}
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 3 regimes
                                    2. if eps < -1.45000000000000012e158

                                      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^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
                                      4. Step-by-step derivation
                                        1. Applied rewrites100.0%

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

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

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

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

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

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

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

                                              if -1.45000000000000012e158 < eps < -1 or 1 < eps

                                              1. Initial program 100.0%

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

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

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

                                                if -1 < eps < 1

                                                1. Initial program 41.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. Applied rewrites100.0%

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

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

                                                      \[\leadsto \mathsf{fma}\left(e^{-x}, \left(1 + x\right) - -1, \frac{x}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right), x, 1\right), x, 1\right)}\right) \cdot 0.5 \]
                                                  4. Recombined 3 regimes into one program.
                                                  5. Final simplification79.8%

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

                                                  Alternative 5: 75.1% accurate, 1.6× speedup?

                                                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\varepsilon \leq -1.45 \cdot 10^{+158}:\\ \;\;\;\;\frac{1 \cdot \mathsf{fma}\left(\varepsilon - 1, x, 1\right) - -1 \cdot e^{\varepsilon \cdot \left(-x\right)}}{2}\\ \mathbf{elif}\;\varepsilon \leq -1 \lor \neg \left(\varepsilon \leq 1\right):\\ \;\;\;\;\frac{1 \cdot e^{x \cdot \varepsilon} - -1 \cdot \mathsf{fma}\left(-1 - \varepsilon, x, 1\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(e^{-x}, \left(1 + x\right) - -1, \frac{x}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right), x, 1\right), x, 1\right)}\right) \cdot 0.5\\ \end{array} \end{array} \]
                                                  (FPCore (x eps)
                                                   :precision binary64
                                                   (if (<= eps -1.45e+158)
                                                     (/ (- (* 1.0 (fma (- eps 1.0) x 1.0)) (* -1.0 (exp (* eps (- x))))) 2.0)
                                                     (if (or (<= eps -1.0) (not (<= eps 1.0)))
                                                       (/ (- (* 1.0 (exp (* x eps))) (* -1.0 (fma (- -1.0 eps) x 1.0))) 2.0)
                                                       (*
                                                        (fma
                                                         (exp (- x))
                                                         (- (+ 1.0 x) -1.0)
                                                         (/ x (fma (fma (fma 0.16666666666666666 x 0.5) x 1.0) x 1.0)))
                                                        0.5))))
                                                  double code(double x, double eps) {
                                                  	double tmp;
                                                  	if (eps <= -1.45e+158) {
                                                  		tmp = ((1.0 * fma((eps - 1.0), x, 1.0)) - (-1.0 * exp((eps * -x)))) / 2.0;
                                                  	} else if ((eps <= -1.0) || !(eps <= 1.0)) {
                                                  		tmp = ((1.0 * exp((x * eps))) - (-1.0 * fma((-1.0 - eps), x, 1.0))) / 2.0;
                                                  	} else {
                                                  		tmp = fma(exp(-x), ((1.0 + x) - -1.0), (x / fma(fma(fma(0.16666666666666666, x, 0.5), x, 1.0), x, 1.0))) * 0.5;
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  function code(x, eps)
                                                  	tmp = 0.0
                                                  	if (eps <= -1.45e+158)
                                                  		tmp = Float64(Float64(Float64(1.0 * fma(Float64(eps - 1.0), x, 1.0)) - Float64(-1.0 * exp(Float64(eps * Float64(-x))))) / 2.0);
                                                  	elseif ((eps <= -1.0) || !(eps <= 1.0))
                                                  		tmp = Float64(Float64(Float64(1.0 * exp(Float64(x * eps))) - Float64(-1.0 * fma(Float64(-1.0 - eps), x, 1.0))) / 2.0);
                                                  	else
                                                  		tmp = Float64(fma(exp(Float64(-x)), Float64(Float64(1.0 + x) - -1.0), Float64(x / fma(fma(fma(0.16666666666666666, x, 0.5), x, 1.0), x, 1.0))) * 0.5);
                                                  	end
                                                  	return tmp
                                                  end
                                                  
                                                  code[x_, eps_] := If[LessEqual[eps, -1.45e+158], N[(N[(N[(1.0 * N[(N[(eps - 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(-1.0 * N[Exp[N[(eps * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[eps, -1.0], N[Not[LessEqual[eps, 1.0]], $MachinePrecision]], N[(N[(N[(1.0 * N[Exp[N[(x * eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(-1.0 * N[(N[(-1.0 - eps), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[(-x)], $MachinePrecision] * N[(N[(1.0 + x), $MachinePrecision] - -1.0), $MachinePrecision] + N[(x / N[(N[(N[(0.16666666666666666 * x + 0.5), $MachinePrecision] * x + 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]]
                                                  
                                                  \begin{array}{l}
                                                  
                                                  \\
                                                  \begin{array}{l}
                                                  \mathbf{if}\;\varepsilon \leq -1.45 \cdot 10^{+158}:\\
                                                  \;\;\;\;\frac{1 \cdot \mathsf{fma}\left(\varepsilon - 1, x, 1\right) - -1 \cdot e^{\varepsilon \cdot \left(-x\right)}}{2}\\
                                                  
                                                  \mathbf{elif}\;\varepsilon \leq -1 \lor \neg \left(\varepsilon \leq 1\right):\\
                                                  \;\;\;\;\frac{1 \cdot e^{x \cdot \varepsilon} - -1 \cdot \mathsf{fma}\left(-1 - \varepsilon, x, 1\right)}{2}\\
                                                  
                                                  \mathbf{else}:\\
                                                  \;\;\;\;\mathsf{fma}\left(e^{-x}, \left(1 + x\right) - -1, \frac{x}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right), x, 1\right), x, 1\right)}\right) \cdot 0.5\\
                                                  
                                                  
                                                  \end{array}
                                                  \end{array}
                                                  
                                                  Derivation
                                                  1. Split input into 3 regimes
                                                  2. if eps < -1.45000000000000012e158

                                                    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^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
                                                    4. Step-by-step derivation
                                                      1. Applied rewrites100.0%

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

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

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

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

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

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

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

                                                            if -1.45000000000000012e158 < eps < -1 or 1 < eps

                                                            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

                                                                    if -1 < eps < 1

                                                                    1. Initial program 41.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. Applied rewrites100.0%

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

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

                                                                          \[\leadsto \mathsf{fma}\left(e^{-x}, \left(1 + x\right) - -1, \frac{x}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right), x, 1\right), x, 1\right)}\right) \cdot 0.5 \]
                                                                      4. Recombined 3 regimes into one program.
                                                                      5. Final simplification79.8%

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

                                                                      Alternative 6: 70.8% accurate, 2.0× speedup?

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

                                                                        1. Initial program 64.9%

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

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

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

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

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

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

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

                                                                                \[\leadsto \frac{1 \cdot e^{x \cdot \varepsilon} - -1 \cdot \color{blue}{1}}{2} \]
                                                                              3. Step-by-step derivation
                                                                                1. Applied rewrites78.9%

                                                                                  \[\leadsto \frac{1 \cdot e^{x \cdot \varepsilon} - -1 \cdot \color{blue}{1}}{2} \]

                                                                                if 1.15e21 < x < 2.0499999999999999e213

                                                                                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. Applied rewrites16.1%

                                                                                    \[\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. Taylor expanded in x around 0

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

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

                                                                                    if 2.0499999999999999e213 < 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. Applied rewrites38.5%

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

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

                                                                                          \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{-0.5}, 1\right) \]
                                                                                        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 rewrites63.1%

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

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

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

                                                                                          Alternative 7: 60.0% accurate, 4.5× speedup?

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

                                                                                            1. Initial program 64.5%

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

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

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

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

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

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

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

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

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

                                                                                                    if 1.22e9 < x < 2.0499999999999999e213

                                                                                                    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. Applied rewrites15.5%

                                                                                                        \[\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. Taylor expanded in x around 0

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

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

                                                                                                        if 2.0499999999999999e213 < 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. Applied rewrites38.5%

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

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

                                                                                                              \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{-0.5}, 1\right) \]
                                                                                                            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 rewrites63.1%

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

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

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

                                                                                                              Alternative 8: 53.5% accurate, 6.5× speedup?

                                                                                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 3.2 \cdot 10^{+110} \lor \neg \left(x \leq 10^{+213}\right):\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right) \cdot x, x, 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right), x, 1\right), x, 1\right)}\\ \end{array} \end{array} \]
                                                                                                              (FPCore (x eps)
                                                                                                               :precision binary64
                                                                                                               (if (or (<= x 3.2e+110) (not (<= x 1e+213)))
                                                                                                                 (fma (* (fma 0.3333333333333333 x -0.5) x) x 1.0)
                                                                                                                 (/ x (fma (fma (fma 0.16666666666666666 x 0.5) x 1.0) x 1.0))))
                                                                                                              double code(double x, double eps) {
                                                                                                              	double tmp;
                                                                                                              	if ((x <= 3.2e+110) || !(x <= 1e+213)) {
                                                                                                              		tmp = fma((fma(0.3333333333333333, x, -0.5) * x), x, 1.0);
                                                                                                              	} else {
                                                                                                              		tmp = x / fma(fma(fma(0.16666666666666666, x, 0.5), x, 1.0), x, 1.0);
                                                                                                              	}
                                                                                                              	return tmp;
                                                                                                              }
                                                                                                              
                                                                                                              function code(x, eps)
                                                                                                              	tmp = 0.0
                                                                                                              	if ((x <= 3.2e+110) || !(x <= 1e+213))
                                                                                                              		tmp = fma(Float64(fma(0.3333333333333333, x, -0.5) * x), x, 1.0);
                                                                                                              	else
                                                                                                              		tmp = Float64(x / fma(fma(fma(0.16666666666666666, x, 0.5), x, 1.0), x, 1.0));
                                                                                                              	end
                                                                                                              	return tmp
                                                                                                              end
                                                                                                              
                                                                                                              code[x_, eps_] := If[Or[LessEqual[x, 3.2e+110], N[Not[LessEqual[x, 1e+213]], $MachinePrecision]], N[(N[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * x), $MachinePrecision] * x + 1.0), $MachinePrecision], N[(x / N[(N[(N[(0.16666666666666666 * x + 0.5), $MachinePrecision] * x + 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision]]
                                                                                                              
                                                                                                              \begin{array}{l}
                                                                                                              
                                                                                                              \\
                                                                                                              \begin{array}{l}
                                                                                                              \mathbf{if}\;x \leq 3.2 \cdot 10^{+110} \lor \neg \left(x \leq 10^{+213}\right):\\
                                                                                                              \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right) \cdot x, x, 1\right)\\
                                                                                                              
                                                                                                              \mathbf{else}:\\
                                                                                                              \;\;\;\;\frac{x}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right), x, 1\right), x, 1\right)}\\
                                                                                                              
                                                                                                              
                                                                                                              \end{array}
                                                                                                              \end{array}
                                                                                                              
                                                                                                              Derivation
                                                                                                              1. Split input into 2 regimes
                                                                                                              2. if x < 3.19999999999999994e110 or 9.99999999999999984e212 < x

                                                                                                                1. Initial program 72.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. Applied rewrites54.8%

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

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

                                                                                                                      \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{-0.5}, 1\right) \]
                                                                                                                    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.7%

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

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

                                                                                                                        if 3.19999999999999994e110 < x < 9.99999999999999984e212

                                                                                                                        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. Applied rewrites81.8%

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

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

                                                                                                                              \[\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.8%

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

                                                                                                                              \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 3.2 \cdot 10^{+110} \lor \neg \left(x \leq 10^{+213}\right):\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right) \cdot x, x, 1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right), x, 1\right), x, 1\right)}\\ \end{array} \]
                                                                                                                            6. Add Preprocessing

                                                                                                                            Alternative 9: 56.3% accurate, 6.5× speedup?

                                                                                                                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4.1 \cdot 10^{+109}:\\ \;\;\;\;\frac{1 \cdot \mathsf{fma}\left(\varepsilon - 1, x, 1\right) - -1 \cdot 1}{2}\\ \mathbf{elif}\;x \leq 10^{+213}:\\ \;\;\;\;\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(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right) \cdot x, x, 1\right)\\ \end{array} \end{array} \]
                                                                                                                            (FPCore (x eps)
                                                                                                                             :precision binary64
                                                                                                                             (if (<= x 4.1e+109)
                                                                                                                               (/ (- (* 1.0 (fma (- eps 1.0) x 1.0)) (* -1.0 1.0)) 2.0)
                                                                                                                               (if (<= x 1e+213)
                                                                                                                                 (/ x (fma (fma (fma 0.16666666666666666 x 0.5) x 1.0) x 1.0))
                                                                                                                                 (fma (* (fma 0.3333333333333333 x -0.5) x) x 1.0))))
                                                                                                                            double code(double x, double eps) {
                                                                                                                            	double tmp;
                                                                                                                            	if (x <= 4.1e+109) {
                                                                                                                            		tmp = ((1.0 * fma((eps - 1.0), x, 1.0)) - (-1.0 * 1.0)) / 2.0;
                                                                                                                            	} else if (x <= 1e+213) {
                                                                                                                            		tmp = x / fma(fma(fma(0.16666666666666666, x, 0.5), x, 1.0), x, 1.0);
                                                                                                                            	} else {
                                                                                                                            		tmp = fma((fma(0.3333333333333333, x, -0.5) * x), x, 1.0);
                                                                                                                            	}
                                                                                                                            	return tmp;
                                                                                                                            }
                                                                                                                            
                                                                                                                            function code(x, eps)
                                                                                                                            	tmp = 0.0
                                                                                                                            	if (x <= 4.1e+109)
                                                                                                                            		tmp = Float64(Float64(Float64(1.0 * fma(Float64(eps - 1.0), x, 1.0)) - Float64(-1.0 * 1.0)) / 2.0);
                                                                                                                            	elseif (x <= 1e+213)
                                                                                                                            		tmp = Float64(x / fma(fma(fma(0.16666666666666666, x, 0.5), x, 1.0), x, 1.0));
                                                                                                                            	else
                                                                                                                            		tmp = fma(Float64(fma(0.3333333333333333, x, -0.5) * x), x, 1.0);
                                                                                                                            	end
                                                                                                                            	return tmp
                                                                                                                            end
                                                                                                                            
                                                                                                                            code[x_, eps_] := If[LessEqual[x, 4.1e+109], N[(N[(N[(1.0 * N[(N[(eps - 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision] - N[(-1.0 * 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 1e+213], N[(x / N[(N[(N[(0.16666666666666666 * x + 0.5), $MachinePrecision] * x + 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * x), $MachinePrecision] * x + 1.0), $MachinePrecision]]]
                                                                                                                            
                                                                                                                            \begin{array}{l}
                                                                                                                            
                                                                                                                            \\
                                                                                                                            \begin{array}{l}
                                                                                                                            \mathbf{if}\;x \leq 4.1 \cdot 10^{+109}:\\
                                                                                                                            \;\;\;\;\frac{1 \cdot \mathsf{fma}\left(\varepsilon - 1, x, 1\right) - -1 \cdot 1}{2}\\
                                                                                                                            
                                                                                                                            \mathbf{elif}\;x \leq 10^{+213}:\\
                                                                                                                            \;\;\;\;\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(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right) \cdot x, x, 1\right)\\
                                                                                                                            
                                                                                                                            
                                                                                                                            \end{array}
                                                                                                                            \end{array}
                                                                                                                            
                                                                                                                            Derivation
                                                                                                                            1. Split input into 3 regimes
                                                                                                                            2. if x < 4.0999999999999997e109

                                                                                                                              1. Initial program 68.8%

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

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

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

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

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

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

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

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

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

                                                                                                                                      if 4.0999999999999997e109 < x < 9.99999999999999984e212

                                                                                                                                      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. Applied rewrites81.8%

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

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

                                                                                                                                            \[\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.8%

                                                                                                                                              \[\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 9.99999999999999984e212 < 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. Applied rewrites38.5%

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

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

                                                                                                                                                  \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{-0.5}, 1\right) \]
                                                                                                                                                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 rewrites63.1%

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

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

                                                                                                                                                    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 4.1 \cdot 10^{+109}:\\ \;\;\;\;\frac{1 \cdot \mathsf{fma}\left(\varepsilon - 1, x, 1\right) - -1 \cdot 1}{2}\\ \mathbf{elif}\;x \leq 10^{+213}:\\ \;\;\;\;\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(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right) \cdot x, x, 1\right)\\ \end{array} \]
                                                                                                                                                  5. Add Preprocessing

                                                                                                                                                  Alternative 10: 53.0% accurate, 15.2× speedup?

                                                                                                                                                  \[\begin{array}{l} \\ \mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right) \cdot x, x, 1\right) \end{array} \]
                                                                                                                                                  (FPCore (x eps)
                                                                                                                                                   :precision binary64
                                                                                                                                                   (fma (* (fma 0.3333333333333333 x -0.5) x) x 1.0))
                                                                                                                                                  double code(double x, double eps) {
                                                                                                                                                  	return fma((fma(0.3333333333333333, x, -0.5) * x), x, 1.0);
                                                                                                                                                  }
                                                                                                                                                  
                                                                                                                                                  function code(x, eps)
                                                                                                                                                  	return fma(Float64(fma(0.3333333333333333, x, -0.5) * x), x, 1.0)
                                                                                                                                                  end
                                                                                                                                                  
                                                                                                                                                  code[x_, eps_] := N[(N[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * x), $MachinePrecision] * x + 1.0), $MachinePrecision]
                                                                                                                                                  
                                                                                                                                                  \begin{array}{l}
                                                                                                                                                  
                                                                                                                                                  \\
                                                                                                                                                  \mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right) \cdot x, x, 1\right)
                                                                                                                                                  \end{array}
                                                                                                                                                  
                                                                                                                                                  Derivation
                                                                                                                                                  1. Initial program 75.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. Applied rewrites57.6%

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

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

                                                                                                                                                        \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{-0.5}, 1\right) \]
                                                                                                                                                      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 rewrites49.2%

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

                                                                                                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right) \cdot x, x, 1\right) \]
                                                                                                                                                          2. Final simplification49.2%

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

                                                                                                                                                          Alternative 11: 52.9% accurate, 16.1× speedup?

                                                                                                                                                          \[\begin{array}{l} \\ \mathsf{fma}\left(0.3333333333333333 \cdot x, x \cdot x, 1\right) \end{array} \]
                                                                                                                                                          (FPCore (x eps) :precision binary64 (fma (* 0.3333333333333333 x) (* x x) 1.0))
                                                                                                                                                          double code(double x, double eps) {
                                                                                                                                                          	return fma((0.3333333333333333 * x), (x * x), 1.0);
                                                                                                                                                          }
                                                                                                                                                          
                                                                                                                                                          function code(x, eps)
                                                                                                                                                          	return fma(Float64(0.3333333333333333 * x), Float64(x * x), 1.0)
                                                                                                                                                          end
                                                                                                                                                          
                                                                                                                                                          code[x_, eps_] := N[(N[(0.3333333333333333 * x), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]
                                                                                                                                                          
                                                                                                                                                          \begin{array}{l}
                                                                                                                                                          
                                                                                                                                                          \\
                                                                                                                                                          \mathsf{fma}\left(0.3333333333333333 \cdot x, x \cdot x, 1\right)
                                                                                                                                                          \end{array}
                                                                                                                                                          
                                                                                                                                                          Derivation
                                                                                                                                                          1. Initial program 75.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. Applied rewrites57.6%

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

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

                                                                                                                                                                \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{-0.5}, 1\right) \]
                                                                                                                                                              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 rewrites49.2%

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

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

                                                                                                                                                                    \[\leadsto \mathsf{fma}\left(0.3333333333333333 \cdot x, x \cdot x, 1\right) \]
                                                                                                                                                                  2. Final simplification49.0%

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

                                                                                                                                                                  Alternative 12: 44.8% 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;
                                                                                                                                                                  }
                                                                                                                                                                  
                                                                                                                                                                  module fmin_fmax_functions
                                                                                                                                                                      implicit none
                                                                                                                                                                      private
                                                                                                                                                                      public fmax
                                                                                                                                                                      public fmin
                                                                                                                                                                  
                                                                                                                                                                      interface fmax
                                                                                                                                                                          module procedure fmax88
                                                                                                                                                                          module procedure fmax44
                                                                                                                                                                          module procedure fmax84
                                                                                                                                                                          module procedure fmax48
                                                                                                                                                                      end interface
                                                                                                                                                                      interface fmin
                                                                                                                                                                          module procedure fmin88
                                                                                                                                                                          module procedure fmin44
                                                                                                                                                                          module procedure fmin84
                                                                                                                                                                          module procedure fmin48
                                                                                                                                                                      end interface
                                                                                                                                                                  contains
                                                                                                                                                                      real(8) function fmax88(x, y) result (res)
                                                                                                                                                                          real(8), intent (in) :: x
                                                                                                                                                                          real(8), intent (in) :: y
                                                                                                                                                                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                                                                                                                      end function
                                                                                                                                                                      real(4) function fmax44(x, y) result (res)
                                                                                                                                                                          real(4), intent (in) :: x
                                                                                                                                                                          real(4), intent (in) :: y
                                                                                                                                                                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                                                                                                                      end function
                                                                                                                                                                      real(8) function fmax84(x, y) result(res)
                                                                                                                                                                          real(8), intent (in) :: x
                                                                                                                                                                          real(4), intent (in) :: y
                                                                                                                                                                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                                                                                                                      end function
                                                                                                                                                                      real(8) function fmax48(x, y) result(res)
                                                                                                                                                                          real(4), intent (in) :: x
                                                                                                                                                                          real(8), intent (in) :: y
                                                                                                                                                                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                                                                                                                      end function
                                                                                                                                                                      real(8) function fmin88(x, y) result (res)
                                                                                                                                                                          real(8), intent (in) :: x
                                                                                                                                                                          real(8), intent (in) :: y
                                                                                                                                                                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                                                                                                                      end function
                                                                                                                                                                      real(4) function fmin44(x, y) result (res)
                                                                                                                                                                          real(4), intent (in) :: x
                                                                                                                                                                          real(4), intent (in) :: y
                                                                                                                                                                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                                                                                                                      end function
                                                                                                                                                                      real(8) function fmin84(x, y) result(res)
                                                                                                                                                                          real(8), intent (in) :: x
                                                                                                                                                                          real(4), intent (in) :: y
                                                                                                                                                                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                                                                                                                      end function
                                                                                                                                                                      real(8) function fmin48(x, y) result(res)
                                                                                                                                                                          real(4), intent (in) :: x
                                                                                                                                                                          real(8), intent (in) :: y
                                                                                                                                                                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                                                                                                                      end function
                                                                                                                                                                  end module
                                                                                                                                                                  
                                                                                                                                                                  real(8) function code(x, eps)
                                                                                                                                                                  use fmin_fmax_functions
                                                                                                                                                                      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 75.0%

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

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

                                                                                                                                                                      \[\leadsto \color{blue}{1} \]
                                                                                                                                                                    2. Final simplification41.2%

                                                                                                                                                                      \[\leadsto 1 \]
                                                                                                                                                                    3. Add Preprocessing

                                                                                                                                                                    Reproduce

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