NMSE Section 6.1 mentioned, A

Percentage Accurate: 73.4% → 98.7%
Time: 6.3s
Alternatives: 15
Speedup: 3.8×

Specification

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

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

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 73.4% 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: 98.7% accurate, 0.8× speedup?

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

\\
\left(e^{x \cdot \left(-1 + eps\_m\right)} + {\left(e^{-1}\right)}^{\left(\mathsf{fma}\left(x, eps\_m, x\right)\right)}\right) \cdot 0.5
\end{array}
Derivation
  1. Initial program 73.9%

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

    \[\leadsto \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)} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - \left(-{\left(e^{-1}\right)}^{\left(x \cdot \varepsilon + x\right)}\right)\right) \cdot \frac{1}{2} \]
    8. lift-fma.f6499.4

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

    \[\leadsto \left(e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - \left(-{\left(e^{-1}\right)}^{\left(\mathsf{fma}\left(x, \varepsilon, x\right)\right)}\right)\right) \cdot 0.5 \]
  8. Final simplification99.4%

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

Alternative 2: 98.5% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;eps\_m \leq 2.15 \cdot 10^{-5}:\\
\;\;\;\;e^{-x}\\

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


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

    1. Initial program 62.2%

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

      \[\leadsto \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)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto e^{-1 \cdot x} \]
    9. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto e^{-1 \cdot x} \]
      2. distribute-rgt-neg-inN/A

        \[\leadsto e^{-1 \cdot x} \]
      3. pow-expN/A

        \[\leadsto e^{-1 \cdot x} \]
      4. +-commutativeN/A

        \[\leadsto e^{-1 \cdot x} \]
      5. *-commutativeN/A

        \[\leadsto e^{-1 \cdot x} \]
      6. mul-1-negN/A

        \[\leadsto e^{-1 \cdot x} \]
      7. *-commutativeN/A

        \[\leadsto e^{-1 \cdot x} \]
      8. +-commutativeN/A

        \[\leadsto e^{-1 \cdot x} \]
      9. mul-1-negN/A

        \[\leadsto e^{\mathsf{neg}\left(x\right)} \]
      10. lift-exp.f64N/A

        \[\leadsto e^{\mathsf{neg}\left(x\right)} \]
      11. lift-neg.f6479.1

        \[\leadsto e^{-x} \]
    10. Applied rewrites79.1%

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

    if 2.1500000000000001e-5 < eps

    1. Initial program 100.0%

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

      \[\leadsto \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)} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

Alternative 3: 98.7% accurate, 1.2× speedup?

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

\\
\left(e^{x \cdot \left(-1 + eps\_m\right)} + e^{-\mathsf{fma}\left(x, eps\_m, x\right)}\right) \cdot 0.5
\end{array}
Derivation
  1. Initial program 73.9%

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

    \[\leadsto \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)} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

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

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

    \[\leadsto \color{blue}{\left(e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
  6. Final simplification99.4%

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

Alternative 4: 84.2% accurate, 1.9× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} t_0 := \left(e^{\left(-x\right) \cdot \left(-eps\_m\right)} - -1\right) \cdot 0.5\\ \mathbf{if}\;x \leq -1.35 \cdot 10^{-272}:\\ \;\;\;\;\left(1 + e^{-x \cdot eps\_m}\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 970000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.56 \cdot 10^{+100}:\\ \;\;\;\;e^{-x}\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+275}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\frac{1}{eps\_m} - -1\right) - \left(\frac{1}{eps\_m} - 1\right) \cdot 1}{2}\\ \end{array} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (let* ((t_0 (* (- (exp (* (- x) (- eps_m))) -1.0) 0.5)))
   (if (<= x -1.35e-272)
     (* (+ 1.0 (exp (- (* x eps_m)))) 0.5)
     (if (<= x 970000.0)
       t_0
       (if (<= x 1.56e+100)
         (exp (- x))
         (if (<= x 3.3e+275)
           t_0
           (/
            (- (- (/ 1.0 eps_m) -1.0) (* (- (/ 1.0 eps_m) 1.0) 1.0))
            2.0)))))))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	double t_0 = (exp((-x * -eps_m)) - -1.0) * 0.5;
	double tmp;
	if (x <= -1.35e-272) {
		tmp = (1.0 + exp(-(x * eps_m))) * 0.5;
	} else if (x <= 970000.0) {
		tmp = t_0;
	} else if (x <= 1.56e+100) {
		tmp = exp(-x);
	} else if (x <= 3.3e+275) {
		tmp = t_0;
	} else {
		tmp = (((1.0 / eps_m) - -1.0) - (((1.0 / eps_m) - 1.0) * 1.0)) / 2.0;
	}
	return tmp;
}
eps_m =     private
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, eps_m)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: eps_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (exp((-x * -eps_m)) - (-1.0d0)) * 0.5d0
    if (x <= (-1.35d-272)) then
        tmp = (1.0d0 + exp(-(x * eps_m))) * 0.5d0
    else if (x <= 970000.0d0) then
        tmp = t_0
    else if (x <= 1.56d+100) then
        tmp = exp(-x)
    else if (x <= 3.3d+275) then
        tmp = t_0
    else
        tmp = (((1.0d0 / eps_m) - (-1.0d0)) - (((1.0d0 / eps_m) - 1.0d0) * 1.0d0)) / 2.0d0
    end if
    code = tmp
