Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A

Percentage Accurate: 96.0% → 98.9%
Time: 6.3s
Alternatives: 9
Speedup: 3.7×

Specification

?
\[\begin{array}{l} \\ x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))
double code(double x, double y, double z) {
	return x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
}
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, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
end function
public static double code(double x, double y, double z) {
	return x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
}
def code(x, y, z):
	return x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y)))
function code(x, y, z)
	return Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y))))
end
function tmp = code(x, y, z)
	tmp = x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
end
code[x_, y_, z_] := N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 alternatives:

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

Initial Program: 96.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))
double code(double x, double y, double z) {
	return x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
}
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, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
end function
public static double code(double x, double y, double z) {
	return x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
}
def code(x, y, z):
	return x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y)))
function code(x, y, z)
	return Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y))))
end
function tmp = code(x, y, z)
	tmp = x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
end
code[x_, y_, z_] := N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
\end{array}

Alternative 1: 98.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -9 \cdot 10^{+70}:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-16}:\\ \;\;\;\;x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -9e+70)
   (+ x (/ -1.0 x))
   (if (<= z 1.8e-16)
     (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y))))
     x)))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -9e+70) {
		tmp = x + (-1.0 / x);
	} else if (z <= 1.8e-16) {
		tmp = x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
	} else {
		tmp = x;
	}
	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, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-9d+70)) then
        tmp = x + ((-1.0d0) / x)
    else if (z <= 1.8d-16) then
        tmp = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -9e+70) {
		tmp = x + (-1.0 / x);
	} else if (z <= 1.8e-16) {
		tmp = x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -9e+70:
		tmp = x + (-1.0 / x)
	elif z <= 1.8e-16:
		tmp = x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y)))
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -9e+70)
		tmp = Float64(x + Float64(-1.0 / x));
	elseif (z <= 1.8e-16)
		tmp = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y))));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -9e+70)
		tmp = x + (-1.0 / x);
	elseif (z <= 1.8e-16)
		tmp = x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -9e+70], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e-16], N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+70}:\\
\;\;\;\;x + \frac{-1}{x}\\

