NMSE Section 6.1 mentioned, A

Percentage Accurate: 73.5% → 99.9%
Time: 5.7s
Alternatives: 9
Speedup: 2.5×

Specification

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

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

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

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

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 73.5% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 99.9% accurate, 1.5× speedup?

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

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

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

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

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


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

    1. Initial program 37.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(e^{-x} + \frac{e^{-x}}{x}\right) \cdot x \]
      10. lift-exp.f6499.8

        \[\leadsto \left(e^{-x} + \frac{e^{-x}}{x}\right) \cdot x \]
    9. Applied rewrites99.8%

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

    if 1 < eps

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.1% accurate, 1.5× speedup?

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

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

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

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

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

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

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

Alternative 3: 85.3% accurate, 2.3× speedup?

\[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{-309}:\\ \;\;\;\;\left(1 - \left(-e^{-x \cdot eps\_m}\right)\right) \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\left(e^{x \cdot eps\_m} - -1\right) \cdot 0.5\\ \end{array} \end{array} \]
eps_m = (fabs.f64 eps)
(FPCore (x eps_m)
 :precision binary64
 (if (<= x -2e-309)
   (* (- 1.0 (- (exp (- (* x eps_m))))) 0.5)
   (* (- (exp (* x eps_m)) -1.0) 0.5)))
