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

Percentage Accurate: 69.5% → 99.8%
Time: 3.6s
Alternatives: 18
Speedup: 1.7×

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 18 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: 69.5% 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: 99.8% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{x}{y + x} \cdot \left(\frac{y}{y + x} \cdot \frac{-1}{\left(-1 - x\right) - y}\right) \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (* (/ x (+ y x)) (* (/ y (+ y x)) (/ -1.0 (- (- -1.0 x) y)))))
assert(x < y);
double code(double x, double y) {
	return (x / (y + x)) * ((y / (y + x)) * (-1.0 / ((-1.0 - x) - y)));
}
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 = (x / (y + x)) * ((y / (y + x)) * ((-1.0d0) / (((-1.0d0) - x) - y)))
end function
assert x < y;
public static double code(double x, double y) {
	return (x / (y + x)) * ((y / (y + x)) * (-1.0 / ((-1.0 - x) - y)));
}
[x, y] = sort([x, y])
def code(x, y):
	return (x / (y + x)) * ((y / (y + x)) * (-1.0 / ((-1.0 - x) - y)))
x, y = sort([x, y])
function code(x, y)
	return Float64(Float64(x / Float64(y + x)) * Float64(Float64(y / Float64(y + x)) * Float64(-1.0 / Float64(Float64(-1.0 - x) - y))))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = (x / (y + x)) * ((y / (y + x)) * (-1.0 / ((-1.0 - x) - y)));
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(N[(-1.0 - x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y + x} \cdot \left(\frac{y}{y + x} \cdot \frac{-1}{\left(-1 - x\right) - y}\right)
\end{array}
Derivation
  1. Initial program 69.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. Step-by-step derivation
    1. 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)}} \]
    2. 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)}} \]
    3. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{x}{y + x} \cdot \left(\frac{y}{y + x} \cdot \frac{-1}{\mathsf{neg}\left(\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}\right) \]
  3. Applied rewrites99.8%

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

Alternative 2: 99.5% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 10^{-38}:\\ \;\;\;\;\frac{\frac{\frac{y}{x + y} \cdot x}{x - -1}}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{y}{y - \left(-1 - x\right)} \cdot x}{y + x}}{y + x}\\ \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 1e-38)
   (/ (/ (* (/ y (+ x y)) x) (- x -1.0)) (+ x y))
   (/ (/ (* (/ y (- y (- -1.0 x))) x) (+ y x)) (+ y x))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 1e-38) {
		tmp = (((y / (x + y)) * x) / (x - -1.0)) / (x + y);
	} else {
		tmp = (((y / (y - (-1.0 - x))) * x) / (y + x)) / (y + x);
	}
	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 <= 1d-38) then
        tmp = (((y / (x + y)) * x) / (x - (-1.0d0))) / (x + y)
    else
        tmp = (((y / (y - ((-1.0d0) - x))) * x) / (y + x)) / (y + x)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 1e-38) {
		tmp = (((y / (x + y)) * x) / (x - -1.0)) / (x + y);
	} else {
		tmp = (((y / (y - (-1.0 - x))) * x) / (y + x)) / (y + x);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 1e-38:
		tmp = (((y / (x + y)) * x) / (x - -1.0)) / (x + y)
	else:
		tmp = (((y / (y - (-1.0 - x))) * x) / (y + x)) / (y + x)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 1e-38)
		tmp = Float64(Float64(Float64(Float64(y / Float64(x + y)) * x) / Float64(x - -1.0)) / Float64(x + y));
	else
		tmp = Float64(Float64(Float64(Float64(y / Float64(y - Float64(-1.0 - x))) * x) / Float64(y + x)) / Float64(y + x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 1e-38)
		tmp = (((y / (x + y)) * x) / (x - -1.0)) / (x + y);
	else
		tmp = (((y / (y - (-1.0 - x))) * x) / (y + x)) / (y + x);
	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, 1e-38], N[(N[(N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / N[(x - -1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y / N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10^{-38}:\\
\;\;\;\;\frac{\frac{\frac{y}{x + y} \cdot x}{x - -1}}{x + y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 9.9999999999999996e-39

    1. Initial program 69.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 0

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)} \cdot x} \]
    6. Applied rewrites70.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot \frac{y}{y + x}}{\color{blue}{\left(x - -1\right) \cdot \left(y + x\right)}} \]
    8. Applied rewrites74.5%

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

    if 9.9999999999999996e-39 < y

    1. Initial program 69.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. Step-by-step derivation
      1. 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)}} \]
      2. 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)}} \]
      3. *-commutativeN/A

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

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

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

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

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

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

