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

Percentage Accurate: 68.9% → 92.5%
Time: 3.4s
Alternatives: 13
Speedup: 1.5×

Specification

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

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

real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
	return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y):
	return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y)
	return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0)))
end
function tmp = code(x, y)
	tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\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 13 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: 68.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \end{array} \]
(FPCore (x y)
 :precision binary64
 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
double code(double x, double y) {
	return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
public static double code(double x, double y) {
	return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
def code(x, y):
	return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
function code(x, y)
	return Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(Float64(x + y) + 1.0)))
end
function tmp = code(x, y)
	tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
end
code[x_, y_] := N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}

Alternative 1: 92.5% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{\left(y + x\right) + 1}\\ \mathbf{if}\;x \leq -1.4 \cdot 10^{+149}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{x}, -2, 1\right)}{x} \cdot t\_0\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-159}:\\ \;\;\;\;\frac{x}{{\left(y + x\right)}^{2}} \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ y (+ (+ y x) 1.0))))
   (if (<= x -1.4e+149)
     (* (/ (fma (/ y x) -2.0 1.0) x) t_0)
     (if (<= x -5e-159)
       (* (/ x (pow (+ y x) 2.0)) t_0)
       (/ x (* (+ 1.0 y) y))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / ((y + x) + 1.0);
	double tmp;
	if (x <= -1.4e+149) {
		tmp = (fma((y / x), -2.0, 1.0) / x) * t_0;
	} else if (x <= -5e-159) {
		tmp = (x / pow((y + x), 2.0)) * t_0;
	} else {
		tmp = x / ((1.0 + y) * y);
	}
	return tmp;
}
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(Float64(y + x) + 1.0))
	tmp = 0.0
	if (x <= -1.4e+149)
		tmp = Float64(Float64(fma(Float64(y / x), -2.0, 1.0) / x) * t_0);
	elseif (x <= -5e-159)
		tmp = Float64(Float64(x / (Float64(y + x) ^ 2.0)) * t_0);
	else
		tmp = Float64(x / Float64(Float64(1.0 + y) * y));
	end
	return tmp
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.4e+149], N[(N[(N[(N[(y / x), $MachinePrecision] * -2.0 + 1.0), $MachinePrecision] / x), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[x, -5e-159], N[(N[(x / N[Power[N[(y + x), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(x / N[(N[(1.0 + y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{\left(y + x\right) + 1}\\
\mathbf{if}\;x \leq -1.4 \cdot 10^{+149}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{x}, -2, 1\right)}{x} \cdot t\_0\\

\mathbf{elif}\;x \leq -5 \cdot 10^{-159}:\\
\;\;\;\;\frac{x}{{\left(y + x\right)}^{2}} \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\


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

    1. Initial program 63.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \cdot \frac{y}{\left(x + y\right) + 1} \]
      12. pow2N/A

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

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

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

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

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

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

        \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      19. lower-+.f6485.1

        \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
    3. Applied rewrites85.1%

      \[\leadsto \color{blue}{\frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\left(y + x\right) + 1}} \]
    4. Taylor expanded in x around inf

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{y}{x}, -2, 1\right)}{x} \cdot \frac{y}{\left(y + x\right) + 1} \]
      5. lower-/.f6492.8

        \[\leadsto \frac{\mathsf{fma}\left(\frac{y}{x}, -2, 1\right)}{x} \cdot \frac{y}{\left(y + x\right) + 1} \]
    6. Applied rewrites92.8%

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

    if -1.4e149 < x < -5.00000000000000032e-159

    1. Initial program 77.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \cdot \frac{y}{\left(x + y\right) + 1} \]
      12. pow2N/A

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

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

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

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

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

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

        \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      19. lower-+.f6497.5

        \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
    3. Applied rewrites97.5%

      \[\leadsto \color{blue}{\frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\left(y + x\right) + 1}} \]

    if -5.00000000000000032e-159 < x

    1. Initial program 64.4%

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

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

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

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

        \[\leadsto \frac{x}{\left(1 + y\right) \cdot \color{blue}{y}} \]
      4. lower-+.f6487.3

        \[\leadsto \frac{x}{\left(1 + y\right) \cdot y} \]
    4. Applied rewrites87.3%

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

Alternative 2: 92.4% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{\left(y + x\right) + 1}\\ \mathbf{if}\;x \leq -1.4 \cdot 10^{+149}:\\ \;\;\;\;{x}^{-1} \cdot t\_0\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-159}:\\ \;\;\;\;\frac{x}{{\left(y + x\right)}^{2}} \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ y (+ (+ y x) 1.0))))
   (if (<= x -1.4e+149)
     (* (pow x -1.0) t_0)
     (if (<= x -5e-159)
       (* (/ x (pow (+ y x) 2.0)) t_0)
       (/ x (* (+ 1.0 y) y))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / ((y + x) + 1.0);
	double tmp;
	if (x <= -1.4e+149) {
		tmp = pow(x, -1.0) * t_0;
	} else if (x <= -5e-159) {
		tmp = (x / pow((y + x), 2.0)) * t_0;
	} else {
		tmp = x / ((1.0 + y) * y);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = y / ((y + x) + 1.0d0)
    if (x <= (-1.4d+149)) then
        tmp = (x ** (-1.0d0)) * t_0
    else if (x <= (-5d-159)) then
        tmp = (x / ((y + x) ** 2.0d0)) * t_0
    else
        tmp = x / ((1.0d0 + y) * y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y / ((y + x) + 1.0);
	double tmp;
	if (x <= -1.4e+149) {
		tmp = Math.pow(x, -1.0) * t_0;
	} else if (x <= -5e-159) {
		tmp = (x / Math.pow((y + x), 2.0)) * t_0;
	} else {
		tmp = x / ((1.0 + y) * y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / ((y + x) + 1.0)
	tmp = 0
	if x <= -1.4e+149:
		tmp = math.pow(x, -1.0) * t_0
	elif x <= -5e-159:
		tmp = (x / math.pow((y + x), 2.0)) * t_0
	else:
		tmp = x / ((1.0 + y) * y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(Float64(y + x) + 1.0))
	tmp = 0.0
	if (x <= -1.4e+149)
		tmp = Float64((x ^ -1.0) * t_0);
	elseif (x <= -5e-159)
		tmp = Float64(Float64(x / (Float64(y + x) ^ 2.0)) * t_0);
	else
		tmp = Float64(x / Float64(Float64(1.0 + y) * y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y / ((y + x) + 1.0);
	tmp = 0.0;
	if (x <= -1.4e+149)
		tmp = (x ^ -1.0) * t_0;
	elseif (x <= -5e-159)
		tmp = (x / ((y + x) ^ 2.0)) * t_0;
	else
		tmp = x / ((1.0 + y) * y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.4e+149], N[(N[Power[x, -1.0], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[x, -5e-159], N[(N[(x / N[Power[N[(y + x), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(x / N[(N[(1.0 + y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{\left(y + x\right) + 1}\\
\mathbf{if}\;x \leq -1.4 \cdot 10^{+149}:\\
\;\;\;\;{x}^{-1} \cdot t\_0\\

\mathbf{elif}\;x \leq -5 \cdot 10^{-159}:\\
\;\;\;\;\frac{x}{{\left(y + x\right)}^{2}} \cdot t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\


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

    1. Initial program 63.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \cdot \frac{y}{\left(x + y\right) + 1} \]
      12. pow2N/A

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

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

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

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

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

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

        \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      19. lower-+.f6485.1

        \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
    3. Applied rewrites85.1%

      \[\leadsto \color{blue}{\frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\left(y + x\right) + 1}} \]
    4. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{1}{x}} \cdot \frac{y}{\left(y + x\right) + 1} \]
    5. Step-by-step derivation
      1. inv-powN/A

        \[\leadsto {x}^{\color{blue}{-1}} \cdot \frac{y}{\left(y + x\right) + 1} \]
      2. lower-pow.f6492.4

        \[\leadsto {x}^{\color{blue}{-1}} \cdot \frac{y}{\left(y + x\right) + 1} \]
    6. Applied rewrites92.4%

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

    if -1.4e149 < x < -5.00000000000000032e-159

    1. Initial program 77.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \cdot \frac{y}{\left(x + y\right) + 1} \]
      12. pow2N/A

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

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

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

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

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

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

        \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      19. lower-+.f6497.5

        \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
    3. Applied rewrites97.5%

      \[\leadsto \color{blue}{\frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\left(y + x\right) + 1}} \]

    if -5.00000000000000032e-159 < x

    1. Initial program 64.4%

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

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

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

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

        \[\leadsto \frac{x}{\left(1 + y\right) \cdot \color{blue}{y}} \]
      4. lower-+.f6487.3

        \[\leadsto \frac{x}{\left(1 + y\right) \cdot y} \]
    4. Applied rewrites87.3%

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

Alternative 3: 89.7% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \left(y + x\right) + 1\\ \mathbf{if}\;x \leq -1.18 \cdot 10^{+79}:\\ \;\;\;\;{x}^{-1} \cdot \frac{y}{t\_0}\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-159}:\\ \;\;\;\;x \cdot \frac{y}{t\_0 \cdot {\left(y + x\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ (+ y x) 1.0)))
   (if (<= x -1.18e+79)
     (* (pow x -1.0) (/ y t_0))
     (if (<= x -5e-159)
       (* x (/ y (* t_0 (pow (+ y x) 2.0))))
       (/ x (* (+ 1.0 y) y))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = (y + x) + 1.0;
	double tmp;
	if (x <= -1.18e+79) {
		tmp = pow(x, -1.0) * (y / t_0);
	} else if (x <= -5e-159) {
		tmp = x * (y / (t_0 * pow((y + x), 2.0)));
	} else {
		tmp = x / ((1.0 + y) * y);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (y + x) + 1.0d0
    if (x <= (-1.18d+79)) then
        tmp = (x ** (-1.0d0)) * (y / t_0)
    else if (x <= (-5d-159)) then
        tmp = x * (y / (t_0 * ((y + x) ** 2.0d0)))
    else
        tmp = x / ((1.0d0 + y) * y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = (y + x) + 1.0;
	double tmp;
	if (x <= -1.18e+79) {
		tmp = Math.pow(x, -1.0) * (y / t_0);
	} else if (x <= -5e-159) {
		tmp = x * (y / (t_0 * Math.pow((y + x), 2.0)));
	} else {
		tmp = x / ((1.0 + y) * y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = (y + x) + 1.0
	tmp = 0
	if x <= -1.18e+79:
		tmp = math.pow(x, -1.0) * (y / t_0)
	elif x <= -5e-159:
		tmp = x * (y / (t_0 * math.pow((y + x), 2.0)))
	else:
		tmp = x / ((1.0 + y) * y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(Float64(y + x) + 1.0)
	tmp = 0.0
	if (x <= -1.18e+79)
		tmp = Float64((x ^ -1.0) * Float64(y / t_0));
	elseif (x <= -5e-159)
		tmp = Float64(x * Float64(y / Float64(t_0 * (Float64(y + x) ^ 2.0))));
	else
		tmp = Float64(x / Float64(Float64(1.0 + y) * y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = (y + x) + 1.0;
	tmp = 0.0;
	if (x <= -1.18e+79)
		tmp = (x ^ -1.0) * (y / t_0);
	elseif (x <= -5e-159)
		tmp = x * (y / (t_0 * ((y + x) ^ 2.0)));
	else
		tmp = x / ((1.0 + y) * y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, -1.18e+79], N[(N[Power[x, -1.0], $MachinePrecision] * N[(y / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5e-159], N[(x * N[(y / N[(t$95$0 * N[Power[N[(y + x), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(1.0 + y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(y + x\right) + 1\\
\mathbf{if}\;x \leq -1.18 \cdot 10^{+79}:\\
\;\;\;\;{x}^{-1} \cdot \frac{y}{t\_0}\\

\mathbf{elif}\;x \leq -5 \cdot 10^{-159}:\\
\;\;\;\;x \cdot \frac{y}{t\_0 \cdot {\left(y + x\right)}^{2}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\


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

    1. Initial program 61.9%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \cdot \frac{y}{\left(x + y\right) + 1} \]
      12. pow2N/A

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

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

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

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

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

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

        \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      19. lower-+.f6487.7

        \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
    3. Applied rewrites87.7%

      \[\leadsto \color{blue}{\frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\left(y + x\right) + 1}} \]
    4. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{1}{x}} \cdot \frac{y}{\left(y + x\right) + 1} \]
    5. Step-by-step derivation
      1. inv-powN/A

        \[\leadsto {x}^{\color{blue}{-1}} \cdot \frac{y}{\left(y + x\right) + 1} \]
      2. lower-pow.f6489.0

        \[\leadsto {x}^{\color{blue}{-1}} \cdot \frac{y}{\left(y + x\right) + 1} \]
    6. Applied rewrites89.0%

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

    if -1.18e79 < x < -5.00000000000000032e-159

    1. Initial program 83.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(\left(x + y\right) + 1\right)}} \]
      9. associate-/l*N/A

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      17. pow2N/A

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

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

        \[\leadsto x \cdot \frac{y}{\left(\left(y + x\right) + 1\right) \cdot {\color{blue}{\left(y + x\right)}}^{2}} \]
      20. lower-+.f6493.8

        \[\leadsto x \cdot \frac{y}{\left(\left(y + x\right) + 1\right) \cdot {\color{blue}{\left(y + x\right)}}^{2}} \]
    3. Applied rewrites93.8%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(y + x\right) + 1\right) \cdot {\left(y + x\right)}^{2}}} \]

    if -5.00000000000000032e-159 < x

    1. Initial program 64.4%

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

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

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

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

        \[\leadsto \frac{x}{\left(1 + y\right) \cdot \color{blue}{y}} \]
      4. lower-+.f6487.3

        \[\leadsto \frac{x}{\left(1 + y\right) \cdot y} \]
    4. Applied rewrites87.3%

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

Alternative 4: 88.3% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{-5}:\\ \;\;\;\;{x}^{-1} \cdot \frac{y}{\left(y + x\right) + 1}\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-159}:\\ \;\;\;\;\frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -3.1e-5)
   (* (pow x -1.0) (/ y (+ (+ y x) 1.0)))
   (if (<= x -5e-159)
     (* (/ x (pow (+ y x) 2.0)) (/ y (+ y 1.0)))
     (/ x (* (+ 1.0 y) y)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -3.1e-5) {
		tmp = pow(x, -1.0) * (y / ((y + x) + 1.0));
	} else if (x <= -5e-159) {
		tmp = (x / pow((y + x), 2.0)) * (y / (y + 1.0));
	} else {
		tmp = x / ((1.0 + y) * y);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-3.1d-5)) then
        tmp = (x ** (-1.0d0)) * (y / ((y + x) + 1.0d0))
    else if (x <= (-5d-159)) then
        tmp = (x / ((y + x) ** 2.0d0)) * (y / (y + 1.0d0))
    else
        tmp = x / ((1.0d0 + y) * y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -3.1e-5) {
		tmp = Math.pow(x, -1.0) * (y / ((y + x) + 1.0));
	} else if (x <= -5e-159) {
		tmp = (x / Math.pow((y + x), 2.0)) * (y / (y + 1.0));
	} else {
		tmp = x / ((1.0 + y) * y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -3.1e-5:
		tmp = math.pow(x, -1.0) * (y / ((y + x) + 1.0))
	elif x <= -5e-159:
		tmp = (x / math.pow((y + x), 2.0)) * (y / (y + 1.0))
	else:
		tmp = x / ((1.0 + y) * y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -3.1e-5)
		tmp = Float64((x ^ -1.0) * Float64(y / Float64(Float64(y + x) + 1.0)));
	elseif (x <= -5e-159)
		tmp = Float64(Float64(x / (Float64(y + x) ^ 2.0)) * Float64(y / Float64(y + 1.0)));
	else
		tmp = Float64(x / Float64(Float64(1.0 + y) * y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -3.1e-5)
		tmp = (x ^ -1.0) * (y / ((y + x) + 1.0));
	elseif (x <= -5e-159)
		tmp = (x / ((y + x) ^ 2.0)) * (y / (y + 1.0));
	else
		tmp = x / ((1.0 + y) * y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -3.1e-5], N[(N[Power[x, -1.0], $MachinePrecision] * N[(y / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5e-159], N[(N[(x / N[Power[N[(y + x), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(y / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(N[(1.0 + y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{-5}:\\
\;\;\;\;{x}^{-1} \cdot \frac{y}{\left(y + x\right) + 1}\\

\mathbf{elif}\;x \leq -5 \cdot 10^{-159}:\\
\;\;\;\;\frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{y + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\


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

    1. Initial program 68.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \cdot \frac{y}{\left(x + y\right) + 1} \]
      12. pow2N/A

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

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

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

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

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

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

        \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      19. lower-+.f6490.0

        \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
    3. Applied rewrites90.0%

      \[\leadsto \color{blue}{\frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\left(y + x\right) + 1}} \]
    4. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\frac{1}{x}} \cdot \frac{y}{\left(y + x\right) + 1} \]
    5. Step-by-step derivation
      1. inv-powN/A

        \[\leadsto {x}^{\color{blue}{-1}} \cdot \frac{y}{\left(y + x\right) + 1} \]
      2. lower-pow.f6485.0

        \[\leadsto {x}^{\color{blue}{-1}} \cdot \frac{y}{\left(y + x\right) + 1} \]
    6. Applied rewrites85.0%

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

    if -3.10000000000000014e-5 < x < -5.00000000000000032e-159

    1. Initial program 80.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \cdot \frac{y}{\left(x + y\right) + 1} \]
      12. pow2N/A

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

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

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

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

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

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

        \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      19. lower-+.f6499.4

        \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
    3. Applied rewrites99.4%

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

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

        \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\color{blue}{y} + 1} \]

      if -5.00000000000000032e-159 < x

      1. Initial program 64.4%

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

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

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

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

          \[\leadsto \frac{x}{\left(1 + y\right) \cdot \color{blue}{y}} \]
        4. lower-+.f6487.3

          \[\leadsto \frac{x}{\left(1 + y\right) \cdot y} \]
      4. Applied rewrites87.3%

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

    Alternative 5: 84.4% accurate, 0.8× speedup?

    \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.35 \cdot 10^{-131}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{x}\\ \mathbf{elif}\;y \leq 140000000000:\\ \;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+164}:\\ \;\;\;\;\frac{x}{{\left(y + x\right)}^{2}} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \end{array} \]
    NOTE: x and y should be sorted in increasing order before calling this function.
    (FPCore (x y)
     :precision binary64
     (if (<= y 1.35e-131)
       (/ (/ y (+ 1.0 x)) x)
       (if (<= y 140000000000.0)
         (/ x (* (+ 1.0 y) y))
         (if (<= y 1.4e+164) (* (/ x (pow (+ y x) 2.0)) 1.0) (/ (/ x y) y)))))
    assert(x < y);
    double code(double x, double y) {
    	double tmp;
    	if (y <= 1.35e-131) {
    		tmp = (y / (1.0 + x)) / x;
    	} else if (y <= 140000000000.0) {
    		tmp = x / ((1.0 + y) * y);
    	} else if (y <= 1.4e+164) {
    		tmp = (x / pow((y + x), 2.0)) * 1.0;
    	} else {
    		tmp = (x / y) / y;
    	}
    	return tmp;
    }
    
    NOTE: x and y should be sorted in increasing order before calling this function.
    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)
    use fmin_fmax_functions
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8) :: tmp
        if (y <= 1.35d-131) then
            tmp = (y / (1.0d0 + x)) / x
        else if (y <= 140000000000.0d0) then
            tmp = x / ((1.0d0 + y) * y)
        else if (y <= 1.4d+164) then
            tmp = (x / ((y + x) ** 2.0d0)) * 1.0d0
        else
            tmp = (x / y) / y
        end if
        code = tmp
    end function
    
    assert x < y;
    public static double code(double x, double y) {
    	double tmp;
    	if (y <= 1.35e-131) {
    		tmp = (y / (1.0 + x)) / x;
    	} else if (y <= 140000000000.0) {
    		tmp = x / ((1.0 + y) * y);
    	} else if (y <= 1.4e+164) {
    		tmp = (x / Math.pow((y + x), 2.0)) * 1.0;
    	} else {
    		tmp = (x / y) / y;
    	}
    	return tmp;
    }
    
    [x, y] = sort([x, y])
    def code(x, y):
    	tmp = 0
    	if y <= 1.35e-131:
    		tmp = (y / (1.0 + x)) / x
    	elif y <= 140000000000.0:
    		tmp = x / ((1.0 + y) * y)
    	elif y <= 1.4e+164:
    		tmp = (x / math.pow((y + x), 2.0)) * 1.0
    	else:
    		tmp = (x / y) / y
    	return tmp
    
    x, y = sort([x, y])
    function code(x, y)
    	tmp = 0.0
    	if (y <= 1.35e-131)
    		tmp = Float64(Float64(y / Float64(1.0 + x)) / x);
    	elseif (y <= 140000000000.0)
    		tmp = Float64(x / Float64(Float64(1.0 + y) * y));
    	elseif (y <= 1.4e+164)
    		tmp = Float64(Float64(x / (Float64(y + x) ^ 2.0)) * 1.0);
    	else
    		tmp = Float64(Float64(x / y) / y);
    	end
    	return tmp
    end
    
    x, y = num2cell(sort([x, y])){:}
    function tmp_2 = code(x, y)
    	tmp = 0.0;
    	if (y <= 1.35e-131)
    		tmp = (y / (1.0 + x)) / x;
    	elseif (y <= 140000000000.0)
    		tmp = x / ((1.0 + y) * y);
    	elseif (y <= 1.4e+164)
    		tmp = (x / ((y + x) ^ 2.0)) * 1.0;
    	else
    		tmp = (x / y) / y;
    	end
    	tmp_2 = tmp;
    end
    
    NOTE: x and y should be sorted in increasing order before calling this function.
    code[x_, y_] := If[LessEqual[y, 1.35e-131], N[(N[(y / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 140000000000.0], N[(x / N[(N[(1.0 + y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+164], N[(N[(x / N[Power[N[(y + x), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]]
    
    \begin{array}{l}
    [x, y] = \mathsf{sort}([x, y])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq 1.35 \cdot 10^{-131}:\\
    \;\;\;\;\frac{\frac{y}{1 + x}}{x}\\
    
    \mathbf{elif}\;y \leq 140000000000:\\
    \;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\
    
    \mathbf{elif}\;y \leq 1.4 \cdot 10^{+164}:\\
    \;\;\;\;\frac{x}{{\left(y + x\right)}^{2}} \cdot 1\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{x}{y}}{y}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if y < 1.35000000000000011e-131

      1. Initial program 63.9%

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

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

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

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

          \[\leadsto \frac{y}{\left(1 + x\right) \cdot \color{blue}{x}} \]
        4. lower-+.f6485.3

          \[\leadsto \frac{y}{\left(1 + x\right) \cdot x} \]
      4. Applied rewrites85.3%

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

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

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

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

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

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

          \[\leadsto \frac{\frac{y}{1 + x}}{x} \]
        7. lift-+.f6488.4

          \[\leadsto \frac{\frac{y}{1 + x}}{x} \]
      6. Applied rewrites88.4%

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

      if 1.35000000000000011e-131 < y < 1.4e11

      1. Initial program 85.0%

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

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

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

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

          \[\leadsto \frac{x}{\left(1 + y\right) \cdot \color{blue}{y}} \]
        4. lower-+.f6458.3

          \[\leadsto \frac{x}{\left(1 + y\right) \cdot y} \]
      4. Applied rewrites58.3%

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

      if 1.4e11 < y < 1.4000000000000001e164

      1. Initial program 72.4%

        \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. Step-by-step derivation
        1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \cdot \frac{y}{\left(x + y\right) + 1} \]
        12. pow2N/A

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

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

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

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

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

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

          \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
        19. lower-+.f6493.3

          \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      3. Applied rewrites93.3%

        \[\leadsto \color{blue}{\frac{x}{{\left(y + x\right)}^{2}} \cdot \frac{y}{\left(y + x\right) + 1}} \]
      4. Taylor expanded in y around inf

        \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \color{blue}{1} \]
      5. Step-by-step derivation
        1. Applied rewrites85.6%

          \[\leadsto \frac{x}{{\left(y + x\right)}^{2}} \cdot \color{blue}{1} \]

        if 1.4000000000000001e164 < y

        1. Initial program 63.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Taylor expanded in y around inf

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

            \[\leadsto \frac{x}{\color{blue}{{y}^{2}}} \]
          2. unpow2N/A

            \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
          3. lower-*.f6486.4

            \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
        4. Applied rewrites86.4%

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

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

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

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

            \[\leadsto \frac{\frac{x}{y}}{\color{blue}{y}} \]
          5. lower-/.f6494.1

            \[\leadsto \frac{\frac{x}{y}}{y} \]
        6. Applied rewrites94.1%

          \[\leadsto \frac{\frac{x}{y}}{\color{blue}{y}} \]
      6. Recombined 4 regimes into one program.
      7. Add Preprocessing

      Alternative 6: 82.3% accurate, 0.9× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{-10}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{-131}:\\ \;\;\;\;\frac{y}{\left(1 + x\right) \cdot x}\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+164}:\\ \;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \end{array} \]
      NOTE: x and y should be sorted in increasing order before calling this function.
      (FPCore (x y)
       :precision binary64
       (if (<= y -4.5e-10)
         (/ (/ y x) x)
         (if (<= y 1.35e-131)
           (/ y (* (+ 1.0 x) x))
           (if (<= y 1.4e+164) (/ x (* (+ 1.0 y) y)) (/ (/ x y) y)))))
      assert(x < y);
      double code(double x, double y) {
      	double tmp;
      	if (y <= -4.5e-10) {
      		tmp = (y / x) / x;
      	} else if (y <= 1.35e-131) {
      		tmp = y / ((1.0 + x) * x);
      	} else if (y <= 1.4e+164) {
      		tmp = x / ((1.0 + y) * y);
      	} else {
      		tmp = (x / y) / y;
      	}
      	return tmp;
      }
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      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)
      use fmin_fmax_functions
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8) :: tmp
          if (y <= (-4.5d-10)) then
              tmp = (y / x) / x
          else if (y <= 1.35d-131) then
              tmp = y / ((1.0d0 + x) * x)
          else if (y <= 1.4d+164) then
              tmp = x / ((1.0d0 + y) * y)
          else
              tmp = (x / y) / y
          end if
          code = tmp
      end function
      
      assert x < y;
      public static double code(double x, double y) {
      	double tmp;
      	if (y <= -4.5e-10) {
      		tmp = (y / x) / x;
      	} else if (y <= 1.35e-131) {
      		tmp = y / ((1.0 + x) * x);
      	} else if (y <= 1.4e+164) {
      		tmp = x / ((1.0 + y) * y);
      	} else {
      		tmp = (x / y) / y;
      	}
      	return tmp;
      }
      
      [x, y] = sort([x, y])
      def code(x, y):
      	tmp = 0
      	if y <= -4.5e-10:
      		tmp = (y / x) / x
      	elif y <= 1.35e-131:
      		tmp = y / ((1.0 + x) * x)
      	elif y <= 1.4e+164:
      		tmp = x / ((1.0 + y) * y)
      	else:
      		tmp = (x / y) / y
      	return tmp
      
      x, y = sort([x, y])
      function code(x, y)
      	tmp = 0.0
      	if (y <= -4.5e-10)
      		tmp = Float64(Float64(y / x) / x);
      	elseif (y <= 1.35e-131)
      		tmp = Float64(y / Float64(Float64(1.0 + x) * x));
      	elseif (y <= 1.4e+164)
      		tmp = Float64(x / Float64(Float64(1.0 + y) * y));
      	else
      		tmp = Float64(Float64(x / y) / y);
      	end
      	return tmp
      end
      
      x, y = num2cell(sort([x, y])){:}
      function tmp_2 = code(x, y)
      	tmp = 0.0;
      	if (y <= -4.5e-10)
      		tmp = (y / x) / x;
      	elseif (y <= 1.35e-131)
      		tmp = y / ((1.0 + x) * x);
      	elseif (y <= 1.4e+164)
      		tmp = x / ((1.0 + y) * y);
      	else
      		tmp = (x / y) / y;
      	end
      	tmp_2 = tmp;
      end
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      code[x_, y_] := If[LessEqual[y, -4.5e-10], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 1.35e-131], N[(y / N[(N[(1.0 + x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+164], N[(x / N[(N[(1.0 + y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]]
      
      \begin{array}{l}
      [x, y] = \mathsf{sort}([x, y])\\
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -4.5 \cdot 10^{-10}:\\
      \;\;\;\;\frac{\frac{y}{x}}{x}\\
      
      \mathbf{elif}\;y \leq 1.35 \cdot 10^{-131}:\\
      \;\;\;\;\frac{y}{\left(1 + x\right) \cdot x}\\
      
      \mathbf{elif}\;y \leq 1.4 \cdot 10^{+164}:\\
      \;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\frac{x}{y}}{y}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if y < -4.5e-10

        1. Initial program 32.4%

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

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

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

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

            \[\leadsto \frac{y}{\left(1 + x\right) \cdot \color{blue}{x}} \]
          4. lower-+.f6476.4

            \[\leadsto \frac{y}{\left(1 + x\right) \cdot x} \]
        4. Applied rewrites76.4%

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

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

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

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

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

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

            \[\leadsto \frac{\frac{y}{1 + x}}{x} \]
          7. lift-+.f6496.2

            \[\leadsto \frac{\frac{y}{1 + x}}{x} \]
        6. Applied rewrites96.2%

          \[\leadsto \color{blue}{\frac{\frac{y}{1 + x}}{x}} \]
        7. Taylor expanded in x around inf

          \[\leadsto \frac{\frac{y}{x}}{x} \]
        8. Step-by-step derivation
          1. Applied rewrites96.1%

            \[\leadsto \frac{\frac{y}{x}}{x} \]

          if -4.5e-10 < y < 1.35000000000000011e-131

          1. Initial program 69.9%

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

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

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

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

              \[\leadsto \frac{y}{\left(1 + x\right) \cdot \color{blue}{x}} \]
            4. lower-+.f6486.9

              \[\leadsto \frac{y}{\left(1 + x\right) \cdot x} \]
          4. Applied rewrites86.9%

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

          if 1.35000000000000011e-131 < y < 1.4000000000000001e164

          1. Initial program 77.8%

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

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

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

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

              \[\leadsto \frac{x}{\left(1 + y\right) \cdot \color{blue}{y}} \]
            4. lower-+.f6468.1

              \[\leadsto \frac{x}{\left(1 + y\right) \cdot y} \]
          4. Applied rewrites68.1%

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

          if 1.4000000000000001e164 < y

          1. Initial program 63.5%

            \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          2. Taylor expanded in y around inf

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

              \[\leadsto \frac{x}{\color{blue}{{y}^{2}}} \]
            2. unpow2N/A

              \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
            3. lower-*.f6486.4

              \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
          4. Applied rewrites86.4%

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

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

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

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

              \[\leadsto \frac{\frac{x}{y}}{\color{blue}{y}} \]
            5. lower-/.f6494.1

              \[\leadsto \frac{\frac{x}{y}}{y} \]
          6. Applied rewrites94.1%

            \[\leadsto \frac{\frac{x}{y}}{\color{blue}{y}} \]
        9. Recombined 4 regimes into one program.
        10. Add Preprocessing

        Alternative 7: 82.3% accurate, 1.1× speedup?

        \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.35 \cdot 10^{-131}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{x}\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+164}:\\ \;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \end{array} \]
        NOTE: x and y should be sorted in increasing order before calling this function.
        (FPCore (x y)
         :precision binary64
         (if (<= y 1.35e-131)
           (/ (/ y (+ 1.0 x)) x)
           (if (<= y 1.4e+164) (/ x (* (+ 1.0 y) y)) (/ (/ x y) y))))
        assert(x < y);
        double code(double x, double y) {
        	double tmp;
        	if (y <= 1.35e-131) {
        		tmp = (y / (1.0 + x)) / x;
        	} else if (y <= 1.4e+164) {
        		tmp = x / ((1.0 + y) * y);
        	} else {
        		tmp = (x / y) / y;
        	}
        	return tmp;
        }
        
        NOTE: x and y should be sorted in increasing order before calling this function.
        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)
        use fmin_fmax_functions
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8) :: tmp
            if (y <= 1.35d-131) then
                tmp = (y / (1.0d0 + x)) / x
            else if (y <= 1.4d+164) then
                tmp = x / ((1.0d0 + y) * y)
            else
                tmp = (x / y) / y
            end if
            code = tmp
        end function
        
        assert x < y;
        public static double code(double x, double y) {
        	double tmp;
        	if (y <= 1.35e-131) {
        		tmp = (y / (1.0 + x)) / x;
        	} else if (y <= 1.4e+164) {
        		tmp = x / ((1.0 + y) * y);
        	} else {
        		tmp = (x / y) / y;
        	}
        	return tmp;
        }
        
        [x, y] = sort([x, y])
        def code(x, y):
        	tmp = 0
        	if y <= 1.35e-131:
        		tmp = (y / (1.0 + x)) / x
        	elif y <= 1.4e+164:
        		tmp = x / ((1.0 + y) * y)
        	else:
        		tmp = (x / y) / y
        	return tmp
        
        x, y = sort([x, y])
        function code(x, y)
        	tmp = 0.0
        	if (y <= 1.35e-131)
        		tmp = Float64(Float64(y / Float64(1.0 + x)) / x);
        	elseif (y <= 1.4e+164)
        		tmp = Float64(x / Float64(Float64(1.0 + y) * y));
        	else
        		tmp = Float64(Float64(x / y) / y);
        	end
        	return tmp
        end
        
        x, y = num2cell(sort([x, y])){:}
        function tmp_2 = code(x, y)
        	tmp = 0.0;
        	if (y <= 1.35e-131)
        		tmp = (y / (1.0 + x)) / x;
        	elseif (y <= 1.4e+164)
        		tmp = x / ((1.0 + y) * y);
        	else
        		tmp = (x / y) / y;
        	end
        	tmp_2 = tmp;
        end
        
        NOTE: x and y should be sorted in increasing order before calling this function.
        code[x_, y_] := If[LessEqual[y, 1.35e-131], N[(N[(y / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 1.4e+164], N[(x / N[(N[(1.0 + y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]
        
        \begin{array}{l}
        [x, y] = \mathsf{sort}([x, y])\\
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq 1.35 \cdot 10^{-131}:\\
        \;\;\;\;\frac{\frac{y}{1 + x}}{x}\\
        
        \mathbf{elif}\;y \leq 1.4 \cdot 10^{+164}:\\
        \;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\frac{x}{y}}{y}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if y < 1.35000000000000011e-131

          1. Initial program 63.9%

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

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

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

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

              \[\leadsto \frac{y}{\left(1 + x\right) \cdot \color{blue}{x}} \]
            4. lower-+.f6485.3

              \[\leadsto \frac{y}{\left(1 + x\right) \cdot x} \]
          4. Applied rewrites85.3%

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

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

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

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

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

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

              \[\leadsto \frac{\frac{y}{1 + x}}{x} \]
            7. lift-+.f6488.4

              \[\leadsto \frac{\frac{y}{1 + x}}{x} \]
          6. Applied rewrites88.4%

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

          if 1.35000000000000011e-131 < y < 1.4000000000000001e164

          1. Initial program 77.8%

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

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

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

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

              \[\leadsto \frac{x}{\left(1 + y\right) \cdot \color{blue}{y}} \]
            4. lower-+.f6468.1

              \[\leadsto \frac{x}{\left(1 + y\right) \cdot y} \]
          4. Applied rewrites68.1%

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

          if 1.4000000000000001e164 < y

          1. Initial program 63.5%

            \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          2. Taylor expanded in y around inf

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

              \[\leadsto \frac{x}{\color{blue}{{y}^{2}}} \]
            2. unpow2N/A

              \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
            3. lower-*.f6486.4

              \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
          4. Applied rewrites86.4%

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

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

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

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

              \[\leadsto \frac{\frac{x}{y}}{\color{blue}{y}} \]
            5. lower-/.f6494.1

              \[\leadsto \frac{\frac{x}{y}}{y} \]
          6. Applied rewrites94.1%

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

        Alternative 8: 78.8% accurate, 1.5× speedup?

        \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -7900000:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\ \end{array} \end{array} \]
        NOTE: x and y should be sorted in increasing order before calling this function.
        (FPCore (x y)
         :precision binary64
         (if (<= x -7900000.0) (/ (/ y x) x) (/ x (* (+ 1.0 y) y))))
        assert(x < y);
        double code(double x, double y) {
        	double tmp;
        	if (x <= -7900000.0) {
        		tmp = (y / x) / x;
        	} else {
        		tmp = x / ((1.0 + y) * y);
        	}
        	return tmp;
        }
        
        NOTE: x and y should be sorted in increasing order before calling this function.
        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)
        use fmin_fmax_functions
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8) :: tmp
            if (x <= (-7900000.0d0)) then
                tmp = (y / x) / x
            else
                tmp = x / ((1.0d0 + y) * y)
            end if
            code = tmp
        end function
        
        assert x < y;
        public static double code(double x, double y) {
        	double tmp;
        	if (x <= -7900000.0) {
        		tmp = (y / x) / x;
        	} else {
        		tmp = x / ((1.0 + y) * y);
        	}
        	return tmp;
        }
        
        [x, y] = sort([x, y])
        def code(x, y):
        	tmp = 0
        	if x <= -7900000.0:
        		tmp = (y / x) / x
        	else:
        		tmp = x / ((1.0 + y) * y)
        	return tmp
        
        x, y = sort([x, y])
        function code(x, y)
        	tmp = 0.0
        	if (x <= -7900000.0)
        		tmp = Float64(Float64(y / x) / x);
        	else
        		tmp = Float64(x / Float64(Float64(1.0 + y) * y));
        	end
        	return tmp
        end
        
        x, y = num2cell(sort([x, y])){:}
        function tmp_2 = code(x, y)
        	tmp = 0.0;
        	if (x <= -7900000.0)
        		tmp = (y / x) / x;
        	else
        		tmp = x / ((1.0 + y) * y);
        	end
        	tmp_2 = tmp;
        end
        
        NOTE: x and y should be sorted in increasing order before calling this function.
        code[x_, y_] := If[LessEqual[x, -7900000.0], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], N[(x / N[(N[(1.0 + y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        [x, y] = \mathsf{sort}([x, y])\\
        \\
        \begin{array}{l}
        \mathbf{if}\;x \leq -7900000:\\
        \;\;\;\;\frac{\frac{y}{x}}{x}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{x}{\left(1 + y\right) \cdot y}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if x < -7.9e6

          1. Initial program 67.3%

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

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

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

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

              \[\leadsto \frac{y}{\left(1 + x\right) \cdot \color{blue}{x}} \]
            4. lower-+.f6481.0

              \[\leadsto \frac{y}{\left(1 + x\right) \cdot x} \]
          4. Applied rewrites81.0%

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

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

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

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

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

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

              \[\leadsto \frac{\frac{y}{1 + x}}{x} \]
            7. lift-+.f6485.3

              \[\leadsto \frac{\frac{y}{1 + x}}{x} \]
          6. Applied rewrites85.3%

            \[\leadsto \color{blue}{\frac{\frac{y}{1 + x}}{x}} \]
          7. Taylor expanded in x around inf

            \[\leadsto \frac{\frac{y}{x}}{x} \]
          8. Step-by-step derivation
            1. Applied rewrites84.9%

              \[\leadsto \frac{\frac{y}{x}}{x} \]

            if -7.9e6 < x

            1. Initial program 70.0%

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

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

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

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

                \[\leadsto \frac{x}{\left(1 + y\right) \cdot \color{blue}{y}} \]
              4. lower-+.f6474.3

                \[\leadsto \frac{x}{\left(1 + y\right) \cdot y} \]
            4. Applied rewrites74.3%

              \[\leadsto \color{blue}{\frac{x}{\left(1 + y\right) \cdot y}} \]
          9. Recombined 2 regimes into one program.
          10. Add Preprocessing

          Alternative 9: 73.4% accurate, 1.0× speedup?

          \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{-201}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{-144}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 850000:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \end{array} \]
          NOTE: x and y should be sorted in increasing order before calling this function.
          (FPCore (x y)
           :precision binary64
           (if (<= y -3.2e-201)
             (/ (/ y x) x)
             (if (<= y 1.05e-144)
               (/ y x)
               (if (<= y 850000.0) (/ y (* x x)) (/ (/ x y) y)))))
          assert(x < y);
          double code(double x, double y) {
          	double tmp;
          	if (y <= -3.2e-201) {
          		tmp = (y / x) / x;
          	} else if (y <= 1.05e-144) {
          		tmp = y / x;
          	} else if (y <= 850000.0) {
          		tmp = y / (x * x);
          	} else {
          		tmp = (x / y) / y;
          	}
          	return tmp;
          }
          
          NOTE: x and y should be sorted in increasing order before calling this function.
          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)
          use fmin_fmax_functions
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8) :: tmp
              if (y <= (-3.2d-201)) then
                  tmp = (y / x) / x
              else if (y <= 1.05d-144) then
                  tmp = y / x
              else if (y <= 850000.0d0) then
                  tmp = y / (x * x)
              else
                  tmp = (x / y) / y
              end if
              code = tmp
          end function
          
          assert x < y;
          public static double code(double x, double y) {
          	double tmp;
          	if (y <= -3.2e-201) {
          		tmp = (y / x) / x;
          	} else if (y <= 1.05e-144) {
          		tmp = y / x;
          	} else if (y <= 850000.0) {
          		tmp = y / (x * x);
          	} else {
          		tmp = (x / y) / y;
          	}
          	return tmp;
          }
          
          [x, y] = sort([x, y])
          def code(x, y):
          	tmp = 0
          	if y <= -3.2e-201:
          		tmp = (y / x) / x
          	elif y <= 1.05e-144:
          		tmp = y / x
          	elif y <= 850000.0:
          		tmp = y / (x * x)
          	else:
          		tmp = (x / y) / y
          	return tmp
          
          x, y = sort([x, y])
          function code(x, y)
          	tmp = 0.0
          	if (y <= -3.2e-201)
          		tmp = Float64(Float64(y / x) / x);
          	elseif (y <= 1.05e-144)
          		tmp = Float64(y / x);
          	elseif (y <= 850000.0)
          		tmp = Float64(y / Float64(x * x));
          	else
          		tmp = Float64(Float64(x / y) / y);
          	end
          	return tmp
          end
          
          x, y = num2cell(sort([x, y])){:}
          function tmp_2 = code(x, y)
          	tmp = 0.0;
          	if (y <= -3.2e-201)
          		tmp = (y / x) / x;
          	elseif (y <= 1.05e-144)
          		tmp = y / x;
          	elseif (y <= 850000.0)
          		tmp = y / (x * x);
          	else
          		tmp = (x / y) / y;
          	end
          	tmp_2 = tmp;
          end
          
          NOTE: x and y should be sorted in increasing order before calling this function.
          code[x_, y_] := If[LessEqual[y, -3.2e-201], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 1.05e-144], N[(y / x), $MachinePrecision], If[LessEqual[y, 850000.0], N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]]
          
          \begin{array}{l}
          [x, y] = \mathsf{sort}([x, y])\\
          \\
          \begin{array}{l}
          \mathbf{if}\;y \leq -3.2 \cdot 10^{-201}:\\
          \;\;\;\;\frac{\frac{y}{x}}{x}\\
          
          \mathbf{elif}\;y \leq 1.05 \cdot 10^{-144}:\\
          \;\;\;\;\frac{y}{x}\\
          
          \mathbf{elif}\;y \leq 850000:\\
          \;\;\;\;\frac{y}{x \cdot x}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\frac{x}{y}}{y}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 4 regimes
          2. if y < -3.2000000000000001e-201

            1. Initial program 70.7%

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

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

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

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

                \[\leadsto \frac{y}{\left(1 + x\right) \cdot \color{blue}{x}} \]
              4. lower-+.f6489.7

                \[\leadsto \frac{y}{\left(1 + x\right) \cdot x} \]
            4. Applied rewrites89.7%

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

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

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

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

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

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

                \[\leadsto \frac{\frac{y}{1 + x}}{x} \]
              7. lift-+.f6497.3

                \[\leadsto \frac{\frac{y}{1 + x}}{x} \]
            6. Applied rewrites97.3%

              \[\leadsto \color{blue}{\frac{\frac{y}{1 + x}}{x}} \]
            7. Taylor expanded in x around inf

              \[\leadsto \frac{\frac{y}{x}}{x} \]
            8. Step-by-step derivation
              1. Applied rewrites82.8%

                \[\leadsto \frac{\frac{y}{x}}{x} \]

              if -3.2000000000000001e-201 < y < 1.0500000000000001e-144

              1. Initial program 58.7%

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

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

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

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

                  \[\leadsto \frac{y}{\left(1 + x\right) \cdot \color{blue}{x}} \]
                4. lower-+.f6483.8

                  \[\leadsto \frac{y}{\left(1 + x\right) \cdot x} \]
              4. Applied rewrites83.8%

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

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

                  \[\leadsto \frac{y}{x} \]

                if 1.0500000000000001e-144 < y < 8.5e5

                1. Initial program 83.5%

                  \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                2. Taylor expanded in x around inf

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

                    \[\leadsto \frac{y}{\color{blue}{{x}^{2}}} \]
                  2. unpow2N/A

                    \[\leadsto \frac{y}{x \cdot \color{blue}{x}} \]
                  3. lower-*.f6434.4

                    \[\leadsto \frac{y}{x \cdot \color{blue}{x}} \]
                4. Applied rewrites34.4%

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

                if 8.5e5 < y

                1. Initial program 68.2%

                  \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                2. Taylor expanded in y around inf

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

                    \[\leadsto \frac{x}{\color{blue}{{y}^{2}}} \]
                  2. unpow2N/A

                    \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
                  3. lower-*.f6480.3

                    \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
                4. Applied rewrites80.3%

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

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

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

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

                    \[\leadsto \frac{\frac{x}{y}}{\color{blue}{y}} \]
                  5. lower-/.f6484.9

                    \[\leadsto \frac{\frac{x}{y}}{y} \]
                6. Applied rewrites84.9%

                  \[\leadsto \frac{\frac{x}{y}}{\color{blue}{y}} \]
              7. Recombined 4 regimes into one program.
              8. Add Preprocessing

              Alternative 10: 72.0% accurate, 1.0× speedup?

              \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x \cdot x}\\ \mathbf{if}\;y \leq -3.4 \cdot 10^{-201}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{-144}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 850000:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \end{array} \]
              NOTE: x and y should be sorted in increasing order before calling this function.
              (FPCore (x y)
               :precision binary64
               (let* ((t_0 (/ y (* x x))))
                 (if (<= y -3.4e-201)
                   t_0
                   (if (<= y 1.05e-144) (/ y x) (if (<= y 850000.0) t_0 (/ (/ x y) y))))))
              assert(x < y);
              double code(double x, double y) {
              	double t_0 = y / (x * x);
              	double tmp;
              	if (y <= -3.4e-201) {
              		tmp = t_0;
              	} else if (y <= 1.05e-144) {
              		tmp = y / x;
              	} else if (y <= 850000.0) {
              		tmp = t_0;
              	} else {
              		tmp = (x / y) / y;
              	}
              	return tmp;
              }
              
              NOTE: x and y should be sorted in increasing order before calling this function.
              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)
              use fmin_fmax_functions
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  real(8) :: t_0
                  real(8) :: tmp
                  t_0 = y / (x * x)
                  if (y <= (-3.4d-201)) then
                      tmp = t_0
                  else if (y <= 1.05d-144) then
                      tmp = y / x
                  else if (y <= 850000.0d0) then
                      tmp = t_0
                  else
                      tmp = (x / y) / y
                  end if
                  code = tmp
              end function
              
              assert x < y;
              public static double code(double x, double y) {
              	double t_0 = y / (x * x);
              	double tmp;
              	if (y <= -3.4e-201) {
              		tmp = t_0;
              	} else if (y <= 1.05e-144) {
              		tmp = y / x;
              	} else if (y <= 850000.0) {
              		tmp = t_0;
              	} else {
              		tmp = (x / y) / y;
              	}
              	return tmp;
              }
              
              [x, y] = sort([x, y])
              def code(x, y):
              	t_0 = y / (x * x)
              	tmp = 0
              	if y <= -3.4e-201:
              		tmp = t_0
              	elif y <= 1.05e-144:
              		tmp = y / x
              	elif y <= 850000.0:
              		tmp = t_0
              	else:
              		tmp = (x / y) / y
              	return tmp
              
              x, y = sort([x, y])
              function code(x, y)
              	t_0 = Float64(y / Float64(x * x))
              	tmp = 0.0
              	if (y <= -3.4e-201)
              		tmp = t_0;
              	elseif (y <= 1.05e-144)
              		tmp = Float64(y / x);
              	elseif (y <= 850000.0)
              		tmp = t_0;
              	else
              		tmp = Float64(Float64(x / y) / y);
              	end
              	return tmp
              end
              
              x, y = num2cell(sort([x, y])){:}
              function tmp_2 = code(x, y)
              	t_0 = y / (x * x);
              	tmp = 0.0;
              	if (y <= -3.4e-201)
              		tmp = t_0;
              	elseif (y <= 1.05e-144)
              		tmp = y / x;
              	elseif (y <= 850000.0)
              		tmp = t_0;
              	else
              		tmp = (x / y) / y;
              	end
              	tmp_2 = tmp;
              end
              
              NOTE: x and y should be sorted in increasing order before calling this function.
              code[x_, y_] := Block[{t$95$0 = N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.4e-201], t$95$0, If[LessEqual[y, 1.05e-144], N[(y / x), $MachinePrecision], If[LessEqual[y, 850000.0], t$95$0, N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision]]]]]
              
              \begin{array}{l}
              [x, y] = \mathsf{sort}([x, y])\\
              \\
              \begin{array}{l}
              t_0 := \frac{y}{x \cdot x}\\
              \mathbf{if}\;y \leq -3.4 \cdot 10^{-201}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;y \leq 1.05 \cdot 10^{-144}:\\
              \;\;\;\;\frac{y}{x}\\
              
              \mathbf{elif}\;y \leq 850000:\\
              \;\;\;\;t\_0\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{\frac{x}{y}}{y}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if y < -3.39999999999999985e-201 or 1.0500000000000001e-144 < y < 8.5e5

                1. Initial program 76.9%

                  \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                2. Taylor expanded in x around inf

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

                    \[\leadsto \frac{y}{\color{blue}{{x}^{2}}} \]
                  2. unpow2N/A

                    \[\leadsto \frac{y}{x \cdot \color{blue}{x}} \]
                  3. lower-*.f6455.3

                    \[\leadsto \frac{y}{x \cdot \color{blue}{x}} \]
                4. Applied rewrites55.3%

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

                if -3.39999999999999985e-201 < y < 1.0500000000000001e-144

                1. Initial program 58.7%

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

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

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

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

                    \[\leadsto \frac{y}{\left(1 + x\right) \cdot \color{blue}{x}} \]
                  4. lower-+.f6483.8

                    \[\leadsto \frac{y}{\left(1 + x\right) \cdot x} \]
                4. Applied rewrites83.8%

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

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

                    \[\leadsto \frac{y}{x} \]

                  if 8.5e5 < y

                  1. Initial program 68.2%

                    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                  2. Taylor expanded in y around inf

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

                      \[\leadsto \frac{x}{\color{blue}{{y}^{2}}} \]
                    2. unpow2N/A

                      \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
                    3. lower-*.f6480.3

                      \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
                  4. Applied rewrites80.3%

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

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

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

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

                      \[\leadsto \frac{\frac{x}{y}}{\color{blue}{y}} \]
                    5. lower-/.f6484.9

                      \[\leadsto \frac{\frac{x}{y}}{y} \]
                  6. Applied rewrites84.9%

                    \[\leadsto \frac{\frac{x}{y}}{\color{blue}{y}} \]
                7. Recombined 3 regimes into one program.
                8. Add Preprocessing

                Alternative 11: 70.0% accurate, 1.0× speedup?

                \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x \cdot x}\\ \mathbf{if}\;y \leq -3.4 \cdot 10^{-201}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{-144}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 850000:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \end{array} \]
                NOTE: x and y should be sorted in increasing order before calling this function.
                (FPCore (x y)
                 :precision binary64
                 (let* ((t_0 (/ y (* x x))))
                   (if (<= y -3.4e-201)
                     t_0
                     (if (<= y 1.05e-144) (/ y x) (if (<= y 850000.0) t_0 (/ x (* y y)))))))
                assert(x < y);
                double code(double x, double y) {
                	double t_0 = y / (x * x);
                	double tmp;
                	if (y <= -3.4e-201) {
                		tmp = t_0;
                	} else if (y <= 1.05e-144) {
                		tmp = y / x;
                	} else if (y <= 850000.0) {
                		tmp = t_0;
                	} else {
                		tmp = x / (y * y);
                	}
                	return tmp;
                }
                
                NOTE: x and y should be sorted in increasing order before calling this function.
                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)
                use fmin_fmax_functions
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8) :: t_0
                    real(8) :: tmp
                    t_0 = y / (x * x)
                    if (y <= (-3.4d-201)) then
                        tmp = t_0
                    else if (y <= 1.05d-144) then
                        tmp = y / x
                    else if (y <= 850000.0d0) then
                        tmp = t_0
                    else
                        tmp = x / (y * y)
                    end if
                    code = tmp
                end function
                
                assert x < y;
                public static double code(double x, double y) {
                	double t_0 = y / (x * x);
                	double tmp;
                	if (y <= -3.4e-201) {
                		tmp = t_0;
                	} else if (y <= 1.05e-144) {
                		tmp = y / x;
                	} else if (y <= 850000.0) {
                		tmp = t_0;
                	} else {
                		tmp = x / (y * y);
                	}
                	return tmp;
                }
                
                [x, y] = sort([x, y])
                def code(x, y):
                	t_0 = y / (x * x)
                	tmp = 0
                	if y <= -3.4e-201:
                		tmp = t_0
                	elif y <= 1.05e-144:
                		tmp = y / x
                	elif y <= 850000.0:
                		tmp = t_0
                	else:
                		tmp = x / (y * y)
                	return tmp
                
                x, y = sort([x, y])
                function code(x, y)
                	t_0 = Float64(y / Float64(x * x))
                	tmp = 0.0
                	if (y <= -3.4e-201)
                		tmp = t_0;
                	elseif (y <= 1.05e-144)
                		tmp = Float64(y / x);
                	elseif (y <= 850000.0)
                		tmp = t_0;
                	else
                		tmp = Float64(x / Float64(y * y));
                	end
                	return tmp
                end
                
                x, y = num2cell(sort([x, y])){:}
                function tmp_2 = code(x, y)
                	t_0 = y / (x * x);
                	tmp = 0.0;
                	if (y <= -3.4e-201)
                		tmp = t_0;
                	elseif (y <= 1.05e-144)
                		tmp = y / x;
                	elseif (y <= 850000.0)
                		tmp = t_0;
                	else
                		tmp = x / (y * y);
                	end
                	tmp_2 = tmp;
                end
                
                NOTE: x and y should be sorted in increasing order before calling this function.
                code[x_, y_] := Block[{t$95$0 = N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.4e-201], t$95$0, If[LessEqual[y, 1.05e-144], N[(y / x), $MachinePrecision], If[LessEqual[y, 850000.0], t$95$0, N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]]]]
                
                \begin{array}{l}
                [x, y] = \mathsf{sort}([x, y])\\
                \\
                \begin{array}{l}
                t_0 := \frac{y}{x \cdot x}\\
                \mathbf{if}\;y \leq -3.4 \cdot 10^{-201}:\\
                \;\;\;\;t\_0\\
                
                \mathbf{elif}\;y \leq 1.05 \cdot 10^{-144}:\\
                \;\;\;\;\frac{y}{x}\\
                
                \mathbf{elif}\;y \leq 850000:\\
                \;\;\;\;t\_0\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{x}{y \cdot y}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if y < -3.39999999999999985e-201 or 1.0500000000000001e-144 < y < 8.5e5

                  1. Initial program 76.9%

                    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                  2. Taylor expanded in x around inf

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

                      \[\leadsto \frac{y}{\color{blue}{{x}^{2}}} \]
                    2. unpow2N/A

                      \[\leadsto \frac{y}{x \cdot \color{blue}{x}} \]
                    3. lower-*.f6455.3

                      \[\leadsto \frac{y}{x \cdot \color{blue}{x}} \]
                  4. Applied rewrites55.3%

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

                  if -3.39999999999999985e-201 < y < 1.0500000000000001e-144

                  1. Initial program 58.7%

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

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

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

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

                      \[\leadsto \frac{y}{\left(1 + x\right) \cdot \color{blue}{x}} \]
                    4. lower-+.f6483.8

                      \[\leadsto \frac{y}{\left(1 + x\right) \cdot x} \]
                  4. Applied rewrites83.8%

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

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

                      \[\leadsto \frac{y}{x} \]

                    if 8.5e5 < y

                    1. Initial program 68.2%

                      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                    2. Taylor expanded in y around inf

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

                        \[\leadsto \frac{x}{\color{blue}{{y}^{2}}} \]
                      2. unpow2N/A

                        \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
                      3. lower-*.f6480.3

                        \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
                    4. Applied rewrites80.3%

                      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
                  7. Recombined 3 regimes into one program.
                  8. Add Preprocessing

                  Alternative 12: 60.2% accurate, 1.9× speedup?

                  \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 8.5 \cdot 10^{-26}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \end{array} \]
                  NOTE: x and y should be sorted in increasing order before calling this function.
                  (FPCore (x y) :precision binary64 (if (<= y 8.5e-26) (/ y x) (/ x (* y y))))
                  assert(x < y);
                  double code(double x, double y) {
                  	double tmp;
                  	if (y <= 8.5e-26) {
                  		tmp = y / x;
                  	} else {
                  		tmp = x / (y * y);
                  	}
                  	return tmp;
                  }
                  
                  NOTE: x and y should be sorted in increasing order before calling this function.
                  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)
                  use fmin_fmax_functions
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      real(8) :: tmp
                      if (y <= 8.5d-26) then
                          tmp = y / x
                      else
                          tmp = x / (y * y)
                      end if
                      code = tmp
                  end function
                  
                  assert x < y;
                  public static double code(double x, double y) {
                  	double tmp;
                  	if (y <= 8.5e-26) {
                  		tmp = y / x;
                  	} else {
                  		tmp = x / (y * y);
                  	}
                  	return tmp;
                  }
                  
                  [x, y] = sort([x, y])
                  def code(x, y):
                  	tmp = 0
                  	if y <= 8.5e-26:
                  		tmp = y / x
                  	else:
                  		tmp = x / (y * y)
                  	return tmp
                  
                  x, y = sort([x, y])
                  function code(x, y)
                  	tmp = 0.0
                  	if (y <= 8.5e-26)
                  		tmp = Float64(y / x);
                  	else
                  		tmp = Float64(x / Float64(y * y));
                  	end
                  	return tmp
                  end
                  
                  x, y = num2cell(sort([x, y])){:}
                  function tmp_2 = code(x, y)
                  	tmp = 0.0;
                  	if (y <= 8.5e-26)
                  		tmp = y / x;
                  	else
                  		tmp = x / (y * y);
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  NOTE: x and y should be sorted in increasing order before calling this function.
                  code[x_, y_] := If[LessEqual[y, 8.5e-26], N[(y / x), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]
                  
                  \begin{array}{l}
                  [x, y] = \mathsf{sort}([x, y])\\
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;y \leq 8.5 \cdot 10^{-26}:\\
                  \;\;\;\;\frac{y}{x}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\frac{x}{y \cdot y}\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if y < 8.50000000000000004e-26

                    1. Initial program 67.8%

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

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

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

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

                        \[\leadsto \frac{y}{\left(1 + x\right) \cdot \color{blue}{x}} \]
                      4. lower-+.f6476.8

                        \[\leadsto \frac{y}{\left(1 + x\right) \cdot x} \]
                    4. Applied rewrites76.8%

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

                      \[\leadsto \frac{y}{x} \]
                    6. Step-by-step derivation
                      1. Applied rewrites47.2%

                        \[\leadsto \frac{y}{x} \]

                      if 8.50000000000000004e-26 < y

                      1. Initial program 70.1%

                        \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                      2. Taylor expanded in y around inf

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

                          \[\leadsto \frac{x}{\color{blue}{{y}^{2}}} \]
                        2. unpow2N/A

                          \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
                        3. lower-*.f6475.1

                          \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
                      4. Applied rewrites75.1%

                        \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
                    7. Recombined 2 regimes into one program.
                    8. Add Preprocessing

                    Alternative 13: 26.5% accurate, 5.7× speedup?

                    \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{y}{x} \end{array} \]
                    NOTE: x and y should be sorted in increasing order before calling this function.
                    (FPCore (x y) :precision binary64 (/ y x))
                    assert(x < y);
                    double code(double x, double y) {
                    	return y / x;
                    }
                    
                    NOTE: x and y should be sorted in increasing order before calling this function.
                    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)
                    use fmin_fmax_functions
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        code = y / x
                    end function
                    
                    assert x < y;
                    public static double code(double x, double y) {
                    	return y / x;
                    }
                    
                    [x, y] = sort([x, y])
                    def code(x, y):
                    	return y / x
                    
                    x, y = sort([x, y])
                    function code(x, y)
                    	return Float64(y / x)
                    end
                    
                    x, y = num2cell(sort([x, y])){:}
                    function tmp = code(x, y)
                    	tmp = y / x;
                    end
                    
                    NOTE: x and y should be sorted in increasing order before calling this function.
                    code[x_, y_] := N[(y / x), $MachinePrecision]
                    
                    \begin{array}{l}
                    [x, y] = \mathsf{sort}([x, y])\\
                    \\
                    \frac{y}{x}
                    \end{array}
                    
                    Derivation
                    1. Initial program 68.9%

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

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

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

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

                        \[\leadsto \frac{y}{\left(1 + x\right) \cdot \color{blue}{x}} \]
                      4. lower-+.f6449.2

                        \[\leadsto \frac{y}{\left(1 + x\right) \cdot x} \]
                    4. Applied rewrites49.2%

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

                      \[\leadsto \frac{y}{x} \]
                    6. Step-by-step derivation
                      1. Applied rewrites26.5%

                        \[\leadsto \frac{y}{x} \]
                      2. Add Preprocessing

                      Reproduce

                      ?
                      herbie shell --seed 2025101 
                      (FPCore (x y)
                        :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
                        :precision binary64
                        (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))