NMSE Section 6.1 mentioned, A

Percentage Accurate: 73.8% → 99.0%
Time: 5.7s
Alternatives: 12
Speedup: 1.6×

Specification

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

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

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

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

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 73.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.0% accurate, 1.5× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 88.8% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \left(e^{-\varepsilon \cdot x} + e^{\left(\varepsilon - 1\right) \cdot x}\right) \cdot 0.5 \end{array} \]
(FPCore (x eps)
 :precision binary64
 (* (+ (exp (- (* eps x))) (exp (* (- eps 1.0) x))) 0.5))
double code(double x, double eps) {
	return (exp(-(eps * x)) + exp(((eps - 1.0) * x))) * 0.5;
}
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 = (exp(-(eps * x)) + exp(((eps - 1.0d0) * x))) * 0.5d0
end function
public static double code(double x, double eps) {
	return (Math.exp(-(eps * x)) + Math.exp(((eps - 1.0) * x))) * 0.5;
}
def code(x, eps):
	return (math.exp(-(eps * x)) + math.exp(((eps - 1.0) * x))) * 0.5
function code(x, eps)
	return Float64(Float64(exp(Float64(-Float64(eps * x))) + exp(Float64(Float64(eps - 1.0) * x))) * 0.5)
end
function tmp = code(x, eps)
	tmp = (exp(-(eps * x)) + exp(((eps - 1.0) * x))) * 0.5;
