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

Percentage Accurate: 69.1% → 99.8%
Time: 6.1s
Alternatives: 17
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 17 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.1% 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, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{\frac{y \cdot \frac{x}{y + x}}{y - \left(-1 - x\right)}}{y + x} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (/ (/ (* y (/ x (+ y x))) (- y (- -1.0 x))) (+ y x)))
assert(x < y);
double code(double x, double y) {
	return ((y * (x / (y + x))) / (y - (-1.0 - x))) / (y + x);
}
NOTE: x and y should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = ((y * (x / (y + x))) / (y - ((-1.0d0) - x))) / (y + x)
end function
assert x < y;
public static double code(double x, double y) {
	return ((y * (x / (y + x))) / (y - (-1.0 - x))) / (y + x);
}
[x, y] = sort([x, y])
def code(x, y):
	return ((y * (x / (y + x))) / (y - (-1.0 - x))) / (y + x)
x, y = sort([x, y])
function code(x, y)
	return Float64(Float64(Float64(y * Float64(x / Float64(y + x))) / Float64(y - Float64(-1.0 - x))) / Float64(y + x))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = ((y * (x / (y + x))) / (y - (-1.0 - x))) / (y + x);
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(N[(N[(y * N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{y \cdot \frac{x}{y + x}}{y - \left(-1 - x\right)}}{y + x}
\end{array}
Derivation
  1. Initial program 69.1%

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

      \[\leadsto \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. associate-/r*N/A

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

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

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

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

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

Alternative 2: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{x}{x + y} \cdot \frac{\frac{y}{x + y}}{y - \left(-1 - x\right)} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (* (/ x (+ x y)) (/ (/ y (+ x y)) (- y (- -1.0 x)))))
assert(x < y);
double code(double x, double y) {
	return (x / (x + y)) * ((y / (x + y)) / (y - (-1.0 - x)));
}
NOTE: x and y should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x / (x + y)) * ((y / (x + y)) / (y - ((-1.0d0) - x)))
end function
assert x < y;
public static double code(double x, double y) {
	return (x / (x + y)) * ((y / (x + y)) / (y - (-1.0 - x)));
}
[x, y] = sort([x, y])
def code(x, y):
	return (x / (x + y)) * ((y / (x + y)) / (y - (-1.0 - x)))
x, y = sort([x, y])
function code(x, y)
	return Float64(Float64(x / Float64(x + y)) * Float64(Float64(y / Float64(x + y)) / Float64(y - Float64(-1.0 - x))))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = (x / (x + y)) * ((y / (x + y)) / (y - (-1.0 - x)));
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{x + y} \cdot \frac{\frac{y}{x + y}}{y - \left(-1 - x\right)}
\end{array}
Derivation
  1. Initial program 69.1%

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

      \[\leadsto \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. associate-/r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{y \cdot \frac{x}{y + x}}{\left(\frac{1}{y} + \frac{x}{y}\right) \cdot y + y}}{y + x} \]
    6. lower-fma.f6499.8

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

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

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

      \[\leadsto \frac{\frac{y \cdot \frac{x}{y + x}}{\mathsf{fma}\left(\frac{1}{y} + \frac{x}{y}, y, y\right)}}{y + x} \]
    10. div-add-revN/A

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

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

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

      \[\leadsto \frac{\frac{y \cdot \frac{x}{y + x}}{\mathsf{fma}\left(\frac{1 + x}{y}, y, y\right)}}{y + x} \]
    14. +-commutativeN/A

      \[\leadsto \frac{\frac{y \cdot \frac{x}{y + x}}{\mathsf{fma}\left(\frac{x + 1}{y}, y, y\right)}}{y + x} \]
    15. metadata-evalN/A

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

      \[\leadsto \frac{\frac{y \cdot \frac{x}{y + x}}{\mathsf{fma}\left(\frac{x - -1}{y}, y, y\right)}}{y + x} \]
    17. lift--.f6499.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 96.4% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := y - \left(-1 - x\right)\\ \mathbf{if}\;y \leq -1.7 \cdot 10^{+119}:\\ \;\;\;\;\frac{y}{x + y} \cdot \frac{\frac{x}{x - -1}}{x + y}\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{+144}:\\ \;\;\;\;\frac{\frac{x}{y + x} \cdot y}{t\_0 \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t\_0}}{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
 (let* ((t_0 (- y (- -1.0 x))))
   (if (<= y -1.7e+119)
     (* (/ y (+ x y)) (/ (/ x (- x -1.0)) (+ x y)))
     (if (<= y 2.9e+144)
       (/ (* (/ x (+ y x)) y) (* t_0 (+ y x)))
       (/ (/ x t_0) (+ y x))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y - (-1.0 - x);
	double tmp;
	if (y <= -1.7e+119) {
		tmp = (y / (x + y)) * ((x / (x - -1.0)) / (x + y));
	} else if (y <= 2.9e+144) {
		tmp = ((x / (y + x)) * y) / (t_0 * (y + x));
	} else {
		tmp = (x / t_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) :: t_0
    real(8) :: tmp
    t_0 = y - ((-1.0d0) - x)
    if (y <= (-1.7d+119)) then
        tmp = (y / (x + y)) * ((x / (x - (-1.0d0))) / (x + y))
    else if (y <= 2.9d+144) then
        tmp = ((x / (y + x)) * y) / (t_0 * (y + x))
    else
        tmp = (x / t_0) / (y + x)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y - (-1.0 - x);
	double tmp;
	if (y <= -1.7e+119) {
		tmp = (y / (x + y)) * ((x / (x - -1.0)) / (x + y));
	} else if (y <= 2.9e+144) {
		tmp = ((x / (y + x)) * y) / (t_0 * (y + x));
	} else {
		tmp = (x / t_0) / (y + x);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y - (-1.0 - x)
	tmp = 0
	if y <= -1.7e+119:
		tmp = (y / (x + y)) * ((x / (x - -1.0)) / (x + y))
	elif y <= 2.9e+144:
		tmp = ((x / (y + x)) * y) / (t_0 * (y + x))
	else:
		tmp = (x / t_0) / (y + x)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y - Float64(-1.0 - x))
	tmp = 0.0
	if (y <= -1.7e+119)
		tmp = Float64(Float64(y / Float64(x + y)) * Float64(Float64(x / Float64(x - -1.0)) / Float64(x + y)));
	elseif (y <= 2.9e+144)
		tmp = Float64(Float64(Float64(x / Float64(y + x)) * y) / Float64(t_0 * Float64(y + x)));
	else
		tmp = Float64(Float64(x / t_0) / Float64(y + x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y - (-1.0 - x);
	tmp = 0.0;
	if (y <= -1.7e+119)
		tmp = (y / (x + y)) * ((x / (x - -1.0)) / (x + y));
	elseif (y <= 2.9e+144)
		tmp = ((x / (y + x)) * y) / (t_0 * (y + x));
	else
		tmp = (x / t_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_] := Block[{t$95$0 = N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.7e+119], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.9e+144], N[(N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] / N[(t$95$0 * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / t$95$0), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y - \left(-1 - x\right)\\
\mathbf{if}\;y \leq -1.7 \cdot 10^{+119}:\\
\;\;\;\;\frac{y}{x + y} \cdot \frac{\frac{x}{x - -1}}{x + y}\\

\mathbf{elif}\;y \leq 2.9 \cdot 10^{+144}:\\
\;\;\;\;\frac{\frac{x}{y + x} \cdot y}{t\_0 \cdot \left(y + x\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t\_0}}{y + x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.70000000000000007e119

    1. Initial program 69.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Taylor expanded in y around 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-+.f6459.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 rewrites59.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. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{x + y} \cdot \color{blue}{\frac{\frac{x}{x - -1}}{x + y}} \]
      11. lower-/.f6476.6

        \[\leadsto \frac{y}{x + y} \cdot \frac{\color{blue}{\frac{x}{x - -1}}}{x + y} \]
    10. Applied rewrites76.6%

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

    if -1.70000000000000007e119 < y < 2.89999999999999998e144

    1. Initial program 69.1%

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

        \[\leadsto \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. 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. times-fracN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.89999999999999998e144 < y

    1. Initial program 69.1%

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

        \[\leadsto \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. associate-/r*N/A

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

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

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

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

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

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

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

    Alternative 4: 92.1% accurate, 0.9× speedup?

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

      1. Initial program 69.1%

        \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. Taylor expanded in y around 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-+.f6459.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 rewrites59.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. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

      if 0.11799999999999999 < y

      1. Initial program 69.1%

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

          \[\leadsto \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. associate-/r*N/A

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

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

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

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

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

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

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

      Alternative 5: 92.1% accurate, 0.9× speedup?

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

        1. Initial program 69.1%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Taylor expanded in y around 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-+.f6459.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 rewrites59.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. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{y}{x + y} \cdot \color{blue}{\frac{\frac{x}{x - -1}}{x + y}} \]
          11. lower-/.f6476.6

            \[\leadsto \frac{y}{x + y} \cdot \frac{\color{blue}{\frac{x}{x - -1}}}{x + y} \]
        10. Applied rewrites76.6%

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

        if 0.11799999999999999 < y

        1. Initial program 69.1%

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

            \[\leadsto \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. associate-/r*N/A

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

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

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

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

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

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

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

        Alternative 6: 91.5% accurate, 0.8× speedup?

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

          1. Initial program 69.1%

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

              \[\leadsto \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. associate-/r*N/A

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

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

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

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

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

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

              \[\leadsto \frac{\frac{y}{\color{blue}{x}}}{y + x} \]
          6. Applied rewrites38.9%

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

          if -1.70000000000000007e119 < y < 0.11799999999999999

          1. Initial program 69.1%

            \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          2. Taylor expanded in y around 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-+.f6459.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 rewrites59.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. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 0.11799999999999999 < y

          1. Initial program 69.1%

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

              \[\leadsto \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. associate-/r*N/A

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

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

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

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

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

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

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

          Alternative 7: 89.6% accurate, 0.7× speedup?

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

            1. Initial program 69.1%

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

                \[\leadsto \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. associate-/r*N/A

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

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

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

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

              \[\leadsto \color{blue}{\frac{\frac{y \cdot \frac{x}{y + x}}{y - \left(-1 - x\right)}}{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-+.f6451.5

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

              \[\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--.f6451.5

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

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

            if 1.45e-260 < y < 8.20000000000000039e-162

            1. Initial program 69.1%

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

                \[\leadsto \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. 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. times-fracN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              if 8.20000000000000039e-162 < y < 4.15e-4

              1. Initial program 69.1%

                \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              2. Taylor expanded in y around 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-+.f6459.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 rewrites59.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. 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(1 + x\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(1 + x\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(1 + x\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(1 + x\right)}\right)} \]
                6. lower-*.f64N/A

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

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

                  \[\leadsto y \cdot \color{blue}{\frac{x}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
                9. 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)}} \]
                10. *-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)}} \]
                11. lower-*.f6476.1

                  \[\leadsto y \cdot \frac{x}{\color{blue}{\left(1 + x\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
                12. 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)} \]
                13. +-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)} \]
                14. 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)} \]
                15. metadata-evalN/A

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

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

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

              if 4.15e-4 < y

              1. Initial program 69.1%

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

                  \[\leadsto \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. associate-/r*N/A

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

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

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

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

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

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

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

              Alternative 8: 86.8% accurate, 0.7× speedup?

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

                1. Initial program 69.1%

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

                    \[\leadsto \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. associate-/r*N/A

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

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

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

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

                  \[\leadsto \color{blue}{\frac{\frac{y \cdot \frac{x}{y + x}}{y - \left(-1 - x\right)}}{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-+.f6451.5

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

                  \[\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--.f6451.5

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

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

                if 1.18e-259 < y < 3.99999999999999982e-162

                1. Initial program 69.1%

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

                    \[\leadsto \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. associate-/r*N/A

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

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

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

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

                  \[\leadsto \color{blue}{\frac{\frac{y \cdot \frac{x}{y + x}}{y - \left(-1 - x\right)}}{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-+.f6450.3

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

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

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

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

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

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

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

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

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

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

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

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

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

                if 3.99999999999999982e-162 < y < 4.15e-4

                1. Initial program 69.1%

                  \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                2. Taylor expanded in y around 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-+.f6459.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 rewrites59.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. 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(1 + x\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(1 + x\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(1 + x\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(1 + x\right)}\right)} \]
                  6. lower-*.f64N/A

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

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

                    \[\leadsto y \cdot \color{blue}{\frac{x}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
                  9. 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)}} \]
                  10. *-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)}} \]
                  11. lower-*.f6476.1

                    \[\leadsto y \cdot \frac{x}{\color{blue}{\left(1 + x\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
                  12. 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)} \]
                  13. +-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)} \]
                  14. 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)} \]
                  15. metadata-evalN/A

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

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

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

                if 4.15e-4 < y

                1. Initial program 69.1%

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

                    \[\leadsto \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. associate-/r*N/A

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

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

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

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

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

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

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

                Alternative 9: 86.4% accurate, 0.7× speedup?

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

                  1. Initial program 69.1%

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

                      \[\leadsto \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. associate-/r*N/A

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

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

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

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

                    \[\leadsto \color{blue}{\frac{\frac{y \cdot \frac{x}{y + x}}{y - \left(-1 - x\right)}}{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-+.f6451.5

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

                    \[\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--.f6451.5

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

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

                  if 1.18e-259 < y < 3.99999999999999982e-162

                  1. Initial program 69.1%

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

                      \[\leadsto \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. associate-/r*N/A

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

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

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

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

                    \[\leadsto \color{blue}{\frac{\frac{y \cdot \frac{x}{y + x}}{y - \left(-1 - x\right)}}{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-+.f6450.3

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

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

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

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

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

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

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

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

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

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

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

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

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

                  if 3.99999999999999982e-162 < y < 4.15e-4

                  1. Initial program 69.1%

                    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                  2. Taylor expanded in y around 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-+.f6459.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 rewrites59.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. lower-/.f6472.7

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

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

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

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

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

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

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

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

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

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

                  if 4.15e-4 < y

                  1. Initial program 69.1%

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

                      \[\leadsto \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. associate-/r*N/A

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

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

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

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

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

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

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

                  Alternative 10: 82.9% accurate, 0.9× speedup?

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

                    1. Initial program 69.1%

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

                        \[\leadsto \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. associate-/r*N/A

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

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

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

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

                      \[\leadsto \color{blue}{\frac{\frac{y \cdot \frac{x}{y + x}}{y - \left(-1 - x\right)}}{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-+.f6451.5

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

                      \[\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--.f6451.5

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

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

                    if 1.05e-79 < y < 6.9999999999999994e-5

                    1. Initial program 69.1%

                      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                    2. Taylor expanded in y around 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-+.f6459.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 rewrites59.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. Taylor expanded in x around 0

                      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot 1} \]
                    6. Step-by-step derivation
                      1. Applied rewrites49.9%

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

                      if 6.9999999999999994e-5 < y

                      1. Initial program 69.1%

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

                          \[\leadsto \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. associate-/r*N/A

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

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

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

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

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

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

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

                      Alternative 11: 82.8% accurate, 1.0× speedup?

                      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{\frac{x}{y - -1}}{y + x}\\ \mathbf{if}\;x \leq -3.45 \cdot 10^{+62}:\\ \;\;\;\;\frac{\frac{y}{x}}{y + x}\\ \mathbf{elif}\;x \leq -5 \cdot 10^{+34}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{-142}:\\ \;\;\;\;\frac{y}{x \cdot \left(1 + x\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \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 -1.0)) (+ y x))))
                         (if (<= x -3.45e+62)
                           (/ (/ y x) (+ y x))
                           (if (<= x -5e+34) t_0 (if (<= x -1.8e-142) (/ y (* x (+ 1.0 x))) t_0)))))
                      assert(x < y);
                      double code(double x, double y) {
                      	double t_0 = (x / (y - -1.0)) / (y + x);
                      	double tmp;
                      	if (x <= -3.45e+62) {
                      		tmp = (y / x) / (y + x);
                      	} else if (x <= -5e+34) {
                      		tmp = t_0;
                      	} else if (x <= -1.8e-142) {
                      		tmp = y / (x * (1.0 + x));
                      	} else {
                      		tmp = t_0;
                      	}
                      	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 - (-1.0d0))) / (y + x)
                          if (x <= (-3.45d+62)) then
                              tmp = (y / x) / (y + x)
                          else if (x <= (-5d+34)) then
                              tmp = t_0
                          else if (x <= (-1.8d-142)) then
                              tmp = y / (x * (1.0d0 + x))
                          else
                              tmp = t_0
                          end if
                          code = tmp
                      end function
                      
                      assert x < y;
                      public static double code(double x, double y) {
                      	double t_0 = (x / (y - -1.0)) / (y + x);
                      	double tmp;
                      	if (x <= -3.45e+62) {
                      		tmp = (y / x) / (y + x);
                      	} else if (x <= -5e+34) {
                      		tmp = t_0;
                      	} else if (x <= -1.8e-142) {
                      		tmp = y / (x * (1.0 + x));
                      	} else {
                      		tmp = t_0;
                      	}
                      	return tmp;
                      }
                      
                      [x, y] = sort([x, y])
                      def code(x, y):
                      	t_0 = (x / (y - -1.0)) / (y + x)
                      	tmp = 0
                      	if x <= -3.45e+62:
                      		tmp = (y / x) / (y + x)
                      	elif x <= -5e+34:
                      		tmp = t_0
                      	elif x <= -1.8e-142:
                      		tmp = y / (x * (1.0 + x))
                      	else:
                      		tmp = t_0
                      	return tmp
                      
                      x, y = sort([x, y])
                      function code(x, y)
                      	t_0 = Float64(Float64(x / Float64(y - -1.0)) / Float64(y + x))
                      	tmp = 0.0
                      	if (x <= -3.45e+62)
                      		tmp = Float64(Float64(y / x) / Float64(y + x));
                      	elseif (x <= -5e+34)
                      		tmp = t_0;
                      	elseif (x <= -1.8e-142)
                      		tmp = Float64(y / Float64(x * Float64(1.0 + x)));
                      	else
                      		tmp = t_0;
                      	end
                      	return tmp
                      end
                      
                      x, y = num2cell(sort([x, y])){:}
                      function tmp_2 = code(x, y)
                      	t_0 = (x / (y - -1.0)) / (y + x);
                      	tmp = 0.0;
                      	if (x <= -3.45e+62)
                      		tmp = (y / x) / (y + x);
                      	elseif (x <= -5e+34)
                      		tmp = t_0;
                      	elseif (x <= -1.8e-142)
                      		tmp = y / (x * (1.0 + x));
                      	else
                      		tmp = t_0;
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      NOTE: x and y should be sorted in increasing order before calling this function.
                      code[x_, y_] := Block[{t$95$0 = N[(N[(x / N[(y - -1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.45e+62], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5e+34], t$95$0, If[LessEqual[x, -1.8e-142], N[(y / N[(x * N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
                      
                      \begin{array}{l}
                      [x, y] = \mathsf{sort}([x, y])\\
                      \\
                      \begin{array}{l}
                      t_0 := \frac{\frac{x}{y - -1}}{y + x}\\
                      \mathbf{if}\;x \leq -3.45 \cdot 10^{+62}:\\
                      \;\;\;\;\frac{\frac{y}{x}}{y + x}\\
                      
                      \mathbf{elif}\;x \leq -5 \cdot 10^{+34}:\\
                      \;\;\;\;t\_0\\
                      
                      \mathbf{elif}\;x \leq -1.8 \cdot 10^{-142}:\\
                      \;\;\;\;\frac{y}{x \cdot \left(1 + x\right)}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;t\_0\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if x < -3.44999999999999999e62

                        1. Initial program 69.1%

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

                            \[\leadsto \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. associate-/r*N/A

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

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

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

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

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

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

                            \[\leadsto \frac{\frac{y}{\color{blue}{x}}}{y + x} \]
                        6. Applied rewrites38.9%

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

                        if -3.44999999999999999e62 < x < -4.9999999999999998e34 or -1.8e-142 < x

                        1. Initial program 69.1%

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

                            \[\leadsto \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. associate-/r*N/A

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

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

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

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

                          \[\leadsto \color{blue}{\frac{\frac{y \cdot \frac{x}{y + x}}{y - \left(-1 - x\right)}}{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-+.f6450.3

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

                          \[\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--.f6450.3

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

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

                        if -4.9999999999999998e34 < x < -1.8e-142

                        1. Initial program 69.1%

                          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                        2. Taylor expanded in y around 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-+.f6449.2

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

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

                      Alternative 12: 82.8% accurate, 1.1× speedup?

                      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -3.45 \cdot 10^{+62}:\\ \;\;\;\;\frac{\frac{y}{x}}{y + x}\\ \mathbf{elif}\;x \leq -5 \cdot 10^{+34}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{-142}:\\ \;\;\;\;\frac{y}{x \cdot \left(1 + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y - -1}\\ \end{array} \end{array} \]
                      NOTE: x and y should be sorted in increasing order before calling this function.
                      (FPCore (x y)
                       :precision binary64
                       (if (<= x -3.45e+62)
                         (/ (/ y x) (+ y x))
                         (if (<= x -5e+34)
                           (/ x (fma y y y))
                           (if (<= x -1.8e-142) (/ y (* x (+ 1.0 x))) (/ (/ x y) (- y -1.0))))))
                      assert(x < y);
                      double code(double x, double y) {
                      	double tmp;
                      	if (x <= -3.45e+62) {
                      		tmp = (y / x) / (y + x);
                      	} else if (x <= -5e+34) {
                      		tmp = x / fma(y, y, y);
                      	} else if (x <= -1.8e-142) {
                      		tmp = y / (x * (1.0 + x));
                      	} else {
                      		tmp = (x / y) / (y - -1.0);
                      	}
                      	return tmp;
                      }
                      
                      x, y = sort([x, y])
                      function code(x, y)
                      	tmp = 0.0
                      	if (x <= -3.45e+62)
                      		tmp = Float64(Float64(y / x) / Float64(y + x));
                      	elseif (x <= -5e+34)
                      		tmp = Float64(x / fma(y, y, y));
                      	elseif (x <= -1.8e-142)
                      		tmp = Float64(y / Float64(x * Float64(1.0 + x)));
                      	else
                      		tmp = Float64(Float64(x / y) / Float64(y - -1.0));
                      	end
                      	return tmp
                      end
                      
                      NOTE: x and y should be sorted in increasing order before calling this function.
                      code[x_, y_] := If[LessEqual[x, -3.45e+62], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5e+34], N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.8e-142], N[(y / N[(x * N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y - -1.0), $MachinePrecision]), $MachinePrecision]]]]
                      
                      \begin{array}{l}
                      [x, y] = \mathsf{sort}([x, y])\\
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;x \leq -3.45 \cdot 10^{+62}:\\
                      \;\;\;\;\frac{\frac{y}{x}}{y + x}\\
                      
                      \mathbf{elif}\;x \leq -5 \cdot 10^{+34}:\\
                      \;\;\;\;\frac{x}{\mathsf{fma}\left(y, y, y\right)}\\
                      
                      \mathbf{elif}\;x \leq -1.8 \cdot 10^{-142}:\\
                      \;\;\;\;\frac{y}{x \cdot \left(1 + x\right)}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{\frac{x}{y}}{y - -1}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 4 regimes
                      2. if x < -3.44999999999999999e62

                        1. Initial program 69.1%

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

                            \[\leadsto \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. associate-/r*N/A

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

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

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

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

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

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

                            \[\leadsto \frac{\frac{y}{\color{blue}{x}}}{y + x} \]
                        6. Applied rewrites38.9%

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

                        if -3.44999999999999999e62 < x < -4.9999999999999998e34

                        1. Initial program 69.1%

                          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                        2. Taylor expanded in 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-+.f6448.6

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

                          \[\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.f6448.6

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

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

                        if -4.9999999999999998e34 < x < -1.8e-142

                        1. Initial program 69.1%

                          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                        2. Taylor expanded in y around 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-+.f6449.2

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

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

                        if -1.8e-142 < x

                        1. Initial program 69.1%

                          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                        2. Taylor expanded in 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-+.f6448.6

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

                          \[\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. associate-/r*N/A

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

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

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

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

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

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

                            \[\leadsto \frac{\frac{x}{y}}{y - -1} \]
                          10. lower--.f6449.7

                            \[\leadsto \frac{\frac{x}{y}}{y - \color{blue}{-1}} \]
                        6. Applied rewrites49.7%

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

                      Alternative 13: 80.9% accurate, 1.2× speedup?

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

                        1. Initial program 69.1%

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

                            \[\leadsto \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. associate-/r*N/A

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

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

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

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

                          \[\leadsto \color{blue}{\frac{\frac{y \cdot \frac{x}{y + x}}{y - \left(-1 - x\right)}}{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-+.f6451.5

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

                          \[\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--.f6451.5

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

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

                        if -8.4000000000000004e-132 < x

                        1. Initial program 69.1%

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

                            \[\leadsto \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. associate-/r*N/A

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

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

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

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

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

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

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

                        Alternative 14: 80.8% accurate, 1.4× speedup?

                        \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -8.4 \cdot 10^{-132}:\\ \;\;\;\;\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 (<= x -8.4e-132)
                           (/ (/ y (- x -1.0)) (+ y x))
                           (/ (/ x (- y -1.0)) (+ y x))))
                        assert(x < y);
                        double code(double x, double y) {
                        	double tmp;
                        	if (x <= -8.4e-132) {
                        		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 (x <= (-8.4d-132)) 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 (x <= -8.4e-132) {
                        		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 x <= -8.4e-132:
                        		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 (x <= -8.4e-132)
                        		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 (x <= -8.4e-132)
                        		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[x, -8.4e-132], 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}\;x \leq -8.4 \cdot 10^{-132}:\\
                        \;\;\;\;\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 x < -8.4000000000000004e-132

                          1. Initial program 69.1%

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

                              \[\leadsto \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. associate-/r*N/A

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

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

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

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

                            \[\leadsto \color{blue}{\frac{\frac{y \cdot \frac{x}{y + x}}{y - \left(-1 - x\right)}}{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-+.f6451.5

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

                            \[\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--.f6451.5

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

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

                          if -8.4000000000000004e-132 < x

                          1. Initial program 69.1%

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

                              \[\leadsto \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. associate-/r*N/A

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

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

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

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

                            \[\leadsto \color{blue}{\frac{\frac{y \cdot \frac{x}{y + x}}{y - \left(-1 - x\right)}}{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-+.f6450.3

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

                            \[\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--.f6450.3

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

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

                        Alternative 15: 80.0% accurate, 1.7× speedup?

                        \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{-142}:\\ \;\;\;\;\frac{y}{x \cdot \left(1 + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y - -1}\\ \end{array} \end{array} \]
                        NOTE: x and y should be sorted in increasing order before calling this function.
                        (FPCore (x y)
                         :precision binary64
                         (if (<= x -1.8e-142) (/ y (* x (+ 1.0 x))) (/ (/ x y) (- y -1.0))))
                        assert(x < y);
                        double code(double x, double y) {
                        	double tmp;
                        	if (x <= -1.8e-142) {
                        		tmp = y / (x * (1.0 + x));
                        	} else {
                        		tmp = (x / y) / (y - -1.0);
                        	}
                        	return tmp;
                        }
                        
                        NOTE: x and y should be sorted in increasing order before calling this function.
                        module fmin_fmax_functions
                            implicit none
                            private
                            public fmax
                            public fmin
                        
                            interface fmax
                                module procedure fmax88
                                module procedure fmax44
                                module procedure fmax84
                                module procedure fmax48
                            end interface
                            interface fmin
                                module procedure fmin88
                                module procedure fmin44
                                module procedure fmin84
                                module procedure fmin48
                            end interface
                        contains
                            real(8) function fmax88(x, y) result (res)
                                real(8), intent (in) :: x
                                real(8), intent (in) :: y
                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                            end function
                            real(4) function fmax44(x, y) result (res)
                                real(4), intent (in) :: x
                                real(4), intent (in) :: y
                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                            end function
                            real(8) function fmax84(x, y) result(res)
                                real(8), intent (in) :: x
                                real(4), intent (in) :: y
                                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                            end function
                            real(8) function fmax48(x, y) result(res)
                                real(4), intent (in) :: x
                                real(8), intent (in) :: y
                                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                            end function
                            real(8) function fmin88(x, y) result (res)
                                real(8), intent (in) :: x
                                real(8), intent (in) :: y
                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                            end function
                            real(4) function fmin44(x, y) result (res)
                                real(4), intent (in) :: x
                                real(4), intent (in) :: y
                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                            end function
                            real(8) function fmin84(x, y) result(res)
                                real(8), intent (in) :: x
                                real(4), intent (in) :: y
                                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                            end function
                            real(8) function fmin48(x, y) result(res)
                                real(4), intent (in) :: x
                                real(8), intent (in) :: y
                                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                            end function
                        end module
                        
                        real(8) function code(x, y)
                        use fmin_fmax_functions
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            real(8) :: tmp
                            if (x <= (-1.8d-142)) then
                                tmp = y / (x * (1.0d0 + x))
                            else
                                tmp = (x / y) / (y - (-1.0d0))
                            end if
                            code = tmp
                        end function
                        
                        assert x < y;
                        public static double code(double x, double y) {
                        	double tmp;
                        	if (x <= -1.8e-142) {
                        		tmp = y / (x * (1.0 + x));
                        	} else {
                        		tmp = (x / y) / (y - -1.0);
                        	}
                        	return tmp;
                        }
                        
                        [x, y] = sort([x, y])
                        def code(x, y):
                        	tmp = 0
                        	if x <= -1.8e-142:
                        		tmp = y / (x * (1.0 + x))
                        	else:
                        		tmp = (x / y) / (y - -1.0)
                        	return tmp
                        
                        x, y = sort([x, y])
                        function code(x, y)
                        	tmp = 0.0
                        	if (x <= -1.8e-142)
                        		tmp = Float64(y / Float64(x * Float64(1.0 + x)));
                        	else
                        		tmp = Float64(Float64(x / y) / Float64(y - -1.0));
                        	end
                        	return tmp
                        end
                        
                        x, y = num2cell(sort([x, y])){:}
                        function tmp_2 = code(x, y)
                        	tmp = 0.0;
                        	if (x <= -1.8e-142)
                        		tmp = y / (x * (1.0 + x));
                        	else
                        		tmp = (x / y) / (y - -1.0);
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        NOTE: x and y should be sorted in increasing order before calling this function.
                        code[x_, y_] := If[LessEqual[x, -1.8e-142], N[(y / N[(x * N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y - -1.0), $MachinePrecision]), $MachinePrecision]]
                        
                        \begin{array}{l}
                        [x, y] = \mathsf{sort}([x, y])\\
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;x \leq -1.8 \cdot 10^{-142}:\\
                        \;\;\;\;\frac{y}{x \cdot \left(1 + x\right)}\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;\frac{\frac{x}{y}}{y - -1}\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if x < -1.8e-142

                          1. Initial program 69.1%

                            \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                          2. Taylor expanded in y around 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-+.f6449.2

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

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

                          if -1.8e-142 < x

                          1. Initial program 69.1%

                            \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                          2. Taylor expanded in 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-+.f6448.6

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

                            \[\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. associate-/r*N/A

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

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

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

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

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

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

                              \[\leadsto \frac{\frac{x}{y}}{y - -1} \]
                            10. lower--.f6449.7

                              \[\leadsto \frac{\frac{x}{y}}{y - \color{blue}{-1}} \]
                          6. Applied rewrites49.7%

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

                        Alternative 16: 78.9% accurate, 1.7× speedup?

                        \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{-142}:\\ \;\;\;\;\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 (<= x -1.8e-142) (/ y (* x (+ 1.0 x))) (/ x (fma y y y))))
                        assert(x < y);
                        double code(double x, double y) {
                        	double tmp;
                        	if (x <= -1.8e-142) {
                        		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 (x <= -1.8e-142)
                        		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[x, -1.8e-142], 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}\;x \leq -1.8 \cdot 10^{-142}:\\
                        \;\;\;\;\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 x < -1.8e-142

                          1. Initial program 69.1%

                            \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                          2. Taylor expanded in y around 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-+.f6449.2

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

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

                          if -1.8e-142 < x

                          1. Initial program 69.1%

                            \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                          2. Taylor expanded in 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-+.f6448.6

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

                            \[\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.f6448.6

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

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

                        Alternative 17: 48.6% 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.1%

                          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
                        2. Taylor expanded in 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-+.f6448.6

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

                          \[\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.f6448.6

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

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

                        Reproduce

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