Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A

Percentage Accurate: 87.9% → 99.9%
Time: 4.8s
Alternatives: 12
Speedup: 0.5×

Specification

?
\[\begin{array}{l} \\ \frac{x + y}{1 - \frac{y}{z}} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
	return (x + y) / (1.0 - (y / z));
}
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.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
	return (x + y) / (1.0 - (y / z));
}
def code(x, y, z):
	return (x + y) / (1.0 - (y / z))
function code(x, y, z)
	return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z)))
end
function tmp = code(x, y, z)
	tmp = (x + y) / (1.0 - (y / z));
end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 87.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x + y}{1 - \frac{y}{z}} \end{array} \]
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
double code(double x, double y, double z) {
	return (x + y) / (1.0 - (y / z));
}
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.0d0 - (y / z))
end function
public static double code(double x, double y, double z) {
	return (x + y) / (1.0 - (y / z));
}
def code(x, y, z):
	return (x + y) / (1.0 - (y / z))
function code(x, y, z)
	return Float64(Float64(x + y) / Float64(1.0 - Float64(y / z)))
end
function tmp = code(x, y, z)
	tmp = (x + y) / (1.0 - (y / z));
end
code[x_, y_, z_] := N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x + y}{1 - \frac{y}{z}}
\end{array}

Alternative 1: 99.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x + y}{1 - \frac{y}{z}}\\ t_1 := \frac{z}{z - y} \cdot \left(y + x\right)\\ \mathbf{if}\;t\_0 \leq -5 \cdot 10^{-305}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\left(-1 - \frac{x}{y - z}\right) \cdot z\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (+ x y) (- 1.0 (/ y z)))) (t_1 (* (/ z (- z y)) (+ y x))))
   (if (<= t_0 -5e-305)
     t_1
     (if (<= t_0 0.0) (* (- -1.0 (/ x (- y z))) z) t_1))))