end function
eps_m = Math.abs(eps);
public static double code(double x, double eps_m) {
	double t_0 = (Math.exp((-x * -eps_m)) - -1.0) * 0.5;
	double tmp;
	if (x <= -1.35e-272) {
		tmp = (1.0 + Math.exp(-(x * eps_m))) * 0.5;
	} else if (x <= 970000.0) {
		tmp = t_0;
	} else if (x <= 1.56e+100) {
		tmp = Math.exp(-x);
	} else if (x <= 3.3e+275) {
		tmp = t_0;
	} else {
		tmp = (((1.0 / eps_m) - -1.0) - (((1.0 / eps_m) - 1.0) * 1.0)) / 2.0;
	}
	return tmp;
}
eps_m = math.fabs(eps)
def code(x, eps_m):
	t_0 = (math.exp((-x * -eps_m)) - -1.0) * 0.5
	tmp = 0
	if x <= -1.35e-272:
		tmp = (1.0 + math.exp(-(x * eps_m))) * 0.5
	elif x <= 970000.0:
		tmp = t_0
	elif x <= 1.56e+100:
		tmp = math.exp(-x)
	elif x <= 3.3e+275:
		tmp = t_0
	else:
		tmp = (((1.0 / eps_m) - -1.0) - (((1.0 / eps_m) - 1.0) * 1.0)) / 2.0
	return tmp
eps_m = abs(eps)
function code(x, eps_m)
	t_0 = Float64(Float64(exp(Float64(Float64(-x) * Float64(-eps_m))) - -1.0) * 0.5)
	tmp = 0.0
	if (x <= -1.35e-272)
		tmp = Float64(Float64(1.0 + exp(Float64(-Float64(x * eps_m)))) * 0.5);
	elseif (x <= 970000.0)
		tmp = t_0;
	elseif (x <= 1.56e+100)
		tmp = exp(Float64(-x));
	elseif (x <= 3.3e+275)
		tmp = t_0;
	else
		tmp = Float64(Float64(Float64(Float64(1.0 / eps_m) - -1.0) - Float64(Float64(Float64(1.0 / eps_m) - 1.0) * 1.0)) / 2.0);
	end
	return tmp
end
eps_m = abs(eps);
function tmp_2 = code(x, eps_m)
	t_0 = (exp((-x * -eps_m)) - -1.0) * 0.5;
	tmp = 0.0;
	if (x <= -1.35e-272)
		tmp = (1.0 + exp(-(x * eps_m))) * 0.5;
	elseif (x <= 970000.0)
		tmp = t_0;
	elseif (x <= 1.56e+100)
		tmp = exp(-x);
	elseif (x <= 3.3e+275)
		tmp = t_0;
	else
		tmp = (((1.0 / eps_m) - -1.0) - (((1.0 / eps_m) - 1.0) * 1.0)) / 2.0;
	end
	tmp_2 = tmp;
