NMSE Section 6.1 mentioned, A

Percentage Accurate: 73.0% → 100.0%
Time: 5.7s
Alternatives: 15
Speedup: 2.1×

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}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 73.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: 100.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \left(x + 1\right) \cdot e^{-x}\\
\mathbf{if}\;eps\_m \leq 10^{-8}:\\
\;\;\;\;\left(t\_0 - -1 \cdot t\_0\right) \cdot 0.5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if eps < 1e-8

    1. Initial program 35.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. 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. *-commutativeN/A

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

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

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

    if 1e-8 < 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. Step-by-step derivation
      1. lift-exp.f64N/A

        \[\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}{e^{-\left(1 + \varepsilon\right) \cdot x}}}{2} \]
      2. lift-neg.f64N/A

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

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

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

        \[\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}{\frac{1}{e^{\left(1 + \varepsilon\right) \cdot x}}}}{2} \]
      6. lower-/.f64N/A

        \[\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}{\frac{1}{e^{\left(1 + \varepsilon\right) \cdot x}}}}{2} \]
      7. lower-exp.f64N/A

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

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

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

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

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

        \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot \frac{1}{e^{\color{blue}{\mathsf{fma}\left(x, \varepsilon, x\right)}}}}{2} \]
    3. Applied rewrites100.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}{\frac{1}{e^{\mathsf{fma}\left(x, \varepsilon, x\right)}}}}{2} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 57.8% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 53.3%

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

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

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

      if 1.99999999999999988e39 < (/.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 99.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. Taylor expanded in eps around inf

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

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

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

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

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

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

          \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
        3. Step-by-step derivation
          1. distribute-lft-neg-inN/A

            \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
          2. rec-expN/A

            \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
          3. mul-1-negN/A

            \[\leadsto \left(\left(1 + \left(\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
          4. distribute-lft-neg-inN/A

            \[\leadsto \left(\left(1 + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(1 - \varepsilon\right)\right) - -1\right) \cdot \frac{1}{2} \]
          5. +-commutativeN/A

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

            \[\leadsto \left(\mathsf{fma}\left(\mathsf{neg}\left(x\right), 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
          7. lift-neg.f64N/A

            \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
          8. lift--.f6419.3

            \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot 0.5 \]
        4. Applied rewrites19.3%

          \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot 0.5 \]
        5. Step-by-step derivation
          1. lift--.f64N/A

            \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
          2. flip--N/A

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

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

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

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

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

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

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

            \[\leadsto \left(\mathsf{fma}\left(-x, \frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon + 1}, 1\right) - -1\right) \cdot \frac{1}{2} \]
          10. lower-+.f6434.5

            \[\leadsto \left(\mathsf{fma}\left(-x, \frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon + 1}, 1\right) - -1\right) \cdot 0.5 \]
        6. Applied rewrites34.5%

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

      Alternative 3: 100.0% accurate, 1.1× speedup?

      \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} t_0 := \left(x + 1\right) \cdot e^{-x}\\ \mathbf{if}\;eps\_m \leq 4 \cdot 10^{-6}:\\ \;\;\;\;\left(t\_0 - -1 \cdot t\_0\right) \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{e^{x \cdot \left(1 - eps\_m\right)}} - \left(-e^{-x \cdot eps\_m}\right)\right) \cdot 0.5\\ \end{array} \end{array} \]
      eps_m = (fabs.f64 eps)
      (FPCore (x eps_m)
       :precision binary64
       (let* ((t_0 (* (+ x 1.0) (exp (- x)))))
         (if (<= eps_m 4e-6)
           (* (- t_0 (* -1.0 t_0)) 0.5)
           (* (- (/ 1.0 (exp (* x (- 1.0 eps_m)))) (- (exp (- (* x eps_m))))) 0.5))))
      eps_m = fabs(eps);
      double code(double x, double eps_m) {
      	double t_0 = (x + 1.0) * exp(-x);
      	double tmp;
      	if (eps_m <= 4e-6) {
      		tmp = (t_0 - (-1.0 * t_0)) * 0.5;
      	} else {
      		tmp = ((1.0 / exp((x * (1.0 - eps_m)))) - -exp(-(x * eps_m))) * 0.5;
      	}
      	return tmp;
      }
      
      eps_m =     private
      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_m)
      use fmin_fmax_functions
          real(8), intent (in) :: x
          real(8), intent (in) :: eps_m
          real(8) :: t_0
          real(8) :: tmp
          t_0 = (x + 1.0d0) * exp(-x)
          if (eps_m <= 4d-6) then
              tmp = (t_0 - ((-1.0d0) * t_0)) * 0.5d0
          else
              tmp = ((1.0d0 / exp((x * (1.0d0 - eps_m)))) - -exp(-(x * eps_m))) * 0.5d0
          end if
          code = tmp
      end function
      
      eps_m = Math.abs(eps);
      public static double code(double x, double eps_m) {
      	double t_0 = (x + 1.0) * Math.exp(-x);
      	double tmp;
      	if (eps_m <= 4e-6) {
      		tmp = (t_0 - (-1.0 * t_0)) * 0.5;
      	} else {
      		tmp = ((1.0 / Math.exp((x * (1.0 - eps_m)))) - -Math.exp(-(x * eps_m))) * 0.5;
      	}
      	return tmp;
      }
      
      eps_m = math.fabs(eps)
      def code(x, eps_m):
      	t_0 = (x + 1.0) * math.exp(-x)
      	tmp = 0
      	if eps_m <= 4e-6:
      		tmp = (t_0 - (-1.0 * t_0)) * 0.5
      	else:
      		tmp = ((1.0 / math.exp((x * (1.0 - eps_m)))) - -math.exp(-(x * eps_m))) * 0.5
      	return tmp
      
      eps_m = abs(eps)
      function code(x, eps_m)
      	t_0 = Float64(Float64(x + 1.0) * exp(Float64(-x)))
      	tmp = 0.0
      	if (eps_m <= 4e-6)
      		tmp = Float64(Float64(t_0 - Float64(-1.0 * t_0)) * 0.5);
      	else
      		tmp = Float64(Float64(Float64(1.0 / exp(Float64(x * Float64(1.0 - eps_m)))) - Float64(-exp(Float64(-Float64(x * eps_m))))) * 0.5);
      	end
      	return tmp
      end
      
      eps_m = abs(eps);
      function tmp_2 = code(x, eps_m)
      	t_0 = (x + 1.0) * exp(-x);
      	tmp = 0.0;
      	if (eps_m <= 4e-6)
      		tmp = (t_0 - (-1.0 * t_0)) * 0.5;
      	else
      		tmp = ((1.0 / exp((x * (1.0 - eps_m)))) - -exp(-(x * eps_m))) * 0.5;
      	end
      	tmp_2 = tmp;
      end
      
      eps_m = N[Abs[eps], $MachinePrecision]
      code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(x + 1.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps$95$m, 4e-6], N[(N[(t$95$0 - N[(-1.0 * t$95$0), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(1.0 / N[Exp[N[(x * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - (-N[Exp[(-N[(x * eps$95$m), $MachinePrecision])], $MachinePrecision])), $MachinePrecision] * 0.5), $MachinePrecision]]]
      
      \begin{array}{l}
      eps_m = \left|\varepsilon\right|
      
      \\
      \begin{array}{l}
      t_0 := \left(x + 1\right) \cdot e^{-x}\\
      \mathbf{if}\;eps\_m \leq 4 \cdot 10^{-6}:\\
      \;\;\;\;\left(t\_0 - -1 \cdot t\_0\right) \cdot 0.5\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(\frac{1}{e^{x \cdot \left(1 - eps\_m\right)}} - \left(-e^{-x \cdot eps\_m}\right)\right) \cdot 0.5\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if eps < 3.99999999999999982e-6

        1. Initial program 36.3%

          \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
        2. 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. *-commutativeN/A

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

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

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

        if 3.99999999999999982e-6 < 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. Taylor expanded in eps around inf

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

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

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

          \[\leadsto \color{blue}{\left(e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
        5. Step-by-step derivation
          1. lift-exp.f64N/A

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(\frac{1}{e^{x \cdot \left(1 - \varepsilon\right)}} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot \frac{1}{2} \]
          12. lift--.f64100.0

            \[\leadsto \left(\frac{1}{e^{x \cdot \left(1 - \varepsilon\right)}} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
        6. Applied rewrites100.0%

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

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

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

            \[\leadsto \left(\frac{1}{e^{x \cdot \left(1 - \varepsilon\right)}} - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot 0.5 \]
        9. Applied rewrites100.0%

          \[\leadsto \left(\frac{1}{e^{x \cdot \left(1 - \varepsilon\right)}} - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot 0.5 \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 4: 99.8% accurate, 1.1× speedup?

      \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} t_0 := \left(x + 1\right) \cdot e^{-x}\\ \mathbf{if}\;eps\_m \leq 0.0036:\\ \;\;\;\;\left(t\_0 - -1 \cdot t\_0\right) \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{1}{e^{x \cdot \left(-eps\_m\right)}} - \left(-e^{-x \cdot eps\_m}\right)\right) \cdot 0.5\\ \end{array} \end{array} \]
      eps_m = (fabs.f64 eps)
      (FPCore (x eps_m)
       :precision binary64
       (let* ((t_0 (* (+ x 1.0) (exp (- x)))))
         (if (<= eps_m 0.0036)
           (* (- t_0 (* -1.0 t_0)) 0.5)
           (* (- (/ 1.0 (exp (* x (- eps_m)))) (- (exp (- (* x eps_m))))) 0.5))))
      eps_m = fabs(eps);
      double code(double x, double eps_m) {
      	double t_0 = (x + 1.0) * exp(-x);
      	double tmp;
      	if (eps_m <= 0.0036) {
      		tmp = (t_0 - (-1.0 * t_0)) * 0.5;
      	} else {
      		tmp = ((1.0 / exp((x * -eps_m))) - -exp(-(x * eps_m))) * 0.5;
      	}
      	return tmp;
      }
      
      eps_m =     private
      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_m)
      use fmin_fmax_functions
          real(8), intent (in) :: x
          real(8), intent (in) :: eps_m
          real(8) :: t_0
          real(8) :: tmp
          t_0 = (x + 1.0d0) * exp(-x)
          if (eps_m <= 0.0036d0) then
              tmp = (t_0 - ((-1.0d0) * t_0)) * 0.5d0
          else
              tmp = ((1.0d0 / exp((x * -eps_m))) - -exp(-(x * eps_m))) * 0.5d0
          end if
          code = tmp
      end function
      
      eps_m = Math.abs(eps);
      public static double code(double x, double eps_m) {
      	double t_0 = (x + 1.0) * Math.exp(-x);
      	double tmp;
      	if (eps_m <= 0.0036) {
      		tmp = (t_0 - (-1.0 * t_0)) * 0.5;
      	} else {
      		tmp = ((1.0 / Math.exp((x * -eps_m))) - -Math.exp(-(x * eps_m))) * 0.5;
      	}
      	return tmp;
      }
      
      eps_m = math.fabs(eps)
      def code(x, eps_m):
      	t_0 = (x + 1.0) * math.exp(-x)
      	tmp = 0
      	if eps_m <= 0.0036:
      		tmp = (t_0 - (-1.0 * t_0)) * 0.5
      	else:
      		tmp = ((1.0 / math.exp((x * -eps_m))) - -math.exp(-(x * eps_m))) * 0.5
      	return tmp
      
      eps_m = abs(eps)
      function code(x, eps_m)
      	t_0 = Float64(Float64(x + 1.0) * exp(Float64(-x)))
      	tmp = 0.0
      	if (eps_m <= 0.0036)
      		tmp = Float64(Float64(t_0 - Float64(-1.0 * t_0)) * 0.5);
      	else
      		tmp = Float64(Float64(Float64(1.0 / exp(Float64(x * Float64(-eps_m)))) - Float64(-exp(Float64(-Float64(x * eps_m))))) * 0.5);
      	end
      	return tmp
      end
      
      eps_m = abs(eps);
      function tmp_2 = code(x, eps_m)
      	t_0 = (x + 1.0) * exp(-x);
      	tmp = 0.0;
      	if (eps_m <= 0.0036)
      		tmp = (t_0 - (-1.0 * t_0)) * 0.5;
      	else
      		tmp = ((1.0 / exp((x * -eps_m))) - -exp(-(x * eps_m))) * 0.5;
      	end
      	tmp_2 = tmp;
      end
      
      eps_m = N[Abs[eps], $MachinePrecision]
      code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(x + 1.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps$95$m, 0.0036], N[(N[(t$95$0 - N[(-1.0 * t$95$0), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(1.0 / N[Exp[N[(x * (-eps$95$m)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - (-N[Exp[(-N[(x * eps$95$m), $MachinePrecision])], $MachinePrecision])), $MachinePrecision] * 0.5), $MachinePrecision]]]
      
      \begin{array}{l}
      eps_m = \left|\varepsilon\right|
      
      \\
      \begin{array}{l}
      t_0 := \left(x + 1\right) \cdot e^{-x}\\
      \mathbf{if}\;eps\_m \leq 0.0036:\\
      \;\;\;\;\left(t\_0 - -1 \cdot t\_0\right) \cdot 0.5\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(\frac{1}{e^{x \cdot \left(-eps\_m\right)}} - \left(-e^{-x \cdot eps\_m}\right)\right) \cdot 0.5\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if eps < 0.0035999999999999999

        1. Initial program 37.2%

          \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
        2. 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. *-commutativeN/A

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

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

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

        if 0.0035999999999999999 < 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. Taylor expanded in eps around inf

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

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

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

          \[\leadsto \color{blue}{\left(e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
        5. Step-by-step derivation
          1. lift-exp.f64N/A

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(\frac{1}{e^{x \cdot \left(1 - \varepsilon\right)}} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot \frac{1}{2} \]
          12. lift--.f64100.0

            \[\leadsto \left(\frac{1}{e^{x \cdot \left(1 - \varepsilon\right)}} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
        6. Applied rewrites100.0%

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

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

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

            \[\leadsto \left(\frac{1}{e^{x \cdot \left(1 - \varepsilon\right)}} - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot 0.5 \]
        9. Applied rewrites100.0%

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

          \[\leadsto \left(\frac{1}{e^{x \cdot \left(-1 \cdot \varepsilon\right)}} - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot \frac{1}{2} \]
        11. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto \left(\frac{1}{e^{x \cdot \left(\mathsf{neg}\left(\varepsilon\right)\right)}} - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot \frac{1}{2} \]
          2. lower-neg.f6499.7

            \[\leadsto \left(\frac{1}{e^{x \cdot \left(-\varepsilon\right)}} - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot 0.5 \]
        12. Applied rewrites99.7%

          \[\leadsto \left(\frac{1}{e^{x \cdot \left(-\varepsilon\right)}} - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot 0.5 \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 5: 99.8% accurate, 1.1× speedup?

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

        1. Initial program 37.2%

          \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
        2. 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. *-commutativeN/A

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

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

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

        if 0.0035999999999999999 < 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. Taylor expanded in eps around inf

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

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

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

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

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

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

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

            \[\leadsto \left(e^{x \cdot \varepsilon} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot \frac{1}{2} \]
          4. lower-*.f6499.7

            \[\leadsto \left(e^{x \cdot \varepsilon} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
        7. Applied rewrites99.7%

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

      Alternative 6: 92.0% accurate, 1.2× speedup?

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

        1. Initial program 34.4%

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

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

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

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

          \[\leadsto \color{blue}{\left(e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
        5. Step-by-step derivation
          1. lift-exp.f64N/A

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(\frac{1}{e^{x \cdot \left(1 - \varepsilon\right)}} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot \frac{1}{2} \]
          12. lift--.f6497.8

            \[\leadsto \left(\frac{1}{e^{x \cdot \left(1 - \varepsilon\right)}} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
        6. Applied rewrites97.8%

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

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

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

            \[\leadsto \left(\frac{1}{\mathsf{fma}\left(x, 1 - \varepsilon, 1\right)} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot \frac{1}{2} \]
          3. lift--.f6467.3

            \[\leadsto \left(\frac{1}{\mathsf{fma}\left(x, 1 - \varepsilon, 1\right)} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
        9. Applied rewrites67.3%

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

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

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

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

            \[\leadsto \left(\frac{1}{\mathsf{fma}\left(-1, x, \frac{1}{\varepsilon} + \frac{x}{\varepsilon}\right) \cdot \varepsilon} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot \frac{1}{2} \]
          4. div-add-revN/A

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

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

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

            \[\leadsto \left(\frac{1}{\mathsf{fma}\left(-1, x, \frac{x + 1}{\varepsilon}\right) \cdot \varepsilon} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
        12. Applied rewrites84.9%

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

        if 1.05e-33 < eps < 0.0035999999999999999

        1. Initial program 62.4%

          \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
        2. 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} \]
        3. Step-by-step derivation
          1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot \mathsf{fma}\left(\varepsilon - 1, x, 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot \mathsf{fma}\left(-1, \mathsf{fma}\left(x, \varepsilon, x\right), 1\right)}{2} \]
        7. Applied rewrites53.6%

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

        if 0.0035999999999999999 < 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. Taylor expanded in eps around inf

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

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

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

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

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

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

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

            \[\leadsto \left(e^{x \cdot \varepsilon} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot \frac{1}{2} \]
          4. lower-*.f6499.7

            \[\leadsto \left(e^{x \cdot \varepsilon} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
        7. Applied rewrites99.7%

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

      Alternative 7: 99.0% accurate, 1.2× speedup?

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

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

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

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

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

      Alternative 8: 84.9% accurate, 2.0× speedup?

      \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -2.15 \cdot 10^{-268}:\\ \;\;\;\;\left(1 - \left(-e^{-x \cdot eps\_m}\right)\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{+93}:\\ \;\;\;\;\left(e^{x \cdot eps\_m} - -1\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{+167}:\\ \;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) \cdot 1 - \left(\frac{1}{eps\_m} - 1\right) \cdot 1}{2}\\ \mathbf{else}:\\ \;\;\;\;\left(e^{\left(-x\right) \cdot \left(1 - eps\_m\right)} - -1\right) \cdot 0.5\\ \end{array} \end{array} \]
      eps_m = (fabs.f64 eps)
      (FPCore (x eps_m)
       :precision binary64
       (if (<= x -2.15e-268)
         (* (- 1.0 (- (exp (- (* x eps_m))))) 0.5)
         (if (<= x 7.2e+93)
           (* (- (exp (* x eps_m)) -1.0) 0.5)
           (if (<= x 1.2e+167)
             (/ (- (* (+ 1.0 (/ 1.0 eps_m)) 1.0) (* (- (/ 1.0 eps_m) 1.0) 1.0)) 2.0)
             (* (- (exp (* (- x) (- 1.0 eps_m))) -1.0) 0.5)))))
      eps_m = fabs(eps);
      double code(double x, double eps_m) {
      	double tmp;
      	if (x <= -2.15e-268) {
      		tmp = (1.0 - -exp(-(x * eps_m))) * 0.5;
      	} else if (x <= 7.2e+93) {
      		tmp = (exp((x * eps_m)) - -1.0) * 0.5;
      	} else if (x <= 1.2e+167) {
      		tmp = (((1.0 + (1.0 / eps_m)) * 1.0) - (((1.0 / eps_m) - 1.0) * 1.0)) / 2.0;
      	} else {
      		tmp = (exp((-x * (1.0 - eps_m))) - -1.0) * 0.5;
      	}
      	return tmp;
      }
      
      eps_m =     private
      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_m)
      use fmin_fmax_functions
          real(8), intent (in) :: x
          real(8), intent (in) :: eps_m
          real(8) :: tmp
          if (x <= (-2.15d-268)) then
              tmp = (1.0d0 - -exp(-(x * eps_m))) * 0.5d0
          else if (x <= 7.2d+93) then
              tmp = (exp((x * eps_m)) - (-1.0d0)) * 0.5d0
          else if (x <= 1.2d+167) then
              tmp = (((1.0d0 + (1.0d0 / eps_m)) * 1.0d0) - (((1.0d0 / eps_m) - 1.0d0) * 1.0d0)) / 2.0d0
          else
              tmp = (exp((-x * (1.0d0 - eps_m))) - (-1.0d0)) * 0.5d0
          end if
          code = tmp
      end function
      
      eps_m = Math.abs(eps);
      public static double code(double x, double eps_m) {
      	double tmp;
      	if (x <= -2.15e-268) {
      		tmp = (1.0 - -Math.exp(-(x * eps_m))) * 0.5;
      	} else if (x <= 7.2e+93) {
      		tmp = (Math.exp((x * eps_m)) - -1.0) * 0.5;
      	} else if (x <= 1.2e+167) {
      		tmp = (((1.0 + (1.0 / eps_m)) * 1.0) - (((1.0 / eps_m) - 1.0) * 1.0)) / 2.0;
      	} else {
      		tmp = (Math.exp((-x * (1.0 - eps_m))) - -1.0) * 0.5;
      	}
      	return tmp;
      }
      
      eps_m = math.fabs(eps)
      def code(x, eps_m):
      	tmp = 0
      	if x <= -2.15e-268:
      		tmp = (1.0 - -math.exp(-(x * eps_m))) * 0.5
      	elif x <= 7.2e+93:
      		tmp = (math.exp((x * eps_m)) - -1.0) * 0.5
      	elif x <= 1.2e+167:
      		tmp = (((1.0 + (1.0 / eps_m)) * 1.0) - (((1.0 / eps_m) - 1.0) * 1.0)) / 2.0
      	else:
      		tmp = (math.exp((-x * (1.0 - eps_m))) - -1.0) * 0.5
      	return tmp
      
      eps_m = abs(eps)
      function code(x, eps_m)
      	tmp = 0.0
      	if (x <= -2.15e-268)
      		tmp = Float64(Float64(1.0 - Float64(-exp(Float64(-Float64(x * eps_m))))) * 0.5);
      	elseif (x <= 7.2e+93)
      		tmp = Float64(Float64(exp(Float64(x * eps_m)) - -1.0) * 0.5);
      	elseif (x <= 1.2e+167)
      		tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * 1.0) - Float64(Float64(Float64(1.0 / eps_m) - 1.0) * 1.0)) / 2.0);
      	else
      		tmp = Float64(Float64(exp(Float64(Float64(-x) * Float64(1.0 - eps_m))) - -1.0) * 0.5);
      	end
      	return tmp
      end
      
      eps_m = abs(eps);
      function tmp_2 = code(x, eps_m)
      	tmp = 0.0;
      	if (x <= -2.15e-268)
      		tmp = (1.0 - -exp(-(x * eps_m))) * 0.5;
      	elseif (x <= 7.2e+93)
      		tmp = (exp((x * eps_m)) - -1.0) * 0.5;
      	elseif (x <= 1.2e+167)
      		tmp = (((1.0 + (1.0 / eps_m)) * 1.0) - (((1.0 / eps_m) - 1.0) * 1.0)) / 2.0;
      	else
      		tmp = (exp((-x * (1.0 - eps_m))) - -1.0) * 0.5;
      	end
      	tmp_2 = tmp;
      end
      
      eps_m = N[Abs[eps], $MachinePrecision]
      code[x_, eps$95$m_] := If[LessEqual[x, -2.15e-268], N[(N[(1.0 - (-N[Exp[(-N[(x * eps$95$m), $MachinePrecision])], $MachinePrecision])), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 7.2e+93], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 1.2e+167], N[(N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] - N[(N[(N[(1.0 / eps$95$m), $MachinePrecision] - 1.0), $MachinePrecision] * 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[((-x) * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] * 0.5), $MachinePrecision]]]]
      
      \begin{array}{l}
      eps_m = \left|\varepsilon\right|
      
      \\
      \begin{array}{l}
      \mathbf{if}\;x \leq -2.15 \cdot 10^{-268}:\\
      \;\;\;\;\left(1 - \left(-e^{-x \cdot eps\_m}\right)\right) \cdot 0.5\\
      
      \mathbf{elif}\;x \leq 7.2 \cdot 10^{+93}:\\
      \;\;\;\;\left(e^{x \cdot eps\_m} - -1\right) \cdot 0.5\\
      
      \mathbf{elif}\;x \leq 1.2 \cdot 10^{+167}:\\
      \;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) \cdot 1 - \left(\frac{1}{eps\_m} - 1\right) \cdot 1}{2}\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(e^{\left(-x\right) \cdot \left(1 - eps\_m\right)} - -1\right) \cdot 0.5\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if x < -2.15e-268

        1. Initial program 69.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. Taylor expanded in eps around inf

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

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

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

          \[\leadsto \color{blue}{\left(e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
        5. Step-by-step derivation
          1. lift-exp.f64N/A

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(\frac{1}{e^{x \cdot \left(1 - \varepsilon\right)}} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot \frac{1}{2} \]
          12. lift--.f6498.7

            \[\leadsto \left(\frac{1}{e^{x \cdot \left(1 - \varepsilon\right)}} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
        6. Applied rewrites98.7%

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

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

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

            \[\leadsto \left(\frac{1}{e^{x \cdot \left(1 - \varepsilon\right)}} - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot 0.5 \]
        9. Applied rewrites98.8%

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

          \[\leadsto \left(1 - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot \frac{1}{2} \]
        11. Step-by-step derivation
          1. rec-exp98.5

            \[\leadsto \left(1 - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot 0.5 \]
          2. *-commutative98.5

            \[\leadsto \left(1 - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot 0.5 \]
          3. distribute-rgt-neg-in98.5

            \[\leadsto \left(1 - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot 0.5 \]
          4. *-commutative98.5

            \[\leadsto \left(1 - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot 0.5 \]
        12. Applied rewrites98.5%

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

        if -2.15e-268 < x < 7.1999999999999998e93

        1. Initial program 62.6%

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

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

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

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

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

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

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

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

              \[\leadsto \left(e^{x \cdot \varepsilon} - -1\right) \cdot \frac{1}{2} \]
            2. lower-*.f6488.4

              \[\leadsto \left(e^{x \cdot \varepsilon} - -1\right) \cdot 0.5 \]
          4. Applied rewrites88.4%

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

          if 7.1999999999999998e93 < x < 1.19999999999999999e167

          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. 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}{1}}{2} \]
          3. Step-by-step derivation
            1. Applied rewrites51.5%

              \[\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}{1}}{2} \]
            2. Taylor expanded in x around 0

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

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

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

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

                \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot \mathsf{fma}\left(\varepsilon - 1, x, 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
            4. Applied rewrites22.1%

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

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

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

              if 1.19999999999999999e167 < 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. Taylor expanded in eps around inf

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

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

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

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

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

                  \[\leadsto \left(e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - -1\right) \cdot 0.5 \]
              7. Recombined 4 regimes into one program.
              8. Add Preprocessing

              Alternative 9: 84.8% accurate, 2.1× speedup?

              \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} t_0 := \left(e^{x \cdot eps\_m} - -1\right) \cdot 0.5\\ \mathbf{if}\;x \leq -2.15 \cdot 10^{-268}:\\ \;\;\;\;\left(1 - \left(-e^{-x \cdot eps\_m}\right)\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{+93}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{+167}:\\ \;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) \cdot 1 - \left(\frac{1}{eps\_m} - 1\right) \cdot 1}{2}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
              eps_m = (fabs.f64 eps)
              (FPCore (x eps_m)
               :precision binary64
               (let* ((t_0 (* (- (exp (* x eps_m)) -1.0) 0.5)))
                 (if (<= x -2.15e-268)
                   (* (- 1.0 (- (exp (- (* x eps_m))))) 0.5)
                   (if (<= x 7.2e+93)
                     t_0
                     (if (<= x 1.2e+167)
                       (/
                        (- (* (+ 1.0 (/ 1.0 eps_m)) 1.0) (* (- (/ 1.0 eps_m) 1.0) 1.0))
                        2.0)
                       t_0)))))
              eps_m = fabs(eps);
              double code(double x, double eps_m) {
              	double t_0 = (exp((x * eps_m)) - -1.0) * 0.5;
              	double tmp;
              	if (x <= -2.15e-268) {
              		tmp = (1.0 - -exp(-(x * eps_m))) * 0.5;
              	} else if (x <= 7.2e+93) {
              		tmp = t_0;
              	} else if (x <= 1.2e+167) {
              		tmp = (((1.0 + (1.0 / eps_m)) * 1.0) - (((1.0 / eps_m) - 1.0) * 1.0)) / 2.0;
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              eps_m =     private
              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_m)
              use fmin_fmax_functions
                  real(8), intent (in) :: x
                  real(8), intent (in) :: eps_m
                  real(8) :: t_0
                  real(8) :: tmp
                  t_0 = (exp((x * eps_m)) - (-1.0d0)) * 0.5d0
                  if (x <= (-2.15d-268)) then
                      tmp = (1.0d0 - -exp(-(x * eps_m))) * 0.5d0
                  else if (x <= 7.2d+93) then
                      tmp = t_0
                  else if (x <= 1.2d+167) then
                      tmp = (((1.0d0 + (1.0d0 / eps_m)) * 1.0d0) - (((1.0d0 / eps_m) - 1.0d0) * 1.0d0)) / 2.0d0
                  else
                      tmp = t_0
                  end if
                  code = tmp
              end function
              
              eps_m = Math.abs(eps);
              public static double code(double x, double eps_m) {
              	double t_0 = (Math.exp((x * eps_m)) - -1.0) * 0.5;
              	double tmp;
              	if (x <= -2.15e-268) {
              		tmp = (1.0 - -Math.exp(-(x * eps_m))) * 0.5;
              	} else if (x <= 7.2e+93) {
              		tmp = t_0;
              	} else if (x <= 1.2e+167) {
              		tmp = (((1.0 + (1.0 / eps_m)) * 1.0) - (((1.0 / eps_m) - 1.0) * 1.0)) / 2.0;
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              eps_m = math.fabs(eps)
              def code(x, eps_m):
              	t_0 = (math.exp((x * eps_m)) - -1.0) * 0.5
              	tmp = 0
              	if x <= -2.15e-268:
              		tmp = (1.0 - -math.exp(-(x * eps_m))) * 0.5
              	elif x <= 7.2e+93:
              		tmp = t_0
              	elif x <= 1.2e+167:
              		tmp = (((1.0 + (1.0 / eps_m)) * 1.0) - (((1.0 / eps_m) - 1.0) * 1.0)) / 2.0
              	else:
              		tmp = t_0
              	return tmp
              
              eps_m = abs(eps)
              function code(x, eps_m)
              	t_0 = Float64(Float64(exp(Float64(x * eps_m)) - -1.0) * 0.5)
              	tmp = 0.0
              	if (x <= -2.15e-268)
              		tmp = Float64(Float64(1.0 - Float64(-exp(Float64(-Float64(x * eps_m))))) * 0.5);
              	elseif (x <= 7.2e+93)
              		tmp = t_0;
              	elseif (x <= 1.2e+167)
              		tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * 1.0) - Float64(Float64(Float64(1.0 / eps_m) - 1.0) * 1.0)) / 2.0);
              	else
              		tmp = t_0;
              	end
              	return tmp
              end
              
              eps_m = abs(eps);
              function tmp_2 = code(x, eps_m)
              	t_0 = (exp((x * eps_m)) - -1.0) * 0.5;
              	tmp = 0.0;
              	if (x <= -2.15e-268)
              		tmp = (1.0 - -exp(-(x * eps_m))) * 0.5;
              	elseif (x <= 7.2e+93)
              		tmp = t_0;
              	elseif (x <= 1.2e+167)
              		tmp = (((1.0 + (1.0 / eps_m)) * 1.0) - (((1.0 / eps_m) - 1.0) * 1.0)) / 2.0;
              	else
              		tmp = t_0;
              	end
              	tmp_2 = tmp;
              end
              
              eps_m = N[Abs[eps], $MachinePrecision]
              code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[x, -2.15e-268], N[(N[(1.0 - (-N[Exp[(-N[(x * eps$95$m), $MachinePrecision])], $MachinePrecision])), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 7.2e+93], t$95$0, If[LessEqual[x, 1.2e+167], N[(N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] - N[(N[(N[(1.0 / eps$95$m), $MachinePrecision] - 1.0), $MachinePrecision] * 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], t$95$0]]]]
              
              \begin{array}{l}
              eps_m = \left|\varepsilon\right|
              
              \\
              \begin{array}{l}
              t_0 := \left(e^{x \cdot eps\_m} - -1\right) \cdot 0.5\\
              \mathbf{if}\;x \leq -2.15 \cdot 10^{-268}:\\
              \;\;\;\;\left(1 - \left(-e^{-x \cdot eps\_m}\right)\right) \cdot 0.5\\
              
              \mathbf{elif}\;x \leq 7.2 \cdot 10^{+93}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;x \leq 1.2 \cdot 10^{+167}:\\
              \;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) \cdot 1 - \left(\frac{1}{eps\_m} - 1\right) \cdot 1}{2}\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_0\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if x < -2.15e-268

                1. Initial program 69.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. Taylor expanded in eps around inf

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

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

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

                  \[\leadsto \color{blue}{\left(e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
                5. Step-by-step derivation
                  1. lift-exp.f64N/A

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \left(\frac{1}{e^{x \cdot \left(1 - \varepsilon\right)}} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot \frac{1}{2} \]
                  12. lift--.f6498.7

                    \[\leadsto \left(\frac{1}{e^{x \cdot \left(1 - \varepsilon\right)}} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
                6. Applied rewrites98.7%

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

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

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

                    \[\leadsto \left(\frac{1}{e^{x \cdot \left(1 - \varepsilon\right)}} - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot 0.5 \]
                9. Applied rewrites98.8%

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

                  \[\leadsto \left(1 - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot \frac{1}{2} \]
                11. Step-by-step derivation
                  1. rec-exp98.5

                    \[\leadsto \left(1 - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot 0.5 \]
                  2. *-commutative98.5

                    \[\leadsto \left(1 - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot 0.5 \]
                  3. distribute-rgt-neg-in98.5

                    \[\leadsto \left(1 - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot 0.5 \]
                  4. *-commutative98.5

                    \[\leadsto \left(1 - \left(-e^{-x \cdot \varepsilon}\right)\right) \cdot 0.5 \]
                12. Applied rewrites98.5%

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

                if -2.15e-268 < x < 7.1999999999999998e93 or 1.19999999999999999e167 < x

                1. Initial program 72.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. Taylor expanded in eps around inf

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

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

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

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

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

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

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

                      \[\leadsto \left(e^{x \cdot \varepsilon} - -1\right) \cdot \frac{1}{2} \]
                    2. lower-*.f6479.3

                      \[\leadsto \left(e^{x \cdot \varepsilon} - -1\right) \cdot 0.5 \]
                  4. Applied rewrites79.3%

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

                  if 7.1999999999999998e93 < x < 1.19999999999999999e167

                  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. 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}{1}}{2} \]
                  3. Step-by-step derivation
                    1. Applied rewrites51.5%

                      \[\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}{1}}{2} \]
                    2. Taylor expanded in x around 0

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

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

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

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

                        \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot \mathsf{fma}\left(\varepsilon - 1, x, 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                    4. Applied rewrites22.1%

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

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

                        \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot 1 - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                    7. Recombined 3 regimes into one program.
                    8. Add Preprocessing

                    Alternative 10: 78.2% accurate, 2.1× speedup?

                    \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} t_0 := \left(e^{x \cdot eps\_m} - -1\right) \cdot 0.5\\ \mathbf{if}\;x \leq -1.55:\\ \;\;\;\;\left(e^{-x} - -1\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{+93}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.2 \cdot 10^{+167}:\\ \;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) \cdot 1 - \left(\frac{1}{eps\_m} - 1\right) \cdot 1}{2}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                    eps_m = (fabs.f64 eps)
                    (FPCore (x eps_m)
                     :precision binary64
                     (let* ((t_0 (* (- (exp (* x eps_m)) -1.0) 0.5)))
                       (if (<= x -1.55)
                         (* (- (exp (- x)) -1.0) 0.5)
                         (if (<= x 7.2e+93)
                           t_0
                           (if (<= x 1.2e+167)
                             (/
                              (- (* (+ 1.0 (/ 1.0 eps_m)) 1.0) (* (- (/ 1.0 eps_m) 1.0) 1.0))
                              2.0)
                             t_0)))))
                    eps_m = fabs(eps);
                    double code(double x, double eps_m) {
                    	double t_0 = (exp((x * eps_m)) - -1.0) * 0.5;
                    	double tmp;
                    	if (x <= -1.55) {
                    		tmp = (exp(-x) - -1.0) * 0.5;
                    	} else if (x <= 7.2e+93) {
                    		tmp = t_0;
                    	} else if (x <= 1.2e+167) {
                    		tmp = (((1.0 + (1.0 / eps_m)) * 1.0) - (((1.0 / eps_m) - 1.0) * 1.0)) / 2.0;
                    	} else {
                    		tmp = t_0;
                    	}
                    	return tmp;
                    }
                    
                    eps_m =     private
                    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_m)
                    use fmin_fmax_functions
                        real(8), intent (in) :: x
                        real(8), intent (in) :: eps_m
                        real(8) :: t_0
                        real(8) :: tmp
                        t_0 = (exp((x * eps_m)) - (-1.0d0)) * 0.5d0
                        if (x <= (-1.55d0)) then
                            tmp = (exp(-x) - (-1.0d0)) * 0.5d0
                        else if (x <= 7.2d+93) then
                            tmp = t_0
                        else if (x <= 1.2d+167) then
                            tmp = (((1.0d0 + (1.0d0 / eps_m)) * 1.0d0) - (((1.0d0 / eps_m) - 1.0d0) * 1.0d0)) / 2.0d0
                        else
                            tmp = t_0
                        end if
                        code = tmp
                    end function
                    
                    eps_m = Math.abs(eps);
                    public static double code(double x, double eps_m) {
                    	double t_0 = (Math.exp((x * eps_m)) - -1.0) * 0.5;
                    	double tmp;
                    	if (x <= -1.55) {
                    		tmp = (Math.exp(-x) - -1.0) * 0.5;
                    	} else if (x <= 7.2e+93) {
                    		tmp = t_0;
                    	} else if (x <= 1.2e+167) {
                    		tmp = (((1.0 + (1.0 / eps_m)) * 1.0) - (((1.0 / eps_m) - 1.0) * 1.0)) / 2.0;
                    	} else {
                    		tmp = t_0;
                    	}
                    	return tmp;
                    }
                    
                    eps_m = math.fabs(eps)
                    def code(x, eps_m):
                    	t_0 = (math.exp((x * eps_m)) - -1.0) * 0.5
                    	tmp = 0
                    	if x <= -1.55:
                    		tmp = (math.exp(-x) - -1.0) * 0.5
                    	elif x <= 7.2e+93:
                    		tmp = t_0
                    	elif x <= 1.2e+167:
                    		tmp = (((1.0 + (1.0 / eps_m)) * 1.0) - (((1.0 / eps_m) - 1.0) * 1.0)) / 2.0
                    	else:
                    		tmp = t_0
                    	return tmp
                    
                    eps_m = abs(eps)
                    function code(x, eps_m)
                    	t_0 = Float64(Float64(exp(Float64(x * eps_m)) - -1.0) * 0.5)
                    	tmp = 0.0
                    	if (x <= -1.55)
                    		tmp = Float64(Float64(exp(Float64(-x)) - -1.0) * 0.5);
                    	elseif (x <= 7.2e+93)
                    		tmp = t_0;
                    	elseif (x <= 1.2e+167)
                    		tmp = Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps_m)) * 1.0) - Float64(Float64(Float64(1.0 / eps_m) - 1.0) * 1.0)) / 2.0);
                    	else
                    		tmp = t_0;
                    	end
                    	return tmp
                    end
                    
                    eps_m = abs(eps);
                    function tmp_2 = code(x, eps_m)
                    	t_0 = (exp((x * eps_m)) - -1.0) * 0.5;
                    	tmp = 0.0;
                    	if (x <= -1.55)
                    		tmp = (exp(-x) - -1.0) * 0.5;
                    	elseif (x <= 7.2e+93)
                    		tmp = t_0;
                    	elseif (x <= 1.2e+167)
                    		tmp = (((1.0 + (1.0 / eps_m)) * 1.0) - (((1.0 / eps_m) - 1.0) * 1.0)) / 2.0;
                    	else
                    		tmp = t_0;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    eps_m = N[Abs[eps], $MachinePrecision]
                    code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[x, -1.55], N[(N[(N[Exp[(-x)], $MachinePrecision] - -1.0), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 7.2e+93], t$95$0, If[LessEqual[x, 1.2e+167], N[(N[(N[(N[(1.0 + N[(1.0 / eps$95$m), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision] - N[(N[(N[(1.0 / eps$95$m), $MachinePrecision] - 1.0), $MachinePrecision] * 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], t$95$0]]]]
                    
                    \begin{array}{l}
                    eps_m = \left|\varepsilon\right|
                    
                    \\
                    \begin{array}{l}
                    t_0 := \left(e^{x \cdot eps\_m} - -1\right) \cdot 0.5\\
                    \mathbf{if}\;x \leq -1.55:\\
                    \;\;\;\;\left(e^{-x} - -1\right) \cdot 0.5\\
                    
                    \mathbf{elif}\;x \leq 7.2 \cdot 10^{+93}:\\
                    \;\;\;\;t\_0\\
                    
                    \mathbf{elif}\;x \leq 1.2 \cdot 10^{+167}:\\
                    \;\;\;\;\frac{\left(1 + \frac{1}{eps\_m}\right) \cdot 1 - \left(\frac{1}{eps\_m} - 1\right) \cdot 1}{2}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;t\_0\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 3 regimes
                    2. if x < -1.55000000000000004

                      1. Initial program 98.9%

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

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

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

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

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

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

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

                          \[\leadsto \left(e^{-1 \cdot x} - -1\right) \cdot \frac{1}{2} \]
                        3. Step-by-step derivation
                          1. mul-1-negN/A

                            \[\leadsto \left(e^{\mathsf{neg}\left(x\right)} - -1\right) \cdot \frac{1}{2} \]
                          2. lift-neg.f6497.9

                            \[\leadsto \left(e^{-x} - -1\right) \cdot 0.5 \]
                        4. Applied rewrites97.9%

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

                        if -1.55000000000000004 < x < 7.1999999999999998e93 or 1.19999999999999999e167 < x

                        1. Initial program 65.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. Taylor expanded in eps around inf

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

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

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

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

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

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

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

                              \[\leadsto \left(e^{x \cdot \varepsilon} - -1\right) \cdot \frac{1}{2} \]
                            2. lower-*.f6477.2

                              \[\leadsto \left(e^{x \cdot \varepsilon} - -1\right) \cdot 0.5 \]
                          4. Applied rewrites77.2%

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

                          if 7.1999999999999998e93 < x < 1.19999999999999999e167

                          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. 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}{1}}{2} \]
                          3. Step-by-step derivation
                            1. Applied rewrites51.5%

                              \[\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}{1}}{2} \]
                            2. Taylor expanded in x around 0

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

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

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

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

                                \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot \mathsf{fma}\left(\varepsilon - 1, x, 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                            4. Applied rewrites22.1%

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

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

                                \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot 1 - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                            7. Recombined 3 regimes into one program.
                            8. Add Preprocessing

                            Alternative 11: 72.5% accurate, 2.3× speedup?

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

                              1. Initial program 65.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. Taylor expanded in eps around inf

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

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

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

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

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

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

                                  \[\leadsto \left(e^{-1 \cdot x} - -1\right) \cdot \frac{1}{2} \]
                                3. Step-by-step derivation
                                  1. mul-1-negN/A

                                    \[\leadsto \left(e^{\mathsf{neg}\left(x\right)} - -1\right) \cdot \frac{1}{2} \]
                                  2. lift-neg.f6484.3

                                    \[\leadsto \left(e^{-x} - -1\right) \cdot 0.5 \]
                                4. Applied rewrites84.3%

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

                                if 2.3999999999999999e-191 < x < 5.0000000000000001e85

                                1. Initial program 65.6%

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

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

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

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

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

                                  \[\leadsto \left(e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - -1\right) \cdot \frac{1}{2} \]
                                6. Step-by-step derivation
                                  1. Applied rewrites83.5%

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

                                    \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                  3. Step-by-step derivation
                                    1. distribute-lft-neg-inN/A

                                      \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                    2. rec-expN/A

                                      \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                    3. mul-1-negN/A

                                      \[\leadsto \left(\left(1 + \left(\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                    4. distribute-lft-neg-inN/A

                                      \[\leadsto \left(\left(1 + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(1 - \varepsilon\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                    5. +-commutativeN/A

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

                                      \[\leadsto \left(\mathsf{fma}\left(\mathsf{neg}\left(x\right), 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                    7. lift-neg.f64N/A

                                      \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                    8. lift--.f6448.9

                                      \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot 0.5 \]
                                  4. Applied rewrites48.9%

                                    \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot 0.5 \]
                                  5. Step-by-step derivation
                                    1. lift--.f64N/A

                                      \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                    2. flip--N/A

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

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

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

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

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

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

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

                                      \[\leadsto \left(\mathsf{fma}\left(-x, \frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon + 1}, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                    10. lower-+.f6469.0

                                      \[\leadsto \left(\mathsf{fma}\left(-x, \frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon + 1}, 1\right) - -1\right) \cdot 0.5 \]
                                  6. Applied rewrites69.0%

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

                                  if 5.0000000000000001e85 < x < 3e193

                                  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. 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}{1}}{2} \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites51.4%

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

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

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

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

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

                                        \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot \mathsf{fma}\left(\varepsilon - 1, x, 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                                    4. Applied rewrites24.4%

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

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

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

                                      if 3e193 < 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. Taylor expanded in eps around inf

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

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

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

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

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

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

                                          \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                        3. Step-by-step derivation
                                          1. distribute-lft-neg-inN/A

                                            \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                          2. rec-expN/A

                                            \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                          3. mul-1-negN/A

                                            \[\leadsto \left(\left(1 + \left(\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                          4. distribute-lft-neg-inN/A

                                            \[\leadsto \left(\left(1 + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(1 - \varepsilon\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                          5. +-commutativeN/A

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

                                            \[\leadsto \left(\mathsf{fma}\left(\mathsf{neg}\left(x\right), 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                          7. lift-neg.f64N/A

                                            \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                          8. lift--.f6444.1

                                            \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot 0.5 \]
                                        4. Applied rewrites44.1%

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

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

                                            \[\leadsto \left(x \cdot \varepsilon - -1\right) \cdot \frac{1}{2} \]
                                          2. lift-*.f6444.5

                                            \[\leadsto \left(x \cdot \varepsilon - -1\right) \cdot 0.5 \]
                                        7. Applied rewrites44.5%

                                          \[\leadsto \left(x \cdot \varepsilon - -1\right) \cdot 0.5 \]
                                      7. Recombined 4 regimes into one program.
                                      8. Add Preprocessing

                                      Alternative 12: 65.8% accurate, 2.8× speedup?

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

                                        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. 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}{1}}{2} \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites3.1%

                                            \[\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}{1}}{2} \]
                                          2. Taylor expanded in x around 0

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

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

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

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

                                              \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot \mathsf{fma}\left(\varepsilon - 1, x, 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                                          4. Applied rewrites0.1%

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

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

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

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

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

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

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

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

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

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

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

                                                \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot \frac{\left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right) - 1}{-1 \cdot x - \color{blue}{1}} - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                                              10. lower-*.f6451.7

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

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

                                            if -4.8e8 < x < 2.3999999999999999e-191

                                            1. Initial program 54.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. Taylor expanded in x around 0

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

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

                                              if 2.3999999999999999e-191 < x < 5.0000000000000001e85

                                              1. Initial program 65.6%

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

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

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

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

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

                                                \[\leadsto \left(e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - -1\right) \cdot \frac{1}{2} \]
                                              6. Step-by-step derivation
                                                1. Applied rewrites83.5%

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

                                                  \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                3. Step-by-step derivation
                                                  1. distribute-lft-neg-inN/A

                                                    \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                  2. rec-expN/A

                                                    \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                  3. mul-1-negN/A

                                                    \[\leadsto \left(\left(1 + \left(\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                  4. distribute-lft-neg-inN/A

                                                    \[\leadsto \left(\left(1 + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(1 - \varepsilon\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                  5. +-commutativeN/A

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

                                                    \[\leadsto \left(\mathsf{fma}\left(\mathsf{neg}\left(x\right), 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                                  7. lift-neg.f64N/A

                                                    \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                                  8. lift--.f6448.9

                                                    \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot 0.5 \]
                                                4. Applied rewrites48.9%

                                                  \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot 0.5 \]
                                                5. Step-by-step derivation
                                                  1. lift--.f64N/A

                                                    \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                                  2. flip--N/A

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

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

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

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

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

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

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

                                                    \[\leadsto \left(\mathsf{fma}\left(-x, \frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon + 1}, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                                  10. lower-+.f6469.0

                                                    \[\leadsto \left(\mathsf{fma}\left(-x, \frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon + 1}, 1\right) - -1\right) \cdot 0.5 \]
                                                6. Applied rewrites69.0%

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

                                                if 5.0000000000000001e85 < x < 3e193

                                                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. 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}{1}}{2} \]
                                                3. Step-by-step derivation
                                                  1. Applied rewrites51.4%

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

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

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

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

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

                                                      \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot \mathsf{fma}\left(\varepsilon - 1, x, 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                                                  4. Applied rewrites24.4%

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

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

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

                                                    if 3e193 < 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. Taylor expanded in eps around inf

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

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

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

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

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

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

                                                        \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                      3. Step-by-step derivation
                                                        1. distribute-lft-neg-inN/A

                                                          \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                        2. rec-expN/A

                                                          \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                        3. mul-1-negN/A

                                                          \[\leadsto \left(\left(1 + \left(\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                        4. distribute-lft-neg-inN/A

                                                          \[\leadsto \left(\left(1 + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(1 - \varepsilon\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                        5. +-commutativeN/A

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

                                                          \[\leadsto \left(\mathsf{fma}\left(\mathsf{neg}\left(x\right), 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                                        7. lift-neg.f64N/A

                                                          \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                                        8. lift--.f6444.1

                                                          \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot 0.5 \]
                                                      4. Applied rewrites44.1%

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

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

                                                          \[\leadsto \left(x \cdot \varepsilon - -1\right) \cdot \frac{1}{2} \]
                                                        2. lift-*.f6444.5

                                                          \[\leadsto \left(x \cdot \varepsilon - -1\right) \cdot 0.5 \]
                                                      7. Applied rewrites44.5%

                                                        \[\leadsto \left(x \cdot \varepsilon - -1\right) \cdot 0.5 \]
                                                    7. Recombined 5 regimes into one program.
                                                    8. Add Preprocessing

                                                    Alternative 13: 59.2% accurate, 3.8× speedup?

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

                                                      1. Initial program 65.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. Taylor expanded in x around 0

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

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

                                                        if 2.3999999999999999e-191 < x < 5.0000000000000001e85

                                                        1. Initial program 65.6%

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

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

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

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

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

                                                          \[\leadsto \left(e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - -1\right) \cdot \frac{1}{2} \]
                                                        6. Step-by-step derivation
                                                          1. Applied rewrites83.5%

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

                                                            \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                          3. Step-by-step derivation
                                                            1. distribute-lft-neg-inN/A

                                                              \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                            2. rec-expN/A

                                                              \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                            3. mul-1-negN/A

                                                              \[\leadsto \left(\left(1 + \left(\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                            4. distribute-lft-neg-inN/A

                                                              \[\leadsto \left(\left(1 + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(1 - \varepsilon\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                            5. +-commutativeN/A

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

                                                              \[\leadsto \left(\mathsf{fma}\left(\mathsf{neg}\left(x\right), 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                                            7. lift-neg.f64N/A

                                                              \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                                            8. lift--.f6448.9

                                                              \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot 0.5 \]
                                                          4. Applied rewrites48.9%

                                                            \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot 0.5 \]
                                                          5. Step-by-step derivation
                                                            1. lift--.f64N/A

                                                              \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                                            2. flip--N/A

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

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

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

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

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

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

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

                                                              \[\leadsto \left(\mathsf{fma}\left(-x, \frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon + 1}, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                                            10. lower-+.f6469.0

                                                              \[\leadsto \left(\mathsf{fma}\left(-x, \frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon + 1}, 1\right) - -1\right) \cdot 0.5 \]
                                                          6. Applied rewrites69.0%

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

                                                          if 5.0000000000000001e85 < x < 3e193

                                                          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. 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}{1}}{2} \]
                                                          3. Step-by-step derivation
                                                            1. Applied rewrites51.4%

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

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

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

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

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

                                                                \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot \mathsf{fma}\left(\varepsilon - 1, x, 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                                                            4. Applied rewrites24.4%

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

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

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

                                                              if 3e193 < 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. Taylor expanded in eps around inf

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

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

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

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

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

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

                                                                  \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                                3. Step-by-step derivation
                                                                  1. distribute-lft-neg-inN/A

                                                                    \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                                  2. rec-expN/A

                                                                    \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                                  3. mul-1-negN/A

                                                                    \[\leadsto \left(\left(1 + \left(\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                                  4. distribute-lft-neg-inN/A

                                                                    \[\leadsto \left(\left(1 + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(1 - \varepsilon\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                                  5. +-commutativeN/A

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

                                                                    \[\leadsto \left(\mathsf{fma}\left(\mathsf{neg}\left(x\right), 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                                                  7. lift-neg.f64N/A

                                                                    \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                                                  8. lift--.f6444.1

                                                                    \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot 0.5 \]
                                                                4. Applied rewrites44.1%

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

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

                                                                    \[\leadsto \left(x \cdot \varepsilon - -1\right) \cdot \frac{1}{2} \]
                                                                  2. lift-*.f6444.5

                                                                    \[\leadsto \left(x \cdot \varepsilon - -1\right) \cdot 0.5 \]
                                                                7. Applied rewrites44.5%

                                                                  \[\leadsto \left(x \cdot \varepsilon - -1\right) \cdot 0.5 \]
                                                              7. Recombined 4 regimes into one program.
                                                              8. Add Preprocessing

                                                              Alternative 14: 51.9% accurate, 13.6× speedup?

                                                              \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;x \leq 0.62:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot eps\_m - -1\right) \cdot 0.5\\ \end{array} \end{array} \]
                                                              eps_m = (fabs.f64 eps)
                                                              (FPCore (x eps_m)
                                                               :precision binary64
                                                               (if (<= x 0.62) 1.0 (* (- (* x eps_m) -1.0) 0.5)))
                                                              eps_m = fabs(eps);
                                                              double code(double x, double eps_m) {
                                                              	double tmp;
                                                              	if (x <= 0.62) {
                                                              		tmp = 1.0;
                                                              	} else {
                                                              		tmp = ((x * eps_m) - -1.0) * 0.5;
                                                              	}
                                                              	return tmp;
                                                              }
                                                              
                                                              eps_m =     private
                                                              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_m)
                                                              use fmin_fmax_functions
                                                                  real(8), intent (in) :: x
                                                                  real(8), intent (in) :: eps_m
                                                                  real(8) :: tmp
                                                                  if (x <= 0.62d0) then
                                                                      tmp = 1.0d0
                                                                  else
                                                                      tmp = ((x * eps_m) - (-1.0d0)) * 0.5d0
                                                                  end if
                                                                  code = tmp
                                                              end function
                                                              
                                                              eps_m = Math.abs(eps);
                                                              public static double code(double x, double eps_m) {
                                                              	double tmp;
                                                              	if (x <= 0.62) {
                                                              		tmp = 1.0;
                                                              	} else {
                                                              		tmp = ((x * eps_m) - -1.0) * 0.5;
                                                              	}
                                                              	return tmp;
                                                              }
                                                              
                                                              eps_m = math.fabs(eps)
                                                              def code(x, eps_m):
                                                              	tmp = 0
                                                              	if x <= 0.62:
                                                              		tmp = 1.0
                                                              	else:
                                                              		tmp = ((x * eps_m) - -1.0) * 0.5
                                                              	return tmp
                                                              
                                                              eps_m = abs(eps)
                                                              function code(x, eps_m)
                                                              	tmp = 0.0
                                                              	if (x <= 0.62)
                                                              		tmp = 1.0;
                                                              	else
                                                              		tmp = Float64(Float64(Float64(x * eps_m) - -1.0) * 0.5);
                                                              	end
                                                              	return tmp
                                                              end
                                                              
                                                              eps_m = abs(eps);
                                                              function tmp_2 = code(x, eps_m)
                                                              	tmp = 0.0;
                                                              	if (x <= 0.62)
                                                              		tmp = 1.0;
                                                              	else
                                                              		tmp = ((x * eps_m) - -1.0) * 0.5;
                                                              	end
                                                              	tmp_2 = tmp;
                                                              end
                                                              
                                                              eps_m = N[Abs[eps], $MachinePrecision]
                                                              code[x_, eps$95$m_] := If[LessEqual[x, 0.62], 1.0, N[(N[(N[(x * eps$95$m), $MachinePrecision] - -1.0), $MachinePrecision] * 0.5), $MachinePrecision]]
                                                              
                                                              \begin{array}{l}
                                                              eps_m = \left|\varepsilon\right|
                                                              
                                                              \\
                                                              \begin{array}{l}
                                                              \mathbf{if}\;x \leq 0.62:\\
                                                              \;\;\;\;1\\
                                                              
                                                              \mathbf{else}:\\
                                                              \;\;\;\;\left(x \cdot eps\_m - -1\right) \cdot 0.5\\
                                                              
                                                              
                                                              \end{array}
                                                              \end{array}
                                                              
                                                              Derivation
                                                              1. Split input into 2 regimes
                                                              2. if x < 0.619999999999999996

                                                                1. Initial program 62.4%

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

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

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

                                                                  if 0.619999999999999996 < x

                                                                  1. Initial program 99.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. Taylor expanded in eps around inf

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

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

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

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

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

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

                                                                      \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                                    3. Step-by-step derivation
                                                                      1. distribute-lft-neg-inN/A

                                                                        \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                                      2. rec-expN/A

                                                                        \[\leadsto \left(\left(1 + -1 \cdot \left(x \cdot \left(1 - \varepsilon\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                                      3. mul-1-negN/A

                                                                        \[\leadsto \left(\left(1 + \left(\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                                      4. distribute-lft-neg-inN/A

                                                                        \[\leadsto \left(\left(1 + \left(\mathsf{neg}\left(x\right)\right) \cdot \left(1 - \varepsilon\right)\right) - -1\right) \cdot \frac{1}{2} \]
                                                                      5. +-commutativeN/A

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

                                                                        \[\leadsto \left(\mathsf{fma}\left(\mathsf{neg}\left(x\right), 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                                                      7. lift-neg.f64N/A

                                                                        \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot \frac{1}{2} \]
                                                                      8. lift--.f6428.4

                                                                        \[\leadsto \left(\mathsf{fma}\left(-x, 1 - \varepsilon, 1\right) - -1\right) \cdot 0.5 \]
                                                                    4. Applied rewrites28.4%

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

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

                                                                        \[\leadsto \left(x \cdot \varepsilon - -1\right) \cdot \frac{1}{2} \]
                                                                      2. lift-*.f6428.8

                                                                        \[\leadsto \left(x \cdot \varepsilon - -1\right) \cdot 0.5 \]
                                                                    7. Applied rewrites28.8%

                                                                      \[\leadsto \left(x \cdot \varepsilon - -1\right) \cdot 0.5 \]
                                                                  7. Recombined 2 regimes into one program.
                                                                  8. Add Preprocessing

                                                                  Alternative 15: 44.6% accurate, 273.0× speedup?

                                                                  \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ 1 \end{array} \]
                                                                  eps_m = (fabs.f64 eps)
                                                                  (FPCore (x eps_m) :precision binary64 1.0)
                                                                  eps_m = fabs(eps);
                                                                  double code(double x, double eps_m) {
                                                                  	return 1.0;
                                                                  }
                                                                  
                                                                  eps_m =     private
                                                                  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_m)
                                                                  use fmin_fmax_functions
                                                                      real(8), intent (in) :: x
                                                                      real(8), intent (in) :: eps_m
                                                                      code = 1.0d0
                                                                  end function
                                                                  
                                                                  eps_m = Math.abs(eps);
                                                                  public static double code(double x, double eps_m) {
                                                                  	return 1.0;
                                                                  }
                                                                  
                                                                  eps_m = math.fabs(eps)
                                                                  def code(x, eps_m):
                                                                  	return 1.0
                                                                  
                                                                  eps_m = abs(eps)
                                                                  function code(x, eps_m)
                                                                  	return 1.0
                                                                  end
                                                                  
                                                                  eps_m = abs(eps);
                                                                  function tmp = code(x, eps_m)
                                                                  	tmp = 1.0;
                                                                  end
                                                                  
                                                                  eps_m = N[Abs[eps], $MachinePrecision]
                                                                  code[x_, eps$95$m_] := 1.0
                                                                  
                                                                  \begin{array}{l}
                                                                  eps_m = \left|\varepsilon\right|
                                                                  
                                                                  \\
                                                                  1
                                                                  \end{array}
                                                                  
                                                                  Derivation
                                                                  1. Initial program 73.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. Taylor expanded in x around 0

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

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

                                                                    Reproduce

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