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

Percentage Accurate: 95.3% → 99.9%
Time: 3.9s
Alternatives: 11
Speedup: 3.7×

Specification

?
\[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
(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]
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}

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

\[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
(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]
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}

Alternative 1: 99.9% accurate, 0.9× speedup?

\[\begin{array}{l} \mathbf{if}\;z \leq -145:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{y \cdot \left(1.1283791670955126 \cdot \frac{e^{z}}{y} - x\right)}\\ \end{array} \]
(FPCore (x y z)
  :precision binary64
  (if (<= z -145.0)
  (+ x (/ -1.0 x))
  (+ x (/ y (* y (- (* 1.1283791670955126 (/ (exp z) y)) x))))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -145.0) {
		tmp = x + (-1.0 / x);
	} else {
		tmp = x + (y / (y * ((1.1283791670955126 * (exp(z) / y)) - 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 <= (-145.0d0)) then
        tmp = x + ((-1.0d0) / x)
    else
        tmp = x + (y / (y * ((1.1283791670955126d0 * (exp(z) / y)) - x)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -145.0) {
		tmp = x + (-1.0 / x);
	} else {
		tmp = x + (y / (y * ((1.1283791670955126 * (Math.exp(z) / y)) - x)));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -145.0:
		tmp = x + (-1.0 / x)
	else:
		tmp = x + (y / (y * ((1.1283791670955126 * (math.exp(z) / y)) - x)))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -145.0)
		tmp = Float64(x + Float64(-1.0 / x));
	else
		tmp = Float64(x + Float64(y / Float64(y * Float64(Float64(1.1283791670955126 * Float64(exp(z) / y)) - x))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -145.0)
		tmp = x + (-1.0 / x);
	else
		tmp = x + (y / (y * ((1.1283791670955126 * (exp(z) / y)) - x)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -145.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(y * N[(N[(1.1283791670955126 * N[(N[Exp[z], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z \leq -145:\\
\;\;\;\;x + \frac{-1}{x}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{y}{y \cdot \left(1.1283791670955126 \cdot \frac{e^{z}}{y} - x\right)}\\


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

    1. Initial program 95.3%

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

      \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
    3. Step-by-step derivation
      1. lower-/.f6468.8%

        \[\leadsto x + \frac{-1}{\color{blue}{x}} \]
    4. Applied rewrites68.8%

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

    if -145 < z

    1. Initial program 95.3%

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

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

        \[\leadsto x + \frac{y}{y \cdot \color{blue}{\left(\frac{5641895835477563}{5000000000000000} \cdot \frac{e^{z}}{y} - x\right)}} \]
      2. lower--.f64N/A

        \[\leadsto x + \frac{y}{y \cdot \left(\frac{5641895835477563}{5000000000000000} \cdot \frac{e^{z}}{y} - \color{blue}{x}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto x + \frac{y}{y \cdot \left(\frac{5641895835477563}{5000000000000000} \cdot \frac{e^{z}}{y} - x\right)} \]
      4. lower-/.f64N/A

        \[\leadsto x + \frac{y}{y \cdot \left(\frac{5641895835477563}{5000000000000000} \cdot \frac{e^{z}}{y} - x\right)} \]
      5. lower-exp.f6497.0%

        \[\leadsto x + \frac{y}{y \cdot \left(1.1283791670955126 \cdot \frac{e^{z}}{y} - x\right)} \]
    4. Applied rewrites97.0%

      \[\leadsto x + \frac{y}{\color{blue}{y \cdot \left(1.1283791670955126 \cdot \frac{e^{z}}{y} - x\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 99.7% accurate, 1.0× speedup?

\[\begin{array}{l} \mathbf{if}\;z \leq -0.038:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 1.65:\\ \;\;\;\;x + \frac{y}{\left(1.1283791670955126 + z \cdot \left(1.1283791670955126 + z \cdot \left(0.5641895835477563 + 0.18806319451591877 \cdot z\right)\right)\right) - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\left(0.8862269254527579 \cdot y\right) \cdot e^{-z} + x\\ \end{array} \]
(FPCore (x y z)
  :precision binary64
  (if (<= z -0.038)
  (+ x (/ -1.0 x))
  (if (<= z 1.65)
    (+
     x
     (/
      y
      (-
       (+
        1.1283791670955126
        (*
         z
         (+
          1.1283791670955126
          (* z (+ 0.5641895835477563 (* 0.18806319451591877 z))))))
       (* x y))))
    (+ (* (* 0.8862269254527579 y) (exp (- z))) x))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.038) {
		tmp = x + (-1.0 / x);
	} else if (z <= 1.65) {
		tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (0.18806319451591877 * z)))))) - (x * y)));
	} else {
		tmp = ((0.8862269254527579 * y) * exp(-z)) + 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 <= (-0.038d0)) then
        tmp = x + ((-1.0d0) / x)
    else if (z <= 1.65d0) then
        tmp = x + (y / ((1.1283791670955126d0 + (z * (1.1283791670955126d0 + (z * (0.5641895835477563d0 + (0.18806319451591877d0 * z)))))) - (x * y)))
    else
        tmp = ((0.8862269254527579d0 * y) * exp(-z)) + x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.038) {
		tmp = x + (-1.0 / x);
	} else if (z <= 1.65) {
		tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (0.18806319451591877 * z)))))) - (x * y)));
	} else {
		tmp = ((0.8862269254527579 * y) * Math.exp(-z)) + x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -0.038:
		tmp = x + (-1.0 / x)
	elif z <= 1.65:
		tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (0.18806319451591877 * z)))))) - (x * y)))
	else:
		tmp = ((0.8862269254527579 * y) * math.exp(-z)) + x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -0.038)
		tmp = Float64(x + Float64(-1.0 / x));
	elseif (z <= 1.65)
		tmp = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 + Float64(z * Float64(1.1283791670955126 + Float64(z * Float64(0.5641895835477563 + Float64(0.18806319451591877 * z)))))) - Float64(x * y))));
	else
		tmp = Float64(Float64(Float64(0.8862269254527579 * y) * exp(Float64(-z))) + x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -0.038)
		tmp = x + (-1.0 / x);
	elseif (z <= 1.65)
		tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (0.18806319451591877 * z)))))) - (x * y)));
	else
		tmp = ((0.8862269254527579 * y) * exp(-z)) + x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -0.038], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.65], N[(x + N[(y / N[(N[(1.1283791670955126 + N[(z * N[(1.1283791670955126 + N[(z * N[(0.5641895835477563 + N[(0.18806319451591877 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.8862269254527579 * y), $MachinePrecision] * N[Exp[(-z)], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -0.038:\\
\;\;\;\;x + \frac{-1}{x}\\

\mathbf{elif}\;z \leq 1.65:\\
\;\;\;\;x + \frac{y}{\left(1.1283791670955126 + z \cdot \left(1.1283791670955126 + z \cdot \left(0.5641895835477563 + 0.18806319451591877 \cdot z\right)\right)\right) - x \cdot y}\\

\mathbf{else}:\\
\;\;\;\;\left(0.8862269254527579 \cdot y\right) \cdot e^{-z} + x\\


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

    1. Initial program 95.3%

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

      \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
    3. Step-by-step derivation
      1. lower-/.f6468.8%

        \[\leadsto x + \frac{-1}{\color{blue}{x}} \]
    4. Applied rewrites68.8%

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

    if -0.037999999999999999 < z < 1.6499999999999999

    1. Initial program 95.3%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. 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} \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto x + \frac{y}{\left(\frac{5641895835477563}{5000000000000000} + \color{blue}{z \cdot \left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{10000000000000000} + \frac{5641895835477563}{30000000000000000} \cdot z\right)\right)}\right) - x \cdot y} \]
      2. lower-*.f64N/A

        \[\leadsto x + \frac{y}{\left(\frac{5641895835477563}{5000000000000000} + z \cdot \color{blue}{\left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{10000000000000000} + \frac{5641895835477563}{30000000000000000} \cdot z\right)\right)}\right) - x \cdot y} \]
      3. lower-+.f64N/A

        \[\leadsto x + \frac{y}{\left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{5000000000000000} + \color{blue}{z \cdot \left(\frac{5641895835477563}{10000000000000000} + \frac{5641895835477563}{30000000000000000} \cdot z\right)}\right)\right) - x \cdot y} \]
      4. lower-*.f64N/A

        \[\leadsto x + \frac{y}{\left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{5000000000000000} + z \cdot \color{blue}{\left(\frac{5641895835477563}{10000000000000000} + \frac{5641895835477563}{30000000000000000} \cdot z\right)}\right)\right) - x \cdot y} \]
      5. lower-+.f64N/A

        \[\leadsto x + \frac{y}{\left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{10000000000000000} + \color{blue}{\frac{5641895835477563}{30000000000000000} \cdot z}\right)\right)\right) - x \cdot y} \]
      6. lower-*.f6483.9%

        \[\leadsto x + \frac{y}{\left(1.1283791670955126 + z \cdot \left(1.1283791670955126 + z \cdot \left(0.5641895835477563 + 0.18806319451591877 \cdot \color{blue}{z}\right)\right)\right) - x \cdot y} \]
    4. Applied rewrites83.9%

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

    if 1.6499999999999999 < z

    1. Initial program 95.3%

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

      \[\leadsto x + \color{blue}{\frac{5000000000000000}{5641895835477563} \cdot \frac{y}{e^{z}}} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto x + \frac{5000000000000000}{5641895835477563} \cdot \color{blue}{\frac{y}{e^{z}}} \]
      2. lower-/.f64N/A

        \[\leadsto x + \frac{5000000000000000}{5641895835477563} \cdot \frac{y}{\color{blue}{e^{z}}} \]
      3. lower-exp.f6463.4%

        \[\leadsto x + 0.8862269254527579 \cdot \frac{y}{e^{z}} \]
    4. Applied rewrites63.4%

      \[\leadsto x + \color{blue}{0.8862269254527579 \cdot \frac{y}{e^{z}}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{x + \frac{5000000000000000}{5641895835477563} \cdot \frac{y}{e^{z}}} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{5000000000000000}{5641895835477563} \cdot \frac{y}{e^{z}} + x} \]
      3. lower-+.f6463.4%

        \[\leadsto \color{blue}{0.8862269254527579 \cdot \frac{y}{e^{z}} + x} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{5000000000000000}{5641895835477563} \cdot \color{blue}{\frac{y}{e^{z}}} + x \]
      5. lift-/.f64N/A

        \[\leadsto \frac{5000000000000000}{5641895835477563} \cdot \frac{y}{\color{blue}{e^{z}}} + x \]
      6. associate-*r/N/A

        \[\leadsto \frac{\frac{5000000000000000}{5641895835477563} \cdot y}{\color{blue}{e^{z}}} + x \]
      7. mult-flipN/A

        \[\leadsto \left(\frac{5000000000000000}{5641895835477563} \cdot y\right) \cdot \color{blue}{\frac{1}{e^{z}}} + x \]
      8. lift-exp.f64N/A

        \[\leadsto \left(\frac{5000000000000000}{5641895835477563} \cdot y\right) \cdot \frac{1}{e^{z}} + x \]
      9. rec-expN/A

        \[\leadsto \left(\frac{5000000000000000}{5641895835477563} \cdot y\right) \cdot e^{\mathsf{neg}\left(z\right)} + x \]
      10. lower-*.f64N/A

        \[\leadsto \left(\frac{5000000000000000}{5641895835477563} \cdot y\right) \cdot \color{blue}{e^{\mathsf{neg}\left(z\right)}} + x \]
      11. lower-*.f64N/A

        \[\leadsto \left(\frac{5000000000000000}{5641895835477563} \cdot y\right) \cdot e^{\color{blue}{\mathsf{neg}\left(z\right)}} + x \]
      12. lower-exp.f64N/A

        \[\leadsto \left(\frac{5000000000000000}{5641895835477563} \cdot y\right) \cdot e^{\mathsf{neg}\left(z\right)} + x \]
      13. lower-neg.f6463.4%

        \[\leadsto \left(0.8862269254527579 \cdot y\right) \cdot e^{-z} + x \]
    6. Applied rewrites63.4%

      \[\leadsto \color{blue}{\left(0.8862269254527579 \cdot y\right) \cdot e^{-z} + x} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 99.7% accurate, 2.2× speedup?

\[\begin{array}{l} \mathbf{if}\;z \leq -0.038:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 24.5:\\ \;\;\;\;x + \frac{y}{\left(1.1283791670955126 + z \cdot \left(1.1283791670955126 + z \cdot \left(0.5641895835477563 + 0.18806319451591877 \cdot z\right)\right)\right) - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot x\\ \end{array} \]
(FPCore (x y z)
  :precision binary64
  (if (<= z -0.038)
  (+ x (/ -1.0 x))
  (if (<= z 24.5)
    (+
     x
     (/
      y
      (-
       (+
        1.1283791670955126
        (*
         z
         (+
          1.1283791670955126
          (* z (+ 0.5641895835477563 (* 0.18806319451591877 z))))))
       (* x y))))
    (* 1.0 x))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.038) {
		tmp = x + (-1.0 / x);
	} else if (z <= 24.5) {
		tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (0.18806319451591877 * z)))))) - (x * y)));
	} else {
		tmp = 1.0 * 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 <= (-0.038d0)) then
        tmp = x + ((-1.0d0) / x)
    else if (z <= 24.5d0) then
        tmp = x + (y / ((1.1283791670955126d0 + (z * (1.1283791670955126d0 + (z * (0.5641895835477563d0 + (0.18806319451591877d0 * z)))))) - (x * y)))
    else
        tmp = 1.0d0 * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -0.038) {
		tmp = x + (-1.0 / x);
	} else if (z <= 24.5) {
		tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (0.18806319451591877 * z)))))) - (x * y)));
	} else {
		tmp = 1.0 * x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -0.038:
		tmp = x + (-1.0 / x)
	elif z <= 24.5:
		tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (0.18806319451591877 * z)))))) - (x * y)))
	else:
		tmp = 1.0 * x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -0.038)
		tmp = Float64(x + Float64(-1.0 / x));
	elseif (z <= 24.5)
		tmp = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 + Float64(z * Float64(1.1283791670955126 + Float64(z * Float64(0.5641895835477563 + Float64(0.18806319451591877 * z)))))) - Float64(x * y))));
	else
		tmp = Float64(1.0 * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -0.038)
		tmp = x + (-1.0 / x);
	elseif (z <= 24.5)
		tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (z * (0.5641895835477563 + (0.18806319451591877 * z)))))) - (x * y)));
	else
		tmp = 1.0 * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -0.038], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 24.5], N[(x + N[(y / N[(N[(1.1283791670955126 + N[(z * N[(1.1283791670955126 + N[(z * N[(0.5641895835477563 + N[(0.18806319451591877 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -0.038:\\
\;\;\;\;x + \frac{-1}{x}\\

\mathbf{elif}\;z \leq 24.5:\\
\;\;\;\;x + \frac{y}{\left(1.1283791670955126 + z \cdot \left(1.1283791670955126 + z \cdot \left(0.5641895835477563 + 0.18806319451591877 \cdot z\right)\right)\right) - x \cdot y}\\

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


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

    1. Initial program 95.3%

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

      \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
    3. Step-by-step derivation
      1. lower-/.f6468.8%

        \[\leadsto x + \frac{-1}{\color{blue}{x}} \]
    4. Applied rewrites68.8%

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

    if -0.037999999999999999 < z < 24.5

    1. Initial program 95.3%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. 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} \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto x + \frac{y}{\left(\frac{5641895835477563}{5000000000000000} + \color{blue}{z \cdot \left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{10000000000000000} + \frac{5641895835477563}{30000000000000000} \cdot z\right)\right)}\right) - x \cdot y} \]
      2. lower-*.f64N/A

        \[\leadsto x + \frac{y}{\left(\frac{5641895835477563}{5000000000000000} + z \cdot \color{blue}{\left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{10000000000000000} + \frac{5641895835477563}{30000000000000000} \cdot z\right)\right)}\right) - x \cdot y} \]
      3. lower-+.f64N/A

        \[\leadsto x + \frac{y}{\left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{5000000000000000} + \color{blue}{z \cdot \left(\frac{5641895835477563}{10000000000000000} + \frac{5641895835477563}{30000000000000000} \cdot z\right)}\right)\right) - x \cdot y} \]
      4. lower-*.f64N/A

        \[\leadsto x + \frac{y}{\left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{5000000000000000} + z \cdot \color{blue}{\left(\frac{5641895835477563}{10000000000000000} + \frac{5641895835477563}{30000000000000000} \cdot z\right)}\right)\right) - x \cdot y} \]
      5. lower-+.f64N/A

        \[\leadsto x + \frac{y}{\left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{10000000000000000} + \color{blue}{\frac{5641895835477563}{30000000000000000} \cdot z}\right)\right)\right) - x \cdot y} \]
      6. lower-*.f6483.9%

        \[\leadsto x + \frac{y}{\left(1.1283791670955126 + z \cdot \left(1.1283791670955126 + z \cdot \left(0.5641895835477563 + 0.18806319451591877 \cdot \color{blue}{z}\right)\right)\right) - x \cdot y} \]
    4. Applied rewrites83.9%

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

    if 24.5 < z

    1. Initial program 95.3%

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

      \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
    3. Step-by-step derivation
      1. lower-/.f6468.8%

        \[\leadsto x + \frac{-1}{\color{blue}{x}} \]
    4. Applied rewrites68.8%

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

        \[\leadsto \color{blue}{x + \frac{-1}{x}} \]
      2. sum-to-multN/A

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

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

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

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

        \[\leadsto \left(\color{blue}{1} + \frac{\frac{-1}{x}}{x}\right) \cdot x \]
      7. lower-unsound-/.f6461.7%

        \[\leadsto \left(1 + \color{blue}{\frac{\frac{-1}{x}}{x}}\right) \cdot x \]
    6. Applied rewrites61.7%

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

      \[\leadsto \color{blue}{1} \cdot x \]
    8. Step-by-step derivation
      1. Applied rewrites68.8%

        \[\leadsto \color{blue}{1} \cdot x \]
    9. Recombined 3 regimes into one program.
    10. Add Preprocessing

    Alternative 4: 99.7% accurate, 2.5× speedup?

    \[\begin{array}{l} \mathbf{if}\;z \leq -220:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 640:\\ \;\;\;\;x + \frac{y}{\left(1.1283791670955126 + z \cdot \left(1.1283791670955126 + 0.5641895835477563 \cdot z\right)\right) - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot x\\ \end{array} \]
    (FPCore (x y z)
      :precision binary64
      (if (<= z -220.0)
      (+ x (/ -1.0 x))
      (if (<= z 640.0)
        (+
         x
         (/
          y
          (-
           (+
            1.1283791670955126
            (* z (+ 1.1283791670955126 (* 0.5641895835477563 z))))
           (* x y))))
        (* 1.0 x))))
    double code(double x, double y, double z) {
    	double tmp;
    	if (z <= -220.0) {
    		tmp = x + (-1.0 / x);
    	} else if (z <= 640.0) {
    		tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (0.5641895835477563 * z)))) - (x * y)));
    	} else {
    		tmp = 1.0 * 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 <= (-220.0d0)) then
            tmp = x + ((-1.0d0) / x)
        else if (z <= 640.0d0) then
            tmp = x + (y / ((1.1283791670955126d0 + (z * (1.1283791670955126d0 + (0.5641895835477563d0 * z)))) - (x * y)))
        else
            tmp = 1.0d0 * x
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z) {
    	double tmp;
    	if (z <= -220.0) {
    		tmp = x + (-1.0 / x);
    	} else if (z <= 640.0) {
    		tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (0.5641895835477563 * z)))) - (x * y)));
    	} else {
    		tmp = 1.0 * x;
    	}
    	return tmp;
    }
    
    def code(x, y, z):
    	tmp = 0
    	if z <= -220.0:
    		tmp = x + (-1.0 / x)
    	elif z <= 640.0:
    		tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (0.5641895835477563 * z)))) - (x * y)))
    	else:
    		tmp = 1.0 * x
    	return tmp
    
    function code(x, y, z)
    	tmp = 0.0
    	if (z <= -220.0)
    		tmp = Float64(x + Float64(-1.0 / x));
    	elseif (z <= 640.0)
    		tmp = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 + Float64(z * Float64(1.1283791670955126 + Float64(0.5641895835477563 * z)))) - Float64(x * y))));
    	else
    		tmp = Float64(1.0 * x);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z)
    	tmp = 0.0;
    	if (z <= -220.0)
    		tmp = x + (-1.0 / x);
    	elseif (z <= 640.0)
    		tmp = x + (y / ((1.1283791670955126 + (z * (1.1283791670955126 + (0.5641895835477563 * z)))) - (x * y)));
    	else
    		tmp = 1.0 * x;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_] := If[LessEqual[z, -220.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 640.0], N[(x + N[(y / N[(N[(1.1283791670955126 + N[(z * N[(1.1283791670955126 + N[(0.5641895835477563 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
    
    \begin{array}{l}
    \mathbf{if}\;z \leq -220:\\
    \;\;\;\;x + \frac{-1}{x}\\
    
    \mathbf{elif}\;z \leq 640:\\
    \;\;\;\;x + \frac{y}{\left(1.1283791670955126 + z \cdot \left(1.1283791670955126 + 0.5641895835477563 \cdot z\right)\right) - x \cdot y}\\
    
    \mathbf{else}:\\
    \;\;\;\;1 \cdot x\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if z < -220

      1. Initial program 95.3%

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

        \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
      3. Step-by-step derivation
        1. lower-/.f6468.8%

          \[\leadsto x + \frac{-1}{\color{blue}{x}} \]
      4. Applied rewrites68.8%

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

      if -220 < z < 640

      1. Initial program 95.3%

        \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
      2. 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} \]
      3. Step-by-step derivation
        1. lower-+.f64N/A

          \[\leadsto x + \frac{y}{\left(\frac{5641895835477563}{5000000000000000} + \color{blue}{z \cdot \left(\frac{5641895835477563}{5000000000000000} + \frac{5641895835477563}{10000000000000000} \cdot z\right)}\right) - x \cdot y} \]
        2. lower-*.f64N/A

          \[\leadsto x + \frac{y}{\left(\frac{5641895835477563}{5000000000000000} + z \cdot \color{blue}{\left(\frac{5641895835477563}{5000000000000000} + \frac{5641895835477563}{10000000000000000} \cdot z\right)}\right) - x \cdot y} \]
        3. lower-+.f64N/A

          \[\leadsto x + \frac{y}{\left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{5000000000000000} + \color{blue}{\frac{5641895835477563}{10000000000000000} \cdot z}\right)\right) - x \cdot y} \]
        4. lower-*.f6483.2%

          \[\leadsto x + \frac{y}{\left(1.1283791670955126 + z \cdot \left(1.1283791670955126 + 0.5641895835477563 \cdot \color{blue}{z}\right)\right) - x \cdot y} \]
      4. Applied rewrites83.2%

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

      if 640 < z

      1. Initial program 95.3%

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

        \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
      3. Step-by-step derivation
        1. lower-/.f6468.8%

          \[\leadsto x + \frac{-1}{\color{blue}{x}} \]
      4. Applied rewrites68.8%

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

          \[\leadsto \color{blue}{x + \frac{-1}{x}} \]
        2. sum-to-multN/A

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

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

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

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

          \[\leadsto \left(\color{blue}{1} + \frac{\frac{-1}{x}}{x}\right) \cdot x \]
        7. lower-unsound-/.f6461.7%

          \[\leadsto \left(1 + \color{blue}{\frac{\frac{-1}{x}}{x}}\right) \cdot x \]
      6. Applied rewrites61.7%

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

        \[\leadsto \color{blue}{1} \cdot x \]
      8. Step-by-step derivation
        1. Applied rewrites68.8%

          \[\leadsto \color{blue}{1} \cdot x \]
      9. Recombined 3 regimes into one program.
      10. Add Preprocessing

      Alternative 5: 99.6% accurate, 3.0× speedup?

      \[\begin{array}{l} \mathbf{if}\;z \leq -0.038:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 640:\\ \;\;\;\;x + \frac{y}{\left(1.1283791670955126 + 1.1283791670955126 \cdot z\right) - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot x\\ \end{array} \]
      (FPCore (x y z)
        :precision binary64
        (if (<= z -0.038)
        (+ x (/ -1.0 x))
        (if (<= z 640.0)
          (+
           x
           (/
            y
            (- (+ 1.1283791670955126 (* 1.1283791670955126 z)) (* x y))))
          (* 1.0 x))))
      double code(double x, double y, double z) {
      	double tmp;
      	if (z <= -0.038) {
      		tmp = x + (-1.0 / x);
      	} else if (z <= 640.0) {
      		tmp = x + (y / ((1.1283791670955126 + (1.1283791670955126 * z)) - (x * y)));
      	} else {
      		tmp = 1.0 * 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 <= (-0.038d0)) then
              tmp = x + ((-1.0d0) / x)
          else if (z <= 640.0d0) then
              tmp = x + (y / ((1.1283791670955126d0 + (1.1283791670955126d0 * z)) - (x * y)))
          else
              tmp = 1.0d0 * x
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double tmp;
      	if (z <= -0.038) {
      		tmp = x + (-1.0 / x);
      	} else if (z <= 640.0) {
      		tmp = x + (y / ((1.1283791670955126 + (1.1283791670955126 * z)) - (x * y)));
      	} else {
      		tmp = 1.0 * x;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	tmp = 0
      	if z <= -0.038:
      		tmp = x + (-1.0 / x)
      	elif z <= 640.0:
      		tmp = x + (y / ((1.1283791670955126 + (1.1283791670955126 * z)) - (x * y)))
      	else:
      		tmp = 1.0 * x
      	return tmp
      
      function code(x, y, z)
      	tmp = 0.0
      	if (z <= -0.038)
      		tmp = Float64(x + Float64(-1.0 / x));
      	elseif (z <= 640.0)
      		tmp = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 + Float64(1.1283791670955126 * z)) - Float64(x * y))));
      	else
      		tmp = Float64(1.0 * x);
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	tmp = 0.0;
      	if (z <= -0.038)
      		tmp = x + (-1.0 / x);
      	elseif (z <= 640.0)
      		tmp = x + (y / ((1.1283791670955126 + (1.1283791670955126 * z)) - (x * y)));
      	else
      		tmp = 1.0 * x;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := If[LessEqual[z, -0.038], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 640.0], N[(x + N[(y / N[(N[(1.1283791670955126 + N[(1.1283791670955126 * z), $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
      
      \begin{array}{l}
      \mathbf{if}\;z \leq -0.038:\\
      \;\;\;\;x + \frac{-1}{x}\\
      
      \mathbf{elif}\;z \leq 640:\\
      \;\;\;\;x + \frac{y}{\left(1.1283791670955126 + 1.1283791670955126 \cdot z\right) - x \cdot y}\\
      
      \mathbf{else}:\\
      \;\;\;\;1 \cdot x\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if z < -0.037999999999999999

        1. Initial program 95.3%

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

          \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
        3. Step-by-step derivation
          1. lower-/.f6468.8%

            \[\leadsto x + \frac{-1}{\color{blue}{x}} \]
        4. Applied rewrites68.8%

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

        if -0.037999999999999999 < z < 640

        1. Initial program 95.3%

          \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
        2. 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} \]
        3. Step-by-step derivation
          1. lower-+.f64N/A

            \[\leadsto x + \frac{y}{\left(\frac{5641895835477563}{5000000000000000} + \color{blue}{\frac{5641895835477563}{5000000000000000} \cdot z}\right) - x \cdot y} \]
          2. lower-*.f6482.0%

            \[\leadsto x + \frac{y}{\left(1.1283791670955126 + 1.1283791670955126 \cdot \color{blue}{z}\right) - x \cdot y} \]
        4. Applied rewrites82.0%

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

        if 640 < z

        1. Initial program 95.3%

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

          \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
        3. Step-by-step derivation
          1. lower-/.f6468.8%

            \[\leadsto x + \frac{-1}{\color{blue}{x}} \]
        4. Applied rewrites68.8%

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

            \[\leadsto \color{blue}{x + \frac{-1}{x}} \]
          2. sum-to-multN/A

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

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

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

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

            \[\leadsto \left(\color{blue}{1} + \frac{\frac{-1}{x}}{x}\right) \cdot x \]
          7. lower-unsound-/.f6461.7%

            \[\leadsto \left(1 + \color{blue}{\frac{\frac{-1}{x}}{x}}\right) \cdot x \]
        6. Applied rewrites61.7%

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

          \[\leadsto \color{blue}{1} \cdot x \]
        8. Step-by-step derivation
          1. Applied rewrites68.8%

            \[\leadsto \color{blue}{1} \cdot x \]
        9. Recombined 3 regimes into one program.
        10. Add Preprocessing

        Alternative 6: 99.4% accurate, 0.5× speedup?

        \[\begin{array}{l} \mathbf{if}\;x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \leq 10^{+169}:\\ \;\;\;\;x + \frac{1}{\frac{e^{z} \cdot 1.1283791670955126 - y \cdot x}{y}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{-1}{x}\\ \end{array} \]
        (FPCore (x y z)
          :precision binary64
          (if (<= (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))) 1e+169)
          (+ x (/ 1.0 (/ (- (* (exp z) 1.1283791670955126) (* y x)) y)))
          (+ x (/ -1.0 x))))
        double code(double x, double y, double z) {
        	double tmp;
        	if ((x + (y / ((1.1283791670955126 * exp(z)) - (x * y)))) <= 1e+169) {
        		tmp = x + (1.0 / (((exp(z) * 1.1283791670955126) - (y * x)) / y));
        	} else {
        		tmp = x + (-1.0 / 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 ((x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))) <= 1d+169) then
                tmp = x + (1.0d0 / (((exp(z) * 1.1283791670955126d0) - (y * x)) / y))
            else
                tmp = x + ((-1.0d0) / x)
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double tmp;
        	if ((x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)))) <= 1e+169) {
        		tmp = x + (1.0 / (((Math.exp(z) * 1.1283791670955126) - (y * x)) / y));
        	} else {
        		tmp = x + (-1.0 / x);
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	tmp = 0
        	if (x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y)))) <= 1e+169:
        		tmp = x + (1.0 / (((math.exp(z) * 1.1283791670955126) - (y * x)) / y))
        	else:
        		tmp = x + (-1.0 / x)
        	return tmp
        
        function code(x, y, z)
        	tmp = 0.0
        	if (Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y)))) <= 1e+169)
        		tmp = Float64(x + Float64(1.0 / Float64(Float64(Float64(exp(z) * 1.1283791670955126) - Float64(y * x)) / y)));
        	else
        		tmp = Float64(x + Float64(-1.0 / x));
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	tmp = 0.0;
        	if ((x + (y / ((1.1283791670955126 * exp(z)) - (x * y)))) <= 1e+169)
        		tmp = x + (1.0 / (((exp(z) * 1.1283791670955126) - (y * x)) / y));
        	else
        		tmp = x + (-1.0 / x);
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := If[LessEqual[N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+169], N[(x + N[(1.0 / N[(N[(N[(N[Exp[z], $MachinePrecision] * 1.1283791670955126), $MachinePrecision] - N[(y * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        \mathbf{if}\;x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \leq 10^{+169}:\\
        \;\;\;\;x + \frac{1}{\frac{e^{z} \cdot 1.1283791670955126 - y \cdot x}{y}}\\
        
        \mathbf{else}:\\
        \;\;\;\;x + \frac{-1}{x}\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) < 9.9999999999999993e168

          1. Initial program 95.3%

            \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
          2. Step-by-step derivation
            1. lift-/.f64N/A

              \[\leadsto x + \color{blue}{\frac{y}{\frac{5641895835477563}{5000000000000000} \cdot e^{z} - x \cdot y}} \]
            2. div-flipN/A

              \[\leadsto x + \color{blue}{\frac{1}{\frac{\frac{5641895835477563}{5000000000000000} \cdot e^{z} - x \cdot y}{y}}} \]
            3. lower-unsound-/.f64N/A

              \[\leadsto x + \color{blue}{\frac{1}{\frac{\frac{5641895835477563}{5000000000000000} \cdot e^{z} - x \cdot y}{y}}} \]
            4. lower-unsound-/.f6495.4%

              \[\leadsto x + \frac{1}{\color{blue}{\frac{1.1283791670955126 \cdot e^{z} - x \cdot y}{y}}} \]
            5. lift-*.f64N/A

              \[\leadsto x + \frac{1}{\frac{\color{blue}{\frac{5641895835477563}{5000000000000000} \cdot e^{z}} - x \cdot y}{y}} \]
            6. *-commutativeN/A

              \[\leadsto x + \frac{1}{\frac{\color{blue}{e^{z} \cdot \frac{5641895835477563}{5000000000000000}} - x \cdot y}{y}} \]
            7. lower-*.f6495.4%

              \[\leadsto x + \frac{1}{\frac{\color{blue}{e^{z} \cdot 1.1283791670955126} - x \cdot y}{y}} \]
            8. lift-*.f64N/A

              \[\leadsto x + \frac{1}{\frac{e^{z} \cdot \frac{5641895835477563}{5000000000000000} - \color{blue}{x \cdot y}}{y}} \]
            9. *-commutativeN/A

              \[\leadsto x + \frac{1}{\frac{e^{z} \cdot \frac{5641895835477563}{5000000000000000} - \color{blue}{y \cdot x}}{y}} \]
            10. lower-*.f6495.4%

              \[\leadsto x + \frac{1}{\frac{e^{z} \cdot 1.1283791670955126 - \color{blue}{y \cdot x}}{y}} \]
          3. Applied rewrites95.4%

            \[\leadsto x + \color{blue}{\frac{1}{\frac{e^{z} \cdot 1.1283791670955126 - y \cdot x}{y}}} \]

          if 9.9999999999999993e168 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y))))

          1. Initial program 95.3%

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

            \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
          3. Step-by-step derivation
            1. lower-/.f6468.8%

              \[\leadsto x + \frac{-1}{\color{blue}{x}} \]
          4. Applied rewrites68.8%

            \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 7: 97.6% accurate, 0.5× speedup?

        \[\begin{array}{l} t_0 := x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\\ \mathbf{if}\;t\_0 \leq 10^{+169}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;x + \frac{-1}{x}\\ \end{array} \]
        (FPCore (x y z)
          :precision binary64
          (let* ((t_0 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y))))))
          (if (<= t_0 1e+169) t_0 (+ x (/ -1.0 x)))))
        double code(double x, double y, double z) {
        	double t_0 = x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
        	double tmp;
        	if (t_0 <= 1e+169) {
        		tmp = t_0;
        	} else {
        		tmp = x + (-1.0 / 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) :: t_0
            real(8) :: tmp
            t_0 = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
            if (t_0 <= 1d+169) then
                tmp = t_0
            else
                tmp = x + ((-1.0d0) / x)
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z) {
        	double t_0 = x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
        	double tmp;
        	if (t_0 <= 1e+169) {
        		tmp = t_0;
        	} else {
        		tmp = x + (-1.0 / x);
        	}
        	return tmp;
        }
        
        def code(x, y, z):
        	t_0 = x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y)))
        	tmp = 0
        	if t_0 <= 1e+169:
        		tmp = t_0
        	else:
        		tmp = x + (-1.0 / x)
        	return tmp
        
        function code(x, y, z)
        	t_0 = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y))))
        	tmp = 0.0
        	if (t_0 <= 1e+169)
        		tmp = t_0;
        	else
        		tmp = Float64(x + Float64(-1.0 / x));
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z)
        	t_0 = x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
        	tmp = 0.0;
        	if (t_0 <= 1e+169)
        		tmp = t_0;
        	else
        		tmp = x + (-1.0 / x);
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e+169], t$95$0, N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        t_0 := x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\\
        \mathbf{if}\;t\_0 \leq 10^{+169}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{else}:\\
        \;\;\;\;x + \frac{-1}{x}\\
        
        
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) < 9.9999999999999993e168

          1. Initial program 95.3%

            \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]

          if 9.9999999999999993e168 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y))))

          1. Initial program 95.3%

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

            \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
          3. Step-by-step derivation
            1. lower-/.f6468.8%

              \[\leadsto x + \frac{-1}{\color{blue}{x}} \]
          4. Applied rewrites68.8%

            \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 8: 97.5% accurate, 3.7× speedup?

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

          1. Initial program 95.3%

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

            \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
          3. Step-by-step derivation
            1. lower-/.f6468.8%

              \[\leadsto x + \frac{-1}{\color{blue}{x}} \]
          4. Applied rewrites68.8%

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

          if -850 < z < 3.9e5

          1. Initial program 95.3%

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

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

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

            if 3.9e5 < z

            1. Initial program 95.3%

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

              \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
            3. Step-by-step derivation
              1. lower-/.f6468.8%

                \[\leadsto x + \frac{-1}{\color{blue}{x}} \]
            4. Applied rewrites68.8%

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

                \[\leadsto \color{blue}{x + \frac{-1}{x}} \]
              2. sum-to-multN/A

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

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

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

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

                \[\leadsto \left(\color{blue}{1} + \frac{\frac{-1}{x}}{x}\right) \cdot x \]
              7. lower-unsound-/.f6461.7%

                \[\leadsto \left(1 + \color{blue}{\frac{\frac{-1}{x}}{x}}\right) \cdot x \]
            6. Applied rewrites61.7%

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

              \[\leadsto \color{blue}{1} \cdot x \]
            8. Step-by-step derivation
              1. Applied rewrites68.8%

                \[\leadsto \color{blue}{1} \cdot x \]
            9. Recombined 3 regimes into one program.
            10. Add Preprocessing

            Alternative 9: 86.6% accurate, 0.5× speedup?

            \[\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 -2000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 50000:\\ \;\;\;\;1 \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \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 -2000000.0) t_0 (if (<= t_1 50000.0) (* 1.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 <= -2000000.0) {
            		tmp = t_0;
            	} else if (t_1 <= 50000.0) {
            		tmp = 1.0 * x;
            	} 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, y, z)
            use fmin_fmax_functions
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                real(8), intent (in) :: z
                real(8) :: t_0
                real(8) :: t_1
                real(8) :: tmp
                t_0 = x + ((-1.0d0) / x)
                t_1 = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
                if (t_1 <= (-2000000.0d0)) then
                    tmp = t_0
                else if (t_1 <= 50000.0d0) then
                    tmp = 1.0d0 * x
                else
                    tmp = t_0
                end if
                code = tmp
            end function
            
            public static double code(double x, double y, double z) {
            	double t_0 = x + (-1.0 / x);
            	double t_1 = x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
            	double tmp;
            	if (t_1 <= -2000000.0) {
            		tmp = t_0;
            	} else if (t_1 <= 50000.0) {
            		tmp = 1.0 * x;
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            def code(x, y, z):
            	t_0 = x + (-1.0 / x)
            	t_1 = x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y)))
            	tmp = 0
            	if t_1 <= -2000000.0:
            		tmp = t_0
            	elif t_1 <= 50000.0:
            		tmp = 1.0 * 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 <= -2000000.0)
            		tmp = t_0;
            	elseif (t_1 <= 50000.0)
            		tmp = Float64(1.0 * x);
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            function tmp_2 = code(x, y, z)
            	t_0 = x + (-1.0 / x);
            	t_1 = x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
            	tmp = 0.0;
            	if (t_1 <= -2000000.0)
            		tmp = t_0;
            	elseif (t_1 <= 50000.0)
            		tmp = 1.0 * x;
            	else
            		tmp = t_0;
            	end
            	tmp_2 = 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, -2000000.0], t$95$0, If[LessEqual[t$95$1, 50000.0], N[(1.0 * x), $MachinePrecision], t$95$0]]]]
            
            \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 -2000000:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;t\_1 \leq 50000:\\
            \;\;\;\;1 \cdot x\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) < -2e6 or 5e4 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y))))

              1. Initial program 95.3%

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

                \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
              3. Step-by-step derivation
                1. lower-/.f6468.8%

                  \[\leadsto x + \frac{-1}{\color{blue}{x}} \]
              4. Applied rewrites68.8%

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

              if -2e6 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) < 5e4

              1. Initial program 95.3%

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

                \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
              3. Step-by-step derivation
                1. lower-/.f6468.8%

                  \[\leadsto x + \frac{-1}{\color{blue}{x}} \]
              4. Applied rewrites68.8%

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

                  \[\leadsto \color{blue}{x + \frac{-1}{x}} \]
                2. sum-to-multN/A

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

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

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

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

                  \[\leadsto \left(\color{blue}{1} + \frac{\frac{-1}{x}}{x}\right) \cdot x \]
                7. lower-unsound-/.f6461.7%

                  \[\leadsto \left(1 + \color{blue}{\frac{\frac{-1}{x}}{x}}\right) \cdot x \]
              6. Applied rewrites61.7%

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

                \[\leadsto \color{blue}{1} \cdot x \]
              8. Step-by-step derivation
                1. Applied rewrites68.8%

                  \[\leadsto \color{blue}{1} \cdot x \]
              9. Recombined 2 regimes into one program.
              10. Add Preprocessing

              Alternative 10: 72.1% accurate, 6.1× speedup?

              \[\begin{array}{l} \mathbf{if}\;z \leq -9.2 \cdot 10^{-265}:\\ \;\;\;\;1 \cdot x\\ \mathbf{elif}\;z \leq 9.5:\\ \;\;\;\;x + 0.8862269254527579 \cdot y\\ \mathbf{else}:\\ \;\;\;\;1 \cdot x\\ \end{array} \]
              (FPCore (x y z)
                :precision binary64
                (if (<= z -9.2e-265)
                (* 1.0 x)
                (if (<= z 9.5) (+ x (* 0.8862269254527579 y)) (* 1.0 x))))
              double code(double x, double y, double z) {
              	double tmp;
              	if (z <= -9.2e-265) {
              		tmp = 1.0 * x;
              	} else if (z <= 9.5) {
              		tmp = x + (0.8862269254527579 * y);
              	} else {
              		tmp = 1.0 * 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 <= (-9.2d-265)) then
                      tmp = 1.0d0 * x
                  else if (z <= 9.5d0) then
                      tmp = x + (0.8862269254527579d0 * y)
                  else
                      tmp = 1.0d0 * x
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y, double z) {
              	double tmp;
              	if (z <= -9.2e-265) {
              		tmp = 1.0 * x;
              	} else if (z <= 9.5) {
              		tmp = x + (0.8862269254527579 * y);
              	} else {
              		tmp = 1.0 * x;
              	}
              	return tmp;
              }
              
              def code(x, y, z):
              	tmp = 0
              	if z <= -9.2e-265:
              		tmp = 1.0 * x
              	elif z <= 9.5:
              		tmp = x + (0.8862269254527579 * y)
              	else:
              		tmp = 1.0 * x
              	return tmp
              
              function code(x, y, z)
              	tmp = 0.0
              	if (z <= -9.2e-265)
              		tmp = Float64(1.0 * x);
              	elseif (z <= 9.5)
              		tmp = Float64(x + Float64(0.8862269254527579 * y));
              	else
              		tmp = Float64(1.0 * x);
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z)
              	tmp = 0.0;
              	if (z <= -9.2e-265)
              		tmp = 1.0 * x;
              	elseif (z <= 9.5)
              		tmp = x + (0.8862269254527579 * y);
              	else
              		tmp = 1.0 * x;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_] := If[LessEqual[z, -9.2e-265], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 9.5], N[(x + N[(0.8862269254527579 * y), $MachinePrecision]), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
              
              \begin{array}{l}
              \mathbf{if}\;z \leq -9.2 \cdot 10^{-265}:\\
              \;\;\;\;1 \cdot x\\
              
              \mathbf{elif}\;z \leq 9.5:\\
              \;\;\;\;x + 0.8862269254527579 \cdot y\\
              
              \mathbf{else}:\\
              \;\;\;\;1 \cdot x\\
              
              
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if z < -9.1999999999999996e-265 or 9.5 < z

                1. Initial program 95.3%

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

                  \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
                3. Step-by-step derivation
                  1. lower-/.f6468.8%

                    \[\leadsto x + \frac{-1}{\color{blue}{x}} \]
                4. Applied rewrites68.8%

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

                    \[\leadsto \color{blue}{x + \frac{-1}{x}} \]
                  2. sum-to-multN/A

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

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

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

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

                    \[\leadsto \left(\color{blue}{1} + \frac{\frac{-1}{x}}{x}\right) \cdot x \]
                  7. lower-unsound-/.f6461.7%

                    \[\leadsto \left(1 + \color{blue}{\frac{\frac{-1}{x}}{x}}\right) \cdot x \]
                6. Applied rewrites61.7%

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

                  \[\leadsto \color{blue}{1} \cdot x \]
                8. Step-by-step derivation
                  1. Applied rewrites68.8%

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

                  if -9.1999999999999996e-265 < z < 9.5

                  1. Initial program 95.3%

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

                    \[\leadsto x + \color{blue}{\frac{5000000000000000}{5641895835477563} \cdot \frac{y}{e^{z}}} \]
                  3. Step-by-step derivation
                    1. lower-*.f64N/A

                      \[\leadsto x + \frac{5000000000000000}{5641895835477563} \cdot \color{blue}{\frac{y}{e^{z}}} \]
                    2. lower-/.f64N/A

                      \[\leadsto x + \frac{5000000000000000}{5641895835477563} \cdot \frac{y}{\color{blue}{e^{z}}} \]
                    3. lower-exp.f6463.4%

                      \[\leadsto x + 0.8862269254527579 \cdot \frac{y}{e^{z}} \]
                  4. Applied rewrites63.4%

                    \[\leadsto x + \color{blue}{0.8862269254527579 \cdot \frac{y}{e^{z}}} \]
                  5. Taylor expanded in z around 0

                    \[\leadsto x + \frac{5000000000000000}{5641895835477563} \cdot \color{blue}{y} \]
                  6. Step-by-step derivation
                    1. lower-*.f6460.0%

                      \[\leadsto x + 0.8862269254527579 \cdot y \]
                  7. Applied rewrites60.0%

                    \[\leadsto x + 0.8862269254527579 \cdot \color{blue}{y} \]
                9. Recombined 2 regimes into one program.
                10. Add Preprocessing

                Alternative 11: 68.8% accurate, 21.3× speedup?

                \[1 \cdot x \]
                (FPCore (x y z)
                  :precision binary64
                  (* 1.0 x))
                double code(double x, double y, double z) {
                	return 1.0 * 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 = 1.0d0 * x
                end function
                
                public static double code(double x, double y, double z) {
                	return 1.0 * x;
                }
                
                def code(x, y, z):
                	return 1.0 * x
                
                function code(x, y, z)
                	return Float64(1.0 * x)
                end
                
                function tmp = code(x, y, z)
                	tmp = 1.0 * x;
                end
                
                code[x_, y_, z_] := N[(1.0 * x), $MachinePrecision]
                
                1 \cdot x
                
                Derivation
                1. Initial program 95.3%

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

                  \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
                3. Step-by-step derivation
                  1. lower-/.f6468.8%

                    \[\leadsto x + \frac{-1}{\color{blue}{x}} \]
                4. Applied rewrites68.8%

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

                    \[\leadsto \color{blue}{x + \frac{-1}{x}} \]
                  2. sum-to-multN/A

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

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

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

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

                    \[\leadsto \left(\color{blue}{1} + \frac{\frac{-1}{x}}{x}\right) \cdot x \]
                  7. lower-unsound-/.f6461.7%

                    \[\leadsto \left(1 + \color{blue}{\frac{\frac{-1}{x}}{x}}\right) \cdot x \]
                6. Applied rewrites61.7%

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

                  \[\leadsto \color{blue}{1} \cdot x \]
                8. Step-by-step derivation
                  1. Applied rewrites68.8%

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

                  Reproduce

                  ?
                  herbie shell --seed 2025258 
                  (FPCore (x y z)
                    :name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A"
                    :precision binary64
                    (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))