end
eps_m = N[Abs[eps], $MachinePrecision]
code[x_, eps$95$m_] := Block[{t$95$0 = N[(N[(N[Exp[N[((-x) * (-eps$95$m)), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[x, -1.35e-272], N[(N[(1.0 + N[Exp[(-N[(x * eps$95$m), $MachinePrecision])], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 970000.0], t$95$0, If[LessEqual[x, 1.56e+100], N[Exp[(-x)], $MachinePrecision], If[LessEqual[x, 3.3e+275], t$95$0, N[(N[(N[(N[(1.0 / eps$95$m), $MachinePrecision] - -1.0), $MachinePrecision] - N[(N[(N[(1.0 / eps$95$m), $MachinePrecision] - 1.0), $MachinePrecision] * 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
eps_m = \left|\varepsilon\right|

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

\mathbf{elif}\;x \leq 970000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 1.56 \cdot 10^{+100}:\\
\;\;\;\;e^{-x}\\

\mathbf{elif}\;x \leq 3.3 \cdot 10^{+275}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(\frac{1}{eps\_m} - -1\right) - \left(\frac{1}{eps\_m} - 1\right) \cdot 1}{2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.34999999999999996e-272

    1. Initial program 72.4%

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

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

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

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

      \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot \frac{1}{2} \]
    7. Step-by-step derivation
      1. distribute-lft-neg-in72.0

        \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
      2. exp-neg72.0

        \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
      3. *-commutative72.0

        \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
      4. exp-neg72.0

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

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

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

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

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

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

    if -1.34999999999999996e-272 < x < 9.7e5 or 1.55999999999999998e100 < x < 3.30000000000000022e275

    1. Initial program 70.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 9.7e5 < x < 1.55999999999999998e100

      1. Initial program 100.0%

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

        \[\leadsto \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)} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto e^{-1 \cdot x} \]
      9. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto e^{-1 \cdot x} \]
        2. distribute-rgt-neg-inN/A

          \[\leadsto e^{-1 \cdot x} \]
        3. pow-expN/A

          \[\leadsto e^{-1 \cdot x} \]
        4. +-commutativeN/A

          \[\leadsto e^{-1 \cdot x} \]
        5. *-commutativeN/A

          \[\leadsto e^{-1 \cdot x} \]
        6. mul-1-negN/A

          \[\leadsto e^{-1 \cdot x} \]
        7. *-commutativeN/A

          \[\leadsto e^{-1 \cdot x} \]
        8. +-commutativeN/A

          \[\leadsto e^{-1 \cdot x} \]
        9. mul-1-negN/A

          \[\leadsto e^{\mathsf{neg}\left(x\right)} \]
        10. lift-exp.f64N/A

          \[\leadsto e^{\mathsf{neg}\left(x\right)} \]
        11. lift-neg.f6478.1

          \[\leadsto e^{-x} \]
      10. Applied rewrites78.1%

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

      if 3.30000000000000022e275 < x

      1. Initial program 100.0%

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

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

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

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

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

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

            \[\leadsto \frac{\left({\varepsilon}^{-1} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
          4. lower-pow.f64100.0

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

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

            \[\leadsto \frac{\left({\varepsilon}^{-1} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
          2. inv-powN/A

            \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
          3. lift-/.f64100.0

            \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
        6. Applied rewrites100.0%

          \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
      5. Recombined 4 regimes into one program.
      6. Final simplification71.6%

        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.35 \cdot 10^{-272}:\\ \;\;\;\;\left(1 + e^{-x \cdot \varepsilon}\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 970000:\\ \;\;\;\;\left(e^{\left(-x\right) \cdot \left(-\varepsilon\right)} - -1\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 1.56 \cdot 10^{+100}:\\ \;\;\;\;e^{-x}\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{+275}:\\ \;\;\;\;\left(e^{\left(-x\right) \cdot \left(-\varepsilon\right)} - -1\right) \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\frac{1}{\varepsilon} - -1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2}\\ \end{array} \]
      7. Add Preprocessing

      Alternative 5: 84.2% accurate, 1.9× speedup?

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

        1. Initial program 72.4%

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

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

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

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

          \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot \frac{1}{2} \]
        7. Step-by-step derivation
          1. distribute-lft-neg-in72.0

            \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
          2. exp-neg72.0

            \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
          3. *-commutative72.0

            \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
          4. exp-neg72.0

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

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

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

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

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

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

        if -1.34999999999999996e-272 < x < 9.7e5

        1. Initial program 53.3%

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(e^{\left(-x\right) \cdot \left(1 - \varepsilon\right)} - \left(\left(x \cdot \varepsilon + x\right) - 1\right)\right) \cdot \frac{1}{2} \]
          7. lift-fma.f6488.4

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

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

        if 9.7e5 < x < 1.55999999999999998e100

        1. Initial program 100.0%

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

          \[\leadsto \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)} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto e^{-1 \cdot x} \]
        9. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto e^{-1 \cdot x} \]
          2. distribute-rgt-neg-inN/A

            \[\leadsto e^{-1 \cdot x} \]
          3. pow-expN/A

            \[\leadsto e^{-1 \cdot x} \]
          4. +-commutativeN/A

            \[\leadsto e^{-1 \cdot x} \]
          5. *-commutativeN/A

            \[\leadsto e^{-1 \cdot x} \]
          6. mul-1-negN/A

            \[\leadsto e^{-1 \cdot x} \]
          7. *-commutativeN/A

            \[\leadsto e^{-1 \cdot x} \]
          8. +-commutativeN/A

            \[\leadsto e^{-1 \cdot x} \]
          9. mul-1-negN/A

            \[\leadsto e^{\mathsf{neg}\left(x\right)} \]
          10. lift-exp.f64N/A

            \[\leadsto e^{\mathsf{neg}\left(x\right)} \]
          11. lift-neg.f6478.1

            \[\leadsto e^{-x} \]
        10. Applied rewrites78.1%

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

        if 1.55999999999999998e100 < x < 7.1999999999999996e275

        1. Initial program 100.0%

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

          \[\leadsto \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)} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

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

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

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

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

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

          if 7.1999999999999996e275 < x

          1. Initial program 100.0%

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

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

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

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

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

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

                \[\leadsto \frac{\left({\varepsilon}^{-1} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
              4. lower-pow.f64100.0

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

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

                \[\leadsto \frac{\left({\varepsilon}^{-1} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
              2. inv-powN/A

                \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
              3. lift-/.f64100.0

                \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
            6. Applied rewrites100.0%

              \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
          5. Recombined 5 regimes into one program.
          6. Final simplification71.9%

            \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.35 \cdot 10^{-272}:\\ \;\;\;\;\left(1 + e^{-x \cdot \varepsilon}\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 970000:\\ \;\;\;\;\left(e^{x \cdot \left(-1 + \varepsilon\right)} - \left(\mathsf{fma}\left(x, \varepsilon, x\right) - 1\right)\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 1.56 \cdot 10^{+100}:\\ \;\;\;\;e^{-x}\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{+275}:\\ \;\;\;\;\left(e^{x \cdot \left(-1 + \varepsilon\right)} - -1\right) \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\frac{1}{\varepsilon} - -1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2}\\ \end{array} \]
          7. Add Preprocessing

          Alternative 6: 84.3% accurate, 1.9× speedup?

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

            1. Initial program 72.4%

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

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

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

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

              \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot \frac{1}{2} \]
            7. Step-by-step derivation
              1. distribute-lft-neg-in72.0

                \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
              2. exp-neg72.0

                \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
              3. *-commutative72.0

                \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
              4. exp-neg72.0

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

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

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

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

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

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

            if -1.34999999999999996e-272 < x < 9.7e5

            1. Initial program 53.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \left(e^{x \cdot \varepsilon} - \left(\left(x \cdot \varepsilon + x\right) - 1\right)\right) \cdot \frac{1}{2} \]
              7. lift-fma.f6488.4

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

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

            if 9.7e5 < x < 1.55999999999999998e100

            1. Initial program 100.0%

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

              \[\leadsto \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)} \]
            4. Step-by-step derivation
              1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto e^{-1 \cdot x} \]
            9. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto e^{-1 \cdot x} \]
              2. distribute-rgt-neg-inN/A

                \[\leadsto e^{-1 \cdot x} \]
              3. pow-expN/A

                \[\leadsto e^{-1 \cdot x} \]
              4. +-commutativeN/A

                \[\leadsto e^{-1 \cdot x} \]
              5. *-commutativeN/A

                \[\leadsto e^{-1 \cdot x} \]
              6. mul-1-negN/A

                \[\leadsto e^{-1 \cdot x} \]
              7. *-commutativeN/A

                \[\leadsto e^{-1 \cdot x} \]
              8. +-commutativeN/A

                \[\leadsto e^{-1 \cdot x} \]
              9. mul-1-negN/A

                \[\leadsto e^{\mathsf{neg}\left(x\right)} \]
              10. lift-exp.f64N/A

                \[\leadsto e^{\mathsf{neg}\left(x\right)} \]
              11. lift-neg.f6478.1

                \[\leadsto e^{-x} \]
            10. Applied rewrites78.1%

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

            if 1.55999999999999998e100 < x < 7.1999999999999996e275

            1. Initial program 100.0%

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

              \[\leadsto \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)} \]
            4. Step-by-step derivation
              1. *-commutativeN/A

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

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

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

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

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

              if 7.1999999999999996e275 < x

              1. Initial program 100.0%

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

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

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

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

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

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

                    \[\leadsto \frac{\left({\varepsilon}^{-1} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                  4. lower-pow.f64100.0

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

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

                    \[\leadsto \frac{\left({\varepsilon}^{-1} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                  2. inv-powN/A

                    \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                  3. lift-/.f64100.0

                    \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                6. Applied rewrites100.0%

                  \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
              5. Recombined 5 regimes into one program.
              6. Final simplification71.9%

                \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.35 \cdot 10^{-272}:\\ \;\;\;\;\left(1 + e^{-x \cdot \varepsilon}\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 970000:\\ \;\;\;\;\left(e^{x \cdot \varepsilon} - \left(\mathsf{fma}\left(x, \varepsilon, x\right) - 1\right)\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 1.56 \cdot 10^{+100}:\\ \;\;\;\;e^{-x}\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{+275}:\\ \;\;\;\;\left(e^{x \cdot \left(-1 + \varepsilon\right)} - -1\right) \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\frac{1}{\varepsilon} - -1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2}\\ \end{array} \]
              7. Add Preprocessing

              Alternative 7: 84.3% accurate, 1.9× speedup?

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

                1. Initial program 72.4%

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

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

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

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

                  \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot \frac{1}{2} \]
                7. Step-by-step derivation
                  1. distribute-lft-neg-in72.0

                    \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
                  2. exp-neg72.0

                    \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
                  3. *-commutative72.0

                    \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
                  4. exp-neg72.0

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

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

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

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

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

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

                if -1.34999999999999996e-272 < x < 9.7e5

                1. Initial program 53.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  if 9.7e5 < x < 1.55999999999999998e100

                  1. Initial program 100.0%

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

                    \[\leadsto \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)} \]
                  4. Step-by-step derivation
                    1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto e^{-1 \cdot x} \]
                  9. Step-by-step derivation
                    1. *-commutativeN/A

                      \[\leadsto e^{-1 \cdot x} \]
                    2. distribute-rgt-neg-inN/A

                      \[\leadsto e^{-1 \cdot x} \]
                    3. pow-expN/A

                      \[\leadsto e^{-1 \cdot x} \]
                    4. +-commutativeN/A

                      \[\leadsto e^{-1 \cdot x} \]
                    5. *-commutativeN/A

                      \[\leadsto e^{-1 \cdot x} \]
                    6. mul-1-negN/A

                      \[\leadsto e^{-1 \cdot x} \]
                    7. *-commutativeN/A

                      \[\leadsto e^{-1 \cdot x} \]
                    8. +-commutativeN/A

                      \[\leadsto e^{-1 \cdot x} \]
                    9. mul-1-negN/A

                      \[\leadsto e^{\mathsf{neg}\left(x\right)} \]
                    10. lift-exp.f64N/A

                      \[\leadsto e^{\mathsf{neg}\left(x\right)} \]
                    11. lift-neg.f6478.1

                      \[\leadsto e^{-x} \]
                  10. Applied rewrites78.1%

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

                  if 1.55999999999999998e100 < x < 7.1999999999999996e275

                  1. Initial program 100.0%

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

                    \[\leadsto \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)} \]
                  4. Step-by-step derivation
                    1. *-commutativeN/A

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

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

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

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

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

                    if 7.1999999999999996e275 < x

                    1. Initial program 100.0%

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

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

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

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

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

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

                          \[\leadsto \frac{\left({\varepsilon}^{-1} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                        4. lower-pow.f64100.0

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

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

                          \[\leadsto \frac{\left({\varepsilon}^{-1} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                        2. inv-powN/A

                          \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                        3. lift-/.f64100.0

                          \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                      6. Applied rewrites100.0%

                        \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                    5. Recombined 5 regimes into one program.
                    6. Final simplification71.6%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.35 \cdot 10^{-272}:\\ \;\;\;\;\left(1 + e^{-x \cdot \varepsilon}\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 970000:\\ \;\;\;\;\left(e^{\left(-x\right) \cdot \left(-\varepsilon\right)} - -1\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 1.56 \cdot 10^{+100}:\\ \;\;\;\;e^{-x}\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{+275}:\\ \;\;\;\;\left(e^{x \cdot \left(-1 + \varepsilon\right)} - -1\right) \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\frac{1}{\varepsilon} - -1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2}\\ \end{array} \]
                    7. Add Preprocessing

                    Alternative 8: 78.7% accurate, 2.1× speedup?

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

                      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto e^{-1 \cdot x} \]
                      9. Step-by-step derivation
                        1. *-commutativeN/A

                          \[\leadsto e^{-1 \cdot x} \]
                        2. distribute-rgt-neg-inN/A

                          \[\leadsto e^{-1 \cdot x} \]
                        3. pow-expN/A

                          \[\leadsto e^{-1 \cdot x} \]
                        4. +-commutativeN/A

                          \[\leadsto e^{-1 \cdot x} \]
                        5. *-commutativeN/A

                          \[\leadsto e^{-1 \cdot x} \]
                        6. mul-1-negN/A

                          \[\leadsto e^{-1 \cdot x} \]
                        7. *-commutativeN/A

                          \[\leadsto e^{-1 \cdot x} \]
                        8. +-commutativeN/A

                          \[\leadsto e^{-1 \cdot x} \]
                        9. mul-1-negN/A

                          \[\leadsto e^{\mathsf{neg}\left(x\right)} \]
                        10. lift-exp.f64N/A

                          \[\leadsto e^{\mathsf{neg}\left(x\right)} \]
                        11. lift-neg.f6468.5

                          \[\leadsto e^{-x} \]
                      10. Applied rewrites68.5%

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

                      if -1.05e13 < x < -5.99999999999999983e-223

                      1. Initial program 63.0%

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

                        \[\leadsto \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)} \]
                      4. Step-by-step derivation
                        1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-1, \varepsilon + 1, -\left(1 - \varepsilon\right)\right), x, 2\right) \cdot 0.5 \]
                      8. Applied rewrites54.9%

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

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

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

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

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

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

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

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

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

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

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

                      if -5.99999999999999983e-223 < x < 5.2e-253

                      1. Initial program 59.5%

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

                        \[\leadsto \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)} \]
                      4. Step-by-step derivation
                        1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{fma}\left(-2, x, 2\right) \cdot \frac{1}{2} \]
                      10. Step-by-step derivation
                        1. Applied rewrites89.5%

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

                        if 5.2e-253 < x < 9e5

                        1. Initial program 48.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-1, \varepsilon + 1, -\left(1 - \varepsilon\right)\right), x, 2\right) \cdot 0.5 \]
                        8. Applied rewrites62.1%

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-1, \varepsilon + 1, -\frac{1 - \varepsilon \cdot \varepsilon}{\varepsilon + 1}\right), x, 2\right) \cdot 0.5 \]
                      11. Recombined 4 regimes into one program.
                      12. Final simplification74.3%

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

                      Alternative 9: 81.4% accurate, 2.2× speedup?

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

                        1. Initial program 71.6%

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

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

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

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

                          \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot \frac{1}{2} \]
                        7. Step-by-step derivation
                          1. distribute-lft-neg-in75.7

                            \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
                          2. exp-neg75.7

                            \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
                          3. *-commutative75.7

                            \[\leadsto \left(1 - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \]
                          4. exp-neg75.7

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

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

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

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

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

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

                        if 5.2e-253 < x < 9e5

                        1. Initial program 48.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-1, \varepsilon + 1, -\left(1 - \varepsilon\right)\right), x, 2\right) \cdot 0.5 \]
                        8. Applied rewrites62.1%

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

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

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

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

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

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

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

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

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

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

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

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

                        if 9e5 < x

                        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto e^{-1 \cdot x} \]
                        9. Step-by-step derivation
                          1. *-commutativeN/A

                            \[\leadsto e^{-1 \cdot x} \]
                          2. distribute-rgt-neg-inN/A

                            \[\leadsto e^{-1 \cdot x} \]
                          3. pow-expN/A

                            \[\leadsto e^{-1 \cdot x} \]
                          4. +-commutativeN/A

                            \[\leadsto e^{-1 \cdot x} \]
                          5. *-commutativeN/A

                            \[\leadsto e^{-1 \cdot x} \]
                          6. mul-1-negN/A

                            \[\leadsto e^{-1 \cdot x} \]
                          7. *-commutativeN/A

                            \[\leadsto e^{-1 \cdot x} \]
                          8. +-commutativeN/A

                            \[\leadsto e^{-1 \cdot x} \]
                          9. mul-1-negN/A

                            \[\leadsto e^{\mathsf{neg}\left(x\right)} \]
                          10. lift-exp.f64N/A

                            \[\leadsto e^{\mathsf{neg}\left(x\right)} \]
                          11. lift-neg.f6454.2

                            \[\leadsto e^{-x} \]
                        10. Applied rewrites54.2%

                          \[\leadsto e^{-x} \]
                      3. Recombined 3 regimes into one program.
                      4. Final simplification70.2%

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

                      Alternative 10: 75.9% accurate, 3.8× speedup?

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

                        1. Initial program 100.0%

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

                          \[\leadsto \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)} \]
                        4. Step-by-step derivation
                          1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \left(e^{-x} + e^{\mathsf{neg}\left(x\right)}\right) \cdot \frac{1}{2} \]
                          10. lift-neg.f64100.0

                            \[\leadsto \left(e^{-x} + e^{-x}\right) \cdot 0.5 \]
                        8. Applied rewrites100.0%

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-0.3333333333333333, x, 1\right) \cdot x - 2, x, 2\right) \cdot 0.5 \]
                        11. Applied rewrites100.0%

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(\left(x \cdot x\right) \cdot \frac{-1}{3}, x, 2\right) \cdot \frac{1}{2} \]
                          4. lower-*.f64100.0

                            \[\leadsto \mathsf{fma}\left(\left(x \cdot x\right) \cdot -0.3333333333333333, x, 2\right) \cdot 0.5 \]
                        14. Applied rewrites100.0%

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

                        if -7.40000000000000016e124 < x < -5.99999999999999983e-223

                        1. Initial program 66.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-1, \varepsilon + 1, -\left(1 - \varepsilon\right)\right), x, 2\right) \cdot 0.5 \]
                        8. Applied rewrites49.8%

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

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

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

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

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

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

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

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

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

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

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

                        if -5.99999999999999983e-223 < x < 5.2e-253

                        1. Initial program 59.5%

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

                          \[\leadsto \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)} \]
                        4. Step-by-step derivation
                          1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(-2, x, 2\right) \cdot \frac{1}{2} \]
                        10. Step-by-step derivation
                          1. Applied rewrites89.5%

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

                          if 5.2e-253 < x < 57000

                          1. Initial program 48.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-1, \varepsilon + 1, -\left(1 - \varepsilon\right)\right), x, 2\right) \cdot 0.5 \]
                          8. Applied rewrites62.1%

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

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

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

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

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

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

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

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

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

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

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

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

                          if 57000 < x

                          1. Initial program 100.0%

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

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

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

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

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

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

                                \[\leadsto \frac{\left({\varepsilon}^{-1} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                              4. lower-pow.f6452.2

                                \[\leadsto \frac{\left({\varepsilon}^{-1} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                            4. Applied rewrites52.2%

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

                                \[\leadsto \frac{\left({\varepsilon}^{-1} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                              2. inv-powN/A

                                \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                              3. lift-/.f6452.2

                                \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                            6. Applied rewrites52.2%

                              \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2} \]
                          5. Recombined 5 regimes into one program.
                          6. Final simplification71.8%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7.4 \cdot 10^{+124}:\\ \;\;\;\;\mathsf{fma}\left(\left(x \cdot x\right) \cdot -0.3333333333333333, x, 2\right) \cdot 0.5\\ \mathbf{elif}\;x \leq -6 \cdot 10^{-223}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-1, \frac{\varepsilon \cdot \varepsilon - 1}{\varepsilon - 1}, -1 + \varepsilon\right), x, 2\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{-253}:\\ \;\;\;\;\mathsf{fma}\left(-2, x, 2\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 57000:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-1, \varepsilon - -1, \frac{-1 + \varepsilon \cdot \varepsilon}{\varepsilon - -1}\right), x, 2\right) \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\frac{1}{\varepsilon} - -1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot 1}{2}\\ \end{array} \]
                          7. Add Preprocessing

                          Alternative 11: 72.8% accurate, 4.1× speedup?

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

                            1. Initial program 100.0%

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

                              \[\leadsto \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)} \]
                            4. Step-by-step derivation
                              1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \left(e^{-x} + e^{\mathsf{neg}\left(x\right)}\right) \cdot \frac{1}{2} \]
                              10. lift-neg.f64100.0

                                \[\leadsto \left(e^{-x} + e^{-x}\right) \cdot 0.5 \]
                            8. Applied rewrites100.0%

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

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

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

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

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

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

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

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

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

                                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-0.3333333333333333, x, 1\right) \cdot x - 2, x, 2\right) \cdot 0.5 \]
                            11. Applied rewrites100.0%

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

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

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

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

                                \[\leadsto \mathsf{fma}\left(\left(x \cdot x\right) \cdot \frac{-1}{3}, x, 2\right) \cdot \frac{1}{2} \]
                              4. lower-*.f64100.0

                                \[\leadsto \mathsf{fma}\left(\left(x \cdot x\right) \cdot -0.3333333333333333, x, 2\right) \cdot 0.5 \]
                            14. Applied rewrites100.0%

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

                            if -7.40000000000000016e124 < x < -5.99999999999999983e-223

                            1. Initial program 66.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-1, \varepsilon + 1, -\left(1 - \varepsilon\right)\right), x, 2\right) \cdot 0.5 \]
                            8. Applied rewrites49.8%

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

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

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

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

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

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

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

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

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

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

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

                            if -5.99999999999999983e-223 < x < 5.2e-253

                            1. Initial program 59.5%

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

                              \[\leadsto \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)} \]
                            4. Step-by-step derivation
                              1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(-2, x, 2\right) \cdot \frac{1}{2} \]
                            10. Step-by-step derivation
                              1. Applied rewrites89.5%

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

                              if 5.2e-253 < x < 3.00000000000000012e150

                              1. Initial program 65.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-1, \varepsilon + 1, -\left(1 - \varepsilon\right)\right), x, 2\right) \cdot 0.5 \]
                              8. Applied rewrites42.3%

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

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

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

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

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

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

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

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

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

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

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

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

                              if 3.00000000000000012e150 < x

                              1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \left(e^{-x} + e^{\mathsf{neg}\left(x\right)}\right) \cdot \frac{1}{2} \]
                                10. lift-neg.f6450.8

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(x - 2, x, 2\right) \cdot \frac{1}{2} \]
                                4. lower--.f6448.6

                                  \[\leadsto \mathsf{fma}\left(x - 2, x, 2\right) \cdot 0.5 \]
                              11. Applied rewrites48.6%

                                \[\leadsto \mathsf{fma}\left(x - 2, x, 2\right) \cdot 0.5 \]
                            11. Recombined 5 regimes into one program.
                            12. Final simplification66.7%

                              \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7.4 \cdot 10^{+124}:\\ \;\;\;\;\mathsf{fma}\left(\left(x \cdot x\right) \cdot -0.3333333333333333, x, 2\right) \cdot 0.5\\ \mathbf{elif}\;x \leq -6 \cdot 10^{-223}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-1, \frac{\varepsilon \cdot \varepsilon - 1}{\varepsilon - 1}, -1 + \varepsilon\right), x, 2\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{-253}:\\ \;\;\;\;\mathsf{fma}\left(-2, x, 2\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 3 \cdot 10^{+150}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-1, \varepsilon - -1, \frac{-1 + \varepsilon \cdot \varepsilon}{\varepsilon - -1}\right), x, 2\right) \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x - 2, x, 2\right) \cdot 0.5\\ \end{array} \]
                            13. Add Preprocessing

                            Alternative 12: 67.0% accurate, 5.0× speedup?

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

                              1. Initial program 71.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \left(e^{-x} + e^{\mathsf{neg}\left(x\right)}\right) \cdot \frac{1}{2} \]
                                10. lift-neg.f6477.5

                                  \[\leadsto \left(e^{-x} + e^{-x}\right) \cdot 0.5 \]
                              8. Applied rewrites77.5%

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

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

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

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(\left(\frac{-1}{3} \cdot x + 1\right) \cdot x - 2, x, 2\right) \cdot \frac{1}{2} \]
                                8. lower-fma.f6472.9

                                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-0.3333333333333333, x, 1\right) \cdot x - 2, x, 2\right) \cdot 0.5 \]
                              11. Applied rewrites72.9%

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(\left(x \cdot x\right) \cdot \frac{-1}{3}, x, 2\right) \cdot \frac{1}{2} \]
                                4. lower-*.f6473.1

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

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

                              if 5.2e-253 < x < 3.00000000000000012e150

                              1. Initial program 65.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-1, \varepsilon + 1, -\left(1 - \varepsilon\right)\right), x, 2\right) \cdot 0.5 \]
                              8. Applied rewrites42.3%

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

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

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

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

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

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

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

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

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

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

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

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

                              if 3.00000000000000012e150 < x

                              1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \left(e^{-x} + e^{\mathsf{neg}\left(x\right)}\right) \cdot \frac{1}{2} \]
                                10. lift-neg.f6450.8

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(x - 2, x, 2\right) \cdot \frac{1}{2} \]
                                4. lower--.f6448.6

                                  \[\leadsto \mathsf{fma}\left(x - 2, x, 2\right) \cdot 0.5 \]
                              11. Applied rewrites48.6%

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

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

                            Alternative 13: 59.7% accurate, 9.7× speedup?

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

                              1. Initial program 66.2%

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

                                \[\leadsto \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)} \]
                              4. Step-by-step derivation
                                1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \left(e^{-x} + e^{\mathsf{neg}\left(x\right)}\right) \cdot \frac{1}{2} \]
                                10. lift-neg.f6475.0

                                  \[\leadsto \left(e^{-x} + e^{-x}\right) \cdot 0.5 \]
                              8. Applied rewrites75.0%

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

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

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

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(\left(\frac{-1}{3} \cdot x + 1\right) \cdot x - 2, x, 2\right) \cdot \frac{1}{2} \]
                                8. lower-fma.f6471.4

                                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-0.3333333333333333, x, 1\right) \cdot x - 2, x, 2\right) \cdot 0.5 \]
                              11. Applied rewrites71.4%

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(\left(x \cdot x\right) \cdot \frac{-1}{3}, x, 2\right) \cdot \frac{1}{2} \]
                                4. lower-*.f6471.6

                                  \[\leadsto \mathsf{fma}\left(\left(x \cdot x\right) \cdot -0.3333333333333333, x, 2\right) \cdot 0.5 \]
                              14. Applied rewrites71.6%

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

                              if 1.44999999999999993e-102 < x

                              1. Initial program 86.2%

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

                                \[\leadsto \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)} \]
                              4. Step-by-step derivation
                                1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(-1, 1, -\left(1 - \varepsilon\right)\right), x, 2\right) \cdot 0.5 \]
                              11. Recombined 2 regimes into one program.
                              12. Final simplification55.3%

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

                              Alternative 14: 57.1% accurate, 18.2× speedup?

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

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

                                \[\leadsto \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)} \]
                              4. Step-by-step derivation
                                1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \left(e^{-x} + e^{-x}\right) \cdot 0.5 \]
                              8. Applied rewrites67.3%

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

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

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

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

                                  \[\leadsto \mathsf{fma}\left(x - 2, x, 2\right) \cdot \frac{1}{2} \]
                                4. lower--.f6457.4

                                  \[\leadsto \mathsf{fma}\left(x - 2, x, 2\right) \cdot 0.5 \]
                              11. Applied rewrites57.4%

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

                              Alternative 15: 42.7% accurate, 273.0× speedup?

                              \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ 1 \end{array} \]
                              eps_m = (fabs.f64 eps)
                              (FPCore (x eps_m) :precision binary64 1.0)
                              eps_m = fabs(eps);
                              double code(double x, double eps_m) {
                              	return 1.0;
                              }
                              
                              eps_m =     private
                              module fmin_fmax_functions
                                  implicit none
                                  private
                                  public fmax
                                  public fmin
                              
                                  interface fmax
                                      module procedure fmax88
                                      module procedure fmax44
                                      module procedure fmax84
                                      module procedure fmax48
                                  end interface
                                  interface fmin
                                      module procedure fmin88
                                      module procedure fmin44
                                      module procedure fmin84
                                      module procedure fmin48
                                  end interface
                              contains
                                  real(8) function fmax88(x, y) result (res)
                                      real(8), intent (in) :: x
                                      real(8), intent (in) :: y
                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                  end function
                                  real(4) function fmax44(x, y) result (res)
                                      real(4), intent (in) :: x
                                      real(4), intent (in) :: y
                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                  end function
                                  real(8) function fmax84(x, y) result(res)
                                      real(8), intent (in) :: x
                                      real(4), intent (in) :: y
                                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                  end function
                                  real(8) function fmax48(x, y) result(res)
                                      real(4), intent (in) :: x
                                      real(8), intent (in) :: y
                                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                  end function
                                  real(8) function fmin88(x, y) result (res)
                                      real(8), intent (in) :: x
                                      real(8), intent (in) :: y
                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                  end function
                                  real(4) function fmin44(x, y) result (res)
                                      real(4), intent (in) :: x
                                      real(4), intent (in) :: y
                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                  end function
                                  real(8) function fmin84(x, y) result(res)
                                      real(8), intent (in) :: x
                                      real(4), intent (in) :: y
                                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                  end function
                                  real(8) function fmin48(x, y) result(res)
                                      real(4), intent (in) :: x
                                      real(8), intent (in) :: y
                                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                  end function
                              end module
                              
                              real(8) function code(x, eps_m)
                              use fmin_fmax_functions
                                  real(8), intent (in) :: x
                                  real(8), intent (in) :: eps_m
                                  code = 1.0d0
                              end function
                              
                              eps_m = Math.abs(eps);
                              public static double code(double x, double eps_m) {
                              	return 1.0;
                              }
                              
                              eps_m = math.fabs(eps)
                              def code(x, eps_m):
                              	return 1.0
                              
                              eps_m = abs(eps)
                              function code(x, eps_m)
                              	return 1.0
                              end
                              
                              eps_m = abs(eps);
                              function tmp = code(x, eps_m)
                              	tmp = 1.0;
                              end
                              
                              eps_m = N[Abs[eps], $MachinePrecision]
                              code[x_, eps$95$m_] := 1.0
                              
                              \begin{array}{l}
                              eps_m = \left|\varepsilon\right|
                              
                              \\
                              1
                              \end{array}
                              
                              Derivation
                              1. Initial program 73.9%

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

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

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

                                Reproduce

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