NMSE Section 6.1 mentioned, A

Percentage Accurate: 74.4% → 99.0%
Time: 5.4s
Alternatives: 12
Speedup: 2.0×

Specification

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

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: 74.4% accurate, 1.0× speedup?

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

Alternative 1: 99.0% accurate, 0.7× speedup?

\[\begin{array}{l} t_0 := \mathsf{fma}\left(x, \left|\varepsilon\right|, x\right)\\ 0.5 \cdot \left(e^{-x \cdot \left(1 - \left|\varepsilon\right|\right)} - -1 \cdot \left(\sqrt{\sqrt{{0.36787944117144233}^{t\_0}}} \cdot \sqrt{e^{\mathsf{fma}\left(-1 - \left|\varepsilon\right|, x, \frac{t\_0}{-2}\right)}}\right)\right) \end{array} \]
(FPCore (x eps)
 :precision binary64
 (let* ((t_0 (fma x (fabs eps) x)))
   (*
    0.5
    (-
     (exp (- (* x (- 1.0 (fabs eps)))))
     (*
      -1.0
      (*
       (sqrt (sqrt (pow 0.36787944117144233 t_0)))
       (sqrt (exp (fma (- -1.0 (fabs eps)) x (/ t_0 -2.0))))))))))
double code(double x, double eps) {
	double t_0 = fma(x, fabs(eps), x);
	return 0.5 * (exp(-(x * (1.0 - fabs(eps)))) - (-1.0 * (sqrt(sqrt(pow(0.36787944117144233, t_0))) * sqrt(exp(fma((-1.0 - fabs(eps)), x, (t_0 / -2.0)))))));
}
function code(x, eps)
	t_0 = fma(x, abs(eps), x)
	return Float64(0.5 * Float64(exp(Float64(-Float64(x * Float64(1.0 - abs(eps))))) - Float64(-1.0 * Float64(sqrt(sqrt((0.36787944117144233 ^ t_0))) * sqrt(exp(fma(Float64(-1.0 - abs(eps)), x, Float64(t_0 / -2.0))))))))
