NMSE Section 6.1 mentioned, A

Percentage Accurate: 73.0% → 99.1%
Time: 5.1s
Alternatives: 12
Speedup: 1.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 12 alternatives:

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

Initial Program: 73.0% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 99.1% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 35.6%

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

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

      \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
    4. 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} \]
    5. Step-by-step derivation
      1. Applied rewrites73.0%

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

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

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

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

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

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

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

      if 0.0 < (/.f64 (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) #s(literal 2 binary64))

      1. Initial program 99.8%

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

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

        \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
      4. 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} \]
      5. Step-by-step derivation
        1. Applied rewrites99.8%

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

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

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

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

      Alternative 2: 99.0% accurate, 1.5× speedup?

      \[\begin{array}{l} \\ \left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5 \end{array} \]
      (FPCore (x eps)
       :precision binary64
       (* (- (exp (* (- eps 1.0) x)) (- (exp (- (fma x eps x))))) 0.5))
      double code(double x, double eps) {
      	return (exp(((eps - 1.0) * x)) - -exp(-fma(x, eps, x))) * 0.5;
      }
      
      function code(x, eps)
      	return Float64(Float64(exp(Float64(Float64(eps - 1.0) * x)) - Float64(-exp(Float64(-fma(x, eps, x))))) * 0.5)
      end
      
      code[x_, eps_] := N[(N[(N[Exp[N[(N[(eps - 1.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] - (-N[Exp[(-N[(x * eps + x), $MachinePrecision])], $MachinePrecision])), $MachinePrecision] * 0.5), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5
      \end{array}
      
      Derivation
      1. Initial program 73.0%

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

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

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

      Alternative 3: 71.1% accurate, 1.5× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-x}\\ \mathbf{if}\;x \leq -2 \cdot 10^{-289}:\\ \;\;\;\;\left(1 - \left(-e^{-\varepsilon \cdot x}\right)\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 7 \cdot 10^{+23}:\\ \;\;\;\;\left(e^{\varepsilon \cdot x} - -1\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 1.52 \cdot 10^{+178}:\\ \;\;\;\;\left(t\_0 + t\_0\right) \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\left(e^{\left(\varepsilon - 1\right) \cdot x} - -1\right) \cdot 0.5\\ \end{array} \end{array} \]
      (FPCore (x eps)
       :precision binary64
       (let* ((t_0 (exp (- x))))
         (if (<= x -2e-289)
           (* (- 1.0 (- (exp (- (* eps x))))) 0.5)
           (if (<= x 7e+23)
             (* (- (exp (* eps x)) -1.0) 0.5)
             (if (<= x 1.52e+178)
               (* (+ t_0 t_0) 0.5)
               (* (- (exp (* (- eps 1.0) x)) -1.0) 0.5))))))
      double code(double x, double eps) {
      	double t_0 = exp(-x);
      	double tmp;
      	if (x <= -2e-289) {
      		tmp = (1.0 - -exp(-(eps * x))) * 0.5;
      	} else if (x <= 7e+23) {
      		tmp = (exp((eps * x)) - -1.0) * 0.5;
      	} else if (x <= 1.52e+178) {
      		tmp = (t_0 + t_0) * 0.5;
      	} else {
      		tmp = (exp(((eps - 1.0) * x)) - -1.0) * 0.5;
      	}
      	return tmp;
      }
      
      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
          real(8) :: t_0
          real(8) :: tmp
          t_0 = exp(-x)
          if (x <= (-2d-289)) then
              tmp = (1.0d0 - -exp(-(eps * x))) * 0.5d0
          else if (x <= 7d+23) then
              tmp = (exp((eps * x)) - (-1.0d0)) * 0.5d0
          else if (x <= 1.52d+178) then
              tmp = (t_0 + t_0) * 0.5d0
          else
              tmp = (exp(((eps - 1.0d0) * x)) - (-1.0d0)) * 0.5d0
          end if
          code = tmp
      end function
      
      public static double code(double x, double eps) {
      	double t_0 = Math.exp(-x);
      	double tmp;
      	if (x <= -2e-289) {
      		tmp = (1.0 - -Math.exp(-(eps * x))) * 0.5;
      	} else if (x <= 7e+23) {
      		tmp = (Math.exp((eps * x)) - -1.0) * 0.5;
      	} else if (x <= 1.52e+178) {
      		tmp = (t_0 + t_0) * 0.5;
      	} else {
      		tmp = (Math.exp(((eps - 1.0) * x)) - -1.0) * 0.5;
      	}
      	return tmp;
      }
      
      def code(x, eps):
      	t_0 = math.exp(-x)
      	tmp = 0
      	if x <= -2e-289:
      		tmp = (1.0 - -math.exp(-(eps * x))) * 0.5
      	elif x <= 7e+23:
      		tmp = (math.exp((eps * x)) - -1.0) * 0.5
      	elif x <= 1.52e+178:
      		tmp = (t_0 + t_0) * 0.5
      	else:
      		tmp = (math.exp(((eps - 1.0) * x)) - -1.0) * 0.5
      	return tmp
      
      function code(x, eps)
      	t_0 = exp(Float64(-x))
      	tmp = 0.0
      	if (x <= -2e-289)
      		tmp = Float64(Float64(1.0 - Float64(-exp(Float64(-Float64(eps * x))))) * 0.5);
      	elseif (x <= 7e+23)
      		tmp = Float64(Float64(exp(Float64(eps * x)) - -1.0) * 0.5);
      	elseif (x <= 1.52e+178)
      		tmp = Float64(Float64(t_0 + t_0) * 0.5);
      	else
      		tmp = Float64(Float64(exp(Float64(Float64(eps - 1.0) * x)) - -1.0) * 0.5);
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, eps)
      	t_0 = exp(-x);
      	tmp = 0.0;
      	if (x <= -2e-289)
      		tmp = (1.0 - -exp(-(eps * x))) * 0.5;
      	elseif (x <= 7e+23)
      		tmp = (exp((eps * x)) - -1.0) * 0.5;
      	elseif (x <= 1.52e+178)
      		tmp = (t_0 + t_0) * 0.5;
      	else
      		tmp = (exp(((eps - 1.0) * x)) - -1.0) * 0.5;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, eps_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[x, -2e-289], N[(N[(1.0 - (-N[Exp[(-N[(eps * x), $MachinePrecision])], $MachinePrecision])), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 7e+23], N[(N[(N[Exp[N[(eps * x), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 1.52e+178], N[(N[(t$95$0 + t$95$0), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[Exp[N[(N[(eps - 1.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] * 0.5), $MachinePrecision]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := e^{-x}\\
      \mathbf{if}\;x \leq -2 \cdot 10^{-289}:\\
      \;\;\;\;\left(1 - \left(-e^{-\varepsilon \cdot x}\right)\right) \cdot 0.5\\
      
      \mathbf{elif}\;x \leq 7 \cdot 10^{+23}:\\
      \;\;\;\;\left(e^{\varepsilon \cdot x} - -1\right) \cdot 0.5\\
      
      \mathbf{elif}\;x \leq 1.52 \cdot 10^{+178}:\\
      \;\;\;\;\left(t\_0 + t\_0\right) \cdot 0.5\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(e^{\left(\varepsilon - 1\right) \cdot x} - -1\right) \cdot 0.5\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if x < -2e-289

        1. Initial program 69.8%

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

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

          \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
        4. 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} \]
        5. Step-by-step derivation
          1. Applied rewrites98.9%

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

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

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

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

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

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

            if -2e-289 < x < 7.0000000000000004e23

            1. Initial program 55.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. Applied rewrites98.5%

              \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
            4. 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} \]
            5. Step-by-step derivation
              1. Applied rewrites95.8%

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

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

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

                if 7.0000000000000004e23 < x < 1.5199999999999999e178

                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. Applied rewrites100.0%

                  \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
                4. 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} \]
                5. Step-by-step derivation
                  1. Applied rewrites57.4%

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

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

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

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

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

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

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

                  if 1.5199999999999999e178 < x

                  1. Initial program 100.0%

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

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

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

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

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

                  Alternative 4: 71.0% accurate, 1.7× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{-289}:\\ \;\;\;\;\left(1 - \left(-e^{-\varepsilon \cdot x}\right)\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 7 \cdot 10^{+23}:\\ \;\;\;\;\left(e^{\varepsilon \cdot x} - -1\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 1.52 \cdot 10^{+178}:\\ \;\;\;\;\frac{\left(\frac{1}{\varepsilon} + 1\right) - \frac{1 - \varepsilon}{\varepsilon}}{2}\\ \mathbf{else}:\\ \;\;\;\;\left(e^{\left(\varepsilon - 1\right) \cdot x} - -1\right) \cdot 0.5\\ \end{array} \end{array} \]
                  (FPCore (x eps)
                   :precision binary64
                   (if (<= x -2e-289)
                     (* (- 1.0 (- (exp (- (* eps x))))) 0.5)
                     (if (<= x 7e+23)
                       (* (- (exp (* eps x)) -1.0) 0.5)
                       (if (<= x 1.52e+178)
                         (/ (- (+ (/ 1.0 eps) 1.0) (/ (- 1.0 eps) eps)) 2.0)
                         (* (- (exp (* (- eps 1.0) x)) -1.0) 0.5)))))
                  double code(double x, double eps) {
                  	double tmp;
                  	if (x <= -2e-289) {
                  		tmp = (1.0 - -exp(-(eps * x))) * 0.5;
                  	} else if (x <= 7e+23) {
                  		tmp = (exp((eps * x)) - -1.0) * 0.5;
                  	} else if (x <= 1.52e+178) {
                  		tmp = (((1.0 / eps) + 1.0) - ((1.0 - eps) / eps)) / 2.0;
                  	} else {
                  		tmp = (exp(((eps - 1.0) * x)) - -1.0) * 0.5;
                  	}
                  	return tmp;
                  }
                  
                  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
                      real(8) :: tmp
                      if (x <= (-2d-289)) then
                          tmp = (1.0d0 - -exp(-(eps * x))) * 0.5d0
                      else if (x <= 7d+23) then
                          tmp = (exp((eps * x)) - (-1.0d0)) * 0.5d0
                      else if (x <= 1.52d+178) then
                          tmp = (((1.0d0 / eps) + 1.0d0) - ((1.0d0 - eps) / eps)) / 2.0d0
                      else
                          tmp = (exp(((eps - 1.0d0) * x)) - (-1.0d0)) * 0.5d0
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double x, double eps) {
                  	double tmp;
                  	if (x <= -2e-289) {
                  		tmp = (1.0 - -Math.exp(-(eps * x))) * 0.5;
                  	} else if (x <= 7e+23) {
                  		tmp = (Math.exp((eps * x)) - -1.0) * 0.5;
                  	} else if (x <= 1.52e+178) {
                  		tmp = (((1.0 / eps) + 1.0) - ((1.0 - eps) / eps)) / 2.0;
                  	} else {
                  		tmp = (Math.exp(((eps - 1.0) * x)) - -1.0) * 0.5;
                  	}
                  	return tmp;
                  }
                  
                  def code(x, eps):
                  	tmp = 0
                  	if x <= -2e-289:
                  		tmp = (1.0 - -math.exp(-(eps * x))) * 0.5
                  	elif x <= 7e+23:
                  		tmp = (math.exp((eps * x)) - -1.0) * 0.5
                  	elif x <= 1.52e+178:
                  		tmp = (((1.0 / eps) + 1.0) - ((1.0 - eps) / eps)) / 2.0
                  	else:
                  		tmp = (math.exp(((eps - 1.0) * x)) - -1.0) * 0.5
                  	return tmp
                  
                  function code(x, eps)
                  	tmp = 0.0
                  	if (x <= -2e-289)
                  		tmp = Float64(Float64(1.0 - Float64(-exp(Float64(-Float64(eps * x))))) * 0.5);
                  	elseif (x <= 7e+23)
                  		tmp = Float64(Float64(exp(Float64(eps * x)) - -1.0) * 0.5);
                  	elseif (x <= 1.52e+178)
                  		tmp = Float64(Float64(Float64(Float64(1.0 / eps) + 1.0) - Float64(Float64(1.0 - eps) / eps)) / 2.0);
                  	else
                  		tmp = Float64(Float64(exp(Float64(Float64(eps - 1.0) * x)) - -1.0) * 0.5);
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(x, eps)
                  	tmp = 0.0;
                  	if (x <= -2e-289)
                  		tmp = (1.0 - -exp(-(eps * x))) * 0.5;
                  	elseif (x <= 7e+23)
                  		tmp = (exp((eps * x)) - -1.0) * 0.5;
                  	elseif (x <= 1.52e+178)
                  		tmp = (((1.0 / eps) + 1.0) - ((1.0 - eps) / eps)) / 2.0;
                  	else
                  		tmp = (exp(((eps - 1.0) * x)) - -1.0) * 0.5;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[x_, eps_] := If[LessEqual[x, -2e-289], N[(N[(1.0 - (-N[Exp[(-N[(eps * x), $MachinePrecision])], $MachinePrecision])), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 7e+23], N[(N[(N[Exp[N[(eps * x), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 1.52e+178], N[(N[(N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision] - N[(N[(1.0 - eps), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[Exp[N[(N[(eps - 1.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] * 0.5), $MachinePrecision]]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;x \leq -2 \cdot 10^{-289}:\\
                  \;\;\;\;\left(1 - \left(-e^{-\varepsilon \cdot x}\right)\right) \cdot 0.5\\
                  
                  \mathbf{elif}\;x \leq 7 \cdot 10^{+23}:\\
                  \;\;\;\;\left(e^{\varepsilon \cdot x} - -1\right) \cdot 0.5\\
                  
                  \mathbf{elif}\;x \leq 1.52 \cdot 10^{+178}:\\
                  \;\;\;\;\frac{\left(\frac{1}{\varepsilon} + 1\right) - \frac{1 - \varepsilon}{\varepsilon}}{2}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\left(e^{\left(\varepsilon - 1\right) \cdot x} - -1\right) \cdot 0.5\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 4 regimes
                  2. if x < -2e-289

                    1. Initial program 69.8%

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

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

                      \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
                    4. 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} \]
                    5. Step-by-step derivation
                      1. Applied rewrites98.9%

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

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

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

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

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

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

                        if -2e-289 < x < 7.0000000000000004e23

                        1. Initial program 55.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. Applied rewrites98.5%

                          \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
                        4. 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} \]
                        5. Step-by-step derivation
                          1. Applied rewrites95.8%

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

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

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

                            if 7.0000000000000004e23 < x < 1.5199999999999999e178

                            1. Initial program 100.0%

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

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

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

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

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

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

                                \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
                              2. lift--.f6450.4

                                \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - \color{blue}{1}\right)}{2} \]
                            7. Applied rewrites50.4%

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

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

                                \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \frac{1 + \left(\mathsf{neg}\left(\varepsilon\right)\right)}{\varepsilon}}{2} \]
                              2. negate-subN/A

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

                                \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \frac{1 - \varepsilon}{\varepsilon}}{2} \]
                              4. lift--.f6450.4

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

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

                            if 1.5199999999999999e178 < x

                            1. Initial program 100.0%

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

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

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

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

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

                            Alternative 5: 70.9% accurate, 1.9× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(e^{\varepsilon \cdot x} - -1\right) \cdot 0.5\\ \mathbf{if}\;x \leq -2 \cdot 10^{-289}:\\ \;\;\;\;\left(1 - \left(-e^{-\varepsilon \cdot x}\right)\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 7 \cdot 10^{+23}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{+178}:\\ \;\;\;\;\frac{\left(\frac{1}{\varepsilon} + 1\right) - \frac{1 - \varepsilon}{\varepsilon}}{2}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                            (FPCore (x eps)
                             :precision binary64
                             (let* ((t_0 (* (- (exp (* eps x)) -1.0) 0.5)))
                               (if (<= x -2e-289)
                                 (* (- 1.0 (- (exp (- (* eps x))))) 0.5)
                                 (if (<= x 7e+23)
                                   t_0
                                   (if (<= x 1.9e+178)
                                     (/ (- (+ (/ 1.0 eps) 1.0) (/ (- 1.0 eps) eps)) 2.0)
                                     t_0)))))
                            double code(double x, double eps) {
                            	double t_0 = (exp((eps * x)) - -1.0) * 0.5;
                            	double tmp;
                            	if (x <= -2e-289) {
                            		tmp = (1.0 - -exp(-(eps * x))) * 0.5;
                            	} else if (x <= 7e+23) {
                            		tmp = t_0;
                            	} else if (x <= 1.9e+178) {
                            		tmp = (((1.0 / eps) + 1.0) - ((1.0 - eps) / eps)) / 2.0;
                            	} else {
                            		tmp = t_0;
                            	}
                            	return tmp;
                            }
                            
                            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
                                real(8) :: t_0
                                real(8) :: tmp
                                t_0 = (exp((eps * x)) - (-1.0d0)) * 0.5d0
                                if (x <= (-2d-289)) then
                                    tmp = (1.0d0 - -exp(-(eps * x))) * 0.5d0
                                else if (x <= 7d+23) then
                                    tmp = t_0
                                else if (x <= 1.9d+178) then
                                    tmp = (((1.0d0 / eps) + 1.0d0) - ((1.0d0 - eps) / eps)) / 2.0d0
                                else
                                    tmp = t_0
                                end if
                                code = tmp
                            end function
                            
                            public static double code(double x, double eps) {
                            	double t_0 = (Math.exp((eps * x)) - -1.0) * 0.5;
                            	double tmp;
                            	if (x <= -2e-289) {
                            		tmp = (1.0 - -Math.exp(-(eps * x))) * 0.5;
                            	} else if (x <= 7e+23) {
                            		tmp = t_0;
                            	} else if (x <= 1.9e+178) {
                            		tmp = (((1.0 / eps) + 1.0) - ((1.0 - eps) / eps)) / 2.0;
                            	} else {
                            		tmp = t_0;
                            	}
                            	return tmp;
                            }
                            
                            def code(x, eps):
                            	t_0 = (math.exp((eps * x)) - -1.0) * 0.5
                            	tmp = 0
                            	if x <= -2e-289:
                            		tmp = (1.0 - -math.exp(-(eps * x))) * 0.5
                            	elif x <= 7e+23:
                            		tmp = t_0
                            	elif x <= 1.9e+178:
                            		tmp = (((1.0 / eps) + 1.0) - ((1.0 - eps) / eps)) / 2.0
                            	else:
                            		tmp = t_0
                            	return tmp
                            
                            function code(x, eps)
                            	t_0 = Float64(Float64(exp(Float64(eps * x)) - -1.0) * 0.5)
                            	tmp = 0.0
                            	if (x <= -2e-289)
                            		tmp = Float64(Float64(1.0 - Float64(-exp(Float64(-Float64(eps * x))))) * 0.5);
                            	elseif (x <= 7e+23)
                            		tmp = t_0;
                            	elseif (x <= 1.9e+178)
                            		tmp = Float64(Float64(Float64(Float64(1.0 / eps) + 1.0) - Float64(Float64(1.0 - eps) / eps)) / 2.0);
                            	else
                            		tmp = t_0;
                            	end
                            	return tmp
                            end
                            
                            function tmp_2 = code(x, eps)
                            	t_0 = (exp((eps * x)) - -1.0) * 0.5;
                            	tmp = 0.0;
                            	if (x <= -2e-289)
                            		tmp = (1.0 - -exp(-(eps * x))) * 0.5;
                            	elseif (x <= 7e+23)
                            		tmp = t_0;
                            	elseif (x <= 1.9e+178)
                            		tmp = (((1.0 / eps) + 1.0) - ((1.0 - eps) / eps)) / 2.0;
                            	else
                            		tmp = t_0;
                            	end
                            	tmp_2 = tmp;
                            end
                            
                            code[x_, eps_] := Block[{t$95$0 = N[(N[(N[Exp[N[(eps * x), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[x, -2e-289], N[(N[(1.0 - (-N[Exp[(-N[(eps * x), $MachinePrecision])], $MachinePrecision])), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 7e+23], t$95$0, If[LessEqual[x, 1.9e+178], N[(N[(N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision] - N[(N[(1.0 - eps), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], t$95$0]]]]
                            
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            t_0 := \left(e^{\varepsilon \cdot x} - -1\right) \cdot 0.5\\
                            \mathbf{if}\;x \leq -2 \cdot 10^{-289}:\\
                            \;\;\;\;\left(1 - \left(-e^{-\varepsilon \cdot x}\right)\right) \cdot 0.5\\
                            
                            \mathbf{elif}\;x \leq 7 \cdot 10^{+23}:\\
                            \;\;\;\;t\_0\\
                            
                            \mathbf{elif}\;x \leq 1.9 \cdot 10^{+178}:\\
                            \;\;\;\;\frac{\left(\frac{1}{\varepsilon} + 1\right) - \frac{1 - \varepsilon}{\varepsilon}}{2}\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;t\_0\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 3 regimes
                            2. if x < -2e-289

                              1. Initial program 69.8%

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

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

                                \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
                              4. 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} \]
                              5. Step-by-step derivation
                                1. Applied rewrites98.9%

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

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

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

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

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

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

                                  if -2e-289 < x < 7.0000000000000004e23 or 1.89999999999999999e178 < x

                                  1. Initial program 66.8%

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

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

                                    \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
                                  4. 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} \]
                                  5. Step-by-step derivation
                                    1. Applied rewrites89.5%

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

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

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

                                      if 7.0000000000000004e23 < x < 1.89999999999999999e178

                                      1. Initial program 100.0%

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

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

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

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

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

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

                                          \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
                                        2. lift--.f6450.4

                                          \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - \color{blue}{1}\right)}{2} \]
                                      7. Applied rewrites50.4%

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

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

                                          \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \frac{1 + \left(\mathsf{neg}\left(\varepsilon\right)\right)}{\varepsilon}}{2} \]
                                        2. negate-subN/A

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

                                          \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \frac{1 - \varepsilon}{\varepsilon}}{2} \]
                                        4. lift--.f6450.4

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

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

                                    Alternative 6: 67.9% accurate, 1.9× speedup?

                                    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(e^{\varepsilon \cdot x} - -1\right) \cdot 0.5\\ \mathbf{if}\;x \leq -2 \cdot 10^{-289}:\\ \;\;\;\;\left(e^{-x} - -1\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 7 \cdot 10^{+23}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 1.9 \cdot 10^{+178}:\\ \;\;\;\;\frac{\left(\frac{1}{\varepsilon} + 1\right) - \frac{1 - \varepsilon}{\varepsilon}}{2}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                    (FPCore (x eps)
                                     :precision binary64
                                     (let* ((t_0 (* (- (exp (* eps x)) -1.0) 0.5)))
                                       (if (<= x -2e-289)
                                         (* (- (exp (- x)) -1.0) 0.5)
                                         (if (<= x 7e+23)
                                           t_0
                                           (if (<= x 1.9e+178)
                                             (/ (- (+ (/ 1.0 eps) 1.0) (/ (- 1.0 eps) eps)) 2.0)
                                             t_0)))))
                                    double code(double x, double eps) {
                                    	double t_0 = (exp((eps * x)) - -1.0) * 0.5;
                                    	double tmp;
                                    	if (x <= -2e-289) {
                                    		tmp = (exp(-x) - -1.0) * 0.5;
                                    	} else if (x <= 7e+23) {
                                    		tmp = t_0;
                                    	} else if (x <= 1.9e+178) {
                                    		tmp = (((1.0 / eps) + 1.0) - ((1.0 - eps) / eps)) / 2.0;
                                    	} else {
                                    		tmp = t_0;
                                    	}
                                    	return tmp;
                                    }
                                    
                                    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
                                        real(8) :: t_0
                                        real(8) :: tmp
                                        t_0 = (exp((eps * x)) - (-1.0d0)) * 0.5d0
                                        if (x <= (-2d-289)) then
                                            tmp = (exp(-x) - (-1.0d0)) * 0.5d0
                                        else if (x <= 7d+23) then
                                            tmp = t_0
                                        else if (x <= 1.9d+178) then
                                            tmp = (((1.0d0 / eps) + 1.0d0) - ((1.0d0 - eps) / eps)) / 2.0d0
                                        else
                                            tmp = t_0
                                        end if
                                        code = tmp
                                    end function
                                    
                                    public static double code(double x, double eps) {
                                    	double t_0 = (Math.exp((eps * x)) - -1.0) * 0.5;
                                    	double tmp;
                                    	if (x <= -2e-289) {
                                    		tmp = (Math.exp(-x) - -1.0) * 0.5;
                                    	} else if (x <= 7e+23) {
                                    		tmp = t_0;
                                    	} else if (x <= 1.9e+178) {
                                    		tmp = (((1.0 / eps) + 1.0) - ((1.0 - eps) / eps)) / 2.0;
                                    	} else {
                                    		tmp = t_0;
                                    	}
                                    	return tmp;
                                    }
                                    
                                    def code(x, eps):
                                    	t_0 = (math.exp((eps * x)) - -1.0) * 0.5
                                    	tmp = 0
                                    	if x <= -2e-289:
                                    		tmp = (math.exp(-x) - -1.0) * 0.5
                                    	elif x <= 7e+23:
                                    		tmp = t_0
                                    	elif x <= 1.9e+178:
                                    		tmp = (((1.0 / eps) + 1.0) - ((1.0 - eps) / eps)) / 2.0
                                    	else:
                                    		tmp = t_0
                                    	return tmp
                                    
                                    function code(x, eps)
                                    	t_0 = Float64(Float64(exp(Float64(eps * x)) - -1.0) * 0.5)
                                    	tmp = 0.0
                                    	if (x <= -2e-289)
                                    		tmp = Float64(Float64(exp(Float64(-x)) - -1.0) * 0.5);
                                    	elseif (x <= 7e+23)
                                    		tmp = t_0;
                                    	elseif (x <= 1.9e+178)
                                    		tmp = Float64(Float64(Float64(Float64(1.0 / eps) + 1.0) - Float64(Float64(1.0 - eps) / eps)) / 2.0);
                                    	else
                                    		tmp = t_0;
                                    	end
                                    	return tmp
                                    end
                                    
                                    function tmp_2 = code(x, eps)
                                    	t_0 = (exp((eps * x)) - -1.0) * 0.5;
                                    	tmp = 0.0;
                                    	if (x <= -2e-289)
                                    		tmp = (exp(-x) - -1.0) * 0.5;
                                    	elseif (x <= 7e+23)
                                    		tmp = t_0;
                                    	elseif (x <= 1.9e+178)
                                    		tmp = (((1.0 / eps) + 1.0) - ((1.0 - eps) / eps)) / 2.0;
                                    	else
                                    		tmp = t_0;
                                    	end
                                    	tmp_2 = tmp;
                                    end
                                    
                                    code[x_, eps_] := Block[{t$95$0 = N[(N[(N[Exp[N[(eps * x), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[x, -2e-289], N[(N[(N[Exp[(-x)], $MachinePrecision] - -1.0), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 7e+23], t$95$0, If[LessEqual[x, 1.9e+178], N[(N[(N[(N[(1.0 / eps), $MachinePrecision] + 1.0), $MachinePrecision] - N[(N[(1.0 - eps), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], t$95$0]]]]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \begin{array}{l}
                                    t_0 := \left(e^{\varepsilon \cdot x} - -1\right) \cdot 0.5\\
                                    \mathbf{if}\;x \leq -2 \cdot 10^{-289}:\\
                                    \;\;\;\;\left(e^{-x} - -1\right) \cdot 0.5\\
                                    
                                    \mathbf{elif}\;x \leq 7 \cdot 10^{+23}:\\
                                    \;\;\;\;t\_0\\
                                    
                                    \mathbf{elif}\;x \leq 1.9 \cdot 10^{+178}:\\
                                    \;\;\;\;\frac{\left(\frac{1}{\varepsilon} + 1\right) - \frac{1 - \varepsilon}{\varepsilon}}{2}\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;t\_0\\
                                    
                                    
                                    \end{array}
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 3 regimes
                                    2. if x < -2e-289

                                      1. Initial program 69.8%

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

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

                                        \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
                                      4. 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} \]
                                      5. Step-by-step derivation
                                        1. Applied rewrites98.9%

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

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

                                            \[\leadsto \left(e^{\varepsilon \cdot x} - -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.f6481.1

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

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

                                          if -2e-289 < x < 7.0000000000000004e23 or 1.89999999999999999e178 < x

                                          1. Initial program 66.8%

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

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

                                            \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
                                          4. 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} \]
                                          5. Step-by-step derivation
                                            1. Applied rewrites89.5%

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

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

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

                                              if 7.0000000000000004e23 < x < 1.89999999999999999e178

                                              1. Initial program 100.0%

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

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

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

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

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

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

                                                  \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
                                                2. lift--.f6450.4

                                                  \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - \color{blue}{1}\right)}{2} \]
                                              7. Applied rewrites50.4%

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

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

                                                  \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \frac{1 + \left(\mathsf{neg}\left(\varepsilon\right)\right)}{\varepsilon}}{2} \]
                                                2. negate-subN/A

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

                                                  \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \frac{1 - \varepsilon}{\varepsilon}}{2} \]
                                                4. lift--.f6450.4

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

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

                                            Alternative 7: 67.5% accurate, 2.2× speedup?

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

                                              1. Initial program 62.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. Applied rewrites98.9%

                                                \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
                                              4. 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} \]
                                              5. Step-by-step derivation
                                                1. Applied rewrites98.9%

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

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

                                                    \[\leadsto \left(e^{\varepsilon \cdot x} - -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.f6479.1

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

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

                                                  if 0.033000000000000002 < x < 1.89999999999999999e178

                                                  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 x around 0

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

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

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

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

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

                                                      \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
                                                    2. lift--.f6448.7

                                                      \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - \color{blue}{1}\right)}{2} \]
                                                  7. Applied rewrites48.7%

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

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

                                                      \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \frac{1 + \left(\mathsf{neg}\left(\varepsilon\right)\right)}{\varepsilon}}{2} \]
                                                    2. negate-subN/A

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

                                                      \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \frac{1 - \varepsilon}{\varepsilon}}{2} \]
                                                    4. lift--.f6448.7

                                                      \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \frac{1 - \varepsilon}{\varepsilon}}{2} \]
                                                  10. Applied rewrites48.7%

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

                                                  if 1.89999999999999999e178 < x

                                                  1. Initial program 100.0%

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

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

                                                    \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
                                                  4. 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)} \]
                                                  5. Step-by-step derivation
                                                    1. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

                                                    \[\leadsto 1 + \color{blue}{{x}^{2} \cdot \left(\frac{1}{3} \cdot x - \frac{1}{2}\right)} \]
                                                  8. 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. negate-subN/A

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

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

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

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

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

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

                                                Alternative 8: 67.5% accurate, 2.4× speedup?

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

                                                  1. Initial program 62.4%

                                                    \[\frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
                                                  2. Taylor expanded in 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. Applied rewrites98.7%

                                                    \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
                                                  4. 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} \]
                                                  5. Step-by-step derivation
                                                    1. Applied rewrites98.7%

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

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

                                                        \[\leadsto \left(e^{\varepsilon \cdot x} - -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 360 < x < 1.89999999999999999e178

                                                      1. Initial program 99.9%

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

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

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

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

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

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

                                                          \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
                                                        2. lift--.f6449.6

                                                          \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - \color{blue}{1}\right)}{2} \]
                                                      7. Applied rewrites49.6%

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

                                                        \[\leadsto \frac{\frac{1}{\color{blue}{\varepsilon}} - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
                                                      9. Step-by-step derivation
                                                        1. lift-/.f6449.6

                                                          \[\leadsto \frac{\frac{1}{\varepsilon} - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
                                                      10. Applied rewrites49.6%

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

                                                      if 1.89999999999999999e178 < x

                                                      1. Initial program 100.0%

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

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

                                                        \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
                                                      4. 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)} \]
                                                      5. Step-by-step derivation
                                                        1. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

                                                        \[\leadsto 1 + \color{blue}{{x}^{2} \cdot \left(\frac{1}{3} \cdot x - \frac{1}{2}\right)} \]
                                                      8. 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. negate-subN/A

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

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

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

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

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

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

                                                    Alternative 9: 60.1% accurate, 2.4× speedup?

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

                                                      1. Initial program 62.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. Applied rewrites98.9%

                                                        \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
                                                      4. 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} \]
                                                      5. Step-by-step derivation
                                                        1. Applied rewrites98.9%

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

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

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

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

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

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

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

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

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

                                                          if 0.033000000000000002 < x < 1.89999999999999999e178

                                                          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 x around 0

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

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

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

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

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

                                                              \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
                                                            2. lift--.f6448.7

                                                              \[\leadsto \frac{\left(\frac{1}{\varepsilon} + 1\right) - \left(\frac{1}{\varepsilon} - \color{blue}{1}\right)}{2} \]
                                                          7. Applied rewrites48.7%

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

                                                            \[\leadsto \frac{\frac{1}{\color{blue}{\varepsilon}} - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
                                                          9. Step-by-step derivation
                                                            1. lift-/.f6448.7

                                                              \[\leadsto \frac{\frac{1}{\varepsilon} - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
                                                          10. Applied rewrites48.7%

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

                                                          if 1.89999999999999999e178 < x

                                                          1. Initial program 100.0%

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

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

                                                            \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
                                                          4. 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)} \]
                                                          5. Step-by-step derivation
                                                            1. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

                                                            \[\leadsto 1 + \color{blue}{{x}^{2} \cdot \left(\frac{1}{3} \cdot x - \frac{1}{2}\right)} \]
                                                          8. 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. negate-subN/A

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

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

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

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

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

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

                                                        Alternative 10: 56.3% accurate, 3.2× speedup?

                                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -360:\\ \;\;\;\;\left(1 - \mathsf{fma}\left(x, 1 + \varepsilon, -1\right)\right) \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right), x \cdot x, 1\right)\\ \end{array} \end{array} \]
                                                        (FPCore (x eps)
                                                         :precision binary64
                                                         (if (<= x -360.0)
                                                           (* (- 1.0 (fma x (+ 1.0 eps) -1.0)) 0.5)
                                                           (fma (fma 0.3333333333333333 x -0.5) (* x x) 1.0)))
                                                        double code(double x, double eps) {
                                                        	double tmp;
                                                        	if (x <= -360.0) {
                                                        		tmp = (1.0 - fma(x, (1.0 + eps), -1.0)) * 0.5;
                                                        	} else {
                                                        		tmp = fma(fma(0.3333333333333333, x, -0.5), (x * x), 1.0);
                                                        	}
                                                        	return tmp;
                                                        }
                                                        
                                                        function code(x, eps)
                                                        	tmp = 0.0
                                                        	if (x <= -360.0)
                                                        		tmp = Float64(Float64(1.0 - fma(x, Float64(1.0 + eps), -1.0)) * 0.5);
                                                        	else
                                                        		tmp = fma(fma(0.3333333333333333, x, -0.5), Float64(x * x), 1.0);
                                                        	end
                                                        	return tmp
                                                        end
                                                        
                                                        code[x_, eps_] := If[LessEqual[x, -360.0], N[(N[(1.0 - N[(x * N[(1.0 + eps), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]]
                                                        
                                                        \begin{array}{l}
                                                        
                                                        \\
                                                        \begin{array}{l}
                                                        \mathbf{if}\;x \leq -360:\\
                                                        \;\;\;\;\left(1 - \mathsf{fma}\left(x, 1 + \varepsilon, -1\right)\right) \cdot 0.5\\
                                                        
                                                        \mathbf{else}:\\
                                                        \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right), x \cdot x, 1\right)\\
                                                        
                                                        
                                                        \end{array}
                                                        \end{array}
                                                        
                                                        Derivation
                                                        1. Split input into 2 regimes
                                                        2. if x < -360

                                                          1. Initial program 99.7%

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

                                                            \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
                                                          4. 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} \]
                                                          5. Step-by-step derivation
                                                            1. Applied rewrites99.7%

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

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

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

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

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

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

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

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

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

                                                              if -360 < x

                                                              1. Initial program 68.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. Applied rewrites98.9%

                                                                \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
                                                              4. 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)} \]
                                                              5. Step-by-step derivation
                                                                1. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

                                                                \[\leadsto 1 + \color{blue}{{x}^{2} \cdot \left(\frac{1}{3} \cdot x - \frac{1}{2}\right)} \]
                                                              8. 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. negate-subN/A

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

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

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

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

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

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

                                                            Alternative 11: 52.4% accurate, 4.2× speedup?

                                                            \[\begin{array}{l} \\ \mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right), x \cdot x, 1\right) \end{array} \]
                                                            (FPCore (x eps)
                                                             :precision binary64
                                                             (fma (fma 0.3333333333333333 x -0.5) (* x x) 1.0))
                                                            double code(double x, double eps) {
                                                            	return fma(fma(0.3333333333333333, x, -0.5), (x * x), 1.0);
                                                            }
                                                            
                                                            function code(x, eps)
                                                            	return fma(fma(0.3333333333333333, x, -0.5), Float64(x * x), 1.0)
                                                            end
                                                            
                                                            code[x_, eps_] := N[(N[(0.3333333333333333 * x + -0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]
                                                            
                                                            \begin{array}{l}
                                                            
                                                            \\
                                                            \mathsf{fma}\left(\mathsf{fma}\left(0.3333333333333333, x, -0.5\right), x \cdot x, 1\right)
                                                            \end{array}
                                                            
                                                            Derivation
                                                            1. Initial program 73.0%

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

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

                                                              \[\leadsto \color{blue}{\left(e^{\left(\varepsilon - 1\right) \cdot x} - \left(-e^{-\mathsf{fma}\left(x, \varepsilon, x\right)}\right)\right) \cdot 0.5} \]
                                                            4. 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)} \]
                                                            5. Step-by-step derivation
                                                              1. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

                                                              \[\leadsto 1 + \color{blue}{{x}^{2} \cdot \left(\frac{1}{3} \cdot x - \frac{1}{2}\right)} \]
                                                            8. 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. negate-subN/A

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

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

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

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

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

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

                                                            Alternative 12: 43.9% accurate, 58.4× speedup?

                                                            \[\begin{array}{l} \\ 1 \end{array} \]
                                                            (FPCore (x eps) :precision binary64 1.0)
                                                            double code(double x, double eps) {
                                                            	return 1.0;
                                                            }
                                                            
                                                            module fmin_fmax_functions
                                                                implicit none
                                                                private
                                                                public fmax
                                                                public fmin
                                                            
                                                                interface fmax
                                                                    module procedure fmax88
                                                                    module procedure fmax44
                                                                    module procedure fmax84
                                                                    module procedure fmax48
                                                                end interface
                                                                interface fmin
                                                                    module procedure fmin88
                                                                    module procedure fmin44
                                                                    module procedure fmin84
                                                                    module procedure fmin48
                                                                end interface
                                                            contains
                                                                real(8) function fmax88(x, y) result (res)
                                                                    real(8), intent (in) :: x
                                                                    real(8), intent (in) :: y
                                                                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                end function
                                                                real(4) function fmax44(x, y) result (res)
                                                                    real(4), intent (in) :: x
                                                                    real(4), intent (in) :: y
                                                                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                end function
                                                                real(8) function fmax84(x, y) result(res)
                                                                    real(8), intent (in) :: x
                                                                    real(4), intent (in) :: y
                                                                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                end function
                                                                real(8) function fmax48(x, y) result(res)
                                                                    real(4), intent (in) :: x
                                                                    real(8), intent (in) :: y
                                                                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                end function
                                                                real(8) function fmin88(x, y) result (res)
                                                                    real(8), intent (in) :: x
                                                                    real(8), intent (in) :: y
                                                                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                end function
                                                                real(4) function fmin44(x, y) result (res)
                                                                    real(4), intent (in) :: x
                                                                    real(4), intent (in) :: y
                                                                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                end function
                                                                real(8) function fmin84(x, y) result(res)
                                                                    real(8), intent (in) :: x
                                                                    real(4), intent (in) :: y
                                                                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                end function
                                                                real(8) function fmin48(x, y) result(res)
                                                                    real(4), intent (in) :: x
                                                                    real(8), intent (in) :: y
                                                                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                end function
                                                            end module
                                                            
                                                            real(8) function code(x, eps)
                                                            use fmin_fmax_functions
                                                                real(8), intent (in) :: x
                                                                real(8), intent (in) :: eps
                                                                code = 1.0d0
                                                            end function
                                                            
                                                            public static double code(double x, double eps) {
                                                            	return 1.0;
                                                            }
                                                            
                                                            def code(x, eps):
                                                            	return 1.0
                                                            
                                                            function code(x, eps)
                                                            	return 1.0
                                                            end
                                                            
                                                            function tmp = code(x, eps)
                                                            	tmp = 1.0;
                                                            end
                                                            
                                                            code[x_, eps_] := 1.0
                                                            
                                                            \begin{array}{l}
                                                            
                                                            \\
                                                            1
                                                            \end{array}
                                                            
                                                            Derivation
                                                            1. Initial program 73.0%

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

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

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

                                                              Reproduce

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