end
code[x_, eps_] := N[(N[(N[Exp[(-N[(eps * x), $MachinePrecision])], $MachinePrecision] + N[Exp[N[(N[(eps - 1.0), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]
\begin{array}{l}

\\
\left(e^{-\varepsilon \cdot x} + e^{\left(\varepsilon - 1\right) \cdot x}\right) \cdot 0.5
\end{array}
Derivation
  1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 64.9% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{+17}:\\ \;\;\;\;\left(\frac{e^{-x}}{\varepsilon} - \left(\frac{1}{\varepsilon} - 1\right)\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 4 \cdot 10^{-265}:\\ \;\;\;\;\left(e^{-\varepsilon \cdot x} + \left(1 + x \cdot \left(\varepsilon - 1\right)\right)\right) \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1\right)\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (if (<= x -2e+17)
   (* (- (/ (exp (- x)) eps) (- (/ 1.0 eps) 1.0)) 0.5)
   (if (<= x 4e-265)
     (* (+ (exp (- (* eps x))) (+ 1.0 (* x (- eps 1.0)))) 0.5)
     (* 0.5 (- (exp (- (* x (- 1.0 eps)))) -1.0)))))
double code(double x, double eps) {
	double tmp;
	if (x <= -2e+17) {
		tmp = ((exp(-x) / eps) - ((1.0 / eps) - 1.0)) * 0.5;
	} else if (x <= 4e-265) {
		tmp = (exp(-(eps * x)) + (1.0 + (x * (eps - 1.0)))) * 0.5;
	} else {
		tmp = 0.5 * (exp(-(x * (1.0 - eps))) - -1.0);
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, eps)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    real(8) :: tmp
    if (x <= (-2d+17)) then
        tmp = ((exp(-x) / eps) - ((1.0d0 / eps) - 1.0d0)) * 0.5d0
    else if (x <= 4d-265) then
        tmp = (exp(-(eps * x)) + (1.0d0 + (x * (eps - 1.0d0)))) * 0.5d0
    else
        tmp = 0.5d0 * (exp(-(x * (1.0d0 - eps))) - (-1.0d0))
    end if
    code = tmp
end function
public static double code(double x, double eps) {
	double tmp;
	if (x <= -2e+17) {
		tmp = ((Math.exp(-x) / eps) - ((1.0 / eps) - 1.0)) * 0.5;
	} else if (x <= 4e-265) {
		tmp = (Math.exp(-(eps * x)) + (1.0 + (x * (eps - 1.0)))) * 0.5;
	} else {
		tmp = 0.5 * (Math.exp(-(x * (1.0 - eps))) - -1.0);
	}
	return tmp;
}
def code(x, eps):
	tmp = 0
	if x <= -2e+17:
		tmp = ((math.exp(-x) / eps) - ((1.0 / eps) - 1.0)) * 0.5
	elif x <= 4e-265:
		tmp = (math.exp(-(eps * x)) + (1.0 + (x * (eps - 1.0)))) * 0.5
	else:
		tmp = 0.5 * (math.exp(-(x * (1.0 - eps))) - -1.0)
	return tmp
function code(x, eps)
	tmp = 0.0
	if (x <= -2e+17)
		tmp = Float64(Float64(Float64(exp(Float64(-x)) / eps) - Float64(Float64(1.0 / eps) - 1.0)) * 0.5);
	elseif (x <= 4e-265)
		tmp = Float64(Float64(exp(Float64(-Float64(eps * x))) + Float64(1.0 + Float64(x * Float64(eps - 1.0)))) * 0.5);
	else
		tmp = Float64(0.5 * Float64(exp(Float64(-Float64(x * Float64(1.0 - eps)))) - -1.0));
	end
	return tmp
end
function tmp_2 = code(x, eps)
	tmp = 0.0;
	if (x <= -2e+17)
		tmp = ((exp(-x) / eps) - ((1.0 / eps) - 1.0)) * 0.5;
	elseif (x <= 4e-265)
		tmp = (exp(-(eps * x)) + (1.0 + (x * (eps - 1.0)))) * 0.5;
	else
		tmp = 0.5 * (exp(-(x * (1.0 - eps))) - -1.0);
	end
	tmp_2 = tmp;
end
code[x_, eps_] := If[LessEqual[x, -2e+17], N[(N[(N[(N[Exp[(-x)], $MachinePrecision] / eps), $MachinePrecision] - N[(N[(1.0 / eps), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 4e-265], N[(N[(N[Exp[(-N[(eps * x), $MachinePrecision])], $MachinePrecision] + N[(1.0 + N[(x * N[(eps - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], N[(0.5 * N[(N[Exp[(-N[(x * N[(1.0 - eps), $MachinePrecision]), $MachinePrecision])], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{+17}:\\
\;\;\;\;\left(\frac{e^{-x}}{\varepsilon} - \left(\frac{1}{\varepsilon} - 1\right)\right) \cdot 0.5\\

\mathbf{elif}\;x \leq 4 \cdot 10^{-265}:\\
\;\;\;\;\left(e^{-\varepsilon \cdot x} + \left(1 + x \cdot \left(\varepsilon - 1\right)\right)\right) \cdot 0.5\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2e17

    1. Initial program 73.8%

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{e^{\mathsf{neg}\left(x\right)}}{\varepsilon}} - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
    6. Step-by-step derivation
      1. lower-/.f64N/A

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

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

        \[\leadsto \frac{\frac{e^{-x}}{\varepsilon} - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
    7. Applied rewrites12.0%

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

        \[\leadsto \color{blue}{\frac{\frac{e^{-x}}{\varepsilon} - \left(\frac{1}{\varepsilon} - 1\right)}{2}} \]
      2. mult-flipN/A

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

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

        \[\leadsto \color{blue}{\left(\frac{e^{-x}}{\varepsilon} - \left(\frac{1}{\varepsilon} - 1\right)\right) \cdot 0.5} \]
    9. Applied rewrites12.0%

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

    if -2e17 < x < 3.99999999999999994e-265

    1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999994e-265 < x

    1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 4: 63.9% accurate, 1.9× speedup?

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

      1. Initial program 73.8%

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{e^{\mathsf{neg}\left(x\right)}}{\varepsilon}} - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
      6. Step-by-step derivation
        1. lower-/.f64N/A

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

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

          \[\leadsto \frac{\frac{e^{-x}}{\varepsilon} - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
      7. Applied rewrites12.0%

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

          \[\leadsto \color{blue}{\frac{\frac{e^{-x}}{\varepsilon} - \left(\frac{1}{\varepsilon} - 1\right)}{2}} \]
        2. mult-flipN/A

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

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

          \[\leadsto \color{blue}{\left(\frac{e^{-x}}{\varepsilon} - \left(\frac{1}{\varepsilon} - 1\right)\right) \cdot 0.5} \]
      9. Applied rewrites12.0%

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

      if -330 < x

      1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 5: 63.6% accurate, 1.7× speedup?

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

        1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto 1 - x \]
          2. sub-negate-revN/A

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\mathsf{fma}\left(x, x, -1\right)}{\mathsf{neg}\left(\left(x - -1\right)\right)} \]
          14. lift--.f64N/A

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

            \[\leadsto \frac{\mathsf{fma}\left(x, x, -1\right)}{-1 - x} \]
          16. lower--.f6449.2

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

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

        if -1.35000000000000003e154 < x < 3.99999999999999994e-265

        1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{1 - {x}^{2}}{1 - -1 \cdot x} \]
          11. lift-*.f64N/A

            \[\leadsto \frac{1 - {x}^{2}}{1 - -1 \cdot x} \]
          12. mul-1-negN/A

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

            \[\leadsto \frac{1 - {x}^{2}}{1 + x} \]
          14. +-commutativeN/A

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

            \[\leadsto \frac{1 - {x}^{2}}{x + \color{blue}{1}} \]
          16. lower--.f64N/A

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

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

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

            \[\leadsto \frac{1 - x \cdot x}{x + 1} \]
          20. add-flipN/A

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

            \[\leadsto \frac{1 - x \cdot x}{x - -1} \]
          22. lower--.f6449.2

            \[\leadsto \frac{1 - x \cdot x}{x - -1} \]
        9. Applied rewrites49.2%

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

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

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

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

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

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

            \[\leadsto \frac{\frac{1 - \left(x \cdot x\right) \cdot \left(x \cdot x\right)}{1 + x \cdot x}}{x - -1} \]
          7. associate-*r*N/A

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

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

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

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

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

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

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

        if 3.99999999999999994e-265 < x

        1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 6: 63.2% accurate, 1.8× speedup?

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

          1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto 1 - x \]
            2. sub-negate-revN/A

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\mathsf{fma}\left(x, x, -1\right)}{\mathsf{neg}\left(\left(x - -1\right)\right)} \]
            14. lift--.f64N/A

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

              \[\leadsto \frac{\mathsf{fma}\left(x, x, -1\right)}{-1 - x} \]
            16. lower--.f6449.2

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

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

          if -1.35000000000000003e154 < x < 3.99999999999999994e-265

          1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto 1 + \color{blue}{-1 \cdot x} \]
          8. Applied rewrites44.5%

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\left(\mathsf{fma}\left(x, x, x\right) + 1\right) \cdot \left(1 - x\right)}{\mathsf{fma}\left(x, x, x\right) + 1} \]
            13. lower-*.f6444.5

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

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

              \[\leadsto \frac{\left(\left(x \cdot x + x\right) + 1\right) \cdot \left(1 - x\right)}{\mathsf{fma}\left(x, x, x\right) + 1} \]
            16. distribute-lft1-inN/A

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

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

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

              \[\leadsto \frac{\left(\left(x - -1\right) \cdot x + 1\right) \cdot \left(1 - x\right)}{\mathsf{fma}\left(x, x, x\right) + 1} \]
            20. lower-fma.f6444.5

              \[\leadsto \frac{\mathsf{fma}\left(x - -1, x, 1\right) \cdot \left(1 - x\right)}{\mathsf{fma}\left(x, x, x\right) + 1} \]
          10. Applied rewrites44.5%

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

          if 3.99999999999999994e-265 < x

          1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 7: 62.9% accurate, 1.9× speedup?

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

            1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto 1 - x \]
              2. sub-negate-revN/A

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\mathsf{fma}\left(x, x, -1\right)}{\mathsf{neg}\left(\left(x - -1\right)\right)} \]
              14. lift--.f64N/A

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

                \[\leadsto \frac{\mathsf{fma}\left(x, x, -1\right)}{-1 - x} \]
              16. lower--.f6449.2

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

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

            if -1.35000000000000003e154 < x < 3.99999999999999994e-265

            1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\mathsf{fma}\left(x \cdot x, x, -1\right)}{\mathsf{neg}\left(\left(\mathsf{fma}\left(x, x, x\right) + 1\right)\right)} \]
              22. add-flipN/A

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

                \[\leadsto \frac{\mathsf{fma}\left(x \cdot x, x, -1\right)}{\mathsf{neg}\left(\left(\mathsf{fma}\left(x, x, x\right) - -1\right)\right)} \]
            11. Applied rewrites44.5%

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

            if 3.99999999999999994e-265 < x

            1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Alternative 8: 62.8% accurate, 2.1× speedup?

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

              1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto 1 - x \]
                2. sub-negate-revN/A

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{\mathsf{fma}\left(x, x, -1\right)}{\mathsf{neg}\left(\left(x - -1\right)\right)} \]
                14. lift--.f64N/A

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

                  \[\leadsto \frac{\mathsf{fma}\left(x, x, -1\right)}{-1 - x} \]
                16. lower--.f6449.2

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

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

              if -1.35000000000000003e154 < x < 2.1999999999999998e-8

              1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{\mathsf{fma}\left(x \cdot x, x, -1\right)}{\mathsf{neg}\left(\left(\mathsf{fma}\left(x, x, x\right) + 1\right)\right)} \]
                22. add-flipN/A

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

                  \[\leadsto \frac{\mathsf{fma}\left(x \cdot x, x, -1\right)}{\mathsf{neg}\left(\left(\mathsf{fma}\left(x, x, x\right) - -1\right)\right)} \]
              11. Applied rewrites44.5%

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

              if 2.1999999999999998e-8 < x

              1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

            Alternative 9: 62.1% accurate, 2.6× speedup?

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

              1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto 1 - x \]
                2. sub-negate-revN/A

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{\mathsf{fma}\left(x, x, -1\right)}{\mathsf{neg}\left(\left(x - -1\right)\right)} \]
                14. lift--.f64N/A

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

                  \[\leadsto \frac{\mathsf{fma}\left(x, x, -1\right)}{-1 - x} \]
                16. lower--.f6449.2

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

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

              if 2.1999999999999998e-8 < x

              1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

            Alternative 10: 62.1% accurate, 2.9× speedup?

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

              1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto 1 - x \]
                2. sub-negate-revN/A

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{\mathsf{fma}\left(x, x, -1\right)}{\mathsf{neg}\left(\left(x - -1\right)\right)} \]
                14. lift--.f64N/A

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

                  \[\leadsto \frac{\mathsf{fma}\left(x, x, -1\right)}{-1 - x} \]
                16. lower--.f6449.2

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

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

              if 1 < x

              1. Initial program 73.8%

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

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

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

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

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

                \[\leadsto \frac{\color{blue}{\frac{e^{\mathsf{neg}\left(x\right)}}{\varepsilon}} - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
              6. Step-by-step derivation
                1. lower-/.f64N/A

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

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

                  \[\leadsto \frac{\frac{e^{-x}}{\varepsilon} - \left(\frac{1}{\varepsilon} - 1\right)}{2} \]
              7. Applied rewrites12.0%

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

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

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

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

            Alternative 11: 49.2% accurate, 4.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto 1 - x \]
              2. sub-negate-revN/A

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\mathsf{fma}\left(x, x, -1\right)}{\mathsf{neg}\left(\left(x - -1\right)\right)} \]
              14. lift--.f64N/A

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

                \[\leadsto \frac{\mathsf{fma}\left(x, x, -1\right)}{-1 - x} \]
              16. lower--.f6449.2

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

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

            Alternative 12: 43.6% accurate, 58.4× speedup?

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

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

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

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

              Reproduce

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