end
code[x_, eps_] := Block[{t$95$0 = N[(x * N[Abs[eps], $MachinePrecision] + x), $MachinePrecision]}, N[(0.5 * N[(N[Exp[(-N[(x * N[(1.0 - N[Abs[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])], $MachinePrecision] - N[(-1.0 * N[(N[Sqrt[N[Sqrt[N[Power[0.36787944117144233, t$95$0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[Exp[N[(N[(-1.0 - N[Abs[eps], $MachinePrecision]), $MachinePrecision] * x + N[(t$95$0 / -2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(x, \left|\varepsilon\right|, x\right)\\
0.5 \cdot \left(e^{-x \cdot \left(1 - \left|\varepsilon\right|\right)} - -1 \cdot \left(\sqrt{\sqrt{{0.36787944117144233}^{t\_0}}} \cdot \sqrt{e^{\mathsf{fma}\left(-1 - \left|\varepsilon\right|, x, \frac{t\_0}{-2}\right)}}\right)\right)
\end{array}
Derivation
  1. Initial program 74.4%

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

    \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
  3. Step-by-step derivation
    1. 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. Applied rewrites99.0%

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

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

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

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

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

      \[\leadsto \frac{1}{2} \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1 \cdot \left(\sqrt{\sqrt{e^{\left(\left(\mathsf{neg}\left(1\right)\right) + \left(\mathsf{neg}\left(\varepsilon\right)\right)\right) \cdot x}}} \cdot \sqrt{e^{\mathsf{fma}\left(-1 - \varepsilon, x, \frac{\mathsf{fma}\left(x, \varepsilon, x\right)}{-2}\right)}}\right)\right) \]
    6. distribute-neg-outN/A

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

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

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

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

      \[\leadsto \frac{1}{2} \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1 \cdot \left(\sqrt{\sqrt{e^{\left(-1 \cdot x\right) \cdot \left(1 + \varepsilon\right)}}} \cdot \sqrt{e^{\mathsf{fma}\left(-1 - \varepsilon, x, \frac{\mathsf{fma}\left(x, \varepsilon, x\right)}{-2}\right)}}\right)\right) \]
    11. associate-*l*N/A

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

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

      \[\leadsto \frac{1}{2} \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1 \cdot \left(\sqrt{\sqrt{e^{-1 \cdot \left(x \cdot \left(1 + \varepsilon\right)\right)}}} \cdot \sqrt{e^{\mathsf{fma}\left(-1 - \varepsilon, x, \frac{\mathsf{fma}\left(x, \varepsilon, x\right)}{-2}\right)}}\right)\right) \]
    14. exp-prodN/A

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

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

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

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

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

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

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

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

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

    \[\leadsto 0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1 \cdot \left(\sqrt{\sqrt{{\left(e^{-1}\right)}^{\left(\mathsf{fma}\left(x, \varepsilon, x\right)\right)}}} \cdot \sqrt{e^{\mathsf{fma}\left(\color{blue}{-1 - \varepsilon}, x, \frac{\mathsf{fma}\left(x, \varepsilon, x\right)}{-2}\right)}}\right)\right) \]
  8. Evaluated real constant99.0%

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

Alternative 2: 99.0% accurate, 0.7× speedup?

\[\begin{array}{l} t_0 := -1 - \left|\varepsilon\right|\\ 0.5 \cdot \left(e^{-x \cdot \left(1 - \left|\varepsilon\right|\right)} - -1 \cdot \left(\sqrt{\sqrt{e^{t\_0 \cdot x}}} \cdot \sqrt{e^{\mathsf{fma}\left(t\_0, x, \frac{\mathsf{fma}\left(x, \left|\varepsilon\right|, x\right)}{-2}\right)}}\right)\right) \end{array} \]
(FPCore (x eps)
 :precision binary64
 (let* ((t_0 (- -1.0 (fabs eps))))
   (*
    0.5
    (-
     (exp (- (* x (- 1.0 (fabs eps)))))
     (*
      -1.0
      (*
       (sqrt (sqrt (exp (* t_0 x))))
       (sqrt (exp (fma t_0 x (/ (fma x (fabs eps) x) -2.0))))))))))
double code(double x, double eps) {
	double t_0 = -1.0 - fabs(eps);
	return 0.5 * (exp(-(x * (1.0 - fabs(eps)))) - (-1.0 * (sqrt(sqrt(exp((t_0 * x)))) * sqrt(exp(fma(t_0, x, (fma(x, fabs(eps), x) / -2.0)))))));
}
function code(x, eps)
	t_0 = Float64(-1.0 - abs(eps))
	return Float64(0.5 * Float64(exp(Float64(-Float64(x * Float64(1.0 - abs(eps))))) - Float64(-1.0 * Float64(sqrt(sqrt(exp(Float64(t_0 * x)))) * sqrt(exp(fma(t_0, x, Float64(fma(x, abs(eps), x) / -2.0))))))))
end
code[x_, eps_] := Block[{t$95$0 = N[(-1.0 - N[Abs[eps], $MachinePrecision]), $MachinePrecision]}, N[(0.5 * N[(N[Exp[(-N[(x * N[(1.0 - N[Abs[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision])], $MachinePrecision] - N[(-1.0 * N[(N[Sqrt[N[Sqrt[N[Exp[N[(t$95$0 * x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[Exp[N[(t$95$0 * x + N[(N[(x * N[Abs[eps], $MachinePrecision] + x), $MachinePrecision] / -2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := -1 - \left|\varepsilon\right|\\
0.5 \cdot \left(e^{-x \cdot \left(1 - \left|\varepsilon\right|\right)} - -1 \cdot \left(\sqrt{\sqrt{e^{t\_0 \cdot x}}} \cdot \sqrt{e^{\mathsf{fma}\left(t\_0, x, \frac{\mathsf{fma}\left(x, \left|\varepsilon\right|, x\right)}{-2}\right)}}\right)\right)
\end{array}
Derivation
  1. Initial program 74.4%

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

    \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
  3. Step-by-step derivation
    1. 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. Applied rewrites99.0%

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

Alternative 3: 99.0% accurate, 1.4× speedup?

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

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

    \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
  3. Step-by-step derivation
    1. 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. Add Preprocessing

Alternative 4: 84.4% accurate, 1.4× speedup?

\[\begin{array}{l} t_0 := e^{-x}\\ \mathbf{if}\;x \leq -2.5 \cdot 10^{+44}:\\ \;\;\;\;0.5 \cdot \left(t\_0 - -1\right)\\ \mathbf{elif}\;x \leq -4 \cdot 10^{-300}:\\ \;\;\;\;\left(e^{\left(-1 - \left|\varepsilon\right|\right) \cdot x} + \mathsf{fma}\left(\left|\varepsilon\right| - 1, x, 1\right)\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 1.08 \cdot 10^{+257}:\\ \;\;\;\;0.5 \cdot \left(e^{\left|\varepsilon\right| \cdot x} - -1\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(t\_0 - -1 \cdot t\_0\right)\\ \end{array} \]
(FPCore (x eps)
 :precision binary64
 (let* ((t_0 (exp (- x))))
   (if (<= x -2.5e+44)
     (* 0.5 (- t_0 -1.0))
     (if (<= x -4e-300)
       (*
        (+ (exp (* (- -1.0 (fabs eps)) x)) (fma (- (fabs eps) 1.0) x 1.0))
        0.5)
       (if (<= x 1.08e+257)
         (* 0.5 (- (exp (* (fabs eps) x)) -1.0))
         (* 0.5 (- t_0 (* -1.0 t_0))))))))
double code(double x, double eps) {
	double t_0 = exp(-x);
	double tmp;
	if (x <= -2.5e+44) {
		tmp = 0.5 * (t_0 - -1.0);
	} else if (x <= -4e-300) {
		tmp = (exp(((-1.0 - fabs(eps)) * x)) + fma((fabs(eps) - 1.0), x, 1.0)) * 0.5;
	} else if (x <= 1.08e+257) {
		tmp = 0.5 * (exp((fabs(eps) * x)) - -1.0);
	} else {
		tmp = 0.5 * (t_0 - (-1.0 * t_0));
	}
	return tmp;
}
function code(x, eps)
	t_0 = exp(Float64(-x))
	tmp = 0.0
	if (x <= -2.5e+44)
		tmp = Float64(0.5 * Float64(t_0 - -1.0));
	elseif (x <= -4e-300)
		tmp = Float64(Float64(exp(Float64(Float64(-1.0 - abs(eps)) * x)) + fma(Float64(abs(eps) - 1.0), x, 1.0)) * 0.5);
	elseif (x <= 1.08e+257)
		tmp = Float64(0.5 * Float64(exp(Float64(abs(eps) * x)) - -1.0));
	else
		tmp = Float64(0.5 * Float64(t_0 - Float64(-1.0 * t_0)));
	end
	return tmp
end
code[x_, eps_] := Block[{t$95$0 = N[Exp[(-x)], $MachinePrecision]}, If[LessEqual[x, -2.5e+44], N[(0.5 * N[(t$95$0 - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4e-300], N[(N[(N[Exp[N[(N[(-1.0 - N[Abs[eps], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Abs[eps], $MachinePrecision] - 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 1.08e+257], N[(0.5 * N[(N[Exp[N[(N[Abs[eps], $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(t$95$0 - N[(-1.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := e^{-x}\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{+44}:\\
\;\;\;\;0.5 \cdot \left(t\_0 - -1\right)\\

\mathbf{elif}\;x \leq -4 \cdot 10^{-300}:\\
\;\;\;\;\left(e^{\left(-1 - \left|\varepsilon\right|\right) \cdot x} + \mathsf{fma}\left(\left|\varepsilon\right| - 1, x, 1\right)\right) \cdot 0.5\\

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

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(t\_0 - -1 \cdot t\_0\right)\\


\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -2.4999999999999998e44

    1. Initial program 74.4%

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

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
    3. Step-by-step derivation
      1. 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 0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1\right) \]
    6. Step-by-step derivation
      1. Applied rewrites64.0%

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

        \[\leadsto 0.5 \cdot \left(e^{\mathsf{neg}\left(x\right)} - -1\right) \]
      3. Step-by-step derivation
        1. lower-exp.f64N/A

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

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

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

      if -2.4999999999999998e44 < x < -4.0000000000000001e-300

      1. Initial program 74.4%

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

        \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
      3. Step-by-step derivation
        1. 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 0.5 \cdot \left(\left(1 + x \cdot \left(\varepsilon - 1\right)\right) - \color{blue}{-1} \cdot e^{-x \cdot \left(1 + \varepsilon\right)}\right) \]
      6. Step-by-step derivation
        1. lower-+.f64N/A

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

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

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

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

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

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

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

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

      if -4.0000000000000001e-300 < x < 1.07999999999999998e257

      1. Initial program 74.4%

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

        \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
      3. Step-by-step derivation
        1. 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 0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1\right) \]
      6. Step-by-step derivation
        1. Applied rewrites64.0%

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

          \[\leadsto 0.5 \cdot \left(e^{\varepsilon \cdot x} - -1\right) \]
        3. Step-by-step derivation
          1. lower-*.f6464.2%

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

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

        if 1.07999999999999998e257 < x

        1. Initial program 74.4%

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

          \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
        3. Step-by-step derivation
          1. 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 eps around 0

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

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

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

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

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

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

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

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

      Alternative 5: 84.3% accurate, 1.5× speedup?

      \[\begin{array}{l} t_0 := \frac{1}{\left|\varepsilon\right|}\\ \mathbf{if}\;x \leq -2.5 \cdot 10^{+44}:\\ \;\;\;\;0.5 \cdot \left(e^{-x} - -1\right)\\ \mathbf{elif}\;x \leq -4 \cdot 10^{-300}:\\ \;\;\;\;\left(e^{\left(-1 - \left|\varepsilon\right|\right) \cdot x} + \mathsf{fma}\left(\left|\varepsilon\right| - 1, x, 1\right)\right) \cdot 0.5\\ \mathbf{elif}\;x \leq 1.08 \cdot 10^{+257}:\\ \;\;\;\;0.5 \cdot \left(e^{\left|\varepsilon\right| \cdot x} - -1\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(1 + t\_0\right) - \left(t\_0 - 1\right)}{2}\\ \end{array} \]
      (FPCore (x eps)
       :precision binary64
       (let* ((t_0 (/ 1.0 (fabs eps))))
         (if (<= x -2.5e+44)
           (* 0.5 (- (exp (- x)) -1.0))
           (if (<= x -4e-300)
             (*
              (+ (exp (* (- -1.0 (fabs eps)) x)) (fma (- (fabs eps) 1.0) x 1.0))
              0.5)
             (if (<= x 1.08e+257)
               (* 0.5 (- (exp (* (fabs eps) x)) -1.0))
               (/ (- (+ 1.0 t_0) (- t_0 1.0)) 2.0))))))
      double code(double x, double eps) {
      	double t_0 = 1.0 / fabs(eps);
      	double tmp;
      	if (x <= -2.5e+44) {
      		tmp = 0.5 * (exp(-x) - -1.0);
      	} else if (x <= -4e-300) {
      		tmp = (exp(((-1.0 - fabs(eps)) * x)) + fma((fabs(eps) - 1.0), x, 1.0)) * 0.5;
      	} else if (x <= 1.08e+257) {
      		tmp = 0.5 * (exp((fabs(eps) * x)) - -1.0);
      	} else {
      		tmp = ((1.0 + t_0) - (t_0 - 1.0)) / 2.0;
      	}
      	return tmp;
      }
      
      function code(x, eps)
      	t_0 = Float64(1.0 / abs(eps))
      	tmp = 0.0
      	if (x <= -2.5e+44)
      		tmp = Float64(0.5 * Float64(exp(Float64(-x)) - -1.0));
      	elseif (x <= -4e-300)
      		tmp = Float64(Float64(exp(Float64(Float64(-1.0 - abs(eps)) * x)) + fma(Float64(abs(eps) - 1.0), x, 1.0)) * 0.5);
      	elseif (x <= 1.08e+257)
      		tmp = Float64(0.5 * Float64(exp(Float64(abs(eps) * x)) - -1.0));
      	else
      		tmp = Float64(Float64(Float64(1.0 + t_0) - Float64(t_0 - 1.0)) / 2.0);
      	end
      	return tmp
      end
      
      code[x_, eps_] := Block[{t$95$0 = N[(1.0 / N[Abs[eps], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.5e+44], N[(0.5 * N[(N[Exp[(-x)], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4e-300], N[(N[(N[Exp[N[(N[(-1.0 - N[Abs[eps], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] + N[(N[(N[Abs[eps], $MachinePrecision] - 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[x, 1.08e+257], N[(0.5 * N[(N[Exp[N[(N[Abs[eps], $MachinePrecision] * x), $MachinePrecision]], $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 + t$95$0), $MachinePrecision] - N[(t$95$0 - 1.0), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]]]]]
      
      \begin{array}{l}
      t_0 := \frac{1}{\left|\varepsilon\right|}\\
      \mathbf{if}\;x \leq -2.5 \cdot 10^{+44}:\\
      \;\;\;\;0.5 \cdot \left(e^{-x} - -1\right)\\
      
      \mathbf{elif}\;x \leq -4 \cdot 10^{-300}:\\
      \;\;\;\;\left(e^{\left(-1 - \left|\varepsilon\right|\right) \cdot x} + \mathsf{fma}\left(\left|\varepsilon\right| - 1, x, 1\right)\right) \cdot 0.5\\
      
      \mathbf{elif}\;x \leq 1.08 \cdot 10^{+257}:\\
      \;\;\;\;0.5 \cdot \left(e^{\left|\varepsilon\right| \cdot x} - -1\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\left(1 + t\_0\right) - \left(t\_0 - 1\right)}{2}\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if x < -2.4999999999999998e44

        1. Initial program 74.4%

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

          \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
        3. Step-by-step derivation
          1. 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 0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1\right) \]
        6. Step-by-step derivation
          1. Applied rewrites64.0%

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

            \[\leadsto 0.5 \cdot \left(e^{\mathsf{neg}\left(x\right)} - -1\right) \]
          3. Step-by-step derivation
            1. lower-exp.f64N/A

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

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

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

          if -2.4999999999999998e44 < x < -4.0000000000000001e-300

          1. Initial program 74.4%

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

            \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
          3. Step-by-step derivation
            1. 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 0.5 \cdot \left(\left(1 + x \cdot \left(\varepsilon - 1\right)\right) - \color{blue}{-1} \cdot e^{-x \cdot \left(1 + \varepsilon\right)}\right) \]
          6. Step-by-step derivation
            1. lower-+.f64N/A

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

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

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

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

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

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

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

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

          if -4.0000000000000001e-300 < x < 1.07999999999999998e257

          1. Initial program 74.4%

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

            \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
          3. Step-by-step derivation
            1. 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 0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1\right) \]
          6. Step-by-step derivation
            1. Applied rewrites64.0%

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

              \[\leadsto 0.5 \cdot \left(e^{\varepsilon \cdot x} - -1\right) \]
            3. Step-by-step derivation
              1. lower-*.f6464.2%

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

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

            if 1.07999999999999998e257 < x

            1. Initial program 74.4%

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

                \[\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 rewrites39.2%

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

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

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

          Alternative 6: 77.5% accurate, 2.0× speedup?

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

            1. Initial program 74.4%

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

              \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
            3. Step-by-step derivation
              1. 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 0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1\right) \]
            6. Step-by-step derivation
              1. Applied rewrites64.0%

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

                \[\leadsto 0.5 \cdot \left(e^{\mathsf{neg}\left(x\right)} - -1\right) \]
              3. Step-by-step derivation
                1. lower-exp.f64N/A

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

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

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

              if -4.0000000000000001e-300 < x < 1.07999999999999998e257

              1. Initial program 74.4%

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

                \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
              3. Step-by-step derivation
                1. 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 0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1\right) \]
              6. Step-by-step derivation
                1. Applied rewrites64.0%

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

                  \[\leadsto 0.5 \cdot \left(e^{\varepsilon \cdot x} - -1\right) \]
                3. Step-by-step derivation
                  1. lower-*.f6464.2%

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

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

                if 1.07999999999999998e257 < x

                1. Initial program 74.4%

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

                    \[\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 rewrites39.2%

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

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

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

              Alternative 7: 69.9% accurate, 1.9× speedup?

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

                1. Initial program 74.4%

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

                  \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                3. Step-by-step derivation
                  1. 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 0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1\right) \]
                6. Step-by-step derivation
                  1. Applied rewrites64.0%

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

                    \[\leadsto 0.5 \cdot \left(e^{\mathsf{neg}\left(x\right)} - -1\right) \]
                  3. Step-by-step derivation
                    1. lower-exp.f64N/A

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

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

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

                  if 2.99999999999999998e-9 < x < 1.34999999999999989e158 or 1.07999999999999998e257 < x

                  1. Initial program 74.4%

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

                      \[\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 rewrites39.2%

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

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

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

                  if 1.34999999999999989e158 < x < 1.07999999999999998e257

                  1. Initial program 74.4%

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

                    \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                  3. Step-by-step derivation
                    1. 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 0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1\right) \]
                  6. Step-by-step derivation
                    1. Applied rewrites64.0%

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

                      \[\leadsto 0.5 \cdot \left(e^{\mathsf{neg}\left(x\right)} - -1\right) \]
                    3. Step-by-step derivation
                      1. lower-exp.f64N/A

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

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

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

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

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

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

                        \[\leadsto \frac{1}{2} \cdot \left(\left(1 + x \cdot \left(\frac{1}{2} \cdot x - 1\right)\right) - -1\right) \]
                      4. lower-*.f6456.8%

                        \[\leadsto 0.5 \cdot \left(\left(1 + x \cdot \left(0.5 \cdot x - 1\right)\right) - -1\right) \]
                    7. Applied rewrites56.8%

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

                  Alternative 8: 65.4% accurate, 2.3× speedup?

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

                    1. Initial program 74.4%

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

                      \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                    3. Step-by-step derivation
                      1. 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 0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1\right) \]
                    6. Step-by-step derivation
                      1. Applied rewrites64.0%

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

                        \[\leadsto 0.5 \cdot \left(e^{\mathsf{neg}\left(x\right)} - -1\right) \]
                      3. Step-by-step derivation
                        1. lower-exp.f64N/A

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

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

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

                      if 1.3000000000000001e-229 < x < 1.8999999999999999e154

                      1. Initial program 74.4%

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

                        \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                      3. Step-by-step derivation
                        1. 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 0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1\right) \]
                      6. Step-by-step derivation
                        1. Applied rewrites64.0%

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

                          \[\leadsto 0.5 \cdot \left(\left(1 + x \cdot \left(\varepsilon - 1\right)\right) - -1\right) \]
                        3. Step-by-step derivation
                          1. lower-+.f64N/A

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

                            \[\leadsto \frac{1}{2} \cdot \left(\left(1 + x \cdot \left(\varepsilon - 1\right)\right) - -1\right) \]
                          3. lower--.f6449.5%

                            \[\leadsto 0.5 \cdot \left(\left(1 + x \cdot \left(\varepsilon - 1\right)\right) - -1\right) \]
                        4. Applied rewrites49.5%

                          \[\leadsto 0.5 \cdot \left(\left(1 + x \cdot \left(\varepsilon - 1\right)\right) - -1\right) \]

                        if 1.8999999999999999e154 < x

                        1. Initial program 74.4%

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

                          \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                        3. Step-by-step derivation
                          1. 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 0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1\right) \]
                        6. Step-by-step derivation
                          1. Applied rewrites64.0%

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

                            \[\leadsto 0.5 \cdot \left(e^{\mathsf{neg}\left(x\right)} - -1\right) \]
                          3. Step-by-step derivation
                            1. lower-exp.f64N/A

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

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

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

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

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

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

                              \[\leadsto \frac{1}{2} \cdot \left(\left(1 + x \cdot \left(\frac{1}{2} \cdot x - 1\right)\right) - -1\right) \]
                            4. lower-*.f6456.8%

                              \[\leadsto 0.5 \cdot \left(\left(1 + x \cdot \left(0.5 \cdot x - 1\right)\right) - -1\right) \]
                          7. Applied rewrites56.8%

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

                        Alternative 9: 63.9% accurate, 2.7× speedup?

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

                          1. Initial program 74.4%

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

                            \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                          3. Step-by-step derivation
                            1. 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 0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1\right) \]
                          6. Step-by-step derivation
                            1. Applied rewrites64.0%

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

                              \[\leadsto 0.5 \cdot \left(e^{\mathsf{neg}\left(x\right)} - -1\right) \]
                            3. Step-by-step derivation
                              1. lower-exp.f64N/A

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

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

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

                            if 1.3000000000000001e-229 < x

                            1. Initial program 74.4%

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

                              \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                            3. Step-by-step derivation
                              1. 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 0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1\right) \]
                            6. Step-by-step derivation
                              1. Applied rewrites64.0%

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

                                \[\leadsto 0.5 \cdot \left(\left(1 + x \cdot \left(\varepsilon - 1\right)\right) - -1\right) \]
                              3. Step-by-step derivation
                                1. lower-+.f64N/A

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

                                  \[\leadsto \frac{1}{2} \cdot \left(\left(1 + x \cdot \left(\varepsilon - 1\right)\right) - -1\right) \]
                                3. lower--.f6449.5%

                                  \[\leadsto 0.5 \cdot \left(\left(1 + x \cdot \left(\varepsilon - 1\right)\right) - -1\right) \]
                              4. Applied rewrites49.5%

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

                            Alternative 10: 56.9% accurate, 2.9× speedup?

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

                              1. Initial program 74.4%

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

                                \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                              3. Step-by-step derivation
                                1. 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. fp-cancel-sign-sub-invN/A

                                  \[\leadsto 1 - \left(\mathsf{neg}\left(-1\right)\right) \cdot \color{blue}{x} \]
                                4. flip--N/A

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

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

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

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

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

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

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

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

                                  \[\leadsto \frac{1 \cdot 1 - x \cdot x}{1 + \left(\mathsf{neg}\left(-1\right)\right) \cdot x} \]
                                13. distribute-lft-neg-outN/A

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

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

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

                                  \[\leadsto \frac{1 \cdot 1 - x \cdot x}{1 + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)} \]
                                17. remove-double-negN/A

                                  \[\leadsto \frac{1 \cdot 1 - x \cdot x}{1 + x} \]
                                18. lower-unsound-+.f6449.1%

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

                                \[\leadsto \frac{1 \cdot 1 - x \cdot x}{1 + \color{blue}{x}} \]

                              if 1.3000000000000001e-229 < x

                              1. Initial program 74.4%

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

                                \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                              3. Step-by-step derivation
                                1. 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 0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1\right) \]
                              6. Step-by-step derivation
                                1. Applied rewrites64.0%

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

                                  \[\leadsto 0.5 \cdot \left(\left(1 + x \cdot \left(\varepsilon - 1\right)\right) - -1\right) \]
                                3. Step-by-step derivation
                                  1. lower-+.f64N/A

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

                                    \[\leadsto \frac{1}{2} \cdot \left(\left(1 + x \cdot \left(\varepsilon - 1\right)\right) - -1\right) \]
                                  3. lower--.f6449.5%

                                    \[\leadsto 0.5 \cdot \left(\left(1 + x \cdot \left(\varepsilon - 1\right)\right) - -1\right) \]
                                4. Applied rewrites49.5%

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

                              Alternative 11: 50.8% accurate, 2.9× speedup?

                              \[\begin{array}{l} \mathbf{if}\;x \leq 1.3 \cdot 10^{-229}:\\ \;\;\;\;1 - x\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(1 + x \cdot \left(\left|\varepsilon\right| - 1\right)\right) - -1\right)\\ \end{array} \]
                              (FPCore (x eps)
                               :precision binary64
                               (if (<= x 1.3e-229)
                                 (- 1.0 x)
                                 (* 0.5 (- (+ 1.0 (* x (- (fabs eps) 1.0))) -1.0))))
                              double code(double x, double eps) {
                              	double tmp;
                              	if (x <= 1.3e-229) {
                              		tmp = 1.0 - x;
                              	} else {
                              		tmp = 0.5 * ((1.0 + (x * (fabs(eps) - 1.0))) - -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 <= 1.3d-229) then
                                      tmp = 1.0d0 - x
                                  else
                                      tmp = 0.5d0 * ((1.0d0 + (x * (abs(eps) - 1.0d0))) - (-1.0d0))
                                  end if
                                  code = tmp
                              end function
                              
                              public static double code(double x, double eps) {
                              	double tmp;
                              	if (x <= 1.3e-229) {
                              		tmp = 1.0 - x;
                              	} else {
                              		tmp = 0.5 * ((1.0 + (x * (Math.abs(eps) - 1.0))) - -1.0);
                              	}
                              	return tmp;
                              }
                              
                              def code(x, eps):
                              	tmp = 0
                              	if x <= 1.3e-229:
                              		tmp = 1.0 - x
                              	else:
                              		tmp = 0.5 * ((1.0 + (x * (math.fabs(eps) - 1.0))) - -1.0)
                              	return tmp
                              
                              function code(x, eps)
                              	tmp = 0.0
                              	if (x <= 1.3e-229)
                              		tmp = Float64(1.0 - x);
                              	else
                              		tmp = Float64(0.5 * Float64(Float64(1.0 + Float64(x * Float64(abs(eps) - 1.0))) - -1.0));
                              	end
                              	return tmp
                              end
                              
                              function tmp_2 = code(x, eps)
                              	tmp = 0.0;
                              	if (x <= 1.3e-229)
                              		tmp = 1.0 - x;
                              	else
                              		tmp = 0.5 * ((1.0 + (x * (abs(eps) - 1.0))) - -1.0);
                              	end
                              	tmp_2 = tmp;
                              end
                              
                              code[x_, eps_] := If[LessEqual[x, 1.3e-229], N[(1.0 - x), $MachinePrecision], N[(0.5 * N[(N[(1.0 + N[(x * N[(N[Abs[eps], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]
                              
                              \begin{array}{l}
                              \mathbf{if}\;x \leq 1.3 \cdot 10^{-229}:\\
                              \;\;\;\;1 - x\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;0.5 \cdot \left(\left(1 + x \cdot \left(\left|\varepsilon\right| - 1\right)\right) - -1\right)\\
                              
                              
                              \end{array}
                              
                              Derivation
                              1. Split input into 2 regimes
                              2. if x < 1.3000000000000001e-229

                                1. Initial program 74.4%

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

                                  \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                                3. Step-by-step derivation
                                  1. 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 1 - x \]

                                if 1.3000000000000001e-229 < x

                                1. Initial program 74.4%

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

                                  \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(x \cdot \left(1 - \varepsilon\right)\right)} - -1 \cdot e^{\mathsf{neg}\left(x \cdot \left(1 + \varepsilon\right)\right)}\right)} \]
                                3. Step-by-step derivation
                                  1. 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 0.5 \cdot \left(e^{-x \cdot \left(1 - \varepsilon\right)} - -1\right) \]
                                6. Step-by-step derivation
                                  1. Applied rewrites64.0%

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

                                    \[\leadsto 0.5 \cdot \left(\left(1 + x \cdot \left(\varepsilon - 1\right)\right) - -1\right) \]
                                  3. Step-by-step derivation
                                    1. lower-+.f64N/A

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

                                      \[\leadsto \frac{1}{2} \cdot \left(\left(1 + x \cdot \left(\varepsilon - 1\right)\right) - -1\right) \]
                                    3. lower--.f6449.5%

                                      \[\leadsto 0.5 \cdot \left(\left(1 + x \cdot \left(\varepsilon - 1\right)\right) - -1\right) \]
                                  4. Applied rewrites49.5%

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

                                Alternative 12: 43.6% accurate, 58.4× speedup?

                                \[1 \]
                                (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
                                
                                1
                                
                                Derivation
                                1. Initial program 74.4%

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