\mathbf{elif}\;z \leq 1.8 \cdot 10^{-16}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -8.9999999999999999e70

    1. Initial program 82.8%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
    4. Step-by-step derivation
      1. Applied rewrites99.9%

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

      if -8.9999999999999999e70 < z < 1.79999999999999991e-16

      1. Initial program 99.8%

        \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
      2. Add Preprocessing

      if 1.79999999999999991e-16 < z

      1. Initial program 91.2%

        \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
      2. Add Preprocessing
      3. Taylor expanded in x around inf

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

          \[\leadsto \color{blue}{x} \]
      5. Recombined 3 regimes into one program.
      6. Add Preprocessing

      Alternative 2: 87.1% accurate, 0.3× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \frac{-1}{x}\\ t_1 := x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\\ \mathbf{if}\;t\_1 \leq -500:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-155}:\\ \;\;\;\;\mathsf{fma}\left(0.8862269254527579, y, x\right)\\ \mathbf{elif}\;t\_1 \leq 400:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (+ x (/ -1.0 x)))
              (t_1 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y))))))
         (if (<= t_1 -500.0)
           t_0
           (if (<= t_1 -2e-155)
             (fma 0.8862269254527579 y x)
             (if (<= t_1 400.0) x t_0)))))
      double code(double x, double y, double z) {
      	double t_0 = x + (-1.0 / x);
      	double t_1 = x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
      	double tmp;
      	if (t_1 <= -500.0) {
      		tmp = t_0;
      	} else if (t_1 <= -2e-155) {
      		tmp = fma(0.8862269254527579, y, x);
      	} else if (t_1 <= 400.0) {
      		tmp = x;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	t_0 = Float64(x + Float64(-1.0 / x))
      	t_1 = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y))))
      	tmp = 0.0
      	if (t_1 <= -500.0)
      		tmp = t_0;
      	elseif (t_1 <= -2e-155)
      		tmp = fma(0.8862269254527579, y, x);
      	elseif (t_1 <= 400.0)
      		tmp = x;
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -500.0], t$95$0, If[LessEqual[t$95$1, -2e-155], N[(0.8862269254527579 * y + x), $MachinePrecision], If[LessEqual[t$95$1, 400.0], x, t$95$0]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := x + \frac{-1}{x}\\
      t_1 := x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\\
      \mathbf{if}\;t\_1 \leq -500:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-155}:\\
      \;\;\;\;\mathsf{fma}\left(0.8862269254527579, y, x\right)\\
      
      \mathbf{elif}\;t\_1 \leq 400:\\
      \;\;\;\;x\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) < -500 or 400 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y))))

        1. Initial program 92.5%

          \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
        2. Add Preprocessing
        3. Taylor expanded in x around inf

          \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
        4. Step-by-step derivation
          1. Applied rewrites92.3%

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

          if -500 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) < -2.00000000000000003e-155

          1. Initial program 99.9%

            \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
          2. Add Preprocessing
          3. Taylor expanded in y around 0

            \[\leadsto \color{blue}{x + \frac{5000000000000000}{5641895835477563} \cdot \frac{y}{e^{z}}} \]
          4. Step-by-step derivation
            1. Applied rewrites99.9%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{0.8862269254527579}{e^{z}}, y, x\right)} \]
            2. Taylor expanded in z around 0

              \[\leadsto \mathsf{fma}\left(\frac{5000000000000000}{5641895835477563}, y, x\right) \]
            3. Step-by-step derivation
              1. Applied rewrites95.4%

                \[\leadsto \mathsf{fma}\left(0.8862269254527579, y, x\right) \]

              if -2.00000000000000003e-155 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) < 400

              1. Initial program 99.9%

                \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
              2. Add Preprocessing
              3. Taylor expanded in x around inf

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

                  \[\leadsto \color{blue}{x} \]
              5. Recombined 3 regimes into one program.
              6. Add Preprocessing

              Alternative 3: 99.3% accurate, 2.4× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -420:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-16}:\\ \;\;\;\;x + \frac{y}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.18806319451591877, z, 0.5641895835477563\right), z, 1.1283791670955126\right), z, 1.1283791670955126\right) - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (if (<= z -420.0)
                 (+ x (/ -1.0 x))
                 (if (<= z 1.8e-16)
                   (+
                    x
                    (/
                     y
                     (-
                      (fma
                       (fma
                        (fma 0.18806319451591877 z 0.5641895835477563)
                        z
                        1.1283791670955126)
                       z
                       1.1283791670955126)
                      (* x y))))
                   x)))
              double code(double x, double y, double z) {
              	double tmp;
              	if (z <= -420.0) {
              		tmp = x + (-1.0 / x);
              	} else if (z <= 1.8e-16) {
              		tmp = x + (y / (fma(fma(fma(0.18806319451591877, z, 0.5641895835477563), z, 1.1283791670955126), z, 1.1283791670955126) - (x * y)));
              	} else {
              		tmp = x;
              	}
              	return tmp;
              }
              
              function code(x, y, z)
              	tmp = 0.0
              	if (z <= -420.0)
              		tmp = Float64(x + Float64(-1.0 / x));
              	elseif (z <= 1.8e-16)
              		tmp = Float64(x + Float64(y / Float64(fma(fma(fma(0.18806319451591877, z, 0.5641895835477563), z, 1.1283791670955126), z, 1.1283791670955126) - Float64(x * y))));
              	else
              		tmp = x;
              	end
              	return tmp
              end
              
              code[x_, y_, z_] := If[LessEqual[z, -420.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e-16], N[(x + N[(y / N[(N[(N[(N[(0.18806319451591877 * z + 0.5641895835477563), $MachinePrecision] * z + 1.1283791670955126), $MachinePrecision] * z + 1.1283791670955126), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;z \leq -420:\\
              \;\;\;\;x + \frac{-1}{x}\\
              
              \mathbf{elif}\;z \leq 1.8 \cdot 10^{-16}:\\
              \;\;\;\;x + \frac{y}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.18806319451591877, z, 0.5641895835477563\right), z, 1.1283791670955126\right), z, 1.1283791670955126\right) - x \cdot y}\\
              
              \mathbf{else}:\\
              \;\;\;\;x\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if z < -420

                1. Initial program 86.4%

                  \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                2. Add Preprocessing
                3. Taylor expanded in x around inf

                  \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
                4. Step-by-step derivation
                  1. Applied rewrites100.0%

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

                  if -420 < z < 1.79999999999999991e-16

                  1. Initial program 99.8%

                    \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                  2. Add Preprocessing
                  3. Taylor expanded in z around 0

                    \[\leadsto x + \frac{y}{\color{blue}{\left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{10000000000000000} + \frac{5641895835477563}{30000000000000000} \cdot z\right)\right)\right)} - x \cdot y} \]
                  4. Step-by-step derivation
                    1. Applied rewrites99.7%

                      \[\leadsto x + \frac{y}{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.18806319451591877, z, 0.5641895835477563\right), z, 1.1283791670955126\right), z, 1.1283791670955126\right)} - x \cdot y} \]

                    if 1.79999999999999991e-16 < z

                    1. Initial program 91.2%

                      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                    2. Add Preprocessing
                    3. Taylor expanded in x around inf

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

                        \[\leadsto \color{blue}{x} \]
                    5. Recombined 3 regimes into one program.
                    6. Add Preprocessing

                    Alternative 4: 99.3% accurate, 2.7× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -420:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-16}:\\ \;\;\;\;x + \frac{y}{\mathsf{fma}\left(\mathsf{fma}\left(0.5641895835477563, z, 1.1283791670955126\right), z, 1.1283791670955126\right) - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
                    (FPCore (x y z)
                     :precision binary64
                     (if (<= z -420.0)
                       (+ x (/ -1.0 x))
                       (if (<= z 1.8e-16)
                         (+
                          x
                          (/
                           y
                           (-
                            (fma
                             (fma 0.5641895835477563 z 1.1283791670955126)
                             z
                             1.1283791670955126)
                            (* x y))))
                         x)))
                    double code(double x, double y, double z) {
                    	double tmp;
                    	if (z <= -420.0) {
                    		tmp = x + (-1.0 / x);
                    	} else if (z <= 1.8e-16) {
                    		tmp = x + (y / (fma(fma(0.5641895835477563, z, 1.1283791670955126), z, 1.1283791670955126) - (x * y)));
                    	} else {
                    		tmp = x;
                    	}
                    	return tmp;
                    }
                    
                    function code(x, y, z)
                    	tmp = 0.0
                    	if (z <= -420.0)
                    		tmp = Float64(x + Float64(-1.0 / x));
                    	elseif (z <= 1.8e-16)
                    		tmp = Float64(x + Float64(y / Float64(fma(fma(0.5641895835477563, z, 1.1283791670955126), z, 1.1283791670955126) - Float64(x * y))));
                    	else
                    		tmp = x;
                    	end
                    	return tmp
                    end
                    
                    code[x_, y_, z_] := If[LessEqual[z, -420.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e-16], N[(x + N[(y / N[(N[(N[(0.5641895835477563 * z + 1.1283791670955126), $MachinePrecision] * z + 1.1283791670955126), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;z \leq -420:\\
                    \;\;\;\;x + \frac{-1}{x}\\
                    
                    \mathbf{elif}\;z \leq 1.8 \cdot 10^{-16}:\\
                    \;\;\;\;x + \frac{y}{\mathsf{fma}\left(\mathsf{fma}\left(0.5641895835477563, z, 1.1283791670955126\right), z, 1.1283791670955126\right) - x \cdot y}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;x\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 3 regimes
                    2. if z < -420

                      1. Initial program 86.4%

                        \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                      2. Add Preprocessing
                      3. Taylor expanded in x around inf

                        \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
                      4. Step-by-step derivation
                        1. Applied rewrites100.0%

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

                        if -420 < z < 1.79999999999999991e-16

                        1. Initial program 99.8%

                          \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                        2. Add Preprocessing
                        3. Taylor expanded in z around 0

                          \[\leadsto x + \frac{y}{\color{blue}{\left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{5000000000000000} + \frac{5641895835477563}{10000000000000000} \cdot z\right)\right)} - x \cdot y} \]
                        4. Step-by-step derivation
                          1. Applied rewrites99.4%

                            \[\leadsto x + \frac{y}{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.5641895835477563, z, 1.1283791670955126\right), z, 1.1283791670955126\right)} - x \cdot y} \]

                          if 1.79999999999999991e-16 < z

                          1. Initial program 91.2%

                            \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                          2. Add Preprocessing
                          3. Taylor expanded in x around inf

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

                              \[\leadsto \color{blue}{x} \]
                          5. Recombined 3 regimes into one program.
                          6. Add Preprocessing

                          Alternative 5: 99.3% accurate, 3.1× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -420:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-16}:\\ \;\;\;\;x + \frac{y}{\mathsf{fma}\left(1.1283791670955126, z, 1.1283791670955126\right) - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
                          (FPCore (x y z)
                           :precision binary64
                           (if (<= z -420.0)
                             (+ x (/ -1.0 x))
                             (if (<= z 1.8e-16)
                               (+ x (/ y (- (fma 1.1283791670955126 z 1.1283791670955126) (* x y))))
                               x)))
                          double code(double x, double y, double z) {
                          	double tmp;
                          	if (z <= -420.0) {
                          		tmp = x + (-1.0 / x);
                          	} else if (z <= 1.8e-16) {
                          		tmp = x + (y / (fma(1.1283791670955126, z, 1.1283791670955126) - (x * y)));
                          	} else {
                          		tmp = x;
                          	}
                          	return tmp;
                          }
                          
                          function code(x, y, z)
                          	tmp = 0.0
                          	if (z <= -420.0)
                          		tmp = Float64(x + Float64(-1.0 / x));
                          	elseif (z <= 1.8e-16)
                          		tmp = Float64(x + Float64(y / Float64(fma(1.1283791670955126, z, 1.1283791670955126) - Float64(x * y))));
                          	else
                          		tmp = x;
                          	end
                          	return tmp
                          end
                          
                          code[x_, y_, z_] := If[LessEqual[z, -420.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e-16], N[(x + N[(y / N[(N[(1.1283791670955126 * z + 1.1283791670955126), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;z \leq -420:\\
                          \;\;\;\;x + \frac{-1}{x}\\
                          
                          \mathbf{elif}\;z \leq 1.8 \cdot 10^{-16}:\\
                          \;\;\;\;x + \frac{y}{\mathsf{fma}\left(1.1283791670955126, z, 1.1283791670955126\right) - x \cdot y}\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;x\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if z < -420

                            1. Initial program 86.4%

                              \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                            2. Add Preprocessing
                            3. Taylor expanded in x around inf

                              \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
                            4. Step-by-step derivation
                              1. Applied rewrites100.0%

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

                              if -420 < z < 1.79999999999999991e-16

                              1. Initial program 99.8%

                                \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                              2. Add Preprocessing
                              3. Taylor expanded in z around 0

                                \[\leadsto x + \frac{y}{\color{blue}{\left(\frac{5641895835477563}{5000000000000000} + \frac{5641895835477563}{5000000000000000} \cdot z\right)} - x \cdot y} \]
                              4. Step-by-step derivation
                                1. Applied rewrites99.0%

                                  \[\leadsto x + \frac{y}{\color{blue}{\mathsf{fma}\left(1.1283791670955126, z, 1.1283791670955126\right)} - x \cdot y} \]

                                if 1.79999999999999991e-16 < z

                                1. Initial program 91.2%

                                  \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                                2. Add Preprocessing
                                3. Taylor expanded in x around inf

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

                                    \[\leadsto \color{blue}{x} \]
                                5. Recombined 3 regimes into one program.
                                6. Add Preprocessing

                                Alternative 6: 99.3% accurate, 3.7× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -420:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-16}:\\ \;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
                                (FPCore (x y z)
                                 :precision binary64
                                 (if (<= z -420.0)
                                   (+ x (/ -1.0 x))
                                   (if (<= z 1.8e-16) (+ x (/ y (- 1.1283791670955126 (* x y)))) x)))
                                double code(double x, double y, double z) {
                                	double tmp;
                                	if (z <= -420.0) {
                                		tmp = x + (-1.0 / x);
                                	} else if (z <= 1.8e-16) {
                                		tmp = x + (y / (1.1283791670955126 - (x * y)));
                                	} else {
                                		tmp = x;
                                	}
                                	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, y, z)
                                use fmin_fmax_functions
                                    real(8), intent (in) :: x
                                    real(8), intent (in) :: y
                                    real(8), intent (in) :: z
                                    real(8) :: tmp
                                    if (z <= (-420.0d0)) then
                                        tmp = x + ((-1.0d0) / x)
                                    else if (z <= 1.8d-16) then
                                        tmp = x + (y / (1.1283791670955126d0 - (x * y)))
                                    else
                                        tmp = x
                                    end if
                                    code = tmp
                                end function
                                
                                public static double code(double x, double y, double z) {
                                	double tmp;
                                	if (z <= -420.0) {
                                		tmp = x + (-1.0 / x);
                                	} else if (z <= 1.8e-16) {
                                		tmp = x + (y / (1.1283791670955126 - (x * y)));
                                	} else {
                                		tmp = x;
                                	}
                                	return tmp;
                                }
                                
                                def code(x, y, z):
                                	tmp = 0
                                	if z <= -420.0:
                                		tmp = x + (-1.0 / x)
                                	elif z <= 1.8e-16:
                                		tmp = x + (y / (1.1283791670955126 - (x * y)))
                                	else:
                                		tmp = x
                                	return tmp
                                
                                function code(x, y, z)
                                	tmp = 0.0
                                	if (z <= -420.0)
                                		tmp = Float64(x + Float64(-1.0 / x));
                                	elseif (z <= 1.8e-16)
                                		tmp = Float64(x + Float64(y / Float64(1.1283791670955126 - Float64(x * y))));
                                	else
                                		tmp = x;
                                	end
                                	return tmp
                                end
                                
                                function tmp_2 = code(x, y, z)
                                	tmp = 0.0;
                                	if (z <= -420.0)
                                		tmp = x + (-1.0 / x);
                                	elseif (z <= 1.8e-16)
                                		tmp = x + (y / (1.1283791670955126 - (x * y)));
                                	else
                                		tmp = x;
                                	end
                                	tmp_2 = tmp;
                                end
                                
                                code[x_, y_, z_] := If[LessEqual[z, -420.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e-16], N[(x + N[(y / N[(1.1283791670955126 - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                \mathbf{if}\;z \leq -420:\\
                                \;\;\;\;x + \frac{-1}{x}\\
                                
                                \mathbf{elif}\;z \leq 1.8 \cdot 10^{-16}:\\
                                \;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;x\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 3 regimes
                                2. if z < -420

                                  1. Initial program 86.4%

                                    \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                                  2. Add Preprocessing
                                  3. Taylor expanded in x around inf

                                    \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
                                  4. Step-by-step derivation
                                    1. Applied rewrites100.0%

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

                                    if -420 < z < 1.79999999999999991e-16

                                    1. Initial program 99.8%

                                      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                                    2. Add Preprocessing
                                    3. Taylor expanded in z around 0

                                      \[\leadsto x + \frac{y}{\color{blue}{\frac{5641895835477563}{5000000000000000}} - x \cdot y} \]
                                    4. Step-by-step derivation
                                      1. Applied rewrites98.4%

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

                                      if 1.79999999999999991e-16 < z

                                      1. Initial program 91.2%

                                        \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                                      2. Add Preprocessing
                                      3. Taylor expanded in x around inf

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

                                          \[\leadsto \color{blue}{x} \]
                                      5. Recombined 3 regimes into one program.
                                      6. Add Preprocessing

                                      Alternative 7: 74.0% accurate, 5.1× speedup?

                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.5 \cdot 10^{-36}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.75 \cdot 10^{-88}:\\ \;\;\;\;\frac{-1}{x}\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-143}:\\ \;\;\;\;\mathsf{fma}\left(0.8862269254527579, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
                                      (FPCore (x y z)
                                       :precision binary64
                                       (if (<= x -3.5e-36)
                                         x
                                         (if (<= x -1.75e-88)
                                           (/ -1.0 x)
                                           (if (<= x 4.5e-143) (fma 0.8862269254527579 y x) x))))
                                      double code(double x, double y, double z) {
                                      	double tmp;
                                      	if (x <= -3.5e-36) {
                                      		tmp = x;
                                      	} else if (x <= -1.75e-88) {
                                      		tmp = -1.0 / x;
                                      	} else if (x <= 4.5e-143) {
                                      		tmp = fma(0.8862269254527579, y, x);
                                      	} else {
                                      		tmp = x;
                                      	}
                                      	return tmp;
                                      }
                                      
                                      function code(x, y, z)
                                      	tmp = 0.0
                                      	if (x <= -3.5e-36)
                                      		tmp = x;
                                      	elseif (x <= -1.75e-88)
                                      		tmp = Float64(-1.0 / x);
                                      	elseif (x <= 4.5e-143)
                                      		tmp = fma(0.8862269254527579, y, x);
                                      	else
                                      		tmp = x;
                                      	end
                                      	return tmp
                                      end
                                      
                                      code[x_, y_, z_] := If[LessEqual[x, -3.5e-36], x, If[LessEqual[x, -1.75e-88], N[(-1.0 / x), $MachinePrecision], If[LessEqual[x, 4.5e-143], N[(0.8862269254527579 * y + x), $MachinePrecision], x]]]
                                      
                                      \begin{array}{l}
                                      
                                      \\
                                      \begin{array}{l}
                                      \mathbf{if}\;x \leq -3.5 \cdot 10^{-36}:\\
                                      \;\;\;\;x\\
                                      
                                      \mathbf{elif}\;x \leq -1.75 \cdot 10^{-88}:\\
                                      \;\;\;\;\frac{-1}{x}\\
                                      
                                      \mathbf{elif}\;x \leq 4.5 \cdot 10^{-143}:\\
                                      \;\;\;\;\mathsf{fma}\left(0.8862269254527579, y, x\right)\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;x\\
                                      
                                      
                                      \end{array}
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 3 regimes
                                      2. if x < -3.5e-36 or 4.5e-143 < x

                                        1. Initial program 96.4%

                                          \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                                        2. Add Preprocessing
                                        3. Taylor expanded in x around inf

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

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

                                          if -3.5e-36 < x < -1.7500000000000001e-88

                                          1. Initial program 91.7%

                                            \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                                          2. Add Preprocessing
                                          3. Taylor expanded in x around inf

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

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

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

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

                                              if -1.7500000000000001e-88 < x < 4.5e-143

                                              1. Initial program 89.3%

                                                \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                                              2. Add Preprocessing
                                              3. Taylor expanded in y around 0

                                                \[\leadsto \color{blue}{x + \frac{5000000000000000}{5641895835477563} \cdot \frac{y}{e^{z}}} \]
                                              4. Step-by-step derivation
                                                1. Applied rewrites67.3%

                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{0.8862269254527579}{e^{z}}, y, x\right)} \]
                                                2. Taylor expanded in z around 0

                                                  \[\leadsto \mathsf{fma}\left(\frac{5000000000000000}{5641895835477563}, y, x\right) \]
                                                3. Step-by-step derivation
                                                  1. Applied rewrites48.2%

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

                                                Alternative 8: 73.6% accurate, 6.7× speedup?

                                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.4 \cdot 10^{-17}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-143}:\\ \;\;\;\;\mathsf{fma}\left(0.8862269254527579, y, x\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
                                                (FPCore (x y z)
                                                 :precision binary64
                                                 (if (<= x -3.4e-17) x (if (<= x 4.5e-143) (fma 0.8862269254527579 y x) x)))
                                                double code(double x, double y, double z) {
                                                	double tmp;
                                                	if (x <= -3.4e-17) {
                                                		tmp = x;
                                                	} else if (x <= 4.5e-143) {
                                                		tmp = fma(0.8862269254527579, y, x);
                                                	} else {
                                                		tmp = x;
                                                	}
                                                	return tmp;
                                                }
                                                
                                                function code(x, y, z)
                                                	tmp = 0.0
                                                	if (x <= -3.4e-17)
                                                		tmp = x;
                                                	elseif (x <= 4.5e-143)
                                                		tmp = fma(0.8862269254527579, y, x);
                                                	else
                                                		tmp = x;
                                                	end
                                                	return tmp
                                                end
                                                
                                                code[x_, y_, z_] := If[LessEqual[x, -3.4e-17], x, If[LessEqual[x, 4.5e-143], N[(0.8862269254527579 * y + x), $MachinePrecision], x]]
                                                
                                                \begin{array}{l}
                                                
                                                \\
                                                \begin{array}{l}
                                                \mathbf{if}\;x \leq -3.4 \cdot 10^{-17}:\\
                                                \;\;\;\;x\\
                                                
                                                \mathbf{elif}\;x \leq 4.5 \cdot 10^{-143}:\\
                                                \;\;\;\;\mathsf{fma}\left(0.8862269254527579, y, x\right)\\
                                                
                                                \mathbf{else}:\\
                                                \;\;\;\;x\\
                                                
                                                
                                                \end{array}
                                                \end{array}
                                                
                                                Derivation
                                                1. Split input into 2 regimes
                                                2. if x < -3.3999999999999998e-17 or 4.5e-143 < x

                                                  1. Initial program 96.2%

                                                    \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                                                  2. Add Preprocessing
                                                  3. Taylor expanded in x around inf

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

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

                                                    if -3.3999999999999998e-17 < x < 4.5e-143

                                                    1. Initial program 90.6%

                                                      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                                                    2. Add Preprocessing
                                                    3. Taylor expanded in y around 0

                                                      \[\leadsto \color{blue}{x + \frac{5000000000000000}{5641895835477563} \cdot \frac{y}{e^{z}}} \]
                                                    4. Step-by-step derivation
                                                      1. Applied rewrites61.5%

                                                        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{0.8862269254527579}{e^{z}}, y, x\right)} \]
                                                      2. Taylor expanded in z around 0

                                                        \[\leadsto \mathsf{fma}\left(\frac{5000000000000000}{5641895835477563}, y, x\right) \]
                                                      3. Step-by-step derivation
                                                        1. Applied rewrites46.9%

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

                                                      Alternative 9: 70.2% accurate, 128.0× speedup?

                                                      \[\begin{array}{l} \\ x \end{array} \]
                                                      (FPCore (x y z) :precision binary64 x)
                                                      double code(double x, double y, double z) {
                                                      	return x;
                                                      }
                                                      
                                                      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, y, z)
                                                      use fmin_fmax_functions
                                                          real(8), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          real(8), intent (in) :: z
                                                          code = x
                                                      end function
                                                      
                                                      public static double code(double x, double y, double z) {
                                                      	return x;
                                                      }
                                                      
                                                      def code(x, y, z):
                                                      	return x
                                                      
                                                      function code(x, y, z)
                                                      	return x
                                                      end
                                                      
                                                      function tmp = code(x, y, z)
                                                      	tmp = x;
                                                      end
                                                      
                                                      code[x_, y_, z_] := x
                                                      
                                                      \begin{array}{l}
                                                      
                                                      \\
                                                      x
                                                      \end{array}
                                                      
                                                      Derivation
                                                      1. Initial program 94.2%

                                                        \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
                                                      2. Add Preprocessing
                                                      3. Taylor expanded in x around inf

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

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

                                                        Developer Target 1: 99.9% accurate, 1.0× speedup?

                                                        \[\begin{array}{l} \\ x + \frac{1}{\frac{1.1283791670955126}{y} \cdot e^{z} - x} \end{array} \]
                                                        (FPCore (x y z)
                                                         :precision binary64
                                                         (+ x (/ 1.0 (- (* (/ 1.1283791670955126 y) (exp z)) x))))
                                                        double code(double x, double y, double z) {
                                                        	return x + (1.0 / (((1.1283791670955126 / y) * exp(z)) - x));
                                                        }
                                                        
                                                        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, y, z)
                                                        use fmin_fmax_functions
                                                            real(8), intent (in) :: x
                                                            real(8), intent (in) :: y
                                                            real(8), intent (in) :: z
                                                            code = x + (1.0d0 / (((1.1283791670955126d0 / y) * exp(z)) - x))
                                                        end function
                                                        
                                                        public static double code(double x, double y, double z) {
                                                        	return x + (1.0 / (((1.1283791670955126 / y) * Math.exp(z)) - x));
                                                        }
                                                        
                                                        def code(x, y, z):
                                                        	return x + (1.0 / (((1.1283791670955126 / y) * math.exp(z)) - x))
                                                        
                                                        function code(x, y, z)
                                                        	return Float64(x + Float64(1.0 / Float64(Float64(Float64(1.1283791670955126 / y) * exp(z)) - x)))
                                                        end
                                                        
                                                        function tmp = code(x, y, z)
                                                        	tmp = x + (1.0 / (((1.1283791670955126 / y) * exp(z)) - x));
                                                        end
                                                        
                                                        code[x_, y_, z_] := N[(x + N[(1.0 / N[(N[(N[(1.1283791670955126 / y), $MachinePrecision] * N[Exp[z], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                                                        
                                                        \begin{array}{l}
                                                        
                                                        \\
                                                        x + \frac{1}{\frac{1.1283791670955126}{y} \cdot e^{z} - x}
                                                        \end{array}
                                                        

                                                        Reproduce

                                                        ?
                                                        herbie shell --seed 2025021 
                                                        (FPCore (x y z)
                                                          :name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A"
                                                          :precision binary64
                                                        
                                                          :alt
                                                          (! :herbie-platform default (+ x (/ 1 (- (* (/ 5641895835477563/5000000000000000 y) (exp z)) x))))
                                                        
                                                          (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))