Alternative 3: 97.0% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-157}:\\ \;\;\;\;\frac{\frac{\frac{y}{x + y} \cdot x}{x - -1}}{x + y}\\ \mathbf{elif}\;y \leq 4 \cdot 10^{+163}:\\ \;\;\;\;\frac{y}{y + x} \cdot \frac{x}{\left(y - \left(-1 - x\right)\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + x} \cdot \left(1 \cdot \frac{-1}{\left(-1 - x\right) - y}\right)\\ \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 -5e-157)
   (/ (/ (* (/ y (+ x y)) x) (- x -1.0)) (+ x y))
   (if (<= y 4e+163)
     (* (/ y (+ y x)) (/ x (* (- y (- -1.0 x)) (+ y x))))
     (* (/ x (+ y x)) (* 1.0 (/ -1.0 (- (- -1.0 x) y)))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= -5e-157) {
		tmp = (((y / (x + y)) * x) / (x - -1.0)) / (x + y);
	} else if (y <= 4e+163) {
		tmp = (y / (y + x)) * (x / ((y - (-1.0 - x)) * (y + x)));
	} else {
		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - 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 <= (-5d-157)) then
        tmp = (((y / (x + y)) * x) / (x - (-1.0d0))) / (x + y)
    else if (y <= 4d+163) then
        tmp = (y / (y + x)) * (x / ((y - ((-1.0d0) - x)) * (y + x)))
    else
        tmp = (x / (y + x)) * (1.0d0 * ((-1.0d0) / (((-1.0d0) - x) - y)))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= -5e-157) {
		tmp = (((y / (x + y)) * x) / (x - -1.0)) / (x + y);
	} else if (y <= 4e+163) {
		tmp = (y / (y + x)) * (x / ((y - (-1.0 - x)) * (y + x)));
	} else {
		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - y)));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= -5e-157:
		tmp = (((y / (x + y)) * x) / (x - -1.0)) / (x + y)
	elif y <= 4e+163:
		tmp = (y / (y + x)) * (x / ((y - (-1.0 - x)) * (y + x)))
	else:
		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - y)))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= -5e-157)
		tmp = Float64(Float64(Float64(Float64(y / Float64(x + y)) * x) / Float64(x - -1.0)) / Float64(x + y));
	elseif (y <= 4e+163)
		tmp = Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(Float64(y - Float64(-1.0 - x)) * Float64(y + x))));
	else
		tmp = Float64(Float64(x / Float64(y + x)) * Float64(1.0 * Float64(-1.0 / Float64(Float64(-1.0 - x) - y))));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -5e-157)
		tmp = (((y / (x + y)) * x) / (x - -1.0)) / (x + y);
	elseif (y <= 4e+163)
		tmp = (y / (y + x)) * (x / ((y - (-1.0 - x)) * (y + x)));
	else
		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - 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, -5e-157], N[(N[(N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / N[(x - -1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4e+163], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 * N[(-1.0 / N[(N[(-1.0 - x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-157}:\\
\;\;\;\;\frac{\frac{\frac{y}{x + y} \cdot x}{x - -1}}{x + y}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5.0000000000000002e-157

    1. Initial program 69.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 0

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)} \cdot x} \]
    6. Applied rewrites70.9%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot \frac{y}{y + x}}{\color{blue}{\left(x - -1\right) \cdot \left(y + x\right)}} \]
    8. Applied rewrites74.5%

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

    if -5.0000000000000002e-157 < y < 3.9999999999999998e163

    1. Initial program 69.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. Step-by-step derivation
      1. 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)}} \]
      2. 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)} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\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{y \cdot x}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      5. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.9999999999999998e163 < y

    1. Initial program 69.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. Step-by-step derivation
      1. 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)}} \]
      2. 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)}} \]
      3. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y + x} \cdot \left(\frac{y}{y + x} \cdot \frac{-1}{\mathsf{neg}\left(\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}\right) \]
    3. Applied rewrites99.8%

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

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

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

    Alternative 4: 96.9% accurate, 0.8× speedup?

    \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{x}{y + x}\\ \mathbf{if}\;y \leq -1.05 \cdot 10^{+89}:\\ \;\;\;\;\frac{\frac{y}{y + x}}{y + x} \cdot \frac{x}{x - -1}\\ \mathbf{elif}\;y \leq 4 \cdot 10^{+163}:\\ \;\;\;\;\frac{y}{\left(y - \left(-1 - x\right)\right) \cdot \left(y + x\right)} \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \left(1 \cdot \frac{-1}{\left(-1 - x\right) - y}\right)\\ \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 (/ x (+ y x))))
       (if (<= y -1.05e+89)
         (* (/ (/ y (+ y x)) (+ y x)) (/ x (- x -1.0)))
         (if (<= y 4e+163)
           (* (/ y (* (- y (- -1.0 x)) (+ y x))) t_0)
           (* t_0 (* 1.0 (/ -1.0 (- (- -1.0 x) y))))))))
    assert(x < y);
    double code(double x, double y) {
    	double t_0 = x / (y + x);
    	double tmp;
    	if (y <= -1.05e+89) {
    		tmp = ((y / (y + x)) / (y + x)) * (x / (x - -1.0));
    	} else if (y <= 4e+163) {
    		tmp = (y / ((y - (-1.0 - x)) * (y + x))) * t_0;
    	} else {
    		tmp = t_0 * (1.0 * (-1.0 / ((-1.0 - x) - 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 = x / (y + x)
        if (y <= (-1.05d+89)) then
            tmp = ((y / (y + x)) / (y + x)) * (x / (x - (-1.0d0)))
        else if (y <= 4d+163) then
            tmp = (y / ((y - ((-1.0d0) - x)) * (y + x))) * t_0
        else
            tmp = t_0 * (1.0d0 * ((-1.0d0) / (((-1.0d0) - x) - y)))
        end if
        code = tmp
    end function
    
    assert x < y;
    public static double code(double x, double y) {
    	double t_0 = x / (y + x);
    	double tmp;
    	if (y <= -1.05e+89) {
    		tmp = ((y / (y + x)) / (y + x)) * (x / (x - -1.0));
    	} else if (y <= 4e+163) {
    		tmp = (y / ((y - (-1.0 - x)) * (y + x))) * t_0;
    	} else {
    		tmp = t_0 * (1.0 * (-1.0 / ((-1.0 - x) - y)));
    	}
    	return tmp;
    }
    
    [x, y] = sort([x, y])
    def code(x, y):
    	t_0 = x / (y + x)
    	tmp = 0
    	if y <= -1.05e+89:
    		tmp = ((y / (y + x)) / (y + x)) * (x / (x - -1.0))
    	elif y <= 4e+163:
    		tmp = (y / ((y - (-1.0 - x)) * (y + x))) * t_0
    	else:
    		tmp = t_0 * (1.0 * (-1.0 / ((-1.0 - x) - y)))
    	return tmp
    
    x, y = sort([x, y])
    function code(x, y)
    	t_0 = Float64(x / Float64(y + x))
    	tmp = 0.0
    	if (y <= -1.05e+89)
    		tmp = Float64(Float64(Float64(y / Float64(y + x)) / Float64(y + x)) * Float64(x / Float64(x - -1.0)));
    	elseif (y <= 4e+163)
    		tmp = Float64(Float64(y / Float64(Float64(y - Float64(-1.0 - x)) * Float64(y + x))) * t_0);
    	else
    		tmp = Float64(t_0 * Float64(1.0 * Float64(-1.0 / Float64(Float64(-1.0 - x) - y))));
    	end
    	return tmp
    end
    
    x, y = num2cell(sort([x, y])){:}
    function tmp_2 = code(x, y)
    	t_0 = x / (y + x);
    	tmp = 0.0;
    	if (y <= -1.05e+89)
    		tmp = ((y / (y + x)) / (y + x)) * (x / (x - -1.0));
    	elseif (y <= 4e+163)
    		tmp = (y / ((y - (-1.0 - x)) * (y + x))) * t_0;
    	else
    		tmp = t_0 * (1.0 * (-1.0 / ((-1.0 - x) - 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[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.05e+89], N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4e+163], N[(N[(y / N[(N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(t$95$0 * N[(1.0 * N[(-1.0 / N[(N[(-1.0 - x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
    
    \begin{array}{l}
    [x, y] = \mathsf{sort}([x, y])\\
    \\
    \begin{array}{l}
    t_0 := \frac{x}{y + x}\\
    \mathbf{if}\;y \leq -1.05 \cdot 10^{+89}:\\
    \;\;\;\;\frac{\frac{y}{y + x}}{y + x} \cdot \frac{x}{x - -1}\\
    
    \mathbf{elif}\;y \leq 4 \cdot 10^{+163}:\\
    \;\;\;\;\frac{y}{\left(y - \left(-1 - x\right)\right) \cdot \left(y + x\right)} \cdot t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0 \cdot \left(1 \cdot \frac{-1}{\left(-1 - x\right) - y}\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y < -1.04999999999999993e89

      1. Initial program 69.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 0

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

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

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

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

          \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\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(1 + x\right)} \]
        4. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

      if -1.04999999999999993e89 < y < 3.9999999999999998e163

      1. Initial program 69.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. Step-by-step derivation
        1. 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)}} \]
        2. 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)}} \]
        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. associate-*l*N/A

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

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

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

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

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

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

      if 3.9999999999999998e163 < y

      1. Initial program 69.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. Step-by-step derivation
        1. 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)}} \]
        2. 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)}} \]
        3. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{x}{y + x} \cdot \left(\frac{y}{y + x} \cdot \frac{-1}{\mathsf{neg}\left(\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}\right) \]
      3. Applied rewrites99.8%

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

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

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

      Alternative 5: 94.3% accurate, 0.8× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 2 \cdot 10^{-17}:\\ \;\;\;\;\frac{\frac{\frac{y}{x + y} \cdot x}{x - -1}}{x + y}\\ \mathbf{elif}\;y \leq 9 \cdot 10^{+71}:\\ \;\;\;\;\frac{x}{\left(y - \left(-1 - x\right)\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + x} \cdot \left(1 \cdot \frac{-1}{\left(-1 - x\right) - y}\right)\\ \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 2e-17)
         (/ (/ (* (/ y (+ x y)) x) (- x -1.0)) (+ x y))
         (if (<= y 9e+71)
           (* (/ x (* (- y (- -1.0 x)) (* (+ y x) (+ y x)))) y)
           (* (/ x (+ y x)) (* 1.0 (/ -1.0 (- (- -1.0 x) y)))))))
      assert(x < y);
      double code(double x, double y) {
      	double tmp;
      	if (y <= 2e-17) {
      		tmp = (((y / (x + y)) * x) / (x - -1.0)) / (x + y);
      	} else if (y <= 9e+71) {
      		tmp = (x / ((y - (-1.0 - x)) * ((y + x) * (y + x)))) * y;
      	} else {
      		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - 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 <= 2d-17) then
              tmp = (((y / (x + y)) * x) / (x - (-1.0d0))) / (x + y)
          else if (y <= 9d+71) then
              tmp = (x / ((y - ((-1.0d0) - x)) * ((y + x) * (y + x)))) * y
          else
              tmp = (x / (y + x)) * (1.0d0 * ((-1.0d0) / (((-1.0d0) - x) - y)))
          end if
          code = tmp
      end function
      
      assert x < y;
      public static double code(double x, double y) {
      	double tmp;
      	if (y <= 2e-17) {
      		tmp = (((y / (x + y)) * x) / (x - -1.0)) / (x + y);
      	} else if (y <= 9e+71) {
      		tmp = (x / ((y - (-1.0 - x)) * ((y + x) * (y + x)))) * y;
      	} else {
      		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - y)));
      	}
      	return tmp;
      }
      
      [x, y] = sort([x, y])
      def code(x, y):
      	tmp = 0
      	if y <= 2e-17:
      		tmp = (((y / (x + y)) * x) / (x - -1.0)) / (x + y)
      	elif y <= 9e+71:
      		tmp = (x / ((y - (-1.0 - x)) * ((y + x) * (y + x)))) * y
      	else:
      		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - y)))
      	return tmp
      
      x, y = sort([x, y])
      function code(x, y)
      	tmp = 0.0
      	if (y <= 2e-17)
      		tmp = Float64(Float64(Float64(Float64(y / Float64(x + y)) * x) / Float64(x - -1.0)) / Float64(x + y));
      	elseif (y <= 9e+71)
      		tmp = Float64(Float64(x / Float64(Float64(y - Float64(-1.0 - x)) * Float64(Float64(y + x) * Float64(y + x)))) * y);
      	else
      		tmp = Float64(Float64(x / Float64(y + x)) * Float64(1.0 * Float64(-1.0 / Float64(Float64(-1.0 - x) - y))));
      	end
      	return tmp
      end
      
      x, y = num2cell(sort([x, y])){:}
      function tmp_2 = code(x, y)
      	tmp = 0.0;
      	if (y <= 2e-17)
      		tmp = (((y / (x + y)) * x) / (x - -1.0)) / (x + y);
      	elseif (y <= 9e+71)
      		tmp = (x / ((y - (-1.0 - x)) * ((y + x) * (y + x)))) * y;
      	else
      		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - 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, 2e-17], N[(N[(N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / N[(x - -1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+71], N[(N[(x / N[(N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 * N[(-1.0 / N[(N[(-1.0 - x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
      
      \begin{array}{l}
      [x, y] = \mathsf{sort}([x, y])\\
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq 2 \cdot 10^{-17}:\\
      \;\;\;\;\frac{\frac{\frac{y}{x + y} \cdot x}{x - -1}}{x + y}\\
      
      \mathbf{elif}\;y \leq 9 \cdot 10^{+71}:\\
      \;\;\;\;\frac{x}{\left(y - \left(-1 - x\right)\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)} \cdot y\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{x}{y + x} \cdot \left(1 \cdot \frac{-1}{\left(-1 - x\right) - y}\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if y < 2.00000000000000014e-17

        1. Initial program 69.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 0

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)} \cdot x} \]
        6. Applied rewrites70.9%

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{x \cdot \frac{y}{y + x}}{\color{blue}{\left(x - -1\right) \cdot \left(y + x\right)}} \]
        8. Applied rewrites74.5%

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

        if 2.00000000000000014e-17 < y < 9.00000000000000087e71

        1. Initial program 69.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. Step-by-step derivation
          1. 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)}} \]
          2. mult-flipN/A

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

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

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

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

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

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

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

        if 9.00000000000000087e71 < y

        1. Initial program 69.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. Step-by-step derivation
          1. 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)}} \]
          2. 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)}} \]
          3. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{x}{y + x} \cdot \left(\frac{y}{y + x} \cdot \frac{-1}{\mathsf{neg}\left(\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}\right) \]
        3. Applied rewrites99.8%

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

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

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

        Alternative 6: 92.7% accurate, 0.8× speedup?

        \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq -8 \cdot 10^{-157}:\\ \;\;\;\;\frac{\frac{y}{x - -1}}{y + x}\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-5}:\\ \;\;\;\;\frac{y}{y + x} \cdot \frac{x}{\left(x - -1\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + x} \cdot \left(1 \cdot \frac{-1}{\left(-1 - x\right) - y}\right)\\ \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 -8e-157)
           (/ (/ y (- x -1.0)) (+ y x))
           (if (<= y 1.9e-5)
             (* (/ y (+ y x)) (/ x (* (- x -1.0) (+ y x))))
             (* (/ x (+ y x)) (* 1.0 (/ -1.0 (- (- -1.0 x) y)))))))
        assert(x < y);
        double code(double x, double y) {
        	double tmp;
        	if (y <= -8e-157) {
        		tmp = (y / (x - -1.0)) / (y + x);
        	} else if (y <= 1.9e-5) {
        		tmp = (y / (y + x)) * (x / ((x - -1.0) * (y + x)));
        	} else {
        		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - 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 <= (-8d-157)) then
                tmp = (y / (x - (-1.0d0))) / (y + x)
            else if (y <= 1.9d-5) then
                tmp = (y / (y + x)) * (x / ((x - (-1.0d0)) * (y + x)))
            else
                tmp = (x / (y + x)) * (1.0d0 * ((-1.0d0) / (((-1.0d0) - x) - y)))
            end if
            code = tmp
        end function
        
        assert x < y;
        public static double code(double x, double y) {
        	double tmp;
        	if (y <= -8e-157) {
        		tmp = (y / (x - -1.0)) / (y + x);
        	} else if (y <= 1.9e-5) {
        		tmp = (y / (y + x)) * (x / ((x - -1.0) * (y + x)));
        	} else {
        		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - y)));
        	}
        	return tmp;
        }
        
        [x, y] = sort([x, y])
        def code(x, y):
        	tmp = 0
        	if y <= -8e-157:
        		tmp = (y / (x - -1.0)) / (y + x)
        	elif y <= 1.9e-5:
        		tmp = (y / (y + x)) * (x / ((x - -1.0) * (y + x)))
        	else:
        		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - y)))
        	return tmp
        
        x, y = sort([x, y])
        function code(x, y)
        	tmp = 0.0
        	if (y <= -8e-157)
        		tmp = Float64(Float64(y / Float64(x - -1.0)) / Float64(y + x));
        	elseif (y <= 1.9e-5)
        		tmp = Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(Float64(x - -1.0) * Float64(y + x))));
        	else
        		tmp = Float64(Float64(x / Float64(y + x)) * Float64(1.0 * Float64(-1.0 / Float64(Float64(-1.0 - x) - y))));
        	end
        	return tmp
        end
        
        x, y = num2cell(sort([x, y])){:}
        function tmp_2 = code(x, y)
        	tmp = 0.0;
        	if (y <= -8e-157)
        		tmp = (y / (x - -1.0)) / (y + x);
        	elseif (y <= 1.9e-5)
        		tmp = (y / (y + x)) * (x / ((x - -1.0) * (y + x)));
        	else
        		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - 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, -8e-157], N[(N[(y / N[(x - -1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e-5], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(N[(x - -1.0), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 * N[(-1.0 / N[(N[(-1.0 - x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        [x, y] = \mathsf{sort}([x, y])\\
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -8 \cdot 10^{-157}:\\
        \;\;\;\;\frac{\frac{y}{x - -1}}{y + x}\\
        
        \mathbf{elif}\;y \leq 1.9 \cdot 10^{-5}:\\
        \;\;\;\;\frac{y}{y + x} \cdot \frac{x}{\left(x - -1\right) \cdot \left(y + x\right)}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{x}{y + x} \cdot \left(1 \cdot \frac{-1}{\left(-1 - x\right) - y}\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if y < -7.99999999999999955e-157

          1. Initial program 69.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. Step-by-step derivation
            1. 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)}} \]
            2. 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)}} \]
            3. *-commutativeN/A

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

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

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

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

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

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

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

              \[\leadsto \frac{\frac{y}{\color{blue}{1 + x}}}{y + x} \]
            2. lower-+.f6450.4

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

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

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

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

              \[\leadsto \frac{\frac{y}{x + \left(\mathsf{neg}\left(-1\right)\right)}}{y + x} \]
            4. sub-flipN/A

              \[\leadsto \frac{\frac{y}{x - \color{blue}{-1}}}{y + x} \]
            5. lift--.f6450.4

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

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

          if -7.99999999999999955e-157 < y < 1.9000000000000001e-5

          1. Initial program 69.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 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 1.9000000000000001e-5 < y

          1. Initial program 69.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. Step-by-step derivation
            1. 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)}} \]
            2. 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)}} \]
            3. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{x}{y + x} \cdot \left(\frac{y}{y + x} \cdot \frac{-1}{\mathsf{neg}\left(\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}\right) \]
          3. Applied rewrites99.8%

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

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

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

          Alternative 7: 92.7% accurate, 0.9× speedup?

          \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.9 \cdot 10^{-5}:\\ \;\;\;\;\frac{\frac{\frac{y}{x + y} \cdot x}{x - -1}}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + x} \cdot \left(1 \cdot \frac{-1}{\left(-1 - x\right) - y}\right)\\ \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.9e-5)
             (/ (/ (* (/ y (+ x y)) x) (- x -1.0)) (+ x y))
             (* (/ x (+ y x)) (* 1.0 (/ -1.0 (- (- -1.0 x) y))))))
          assert(x < y);
          double code(double x, double y) {
          	double tmp;
          	if (y <= 1.9e-5) {
          		tmp = (((y / (x + y)) * x) / (x - -1.0)) / (x + y);
          	} else {
          		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - 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.9d-5) then
                  tmp = (((y / (x + y)) * x) / (x - (-1.0d0))) / (x + y)
              else
                  tmp = (x / (y + x)) * (1.0d0 * ((-1.0d0) / (((-1.0d0) - x) - y)))
              end if
              code = tmp
          end function
          
          assert x < y;
          public static double code(double x, double y) {
          	double tmp;
          	if (y <= 1.9e-5) {
          		tmp = (((y / (x + y)) * x) / (x - -1.0)) / (x + y);
          	} else {
          		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - y)));
          	}
          	return tmp;
          }
          
          [x, y] = sort([x, y])
          def code(x, y):
          	tmp = 0
          	if y <= 1.9e-5:
          		tmp = (((y / (x + y)) * x) / (x - -1.0)) / (x + y)
          	else:
          		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - y)))
          	return tmp
          
          x, y = sort([x, y])
          function code(x, y)
          	tmp = 0.0
          	if (y <= 1.9e-5)
          		tmp = Float64(Float64(Float64(Float64(y / Float64(x + y)) * x) / Float64(x - -1.0)) / Float64(x + y));
          	else
          		tmp = Float64(Float64(x / Float64(y + x)) * Float64(1.0 * Float64(-1.0 / Float64(Float64(-1.0 - x) - y))));
          	end
          	return tmp
          end
          
          x, y = num2cell(sort([x, y])){:}
          function tmp_2 = code(x, y)
          	tmp = 0.0;
          	if (y <= 1.9e-5)
          		tmp = (((y / (x + y)) * x) / (x - -1.0)) / (x + y);
          	else
          		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - 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.9e-5], N[(N[(N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / N[(x - -1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 * N[(-1.0 / N[(N[(-1.0 - x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          [x, y] = \mathsf{sort}([x, y])\\
          \\
          \begin{array}{l}
          \mathbf{if}\;y \leq 1.9 \cdot 10^{-5}:\\
          \;\;\;\;\frac{\frac{\frac{y}{x + y} \cdot x}{x - -1}}{x + y}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{x}{y + x} \cdot \left(1 \cdot \frac{-1}{\left(-1 - x\right) - y}\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y < 1.9000000000000001e-5

            1. Initial program 69.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 0

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)} \cdot x} \]
            6. Applied rewrites70.9%

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{x \cdot \frac{y}{y + x}}{\color{blue}{\left(x - -1\right) \cdot \left(y + x\right)}} \]
            8. Applied rewrites74.5%

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

            if 1.9000000000000001e-5 < y

            1. Initial program 69.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. Step-by-step derivation
              1. 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)}} \]
              2. 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)}} \]
              3. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{x}{y + x} \cdot \left(\frac{y}{y + x} \cdot \frac{-1}{\mathsf{neg}\left(\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}\right) \]
            3. Applied rewrites99.8%

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

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

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

            Alternative 8: 92.6% accurate, 0.9× speedup?

            \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.9 \cdot 10^{-5}:\\ \;\;\;\;\frac{\frac{y}{y + x}}{y + x} \cdot \frac{x}{x - -1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + x} \cdot \left(1 \cdot \frac{-1}{\left(-1 - x\right) - y}\right)\\ \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.9e-5)
               (* (/ (/ y (+ y x)) (+ y x)) (/ x (- x -1.0)))
               (* (/ x (+ y x)) (* 1.0 (/ -1.0 (- (- -1.0 x) y))))))
            assert(x < y);
            double code(double x, double y) {
            	double tmp;
            	if (y <= 1.9e-5) {
            		tmp = ((y / (y + x)) / (y + x)) * (x / (x - -1.0));
            	} else {
            		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - 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.9d-5) then
                    tmp = ((y / (y + x)) / (y + x)) * (x / (x - (-1.0d0)))
                else
                    tmp = (x / (y + x)) * (1.0d0 * ((-1.0d0) / (((-1.0d0) - x) - y)))
                end if
                code = tmp
            end function
            
            assert x < y;
            public static double code(double x, double y) {
            	double tmp;
            	if (y <= 1.9e-5) {
            		tmp = ((y / (y + x)) / (y + x)) * (x / (x - -1.0));
            	} else {
            		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - y)));
            	}
            	return tmp;
            }
            
            [x, y] = sort([x, y])
            def code(x, y):
            	tmp = 0
            	if y <= 1.9e-5:
            		tmp = ((y / (y + x)) / (y + x)) * (x / (x - -1.0))
            	else:
            		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - y)))
            	return tmp
            
            x, y = sort([x, y])
            function code(x, y)
            	tmp = 0.0
            	if (y <= 1.9e-5)
            		tmp = Float64(Float64(Float64(y / Float64(y + x)) / Float64(y + x)) * Float64(x / Float64(x - -1.0)));
            	else
            		tmp = Float64(Float64(x / Float64(y + x)) * Float64(1.0 * Float64(-1.0 / Float64(Float64(-1.0 - x) - y))));
            	end
            	return tmp
            end
            
            x, y = num2cell(sort([x, y])){:}
            function tmp_2 = code(x, y)
            	tmp = 0.0;
            	if (y <= 1.9e-5)
            		tmp = ((y / (y + x)) / (y + x)) * (x / (x - -1.0));
            	else
            		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - 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.9e-5], N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 * N[(-1.0 / N[(N[(-1.0 - x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            [x, y] = \mathsf{sort}([x, y])\\
            \\
            \begin{array}{l}
            \mathbf{if}\;y \leq 1.9 \cdot 10^{-5}:\\
            \;\;\;\;\frac{\frac{y}{y + x}}{y + x} \cdot \frac{x}{x - -1}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{x}{y + x} \cdot \left(1 \cdot \frac{-1}{\left(-1 - x\right) - y}\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < 1.9000000000000001e-5

              1. Initial program 69.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 0

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

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

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

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

                  \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\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(1 + x\right)} \]
                4. associate-*l*N/A

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

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

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

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

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

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

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

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

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

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

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

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

              if 1.9000000000000001e-5 < y

              1. Initial program 69.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. Step-by-step derivation
                1. 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)}} \]
                2. 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)}} \]
                3. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{x}{y + x} \cdot \left(\frac{y}{y + x} \cdot \frac{-1}{\mathsf{neg}\left(\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}\right) \]
              3. Applied rewrites99.8%

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

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

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

              Alternative 9: 89.1% accurate, 0.8× speedup?

              \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 4.2 \cdot 10^{-177}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{\left(1 + \frac{y}{x}\right) \cdot x}\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-5}:\\ \;\;\;\;y \cdot \frac{x}{\left(x - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + x} \cdot \left(1 \cdot \frac{-1}{\left(-1 - x\right) - y}\right)\\ \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.2e-177)
                 (/ (/ y (+ 1.0 x)) (* (+ 1.0 (/ y x)) x))
                 (if (<= y 1.9e-5)
                   (* y (/ x (* (- x -1.0) (* (+ y x) (+ y x)))))
                   (* (/ x (+ y x)) (* 1.0 (/ -1.0 (- (- -1.0 x) y)))))))
              assert(x < y);
              double code(double x, double y) {
              	double tmp;
              	if (y <= 4.2e-177) {
              		tmp = (y / (1.0 + x)) / ((1.0 + (y / x)) * x);
              	} else if (y <= 1.9e-5) {
              		tmp = y * (x / ((x - -1.0) * ((y + x) * (y + x))));
              	} else {
              		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - 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.2d-177) then
                      tmp = (y / (1.0d0 + x)) / ((1.0d0 + (y / x)) * x)
                  else if (y <= 1.9d-5) then
                      tmp = y * (x / ((x - (-1.0d0)) * ((y + x) * (y + x))))
                  else
                      tmp = (x / (y + x)) * (1.0d0 * ((-1.0d0) / (((-1.0d0) - x) - y)))
                  end if
                  code = tmp
              end function
              
              assert x < y;
              public static double code(double x, double y) {
              	double tmp;
              	if (y <= 4.2e-177) {
              		tmp = (y / (1.0 + x)) / ((1.0 + (y / x)) * x);
              	} else if (y <= 1.9e-5) {
              		tmp = y * (x / ((x - -1.0) * ((y + x) * (y + x))));
              	} else {
              		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - y)));
              	}
              	return tmp;
              }
              
              [x, y] = sort([x, y])
              def code(x, y):
              	tmp = 0
              	if y <= 4.2e-177:
              		tmp = (y / (1.0 + x)) / ((1.0 + (y / x)) * x)
              	elif y <= 1.9e-5:
              		tmp = y * (x / ((x - -1.0) * ((y + x) * (y + x))))
              	else:
              		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - y)))
              	return tmp
              
              x, y = sort([x, y])
              function code(x, y)
              	tmp = 0.0
              	if (y <= 4.2e-177)
              		tmp = Float64(Float64(y / Float64(1.0 + x)) / Float64(Float64(1.0 + Float64(y / x)) * x));
              	elseif (y <= 1.9e-5)
              		tmp = Float64(y * Float64(x / Float64(Float64(x - -1.0) * Float64(Float64(y + x) * Float64(y + x)))));
              	else
              		tmp = Float64(Float64(x / Float64(y + x)) * Float64(1.0 * Float64(-1.0 / Float64(Float64(-1.0 - x) - y))));
              	end
              	return tmp
              end
              
              x, y = num2cell(sort([x, y])){:}
              function tmp_2 = code(x, y)
              	tmp = 0.0;
              	if (y <= 4.2e-177)
              		tmp = (y / (1.0 + x)) / ((1.0 + (y / x)) * x);
              	elseif (y <= 1.9e-5)
              		tmp = y * (x / ((x - -1.0) * ((y + x) * (y + x))));
              	else
              		tmp = (x / (y + x)) * (1.0 * (-1.0 / ((-1.0 - x) - 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.2e-177], N[(N[(y / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e-5], N[(y * N[(x / N[(N[(x - -1.0), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 * N[(-1.0 / N[(N[(-1.0 - x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
              
              \begin{array}{l}
              [x, y] = \mathsf{sort}([x, y])\\
              \\
              \begin{array}{l}
              \mathbf{if}\;y \leq 4.2 \cdot 10^{-177}:\\
              \;\;\;\;\frac{\frac{y}{1 + x}}{\left(1 + \frac{y}{x}\right) \cdot x}\\
              
              \mathbf{elif}\;y \leq 1.9 \cdot 10^{-5}:\\
              \;\;\;\;y \cdot \frac{x}{\left(x - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{x}{y + x} \cdot \left(1 \cdot \frac{-1}{\left(-1 - x\right) - y}\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if y < 4.20000000000000002e-177

                1. Initial program 69.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. Step-by-step derivation
                  1. 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)}} \]
                  2. 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)}} \]
                  3. *-commutativeN/A

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

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

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

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

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

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

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

                    \[\leadsto \frac{\frac{y}{\color{blue}{1 + x}}}{y + x} \]
                  2. lower-+.f6450.4

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

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

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

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

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

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

                    \[\leadsto \frac{\frac{y}{1 + x}}{\color{blue}{\left(1 + \frac{y}{x}\right)} \cdot x} \]
                  6. lower-unsound-/.f6462.5

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

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

                if 4.20000000000000002e-177 < y < 1.9000000000000001e-5

                1. Initial program 69.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 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto y \cdot \frac{x}{\left(x - -1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
                  14. lower--.f6475.1

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

                    \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\mathsf{Rewrite=>}\left(lift-+.f64, \left(x + y\right)\right) \cdot \left(x + y\right)\right)} \]
                  16. lower--.f64N/A

                    \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\mathsf{Rewrite<=}\left(+-commutative, \left(y + x\right)\right) \cdot \left(x + y\right)\right)} \]
                  17. lower--.f64N/A

                    \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\mathsf{Rewrite<=}\left(lift-+.f64, \left(y + x\right)\right) \cdot \left(x + y\right)\right)} \]
                  18. lower--.f64N/A

                    \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\left(y + x\right) \cdot \mathsf{Rewrite=>}\left(lift-+.f64, \left(x + y\right)\right)\right)} \]
                  19. lower--.f64N/A

                    \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\left(y + x\right) \cdot \mathsf{Rewrite<=}\left(+-commutative, \left(y + x\right)\right)\right)} \]
                  20. lower--.f64N/A

                    \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\left(y + x\right) \cdot \mathsf{Rewrite<=}\left(lift-+.f64, \left(y + x\right)\right)\right)} \]
                6. Applied rewrites75.1%

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

                if 1.9000000000000001e-5 < y

                1. Initial program 69.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. Step-by-step derivation
                  1. 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)}} \]
                  2. 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)}} \]
                  3. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{x}{y + x} \cdot \left(\frac{y}{y + x} \cdot \frac{-1}{\mathsf{neg}\left(\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)}\right)}\right) \]
                3. Applied rewrites99.8%

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

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

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

                Alternative 10: 89.0% accurate, 0.8× speedup?

                \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 4.2 \cdot 10^{-177}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{\left(1 + \frac{y}{x}\right) \cdot x}\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-5}:\\ \;\;\;\;y \cdot \frac{x}{\left(x - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - -1}}{y + x}\\ \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.2e-177)
                   (/ (/ y (+ 1.0 x)) (* (+ 1.0 (/ y x)) x))
                   (if (<= y 1.9e-5)
                     (* y (/ x (* (- x -1.0) (* (+ y x) (+ y x)))))
                     (/ (/ x (- y -1.0)) (+ y x)))))
                assert(x < y);
                double code(double x, double y) {
                	double tmp;
                	if (y <= 4.2e-177) {
                		tmp = (y / (1.0 + x)) / ((1.0 + (y / x)) * x);
                	} else if (y <= 1.9e-5) {
                		tmp = y * (x / ((x - -1.0) * ((y + x) * (y + x))));
                	} else {
                		tmp = (x / (y - -1.0)) / (y + x);
                	}
                	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.2d-177) then
                        tmp = (y / (1.0d0 + x)) / ((1.0d0 + (y / x)) * x)
                    else if (y <= 1.9d-5) then
                        tmp = y * (x / ((x - (-1.0d0)) * ((y + x) * (y + x))))
                    else
                        tmp = (x / (y - (-1.0d0))) / (y + x)
                    end if
                    code = tmp
                end function
                
                assert x < y;
                public static double code(double x, double y) {
                	double tmp;
                	if (y <= 4.2e-177) {
                		tmp = (y / (1.0 + x)) / ((1.0 + (y / x)) * x);
                	} else if (y <= 1.9e-5) {
                		tmp = y * (x / ((x - -1.0) * ((y + x) * (y + x))));
                	} else {
                		tmp = (x / (y - -1.0)) / (y + x);
                	}
                	return tmp;
                }
                
                [x, y] = sort([x, y])
                def code(x, y):
                	tmp = 0
                	if y <= 4.2e-177:
                		tmp = (y / (1.0 + x)) / ((1.0 + (y / x)) * x)
                	elif y <= 1.9e-5:
                		tmp = y * (x / ((x - -1.0) * ((y + x) * (y + x))))
                	else:
                		tmp = (x / (y - -1.0)) / (y + x)
                	return tmp
                
                x, y = sort([x, y])
                function code(x, y)
                	tmp = 0.0
                	if (y <= 4.2e-177)
                		tmp = Float64(Float64(y / Float64(1.0 + x)) / Float64(Float64(1.0 + Float64(y / x)) * x));
                	elseif (y <= 1.9e-5)
                		tmp = Float64(y * Float64(x / Float64(Float64(x - -1.0) * Float64(Float64(y + x) * Float64(y + x)))));
                	else
                		tmp = Float64(Float64(x / Float64(y - -1.0)) / Float64(y + x));
                	end
                	return tmp
                end
                
                x, y = num2cell(sort([x, y])){:}
                function tmp_2 = code(x, y)
                	tmp = 0.0;
                	if (y <= 4.2e-177)
                		tmp = (y / (1.0 + x)) / ((1.0 + (y / x)) * x);
                	elseif (y <= 1.9e-5)
                		tmp = y * (x / ((x - -1.0) * ((y + x) * (y + x))));
                	else
                		tmp = (x / (y - -1.0)) / (y + x);
                	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.2e-177], N[(N[(y / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e-5], N[(y * N[(x / N[(N[(x - -1.0), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y - -1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]
                
                \begin{array}{l}
                [x, y] = \mathsf{sort}([x, y])\\
                \\
                \begin{array}{l}
                \mathbf{if}\;y \leq 4.2 \cdot 10^{-177}:\\
                \;\;\;\;\frac{\frac{y}{1 + x}}{\left(1 + \frac{y}{x}\right) \cdot x}\\
                
                \mathbf{elif}\;y \leq 1.9 \cdot 10^{-5}:\\
                \;\;\;\;y \cdot \frac{x}{\left(x - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{\frac{x}{y - -1}}{y + x}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if y < 4.20000000000000002e-177

                  1. Initial program 69.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. Step-by-step derivation
                    1. 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)}} \]
                    2. 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)}} \]
                    3. *-commutativeN/A

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

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{y}{\color{blue}{1 + x}}}{y + x} \]
                    2. lower-+.f6450.4

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{y}{1 + x}}{\color{blue}{\left(1 + \frac{y}{x}\right)} \cdot x} \]
                    6. lower-unsound-/.f6462.5

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

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

                  if 4.20000000000000002e-177 < y < 1.9000000000000001e-5

                  1. Initial program 69.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 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto y \cdot \frac{x}{\left(x - -1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
                    14. lower--.f6475.1

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

                      \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\mathsf{Rewrite=>}\left(lift-+.f64, \left(x + y\right)\right) \cdot \left(x + y\right)\right)} \]
                    16. lower--.f64N/A

                      \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\mathsf{Rewrite<=}\left(+-commutative, \left(y + x\right)\right) \cdot \left(x + y\right)\right)} \]
                    17. lower--.f64N/A

                      \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\mathsf{Rewrite<=}\left(lift-+.f64, \left(y + x\right)\right) \cdot \left(x + y\right)\right)} \]
                    18. lower--.f64N/A

                      \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\left(y + x\right) \cdot \mathsf{Rewrite=>}\left(lift-+.f64, \left(x + y\right)\right)\right)} \]
                    19. lower--.f64N/A

                      \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\left(y + x\right) \cdot \mathsf{Rewrite<=}\left(+-commutative, \left(y + x\right)\right)\right)} \]
                    20. lower--.f64N/A

                      \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\left(y + x\right) \cdot \mathsf{Rewrite<=}\left(lift-+.f64, \left(y + x\right)\right)\right)} \]
                  6. Applied rewrites75.1%

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

                  if 1.9000000000000001e-5 < y

                  1. Initial program 69.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. Step-by-step derivation
                    1. 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)}} \]
                    2. 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)}} \]
                    3. *-commutativeN/A

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

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{x}{\color{blue}{1 + y}}}{y + x} \]
                    2. lower-+.f6451.4

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

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

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

                      \[\leadsto \frac{\frac{x}{y + \color{blue}{1}}}{y + x} \]
                    3. add-flip-revN/A

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

                      \[\leadsto \frac{\frac{x}{y - -1}}{y + x} \]
                    5. lower--.f6451.4

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

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

                Alternative 11: 88.5% accurate, 0.8× speedup?

                \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 4.2 \cdot 10^{-177}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{\left(1 + \frac{y}{x}\right) \cdot x}\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-5}:\\ \;\;\;\;\frac{y}{\left(x - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - -1}}{y + x}\\ \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.2e-177)
                   (/ (/ y (+ 1.0 x)) (* (+ 1.0 (/ y x)) x))
                   (if (<= y 1.9e-5)
                     (* (/ y (* (- x -1.0) (* (+ y x) (+ y x)))) x)
                     (/ (/ x (- y -1.0)) (+ y x)))))
                assert(x < y);
                double code(double x, double y) {
                	double tmp;
                	if (y <= 4.2e-177) {
                		tmp = (y / (1.0 + x)) / ((1.0 + (y / x)) * x);
                	} else if (y <= 1.9e-5) {
                		tmp = (y / ((x - -1.0) * ((y + x) * (y + x)))) * x;
                	} else {
                		tmp = (x / (y - -1.0)) / (y + x);
                	}
                	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.2d-177) then
                        tmp = (y / (1.0d0 + x)) / ((1.0d0 + (y / x)) * x)
                    else if (y <= 1.9d-5) then
                        tmp = (y / ((x - (-1.0d0)) * ((y + x) * (y + x)))) * x
                    else
                        tmp = (x / (y - (-1.0d0))) / (y + x)
                    end if
                    code = tmp
                end function
                
                assert x < y;
                public static double code(double x, double y) {
                	double tmp;
                	if (y <= 4.2e-177) {
                		tmp = (y / (1.0 + x)) / ((1.0 + (y / x)) * x);
                	} else if (y <= 1.9e-5) {
                		tmp = (y / ((x - -1.0) * ((y + x) * (y + x)))) * x;
                	} else {
                		tmp = (x / (y - -1.0)) / (y + x);
                	}
                	return tmp;
                }
                
                [x, y] = sort([x, y])
                def code(x, y):
                	tmp = 0
                	if y <= 4.2e-177:
                		tmp = (y / (1.0 + x)) / ((1.0 + (y / x)) * x)
                	elif y <= 1.9e-5:
                		tmp = (y / ((x - -1.0) * ((y + x) * (y + x)))) * x
                	else:
                		tmp = (x / (y - -1.0)) / (y + x)
                	return tmp
                
                x, y = sort([x, y])
                function code(x, y)
                	tmp = 0.0
                	if (y <= 4.2e-177)
                		tmp = Float64(Float64(y / Float64(1.0 + x)) / Float64(Float64(1.0 + Float64(y / x)) * x));
                	elseif (y <= 1.9e-5)
                		tmp = Float64(Float64(y / Float64(Float64(x - -1.0) * Float64(Float64(y + x) * Float64(y + x)))) * x);
                	else
                		tmp = Float64(Float64(x / Float64(y - -1.0)) / Float64(y + x));
                	end
                	return tmp
                end
                
                x, y = num2cell(sort([x, y])){:}
                function tmp_2 = code(x, y)
                	tmp = 0.0;
                	if (y <= 4.2e-177)
                		tmp = (y / (1.0 + x)) / ((1.0 + (y / x)) * x);
                	elseif (y <= 1.9e-5)
                		tmp = (y / ((x - -1.0) * ((y + x) * (y + x)))) * x;
                	else
                		tmp = (x / (y - -1.0)) / (y + x);
                	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.2e-177], N[(N[(y / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e-5], N[(N[(y / N[(N[(x - -1.0), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(x / N[(y - -1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]
                
                \begin{array}{l}
                [x, y] = \mathsf{sort}([x, y])\\
                \\
                \begin{array}{l}
                \mathbf{if}\;y \leq 4.2 \cdot 10^{-177}:\\
                \;\;\;\;\frac{\frac{y}{1 + x}}{\left(1 + \frac{y}{x}\right) \cdot x}\\
                
                \mathbf{elif}\;y \leq 1.9 \cdot 10^{-5}:\\
                \;\;\;\;\frac{y}{\left(x - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)} \cdot x\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{\frac{x}{y - -1}}{y + x}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if y < 4.20000000000000002e-177

                  1. Initial program 69.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. Step-by-step derivation
                    1. 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)}} \]
                    2. 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)}} \]
                    3. *-commutativeN/A

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

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{y}{\color{blue}{1 + x}}}{y + x} \]
                    2. lower-+.f6450.4

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{y}{1 + x}}{\color{blue}{\left(1 + \frac{y}{x}\right)} \cdot x} \]
                    6. lower-unsound-/.f6462.5

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

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

                  if 4.20000000000000002e-177 < y < 1.9000000000000001e-5

                  1. Initial program 69.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 0

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

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

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

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

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

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

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

                      \[\leadsto \color{blue}{\frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)} \cdot x} \]
                  6. Applied rewrites70.9%

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

                  if 1.9000000000000001e-5 < y

                  1. Initial program 69.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. Step-by-step derivation
                    1. 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)}} \]
                    2. 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)}} \]
                    3. *-commutativeN/A

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

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{x}{\color{blue}{1 + y}}}{y + x} \]
                    2. lower-+.f6451.4

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

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

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

                      \[\leadsto \frac{\frac{x}{y + \color{blue}{1}}}{y + x} \]
                    3. add-flip-revN/A

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

                      \[\leadsto \frac{\frac{x}{y - -1}}{y + x} \]
                    5. lower--.f6451.4

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

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

                Alternative 12: 82.4% accurate, 1.0× speedup?

                \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.02 \cdot 10^{-85}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{\left(1 + \frac{y}{x}\right) \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - -1}}{y + x}\\ \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.02e-85)
                   (/ (/ y (+ 1.0 x)) (* (+ 1.0 (/ y x)) x))
                   (/ (/ x (- y -1.0)) (+ y x))))
                assert(x < y);
                double code(double x, double y) {
                	double tmp;
                	if (y <= 1.02e-85) {
                		tmp = (y / (1.0 + x)) / ((1.0 + (y / x)) * x);
                	} else {
                		tmp = (x / (y - -1.0)) / (y + x);
                	}
                	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.02d-85) then
                        tmp = (y / (1.0d0 + x)) / ((1.0d0 + (y / x)) * x)
                    else
                        tmp = (x / (y - (-1.0d0))) / (y + x)
                    end if
                    code = tmp
                end function
                
                assert x < y;
                public static double code(double x, double y) {
                	double tmp;
                	if (y <= 1.02e-85) {
                		tmp = (y / (1.0 + x)) / ((1.0 + (y / x)) * x);
                	} else {
                		tmp = (x / (y - -1.0)) / (y + x);
                	}
                	return tmp;
                }
                
                [x, y] = sort([x, y])
                def code(x, y):
                	tmp = 0
                	if y <= 1.02e-85:
                		tmp = (y / (1.0 + x)) / ((1.0 + (y / x)) * x)
                	else:
                		tmp = (x / (y - -1.0)) / (y + x)
                	return tmp
                
                x, y = sort([x, y])
                function code(x, y)
                	tmp = 0.0
                	if (y <= 1.02e-85)
                		tmp = Float64(Float64(y / Float64(1.0 + x)) / Float64(Float64(1.0 + Float64(y / x)) * x));
                	else
                		tmp = Float64(Float64(x / Float64(y - -1.0)) / Float64(y + x));
                	end
                	return tmp
                end
                
                x, y = num2cell(sort([x, y])){:}
                function tmp_2 = code(x, y)
                	tmp = 0.0;
                	if (y <= 1.02e-85)
                		tmp = (y / (1.0 + x)) / ((1.0 + (y / x)) * x);
                	else
                		tmp = (x / (y - -1.0)) / (y + x);
                	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.02e-85], N[(N[(y / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(y / x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y - -1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]
                
                \begin{array}{l}
                [x, y] = \mathsf{sort}([x, y])\\
                \\
                \begin{array}{l}
                \mathbf{if}\;y \leq 1.02 \cdot 10^{-85}:\\
                \;\;\;\;\frac{\frac{y}{1 + x}}{\left(1 + \frac{y}{x}\right) \cdot x}\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{\frac{x}{y - -1}}{y + x}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if y < 1.02000000000000001e-85

                  1. Initial program 69.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. Step-by-step derivation
                    1. 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)}} \]
                    2. 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)}} \]
                    3. *-commutativeN/A

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

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{y}{\color{blue}{1 + x}}}{y + x} \]
                    2. lower-+.f6450.4

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{y}{1 + x}}{\color{blue}{\left(1 + \frac{y}{x}\right)} \cdot x} \]
                    6. lower-unsound-/.f6462.5

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

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

                  if 1.02000000000000001e-85 < y

                  1. Initial program 69.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. Step-by-step derivation
                    1. 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)}} \]
                    2. 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)}} \]
                    3. *-commutativeN/A

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

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{x}{\color{blue}{1 + y}}}{y + x} \]
                    2. lower-+.f6451.4

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

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

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

                      \[\leadsto \frac{\frac{x}{y + \color{blue}{1}}}{y + x} \]
                    3. add-flip-revN/A

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

                      \[\leadsto \frac{\frac{x}{y - -1}}{y + x} \]
                    5. lower--.f6451.4

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

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

                Alternative 13: 82.4% accurate, 1.4× speedup?

                \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.02 \cdot 10^{-85}:\\ \;\;\;\;\frac{\frac{y}{x - -1}}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - -1}}{y + x}\\ \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.02e-85)
                   (/ (/ y (- x -1.0)) (+ y x))
                   (/ (/ x (- y -1.0)) (+ y x))))
                assert(x < y);
                double code(double x, double y) {
                	double tmp;
                	if (y <= 1.02e-85) {
                		tmp = (y / (x - -1.0)) / (y + x);
                	} else {
                		tmp = (x / (y - -1.0)) / (y + x);
                	}
                	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.02d-85) then
                        tmp = (y / (x - (-1.0d0))) / (y + x)
                    else
                        tmp = (x / (y - (-1.0d0))) / (y + x)
                    end if
                    code = tmp
                end function
                
                assert x < y;
                public static double code(double x, double y) {
                	double tmp;
                	if (y <= 1.02e-85) {
                		tmp = (y / (x - -1.0)) / (y + x);
                	} else {
                		tmp = (x / (y - -1.0)) / (y + x);
                	}
                	return tmp;
                }
                
                [x, y] = sort([x, y])
                def code(x, y):
                	tmp = 0
                	if y <= 1.02e-85:
                		tmp = (y / (x - -1.0)) / (y + x)
                	else:
                		tmp = (x / (y - -1.0)) / (y + x)
                	return tmp
                
                x, y = sort([x, y])
                function code(x, y)
                	tmp = 0.0
                	if (y <= 1.02e-85)
                		tmp = Float64(Float64(y / Float64(x - -1.0)) / Float64(y + x));
                	else
                		tmp = Float64(Float64(x / Float64(y - -1.0)) / Float64(y + x));
                	end
                	return tmp
                end
                
                x, y = num2cell(sort([x, y])){:}
                function tmp_2 = code(x, y)
                	tmp = 0.0;
                	if (y <= 1.02e-85)
                		tmp = (y / (x - -1.0)) / (y + x);
                	else
                		tmp = (x / (y - -1.0)) / (y + x);
                	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.02e-85], N[(N[(y / N[(x - -1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y - -1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]
                
                \begin{array}{l}
                [x, y] = \mathsf{sort}([x, y])\\
                \\
                \begin{array}{l}
                \mathbf{if}\;y \leq 1.02 \cdot 10^{-85}:\\
                \;\;\;\;\frac{\frac{y}{x - -1}}{y + x}\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{\frac{x}{y - -1}}{y + x}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if y < 1.02000000000000001e-85

                  1. Initial program 69.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. Step-by-step derivation
                    1. 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)}} \]
                    2. 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)}} \]
                    3. *-commutativeN/A

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

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{y}{\color{blue}{1 + x}}}{y + x} \]
                    2. lower-+.f6450.4

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

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

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

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

                      \[\leadsto \frac{\frac{y}{x + \left(\mathsf{neg}\left(-1\right)\right)}}{y + x} \]
                    4. sub-flipN/A

                      \[\leadsto \frac{\frac{y}{x - \color{blue}{-1}}}{y + x} \]
                    5. lift--.f6450.4

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

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

                  if 1.02000000000000001e-85 < y

                  1. Initial program 69.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. Step-by-step derivation
                    1. 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)}} \]
                    2. 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)}} \]
                    3. *-commutativeN/A

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

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{x}{\color{blue}{1 + y}}}{y + x} \]
                    2. lower-+.f6451.4

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

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

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

                      \[\leadsto \frac{\frac{x}{y + \color{blue}{1}}}{y + x} \]
                    3. add-flip-revN/A

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

                      \[\leadsto \frac{\frac{x}{y - -1}}{y + x} \]
                    5. lower--.f6451.4

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

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

                Alternative 14: 81.2% accurate, 1.4× speedup?

                \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.02 \cdot 10^{-85}:\\ \;\;\;\;\frac{y}{x \cdot \left(1 + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - -1}}{y + x}\\ \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.02e-85) (/ y (* x (+ 1.0 x))) (/ (/ x (- y -1.0)) (+ y x))))
                assert(x < y);
                double code(double x, double y) {
                	double tmp;
                	if (y <= 1.02e-85) {
                		tmp = y / (x * (1.0 + x));
                	} else {
                		tmp = (x / (y - -1.0)) / (y + x);
                	}
                	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.02d-85) then
                        tmp = y / (x * (1.0d0 + x))
                    else
                        tmp = (x / (y - (-1.0d0))) / (y + x)
                    end if
                    code = tmp
                end function
                
                assert x < y;
                public static double code(double x, double y) {
                	double tmp;
                	if (y <= 1.02e-85) {
                		tmp = y / (x * (1.0 + x));
                	} else {
                		tmp = (x / (y - -1.0)) / (y + x);
                	}
                	return tmp;
                }
                
                [x, y] = sort([x, y])
                def code(x, y):
                	tmp = 0
                	if y <= 1.02e-85:
                		tmp = y / (x * (1.0 + x))
                	else:
                		tmp = (x / (y - -1.0)) / (y + x)
                	return tmp
                
                x, y = sort([x, y])
                function code(x, y)
                	tmp = 0.0
                	if (y <= 1.02e-85)
                		tmp = Float64(y / Float64(x * Float64(1.0 + x)));
                	else
                		tmp = Float64(Float64(x / Float64(y - -1.0)) / Float64(y + x));
                	end
                	return tmp
                end
                
                x, y = num2cell(sort([x, y])){:}
                function tmp_2 = code(x, y)
                	tmp = 0.0;
                	if (y <= 1.02e-85)
                		tmp = y / (x * (1.0 + x));
                	else
                		tmp = (x / (y - -1.0)) / (y + x);
                	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.02e-85], N[(y / N[(x * N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y - -1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]
                
                \begin{array}{l}
                [x, y] = \mathsf{sort}([x, y])\\
                \\
                \begin{array}{l}
                \mathbf{if}\;y \leq 1.02 \cdot 10^{-85}:\\
                \;\;\;\;\frac{y}{x \cdot \left(1 + x\right)}\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{\frac{x}{y - -1}}{y + x}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if y < 1.02000000000000001e-85

                  1. Initial program 69.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 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. lower-*.f64N/A

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

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

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

                  if 1.02000000000000001e-85 < y

                  1. Initial program 69.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. Step-by-step derivation
                    1. 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)}} \]
                    2. 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)}} \]
                    3. *-commutativeN/A

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

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{x}{\color{blue}{1 + y}}}{y + x} \]
                    2. lower-+.f6451.4

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

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

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

                      \[\leadsto \frac{\frac{x}{y + \color{blue}{1}}}{y + x} \]
                    3. add-flip-revN/A

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

                      \[\leadsto \frac{\frac{x}{y - -1}}{y + x} \]
                    5. lower--.f6451.4

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

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

                Alternative 15: 81.0% accurate, 1.7× speedup?

                \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.02 \cdot 10^{-85}:\\ \;\;\;\;\frac{y}{x \cdot \left(1 + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - -1}}{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.02e-85) (/ y (* x (+ 1.0 x))) (/ (/ x (- y -1.0)) y)))
                assert(x < y);
                double code(double x, double y) {
                	double tmp;
                	if (y <= 1.02e-85) {
                		tmp = y / (x * (1.0 + x));
                	} else {
                		tmp = (x / (y - -1.0)) / 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.02d-85) then
                        tmp = y / (x * (1.0d0 + x))
                    else
                        tmp = (x / (y - (-1.0d0))) / y
                    end if
                    code = tmp
                end function
                
                assert x < y;
                public static double code(double x, double y) {
                	double tmp;
                	if (y <= 1.02e-85) {
                		tmp = y / (x * (1.0 + x));
                	} else {
                		tmp = (x / (y - -1.0)) / y;
                	}
                	return tmp;
                }
                
                [x, y] = sort([x, y])
                def code(x, y):
                	tmp = 0
                	if y <= 1.02e-85:
                		tmp = y / (x * (1.0 + x))
                	else:
                		tmp = (x / (y - -1.0)) / y
                	return tmp
                
                x, y = sort([x, y])
                function code(x, y)
                	tmp = 0.0
                	if (y <= 1.02e-85)
                		tmp = Float64(y / Float64(x * Float64(1.0 + x)));
                	else
                		tmp = Float64(Float64(x / Float64(y - -1.0)) / y);
                	end
                	return tmp
                end
                
                x, y = num2cell(sort([x, y])){:}
                function tmp_2 = code(x, y)
                	tmp = 0.0;
                	if (y <= 1.02e-85)
                		tmp = y / (x * (1.0 + x));
                	else
                		tmp = (x / (y - -1.0)) / 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.02e-85], N[(y / N[(x * N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y - -1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
                
                \begin{array}{l}
                [x, y] = \mathsf{sort}([x, y])\\
                \\
                \begin{array}{l}
                \mathbf{if}\;y \leq 1.02 \cdot 10^{-85}:\\
                \;\;\;\;\frac{y}{x \cdot \left(1 + x\right)}\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{\frac{x}{y - -1}}{y}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if y < 1.02000000000000001e-85

                  1. Initial program 69.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 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. lower-*.f64N/A

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

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

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

                  if 1.02000000000000001e-85 < y

                  1. Initial program 69.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 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. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{x}{1 + y}}{y} \]
                    8. +-commutativeN/A

                      \[\leadsto \frac{\frac{x}{y + 1}}{y} \]
                    9. add-flip-revN/A

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

                      \[\leadsto \frac{\frac{x}{y - -1}}{y} \]
                    11. lower--.f6450.8

                      \[\leadsto \frac{\frac{x}{y - -1}}{y} \]
                  6. Applied rewrites50.8%

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

                Alternative 16: 78.7% accurate, 1.7× speedup?

                \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.02 \cdot 10^{-85}:\\ \;\;\;\;\frac{y}{x \cdot \left(1 + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\ \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.02e-85) (/ y (* x (+ 1.0 x))) (/ x (fma y y y))))
                assert(x < y);
                double code(double x, double y) {
                	double tmp;
                	if (y <= 1.02e-85) {
                		tmp = y / (x * (1.0 + x));
                	} else {
                		tmp = x / fma(y, y, y);
                	}
                	return tmp;
                }
                
                x, y = sort([x, y])
                function code(x, y)
                	tmp = 0.0
                	if (y <= 1.02e-85)
                		tmp = Float64(y / Float64(x * Float64(1.0 + x)));
                	else
                		tmp = Float64(x / fma(y, y, y));
                	end
                	return tmp
                end
                
                NOTE: x and y should be sorted in increasing order before calling this function.
                code[x_, y_] := If[LessEqual[y, 1.02e-85], N[(y / N[(x * N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision]]
                
                \begin{array}{l}
                [x, y] = \mathsf{sort}([x, y])\\
                \\
                \begin{array}{l}
                \mathbf{if}\;y \leq 1.02 \cdot 10^{-85}:\\
                \;\;\;\;\frac{y}{x \cdot \left(1 + x\right)}\\
                
                \mathbf{else}:\\
                \;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if y < 1.02000000000000001e-85

                  1. Initial program 69.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 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. lower-*.f64N/A

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

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

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

                  if 1.02000000000000001e-85 < y

                  1. Initial program 69.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 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. lower-*.f64N/A

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

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

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

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

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

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

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

                      \[\leadsto \frac{x}{y \cdot y + y} \]
                    6. lower-fma.f6449.4

                      \[\leadsto \frac{x}{\mathsf{fma}\left(y, \color{blue}{y}, y\right)} \]
                  6. Applied rewrites49.4%

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

                Alternative 17: 49.4% accurate, 2.6× speedup?

                \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{x}{\mathsf{fma}\left(y, y, y\right)} \end{array} \]
                NOTE: x and y should be sorted in increasing order before calling this function.
                (FPCore (x y) :precision binary64 (/ x (fma y y y)))
                assert(x < y);
                double code(double x, double y) {
                	return x / fma(y, y, y);
                }
                
                x, y = sort([x, y])
                function code(x, y)
                	return Float64(x / fma(y, y, y))
                end
                
                NOTE: x and y should be sorted in increasing order before calling this function.
                code[x_, y_] := N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision]
                
                \begin{array}{l}
                [x, y] = \mathsf{sort}([x, y])\\
                \\
                \frac{x}{\mathsf{fma}\left(y, y, y\right)}
                \end{array}
                
                Derivation
                1. Initial program 69.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 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. lower-*.f64N/A

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

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

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

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

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

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

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

                    \[\leadsto \frac{x}{y \cdot y + y} \]
                  6. lower-fma.f6449.4

                    \[\leadsto \frac{x}{\mathsf{fma}\left(y, \color{blue}{y}, y\right)} \]
                6. Applied rewrites49.4%

                  \[\leadsto \color{blue}{\frac{x}{\mathsf{fma}\left(y, y, y\right)}} \]
                7. Add Preprocessing

                Alternative 18: 26.1% accurate, 5.5× speedup?

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{x}{y \cdot y + y} \]
                  6. lower-fma.f6449.4

                    \[\leadsto \frac{x}{\mathsf{fma}\left(y, \color{blue}{y}, y\right)} \]
                6. Applied rewrites49.4%

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

                  \[\leadsto \frac{x}{\color{blue}{y}} \]
                8. Step-by-step derivation
                  1. lower-/.f6426.1

                    \[\leadsto \frac{x}{y} \]
                9. Applied rewrites26.1%

                  \[\leadsto \frac{x}{\color{blue}{y}} \]
                10. Add Preprocessing

                Reproduce

                ?
                herbie shell --seed 2025159 
                (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))))