eps_m = fabs(eps);
double code(double x, double eps_m) {
	double tmp;
	if (x <= -2e-309) {
		tmp = (1.0 - -exp(-(x * eps_m))) * 0.5;
	} else {
		tmp = (exp((x * eps_m)) - -1.0) * 0.5;
	}
	return tmp;
}
eps_m =     private
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

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

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

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


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

    1. Initial program 68.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -1.9999999999999988e-309 < x

      1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

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

      Alternative 4: 78.0% accurate, 2.5× speedup?

      \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} \mathbf{if}\;eps\_m \leq 72:\\ \;\;\;\;\left(e^{-x} \cdot 2\right) \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\left(e^{x \cdot eps\_m} - -1\right) \cdot 0.5\\ \end{array} \end{array} \]
      eps_m = (fabs.f64 eps)
      (FPCore (x eps_m)
       :precision binary64
       (if (<= eps_m 72.0)
         (* (* (exp (- x)) 2.0) 0.5)
         (* (- (exp (* x eps_m)) -1.0) 0.5)))
      eps_m = fabs(eps);
      double code(double x, double eps_m) {
      	double tmp;
      	if (eps_m <= 72.0) {
      		tmp = (exp(-x) * 2.0) * 0.5;
      	} else {
      		tmp = (exp((x * eps_m)) - -1.0) * 0.5;
      	}
      	return tmp;
      }
      
      eps_m =     private
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(x, eps_m)
      use fmin_fmax_functions
          real(8), intent (in) :: x
          real(8), intent (in) :: eps_m
          real(8) :: tmp
          if (eps_m <= 72.0d0) then
              tmp = (exp(-x) * 2.0d0) * 0.5d0
          else
              tmp = (exp((x * eps_m)) - (-1.0d0)) * 0.5d0
          end if
          code = tmp
      end function
      
      eps_m = Math.abs(eps);
      public static double code(double x, double eps_m) {
      	double tmp;
      	if (eps_m <= 72.0) {
      		tmp = (Math.exp(-x) * 2.0) * 0.5;
      	} else {
      		tmp = (Math.exp((x * eps_m)) - -1.0) * 0.5;
      	}
      	return tmp;
      }
      
      eps_m = math.fabs(eps)
      def code(x, eps_m):
      	tmp = 0
      	if eps_m <= 72.0:
      		tmp = (math.exp(-x) * 2.0) * 0.5
      	else:
      		tmp = (math.exp((x * eps_m)) - -1.0) * 0.5
      	return tmp
      
      eps_m = abs(eps)
      function code(x, eps_m)
      	tmp = 0.0
      	if (eps_m <= 72.0)
      		tmp = Float64(Float64(exp(Float64(-x)) * 2.0) * 0.5);
      	else
      		tmp = Float64(Float64(exp(Float64(x * eps_m)) - -1.0) * 0.5);
      	end
      	return tmp
      end
      
      eps_m = abs(eps);
      function tmp_2 = code(x, eps_m)
      	tmp = 0.0;
      	if (eps_m <= 72.0)
      		tmp = (exp(-x) * 2.0) * 0.5;
      	else
      		tmp = (exp((x * eps_m)) - -1.0) * 0.5;
      	end
      	tmp_2 = tmp;
      end
      
      eps_m = N[Abs[eps], $MachinePrecision]
      code[x_, eps$95$m_] := If[LessEqual[eps$95$m, 72.0], N[(N[(N[Exp[(-x)], $MachinePrecision] * 2.0), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[Exp[N[(x * eps$95$m), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] * 0.5), $MachinePrecision]]
      
      \begin{array}{l}
      eps_m = \left|\varepsilon\right|
      
      \\
      \begin{array}{l}
      \mathbf{if}\;eps\_m \leq 72:\\
      \;\;\;\;\left(e^{-x} \cdot 2\right) \cdot 0.5\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(e^{x \cdot eps\_m} - -1\right) \cdot 0.5\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if eps < 72

        1. Initial program 38.5%

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(e^{\mathsf{neg}\left(x\right)} + e^{-1 \cdot x}\right) \cdot \frac{1}{2} \]
        9. 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. count-2-revN/A

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

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

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

            \[\leadsto \left(e^{-x} \cdot 2\right) \cdot \frac{1}{2} \]
          6. lift-exp.f6497.7

            \[\leadsto \left(e^{-x} \cdot 2\right) \cdot 0.5 \]
        10. Applied rewrites97.7%

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

        if 72 < eps

        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

        Alternative 5: 70.7% accurate, 2.6× speedup?

        \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ \begin{array}{l} t_0 := e^{-x}\\ \mathbf{if}\;x \leq 2.1:\\ \;\;\;\;\left(t\_0 - -1\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 9 \cdot 10^{+126}:\\ \;\;\;\;t\_0 \cdot x\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333 \cdot x - 0.5, x \cdot x, 1\right)\\ \end{array} \end{array} \]
        eps_m = (fabs.f64 eps)
        (FPCore (x eps_m)
         :precision binary64
         (let* ((t_0 (exp (- x))))
           (if (<= x 2.1)
             (* (- t_0 -1.0) 0.5)
             (if (<= x 9e+126)
               (* t_0 x)
               (fma (- (* 0.3333333333333333 x) 0.5) (* x x) 1.0)))))
        eps_m = fabs(eps);
        double code(double x, double eps_m) {
        	double t_0 = exp(-x);
        	double tmp;
        	if (x <= 2.1) {
        		tmp = (t_0 - -1.0) * 0.5;
        	} else if (x <= 9e+126) {
        		tmp = t_0 * x;
        	} else {
        		tmp = fma(((0.3333333333333333 * x) - 0.5), (x * x), 1.0);
        	}
        	return tmp;
        }
        
        eps_m = abs(eps)
        function code(x, eps_m)
        	t_0 = exp(Float64(-x))
        	tmp = 0.0
        	if (x <= 2.1)
        		tmp = Float64(Float64(t_0 - -1.0) * 0.5);
        	elseif (x <= 9e+126)
        		tmp = Float64(t_0 * x);
        	else
        		tmp = fma(Float64(Float64(0.3333333333333333 * x) - 0.5), Float64(x * x), 1.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, 2.1], N[(N[(t$95$0 - -1.0), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 9e+126], N[(t$95$0 * x), $MachinePrecision], N[(N[(N[(0.3333333333333333 * x), $MachinePrecision] - 0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]]]]
        
        \begin{array}{l}
        eps_m = \left|\varepsilon\right|
        
        \\
        \begin{array}{l}
        t_0 := e^{-x}\\
        \mathbf{if}\;x \leq 2.1:\\
        \;\;\;\;\left(t\_0 - -1\right) \cdot 0.5\\
        
        \mathbf{elif}\;x \leq 9 \cdot 10^{+126}:\\
        \;\;\;\;t\_0 \cdot x\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(0.3333333333333333 \cdot x - 0.5, x \cdot x, 1\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if x < 2.10000000000000009

          1. Initial program 63.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if 2.10000000000000009 < x < 8.99999999999999947e126

            1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \left(\left(x + 1\right) \cdot e^{-x} - \left(-e^{-x} \cdot \left(x + 1\right)\right)\right) \cdot \frac{1}{2} \]
              12. lift-+.f6449.6

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

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

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

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

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

                \[\leadsto e^{-x} \cdot x \]
              4. lift-exp.f6448.9

                \[\leadsto e^{-x} \cdot x \]
            9. Applied rewrites48.9%

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

            if 8.99999999999999947e126 < x

            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(0.3333333333333333 \cdot x - 0.5, \color{blue}{x \cdot x}, 1\right) \]
          10. Recombined 3 regimes into one program.
          11. Add Preprocessing

          Alternative 6: 70.7% accurate, 2.7× speedup?

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

            1. Initial program 67.4%

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(e^{\mathsf{neg}\left(x\right)} + e^{-1 \cdot x}\right) \cdot \frac{1}{2} \]
            9. 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. count-2-revN/A

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

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

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

                \[\leadsto \left(e^{-x} \cdot 2\right) \cdot \frac{1}{2} \]
              6. lift-exp.f6475.2

                \[\leadsto \left(e^{-x} \cdot 2\right) \cdot 0.5 \]
            10. Applied rewrites75.2%

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

            if 5e102 < x

            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(0.3333333333333333 \cdot x - 0.5, x \cdot x, 1\right) \]
            7. Applied rewrites51.3%

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

          Alternative 7: 57.6% accurate, 2.6× speedup?

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

            1. Initial program 63.1%

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

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

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

              if 1.3500000000000001 < x < 8.99999999999999947e126

              1. Initial program 99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \left(\left(x + 1\right) \cdot e^{-x} - \left(-e^{-x} \cdot \left(x + 1\right)\right)\right) \cdot \frac{1}{2} \]
                12. lift-+.f6449.6

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

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

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

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

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

                  \[\leadsto e^{-x} \cdot x \]
                4. lift-exp.f6448.9

                  \[\leadsto e^{-x} \cdot x \]
              9. Applied rewrites48.9%

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

              if 8.99999999999999947e126 < x

              1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Alternative 8: 53.1% accurate, 4.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(0.3333333333333333 \cdot x - 0.5, x \cdot x, 1\right) \]
            7. Applied rewrites53.1%

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

            Alternative 9: 44.3% accurate, 58.4× speedup?

            \[\begin{array}{l} eps_m = \left|\varepsilon\right| \\ 1 \end{array} \]
            eps_m = (fabs.f64 eps)
            (FPCore (x eps_m) :precision binary64 1.0)
            eps_m = fabs(eps);
            double code(double x, double eps_m) {
            	return 1.0;
            }
            
            eps_m =     private
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(x, eps_m)
            use fmin_fmax_functions
                real(8), intent (in) :: x
                real(8), intent (in) :: eps_m
                code = 1.0d0
            end function
            
            eps_m = Math.abs(eps);
            public static double code(double x, double eps_m) {
            	return 1.0;
            }
            
            eps_m = math.fabs(eps)
            def code(x, eps_m):
            	return 1.0
            
            eps_m = abs(eps)
            function code(x, eps_m)
            	return 1.0
            end
            
            eps_m = abs(eps);
            function tmp = code(x, eps_m)
            	tmp = 1.0;
            end
            
            eps_m = N[Abs[eps], $MachinePrecision]
            code[x_, eps$95$m_] := 1.0
            
            \begin{array}{l}
            eps_m = \left|\varepsilon\right|
            
            \\
            1
            \end{array}
            
            Derivation
            1. Initial program 73.5%

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

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

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

              Reproduce

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