NMSE Section 6.1 mentioned, A

Percentage Accurate: 72.8% → 99.7%
Time: 10.2s
Alternatives: 13
Speedup: 0.3×

Specification

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

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

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 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: 72.8% 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.7% accurate, 0.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot e^{x \cdot \varepsilon - x} - \frac{-1}{e^{\mathsf{fma}\left(x, \varepsilon, x\right)}}}{2}\\


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

    1. Initial program 57.2%

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

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

        \[\leadsto \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) \cdot \frac{1}{2}} \]
    5. Applied rewrites100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(e^{-x}, \left(1 + x\right) - -1, \frac{x}{e^{x}}\right) \cdot 0.5} \]
    6. Step-by-step derivation
      1. Applied rewrites100.0%

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

      if 1 < (/.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.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot \color{blue}{e^{x \cdot \varepsilon - x}} - \frac{-1}{e^{\mathsf{fma}\left(x, \varepsilon, x\right)}}}{2} \]
    7. Recombined 2 regimes into one program.
    8. Final simplification99.6%

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

    Alternative 2: 78.7% accurate, 0.3× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left({\varepsilon}^{-1} - 1\right) \cdot e^{\left(-1 - \varepsilon\right) \cdot x}\\ \mathbf{if}\;\frac{\left(1 + {\varepsilon}^{-1}\right) \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - t\_0}{2} \leq 1.2:\\ \;\;\;\;\mathsf{fma}\left(x + 2, e^{-x}, \frac{x}{e^{x}}\right) \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\frac{\left({\varepsilon}^{-1} + 1\right) - t\_0}{2}\\ \end{array} \end{array} \]
    (FPCore (x eps)
     :precision binary64
     (let* ((t_0 (* (- (pow eps -1.0) 1.0) (exp (* (- -1.0 eps) x)))))
       (if (<=
            (/ (- (* (+ 1.0 (pow eps -1.0)) (exp (* (+ -1.0 eps) x))) t_0) 2.0)
            1.2)
         (* (fma (+ x 2.0) (exp (- x)) (/ x (exp x))) 0.5)
         (/ (- (+ (pow eps -1.0) 1.0) t_0) 2.0))))
    double code(double x, double eps) {
    	double t_0 = (pow(eps, -1.0) - 1.0) * exp(((-1.0 - eps) * x));
    	double tmp;
    	if (((((1.0 + pow(eps, -1.0)) * exp(((-1.0 + eps) * x))) - t_0) / 2.0) <= 1.2) {
    		tmp = fma((x + 2.0), exp(-x), (x / exp(x))) * 0.5;
    	} else {
    		tmp = ((pow(eps, -1.0) + 1.0) - t_0) / 2.0;
    	}
    	return tmp;
    }
    
    function code(x, eps)
    	t_0 = Float64(Float64((eps ^ -1.0) - 1.0) * exp(Float64(Float64(-1.0 - eps) * x)))
    	tmp = 0.0
    	if (Float64(Float64(Float64(Float64(1.0 + (eps ^ -1.0)) * exp(Float64(Float64(-1.0 + eps) * x))) - t_0) / 2.0) <= 1.2)
    		tmp = Float64(fma(Float64(x + 2.0), exp(Float64(-x)), Float64(x / exp(x))) * 0.5);
    	else
    		tmp = Float64(Float64(Float64((eps ^ -1.0) + 1.0) - t_0) / 2.0);
    	end
    	return tmp
    end
    
    code[x_, eps_] := Block[{t$95$0 = N[(N[(N[Power[eps, -1.0], $MachinePrecision] - 1.0), $MachinePrecision] * N[Exp[N[(N[(-1.0 - eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(1.0 + N[Power[eps, -1.0], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(-1.0 + eps), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], 1.2], N[(N[(N[(x + 2.0), $MachinePrecision] * N[Exp[(-x)], $MachinePrecision] + N[(x / N[Exp[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(N[Power[eps, -1.0], $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision] / 2.0), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \left({\varepsilon}^{-1} - 1\right) \cdot e^{\left(-1 - \varepsilon\right) \cdot x}\\
    \mathbf{if}\;\frac{\left(1 + {\varepsilon}^{-1}\right) \cdot e^{\left(-1 + \varepsilon\right) \cdot x} - t\_0}{2} \leq 1.2:\\
    \;\;\;\;\mathsf{fma}\left(x + 2, e^{-x}, \frac{x}{e^{x}}\right) \cdot 0.5\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\left({\varepsilon}^{-1} + 1\right) - t\_0}{2}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (/.f64 (-.f64 (*.f64 (+.f64 #s(literal 1 binary64) (/.f64 #s(literal 1 binary64) eps)) (exp.f64 (neg.f64 (*.f64 (-.f64 #s(literal 1 binary64) eps) x)))) (*.f64 (-.f64 (/.f64 #s(literal 1 binary64) eps) #s(literal 1 binary64)) (exp.f64 (neg.f64 (*.f64 (+.f64 #s(literal 1 binary64) eps) x))))) #s(literal 2 binary64)) < 1.19999999999999996

      1. Initial program 57.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. Add Preprocessing
      3. 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)} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

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

          \[\leadsto \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) \cdot \frac{1}{2}} \]
      5. Applied rewrites99.4%

        \[\leadsto \color{blue}{\mathsf{fma}\left(e^{-x}, \left(1 + x\right) - -1, \frac{x}{e^{x}}\right) \cdot 0.5} \]
      6. Step-by-step derivation
        1. Applied rewrites99.4%

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

        if 1.19999999999999996 < (/.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.1%

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

            \[\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} \]
          2. lower-+.f64N/A

            \[\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} \]
          3. lower-/.f6462.8

            \[\leadsto \frac{\left(\color{blue}{\frac{1}{\varepsilon}} + 1\right) - \left(\frac{1}{\varepsilon} - 1\right) \cdot e^{-\left(1 + \varepsilon\right) \cdot x}}{2} \]
        5. Applied rewrites62.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} \]
      7. Recombined 2 regimes into one program.
      8. Final simplification83.8%

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

      Alternative 3: 64.4% accurate, 0.8× speedup?

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

        1. Initial program 97.4%

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

            \[\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} \]
          2. lower-+.f64N/A

            \[\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} \]
          3. lower-/.f6469.4

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

          \[\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} \]

        if -0.10000000000000001 < x < 1.44999999999999996

        1. Initial program 53.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. Add Preprocessing
        3. 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)} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

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

            \[\leadsto \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) \cdot \frac{1}{2}} \]
        5. Applied rewrites73.1%

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

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

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

          if 1.44999999999999996 < x < 4.0000000000000003e243

          1. Initial program 98.5%

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

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

              \[\leadsto \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) \cdot \frac{1}{2}} \]
          5. Applied rewrites68.7%

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

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

              \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]

            if 4.0000000000000003e243 < x

            1. Initial program 100.0%

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

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

                \[\leadsto \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) \cdot \frac{1}{2}} \]
            5. Applied rewrites31.1%

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

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

                \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]
              2. Taylor expanded in x around 0

                \[\leadsto x \cdot \left(1 + \color{blue}{x \cdot \left(\frac{1}{2} \cdot x - 1\right)}\right) \]
              3. Step-by-step derivation
                1. Applied rewrites70.5%

                  \[\leadsto \mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x \]
              4. Recombined 4 regimes into one program.
              5. Final simplification70.9%

                \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.1:\\ \;\;\;\;\frac{\left({\varepsilon}^{-1} + 1\right) - \left({\varepsilon}^{-1} - 1\right) \cdot e^{\left(-1 - \varepsilon\right) \cdot x}}{2}\\ \mathbf{elif}\;x \leq 1.45:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333 \cdot x - 0.5, x \cdot x, 1\right)\\ \mathbf{elif}\;x \leq 4 \cdot 10^{+243}:\\ \;\;\;\;\frac{x}{e^{x}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x\\ \end{array} \]
              6. Add Preprocessing

              Alternative 4: 60.3% accurate, 1.1× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := {\varepsilon}^{-1} - 1\\ \mathbf{if}\;x \leq -195:\\ \;\;\;\;\frac{{\varepsilon}^{-1} - t\_0 \cdot \mathsf{fma}\left(-1 - \varepsilon, x, 1\right)}{2}\\ \mathbf{elif}\;x \leq 370:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333 \cdot x - 0.5, x \cdot x, 1\right)\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{+252}:\\ \;\;\;\;\frac{\left({\varepsilon}^{-1} + 1\right) - t\_0}{2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x\\ \end{array} \end{array} \]
              (FPCore (x eps)
               :precision binary64
               (let* ((t_0 (- (pow eps -1.0) 1.0)))
                 (if (<= x -195.0)
                   (/ (- (pow eps -1.0) (* t_0 (fma (- -1.0 eps) x 1.0))) 2.0)
                   (if (<= x 370.0)
                     (fma (- (* 0.3333333333333333 x) 0.5) (* x x) 1.0)
                     (if (<= x 3.6e+252)
                       (/ (- (+ (pow eps -1.0) 1.0) t_0) 2.0)
                       (* (fma (- (* 0.5 x) 1.0) x 1.0) x))))))
              double code(double x, double eps) {
              	double t_0 = pow(eps, -1.0) - 1.0;
              	double tmp;
              	if (x <= -195.0) {
              		tmp = (pow(eps, -1.0) - (t_0 * fma((-1.0 - eps), x, 1.0))) / 2.0;
              	} else if (x <= 370.0) {
              		tmp = fma(((0.3333333333333333 * x) - 0.5), (x * x), 1.0);
              	} else if (x <= 3.6e+252) {
              		tmp = ((pow(eps, -1.0) + 1.0) - t_0) / 2.0;
              	} else {
              		tmp = fma(((0.5 * x) - 1.0), x, 1.0) * x;
              	}
              	return tmp;
              }
              
              function code(x, eps)
              	t_0 = Float64((eps ^ -1.0) - 1.0)
              	tmp = 0.0
              	if (x <= -195.0)
              		tmp = Float64(Float64((eps ^ -1.0) - Float64(t_0 * fma(Float64(-1.0 - eps), x, 1.0))) / 2.0);
              	elseif (x <= 370.0)
              		tmp = fma(Float64(Float64(0.3333333333333333 * x) - 0.5), Float64(x * x), 1.0);
              	elseif (x <= 3.6e+252)
              		tmp = Float64(Float64(Float64((eps ^ -1.0) + 1.0) - t_0) / 2.0);
              	else
              		tmp = Float64(fma(Float64(Float64(0.5 * x) - 1.0), x, 1.0) * x);
              	end
              	return tmp
              end
              
              code[x_, eps_] := Block[{t$95$0 = N[(N[Power[eps, -1.0], $MachinePrecision] - 1.0), $MachinePrecision]}, If[LessEqual[x, -195.0], N[(N[(N[Power[eps, -1.0], $MachinePrecision] - N[(t$95$0 * N[(N[(-1.0 - eps), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision], If[LessEqual[x, 370.0], N[(N[(N[(0.3333333333333333 * x), $MachinePrecision] - 0.5), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[x, 3.6e+252], N[(N[(N[(N[Power[eps, -1.0], $MachinePrecision] + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision] / 2.0), $MachinePrecision], N[(N[(N[(N[(0.5 * x), $MachinePrecision] - 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision] * x), $MachinePrecision]]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := {\varepsilon}^{-1} - 1\\
              \mathbf{if}\;x \leq -195:\\
              \;\;\;\;\frac{{\varepsilon}^{-1} - t\_0 \cdot \mathsf{fma}\left(-1 - \varepsilon, x, 1\right)}{2}\\
              
              \mathbf{elif}\;x \leq 370:\\
              \;\;\;\;\mathsf{fma}\left(0.3333333333333333 \cdot x - 0.5, x \cdot x, 1\right)\\
              
              \mathbf{elif}\;x \leq 3.6 \cdot 10^{+252}:\\
              \;\;\;\;\frac{\left({\varepsilon}^{-1} + 1\right) - t\_0}{2}\\
              
              \mathbf{else}:\\
              \;\;\;\;\mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 4 regimes
              2. if x < -195

                1. Initial program 97.4%

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

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot \mathsf{fma}\left(\color{blue}{-1} + -1 \cdot \varepsilon, x, 1\right)}{2} \]
                  9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  if -195 < x < 370

                  1. Initial program 53.4%

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

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

                      \[\leadsto \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) \cdot \frac{1}{2}} \]
                  5. Applied rewrites73.3%

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

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

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

                    if 370 < x < 3.5999999999999999e252

                    1. Initial program 100.0%

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

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

                        \[\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} \]
                      2. lower-+.f64N/A

                        \[\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} \]
                      3. lower-/.f6421.3

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

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

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

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

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

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

                    if 3.5999999999999999e252 < x

                    1. Initial program 100.0%

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

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

                        \[\leadsto \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) \cdot \frac{1}{2}} \]
                    5. Applied rewrites28.9%

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

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

                        \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]
                      2. Taylor expanded in x around 0

                        \[\leadsto x \cdot \left(1 + \color{blue}{x \cdot \left(\frac{1}{2} \cdot x - 1\right)}\right) \]
                      3. Step-by-step derivation
                        1. Applied rewrites72.7%

                          \[\leadsto \mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x \]
                      4. Recombined 4 regimes into one program.
                      5. Final simplification65.3%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -195:\\ \;\;\;\;\frac{{\varepsilon}^{-1} - \left({\varepsilon}^{-1} - 1\right) \cdot \mathsf{fma}\left(-1 - \varepsilon, x, 1\right)}{2}\\ \mathbf{elif}\;x \leq 370:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333 \cdot x - 0.5, x \cdot x, 1\right)\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{+252}:\\ \;\;\;\;\frac{\left({\varepsilon}^{-1} + 1\right) - \left({\varepsilon}^{-1} - 1\right)}{2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x\\ \end{array} \]
                      6. Add Preprocessing

                      Alternative 5: 60.7% accurate, 1.1× speedup?

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

                        1. Initial program 97.4%

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

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

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

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

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

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

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

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

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

                            \[\leadsto \frac{\left(1 + \frac{1}{\varepsilon}\right) \cdot e^{-\left(1 - \varepsilon\right) \cdot x} - \left(\frac{1}{\varepsilon} - 1\right) \cdot \mathsf{fma}\left(\color{blue}{-1} + -1 \cdot \varepsilon, x, 1\right)}{2} \]
                          9. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          if -195 < x < 1.44999999999999996

                          1. Initial program 53.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. Add Preprocessing
                          3. 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)} \]
                          4. Step-by-step derivation
                            1. *-commutativeN/A

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

                              \[\leadsto \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) \cdot \frac{1}{2}} \]
                          5. Applied rewrites73.1%

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

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

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

                            if 1.44999999999999996 < x < 4.0000000000000003e243

                            1. Initial program 98.5%

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

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

                                \[\leadsto \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) \cdot \frac{1}{2}} \]
                            5. Applied rewrites68.7%

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

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

                                \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]

                              if 4.0000000000000003e243 < x

                              1. Initial program 100.0%

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

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

                                  \[\leadsto \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) \cdot \frac{1}{2}} \]
                              5. Applied rewrites31.1%

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

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

                                  \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]
                                2. Taylor expanded in x around 0

                                  \[\leadsto x \cdot \left(1 + \color{blue}{x \cdot \left(\frac{1}{2} \cdot x - 1\right)}\right) \]
                                3. Step-by-step derivation
                                  1. Applied rewrites70.5%

                                    \[\leadsto \mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x \]
                                4. Recombined 4 regimes into one program.
                                5. Final simplification66.4%

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -195:\\ \;\;\;\;\frac{{\varepsilon}^{-1} - \left({\varepsilon}^{-1} - 1\right) \cdot \mathsf{fma}\left(-1 - \varepsilon, x, 1\right)}{2}\\ \mathbf{elif}\;x \leq 1.45:\\ \;\;\;\;\mathsf{fma}\left(0.3333333333333333 \cdot x - 0.5, x \cdot x, 1\right)\\ \mathbf{elif}\;x \leq 4 \cdot 10^{+243}:\\ \;\;\;\;\frac{x}{e^{x}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x\\ \end{array} \]
                                6. Add Preprocessing

                                Alternative 6: 64.1% accurate, 1.1× speedup?

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

                                  1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \frac{\color{blue}{\frac{1 + \varepsilon}{\varepsilon}} - \frac{-1}{e^{\mathsf{fma}\left(x, \varepsilon, x\right)}}}{2} \]
                                    5. lower-+.f6468.6

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

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

                                    \[\leadsto \frac{\frac{1}{\color{blue}{\varepsilon}} - \frac{-1}{e^{\mathsf{fma}\left(x, \varepsilon, x\right)}}}{2} \]
                                  10. Step-by-step derivation
                                    1. Applied rewrites67.9%

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

                                    if -1.65e7 < x < 1.5

                                    1. Initial program 53.4%

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

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

                                        \[\leadsto \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) \cdot \frac{1}{2}} \]
                                    5. Applied rewrites73.3%

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

                                      \[\leadsto 1 + \color{blue}{{x}^{2} \cdot \left(x \cdot \left(\frac{1}{3} + \frac{-1}{8} \cdot x\right) - \frac{1}{2}\right)} \]
                                    7. Step-by-step derivation
                                      1. Applied rewrites72.5%

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

                                      if 1.5 < x < 4.0000000000000003e243

                                      1. Initial program 98.5%

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

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

                                          \[\leadsto \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) \cdot \frac{1}{2}} \]
                                      5. Applied rewrites68.7%

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

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

                                          \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]

                                        if 4.0000000000000003e243 < x

                                        1. Initial program 100.0%

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

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

                                            \[\leadsto \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) \cdot \frac{1}{2}} \]
                                        5. Applied rewrites31.1%

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

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

                                            \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]
                                          2. Taylor expanded in x around 0

                                            \[\leadsto x \cdot \left(1 + \color{blue}{x \cdot \left(\frac{1}{2} \cdot x - 1\right)}\right) \]
                                          3. Step-by-step derivation
                                            1. Applied rewrites70.5%

                                              \[\leadsto \mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x \]
                                          4. Recombined 4 regimes into one program.
                                          5. Final simplification70.4%

                                            \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -16500000:\\ \;\;\;\;\frac{{\varepsilon}^{-1} - \frac{-1}{e^{\mathsf{fma}\left(x, \varepsilon, x\right)}}}{2}\\ \mathbf{elif}\;x \leq 1.5:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.125, x, 0.3333333333333333\right) \cdot x - 0.5, x \cdot x, 1\right)\\ \mathbf{elif}\;x \leq 4 \cdot 10^{+243}:\\ \;\;\;\;\frac{x}{e^{x}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x\\ \end{array} \]
                                          6. Add Preprocessing

                                          Alternative 7: 57.2% accurate, 1.2× speedup?

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

                                            1. Initial program 63.2%

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

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

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

                                              if 350 < x < 3.5999999999999999e252

                                              1. Initial program 100.0%

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

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

                                                  \[\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} \]
                                                2. lower-+.f64N/A

                                                  \[\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} \]
                                                3. lower-/.f6421.3

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

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

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

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

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

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

                                              if 3.5999999999999999e252 < x

                                              1. Initial program 100.0%

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

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

                                                  \[\leadsto \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) \cdot \frac{1}{2}} \]
                                              5. Applied rewrites28.9%

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

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

                                                  \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]
                                                2. Taylor expanded in x around 0

                                                  \[\leadsto x \cdot \left(1 + \color{blue}{x \cdot \left(\frac{1}{2} \cdot x - 1\right)}\right) \]
                                                3. Step-by-step derivation
                                                  1. Applied rewrites72.7%

                                                    \[\leadsto \mathsf{fma}\left(0.5 \cdot x - 1, x, 1\right) \cdot x \]
                                                4. Recombined 3 regimes into one program.
                                                5. Final simplification59.8%

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

                                                Alternative 8: 64.2% accurate, 1.8× speedup?

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

                                                  1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                      \[\leadsto \frac{\color{blue}{\frac{1 + \varepsilon}{\varepsilon}} - \frac{-1}{e^{\mathsf{fma}\left(x, \varepsilon, x\right)}}}{2} \]
                                                    5. lower-+.f6468.6

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

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

                                                  if -1.65e7 < x < 1.5

                                                  1. Initial program 53.4%

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

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

                                                      \[\leadsto \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) \cdot \frac{1}{2}} \]
                                                  5. Applied rewrites73.3%

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

                                                    \[\leadsto 1 + \color{blue}{{x}^{2} \cdot \left(x \cdot \left(\frac{1}{3} + \frac{-1}{8} \cdot x\right) - \frac{1}{2}\right)} \]
                                                  7. Step-by-step derivation
                                                    1. Applied rewrites72.5%

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

                                                    if 1.5 < x < 4.0000000000000003e243

                                                    1. Initial program 98.5%

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

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

                                                        \[\leadsto \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) \cdot \frac{1}{2}} \]
                                                    5. Applied rewrites68.7%

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

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

                                                        \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]

                                                      if 4.0000000000000003e243 < x

                                                      1. Initial program 100.0%

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

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

                                                          \[\leadsto \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) \cdot \frac{1}{2}} \]
                                                      5. Applied rewrites31.1%

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

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

                                                          \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]
                                                        2. Taylor expanded in x around 0

                                                          \[\leadsto x \cdot \left(1 + \color{blue}{x \cdot \left(\frac{1}{2} \cdot x - 1\right)}\right) \]
                                                        3. Step-by-step derivation
                                                          1. Applied rewrites70.5%

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

                                                        Alternative 9: 53.1% accurate, 6.5× speedup?

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

                                                          1. Initial program 68.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. Add Preprocessing
                                                          3. 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)} \]
                                                          4. Step-by-step derivation
                                                            1. *-commutativeN/A

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

                                                              \[\leadsto \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) \cdot \frac{1}{2}} \]
                                                          5. Applied rewrites58.7%

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

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

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

                                                            if 4.0000000000000002e142 < x < 4.9999999999999997e252

                                                            1. Initial program 100.0%

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

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

                                                                \[\leadsto \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) \cdot \frac{1}{2}} \]
                                                            5. Applied rewrites69.9%

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

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

                                                                \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]
                                                              2. Taylor expanded in x around 0

                                                                \[\leadsto \frac{x}{1 + x \cdot \color{blue}{\left(1 + x \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot x\right)\right)}} \]
                                                              3. Step-by-step derivation
                                                                1. Applied rewrites69.9%

                                                                  \[\leadsto \frac{x}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right), x, 1\right), x, 1\right)} \]

                                                                if 4.9999999999999997e252 < x

                                                                1. Initial program 100.0%

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

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

                                                                    \[\leadsto \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) \cdot \frac{1}{2}} \]
                                                                5. Applied rewrites28.9%

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

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

                                                                    \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]
                                                                  2. Taylor expanded in x around 0

                                                                    \[\leadsto x \cdot \left(1 + \color{blue}{x \cdot \left(\frac{1}{2} \cdot x - 1\right)}\right) \]
                                                                  3. Step-by-step derivation
                                                                    1. Applied rewrites72.7%

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

                                                                  Alternative 10: 52.9% accurate, 7.6× speedup?

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

                                                                    1. Initial program 69.3%

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

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

                                                                        \[\leadsto \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) \cdot \frac{1}{2}} \]
                                                                    5. Applied rewrites58.8%

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

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

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

                                                                      if 4.89999999999999969e166 < x < 4.9999999999999997e252

                                                                      1. Initial program 100.0%

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

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

                                                                          \[\leadsto \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) \cdot \frac{1}{2}} \]
                                                                      5. Applied rewrites70.2%

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

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

                                                                          \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]
                                                                        2. Taylor expanded in x around 0

                                                                          \[\leadsto \frac{x}{1 + x \cdot \color{blue}{\left(1 + \frac{1}{2} \cdot x\right)}} \]
                                                                        3. Step-by-step derivation
                                                                          1. Applied rewrites70.2%

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

                                                                          if 4.9999999999999997e252 < x

                                                                          1. Initial program 100.0%

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

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

                                                                              \[\leadsto \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) \cdot \frac{1}{2}} \]
                                                                          5. Applied rewrites28.9%

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

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

                                                                              \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]
                                                                            2. Taylor expanded in x around 0

                                                                              \[\leadsto x \cdot \left(1 + \color{blue}{x \cdot \left(\frac{1}{2} \cdot x - 1\right)}\right) \]
                                                                            3. Step-by-step derivation
                                                                              1. Applied rewrites72.7%

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

                                                                            Alternative 11: 52.7% accurate, 10.5× speedup?

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

                                                                              1. Initial program 68.2%

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

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

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

                                                                                if 3.5500000000000001e114 < x

                                                                                1. Initial program 100.0%

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

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

                                                                                    \[\leadsto \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) \cdot \frac{1}{2}} \]
                                                                                5. Applied rewrites52.5%

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

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

                                                                                    \[\leadsto \frac{x}{\color{blue}{e^{x}}} \]
                                                                                  2. Taylor expanded in x around 0

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

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

                                                                                  Alternative 12: 52.9% accurate, 13.7× speedup?

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

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

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

                                                                                      \[\leadsto \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) \cdot \frac{1}{2}} \]
                                                                                  5. Applied rewrites58.2%

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

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

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

                                                                                    Alternative 13: 43.5% accurate, 273.0× 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 75.4%

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

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

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

                                                                                      Reproduce

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