double code(double x, double y, double z) {
	double t_0 = (x + y) / (1.0 - (y / z));
	double t_1 = (z / (z - y)) * (y + x);
	double tmp;
	if (t_0 <= -5e-305) {
		tmp = t_1;
	} else if (t_0 <= 0.0) {
		tmp = (-1.0 - (x / (y - z))) * z;
	} else {
		tmp = t_1;
	}
	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 + y) / (1.0d0 - (y / z))
    t_1 = (z / (z - y)) * (y + x)
    if (t_0 <= (-5d-305)) then
        tmp = t_1
    else if (t_0 <= 0.0d0) then
        tmp = ((-1.0d0) - (x / (y - z))) * z
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (x + y) / (1.0 - (y / z));
	double t_1 = (z / (z - y)) * (y + x);
	double tmp;
	if (t_0 <= -5e-305) {
		tmp = t_1;
	} else if (t_0 <= 0.0) {
		tmp = (-1.0 - (x / (y - z))) * z;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x + y) / (1.0 - (y / z))
	t_1 = (z / (z - y)) * (y + x)
	tmp = 0
	if t_0 <= -5e-305:
		tmp = t_1
	elif t_0 <= 0.0:
		tmp = (-1.0 - (x / (y - z))) * z
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x + y) / Float64(1.0 - Float64(y / z)))
	t_1 = Float64(Float64(z / Float64(z - y)) * Float64(y + x))
	tmp = 0.0
	if (t_0 <= -5e-305)
		tmp = t_1;
	elseif (t_0 <= 0.0)
		tmp = Float64(Float64(-1.0 - Float64(x / Float64(y - z))) * z);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x + y) / (1.0 - (y / z));
	t_1 = (z / (z - y)) * (y + x);
	tmp = 0.0;
	if (t_0 <= -5e-305)
		tmp = t_1;
	elseif (t_0 <= 0.0)
		tmp = (-1.0 - (x / (y - z))) * z;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + y), $MachinePrecision] / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-305], t$95$1, If[LessEqual[t$95$0, 0.0], N[(N[(-1.0 - N[(x / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
t_1 := \frac{z}{z - y} \cdot \left(y + x\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-305}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left(-1 - \frac{x}{y - z}\right) \cdot z\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < -4.99999999999999985e-305 or 0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z)))

    1. Initial program 87.9%

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

        \[\leadsto \color{blue}{\frac{x + y}{1 - \frac{y}{z}}} \]
      2. mult-flipN/A

        \[\leadsto \color{blue}{\left(x + y\right) \cdot \frac{1}{1 - \frac{y}{z}}} \]
      3. *-commutativeN/A

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

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

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

        \[\leadsto \frac{1}{1 - \color{blue}{\frac{y}{z}}} \cdot \left(x + y\right) \]
      7. sub-to-fractionN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1 \cdot z - y}{z}}} \cdot \left(x + y\right) \]
      8. div-flip-revN/A

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

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

        \[\leadsto \frac{z}{\color{blue}{z} - y} \cdot \left(x + y\right) \]
      11. lower--.f6488.5

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

        \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(x + y\right)} \]
      13. +-commutativeN/A

        \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(y + x\right)} \]
      14. lower-+.f6488.5

        \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(y + x\right)} \]
    3. Applied rewrites88.5%

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

    if -4.99999999999999985e-305 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z))) < 0.0

    1. Initial program 87.9%

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

        \[\leadsto \color{blue}{\frac{x + y}{1 - \frac{y}{z}}} \]
      2. lift-+.f64N/A

        \[\leadsto \frac{\color{blue}{x + y}}{1 - \frac{y}{z}} \]
      3. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{y + x}}{1 - \frac{y}{z}} \]
      4. div-addN/A

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

        \[\leadsto \frac{y}{\color{blue}{1 - \frac{y}{z}}} + \frac{x}{1 - \frac{y}{z}} \]
      6. lift-/.f64N/A

        \[\leadsto \frac{y}{1 - \color{blue}{\frac{y}{z}}} + \frac{x}{1 - \frac{y}{z}} \]
      7. sub-to-fractionN/A

        \[\leadsto \frac{y}{\color{blue}{\frac{1 \cdot z - y}{z}}} + \frac{x}{1 - \frac{y}{z}} \]
      8. associate-/r/N/A

        \[\leadsto \color{blue}{\frac{y}{1 \cdot z - y} \cdot z} + \frac{x}{1 - \frac{y}{z}} \]
      9. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{1 \cdot z - y}, z, \frac{x}{1 - \frac{y}{z}}\right)} \]
      10. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{1 \cdot z - y}}, z, \frac{x}{1 - \frac{y}{z}}\right) \]
      11. *-lft-identityN/A

        \[\leadsto \mathsf{fma}\left(\frac{y}{\color{blue}{z} - y}, z, \frac{x}{1 - \frac{y}{z}}\right) \]
      12. lower--.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{y}{\color{blue}{z - y}}, z, \frac{x}{1 - \frac{y}{z}}\right) \]
      13. lift--.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\frac{y}{z - y}, z, \frac{x}{1 - \color{blue}{\frac{y}{z}}}\right) \]
      15. sub-to-fractionN/A

        \[\leadsto \mathsf{fma}\left(\frac{y}{z - y}, z, \frac{x}{\color{blue}{\frac{1 \cdot z - y}{z}}}\right) \]
      16. associate-/r/N/A

        \[\leadsto \mathsf{fma}\left(\frac{y}{z - y}, z, \color{blue}{\frac{x}{1 \cdot z - y} \cdot z}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{y}{z - y}, z, \color{blue}{\frac{x}{1 \cdot z - y} \cdot z}\right) \]
      18. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{y}{z - y}, z, \color{blue}{\frac{x}{1 \cdot z - y}} \cdot z\right) \]
      19. *-lft-identityN/A

        \[\leadsto \mathsf{fma}\left(\frac{y}{z - y}, z, \frac{x}{\color{blue}{z} - y} \cdot z\right) \]
      20. lower--.f6492.5

        \[\leadsto \mathsf{fma}\left(\frac{y}{z - y}, z, \frac{x}{\color{blue}{z - y}} \cdot z\right) \]
    3. Applied rewrites92.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z - y}, z, \frac{x}{z - y} \cdot z\right)} \]
    4. Taylor expanded in y around inf

      \[\leadsto \mathsf{fma}\left(\color{blue}{-1}, z, \frac{x}{z - y} \cdot z\right) \]
    5. Step-by-step derivation
      1. Applied rewrites62.8%

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

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

          \[\leadsto -1 \cdot z + \color{blue}{\frac{x}{z - y} \cdot z} \]
        3. distribute-rgt-outN/A

          \[\leadsto \color{blue}{z \cdot \left(-1 + \frac{x}{z - y}\right)} \]
        4. *-commutativeN/A

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

          \[\leadsto \color{blue}{\left(-1 + \frac{x}{z - y}\right) \cdot z} \]
        6. add-flipN/A

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

          \[\leadsto \color{blue}{\left(-1 - \left(\mathsf{neg}\left(\frac{x}{z - y}\right)\right)\right)} \cdot z \]
        8. lift-/.f64N/A

          \[\leadsto \left(-1 - \left(\mathsf{neg}\left(\color{blue}{\frac{x}{z - y}}\right)\right)\right) \cdot z \]
        9. distribute-neg-frac2N/A

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

          \[\leadsto \left(-1 - \color{blue}{\frac{x}{\mathsf{neg}\left(\left(z - y\right)\right)}}\right) \cdot z \]
        11. lift--.f64N/A

          \[\leadsto \left(-1 - \frac{x}{\mathsf{neg}\left(\color{blue}{\left(z - y\right)}\right)}\right) \cdot z \]
        12. sub-negate-revN/A

          \[\leadsto \left(-1 - \frac{x}{\color{blue}{y - z}}\right) \cdot z \]
        13. lower--.f6462.8

          \[\leadsto \left(-1 - \frac{x}{\color{blue}{y - z}}\right) \cdot z \]
      3. Applied rewrites62.8%

        \[\leadsto \color{blue}{\left(-1 - \frac{x}{y - z}\right) \cdot z} \]
    6. Recombined 2 regimes into one program.
    7. Add Preprocessing

    Alternative 2: 96.1% accurate, 0.5× speedup?

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

      1. Initial program 87.9%

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

          \[\leadsto \color{blue}{\frac{x + y}{1 - \frac{y}{z}}} \]
        2. lift--.f64N/A

          \[\leadsto \frac{x + y}{\color{blue}{1 - \frac{y}{z}}} \]
        3. lift-/.f64N/A

          \[\leadsto \frac{x + y}{1 - \color{blue}{\frac{y}{z}}} \]
        4. sub-to-fractionN/A

          \[\leadsto \frac{x + y}{\color{blue}{\frac{1 \cdot z - y}{z}}} \]
        5. associate-/r/N/A

          \[\leadsto \color{blue}{\frac{x + y}{1 \cdot z - y} \cdot z} \]
        6. lower-*.f64N/A

          \[\leadsto \color{blue}{\frac{x + y}{1 \cdot z - y} \cdot z} \]
        7. lower-/.f64N/A

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

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

          \[\leadsto \frac{\color{blue}{y + x}}{1 \cdot z - y} \cdot z \]
        10. lower-+.f64N/A

          \[\leadsto \frac{\color{blue}{y + x}}{1 \cdot z - y} \cdot z \]
        11. *-lft-identityN/A

          \[\leadsto \frac{y + x}{\color{blue}{z} - y} \cdot z \]
        12. lower--.f6492.5

          \[\leadsto \frac{y + x}{\color{blue}{z - y}} \cdot z \]
      3. Applied rewrites92.5%

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

      if 2e-276 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z)))

      1. Initial program 87.9%

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

    Alternative 3: 96.1% accurate, 0.5× speedup?

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

      1. Initial program 87.9%

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

          \[\leadsto \color{blue}{\frac{x + y}{1 - \frac{y}{z}}} \]
        2. lift--.f64N/A

          \[\leadsto \frac{x + y}{\color{blue}{1 - \frac{y}{z}}} \]
        3. lift-/.f64N/A

          \[\leadsto \frac{x + y}{1 - \color{blue}{\frac{y}{z}}} \]
        4. sub-to-fractionN/A

          \[\leadsto \frac{x + y}{\color{blue}{\frac{1 \cdot z - y}{z}}} \]
        5. associate-/r/N/A

          \[\leadsto \color{blue}{\frac{x + y}{1 \cdot z - y} \cdot z} \]
        6. lower-*.f64N/A

          \[\leadsto \color{blue}{\frac{x + y}{1 \cdot z - y} \cdot z} \]
        7. lower-/.f64N/A

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

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

          \[\leadsto \frac{\color{blue}{y + x}}{1 \cdot z - y} \cdot z \]
        10. lower-+.f64N/A

          \[\leadsto \frac{\color{blue}{y + x}}{1 \cdot z - y} \cdot z \]
        11. *-lft-identityN/A

          \[\leadsto \frac{y + x}{\color{blue}{z} - y} \cdot z \]
        12. lower--.f6492.5

          \[\leadsto \frac{y + x}{\color{blue}{z - y}} \cdot z \]
      3. Applied rewrites92.5%

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

      if 0.0 < (/.f64 (+.f64 x y) (-.f64 #s(literal 1 binary64) (/.f64 y z)))

      1. Initial program 87.9%

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

          \[\leadsto \color{blue}{\frac{x + y}{1 - \frac{y}{z}}} \]
        2. mult-flipN/A

          \[\leadsto \color{blue}{\left(x + y\right) \cdot \frac{1}{1 - \frac{y}{z}}} \]
        3. *-commutativeN/A

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

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

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

          \[\leadsto \frac{1}{1 - \color{blue}{\frac{y}{z}}} \cdot \left(x + y\right) \]
        7. sub-to-fractionN/A

          \[\leadsto \frac{1}{\color{blue}{\frac{1 \cdot z - y}{z}}} \cdot \left(x + y\right) \]
        8. div-flip-revN/A

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

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

          \[\leadsto \frac{z}{\color{blue}{z} - y} \cdot \left(x + y\right) \]
        11. lower--.f6488.5

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

          \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(x + y\right)} \]
        13. +-commutativeN/A

          \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(y + x\right)} \]
        14. lower-+.f6488.5

          \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(y + x\right)} \]
      3. Applied rewrites88.5%

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

    Alternative 4: 74.9% accurate, 0.5× speedup?

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

      1. Initial program 87.9%

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

          \[\leadsto \color{blue}{\frac{x + y}{1 - \frac{y}{z}}} \]
        2. mult-flipN/A

          \[\leadsto \color{blue}{\left(x + y\right) \cdot \frac{1}{1 - \frac{y}{z}}} \]
        3. *-commutativeN/A

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

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

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

          \[\leadsto \frac{1}{1 - \color{blue}{\frac{y}{z}}} \cdot \left(x + y\right) \]
        7. sub-to-fractionN/A

          \[\leadsto \frac{1}{\color{blue}{\frac{1 \cdot z - y}{z}}} \cdot \left(x + y\right) \]
        8. div-flip-revN/A

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

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

          \[\leadsto \frac{z}{\color{blue}{z} - y} \cdot \left(x + y\right) \]
        11. lower--.f6488.5

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

          \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(x + y\right)} \]
        13. +-commutativeN/A

          \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(y + x\right)} \]
        14. lower-+.f6488.5

          \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(y + x\right)} \]
      3. Applied rewrites88.5%

        \[\leadsto \color{blue}{\frac{z}{z - y} \cdot \left(y + x\right)} \]
      4. Taylor expanded in x around 0

        \[\leadsto \frac{z}{z - y} \cdot \color{blue}{y} \]
      5. Step-by-step derivation
        1. Applied rewrites41.9%

          \[\leadsto \frac{z}{z - y} \cdot \color{blue}{y} \]
        2. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\frac{z}{z - y} \cdot y} \]
          2. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{z}{z - y}} \cdot y \]
          3. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{z \cdot y}{z - y}} \]
          4. associate-/l*N/A

            \[\leadsto \color{blue}{z \cdot \frac{y}{z - y}} \]
          5. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{y}{z - y} \cdot z} \]
          6. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{y}{z - y} \cdot z} \]
          7. lower-/.f6449.6

            \[\leadsto \color{blue}{\frac{y}{z - y}} \cdot z \]
        3. Applied rewrites49.6%

          \[\leadsto \color{blue}{\frac{y}{z - y} \cdot z} \]

        if -3.9000000000000001e73 < y < 4.40000000000000026e-186

        1. Initial program 87.9%

          \[\frac{x + y}{1 - \frac{y}{z}} \]
        2. Taylor expanded in x around inf

          \[\leadsto \color{blue}{\frac{x}{1 - \frac{y}{z}}} \]
        3. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{x}{\color{blue}{1 - \frac{y}{z}}} \]
          2. lower--.f64N/A

            \[\leadsto \frac{x}{1 - \color{blue}{\frac{y}{z}}} \]
          3. lower-/.f6448.9

            \[\leadsto \frac{x}{1 - \frac{y}{\color{blue}{z}}} \]
        4. Applied rewrites48.9%

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

            \[\leadsto \frac{x}{1 - \color{blue}{\frac{y}{z}}} \]
          2. *-inversesN/A

            \[\leadsto \frac{x}{\frac{z}{z} - \frac{\color{blue}{y}}{z}} \]
          3. lift-/.f64N/A

            \[\leadsto \frac{x}{\frac{z}{z} - \frac{y}{\color{blue}{z}}} \]
          4. sub-divN/A

            \[\leadsto \frac{x}{\frac{z - y}{\color{blue}{z}}} \]
          5. lift--.f64N/A

            \[\leadsto \frac{x}{\frac{z - y}{z}} \]
          6. lower-/.f6448.9

            \[\leadsto \frac{x}{\frac{z - y}{\color{blue}{z}}} \]
        6. Applied rewrites48.9%

          \[\leadsto \frac{x}{\frac{z - y}{\color{blue}{z}}} \]

        if 4.40000000000000026e-186 < y < 1e17

        1. Initial program 87.9%

          \[\frac{x + y}{1 - \frac{y}{z}} \]
        2. Taylor expanded in y around 0

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

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

          if 1e17 < y

          1. Initial program 87.9%

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

              \[\leadsto \color{blue}{\frac{x + y}{1 - \frac{y}{z}}} \]
            2. lift-+.f64N/A

              \[\leadsto \frac{\color{blue}{x + y}}{1 - \frac{y}{z}} \]
            3. +-commutativeN/A

              \[\leadsto \frac{\color{blue}{y + x}}{1 - \frac{y}{z}} \]
            4. div-addN/A

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

              \[\leadsto \frac{y}{\color{blue}{1 - \frac{y}{z}}} + \frac{x}{1 - \frac{y}{z}} \]
            6. lift-/.f64N/A

              \[\leadsto \frac{y}{1 - \color{blue}{\frac{y}{z}}} + \frac{x}{1 - \frac{y}{z}} \]
            7. sub-to-fractionN/A

              \[\leadsto \frac{y}{\color{blue}{\frac{1 \cdot z - y}{z}}} + \frac{x}{1 - \frac{y}{z}} \]
            8. associate-/r/N/A

              \[\leadsto \color{blue}{\frac{y}{1 \cdot z - y} \cdot z} + \frac{x}{1 - \frac{y}{z}} \]
            9. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{1 \cdot z - y}, z, \frac{x}{1 - \frac{y}{z}}\right)} \]
            10. lower-/.f64N/A

              \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{y}{1 \cdot z - y}}, z, \frac{x}{1 - \frac{y}{z}}\right) \]
            11. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(\frac{y}{\color{blue}{z} - y}, z, \frac{x}{1 - \frac{y}{z}}\right) \]
            12. lower--.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{y}{\color{blue}{z - y}}, z, \frac{x}{1 - \frac{y}{z}}\right) \]
            13. lift--.f64N/A

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

              \[\leadsto \mathsf{fma}\left(\frac{y}{z - y}, z, \frac{x}{1 - \color{blue}{\frac{y}{z}}}\right) \]
            15. sub-to-fractionN/A

              \[\leadsto \mathsf{fma}\left(\frac{y}{z - y}, z, \frac{x}{\color{blue}{\frac{1 \cdot z - y}{z}}}\right) \]
            16. associate-/r/N/A

              \[\leadsto \mathsf{fma}\left(\frac{y}{z - y}, z, \color{blue}{\frac{x}{1 \cdot z - y} \cdot z}\right) \]
            17. lower-*.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{y}{z - y}, z, \color{blue}{\frac{x}{1 \cdot z - y} \cdot z}\right) \]
            18. lower-/.f64N/A

              \[\leadsto \mathsf{fma}\left(\frac{y}{z - y}, z, \color{blue}{\frac{x}{1 \cdot z - y}} \cdot z\right) \]
            19. *-lft-identityN/A

              \[\leadsto \mathsf{fma}\left(\frac{y}{z - y}, z, \frac{x}{\color{blue}{z} - y} \cdot z\right) \]
            20. lower--.f6492.5

              \[\leadsto \mathsf{fma}\left(\frac{y}{z - y}, z, \frac{x}{\color{blue}{z - y}} \cdot z\right) \]
          3. Applied rewrites92.5%

            \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z - y}, z, \frac{x}{z - y} \cdot z\right)} \]
          4. Taylor expanded in y around inf

            \[\leadsto \mathsf{fma}\left(\color{blue}{-1}, z, \frac{x}{z - y} \cdot z\right) \]
          5. Step-by-step derivation
            1. Applied rewrites62.8%

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

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

                \[\leadsto -1 \cdot z + \color{blue}{\frac{x}{z - y} \cdot z} \]
              3. distribute-rgt-outN/A

                \[\leadsto \color{blue}{z \cdot \left(-1 + \frac{x}{z - y}\right)} \]
              4. *-commutativeN/A

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

                \[\leadsto \color{blue}{\left(-1 + \frac{x}{z - y}\right) \cdot z} \]
              6. add-flipN/A

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

                \[\leadsto \color{blue}{\left(-1 - \left(\mathsf{neg}\left(\frac{x}{z - y}\right)\right)\right)} \cdot z \]
              8. lift-/.f64N/A

                \[\leadsto \left(-1 - \left(\mathsf{neg}\left(\color{blue}{\frac{x}{z - y}}\right)\right)\right) \cdot z \]
              9. distribute-neg-frac2N/A

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

                \[\leadsto \left(-1 - \color{blue}{\frac{x}{\mathsf{neg}\left(\left(z - y\right)\right)}}\right) \cdot z \]
              11. lift--.f64N/A

                \[\leadsto \left(-1 - \frac{x}{\mathsf{neg}\left(\color{blue}{\left(z - y\right)}\right)}\right) \cdot z \]
              12. sub-negate-revN/A

                \[\leadsto \left(-1 - \frac{x}{\color{blue}{y - z}}\right) \cdot z \]
              13. lower--.f6462.8

                \[\leadsto \left(-1 - \frac{x}{\color{blue}{y - z}}\right) \cdot z \]
            3. Applied rewrites62.8%

              \[\leadsto \color{blue}{\left(-1 - \frac{x}{y - z}\right) \cdot z} \]
          6. Recombined 4 regimes into one program.
          7. Add Preprocessing

          Alternative 5: 73.9% accurate, 0.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y}{z - y} \cdot z\\ \mathbf{if}\;y \leq -3.9 \cdot 10^{+73}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{-186}:\\ \;\;\;\;\frac{x}{\frac{z - y}{z}}\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{+20}:\\ \;\;\;\;\frac{x + y}{1}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (x y z)
           :precision binary64
           (let* ((t_0 (* (/ y (- z y)) z)))
             (if (<= y -3.9e+73)
               t_0
               (if (<= y 4.4e-186)
                 (/ x (/ (- z y) z))
                 (if (<= y 4.7e+20) (/ (+ x y) 1.0) t_0)))))
          double code(double x, double y, double z) {
          	double t_0 = (y / (z - y)) * z;
          	double tmp;
          	if (y <= -3.9e+73) {
          		tmp = t_0;
          	} else if (y <= 4.4e-186) {
          		tmp = x / ((z - y) / z);
          	} else if (y <= 4.7e+20) {
          		tmp = (x + y) / 1.0;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(x, 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 = (y / (z - y)) * z
              if (y <= (-3.9d+73)) then
                  tmp = t_0
              else if (y <= 4.4d-186) then
                  tmp = x / ((z - y) / z)
              else if (y <= 4.7d+20) then
                  tmp = (x + y) / 1.0d0
              else
                  tmp = t_0
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z) {
          	double t_0 = (y / (z - y)) * z;
          	double tmp;
          	if (y <= -3.9e+73) {
          		tmp = t_0;
          	} else if (y <= 4.4e-186) {
          		tmp = x / ((z - y) / z);
          	} else if (y <= 4.7e+20) {
          		tmp = (x + y) / 1.0;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          def code(x, y, z):
          	t_0 = (y / (z - y)) * z
          	tmp = 0
          	if y <= -3.9e+73:
          		tmp = t_0
          	elif y <= 4.4e-186:
          		tmp = x / ((z - y) / z)
          	elif y <= 4.7e+20:
          		tmp = (x + y) / 1.0
          	else:
          		tmp = t_0
          	return tmp
          
          function code(x, y, z)
          	t_0 = Float64(Float64(y / Float64(z - y)) * z)
          	tmp = 0.0
          	if (y <= -3.9e+73)
          		tmp = t_0;
          	elseif (y <= 4.4e-186)
          		tmp = Float64(x / Float64(Float64(z - y) / z));
          	elseif (y <= 4.7e+20)
          		tmp = Float64(Float64(x + y) / 1.0);
          	else
          		tmp = t_0;
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z)
          	t_0 = (y / (z - y)) * z;
          	tmp = 0.0;
          	if (y <= -3.9e+73)
          		tmp = t_0;
          	elseif (y <= 4.4e-186)
          		tmp = x / ((z - y) / z);
          	elseif (y <= 4.7e+20)
          		tmp = (x + y) / 1.0;
          	else
          		tmp = t_0;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[y, -3.9e+73], t$95$0, If[LessEqual[y, 4.4e-186], N[(x / N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.7e+20], N[(N[(x + y), $MachinePrecision] / 1.0), $MachinePrecision], t$95$0]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \frac{y}{z - y} \cdot z\\
          \mathbf{if}\;y \leq -3.9 \cdot 10^{+73}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;y \leq 4.4 \cdot 10^{-186}:\\
          \;\;\;\;\frac{x}{\frac{z - y}{z}}\\
          
          \mathbf{elif}\;y \leq 4.7 \cdot 10^{+20}:\\
          \;\;\;\;\frac{x + y}{1}\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if y < -3.9000000000000001e73 or 4.7e20 < y

            1. Initial program 87.9%

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

                \[\leadsto \color{blue}{\frac{x + y}{1 - \frac{y}{z}}} \]
              2. mult-flipN/A

                \[\leadsto \color{blue}{\left(x + y\right) \cdot \frac{1}{1 - \frac{y}{z}}} \]
              3. *-commutativeN/A

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

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

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

                \[\leadsto \frac{1}{1 - \color{blue}{\frac{y}{z}}} \cdot \left(x + y\right) \]
              7. sub-to-fractionN/A

                \[\leadsto \frac{1}{\color{blue}{\frac{1 \cdot z - y}{z}}} \cdot \left(x + y\right) \]
              8. div-flip-revN/A

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

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

                \[\leadsto \frac{z}{\color{blue}{z} - y} \cdot \left(x + y\right) \]
              11. lower--.f6488.5

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

                \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(x + y\right)} \]
              13. +-commutativeN/A

                \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(y + x\right)} \]
              14. lower-+.f6488.5

                \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(y + x\right)} \]
            3. Applied rewrites88.5%

              \[\leadsto \color{blue}{\frac{z}{z - y} \cdot \left(y + x\right)} \]
            4. Taylor expanded in x around 0

              \[\leadsto \frac{z}{z - y} \cdot \color{blue}{y} \]
            5. Step-by-step derivation
              1. Applied rewrites41.9%

                \[\leadsto \frac{z}{z - y} \cdot \color{blue}{y} \]
              2. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \color{blue}{\frac{z}{z - y} \cdot y} \]
                2. lift-/.f64N/A

                  \[\leadsto \color{blue}{\frac{z}{z - y}} \cdot y \]
                3. associate-*l/N/A

                  \[\leadsto \color{blue}{\frac{z \cdot y}{z - y}} \]
                4. associate-/l*N/A

                  \[\leadsto \color{blue}{z \cdot \frac{y}{z - y}} \]
                5. *-commutativeN/A

                  \[\leadsto \color{blue}{\frac{y}{z - y} \cdot z} \]
                6. lower-*.f64N/A

                  \[\leadsto \color{blue}{\frac{y}{z - y} \cdot z} \]
                7. lower-/.f6449.6

                  \[\leadsto \color{blue}{\frac{y}{z - y}} \cdot z \]
              3. Applied rewrites49.6%

                \[\leadsto \color{blue}{\frac{y}{z - y} \cdot z} \]

              if -3.9000000000000001e73 < y < 4.40000000000000026e-186

              1. Initial program 87.9%

                \[\frac{x + y}{1 - \frac{y}{z}} \]
              2. Taylor expanded in x around inf

                \[\leadsto \color{blue}{\frac{x}{1 - \frac{y}{z}}} \]
              3. Step-by-step derivation
                1. lower-/.f64N/A

                  \[\leadsto \frac{x}{\color{blue}{1 - \frac{y}{z}}} \]
                2. lower--.f64N/A

                  \[\leadsto \frac{x}{1 - \color{blue}{\frac{y}{z}}} \]
                3. lower-/.f6448.9

                  \[\leadsto \frac{x}{1 - \frac{y}{\color{blue}{z}}} \]
              4. Applied rewrites48.9%

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

                  \[\leadsto \frac{x}{1 - \color{blue}{\frac{y}{z}}} \]
                2. *-inversesN/A

                  \[\leadsto \frac{x}{\frac{z}{z} - \frac{\color{blue}{y}}{z}} \]
                3. lift-/.f64N/A

                  \[\leadsto \frac{x}{\frac{z}{z} - \frac{y}{\color{blue}{z}}} \]
                4. sub-divN/A

                  \[\leadsto \frac{x}{\frac{z - y}{\color{blue}{z}}} \]
                5. lift--.f64N/A

                  \[\leadsto \frac{x}{\frac{z - y}{z}} \]
                6. lower-/.f6448.9

                  \[\leadsto \frac{x}{\frac{z - y}{\color{blue}{z}}} \]
              6. Applied rewrites48.9%

                \[\leadsto \frac{x}{\frac{z - y}{\color{blue}{z}}} \]

              if 4.40000000000000026e-186 < y < 4.7e20

              1. Initial program 87.9%

                \[\frac{x + y}{1 - \frac{y}{z}} \]
              2. Taylor expanded in y around 0

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

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

              Alternative 6: 73.9% accurate, 0.6× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y}{z - y} \cdot z\\ \mathbf{if}\;y \leq -3.9 \cdot 10^{+73}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{-186}:\\ \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{+20}:\\ \;\;\;\;\frac{x + y}{1}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
              (FPCore (x y z)
               :precision binary64
               (let* ((t_0 (* (/ y (- z y)) z)))
                 (if (<= y -3.9e+73)
                   t_0
                   (if (<= y 4.4e-186)
                     (/ x (- 1.0 (/ y z)))
                     (if (<= y 4.7e+20) (/ (+ x y) 1.0) t_0)))))
              double code(double x, double y, double z) {
              	double t_0 = (y / (z - y)) * z;
              	double tmp;
              	if (y <= -3.9e+73) {
              		tmp = t_0;
              	} else if (y <= 4.4e-186) {
              		tmp = x / (1.0 - (y / z));
              	} else if (y <= 4.7e+20) {
              		tmp = (x + y) / 1.0;
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              real(8) function code(x, 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 = (y / (z - y)) * z
                  if (y <= (-3.9d+73)) then
                      tmp = t_0
                  else if (y <= 4.4d-186) then
                      tmp = x / (1.0d0 - (y / z))
                  else if (y <= 4.7d+20) then
                      tmp = (x + y) / 1.0d0
                  else
                      tmp = t_0
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y, double z) {
              	double t_0 = (y / (z - y)) * z;
              	double tmp;
              	if (y <= -3.9e+73) {
              		tmp = t_0;
              	} else if (y <= 4.4e-186) {
              		tmp = x / (1.0 - (y / z));
              	} else if (y <= 4.7e+20) {
              		tmp = (x + y) / 1.0;
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              def code(x, y, z):
              	t_0 = (y / (z - y)) * z
              	tmp = 0
              	if y <= -3.9e+73:
              		tmp = t_0
              	elif y <= 4.4e-186:
              		tmp = x / (1.0 - (y / z))
              	elif y <= 4.7e+20:
              		tmp = (x + y) / 1.0
              	else:
              		tmp = t_0
              	return tmp
              
              function code(x, y, z)
              	t_0 = Float64(Float64(y / Float64(z - y)) * z)
              	tmp = 0.0
              	if (y <= -3.9e+73)
              		tmp = t_0;
              	elseif (y <= 4.4e-186)
              		tmp = Float64(x / Float64(1.0 - Float64(y / z)));
              	elseif (y <= 4.7e+20)
              		tmp = Float64(Float64(x + y) / 1.0);
              	else
              		tmp = t_0;
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z)
              	t_0 = (y / (z - y)) * z;
              	tmp = 0.0;
              	if (y <= -3.9e+73)
              		tmp = t_0;
              	elseif (y <= 4.4e-186)
              		tmp = x / (1.0 - (y / z));
              	elseif (y <= 4.7e+20)
              		tmp = (x + y) / 1.0;
              	else
              		tmp = t_0;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[y, -3.9e+73], t$95$0, If[LessEqual[y, 4.4e-186], N[(x / N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.7e+20], N[(N[(x + y), $MachinePrecision] / 1.0), $MachinePrecision], t$95$0]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \frac{y}{z - y} \cdot z\\
              \mathbf{if}\;y \leq -3.9 \cdot 10^{+73}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;y \leq 4.4 \cdot 10^{-186}:\\
              \;\;\;\;\frac{x}{1 - \frac{y}{z}}\\
              
              \mathbf{elif}\;y \leq 4.7 \cdot 10^{+20}:\\
              \;\;\;\;\frac{x + y}{1}\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_0\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if y < -3.9000000000000001e73 or 4.7e20 < y

                1. Initial program 87.9%

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

                    \[\leadsto \color{blue}{\frac{x + y}{1 - \frac{y}{z}}} \]
                  2. mult-flipN/A

                    \[\leadsto \color{blue}{\left(x + y\right) \cdot \frac{1}{1 - \frac{y}{z}}} \]
                  3. *-commutativeN/A

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

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

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

                    \[\leadsto \frac{1}{1 - \color{blue}{\frac{y}{z}}} \cdot \left(x + y\right) \]
                  7. sub-to-fractionN/A

                    \[\leadsto \frac{1}{\color{blue}{\frac{1 \cdot z - y}{z}}} \cdot \left(x + y\right) \]
                  8. div-flip-revN/A

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

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

                    \[\leadsto \frac{z}{\color{blue}{z} - y} \cdot \left(x + y\right) \]
                  11. lower--.f6488.5

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

                    \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(x + y\right)} \]
                  13. +-commutativeN/A

                    \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(y + x\right)} \]
                  14. lower-+.f6488.5

                    \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(y + x\right)} \]
                3. Applied rewrites88.5%

                  \[\leadsto \color{blue}{\frac{z}{z - y} \cdot \left(y + x\right)} \]
                4. Taylor expanded in x around 0

                  \[\leadsto \frac{z}{z - y} \cdot \color{blue}{y} \]
                5. Step-by-step derivation
                  1. Applied rewrites41.9%

                    \[\leadsto \frac{z}{z - y} \cdot \color{blue}{y} \]
                  2. Step-by-step derivation
                    1. lift-*.f64N/A

                      \[\leadsto \color{blue}{\frac{z}{z - y} \cdot y} \]
                    2. lift-/.f64N/A

                      \[\leadsto \color{blue}{\frac{z}{z - y}} \cdot y \]
                    3. associate-*l/N/A

                      \[\leadsto \color{blue}{\frac{z \cdot y}{z - y}} \]
                    4. associate-/l*N/A

                      \[\leadsto \color{blue}{z \cdot \frac{y}{z - y}} \]
                    5. *-commutativeN/A

                      \[\leadsto \color{blue}{\frac{y}{z - y} \cdot z} \]
                    6. lower-*.f64N/A

                      \[\leadsto \color{blue}{\frac{y}{z - y} \cdot z} \]
                    7. lower-/.f6449.6

                      \[\leadsto \color{blue}{\frac{y}{z - y}} \cdot z \]
                  3. Applied rewrites49.6%

                    \[\leadsto \color{blue}{\frac{y}{z - y} \cdot z} \]

                  if -3.9000000000000001e73 < y < 4.40000000000000026e-186

                  1. Initial program 87.9%

                    \[\frac{x + y}{1 - \frac{y}{z}} \]
                  2. Taylor expanded in x around inf

                    \[\leadsto \color{blue}{\frac{x}{1 - \frac{y}{z}}} \]
                  3. Step-by-step derivation
                    1. lower-/.f64N/A

                      \[\leadsto \frac{x}{\color{blue}{1 - \frac{y}{z}}} \]
                    2. lower--.f64N/A

                      \[\leadsto \frac{x}{1 - \color{blue}{\frac{y}{z}}} \]
                    3. lower-/.f6448.9

                      \[\leadsto \frac{x}{1 - \frac{y}{\color{blue}{z}}} \]
                  4. Applied rewrites48.9%

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

                  if 4.40000000000000026e-186 < y < 4.7e20

                  1. Initial program 87.9%

                    \[\frac{x + y}{1 - \frac{y}{z}} \]
                  2. Taylor expanded in y around 0

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

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

                  Alternative 7: 73.9% accurate, 0.6× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y}{z - y} \cdot z\\ \mathbf{if}\;y \leq -3.9 \cdot 10^{+73}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{-186}:\\ \;\;\;\;\frac{z}{z - y} \cdot x\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{+20}:\\ \;\;\;\;\frac{x + y}{1}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                  (FPCore (x y z)
                   :precision binary64
                   (let* ((t_0 (* (/ y (- z y)) z)))
                     (if (<= y -3.9e+73)
                       t_0
                       (if (<= y 4.4e-186)
                         (* (/ z (- z y)) x)
                         (if (<= y 4.7e+20) (/ (+ x y) 1.0) t_0)))))
                  double code(double x, double y, double z) {
                  	double t_0 = (y / (z - y)) * z;
                  	double tmp;
                  	if (y <= -3.9e+73) {
                  		tmp = t_0;
                  	} else if (y <= 4.4e-186) {
                  		tmp = (z / (z - y)) * x;
                  	} else if (y <= 4.7e+20) {
                  		tmp = (x + y) / 1.0;
                  	} else {
                  		tmp = t_0;
                  	}
                  	return tmp;
                  }
                  
                  module fmin_fmax_functions
                      implicit none
                      private
                      public fmax
                      public fmin
                  
                      interface fmax
                          module procedure fmax88
                          module procedure fmax44
                          module procedure fmax84
                          module procedure fmax48
                      end interface
                      interface fmin
                          module procedure fmin88
                          module procedure fmin44
                          module procedure fmin84
                          module procedure fmin48
                      end interface
                  contains
                      real(8) function fmax88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmax44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmax84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmax48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                      end function
                      real(8) function fmin88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmin44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmin84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmin48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                      end function
                  end module
                  
                  real(8) function code(x, 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 = (y / (z - y)) * z
                      if (y <= (-3.9d+73)) then
                          tmp = t_0
                      else if (y <= 4.4d-186) then
                          tmp = (z / (z - y)) * x
                      else if (y <= 4.7d+20) then
                          tmp = (x + y) / 1.0d0
                      else
                          tmp = t_0
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double x, double y, double z) {
                  	double t_0 = (y / (z - y)) * z;
                  	double tmp;
                  	if (y <= -3.9e+73) {
                  		tmp = t_0;
                  	} else if (y <= 4.4e-186) {
                  		tmp = (z / (z - y)) * x;
                  	} else if (y <= 4.7e+20) {
                  		tmp = (x + y) / 1.0;
                  	} else {
                  		tmp = t_0;
                  	}
                  	return tmp;
                  }
                  
                  def code(x, y, z):
                  	t_0 = (y / (z - y)) * z
                  	tmp = 0
                  	if y <= -3.9e+73:
                  		tmp = t_0
                  	elif y <= 4.4e-186:
                  		tmp = (z / (z - y)) * x
                  	elif y <= 4.7e+20:
                  		tmp = (x + y) / 1.0
                  	else:
                  		tmp = t_0
                  	return tmp
                  
                  function code(x, y, z)
                  	t_0 = Float64(Float64(y / Float64(z - y)) * z)
                  	tmp = 0.0
                  	if (y <= -3.9e+73)
                  		tmp = t_0;
                  	elseif (y <= 4.4e-186)
                  		tmp = Float64(Float64(z / Float64(z - y)) * x);
                  	elseif (y <= 4.7e+20)
                  		tmp = Float64(Float64(x + y) / 1.0);
                  	else
                  		tmp = t_0;
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(x, y, z)
                  	t_0 = (y / (z - y)) * z;
                  	tmp = 0.0;
                  	if (y <= -3.9e+73)
                  		tmp = t_0;
                  	elseif (y <= 4.4e-186)
                  		tmp = (z / (z - y)) * x;
                  	elseif (y <= 4.7e+20)
                  		tmp = (x + y) / 1.0;
                  	else
                  		tmp = t_0;
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y / N[(z - y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[y, -3.9e+73], t$95$0, If[LessEqual[y, 4.4e-186], N[(N[(z / N[(z - y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 4.7e+20], N[(N[(x + y), $MachinePrecision] / 1.0), $MachinePrecision], t$95$0]]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  t_0 := \frac{y}{z - y} \cdot z\\
                  \mathbf{if}\;y \leq -3.9 \cdot 10^{+73}:\\
                  \;\;\;\;t\_0\\
                  
                  \mathbf{elif}\;y \leq 4.4 \cdot 10^{-186}:\\
                  \;\;\;\;\frac{z}{z - y} \cdot x\\
                  
                  \mathbf{elif}\;y \leq 4.7 \cdot 10^{+20}:\\
                  \;\;\;\;\frac{x + y}{1}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;t\_0\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 3 regimes
                  2. if y < -3.9000000000000001e73 or 4.7e20 < y

                    1. Initial program 87.9%

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

                        \[\leadsto \color{blue}{\frac{x + y}{1 - \frac{y}{z}}} \]
                      2. mult-flipN/A

                        \[\leadsto \color{blue}{\left(x + y\right) \cdot \frac{1}{1 - \frac{y}{z}}} \]
                      3. *-commutativeN/A

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

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

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

                        \[\leadsto \frac{1}{1 - \color{blue}{\frac{y}{z}}} \cdot \left(x + y\right) \]
                      7. sub-to-fractionN/A

                        \[\leadsto \frac{1}{\color{blue}{\frac{1 \cdot z - y}{z}}} \cdot \left(x + y\right) \]
                      8. div-flip-revN/A

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

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

                        \[\leadsto \frac{z}{\color{blue}{z} - y} \cdot \left(x + y\right) \]
                      11. lower--.f6488.5

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

                        \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(x + y\right)} \]
                      13. +-commutativeN/A

                        \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(y + x\right)} \]
                      14. lower-+.f6488.5

                        \[\leadsto \frac{z}{z - y} \cdot \color{blue}{\left(y + x\right)} \]
                    3. Applied rewrites88.5%

                      \[\leadsto \color{blue}{\frac{z}{z - y} \cdot \left(y + x\right)} \]
                    4. Taylor expanded in x around 0

                      \[\leadsto \frac{z}{z - y} \cdot \color{blue}{y} \]
                    5. Step-by-step derivation
                      1. Applied rewrites41.9%

                        \[\leadsto \frac{z}{z - y} \cdot \color{blue}{y} \]
                      2. Step-by-step derivation
                        1. lift-*.f64N/A

                          \[\leadsto \color{blue}{\frac{z}{z - y} \cdot y} \]
                        2. lift-/.f64N/A

                          \[\leadsto \color{blue}{\frac{z}{z - y}} \cdot y \]
                        3. associate-*l/N/A

                          \[\leadsto \color{blue}{\frac{z \cdot y}{z - y}} \]
                        4. associate-/l*N/A

                          \[\leadsto \color{blue}{z \cdot \frac{y}{z - y}} \]
                        5. *-commutativeN/A

                          \[\leadsto \color{blue}{\frac{y}{z - y} \cdot z} \]
                        6. lower-*.f64N/A

                          \[\leadsto \color{blue}{\frac{y}{z - y} \cdot z} \]
                        7. lower-/.f6449.6

                          \[\leadsto \color{blue}{\frac{y}{z - y}} \cdot z \]
                      3. Applied rewrites49.6%

                        \[\leadsto \color{blue}{\frac{y}{z - y} \cdot z} \]

                      if -3.9000000000000001e73 < y < 4.40000000000000026e-186

                      1. Initial program 87.9%

                        \[\frac{x + y}{1 - \frac{y}{z}} \]
                      2. Taylor expanded in x around inf

                        \[\leadsto \color{blue}{\frac{x}{1 - \frac{y}{z}}} \]
                      3. Step-by-step derivation
                        1. lower-/.f64N/A

                          \[\leadsto \frac{x}{\color{blue}{1 - \frac{y}{z}}} \]
                        2. lower--.f64N/A

                          \[\leadsto \frac{x}{1 - \color{blue}{\frac{y}{z}}} \]
                        3. lower-/.f6448.9

                          \[\leadsto \frac{x}{1 - \frac{y}{\color{blue}{z}}} \]
                      4. Applied rewrites48.9%

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

                          \[\leadsto \frac{x}{1 - \color{blue}{\frac{y}{z}}} \]
                        2. *-inversesN/A

                          \[\leadsto \frac{x}{\frac{z}{z} - \frac{\color{blue}{y}}{z}} \]
                        3. lift-/.f64N/A

                          \[\leadsto \frac{x}{\frac{z}{z} - \frac{y}{\color{blue}{z}}} \]
                        4. sub-divN/A

                          \[\leadsto \frac{x}{\frac{z - y}{\color{blue}{z}}} \]
                        5. lift--.f64N/A

                          \[\leadsto \frac{x}{\frac{z - y}{z}} \]
                        6. lower-/.f6448.9

                          \[\leadsto \frac{x}{\frac{z - y}{\color{blue}{z}}} \]
                      6. Applied rewrites48.9%

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

                          \[\leadsto \frac{x}{\color{blue}{\frac{z - y}{z}}} \]
                        2. mult-flip-revN/A

                          \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{z - y}{z}}} \]
                        3. lift-/.f64N/A

                          \[\leadsto x \cdot \frac{1}{\frac{z - y}{\color{blue}{z}}} \]
                        4. div-flip-revN/A

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

                          \[\leadsto x \cdot \frac{z}{\color{blue}{z - y}} \]
                        6. *-commutativeN/A

                          \[\leadsto \frac{z}{z - y} \cdot \color{blue}{x} \]
                        7. lower-*.f6449.1

                          \[\leadsto \frac{z}{z - y} \cdot \color{blue}{x} \]
                      8. Applied rewrites49.1%

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

                      if 4.40000000000000026e-186 < y < 4.7e20

                      1. Initial program 87.9%

                        \[\frac{x + y}{1 - \frac{y}{z}} \]
                      2. Taylor expanded in y around 0

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

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

                      Alternative 8: 68.0% accurate, 0.7× speedup?

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

                        1. Initial program 87.9%

                          \[\frac{x + y}{1 - \frac{y}{z}} \]
                        2. Taylor expanded in y around inf

                          \[\leadsto \color{blue}{-1 \cdot z} \]
                        3. Step-by-step derivation
                          1. lower-*.f6434.8

                            \[\leadsto -1 \cdot \color{blue}{z} \]
                        4. Applied rewrites34.8%

                          \[\leadsto \color{blue}{-1 \cdot z} \]
                        5. Step-by-step derivation
                          1. lift-*.f64N/A

                            \[\leadsto -1 \cdot \color{blue}{z} \]
                          2. mul-1-negN/A

                            \[\leadsto \mathsf{neg}\left(z\right) \]
                          3. lower-neg.f6434.8

                            \[\leadsto -z \]
                        6. Applied rewrites34.8%

                          \[\leadsto -z \]

                        if -1.10000000000000006e75 < y < 4.40000000000000026e-186

                        1. Initial program 87.9%

                          \[\frac{x + y}{1 - \frac{y}{z}} \]
                        2. Taylor expanded in x around inf

                          \[\leadsto \color{blue}{\frac{x}{1 - \frac{y}{z}}} \]
                        3. Step-by-step derivation
                          1. lower-/.f64N/A

                            \[\leadsto \frac{x}{\color{blue}{1 - \frac{y}{z}}} \]
                          2. lower--.f64N/A

                            \[\leadsto \frac{x}{1 - \color{blue}{\frac{y}{z}}} \]
                          3. lower-/.f6448.9

                            \[\leadsto \frac{x}{1 - \frac{y}{\color{blue}{z}}} \]
                        4. Applied rewrites48.9%

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

                            \[\leadsto \frac{x}{1 - \color{blue}{\frac{y}{z}}} \]
                          2. *-inversesN/A

                            \[\leadsto \frac{x}{\frac{z}{z} - \frac{\color{blue}{y}}{z}} \]
                          3. lift-/.f64N/A

                            \[\leadsto \frac{x}{\frac{z}{z} - \frac{y}{\color{blue}{z}}} \]
                          4. sub-divN/A

                            \[\leadsto \frac{x}{\frac{z - y}{\color{blue}{z}}} \]
                          5. lift--.f64N/A

                            \[\leadsto \frac{x}{\frac{z - y}{z}} \]
                          6. lower-/.f6448.9

                            \[\leadsto \frac{x}{\frac{z - y}{\color{blue}{z}}} \]
                        6. Applied rewrites48.9%

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

                            \[\leadsto \frac{x}{\color{blue}{\frac{z - y}{z}}} \]
                          2. mult-flip-revN/A

                            \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{z - y}{z}}} \]
                          3. lift-/.f64N/A

                            \[\leadsto x \cdot \frac{1}{\frac{z - y}{\color{blue}{z}}} \]
                          4. div-flip-revN/A

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

                            \[\leadsto x \cdot \frac{z}{\color{blue}{z - y}} \]
                          6. *-commutativeN/A

                            \[\leadsto \frac{z}{z - y} \cdot \color{blue}{x} \]
                          7. lower-*.f6449.1

                            \[\leadsto \frac{z}{z - y} \cdot \color{blue}{x} \]
                        8. Applied rewrites49.1%

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

                        if 4.40000000000000026e-186 < y < 5.0000000000000004e49

                        1. Initial program 87.9%

                          \[\frac{x + y}{1 - \frac{y}{z}} \]
                        2. Taylor expanded in y around 0

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

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

                        Alternative 9: 67.8% accurate, 0.7× speedup?

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

                          1. Initial program 87.9%

                            \[\frac{x + y}{1 - \frac{y}{z}} \]
                          2. Taylor expanded in y around inf

                            \[\leadsto \color{blue}{-1 \cdot z} \]
                          3. Step-by-step derivation
                            1. lower-*.f6434.8

                              \[\leadsto -1 \cdot \color{blue}{z} \]
                          4. Applied rewrites34.8%

                            \[\leadsto \color{blue}{-1 \cdot z} \]
                          5. Step-by-step derivation
                            1. lift-*.f64N/A

                              \[\leadsto -1 \cdot \color{blue}{z} \]
                            2. mul-1-negN/A

                              \[\leadsto \mathsf{neg}\left(z\right) \]
                            3. lower-neg.f6434.8

                              \[\leadsto -z \]
                          6. Applied rewrites34.8%

                            \[\leadsto -z \]

                          if -1.10000000000000006e75 < y < -3.09999999999999969e-73

                          1. Initial program 87.9%

                            \[\frac{x + y}{1 - \frac{y}{z}} \]
                          2. Taylor expanded in x around inf

                            \[\leadsto \color{blue}{\frac{x}{1 - \frac{y}{z}}} \]
                          3. Step-by-step derivation
                            1. lower-/.f64N/A

                              \[\leadsto \frac{x}{\color{blue}{1 - \frac{y}{z}}} \]
                            2. lower--.f64N/A

                              \[\leadsto \frac{x}{1 - \color{blue}{\frac{y}{z}}} \]
                            3. lower-/.f6448.9

                              \[\leadsto \frac{x}{1 - \frac{y}{\color{blue}{z}}} \]
                          4. Applied rewrites48.9%

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

                              \[\leadsto \frac{x}{\color{blue}{1 - \frac{y}{z}}} \]
                            2. lift--.f64N/A

                              \[\leadsto \frac{x}{1 - \color{blue}{\frac{y}{z}}} \]
                            3. lift-/.f64N/A

                              \[\leadsto \frac{x}{1 - \frac{y}{\color{blue}{z}}} \]
                            4. sub-to-fractionN/A

                              \[\leadsto \frac{x}{\frac{1 \cdot z - y}{\color{blue}{z}}} \]
                            5. associate-/r/N/A

                              \[\leadsto \frac{x}{1 \cdot z - y} \cdot \color{blue}{z} \]
                            6. *-lft-identityN/A

                              \[\leadsto \frac{x}{z - y} \cdot z \]
                            7. lift--.f64N/A

                              \[\leadsto \frac{x}{z - y} \cdot z \]
                            8. lift-/.f64N/A

                              \[\leadsto \frac{x}{z - y} \cdot z \]
                            9. lift-*.f6445.3

                              \[\leadsto \frac{x}{z - y} \cdot \color{blue}{z} \]
                          6. Applied rewrites45.3%

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

                          if -3.09999999999999969e-73 < y < 5.0000000000000004e49

                          1. Initial program 87.9%

                            \[\frac{x + y}{1 - \frac{y}{z}} \]
                          2. Taylor expanded in y around 0

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

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

                          Alternative 10: 67.7% accurate, 0.9× speedup?

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

                            1. Initial program 87.9%

                              \[\frac{x + y}{1 - \frac{y}{z}} \]
                            2. Taylor expanded in y around inf

                              \[\leadsto \color{blue}{-1 \cdot z} \]
                            3. Step-by-step derivation
                              1. lower-*.f6434.8

                                \[\leadsto -1 \cdot \color{blue}{z} \]
                            4. Applied rewrites34.8%

                              \[\leadsto \color{blue}{-1 \cdot z} \]
                            5. Step-by-step derivation
                              1. lift-*.f64N/A

                                \[\leadsto -1 \cdot \color{blue}{z} \]
                              2. mul-1-negN/A

                                \[\leadsto \mathsf{neg}\left(z\right) \]
                              3. lower-neg.f6434.8

                                \[\leadsto -z \]
                            6. Applied rewrites34.8%

                              \[\leadsto -z \]

                            if -1.79999999999999999e123 < y < 5.0000000000000004e49

                            1. Initial program 87.9%

                              \[\frac{x + y}{1 - \frac{y}{z}} \]
                            2. Taylor expanded in y around 0

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

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

                            Alternative 11: 57.5% accurate, 1.1× speedup?

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

                              1. Initial program 87.9%

                                \[\frac{x + y}{1 - \frac{y}{z}} \]
                              2. Taylor expanded in y around inf

                                \[\leadsto \color{blue}{-1 \cdot z} \]
                              3. Step-by-step derivation
                                1. lower-*.f6434.8

                                  \[\leadsto -1 \cdot \color{blue}{z} \]
                              4. Applied rewrites34.8%

                                \[\leadsto \color{blue}{-1 \cdot z} \]
                              5. Step-by-step derivation
                                1. lift-*.f64N/A

                                  \[\leadsto -1 \cdot \color{blue}{z} \]
                                2. mul-1-negN/A

                                  \[\leadsto \mathsf{neg}\left(z\right) \]
                                3. lower-neg.f6434.8

                                  \[\leadsto -z \]
                              6. Applied rewrites34.8%

                                \[\leadsto -z \]

                              if -5.5000000000000003e73 < y < 4.7e20

                              1. Initial program 87.9%

                                \[\frac{x + y}{1 - \frac{y}{z}} \]
                              2. Taylor expanded in x around inf

                                \[\leadsto \color{blue}{\frac{x}{1 - \frac{y}{z}}} \]
                              3. Step-by-step derivation
                                1. lower-/.f64N/A

                                  \[\leadsto \frac{x}{\color{blue}{1 - \frac{y}{z}}} \]
                                2. lower--.f64N/A

                                  \[\leadsto \frac{x}{1 - \color{blue}{\frac{y}{z}}} \]
                                3. lower-/.f6448.9

                                  \[\leadsto \frac{x}{1 - \frac{y}{\color{blue}{z}}} \]
                              4. Applied rewrites48.9%

                                \[\leadsto \color{blue}{\frac{x}{1 - \frac{y}{z}}} \]
                              5. Taylor expanded in y around 0

                                \[\leadsto \frac{x}{1} \]
                              6. Step-by-step derivation
                                1. Applied rewrites34.3%

                                  \[\leadsto \frac{x}{1} \]
                              7. Recombined 2 regimes into one program.
                              8. Add Preprocessing

                              Alternative 12: 34.8% accurate, 6.7× speedup?

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

                                \[\frac{x + y}{1 - \frac{y}{z}} \]
                              2. Taylor expanded in y around inf

                                \[\leadsto \color{blue}{-1 \cdot z} \]
                              3. Step-by-step derivation
                                1. lower-*.f6434.8

                                  \[\leadsto -1 \cdot \color{blue}{z} \]
                              4. Applied rewrites34.8%

                                \[\leadsto \color{blue}{-1 \cdot z} \]
                              5. Step-by-step derivation
                                1. lift-*.f64N/A

                                  \[\leadsto -1 \cdot \color{blue}{z} \]
                                2. mul-1-negN/A

                                  \[\leadsto \mathsf{neg}\left(z\right) \]
                                3. lower-neg.f6434.8

                                  \[\leadsto -z \]
                              6. Applied rewrites34.8%

                                \[\leadsto -z \]
                              7. Add Preprocessing

                              Reproduce

                              ?
                              herbie shell --seed 2025149 
                              (FPCore (x y z)
                                :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
                                :precision binary64
                                (/ (+ x y) (- 1.0 (/ y z))))