NMSE Section 6.1 mentioned, A

Percentage Accurate: 73.3% → 99.8%
Time: 5.1s
Alternatives: 12
Speedup: 2.2×

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 12 alternatives:

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

Initial Program: 73.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (/
  (-
   (* (+ 1.0 (/ 1.0 eps)) (exp (- (* (- 1.0 eps) x))))
   (* (- (/ 1.0 eps) 1.0) (exp (- (* (+ 1.0 eps) x)))))
  2.0))
double code(double x, double eps) {
	return (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, eps)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    code = (((1.0d0 + (1.0d0 / eps)) * exp(-((1.0d0 - eps) * x))) - (((1.0d0 / eps) - 1.0d0) * exp(-((1.0d0 + eps) * x)))) / 2.0d0
end function
public static double code(double x, double eps) {
	return (((1.0 + (1.0 / eps)) * Math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * Math.exp(-((1.0 + eps) * x)))) / 2.0;
}
def code(x, eps):
	return (((1.0 + (1.0 / eps)) * math.exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * math.exp(-((1.0 + eps) * x)))) / 2.0
function code(x, eps)
	return Float64(Float64(Float64(Float64(1.0 + Float64(1.0 / eps)) * exp(Float64(-Float64(Float64(1.0 - eps) * x)))) - Float64(Float64(Float64(1.0 / eps) - 1.0) * exp(Float64(-Float64(Float64(1.0 + eps) * x))))) / 2.0)
end
function tmp = code(x, eps)
	tmp = (((1.0 + (1.0 / eps)) * exp(-((1.0 - eps) * x))) - (((1.0 / eps) - 1.0) * exp(-((1.0 + eps) * x)))) / 2.0;
end
code[x_, eps_] := N[(N[(N[(N[(1.0 + N[(1.0 / eps), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[(1.0 - eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] - N[(N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[(-N[(N[(1.0 + eps), $MachinePrecision] * x), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 99.8% accurate, 1.5× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;eps\_m \leq 5 \cdot 10^{-33}:\\ \;\;\;\;\left(x - -1\right) \cdot e^{-x}\\ \mathbf{else}:\\ \;\;\;\;\left(e^{-eps\_m \cdot x} + e^{\left(eps\_m - 1\right) \cdot x}\right) \cdot 0.5\\ \end{array} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (if (<= eps_m 5e-33)
   (* (- x -1.0) (exp (- x)))
   (* (+ (exp (- (* eps_m x))) (exp (* (- eps_m 1.0) x))) 0.5)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	double tmp;
	if (eps_m <= 5e-33) {
		tmp = (x - -1.0) * exp(-x);
	} else {
		tmp = (exp(-(eps_m * x)) + exp(((eps_m - 1.0) * x))) * 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 (eps_m <= 5d-33) then
        tmp = (x - (-1.0d0)) * exp(-x)
    else
        tmp = (exp(-(eps_m * x)) + exp(((eps_m - 1.0d0) * x))) * 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 (eps_m <= 5e-33) {
		tmp = (x - -1.0) * Math.exp(-x);
	} else {
		tmp = (Math.exp(-(eps_m * x)) + Math.exp(((eps_m - 1.0) * x))) * 0.5;
	}
	return tmp;
}
eps_m = math.fabs(eps)
def code(x, eps_m):
	tmp = 0
	if eps_m <= 5e-33:
		tmp = (x - -1.0) * math.exp(-x)
	else:
		tmp = (math.exp(-(eps_m * x)) + math.exp(((eps_m - 1.0) * x))) * 0.5
	return tmp
eps_m = abs(eps)
function code(x, eps_m)
	tmp = 0.0
	if (eps_m <= 5e-33)
		tmp = Float64(Float64(x - -1.0) * exp(Float64(-x)));
	else
		tmp = Float64(Float64(exp(Float64(-Float64(eps_m * x))) + exp(Float64(Float64(eps_m - 1.0) * x))) * 0.5);
	end
	return tmp
end
eps_m = abs(eps);
function tmp_2 = code(x, eps_m)
	tmp = 0.0;
	if (eps_m <= 5e-33)
		tmp = (x - -1.0) * exp(-x);
	else
		tmp = (exp(-(eps_m * x)) + exp(((eps_m - 1.0) * x))) * 0.5;
	end
	tmp_2 = tmp;
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 5e-33], N[(N[(x - -1.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision]), $MachinePrecision], N[(N[(N[Exp[(-N[(eps$95$m * x), $MachinePrecision])], $MachinePrecision] + N[Exp[N[(N[(eps$95$m - 1.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

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

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


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

    1. Initial program 73.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(2 \cdot \frac{x - -1}{e^{x}}\right) \cdot 0.5} \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

        \[\leadsto 1 \cdot \frac{\color{blue}{x - -1}}{e^{x}} \]
      6. lift-/.f64N/A

        \[\leadsto 1 \cdot \frac{x - -1}{\color{blue}{e^{x}}} \]
      7. div-flipN/A

        \[\leadsto 1 \cdot \frac{1}{\color{blue}{\frac{e^{x}}{x - -1}}} \]
      8. mult-flipN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{e^{x}}{x - -1}}} \]
      9. div-flipN/A

        \[\leadsto \frac{x - -1}{\color{blue}{e^{x}}} \]
      10. mult-flipN/A

        \[\leadsto \left(x - -1\right) \cdot \color{blue}{\frac{1}{e^{x}}} \]
      11. lift-exp.f64N/A

        \[\leadsto \left(x - -1\right) \cdot \frac{1}{e^{x}} \]
      12. rec-expN/A

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

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

        \[\leadsto \left(x - -1\right) \cdot e^{\mathsf{neg}\left(x\right)} \]
      15. lower-neg.f6457.4

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

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

    if 5.00000000000000028e-33 < eps

    1. Initial program 73.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 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. lower-*.f64N/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\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)} \]
      2. lower--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.8% accurate, 1.4× speedup?

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

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

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


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

    1. Initial program 73.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(2 \cdot \frac{x - -1}{e^{x}}\right) \cdot 0.5} \]
    9. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

        \[\leadsto 1 \cdot \frac{\color{blue}{x - -1}}{e^{x}} \]
      6. lift-/.f64N/A

        \[\leadsto 1 \cdot \frac{x - -1}{\color{blue}{e^{x}}} \]
      7. div-flipN/A

        \[\leadsto 1 \cdot \frac{1}{\color{blue}{\frac{e^{x}}{x - -1}}} \]
      8. mult-flipN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{e^{x}}{x - -1}}} \]
      9. div-flipN/A

        \[\leadsto \frac{x - -1}{\color{blue}{e^{x}}} \]
      10. mult-flipN/A

        \[\leadsto \left(x - -1\right) \cdot \color{blue}{\frac{1}{e^{x}}} \]
      11. lift-exp.f64N/A

        \[\leadsto \left(x - -1\right) \cdot \frac{1}{e^{x}} \]
      12. rec-expN/A

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

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

        \[\leadsto \left(x - -1\right) \cdot e^{\mathsf{neg}\left(x\right)} \]
      15. lower-neg.f6457.4

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

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

    if 5.00000000000000004e-36 < eps

    1. Initial program 73.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 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. lower-*.f64N/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\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)} \]
      2. lower--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 84.8% accurate, 1.8× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(e^{-x \cdot \left(1 - eps\_m\right)} - -1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.19999999999999999e-248

    1. Initial program 73.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 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. lower-*.f64N/A

        \[\leadsto \frac{1}{2} \cdot \color{blue}{\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)} \]
      2. lower--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -2.19999999999999999e-248 < x

      1. Initial program 73.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 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. lower-*.f64N/A

          \[\leadsto \frac{1}{2} \cdot \color{blue}{\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)} \]
        2. lower--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 4: 77.7% accurate, 2.2× speedup?

      \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;x \leq 2.2 \cdot 10^{-247}:\\ \;\;\;\;0.5 \cdot \left(\left(1 + x\right) + e^{-x}\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(e^{-x \cdot \left(1 - eps\_m\right)} - -1\right)\\ \end{array} \end{array} \]
      eps_m = (fabs.f64 eps)
      (FPCore (x eps_m)
       :precision binary64
       (if (<= x 2.2e-247)
         (* 0.5 (+ (+ 1.0 x) (exp (- x))))
         (* 0.5 (- (exp (- (* x (- 1.0 eps_m)))) -1.0))))
      eps_m = fabs(eps);
      double code(double x, double eps_m) {
      	double tmp;
      	if (x <= 2.2e-247) {
      		tmp = 0.5 * ((1.0 + x) + exp(-x));
      	} else {
      		tmp = 0.5 * (exp(-(x * (1.0 - eps_m))) - -1.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) :: tmp
          if (x <= 2.2d-247) then
              tmp = 0.5d0 * ((1.0d0 + x) + exp(-x))
          else
              tmp = 0.5d0 * (exp(-(x * (1.0d0 - eps_m))) - (-1.0d0))
          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.2e-247) {
      		tmp = 0.5 * ((1.0 + x) + Math.exp(-x));
      	} else {
      		tmp = 0.5 * (Math.exp(-(x * (1.0 - eps_m))) - -1.0);
      	}
      	return tmp;
      }
      
      eps_m = math.fabs(eps)
      def code(x, eps_m):
      	tmp = 0
      	if x <= 2.2e-247:
      		tmp = 0.5 * ((1.0 + x) + math.exp(-x))
      	else:
      		tmp = 0.5 * (math.exp(-(x * (1.0 - eps_m))) - -1.0)
      	return tmp
      
      eps_m = abs(eps)
      function code(x, eps_m)
      	tmp = 0.0
      	if (x <= 2.2e-247)
      		tmp = Float64(0.5 * Float64(Float64(1.0 + x) + exp(Float64(-x))));
      	else
      		tmp = Float64(0.5 * Float64(exp(Float64(-Float64(x * Float64(1.0 - eps_m)))) - -1.0));
      	end
      	return tmp
      end
      
      eps_m = abs(eps);
      function tmp_2 = code(x, eps_m)
      	tmp = 0.0;
      	if (x <= 2.2e-247)
      		tmp = 0.5 * ((1.0 + x) + exp(-x));
      	else
      		tmp = 0.5 * (exp(-(x * (1.0 - eps_m))) - -1.0);
      	end
      	tmp_2 = tmp;
      end
      
      eps_m = N[Abs[eps], $MachinePrecision]
      code[x_, eps$95$m_] := If[LessEqual[x, 2.2e-247], N[(0.5 * N[(N[(1.0 + x), $MachinePrecision] + N[Exp[(-x)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Exp[(-N[(x * N[(1.0 - eps$95$m), $MachinePrecision]), $MachinePrecision])], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      eps_m = \left|\varepsilon\right|
      
      \\
      \begin{array}{l}
      \mathbf{if}\;x \leq 2.2 \cdot 10^{-247}:\\
      \;\;\;\;0.5 \cdot \left(\left(1 + x\right) + e^{-x}\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;0.5 \cdot \left(e^{-x \cdot \left(1 - eps\_m\right)} - -1\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if x < 2.19999999999999992e-247

        1. Initial program 73.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 2.19999999999999992e-247 < x

        1. Initial program 73.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 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. lower-*.f64N/A

            \[\leadsto \frac{1}{2} \cdot \color{blue}{\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)} \]
          2. lower--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 5: 72.2% accurate, 2.4× speedup?

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

          1. Initial program 73.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\left(2 \cdot \frac{x - -1}{e^{x}}\right) \cdot 0.5} \]
          9. Step-by-step derivation
            1. lift-*.f64N/A

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

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

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

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

              \[\leadsto 1 \cdot \frac{\color{blue}{x - -1}}{e^{x}} \]
            6. lift-/.f64N/A

              \[\leadsto 1 \cdot \frac{x - -1}{\color{blue}{e^{x}}} \]
            7. div-flipN/A

              \[\leadsto 1 \cdot \frac{1}{\color{blue}{\frac{e^{x}}{x - -1}}} \]
            8. mult-flipN/A

              \[\leadsto \frac{1}{\color{blue}{\frac{e^{x}}{x - -1}}} \]
            9. div-flipN/A

              \[\leadsto \frac{x - -1}{\color{blue}{e^{x}}} \]
            10. mult-flipN/A

              \[\leadsto \left(x - -1\right) \cdot \color{blue}{\frac{1}{e^{x}}} \]
            11. lift-exp.f64N/A

              \[\leadsto \left(x - -1\right) \cdot \frac{1}{e^{x}} \]
            12. rec-expN/A

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

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

              \[\leadsto \left(x - -1\right) \cdot e^{\mathsf{neg}\left(x\right)} \]
            15. lower-neg.f6457.4

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

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

          if 0.0820000000000000034 < eps

          1. Initial program 73.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 6: 66.9% accurate, 2.1× speedup?

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

          1. Initial program 73.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 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. lower-*.f64N/A

              \[\leadsto \frac{1}{2} \cdot \color{blue}{\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)} \]
            2. lower--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto 1 + \color{blue}{-1 \cdot x} \]
          6. Step-by-step derivation
            1. lower-+.f64N/A

              \[\leadsto 1 + -1 \cdot \color{blue}{x} \]
            2. lower-*.f6443.5

              \[\leadsto 1 + -1 \cdot x \]
          7. Applied rewrites43.5%

            \[\leadsto 1 + \color{blue}{-1 \cdot x} \]
          8. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto 1 + -1 \cdot \color{blue}{x} \]
            2. flip-+N/A

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

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 \cdot 1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            4. metadata-evalN/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            6. mul-1-negN/A

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

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            8. mul-1-negN/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            9. sqr-neg-revN/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            10. unpow2N/A

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

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - {x}^{2}\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            12. sub-negate-revN/A

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

              \[\leadsto \frac{{x}^{2} - 1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            14. unpow2N/A

              \[\leadsto \frac{x \cdot x - 1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            15. metadata-evalN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            16. lift-*.f64N/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            17. mul-1-negN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right)\right)\right)} \]
            18. add-flip-revN/A

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

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x + 1\right)\right)} \]
            20. metadata-evalN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x + \left(\mathsf{neg}\left(-1\right)\right)\right)\right)} \]
            21. sub-flipN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x - -1\right)\right)} \]
            22. sub-negate-revN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{-1 - x} \]
            23. lower-/.f64N/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{-1 - \color{blue}{x}} \]
          9. Applied rewrites50.0%

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

          if -1.35000000000000003e154 < x < -8e3

          1. Initial program 73.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 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. lower-*.f64N/A

              \[\leadsto \frac{1}{2} \cdot \color{blue}{\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)} \]
            2. lower--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto 1 + \color{blue}{-1 \cdot x} \]
          6. Step-by-step derivation
            1. lower-+.f64N/A

              \[\leadsto 1 + -1 \cdot \color{blue}{x} \]
            2. lower-*.f6443.5

              \[\leadsto 1 + -1 \cdot x \]
          7. Applied rewrites43.5%

            \[\leadsto 1 + \color{blue}{-1 \cdot x} \]
          8. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto 1 + -1 \cdot \color{blue}{x} \]
            2. lift-*.f64N/A

              \[\leadsto 1 + -1 \cdot x \]
            3. mul-1-negN/A

              \[\leadsto 1 + \left(\mathsf{neg}\left(x\right)\right) \]
            4. sub-flip-reverseN/A

              \[\leadsto 1 - x \]
            5. lower--.f6443.5

              \[\leadsto 1 - x \]
          9. Applied rewrites43.5%

            \[\leadsto \color{blue}{1 - x} \]
          10. Step-by-step derivation
            1. lift--.f64N/A

              \[\leadsto 1 - x \]
            2. flip3--N/A

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

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

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

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

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

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

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

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

              \[\leadsto \frac{1 - \left(x \cdot x\right) \cdot x}{\left(x \cdot x + 1 \cdot x\right) + 1} \]
            11. distribute-rgt-outN/A

              \[\leadsto \frac{1 - \left(x \cdot x\right) \cdot x}{x \cdot \left(x + 1\right) + 1} \]
            12. metadata-evalN/A

              \[\leadsto \frac{1 - \left(x \cdot x\right) \cdot x}{x \cdot \left(x + \left(\mathsf{neg}\left(-1\right)\right)\right) + 1} \]
            13. sub-flipN/A

              \[\leadsto \frac{1 - \left(x \cdot x\right) \cdot x}{x \cdot \left(x - -1\right) + 1} \]
            14. lift--.f64N/A

              \[\leadsto \frac{1 - \left(x \cdot x\right) \cdot x}{x \cdot \left(x - -1\right) + 1} \]
            15. lower-fma.f6445.2

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

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

          if -8e3 < x

          1. Initial program 73.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\left(2 \cdot \frac{x - -1}{e^{x}}\right) \cdot 0.5} \]
          9. Step-by-step derivation
            1. lift-*.f64N/A

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

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

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

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

              \[\leadsto 1 \cdot \frac{\color{blue}{x - -1}}{e^{x}} \]
            6. lift-/.f64N/A

              \[\leadsto 1 \cdot \frac{x - -1}{\color{blue}{e^{x}}} \]
            7. div-flipN/A

              \[\leadsto 1 \cdot \frac{1}{\color{blue}{\frac{e^{x}}{x - -1}}} \]
            8. mult-flipN/A

              \[\leadsto \frac{1}{\color{blue}{\frac{e^{x}}{x - -1}}} \]
            9. div-flipN/A

              \[\leadsto \frac{x - -1}{\color{blue}{e^{x}}} \]
            10. mult-flipN/A

              \[\leadsto \left(x - -1\right) \cdot \color{blue}{\frac{1}{e^{x}}} \]
            11. lift-exp.f64N/A

              \[\leadsto \left(x - -1\right) \cdot \frac{1}{e^{x}} \]
            12. rec-expN/A

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

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

              \[\leadsto \left(x - -1\right) \cdot e^{\mathsf{neg}\left(x\right)} \]
            15. lower-neg.f6457.4

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

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

        Alternative 7: 64.6% accurate, 2.7× speedup?

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

          1. Initial program 73.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 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. lower-*.f64N/A

              \[\leadsto \frac{1}{2} \cdot \color{blue}{\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)} \]
            2. lower--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto 1 + \color{blue}{-1 \cdot x} \]
          6. Step-by-step derivation
            1. lower-+.f64N/A

              \[\leadsto 1 + -1 \cdot \color{blue}{x} \]
            2. lower-*.f6443.5

              \[\leadsto 1 + -1 \cdot x \]
          7. Applied rewrites43.5%

            \[\leadsto 1 + \color{blue}{-1 \cdot x} \]
          8. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto 1 + -1 \cdot \color{blue}{x} \]
            2. flip-+N/A

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

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 \cdot 1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            4. metadata-evalN/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            6. mul-1-negN/A

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

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            8. mul-1-negN/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            9. sqr-neg-revN/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            10. unpow2N/A

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

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - {x}^{2}\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            12. sub-negate-revN/A

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

              \[\leadsto \frac{{x}^{2} - 1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            14. unpow2N/A

              \[\leadsto \frac{x \cdot x - 1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            15. metadata-evalN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            16. lift-*.f64N/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            17. mul-1-negN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right)\right)\right)} \]
            18. add-flip-revN/A

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

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x + 1\right)\right)} \]
            20. metadata-evalN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x + \left(\mathsf{neg}\left(-1\right)\right)\right)\right)} \]
            21. sub-flipN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x - -1\right)\right)} \]
            22. sub-negate-revN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{-1 - x} \]
            23. lower-/.f64N/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{-1 - \color{blue}{x}} \]
          9. Applied rewrites50.0%

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

          if -8e3 < x

          1. Initial program 73.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\left(2 \cdot \frac{x - -1}{e^{x}}\right) \cdot 0.5} \]
          9. Step-by-step derivation
            1. lift-*.f64N/A

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

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

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

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

              \[\leadsto 1 \cdot \frac{\color{blue}{x - -1}}{e^{x}} \]
            6. lift-/.f64N/A

              \[\leadsto 1 \cdot \frac{x - -1}{\color{blue}{e^{x}}} \]
            7. div-flipN/A

              \[\leadsto 1 \cdot \frac{1}{\color{blue}{\frac{e^{x}}{x - -1}}} \]
            8. mult-flipN/A

              \[\leadsto \frac{1}{\color{blue}{\frac{e^{x}}{x - -1}}} \]
            9. div-flipN/A

              \[\leadsto \frac{x - -1}{\color{blue}{e^{x}}} \]
            10. mult-flipN/A

              \[\leadsto \left(x - -1\right) \cdot \color{blue}{\frac{1}{e^{x}}} \]
            11. lift-exp.f64N/A

              \[\leadsto \left(x - -1\right) \cdot \frac{1}{e^{x}} \]
            12. rec-expN/A

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

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

              \[\leadsto \left(x - -1\right) \cdot e^{\mathsf{neg}\left(x\right)} \]
            15. lower-neg.f6457.4

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

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

        Alternative 8: 64.6% accurate, 2.8× speedup?

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

          1. Initial program 73.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 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. lower-*.f64N/A

              \[\leadsto \frac{1}{2} \cdot \color{blue}{\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)} \]
            2. lower--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto 1 + \color{blue}{-1 \cdot x} \]
          6. Step-by-step derivation
            1. lower-+.f64N/A

              \[\leadsto 1 + -1 \cdot \color{blue}{x} \]
            2. lower-*.f6443.5

              \[\leadsto 1 + -1 \cdot x \]
          7. Applied rewrites43.5%

            \[\leadsto 1 + \color{blue}{-1 \cdot x} \]
          8. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto 1 + -1 \cdot \color{blue}{x} \]
            2. flip-+N/A

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

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 \cdot 1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            4. metadata-evalN/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            6. mul-1-negN/A

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

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            8. mul-1-negN/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            9. sqr-neg-revN/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            10. unpow2N/A

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

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - {x}^{2}\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            12. sub-negate-revN/A

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

              \[\leadsto \frac{{x}^{2} - 1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            14. unpow2N/A

              \[\leadsto \frac{x \cdot x - 1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            15. metadata-evalN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            16. lift-*.f64N/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            17. mul-1-negN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right)\right)\right)} \]
            18. add-flip-revN/A

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

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x + 1\right)\right)} \]
            20. metadata-evalN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x + \left(\mathsf{neg}\left(-1\right)\right)\right)\right)} \]
            21. sub-flipN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x - -1\right)\right)} \]
            22. sub-negate-revN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{-1 - x} \]
            23. lower-/.f64N/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{-1 - \color{blue}{x}} \]
          9. Applied rewrites50.0%

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

          if -8e3 < x

          1. Initial program 73.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\left(2 \cdot \frac{x - -1}{e^{x}}\right) \cdot 0.5} \]
          9. Step-by-step derivation
            1. lift-*.f64N/A

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

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

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

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

              \[\leadsto 1 \cdot \frac{\color{blue}{x - -1}}{e^{x}} \]
            6. lift-/.f64N/A

              \[\leadsto 1 \cdot \frac{x - -1}{\color{blue}{e^{x}}} \]
            7. div-flipN/A

              \[\leadsto 1 \cdot \frac{1}{\color{blue}{\frac{e^{x}}{x - -1}}} \]
            8. mult-flipN/A

              \[\leadsto \frac{1}{\color{blue}{\frac{e^{x}}{x - -1}}} \]
            9. div-flipN/A

              \[\leadsto \frac{x - -1}{\color{blue}{e^{x}}} \]
            10. lift-/.f6457.4

              \[\leadsto \frac{x - -1}{\color{blue}{e^{x}}} \]
          10. Applied rewrites57.4%

            \[\leadsto \frac{x - -1}{\color{blue}{e^{x}}} \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 9: 63.7% accurate, 3.2× speedup?

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

          1. Initial program 73.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 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. lower-*.f64N/A

              \[\leadsto \frac{1}{2} \cdot \color{blue}{\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)} \]
            2. lower--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto 1 + \color{blue}{-1 \cdot x} \]
          6. Step-by-step derivation
            1. lower-+.f64N/A

              \[\leadsto 1 + -1 \cdot \color{blue}{x} \]
            2. lower-*.f6443.5

              \[\leadsto 1 + -1 \cdot x \]
          7. Applied rewrites43.5%

            \[\leadsto 1 + \color{blue}{-1 \cdot x} \]
          8. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto 1 + -1 \cdot \color{blue}{x} \]
            2. flip-+N/A

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

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 \cdot 1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            4. metadata-evalN/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            6. mul-1-negN/A

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

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            8. mul-1-negN/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            9. sqr-neg-revN/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            10. unpow2N/A

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

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - {x}^{2}\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            12. sub-negate-revN/A

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

              \[\leadsto \frac{{x}^{2} - 1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            14. unpow2N/A

              \[\leadsto \frac{x \cdot x - 1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            15. metadata-evalN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            16. lift-*.f64N/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            17. mul-1-negN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right)\right)\right)} \]
            18. add-flip-revN/A

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

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x + 1\right)\right)} \]
            20. metadata-evalN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x + \left(\mathsf{neg}\left(-1\right)\right)\right)\right)} \]
            21. sub-flipN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x - -1\right)\right)} \]
            22. sub-negate-revN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{-1 - x} \]
            23. lower-/.f64N/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{-1 - \color{blue}{x}} \]
          9. Applied rewrites50.0%

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

          if 0.660000000000000031 < x

          1. Initial program 73.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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]
          10. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \frac{x}{e^{x}} \]
            2. lower-exp.f6416.0

              \[\leadsto \frac{x}{e^{x}} \]
          11. Applied rewrites16.0%

            \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 10: 57.1% accurate, 3.5× speedup?

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

          1. Initial program 73.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 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. lower-*.f64N/A

              \[\leadsto \frac{1}{2} \cdot \color{blue}{\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)} \]
            2. lower--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto 1 + \color{blue}{-1 \cdot x} \]
          6. Step-by-step derivation
            1. lower-+.f64N/A

              \[\leadsto 1 + -1 \cdot \color{blue}{x} \]
            2. lower-*.f6443.5

              \[\leadsto 1 + -1 \cdot x \]
          7. Applied rewrites43.5%

            \[\leadsto 1 + \color{blue}{-1 \cdot x} \]
          8. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto 1 + -1 \cdot \color{blue}{x} \]
            2. flip-+N/A

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

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 \cdot 1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            4. metadata-evalN/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            5. lift-*.f64N/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            6. mul-1-negN/A

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

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            8. mul-1-negN/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            9. sqr-neg-revN/A

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            10. unpow2N/A

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

              \[\leadsto \frac{\mathsf{neg}\left(\left(1 - {x}^{2}\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            12. sub-negate-revN/A

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

              \[\leadsto \frac{{x}^{2} - 1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            14. unpow2N/A

              \[\leadsto \frac{x \cdot x - 1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            15. metadata-evalN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            16. lift-*.f64N/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
            17. mul-1-negN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right)\right)\right)} \]
            18. add-flip-revN/A

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

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x + 1\right)\right)} \]
            20. metadata-evalN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x + \left(\mathsf{neg}\left(-1\right)\right)\right)\right)} \]
            21. sub-flipN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x - -1\right)\right)} \]
            22. sub-negate-revN/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{-1 - x} \]
            23. lower-/.f64N/A

              \[\leadsto \frac{x \cdot x - -1 \cdot -1}{-1 - \color{blue}{x}} \]
          9. Applied rewrites50.0%

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

          if -4.0000000000000001e-13 < x

          1. Initial program 73.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 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. lower-*.f64N/A

              \[\leadsto \frac{1}{2} \cdot \color{blue}{\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)} \]
            2. lower--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto 1 + \color{blue}{-1 \cdot x} \]
          6. Step-by-step derivation
            1. lower-+.f64N/A

              \[\leadsto 1 + -1 \cdot \color{blue}{x} \]
            2. lower-*.f6443.5

              \[\leadsto 1 + -1 \cdot x \]
          7. Applied rewrites43.5%

            \[\leadsto 1 + \color{blue}{-1 \cdot x} \]
          8. Step-by-step derivation
            1. lift-+.f64N/A

              \[\leadsto 1 + -1 \cdot \color{blue}{x} \]
            2. flip-+N/A

              \[\leadsto \frac{1 \cdot 1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)}{1 - \color{blue}{-1 \cdot x}} \]
            3. div-flipN/A

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

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

              \[\leadsto \frac{1}{\frac{1 - -1 \cdot x}{1 \cdot 1 - \left(-1 \cdot \color{blue}{x}\right) \cdot \left(-1 \cdot x\right)}} \]
            6. mul-1-negN/A

              \[\leadsto \frac{1}{\frac{1 - \left(\mathsf{neg}\left(x\right)\right)}{1 \cdot 1 - \left(-1 \cdot \color{blue}{x}\right) \cdot \left(-1 \cdot x\right)}} \]
            7. add-flip-revN/A

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

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

              \[\leadsto \frac{1}{\frac{x + \left(\mathsf{neg}\left(-1\right)\right)}{1 \cdot 1 - \left(-1 \cdot \color{blue}{x}\right) \cdot \left(-1 \cdot x\right)}} \]
            10. sub-flipN/A

              \[\leadsto \frac{1}{\frac{x - -1}{1 \cdot 1 - \color{blue}{\left(-1 \cdot x\right)} \cdot \left(-1 \cdot x\right)}} \]
            11. lift--.f64N/A

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

              \[\leadsto \frac{1}{\frac{x - -1}{1 - \left(-1 \cdot x\right) \cdot \left(\color{blue}{-1} \cdot x\right)}} \]
            13. lift-*.f64N/A

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

              \[\leadsto \frac{1}{\frac{x - -1}{1 - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(-1 \cdot x\right)}} \]
            15. lift-*.f64N/A

              \[\leadsto \frac{1}{\frac{x - -1}{1 - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(-1 \cdot x\right)}} \]
            16. mul-1-negN/A

              \[\leadsto \frac{1}{\frac{x - -1}{1 - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)}} \]
            17. sqr-neg-revN/A

              \[\leadsto \frac{1}{\frac{x - -1}{1 - x \cdot x}} \]
            18. unpow2N/A

              \[\leadsto \frac{1}{\frac{x - -1}{1 - {x}^{2}}} \]
            19. lift-pow.f64N/A

              \[\leadsto \frac{1}{\frac{x - -1}{1 - {x}^{2}}} \]
            20. lower-/.f64N/A

              \[\leadsto \frac{1}{\frac{x - -1}{1 - \color{blue}{{x}^{2}}}} \]
            21. lower--.f6450.0

              \[\leadsto \frac{1}{\frac{x - -1}{1 - {x}^{\color{blue}{2}}}} \]
            22. lift-pow.f64N/A

              \[\leadsto \frac{1}{\frac{x - -1}{1 - {x}^{2}}} \]
            23. unpow2N/A

              \[\leadsto \frac{1}{\frac{x - -1}{1 - x \cdot x}} \]
            24. lower-*.f6450.0

              \[\leadsto \frac{1}{\frac{x - -1}{1 - x \cdot x}} \]
          9. Applied rewrites50.0%

            \[\leadsto \frac{1}{\frac{x - -1}{\color{blue}{1 - x \cdot x}}} \]
          10. Taylor expanded in x around 0

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

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

              \[\leadsto \frac{1}{1 + x \cdot \left(1 + x\right)} \]
            3. lower-+.f6450.2

              \[\leadsto \frac{1}{1 + x \cdot \left(1 + x\right)} \]
          12. Applied rewrites50.2%

            \[\leadsto \frac{1}{1 + x \cdot \color{blue}{\left(1 + x\right)}} \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 11: 50.0% accurate, 4.9× speedup?

        \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \frac{\mathsf{fma}\left(x, x, -1\right)}{-1 - x} \end{array} \]
        eps_m = (fabs.f64 eps)
        (FPCore (x eps_m) :precision binary64 (/ (fma x x -1.0) (- -1.0 x)))
        eps_m = fabs(eps);
        double code(double x, double eps_m) {
        	return fma(x, x, -1.0) / (-1.0 - x);
        }
        
        eps_m = abs(eps)
        function code(x, eps_m)
        	return Float64(fma(x, x, -1.0) / Float64(-1.0 - x))
        end
        
        eps_m = N[Abs[eps], $MachinePrecision]
        code[x_, eps$95$m_] := N[(N[(x * x + -1.0), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]
        
        \begin{array}{l}
        eps_m = \left|\varepsilon\right|
        
        \\
        \frac{\mathsf{fma}\left(x, x, -1\right)}{-1 - x}
        \end{array}
        
        Derivation
        1. Initial program 73.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 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. lower-*.f64N/A

            \[\leadsto \frac{1}{2} \cdot \color{blue}{\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)} \]
          2. lower--.f64N/A

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto 1 + \color{blue}{-1 \cdot x} \]
        6. Step-by-step derivation
          1. lower-+.f64N/A

            \[\leadsto 1 + -1 \cdot \color{blue}{x} \]
          2. lower-*.f6443.5

            \[\leadsto 1 + -1 \cdot x \]
        7. Applied rewrites43.5%

          \[\leadsto 1 + \color{blue}{-1 \cdot x} \]
        8. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto 1 + -1 \cdot \color{blue}{x} \]
          2. flip-+N/A

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

            \[\leadsto \frac{\mathsf{neg}\left(\left(1 \cdot 1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
          4. metadata-evalN/A

            \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
          5. lift-*.f64N/A

            \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(-1 \cdot x\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
          6. mul-1-negN/A

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

            \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(-1 \cdot x\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
          8. mul-1-negN/A

            \[\leadsto \frac{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
          9. sqr-neg-revN/A

            \[\leadsto \frac{\mathsf{neg}\left(\left(1 - x \cdot x\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
          10. unpow2N/A

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

            \[\leadsto \frac{\mathsf{neg}\left(\left(1 - {x}^{2}\right)\right)}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
          12. sub-negate-revN/A

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

            \[\leadsto \frac{{x}^{2} - 1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
          14. unpow2N/A

            \[\leadsto \frac{x \cdot x - 1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
          15. metadata-evalN/A

            \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
          16. lift-*.f64N/A

            \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - -1 \cdot x\right)\right)} \]
          17. mul-1-negN/A

            \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(1 - \left(\mathsf{neg}\left(x\right)\right)\right)\right)} \]
          18. add-flip-revN/A

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

            \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x + 1\right)\right)} \]
          20. metadata-evalN/A

            \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x + \left(\mathsf{neg}\left(-1\right)\right)\right)\right)} \]
          21. sub-flipN/A

            \[\leadsto \frac{x \cdot x - -1 \cdot -1}{\mathsf{neg}\left(\left(x - -1\right)\right)} \]
          22. sub-negate-revN/A

            \[\leadsto \frac{x \cdot x - -1 \cdot -1}{-1 - x} \]
          23. lower-/.f64N/A

            \[\leadsto \frac{x \cdot x - -1 \cdot -1}{-1 - \color{blue}{x}} \]
        9. Applied rewrites50.0%

          \[\leadsto \frac{\mathsf{fma}\left(x, x, -1\right)}{-1 - \color{blue}{x}} \]
        10. Add Preprocessing

        Alternative 12: 44.1% accurate, 58.4× 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.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 rewrites44.1%

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

          Reproduce

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