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

Percentage Accurate: 68.5% → 99.8%
Time: 4.0s
Alternatives: 24
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 24 alternatives:

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

Initial Program: 68.5% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.2% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.0% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{x}{y + x}\\ \mathbf{if}\;y \leq -1.95 \cdot 10^{+36}:\\ \;\;\;\;\frac{t\_0 \cdot \frac{y}{x - -1}}{y + x}\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{+153}:\\ \;\;\;\;t\_0 \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_0}{1 + y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ x (+ y x))))
   (if (<= y -1.95e+36)
     (/ (* t_0 (/ y (- x -1.0))) (+ y x))
     (if (<= y 1.6e+153)
       (* t_0 (/ y (* (- (+ y x) -1.0) (+ y x))))
       (/ t_0 (+ 1.0 y))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = x / (y + x);
	double tmp;
	if (y <= -1.95e+36) {
		tmp = (t_0 * (y / (x - -1.0))) / (y + x);
	} else if (y <= 1.6e+153) {
		tmp = t_0 * (y / (((y + x) - -1.0) * (y + x)));
	} else {
		tmp = t_0 / (1.0 + y);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x / (y + x)
    if (y <= (-1.95d+36)) then
        tmp = (t_0 * (y / (x - (-1.0d0)))) / (y + x)
    else if (y <= 1.6d+153) then
        tmp = t_0 * (y / (((y + x) - (-1.0d0)) * (y + x)))
    else
        tmp = t_0 / (1.0d0 + y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = x / (y + x);
	double tmp;
	if (y <= -1.95e+36) {
		tmp = (t_0 * (y / (x - -1.0))) / (y + x);
	} else if (y <= 1.6e+153) {
		tmp = t_0 * (y / (((y + x) - -1.0) * (y + x)));
	} else {
		tmp = t_0 / (1.0 + y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = x / (y + x)
	tmp = 0
	if y <= -1.95e+36:
		tmp = (t_0 * (y / (x - -1.0))) / (y + x)
	elif y <= 1.6e+153:
		tmp = t_0 * (y / (((y + x) - -1.0) * (y + x)))
	else:
		tmp = t_0 / (1.0 + y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(x / Float64(y + x))
	tmp = 0.0
	if (y <= -1.95e+36)
		tmp = Float64(Float64(t_0 * Float64(y / Float64(x - -1.0))) / Float64(y + x));
	elseif (y <= 1.6e+153)
		tmp = Float64(t_0 * Float64(y / Float64(Float64(Float64(y + x) - -1.0) * Float64(y + x))));
	else
		tmp = Float64(t_0 / Float64(1.0 + y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = x / (y + x);
	tmp = 0.0;
	if (y <= -1.95e+36)
		tmp = (t_0 * (y / (x - -1.0))) / (y + x);
	elseif (y <= 1.6e+153)
		tmp = t_0 * (y / (((y + x) - -1.0) * (y + x)));
	else
		tmp = t_0 / (1.0 + y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.95e+36], N[(N[(t$95$0 * N[(y / N[(x - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e+153], N[(t$95$0 * N[(y / N[(N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{y + x}\\
\mathbf{if}\;y \leq -1.95 \cdot 10^{+36}:\\
\;\;\;\;\frac{t\_0 \cdot \frac{y}{x - -1}}{y + x}\\

\mathbf{elif}\;y \leq 1.6 \cdot 10^{+153}:\\
\;\;\;\;t\_0 \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}\\

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


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

    1. Initial program 68.5%

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

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

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

      \[\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. lift-+.f64N/A

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

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{x \cdot y}}{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. lift-+.f64N/A

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

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

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

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

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

    if -1.9500000000000001e36 < y < 1.6000000000000001e153

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.6000000000000001e153 < y

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 96.6% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{x}{y + x}\\ \mathbf{if}\;y \leq 7.8 \cdot 10^{-23}:\\ \;\;\;\;\frac{t\_0 \cdot \frac{y}{x - -1}}{y + x}\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{+153}:\\ \;\;\;\;\frac{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}}{y + x} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_0}{1 + y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ x (+ y x))))
   (if (<= y 7.8e-23)
     (/ (* t_0 (/ y (- x -1.0))) (+ y x))
     (if (<= y 1.6e+153)
       (* (/ (/ y (* (- (+ y x) -1.0) (+ y x))) (+ y x)) x)
       (/ t_0 (+ 1.0 y))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = x / (y + x);
	double tmp;
	if (y <= 7.8e-23) {
		tmp = (t_0 * (y / (x - -1.0))) / (y + x);
	} else if (y <= 1.6e+153) {
		tmp = ((y / (((y + x) - -1.0) * (y + x))) / (y + x)) * x;
	} else {
		tmp = t_0 / (1.0 + y);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x / (y + x)
    if (y <= 7.8d-23) then
        tmp = (t_0 * (y / (x - (-1.0d0)))) / (y + x)
    else if (y <= 1.6d+153) then
        tmp = ((y / (((y + x) - (-1.0d0)) * (y + x))) / (y + x)) * x
    else
        tmp = t_0 / (1.0d0 + y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = x / (y + x);
	double tmp;
	if (y <= 7.8e-23) {
		tmp = (t_0 * (y / (x - -1.0))) / (y + x);
	} else if (y <= 1.6e+153) {
		tmp = ((y / (((y + x) - -1.0) * (y + x))) / (y + x)) * x;
	} else {
		tmp = t_0 / (1.0 + y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = x / (y + x)
	tmp = 0
	if y <= 7.8e-23:
		tmp = (t_0 * (y / (x - -1.0))) / (y + x)
	elif y <= 1.6e+153:
		tmp = ((y / (((y + x) - -1.0) * (y + x))) / (y + x)) * x
	else:
		tmp = t_0 / (1.0 + y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(x / Float64(y + x))
	tmp = 0.0
	if (y <= 7.8e-23)
		tmp = Float64(Float64(t_0 * Float64(y / Float64(x - -1.0))) / Float64(y + x));
	elseif (y <= 1.6e+153)
		tmp = Float64(Float64(Float64(y / Float64(Float64(Float64(y + x) - -1.0) * Float64(y + x))) / Float64(y + x)) * x);
	else
		tmp = Float64(t_0 / Float64(1.0 + y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = x / (y + x);
	tmp = 0.0;
	if (y <= 7.8e-23)
		tmp = (t_0 * (y / (x - -1.0))) / (y + x);
	elseif (y <= 1.6e+153)
		tmp = ((y / (((y + x) - -1.0) * (y + x))) / (y + x)) * x;
	else
		tmp = t_0 / (1.0 + y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 7.8e-23], N[(N[(t$95$0 * N[(y / N[(x - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e+153], N[(N[(N[(y / N[(N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(t$95$0 / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{y + x}\\
\mathbf{if}\;y \leq 7.8 \cdot 10^{-23}:\\
\;\;\;\;\frac{t\_0 \cdot \frac{y}{x - -1}}{y + x}\\

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

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


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

    1. Initial program 68.5%

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

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

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

      \[\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. lift-+.f64N/A

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

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{x \cdot y}}{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. lift-+.f64N/A

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

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

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

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

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

    if 7.8e-23 < y < 1.6000000000000001e153

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.6000000000000001e153 < y

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 96.6% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \left(y + x\right) - -1\\ \mathbf{if}\;y \leq 1.02 \cdot 10^{-29}:\\ \;\;\;\;\frac{\frac{x}{y + x} \cdot \frac{y}{x - -1}}{y + x}\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{+86}:\\ \;\;\;\;\frac{y}{t\_0 \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{\frac{t\_0}{y} \cdot \left(y + x\right)}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (- (+ y x) -1.0)))
   (if (<= y 1.02e-29)
     (/ (* (/ x (+ y x)) (/ y (- x -1.0))) (+ y x))
     (if (<= y 3.1e+86)
       (* (/ y (* t_0 (* (+ y x) (+ y x)))) x)
       (/ (/ x y) (* (/ t_0 y) (+ y x)))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = (y + x) - -1.0;
	double tmp;
	if (y <= 1.02e-29) {
		tmp = ((x / (y + x)) * (y / (x - -1.0))) / (y + x);
	} else if (y <= 3.1e+86) {
		tmp = (y / (t_0 * ((y + x) * (y + x)))) * x;
	} else {
		tmp = (x / y) / ((t_0 / y) * (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 + x) - (-1.0d0)
    if (y <= 1.02d-29) then
        tmp = ((x / (y + x)) * (y / (x - (-1.0d0)))) / (y + x)
    else if (y <= 3.1d+86) then
        tmp = (y / (t_0 * ((y + x) * (y + x)))) * x
    else
        tmp = (x / y) / ((t_0 / y) * (y + x))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = (y + x) - -1.0;
	double tmp;
	if (y <= 1.02e-29) {
		tmp = ((x / (y + x)) * (y / (x - -1.0))) / (y + x);
	} else if (y <= 3.1e+86) {
		tmp = (y / (t_0 * ((y + x) * (y + x)))) * x;
	} else {
		tmp = (x / y) / ((t_0 / y) * (y + x));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = (y + x) - -1.0
	tmp = 0
	if y <= 1.02e-29:
		tmp = ((x / (y + x)) * (y / (x - -1.0))) / (y + x)
	elif y <= 3.1e+86:
		tmp = (y / (t_0 * ((y + x) * (y + x)))) * x
	else:
		tmp = (x / y) / ((t_0 / y) * (y + x))
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(Float64(y + x) - -1.0)
	tmp = 0.0
	if (y <= 1.02e-29)
		tmp = Float64(Float64(Float64(x / Float64(y + x)) * Float64(y / Float64(x - -1.0))) / Float64(y + x));
	elseif (y <= 3.1e+86)
		tmp = Float64(Float64(y / Float64(t_0 * Float64(Float64(y + x) * Float64(y + x)))) * x);
	else
		tmp = Float64(Float64(x / y) / Float64(Float64(t_0 / y) * Float64(y + x)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = (y + x) - -1.0;
	tmp = 0.0;
	if (y <= 1.02e-29)
		tmp = ((x / (y + x)) * (y / (x - -1.0))) / (y + x);
	elseif (y <= 3.1e+86)
		tmp = (y / (t_0 * ((y + x) * (y + x)))) * x;
	else
		tmp = (x / y) / ((t_0 / y) * (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[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision]}, If[LessEqual[y, 1.02e-29], N[(N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / N[(x - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e+86], N[(N[(y / N[(t$95$0 * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(t$95$0 / y), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(y + x\right) - -1\\
\mathbf{if}\;y \leq 1.02 \cdot 10^{-29}:\\
\;\;\;\;\frac{\frac{x}{y + x} \cdot \frac{y}{x - -1}}{y + x}\\

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

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


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

    1. Initial program 68.5%

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

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

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

      \[\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. lift-+.f64N/A

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

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{x \cdot y}}{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. lift-+.f64N/A

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

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

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

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

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

    if 1.01999999999999994e-29 < y < 3.1000000000000002e86

    1. Initial program 68.5%

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

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

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

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

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

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

    if 3.1000000000000002e86 < y

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 96.5% accurate, 0.8× speedup?

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

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

real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 1.02d-29) then
        tmp = ((x / (y + x)) * (y / (x - (-1.0d0)))) / (y + x)
    else if (y <= 3.1d+86) then
        tmp = (y / (((y + x) * (y + x)) * (x - ((-1.0d0) - y)))) * x
    else
        tmp = (x / y) / ((((y + x) - (-1.0d0)) / y) * (y + x))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 1.02e-29) {
		tmp = ((x / (y + x)) * (y / (x - -1.0))) / (y + x);
	} else if (y <= 3.1e+86) {
		tmp = (y / (((y + x) * (y + x)) * (x - (-1.0 - y)))) * x;
	} else {
		tmp = (x / y) / ((((y + x) - -1.0) / y) * (y + x));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 1.02e-29:
		tmp = ((x / (y + x)) * (y / (x - -1.0))) / (y + x)
	elif y <= 3.1e+86:
		tmp = (y / (((y + x) * (y + x)) * (x - (-1.0 - y)))) * x
	else:
		tmp = (x / y) / ((((y + x) - -1.0) / y) * (y + x))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 1.02e-29)
		tmp = Float64(Float64(Float64(x / Float64(y + x)) * Float64(y / Float64(x - -1.0))) / Float64(y + x));
	elseif (y <= 3.1e+86)
		tmp = Float64(Float64(y / Float64(Float64(Float64(y + x) * Float64(y + x)) * Float64(x - Float64(-1.0 - y)))) * x);
	else
		tmp = Float64(Float64(x / y) / Float64(Float64(Float64(Float64(y + x) - -1.0) / y) * Float64(y + x)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 1.02e-29)
		tmp = ((x / (y + x)) * (y / (x - -1.0))) / (y + x);
	elseif (y <= 3.1e+86)
		tmp = (y / (((y + x) * (y + x)) * (x - (-1.0 - y)))) * x;
	else
		tmp = (x / y) / ((((y + x) - -1.0) / y) * (y + x));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 1.02e-29], N[(N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / N[(x - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e+86], N[(N[(y / N[(N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x - N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision] / y), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.02 \cdot 10^{-29}:\\
\;\;\;\;\frac{\frac{x}{y + x} \cdot \frac{y}{x - -1}}{y + x}\\

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

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


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

    1. Initial program 68.5%

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

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

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

      \[\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. lift-+.f64N/A

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

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{x \cdot y}}{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. lift-+.f64N/A

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

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

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

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

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

    if 1.01999999999999994e-29 < y < 3.1000000000000002e86

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.1000000000000002e86 < y

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 95.7% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 5.5 \cdot 10^{-10}:\\ \;\;\;\;\frac{\frac{x}{y + x} \cdot \frac{y}{x - -1}}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{\frac{\left(y + x\right) - -1}{y} \cdot \left(y + x\right)}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y 5.5e-10)
   (/ (* (/ x (+ y x)) (/ y (- x -1.0))) (+ y x))
   (/ (/ x y) (* (/ (- (+ y x) -1.0) y) (+ y x)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 5.5e-10) {
		tmp = ((x / (y + x)) * (y / (x - -1.0))) / (y + x);
	} else {
		tmp = (x / y) / ((((y + x) - -1.0) / y) * (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 <= 5.5d-10) then
        tmp = ((x / (y + x)) * (y / (x - (-1.0d0)))) / (y + x)
    else
        tmp = (x / y) / ((((y + x) - (-1.0d0)) / y) * (y + x))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 5.5e-10) {
		tmp = ((x / (y + x)) * (y / (x - -1.0))) / (y + x);
	} else {
		tmp = (x / y) / ((((y + x) - -1.0) / y) * (y + x));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 5.5e-10:
		tmp = ((x / (y + x)) * (y / (x - -1.0))) / (y + x)
	else:
		tmp = (x / y) / ((((y + x) - -1.0) / y) * (y + x))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 5.5e-10)
		tmp = Float64(Float64(Float64(x / Float64(y + x)) * Float64(y / Float64(x - -1.0))) / Float64(y + x));
	else
		tmp = Float64(Float64(x / y) / Float64(Float64(Float64(Float64(y + x) - -1.0) / y) * Float64(y + x)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 5.5e-10)
		tmp = ((x / (y + x)) * (y / (x - -1.0))) / (y + x);
	else
		tmp = (x / y) / ((((y + x) - -1.0) / y) * (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, 5.5e-10], N[(N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / N[(x - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision] / y), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{\frac{x}{y + x} \cdot \frac{y}{x - -1}}{y + x}\\

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


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

    1. Initial program 68.5%

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

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

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

      \[\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. lift-+.f64N/A

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

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{x \cdot y}}{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. lift-+.f64N/A

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

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

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

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

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

    if 5.4999999999999996e-10 < y

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 94.2% accurate, 0.8× speedup?

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

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

real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 5.5d-10) then
        tmp = y / (((y + x) * ((y + x) / x)) * (x - (-1.0d0)))
    else if (y <= 3.2d+152) then
        tmp = ((x / ((y + x) * (y + x))) * y) / (1.0d0 + y)
    else
        tmp = (x / (y + x)) / (1.0d0 + y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 5.5e-10) {
		tmp = y / (((y + x) * ((y + x) / x)) * (x - -1.0));
	} else if (y <= 3.2e+152) {
		tmp = ((x / ((y + x) * (y + x))) * y) / (1.0 + y);
	} else {
		tmp = (x / (y + x)) / (1.0 + y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 5.5e-10:
		tmp = y / (((y + x) * ((y + x) / x)) * (x - -1.0))
	elif y <= 3.2e+152:
		tmp = ((x / ((y + x) * (y + x))) * y) / (1.0 + y)
	else:
		tmp = (x / (y + x)) / (1.0 + y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 5.5e-10)
		tmp = Float64(y / Float64(Float64(Float64(y + x) * Float64(Float64(y + x) / x)) * Float64(x - -1.0)));
	elseif (y <= 3.2e+152)
		tmp = Float64(Float64(Float64(x / Float64(Float64(y + x) * Float64(y + x))) * y) / Float64(1.0 + y));
	else
		tmp = Float64(Float64(x / Float64(y + x)) / Float64(1.0 + y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 5.5e-10)
		tmp = y / (((y + x) * ((y + x) / x)) * (x - -1.0));
	elseif (y <= 3.2e+152)
		tmp = ((x / ((y + x) * (y + x))) * y) / (1.0 + y);
	else
		tmp = (x / (y + x)) / (1.0 + y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 5.5e-10], N[(y / N[(N[(N[(y + x), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * N[(x - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.2e+152], N[(N[(N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{y}{\left(\left(y + x\right) \cdot \frac{y + x}{x}\right) \cdot \left(x - -1\right)}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{1 + y}\\


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

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.4999999999999996e-10 < y < 3.20000000000000005e152

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.20000000000000005e152 < y

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 94.0% accurate, 0.8× speedup?

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

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

real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 5.5d-10) then
        tmp = y / (((y + x) * ((y + x) / x)) * (x - (-1.0d0)))
    else if (y <= 3.2d+152) then
        tmp = (x / y) * (y / (((y + x) - (-1.0d0)) * (y + x)))
    else
        tmp = (x / (y + x)) / (1.0d0 + y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 5.5e-10) {
		tmp = y / (((y + x) * ((y + x) / x)) * (x - -1.0));
	} else if (y <= 3.2e+152) {
		tmp = (x / y) * (y / (((y + x) - -1.0) * (y + x)));
	} else {
		tmp = (x / (y + x)) / (1.0 + y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 5.5e-10:
		tmp = y / (((y + x) * ((y + x) / x)) * (x - -1.0))
	elif y <= 3.2e+152:
		tmp = (x / y) * (y / (((y + x) - -1.0) * (y + x)))
	else:
		tmp = (x / (y + x)) / (1.0 + y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 5.5e-10)
		tmp = Float64(y / Float64(Float64(Float64(y + x) * Float64(Float64(y + x) / x)) * Float64(x - -1.0)));
	elseif (y <= 3.2e+152)
		tmp = Float64(Float64(x / y) * Float64(y / Float64(Float64(Float64(y + x) - -1.0) * Float64(y + x))));
	else
		tmp = Float64(Float64(x / Float64(y + x)) / Float64(1.0 + y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 5.5e-10)
		tmp = y / (((y + x) * ((y + x) / x)) * (x - -1.0));
	elseif (y <= 3.2e+152)
		tmp = (x / y) * (y / (((y + x) - -1.0) * (y + x)));
	else
		tmp = (x / (y + x)) / (1.0 + y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 5.5e-10], N[(y / N[(N[(N[(y + x), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * N[(x - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.2e+152], N[(N[(x / y), $MachinePrecision] * N[(y / N[(N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{y}{\left(\left(y + x\right) \cdot \frac{y + x}{x}\right) \cdot \left(x - -1\right)}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{1 + y}\\


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

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.4999999999999996e-10 < y < 3.20000000000000005e152

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.20000000000000005e152 < y

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 93.4% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 5.5 \cdot 10^{-10}:\\ \;\;\;\;\frac{y}{\left(\left(y + x\right) \cdot \frac{y + x}{x}\right) \cdot \left(x - -1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{\frac{\left(y + x\right) - -1}{y} \cdot \left(y + x\right)}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y 5.5e-10)
   (/ y (* (* (+ y x) (/ (+ y x) x)) (- x -1.0)))
   (/ (/ x y) (* (/ (- (+ y x) -1.0) y) (+ y x)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 5.5e-10) {
		tmp = y / (((y + x) * ((y + x) / x)) * (x - -1.0));
	} else {
		tmp = (x / y) / ((((y + x) - -1.0) / y) * (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 <= 5.5d-10) then
        tmp = y / (((y + x) * ((y + x) / x)) * (x - (-1.0d0)))
    else
        tmp = (x / y) / ((((y + x) - (-1.0d0)) / y) * (y + x))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 5.5e-10) {
		tmp = y / (((y + x) * ((y + x) / x)) * (x - -1.0));
	} else {
		tmp = (x / y) / ((((y + x) - -1.0) / y) * (y + x));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 5.5e-10:
		tmp = y / (((y + x) * ((y + x) / x)) * (x - -1.0))
	else:
		tmp = (x / y) / ((((y + x) - -1.0) / y) * (y + x))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 5.5e-10)
		tmp = Float64(y / Float64(Float64(Float64(y + x) * Float64(Float64(y + x) / x)) * Float64(x - -1.0)));
	else
		tmp = Float64(Float64(x / y) / Float64(Float64(Float64(Float64(y + x) - -1.0) / y) * Float64(y + x)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 5.5e-10)
		tmp = y / (((y + x) * ((y + x) / x)) * (x - -1.0));
	else
		tmp = (x / y) / ((((y + x) - -1.0) / y) * (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, 5.5e-10], N[(y / N[(N[(N[(y + x), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * N[(x - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision] / y), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{y}{\left(\left(y + x\right) \cdot \frac{y + x}{x}\right) \cdot \left(x - -1\right)}\\

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


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

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot y}{\frac{\left(y + x\right) \cdot \left(y + x\right)}{x} \cdot \left(1 + x\right)}} \]
      13. *-lft-identityN/A

        \[\leadsto \frac{\color{blue}{y}}{\frac{\left(y + x\right) \cdot \left(y + x\right)}{x} \cdot \left(1 + x\right)} \]
      14. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{y}{\frac{\left(y + x\right) \cdot \left(y + x\right)}{x} \cdot \left(1 + x\right)}} \]
      15. lower-*.f64N/A

        \[\leadsto \frac{y}{\color{blue}{\frac{\left(y + x\right) \cdot \left(y + x\right)}{x} \cdot \left(1 + x\right)}} \]
    6. Applied rewrites84.0%

      \[\leadsto \color{blue}{\frac{y}{\left(\left(y + x\right) \cdot \frac{y + x}{x}\right) \cdot \left(x - -1\right)}} \]

    if 5.4999999999999996e-10 < y

    1. Initial program 68.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      5. associate-*l*N/A

        \[\leadsto \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)}} \]
      6. times-fracN/A

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{x}{\color{blue}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      10. +-commutativeN/A

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      11. lower-+.f64N/A

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      12. lower-/.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      13. *-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
      14. lower-*.f6493.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
      15. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right)} \cdot \left(x + y\right)} \]
      16. add-flipN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
      17. lower--.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
      18. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      19. +-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      20. lower-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      21. metadata-eval93.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - \color{blue}{-1}\right) \cdot \left(x + y\right)} \]
      22. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(x + y\right)}} \]
      23. +-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
      24. lower-+.f6493.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
    3. Applied rewrites93.4%

      \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
    4. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      3. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\frac{x}{y + x} \cdot y}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      5. times-fracN/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
      7. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1}} \cdot \frac{y}{y + x} \]
      8. lower-/.f6499.8

        \[\leadsto \frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \color{blue}{\frac{y}{y + x}} \]
    5. Applied rewrites99.8%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
      2. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1}} \cdot \frac{y}{y + x} \]
      3. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot \frac{y}{y + x}}{\left(y + x\right) - -1}} \]
      4. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{x}{y + x}} \cdot \frac{y}{y + x}}{\left(y + x\right) - -1} \]
      5. lift-/.f64N/A

        \[\leadsto \frac{\frac{x}{y + x} \cdot \color{blue}{\frac{y}{y + x}}}{\left(y + x\right) - -1} \]
      6. frac-timesN/A

        \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{\left(y + x\right) \cdot \left(y + x\right)}}}{\left(y + x\right) - -1} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{\frac{\color{blue}{x \cdot y}}{\left(y + x\right) \cdot \left(y + x\right)}}{\left(y + x\right) - -1} \]
      8. pow2N/A

        \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{{\left(y + x\right)}^{2}}}}{\left(y + x\right) - -1} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(y + x\right)}}^{2}}}{\left(y + x\right) - -1} \]
      10. +-commutativeN/A

        \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(x + y\right)}}^{2}}}{\left(y + x\right) - -1} \]
      11. lift-+.f64N/A

        \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(x + y\right)}}^{2}}}{\left(y + x\right) - -1} \]
      12. pow2N/A

        \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right)}}}{\left(y + x\right) - -1} \]
      13. lift-*.f64N/A

        \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right)}}}{\left(y + x\right) - -1} \]
      14. associate-/l/N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(y + x\right) - -1\right)}} \]
      15. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(y + x\right) - -1\right)} \]
      16. frac-timesN/A

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(y + x\right) - -1}} \]
      17. div-flipN/A

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{1}{\frac{\left(y + x\right) - -1}{y}}} \]
      18. lift-/.f64N/A

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{1}{\color{blue}{\frac{\left(y + x\right) - -1}{y}}} \]
    7. Applied rewrites99.2%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{\left(y + x\right) - -1}{y} \cdot \left(y + x\right)}} \]
    8. Taylor expanded in x around 0

      \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{\frac{\left(y + x\right) - -1}{y} \cdot \left(y + x\right)} \]
    9. Step-by-step derivation
      1. lower-/.f6461.8

        \[\leadsto \frac{\frac{x}{\color{blue}{y}}}{\frac{\left(y + x\right) - -1}{y} \cdot \left(y + x\right)} \]
    10. Applied rewrites61.8%

      \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{\frac{\left(y + x\right) - -1}{y} \cdot \left(y + x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 93.3% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 5.5 \cdot 10^{-10}:\\ \;\;\;\;\frac{y}{y + x} \cdot \frac{x}{\left(x - -1\right) \cdot \left(y + x\right)}\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{+152}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{1 + y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y 5.5e-10)
   (* (/ y (+ y x)) (/ x (* (- x -1.0) (+ y x))))
   (if (<= y 3.2e+152)
     (* (/ x y) (/ y (* (- (+ y x) -1.0) (+ y x))))
     (/ (/ x (+ y x)) (+ 1.0 y)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 5.5e-10) {
		tmp = (y / (y + x)) * (x / ((x - -1.0) * (y + x)));
	} else if (y <= 3.2e+152) {
		tmp = (x / y) * (y / (((y + x) - -1.0) * (y + x)));
	} else {
		tmp = (x / (y + x)) / (1.0 + y);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 5.5d-10) then
        tmp = (y / (y + x)) * (x / ((x - (-1.0d0)) * (y + x)))
    else if (y <= 3.2d+152) then
        tmp = (x / y) * (y / (((y + x) - (-1.0d0)) * (y + x)))
    else
        tmp = (x / (y + x)) / (1.0d0 + y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 5.5e-10) {
		tmp = (y / (y + x)) * (x / ((x - -1.0) * (y + x)));
	} else if (y <= 3.2e+152) {
		tmp = (x / y) * (y / (((y + x) - -1.0) * (y + x)));
	} else {
		tmp = (x / (y + x)) / (1.0 + y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 5.5e-10:
		tmp = (y / (y + x)) * (x / ((x - -1.0) * (y + x)))
	elif y <= 3.2e+152:
		tmp = (x / y) * (y / (((y + x) - -1.0) * (y + x)))
	else:
		tmp = (x / (y + x)) / (1.0 + y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 5.5e-10)
		tmp = Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(Float64(x - -1.0) * Float64(y + x))));
	elseif (y <= 3.2e+152)
		tmp = Float64(Float64(x / y) * Float64(y / Float64(Float64(Float64(y + x) - -1.0) * Float64(y + x))));
	else
		tmp = Float64(Float64(x / Float64(y + x)) / Float64(1.0 + y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 5.5e-10)
		tmp = (y / (y + x)) * (x / ((x - -1.0) * (y + x)));
	elseif (y <= 3.2e+152)
		tmp = (x / y) * (y / (((y + x) - -1.0) * (y + x)));
	else
		tmp = (x / (y + x)) / (1.0 + y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 5.5e-10], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(N[(x - -1.0), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.2e+152], N[(N[(x / y), $MachinePrecision] * N[(y / N[(N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{x}{\left(x - -1\right) \cdot \left(y + x\right)}\\

\mathbf{elif}\;y \leq 3.2 \cdot 10^{+152}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{1 + y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 5.4999999999999996e-10

    1. Initial program 68.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Taylor expanded in y around 0

      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(1 + x\right)}} \]
    3. Step-by-step derivation
      1. lower-+.f6458.5

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + \color{blue}{x}\right)} \]
    4. Applied rewrites58.5%

      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(1 + x\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(1 + x\right)} \]
      6. associate-*l*N/A

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(1 + x\right)\right)}} \]
      7. lift-+.f64N/A

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right)} \cdot \left(\left(x + y\right) \cdot \left(1 + x\right)\right)} \]
      8. +-commutativeN/A

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) \cdot \left(1 + x\right)\right)} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) \cdot \left(1 + x\right)\right)} \]
      10. times-fracN/A

        \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(x + y\right) \cdot \left(1 + x\right)}} \]
      11. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(x + y\right) \cdot \left(1 + x\right)}} \]
      12. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{y}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(1 + x\right)} \]
      13. lower-/.f64N/A

        \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(1 + x\right)}} \]
      14. lift-+.f64N/A

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(x + y\right)} \cdot \left(1 + x\right)} \]
      15. +-commutativeN/A

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(1 + x\right)} \]
      16. lift-+.f64N/A

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(1 + x\right)} \]
      17. *-commutativeN/A

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(1 + x\right) \cdot \left(y + x\right)}} \]
      18. lower-*.f6476.6

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(1 + x\right) \cdot \left(y + x\right)}} \]
    6. Applied rewrites76.6%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(x - -1\right) \cdot \left(y + x\right)}} \]

    if 5.4999999999999996e-10 < y < 3.20000000000000005e152

    1. Initial program 68.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      5. associate-*l*N/A

        \[\leadsto \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)}} \]
      6. times-fracN/A

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{x}{\color{blue}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      10. +-commutativeN/A

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      11. lower-+.f64N/A

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      12. lower-/.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      13. *-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
      14. lower-*.f6493.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
      15. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right)} \cdot \left(x + y\right)} \]
      16. add-flipN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
      17. lower--.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
      18. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      19. +-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      20. lower-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      21. metadata-eval93.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - \color{blue}{-1}\right) \cdot \left(x + y\right)} \]
      22. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(x + y\right)}} \]
      23. +-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
      24. lower-+.f6493.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
    3. Applied rewrites93.4%

      \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
    4. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{x}{y}} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)} \]
    5. Step-by-step derivation
      1. lower-/.f6458.7

        \[\leadsto \frac{x}{\color{blue}{y}} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)} \]
    6. Applied rewrites58.7%

      \[\leadsto \color{blue}{\frac{x}{y}} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)} \]

    if 3.20000000000000005e152 < y

    1. Initial program 68.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      5. associate-*l*N/A

        \[\leadsto \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)}} \]
      6. times-fracN/A

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{x}{\color{blue}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      10. +-commutativeN/A

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      11. lower-+.f64N/A

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      12. lower-/.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      13. *-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
      14. lower-*.f6493.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
      15. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right)} \cdot \left(x + y\right)} \]
      16. add-flipN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
      17. lower--.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
      18. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      19. +-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      20. lower-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      21. metadata-eval93.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - \color{blue}{-1}\right) \cdot \left(x + y\right)} \]
      22. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(x + y\right)}} \]
      23. +-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
      24. lower-+.f6493.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
    3. Applied rewrites93.4%

      \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
    4. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      3. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\frac{x}{y + x} \cdot y}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      5. times-fracN/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
      7. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1}} \cdot \frac{y}{y + x} \]
      8. lower-/.f6499.8

        \[\leadsto \frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \color{blue}{\frac{y}{y + x}} \]
    5. Applied rewrites99.8%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
      2. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1}} \cdot \frac{y}{y + x} \]
      3. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot \frac{y}{y + x}}{\left(y + x\right) - -1}} \]
      4. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{x}{y + x}} \cdot \frac{y}{y + x}}{\left(y + x\right) - -1} \]
      5. lift-/.f64N/A

        \[\leadsto \frac{\frac{x}{y + x} \cdot \color{blue}{\frac{y}{y + x}}}{\left(y + x\right) - -1} \]
      6. frac-timesN/A

        \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{\left(y + x\right) \cdot \left(y + x\right)}}}{\left(y + x\right) - -1} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{\frac{\color{blue}{x \cdot y}}{\left(y + x\right) \cdot \left(y + x\right)}}{\left(y + x\right) - -1} \]
      8. pow2N/A

        \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{{\left(y + x\right)}^{2}}}}{\left(y + x\right) - -1} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(y + x\right)}}^{2}}}{\left(y + x\right) - -1} \]
      10. +-commutativeN/A

        \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(x + y\right)}}^{2}}}{\left(y + x\right) - -1} \]
      11. lift-+.f64N/A

        \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(x + y\right)}}^{2}}}{\left(y + x\right) - -1} \]
      12. pow2N/A

        \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right)}}}{\left(y + x\right) - -1} \]
      13. lift-*.f64N/A

        \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right)}}}{\left(y + x\right) - -1} \]
      14. associate-/l/N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(y + x\right) - -1\right)}} \]
      15. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(y + x\right) - -1\right)} \]
      16. frac-timesN/A

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(y + x\right) - -1}} \]
      17. div-flipN/A

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{1}{\frac{\left(y + x\right) - -1}{y}}} \]
      18. lift-/.f64N/A

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{1}{\color{blue}{\frac{\left(y + x\right) - -1}{y}}} \]
    7. Applied rewrites99.2%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{\left(y + x\right) - -1}{y} \cdot \left(y + x\right)}} \]
    8. Taylor expanded in x around 0

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + y}} \]
    9. Step-by-step derivation
      1. lower-+.f6450.3

        \[\leadsto \frac{\frac{x}{y + x}}{1 + \color{blue}{y}} \]
    10. Applied rewrites50.3%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + y}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 12: 93.3% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{x}{y + x}\\ \mathbf{if}\;x \leq -7.5 \cdot 10^{-9}:\\ \;\;\;\;\frac{t\_0}{\left(y + x\right) - -1} \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_0 \cdot y}{\left(y - -1\right) \cdot \left(y + x\right)}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ x (+ y x))))
   (if (<= x -7.5e-9)
     (* (/ t_0 (- (+ y x) -1.0)) (/ y x))
     (/ (* t_0 y) (* (- y -1.0) (+ y x))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = x / (y + x);
	double tmp;
	if (x <= -7.5e-9) {
		tmp = (t_0 / ((y + x) - -1.0)) * (y / x);
	} else {
		tmp = (t_0 * y) / ((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) :: t_0
    real(8) :: tmp
    t_0 = x / (y + x)
    if (x <= (-7.5d-9)) then
        tmp = (t_0 / ((y + x) - (-1.0d0))) * (y / x)
    else
        tmp = (t_0 * y) / ((y - (-1.0d0)) * (y + x))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = x / (y + x);
	double tmp;
	if (x <= -7.5e-9) {
		tmp = (t_0 / ((y + x) - -1.0)) * (y / x);
	} else {
		tmp = (t_0 * y) / ((y - -1.0) * (y + x));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = x / (y + x)
	tmp = 0
	if x <= -7.5e-9:
		tmp = (t_0 / ((y + x) - -1.0)) * (y / x)
	else:
		tmp = (t_0 * y) / ((y - -1.0) * (y + x))
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(x / Float64(y + x))
	tmp = 0.0
	if (x <= -7.5e-9)
		tmp = Float64(Float64(t_0 / Float64(Float64(y + x) - -1.0)) * Float64(y / x));
	else
		tmp = Float64(Float64(t_0 * y) / Float64(Float64(y - -1.0) * Float64(y + x)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = x / (y + x);
	tmp = 0.0;
	if (x <= -7.5e-9)
		tmp = (t_0 / ((y + x) - -1.0)) * (y / x);
	else
		tmp = (t_0 * y) / ((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_] := Block[{t$95$0 = N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.5e-9], N[(N[(t$95$0 / N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * y), $MachinePrecision] / N[(N[(y - -1.0), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{x}{y + x}\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{t\_0}{\left(y + x\right) - -1} \cdot \frac{y}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot y}{\left(y - -1\right) \cdot \left(y + x\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.49999999999999933e-9

    1. Initial program 68.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      5. associate-*l*N/A

        \[\leadsto \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)}} \]
      6. times-fracN/A

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{x}{\color{blue}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      10. +-commutativeN/A

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      11. lower-+.f64N/A

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      12. lower-/.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      13. *-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
      14. lower-*.f6493.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
      15. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right)} \cdot \left(x + y\right)} \]
      16. add-flipN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
      17. lower--.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
      18. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      19. +-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      20. lower-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      21. metadata-eval93.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - \color{blue}{-1}\right) \cdot \left(x + y\right)} \]
      22. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(x + y\right)}} \]
      23. +-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
      24. lower-+.f6493.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
    3. Applied rewrites93.4%

      \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
    4. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      3. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\frac{x}{y + x} \cdot y}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      5. times-fracN/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
      7. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1}} \cdot \frac{y}{y + x} \]
      8. lower-/.f6499.8

        \[\leadsto \frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \color{blue}{\frac{y}{y + x}} \]
    5. Applied rewrites99.8%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
    6. Taylor expanded in x around inf

      \[\leadsto \frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \color{blue}{\frac{y}{x}} \]
    7. Step-by-step derivation
      1. lower-/.f6461.6

        \[\leadsto \frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{\color{blue}{x}} \]
    8. Applied rewrites61.6%

      \[\leadsto \frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \color{blue}{\frac{y}{x}} \]

    if -7.49999999999999933e-9 < x

    1. Initial program 68.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Taylor expanded in x around 0

      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(1 + y\right)}} \]
    3. Step-by-step derivation
      1. lower-+.f6458.2

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + \color{blue}{y}\right)} \]
    4. Applied rewrites58.2%

      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(1 + y\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 + y\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 + y\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 + y\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 + y\right)\right)}} \]
      5. lift-+.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right)} \cdot \left(\left(x + y\right) \cdot \left(1 + y\right)\right)} \]
      6. +-commutativeN/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) \cdot \left(1 + y\right)\right)} \]
      7. lift-+.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) \cdot \left(1 + y\right)\right)} \]
      8. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{y + x}}{\left(x + y\right) \cdot \left(1 + y\right)}} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{\frac{\color{blue}{x \cdot y}}{y + x}}{\left(x + y\right) \cdot \left(1 + y\right)} \]
      10. associate-*l/N/A

        \[\leadsto \frac{\color{blue}{\frac{x}{y + x} \cdot y}}{\left(x + y\right) \cdot \left(1 + y\right)} \]
      11. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{x}{y + x}} \cdot y}{\left(x + y\right) \cdot \left(1 + y\right)} \]
      12. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot y}{\left(x + y\right) \cdot \left(1 + y\right)}} \]
      13. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{x}{y + x} \cdot y}}{\left(x + y\right) \cdot \left(1 + y\right)} \]
      14. lift-+.f64N/A

        \[\leadsto \frac{\frac{x}{y + x} \cdot y}{\color{blue}{\left(x + y\right)} \cdot \left(1 + y\right)} \]
      15. +-commutativeN/A

        \[\leadsto \frac{\frac{x}{y + x} \cdot y}{\color{blue}{\left(y + x\right)} \cdot \left(1 + y\right)} \]
      16. lift-+.f64N/A

        \[\leadsto \frac{\frac{x}{y + x} \cdot y}{\color{blue}{\left(y + x\right)} \cdot \left(1 + y\right)} \]
      17. *-commutativeN/A

        \[\leadsto \frac{\frac{x}{y + x} \cdot y}{\color{blue}{\left(1 + y\right) \cdot \left(y + x\right)}} \]
    6. Applied rewrites75.6%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot y}{\left(y - -1\right) \cdot \left(y + x\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 13: 91.6% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \left(y + x\right) - -1\\ \mathbf{if}\;y \leq 1.6 \cdot 10^{-162}:\\ \;\;\;\;\frac{\frac{y}{x}}{t\_0}\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{-10}:\\ \;\;\;\;y \cdot \frac{x}{\left(x - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{+152}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{y}{t\_0 \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{1 + y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (- (+ y x) -1.0)))
   (if (<= y 1.6e-162)
     (/ (/ y x) t_0)
     (if (<= y 4.6e-10)
       (* y (/ x (* (- x -1.0) (* (+ y x) (+ y x)))))
       (if (<= y 3.2e+152)
         (* (/ x y) (/ y (* t_0 (+ y x))))
         (/ (/ x (+ y x)) (+ 1.0 y)))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = (y + x) - -1.0;
	double tmp;
	if (y <= 1.6e-162) {
		tmp = (y / x) / t_0;
	} else if (y <= 4.6e-10) {
		tmp = y * (x / ((x - -1.0) * ((y + x) * (y + x))));
	} else if (y <= 3.2e+152) {
		tmp = (x / y) * (y / (t_0 * (y + x)));
	} else {
		tmp = (x / (y + x)) / (1.0 + y);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (y + x) - (-1.0d0)
    if (y <= 1.6d-162) then
        tmp = (y / x) / t_0
    else if (y <= 4.6d-10) then
        tmp = y * (x / ((x - (-1.0d0)) * ((y + x) * (y + x))))
    else if (y <= 3.2d+152) then
        tmp = (x / y) * (y / (t_0 * (y + x)))
    else
        tmp = (x / (y + x)) / (1.0d0 + y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = (y + x) - -1.0;
	double tmp;
	if (y <= 1.6e-162) {
		tmp = (y / x) / t_0;
	} else if (y <= 4.6e-10) {
		tmp = y * (x / ((x - -1.0) * ((y + x) * (y + x))));
	} else if (y <= 3.2e+152) {
		tmp = (x / y) * (y / (t_0 * (y + x)));
	} else {
		tmp = (x / (y + x)) / (1.0 + y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = (y + x) - -1.0
	tmp = 0
	if y <= 1.6e-162:
		tmp = (y / x) / t_0
	elif y <= 4.6e-10:
		tmp = y * (x / ((x - -1.0) * ((y + x) * (y + x))))
	elif y <= 3.2e+152:
		tmp = (x / y) * (y / (t_0 * (y + x)))
	else:
		tmp = (x / (y + x)) / (1.0 + y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(Float64(y + x) - -1.0)
	tmp = 0.0
	if (y <= 1.6e-162)
		tmp = Float64(Float64(y / x) / t_0);
	elseif (y <= 4.6e-10)
		tmp = Float64(y * Float64(x / Float64(Float64(x - -1.0) * Float64(Float64(y + x) * Float64(y + x)))));
	elseif (y <= 3.2e+152)
		tmp = Float64(Float64(x / y) * Float64(y / Float64(t_0 * Float64(y + x))));
	else
		tmp = Float64(Float64(x / Float64(y + x)) / Float64(1.0 + y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = (y + x) - -1.0;
	tmp = 0.0;
	if (y <= 1.6e-162)
		tmp = (y / x) / t_0;
	elseif (y <= 4.6e-10)
		tmp = y * (x / ((x - -1.0) * ((y + x) * (y + x))));
	elseif (y <= 3.2e+152)
		tmp = (x / y) * (y / (t_0 * (y + x)));
	else
		tmp = (x / (y + x)) / (1.0 + y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision]}, If[LessEqual[y, 1.6e-162], N[(N[(y / x), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[y, 4.6e-10], N[(y * N[(x / N[(N[(x - -1.0), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.2e+152], N[(N[(x / y), $MachinePrecision] * N[(y / N[(t$95$0 * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(y + x\right) - -1\\
\mathbf{if}\;y \leq 1.6 \cdot 10^{-162}:\\
\;\;\;\;\frac{\frac{y}{x}}{t\_0}\\

\mathbf{elif}\;y \leq 4.6 \cdot 10^{-10}:\\
\;\;\;\;y \cdot \frac{x}{\left(x - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\

\mathbf{elif}\;y \leq 3.2 \cdot 10^{+152}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{y}{t\_0 \cdot \left(y + x\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{1 + y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 1.59999999999999988e-162

    1. Initial program 68.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. 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. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1}} \]
      6. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1}} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}}{\left(x + y\right) + 1} \]
      8. lower-/.f6487.6

        \[\leadsto \frac{\color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \cdot y}{\left(x + y\right) + 1} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{\frac{x}{\color{blue}{\left(x + y\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
      10. +-commutativeN/A

        \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
      11. lower-+.f6487.6

        \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
      12. lift-+.f64N/A

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + y\right)}} \cdot y}{\left(x + y\right) + 1} \]
      13. +-commutativeN/A

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot y}{\left(x + y\right) + 1} \]
      14. lower-+.f6487.6

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot y}{\left(x + y\right) + 1} \]
      15. lift-+.f64N/A

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) + 1}} \]
      16. add-flipN/A

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
      17. lower--.f64N/A

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
      18. lift-+.f64N/A

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
      19. +-commutativeN/A

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
      20. lower-+.f64N/A

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
      21. metadata-eval87.6

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\left(y + x\right) - \color{blue}{-1}} \]
    3. Applied rewrites87.6%

      \[\leadsto \color{blue}{\frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\left(y + x\right) - -1}} \]
    4. Taylor expanded in x around inf

      \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{\left(y + x\right) - -1} \]
    5. Step-by-step derivation
      1. lower-/.f6451.2

        \[\leadsto \frac{\frac{y}{\color{blue}{x}}}{\left(y + x\right) - -1} \]
    6. Applied rewrites51.2%

      \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{\left(y + x\right) - -1} \]

    if 1.59999999999999988e-162 < y < 4.60000000000000014e-10

    1. Initial program 68.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Taylor expanded in y around 0

      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(1 + x\right)}} \]
    3. Step-by-step derivation
      1. lower-+.f6458.5

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + \color{blue}{x}\right)} \]
    4. Applied rewrites58.5%

      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(1 + x\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)} \]
      4. associate-/l*N/A

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
      5. lower-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
      6. lower-/.f6475.6

        \[\leadsto y \cdot \color{blue}{\frac{x}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
      7. lift-*.f64N/A

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
      8. *-commutativeN/A

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(1 + x\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      9. lower-*.f6475.6

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(1 + x\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      10. lift-+.f64N/A

        \[\leadsto y \cdot \frac{x}{\left(1 + \color{blue}{x}\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      11. +-commutativeN/A

        \[\leadsto y \cdot \frac{x}{\left(x + \color{blue}{1}\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      12. add-flip-revN/A

        \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      13. metadata-evalN/A

        \[\leadsto y \cdot \frac{x}{\left(x - -1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      14. lower--.f6475.6

        \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      15. lower--.f64N/A

        \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\mathsf{Rewrite=>}\left(lift-+.f64, \left(x + y\right)\right) \cdot \left(x + y\right)\right)} \]
      16. lower--.f64N/A

        \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\mathsf{Rewrite<=}\left(+-commutative, \left(y + x\right)\right) \cdot \left(x + y\right)\right)} \]
      17. lower--.f64N/A

        \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\mathsf{Rewrite<=}\left(lift-+.f64, \left(y + x\right)\right) \cdot \left(x + y\right)\right)} \]
      18. lower--.f64N/A

        \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\left(y + x\right) \cdot \mathsf{Rewrite=>}\left(lift-+.f64, \left(x + y\right)\right)\right)} \]
      19. lower--.f64N/A

        \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\left(y + x\right) \cdot \mathsf{Rewrite<=}\left(+-commutative, \left(y + x\right)\right)\right)} \]
      20. lower--.f64N/A

        \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\left(y + x\right) \cdot \mathsf{Rewrite<=}\left(lift-+.f64, \left(y + x\right)\right)\right)} \]
    6. Applied rewrites75.6%

      \[\leadsto \color{blue}{y \cdot \frac{x}{\left(x - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]

    if 4.60000000000000014e-10 < y < 3.20000000000000005e152

    1. Initial program 68.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      5. associate-*l*N/A

        \[\leadsto \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)}} \]
      6. times-fracN/A

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{x}{\color{blue}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      10. +-commutativeN/A

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      11. lower-+.f64N/A

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      12. lower-/.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      13. *-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
      14. lower-*.f6493.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
      15. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right)} \cdot \left(x + y\right)} \]
      16. add-flipN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
      17. lower--.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
      18. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      19. +-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      20. lower-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      21. metadata-eval93.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - \color{blue}{-1}\right) \cdot \left(x + y\right)} \]
      22. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(x + y\right)}} \]
      23. +-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
      24. lower-+.f6493.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
    3. Applied rewrites93.4%

      \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
    4. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{x}{y}} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)} \]
    5. Step-by-step derivation
      1. lower-/.f6458.7

        \[\leadsto \frac{x}{\color{blue}{y}} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)} \]
    6. Applied rewrites58.7%

      \[\leadsto \color{blue}{\frac{x}{y}} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)} \]

    if 3.20000000000000005e152 < y

    1. Initial program 68.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      5. associate-*l*N/A

        \[\leadsto \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)}} \]
      6. times-fracN/A

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{x}{\color{blue}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      10. +-commutativeN/A

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      11. lower-+.f64N/A

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      12. lower-/.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      13. *-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
      14. lower-*.f6493.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
      15. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right)} \cdot \left(x + y\right)} \]
      16. add-flipN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
      17. lower--.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
      18. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      19. +-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      20. lower-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      21. metadata-eval93.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - \color{blue}{-1}\right) \cdot \left(x + y\right)} \]
      22. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(x + y\right)}} \]
      23. +-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
      24. lower-+.f6493.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
    3. Applied rewrites93.4%

      \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
    4. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      3. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\frac{x}{y + x} \cdot y}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      5. times-fracN/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
      7. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1}} \cdot \frac{y}{y + x} \]
      8. lower-/.f6499.8

        \[\leadsto \frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \color{blue}{\frac{y}{y + x}} \]
    5. Applied rewrites99.8%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
    6. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
      2. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1}} \cdot \frac{y}{y + x} \]
      3. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot \frac{y}{y + x}}{\left(y + x\right) - -1}} \]
      4. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{x}{y + x}} \cdot \frac{y}{y + x}}{\left(y + x\right) - -1} \]
      5. lift-/.f64N/A

        \[\leadsto \frac{\frac{x}{y + x} \cdot \color{blue}{\frac{y}{y + x}}}{\left(y + x\right) - -1} \]
      6. frac-timesN/A

        \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{\left(y + x\right) \cdot \left(y + x\right)}}}{\left(y + x\right) - -1} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{\frac{\color{blue}{x \cdot y}}{\left(y + x\right) \cdot \left(y + x\right)}}{\left(y + x\right) - -1} \]
      8. pow2N/A

        \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{{\left(y + x\right)}^{2}}}}{\left(y + x\right) - -1} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(y + x\right)}}^{2}}}{\left(y + x\right) - -1} \]
      10. +-commutativeN/A

        \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(x + y\right)}}^{2}}}{\left(y + x\right) - -1} \]
      11. lift-+.f64N/A

        \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(x + y\right)}}^{2}}}{\left(y + x\right) - -1} \]
      12. pow2N/A

        \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right)}}}{\left(y + x\right) - -1} \]
      13. lift-*.f64N/A

        \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right)}}}{\left(y + x\right) - -1} \]
      14. associate-/l/N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(y + x\right) - -1\right)}} \]
      15. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(y + x\right) - -1\right)} \]
      16. frac-timesN/A

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(y + x\right) - -1}} \]
      17. div-flipN/A

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{1}{\frac{\left(y + x\right) - -1}{y}}} \]
      18. lift-/.f64N/A

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{1}{\color{blue}{\frac{\left(y + x\right) - -1}{y}}} \]
    7. Applied rewrites99.2%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{\left(y + x\right) - -1}{y} \cdot \left(y + x\right)}} \]
    8. Taylor expanded in x around 0

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + y}} \]
    9. Step-by-step derivation
      1. lower-+.f6450.3

        \[\leadsto \frac{\frac{x}{y + x}}{1 + \color{blue}{y}} \]
    10. Applied rewrites50.3%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + y}} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 14: 90.6% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \left(y + x\right) \cdot \left(y + x\right)\\ t_1 := \left(y + x\right) - -1\\ \mathbf{if}\;y \leq 1.6 \cdot 10^{-162}:\\ \;\;\;\;\frac{\frac{y}{x}}{t\_1}\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{-10}:\\ \;\;\;\;y \cdot \frac{x}{\left(x - -1\right) \cdot t\_0}\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{+118}:\\ \;\;\;\;\frac{y}{\left(y - -1\right) \cdot t\_0} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{t\_1} \cdot 1\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (+ y x) (+ y x))) (t_1 (- (+ y x) -1.0)))
   (if (<= y 1.6e-162)
     (/ (/ y x) t_1)
     (if (<= y 4.4e-10)
       (* y (/ x (* (- x -1.0) t_0)))
       (if (<= y 1.5e+118)
         (* (/ y (* (- y -1.0) t_0)) x)
         (* (/ (/ x (+ y x)) t_1) 1.0))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = (y + x) * (y + x);
	double t_1 = (y + x) - -1.0;
	double tmp;
	if (y <= 1.6e-162) {
		tmp = (y / x) / t_1;
	} else if (y <= 4.4e-10) {
		tmp = y * (x / ((x - -1.0) * t_0));
	} else if (y <= 1.5e+118) {
		tmp = (y / ((y - -1.0) * t_0)) * x;
	} else {
		tmp = ((x / (y + x)) / t_1) * 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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (y + x) * (y + x)
    t_1 = (y + x) - (-1.0d0)
    if (y <= 1.6d-162) then
        tmp = (y / x) / t_1
    else if (y <= 4.4d-10) then
        tmp = y * (x / ((x - (-1.0d0)) * t_0))
    else if (y <= 1.5d+118) then
        tmp = (y / ((y - (-1.0d0)) * t_0)) * x
    else
        tmp = ((x / (y + x)) / t_1) * 1.0d0
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = (y + x) * (y + x);
	double t_1 = (y + x) - -1.0;
	double tmp;
	if (y <= 1.6e-162) {
		tmp = (y / x) / t_1;
	} else if (y <= 4.4e-10) {
		tmp = y * (x / ((x - -1.0) * t_0));
	} else if (y <= 1.5e+118) {
		tmp = (y / ((y - -1.0) * t_0)) * x;
	} else {
		tmp = ((x / (y + x)) / t_1) * 1.0;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = (y + x) * (y + x)
	t_1 = (y + x) - -1.0
	tmp = 0
	if y <= 1.6e-162:
		tmp = (y / x) / t_1
	elif y <= 4.4e-10:
		tmp = y * (x / ((x - -1.0) * t_0))
	elif y <= 1.5e+118:
		tmp = (y / ((y - -1.0) * t_0)) * x
	else:
		tmp = ((x / (y + x)) / t_1) * 1.0
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(Float64(y + x) * Float64(y + x))
	t_1 = Float64(Float64(y + x) - -1.0)
	tmp = 0.0
	if (y <= 1.6e-162)
		tmp = Float64(Float64(y / x) / t_1);
	elseif (y <= 4.4e-10)
		tmp = Float64(y * Float64(x / Float64(Float64(x - -1.0) * t_0)));
	elseif (y <= 1.5e+118)
		tmp = Float64(Float64(y / Float64(Float64(y - -1.0) * t_0)) * x);
	else
		tmp = Float64(Float64(Float64(x / Float64(y + x)) / t_1) * 1.0);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = (y + x) * (y + x);
	t_1 = (y + x) - -1.0;
	tmp = 0.0;
	if (y <= 1.6e-162)
		tmp = (y / x) / t_1;
	elseif (y <= 4.4e-10)
		tmp = y * (x / ((x - -1.0) * t_0));
	elseif (y <= 1.5e+118)
		tmp = (y / ((y - -1.0) * t_0)) * x;
	else
		tmp = ((x / (y + x)) / t_1) * 1.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[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision]}, If[LessEqual[y, 1.6e-162], N[(N[(y / x), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[y, 4.4e-10], N[(y * N[(x / N[(N[(x - -1.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.5e+118], N[(N[(y / N[(N[(y - -1.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] * 1.0), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \left(y + x\right) \cdot \left(y + x\right)\\
t_1 := \left(y + x\right) - -1\\
\mathbf{if}\;y \leq 1.6 \cdot 10^{-162}:\\
\;\;\;\;\frac{\frac{y}{x}}{t\_1}\\

\mathbf{elif}\;y \leq 4.4 \cdot 10^{-10}:\\
\;\;\;\;y \cdot \frac{x}{\left(x - -1\right) \cdot t\_0}\\

\mathbf{elif}\;y \leq 1.5 \cdot 10^{+118}:\\
\;\;\;\;\frac{y}{\left(y - -1\right) \cdot t\_0} \cdot x\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{t\_1} \cdot 1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 1.59999999999999988e-162

    1. Initial program 68.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. 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. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1}} \]
      6. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1}} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}}{\left(x + y\right) + 1} \]
      8. lower-/.f6487.6

        \[\leadsto \frac{\color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \cdot y}{\left(x + y\right) + 1} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{\frac{x}{\color{blue}{\left(x + y\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
      10. +-commutativeN/A

        \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
      11. lower-+.f6487.6

        \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
      12. lift-+.f64N/A

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + y\right)}} \cdot y}{\left(x + y\right) + 1} \]
      13. +-commutativeN/A

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot y}{\left(x + y\right) + 1} \]
      14. lower-+.f6487.6

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot y}{\left(x + y\right) + 1} \]
      15. lift-+.f64N/A

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) + 1}} \]
      16. add-flipN/A

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
      17. lower--.f64N/A

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
      18. lift-+.f64N/A

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
      19. +-commutativeN/A

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
      20. lower-+.f64N/A

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
      21. metadata-eval87.6

        \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\left(y + x\right) - \color{blue}{-1}} \]
    3. Applied rewrites87.6%

      \[\leadsto \color{blue}{\frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\left(y + x\right) - -1}} \]
    4. Taylor expanded in x around inf

      \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{\left(y + x\right) - -1} \]
    5. Step-by-step derivation
      1. lower-/.f6451.2

        \[\leadsto \frac{\frac{y}{\color{blue}{x}}}{\left(y + x\right) - -1} \]
    6. Applied rewrites51.2%

      \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{\left(y + x\right) - -1} \]

    if 1.59999999999999988e-162 < y < 4.3999999999999998e-10

    1. Initial program 68.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Taylor expanded in y around 0

      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(1 + x\right)}} \]
    3. Step-by-step derivation
      1. lower-+.f6458.5

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + \color{blue}{x}\right)} \]
    4. Applied rewrites58.5%

      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(1 + x\right)}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)} \]
      4. associate-/l*N/A

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
      5. lower-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
      6. lower-/.f6475.6

        \[\leadsto y \cdot \color{blue}{\frac{x}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
      7. lift-*.f64N/A

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
      8. *-commutativeN/A

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(1 + x\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      9. lower-*.f6475.6

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(1 + x\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      10. lift-+.f64N/A

        \[\leadsto y \cdot \frac{x}{\left(1 + \color{blue}{x}\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      11. +-commutativeN/A

        \[\leadsto y \cdot \frac{x}{\left(x + \color{blue}{1}\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      12. add-flip-revN/A

        \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      13. metadata-evalN/A

        \[\leadsto y \cdot \frac{x}{\left(x - -1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      14. lower--.f6475.6

        \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      15. lower--.f64N/A

        \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\mathsf{Rewrite=>}\left(lift-+.f64, \left(x + y\right)\right) \cdot \left(x + y\right)\right)} \]
      16. lower--.f64N/A

        \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\mathsf{Rewrite<=}\left(+-commutative, \left(y + x\right)\right) \cdot \left(x + y\right)\right)} \]
      17. lower--.f64N/A

        \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\mathsf{Rewrite<=}\left(lift-+.f64, \left(y + x\right)\right) \cdot \left(x + y\right)\right)} \]
      18. lower--.f64N/A

        \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\left(y + x\right) \cdot \mathsf{Rewrite=>}\left(lift-+.f64, \left(x + y\right)\right)\right)} \]
      19. lower--.f64N/A

        \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\left(y + x\right) \cdot \mathsf{Rewrite<=}\left(+-commutative, \left(y + x\right)\right)\right)} \]
      20. lower--.f64N/A

        \[\leadsto y \cdot \frac{x}{\left(x - \color{blue}{-1}\right) \cdot \left(\left(y + x\right) \cdot \mathsf{Rewrite<=}\left(lift-+.f64, \left(y + x\right)\right)\right)} \]
    6. Applied rewrites75.6%

      \[\leadsto \color{blue}{y \cdot \frac{x}{\left(x - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]

    if 4.3999999999999998e-10 < y < 1.5e118

    1. Initial program 68.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Taylor expanded in x around 0

      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(1 + y\right)}} \]
    3. Step-by-step derivation
      1. lower-+.f6458.2

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + \color{blue}{y}\right)} \]
    4. Applied rewrites58.2%

      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(1 + y\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 + y\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 + y\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 + y\right)}} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + y\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 + y\right)} \cdot x} \]
    6. Applied rewrites75.4%

      \[\leadsto \color{blue}{\frac{y}{\left(y - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)} \cdot x} \]

    if 1.5e118 < y

    1. Initial program 68.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      5. associate-*l*N/A

        \[\leadsto \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)}} \]
      6. times-fracN/A

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{x}{\color{blue}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      10. +-commutativeN/A

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      11. lower-+.f64N/A

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      12. lower-/.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      13. *-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
      14. lower-*.f6493.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
      15. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right)} \cdot \left(x + y\right)} \]
      16. add-flipN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
      17. lower--.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
      18. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      19. +-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      20. lower-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
      21. metadata-eval93.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - \color{blue}{-1}\right) \cdot \left(x + y\right)} \]
      22. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(x + y\right)}} \]
      23. +-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
      24. lower-+.f6493.4

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
    3. Applied rewrites93.4%

      \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
    4. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      3. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\frac{x}{y + x} \cdot y}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      5. times-fracN/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
      7. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1}} \cdot \frac{y}{y + x} \]
      8. lower-/.f6499.8

        \[\leadsto \frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \color{blue}{\frac{y}{y + x}} \]
    5. Applied rewrites99.8%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
    6. Taylor expanded in x around 0

      \[\leadsto \frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \color{blue}{1} \]
    7. Step-by-step derivation
      1. Applied rewrites51.1%

        \[\leadsto \frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \color{blue}{1} \]
    8. Recombined 4 regimes into one program.
    9. Add Preprocessing

    Alternative 15: 90.2% accurate, 0.7× speedup?

    \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \left(y + x\right) \cdot \left(y + x\right)\\ t_1 := \left(y + x\right) - -1\\ \mathbf{if}\;y \leq 1.95 \cdot 10^{-162}:\\ \;\;\;\;\frac{\frac{y}{x}}{t\_1}\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{-10}:\\ \;\;\;\;\frac{y}{\left(x - -1\right) \cdot t\_0} \cdot x\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{+118}:\\ \;\;\;\;\frac{y}{\left(y - -1\right) \cdot t\_0} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{t\_1} \cdot 1\\ \end{array} \end{array} \]
    NOTE: x and y should be sorted in increasing order before calling this function.
    (FPCore (x y)
     :precision binary64
     (let* ((t_0 (* (+ y x) (+ y x))) (t_1 (- (+ y x) -1.0)))
       (if (<= y 1.95e-162)
         (/ (/ y x) t_1)
         (if (<= y 4.4e-10)
           (* (/ y (* (- x -1.0) t_0)) x)
           (if (<= y 1.5e+118)
             (* (/ y (* (- y -1.0) t_0)) x)
             (* (/ (/ x (+ y x)) t_1) 1.0))))))
    assert(x < y);
    double code(double x, double y) {
    	double t_0 = (y + x) * (y + x);
    	double t_1 = (y + x) - -1.0;
    	double tmp;
    	if (y <= 1.95e-162) {
    		tmp = (y / x) / t_1;
    	} else if (y <= 4.4e-10) {
    		tmp = (y / ((x - -1.0) * t_0)) * x;
    	} else if (y <= 1.5e+118) {
    		tmp = (y / ((y - -1.0) * t_0)) * x;
    	} else {
    		tmp = ((x / (y + x)) / t_1) * 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) :: t_0
        real(8) :: t_1
        real(8) :: tmp
        t_0 = (y + x) * (y + x)
        t_1 = (y + x) - (-1.0d0)
        if (y <= 1.95d-162) then
            tmp = (y / x) / t_1
        else if (y <= 4.4d-10) then
            tmp = (y / ((x - (-1.0d0)) * t_0)) * x
        else if (y <= 1.5d+118) then
            tmp = (y / ((y - (-1.0d0)) * t_0)) * x
        else
            tmp = ((x / (y + x)) / t_1) * 1.0d0
        end if
        code = tmp
    end function
    
    assert x < y;
    public static double code(double x, double y) {
    	double t_0 = (y + x) * (y + x);
    	double t_1 = (y + x) - -1.0;
    	double tmp;
    	if (y <= 1.95e-162) {
    		tmp = (y / x) / t_1;
    	} else if (y <= 4.4e-10) {
    		tmp = (y / ((x - -1.0) * t_0)) * x;
    	} else if (y <= 1.5e+118) {
    		tmp = (y / ((y - -1.0) * t_0)) * x;
    	} else {
    		tmp = ((x / (y + x)) / t_1) * 1.0;
    	}
    	return tmp;
    }
    
    [x, y] = sort([x, y])
    def code(x, y):
    	t_0 = (y + x) * (y + x)
    	t_1 = (y + x) - -1.0
    	tmp = 0
    	if y <= 1.95e-162:
    		tmp = (y / x) / t_1
    	elif y <= 4.4e-10:
    		tmp = (y / ((x - -1.0) * t_0)) * x
    	elif y <= 1.5e+118:
    		tmp = (y / ((y - -1.0) * t_0)) * x
    	else:
    		tmp = ((x / (y + x)) / t_1) * 1.0
    	return tmp
    
    x, y = sort([x, y])
    function code(x, y)
    	t_0 = Float64(Float64(y + x) * Float64(y + x))
    	t_1 = Float64(Float64(y + x) - -1.0)
    	tmp = 0.0
    	if (y <= 1.95e-162)
    		tmp = Float64(Float64(y / x) / t_1);
    	elseif (y <= 4.4e-10)
    		tmp = Float64(Float64(y / Float64(Float64(x - -1.0) * t_0)) * x);
    	elseif (y <= 1.5e+118)
    		tmp = Float64(Float64(y / Float64(Float64(y - -1.0) * t_0)) * x);
    	else
    		tmp = Float64(Float64(Float64(x / Float64(y + x)) / t_1) * 1.0);
    	end
    	return tmp
    end
    
    x, y = num2cell(sort([x, y])){:}
    function tmp_2 = code(x, y)
    	t_0 = (y + x) * (y + x);
    	t_1 = (y + x) - -1.0;
    	tmp = 0.0;
    	if (y <= 1.95e-162)
    		tmp = (y / x) / t_1;
    	elseif (y <= 4.4e-10)
    		tmp = (y / ((x - -1.0) * t_0)) * x;
    	elseif (y <= 1.5e+118)
    		tmp = (y / ((y - -1.0) * t_0)) * x;
    	else
    		tmp = ((x / (y + x)) / t_1) * 1.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[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision]}, If[LessEqual[y, 1.95e-162], N[(N[(y / x), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[y, 4.4e-10], N[(N[(y / N[(N[(x - -1.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 1.5e+118], N[(N[(y / N[(N[(y - -1.0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] * 1.0), $MachinePrecision]]]]]]
    
    \begin{array}{l}
    [x, y] = \mathsf{sort}([x, y])\\
    \\
    \begin{array}{l}
    t_0 := \left(y + x\right) \cdot \left(y + x\right)\\
    t_1 := \left(y + x\right) - -1\\
    \mathbf{if}\;y \leq 1.95 \cdot 10^{-162}:\\
    \;\;\;\;\frac{\frac{y}{x}}{t\_1}\\
    
    \mathbf{elif}\;y \leq 4.4 \cdot 10^{-10}:\\
    \;\;\;\;\frac{y}{\left(x - -1\right) \cdot t\_0} \cdot x\\
    
    \mathbf{elif}\;y \leq 1.5 \cdot 10^{+118}:\\
    \;\;\;\;\frac{y}{\left(y - -1\right) \cdot t\_0} \cdot x\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{x}{y + x}}{t\_1} \cdot 1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if y < 1.95e-162

      1. Initial program 68.5%

        \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
        2. lift-*.f64N/A

          \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        3. 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. associate-*r/N/A

          \[\leadsto \color{blue}{\frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1}} \]
        6. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1}} \]
        7. lower-*.f64N/A

          \[\leadsto \frac{\color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}}{\left(x + y\right) + 1} \]
        8. lower-/.f6487.6

          \[\leadsto \frac{\color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \cdot y}{\left(x + y\right) + 1} \]
        9. lift-+.f64N/A

          \[\leadsto \frac{\frac{x}{\color{blue}{\left(x + y\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
        10. +-commutativeN/A

          \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
        11. lower-+.f6487.6

          \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
        12. lift-+.f64N/A

          \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + y\right)}} \cdot y}{\left(x + y\right) + 1} \]
        13. +-commutativeN/A

          \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot y}{\left(x + y\right) + 1} \]
        14. lower-+.f6487.6

          \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot y}{\left(x + y\right) + 1} \]
        15. lift-+.f64N/A

          \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) + 1}} \]
        16. add-flipN/A

          \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
        17. lower--.f64N/A

          \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
        18. lift-+.f64N/A

          \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
        19. +-commutativeN/A

          \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
        20. lower-+.f64N/A

          \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
        21. metadata-eval87.6

          \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\left(y + x\right) - \color{blue}{-1}} \]
      3. Applied rewrites87.6%

        \[\leadsto \color{blue}{\frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\left(y + x\right) - -1}} \]
      4. Taylor expanded in x around inf

        \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{\left(y + x\right) - -1} \]
      5. Step-by-step derivation
        1. lower-/.f6451.2

          \[\leadsto \frac{\frac{y}{\color{blue}{x}}}{\left(y + x\right) - -1} \]
      6. Applied rewrites51.2%

        \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{\left(y + x\right) - -1} \]

      if 1.95e-162 < y < 4.3999999999999998e-10

      1. Initial program 68.5%

        \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. Taylor expanded in y around 0

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(1 + x\right)}} \]
      3. Step-by-step derivation
        1. lower-+.f6458.5

          \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + \color{blue}{x}\right)} \]
      4. Applied rewrites58.5%

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(1 + x\right)}} \]
      5. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
        2. lift-*.f64N/A

          \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)} \]
        3. associate-/l*N/A

          \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
        4. *-commutativeN/A

          \[\leadsto \color{blue}{\frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)} \cdot x} \]
        5. lower-*.f64N/A

          \[\leadsto \color{blue}{\frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)} \cdot x} \]
      6. Applied rewrites72.1%

        \[\leadsto \color{blue}{\frac{y}{\left(x - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)} \cdot x} \]

      if 4.3999999999999998e-10 < y < 1.5e118

      1. Initial program 68.5%

        \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. Taylor expanded in x around 0

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(1 + y\right)}} \]
      3. Step-by-step derivation
        1. lower-+.f6458.2

          \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + \color{blue}{y}\right)} \]
      4. Applied rewrites58.2%

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(1 + y\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 + y\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 + y\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 + y\right)}} \]
        4. *-commutativeN/A

          \[\leadsto \color{blue}{\frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + y\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 + y\right)} \cdot x} \]
      6. Applied rewrites75.4%

        \[\leadsto \color{blue}{\frac{y}{\left(y - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)} \cdot x} \]

      if 1.5e118 < y

      1. Initial program 68.5%

        \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
        2. lift-*.f64N/A

          \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        3. lift-*.f64N/A

          \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
        4. lift-*.f64N/A

          \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
        5. associate-*l*N/A

          \[\leadsto \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)}} \]
        6. times-fracN/A

          \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
        7. lower-*.f64N/A

          \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
        8. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        9. lift-+.f64N/A

          \[\leadsto \frac{x}{\color{blue}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        10. +-commutativeN/A

          \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        11. lower-+.f64N/A

          \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        12. lower-/.f64N/A

          \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
        13. *-commutativeN/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
        14. lower-*.f6493.4

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
        15. lift-+.f64N/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right)} \cdot \left(x + y\right)} \]
        16. add-flipN/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
        17. lower--.f64N/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
        18. lift-+.f64N/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
        19. +-commutativeN/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
        20. lower-+.f64N/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
        21. metadata-eval93.4

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - \color{blue}{-1}\right) \cdot \left(x + y\right)} \]
        22. lift-+.f64N/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(x + y\right)}} \]
        23. +-commutativeN/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
        24. lower-+.f6493.4

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
      3. Applied rewrites93.4%

        \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      4. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
        2. lift-/.f64N/A

          \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
        3. associate-*r/N/A

          \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
        4. lift-*.f64N/A

          \[\leadsto \frac{\frac{x}{y + x} \cdot y}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
        5. times-fracN/A

          \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
        6. lower-*.f64N/A

          \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
        7. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1}} \cdot \frac{y}{y + x} \]
        8. lower-/.f6499.8

          \[\leadsto \frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \color{blue}{\frac{y}{y + x}} \]
      5. Applied rewrites99.8%

        \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
      6. Taylor expanded in x around 0

        \[\leadsto \frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \color{blue}{1} \]
      7. Step-by-step derivation
        1. Applied rewrites51.1%

          \[\leadsto \frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \color{blue}{1} \]
      8. Recombined 4 regimes into one program.
      9. Add Preprocessing

      Alternative 16: 90.2% accurate, 0.8× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.95 \cdot 10^{-162}:\\ \;\;\;\;\frac{\frac{y}{x}}{\left(y + x\right) - -1}\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{-9}:\\ \;\;\;\;\frac{y}{\left(x - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)} \cdot x\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{+152}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(x, 2 + 3 \cdot y, y \cdot \left(1 + y\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{1 + y}\\ \end{array} \end{array} \]
      NOTE: x and y should be sorted in increasing order before calling this function.
      (FPCore (x y)
       :precision binary64
       (if (<= y 1.95e-162)
         (/ (/ y x) (- (+ y x) -1.0))
         (if (<= y 7.5e-9)
           (* (/ y (* (- x -1.0) (* (+ y x) (+ y x)))) x)
           (if (<= y 3.2e+152)
             (/ x (fma x (+ 2.0 (* 3.0 y)) (* y (+ 1.0 y))))
             (/ (/ x (+ y x)) (+ 1.0 y))))))
      assert(x < y);
      double code(double x, double y) {
      	double tmp;
      	if (y <= 1.95e-162) {
      		tmp = (y / x) / ((y + x) - -1.0);
      	} else if (y <= 7.5e-9) {
      		tmp = (y / ((x - -1.0) * ((y + x) * (y + x)))) * x;
      	} else if (y <= 3.2e+152) {
      		tmp = x / fma(x, (2.0 + (3.0 * y)), (y * (1.0 + y)));
      	} else {
      		tmp = (x / (y + x)) / (1.0 + y);
      	}
      	return tmp;
      }
      
      x, y = sort([x, y])
      function code(x, y)
      	tmp = 0.0
      	if (y <= 1.95e-162)
      		tmp = Float64(Float64(y / x) / Float64(Float64(y + x) - -1.0));
      	elseif (y <= 7.5e-9)
      		tmp = Float64(Float64(y / Float64(Float64(x - -1.0) * Float64(Float64(y + x) * Float64(y + x)))) * x);
      	elseif (y <= 3.2e+152)
      		tmp = Float64(x / fma(x, Float64(2.0 + Float64(3.0 * y)), Float64(y * Float64(1.0 + y))));
      	else
      		tmp = Float64(Float64(x / Float64(y + x)) / Float64(1.0 + y));
      	end
      	return tmp
      end
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      code[x_, y_] := If[LessEqual[y, 1.95e-162], N[(N[(y / x), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e-9], N[(N[(y / N[(N[(x - -1.0), $MachinePrecision] * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 3.2e+152], N[(x / N[(x * N[(2.0 + N[(3.0 * y), $MachinePrecision]), $MachinePrecision] + N[(y * N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]]]]
      
      \begin{array}{l}
      [x, y] = \mathsf{sort}([x, y])\\
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq 1.95 \cdot 10^{-162}:\\
      \;\;\;\;\frac{\frac{y}{x}}{\left(y + x\right) - -1}\\
      
      \mathbf{elif}\;y \leq 7.5 \cdot 10^{-9}:\\
      \;\;\;\;\frac{y}{\left(x - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)} \cdot x\\
      
      \mathbf{elif}\;y \leq 3.2 \cdot 10^{+152}:\\
      \;\;\;\;\frac{x}{\mathsf{fma}\left(x, 2 + 3 \cdot y, y \cdot \left(1 + y\right)\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\frac{x}{y + x}}{1 + y}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if y < 1.95e-162

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          3. 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. associate-*r/N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1}} \]
          6. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1}} \]
          7. lower-*.f64N/A

            \[\leadsto \frac{\color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}}{\left(x + y\right) + 1} \]
          8. lower-/.f6487.6

            \[\leadsto \frac{\color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \cdot y}{\left(x + y\right) + 1} \]
          9. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\color{blue}{\left(x + y\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
          10. +-commutativeN/A

            \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
          11. lower-+.f6487.6

            \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
          12. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + y\right)}} \cdot y}{\left(x + y\right) + 1} \]
          13. +-commutativeN/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot y}{\left(x + y\right) + 1} \]
          14. lower-+.f6487.6

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot y}{\left(x + y\right) + 1} \]
          15. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) + 1}} \]
          16. add-flipN/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
          17. lower--.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
          18. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
          19. +-commutativeN/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
          20. lower-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
          21. metadata-eval87.6

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\left(y + x\right) - \color{blue}{-1}} \]
        3. Applied rewrites87.6%

          \[\leadsto \color{blue}{\frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\left(y + x\right) - -1}} \]
        4. Taylor expanded in x around inf

          \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{\left(y + x\right) - -1} \]
        5. Step-by-step derivation
          1. lower-/.f6451.2

            \[\leadsto \frac{\frac{y}{\color{blue}{x}}}{\left(y + x\right) - -1} \]
        6. Applied rewrites51.2%

          \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{\left(y + x\right) - -1} \]

        if 1.95e-162 < y < 7.49999999999999933e-9

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Taylor expanded in y around 0

          \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(1 + x\right)}} \]
        3. Step-by-step derivation
          1. lower-+.f6458.5

            \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + \color{blue}{x}\right)} \]
        4. Applied rewrites58.5%

          \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(1 + x\right)}} \]
        5. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)} \]
          3. associate-/l*N/A

            \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)}} \]
          4. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)} \cdot x} \]
          5. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(1 + x\right)} \cdot x} \]
        6. Applied rewrites72.1%

          \[\leadsto \color{blue}{\frac{y}{\left(x - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)} \cdot x} \]

        if 7.49999999999999933e-9 < y < 3.20000000000000005e152

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          3. lift-*.f64N/A

            \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          4. lift-*.f64N/A

            \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
          5. associate-*l*N/A

            \[\leadsto \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)}} \]
          6. times-fracN/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          7. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          8. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          9. lift-+.f64N/A

            \[\leadsto \frac{x}{\color{blue}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          10. +-commutativeN/A

            \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          11. lower-+.f64N/A

            \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          12. lower-/.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          13. *-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
          14. lower-*.f6493.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
          15. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right)} \cdot \left(x + y\right)} \]
          16. add-flipN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
          17. lower--.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
          18. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          19. +-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          20. lower-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          21. metadata-eval93.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - \color{blue}{-1}\right) \cdot \left(x + y\right)} \]
          22. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(x + y\right)}} \]
          23. +-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
          24. lower-+.f6493.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
        3. Applied rewrites93.4%

          \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
        4. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          2. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)} \cdot \frac{x}{y + x}} \]
          3. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \cdot \frac{x}{y + x} \]
          4. lift-/.f64N/A

            \[\leadsto \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)} \cdot \color{blue}{\frac{x}{y + x}} \]
          5. frac-timesN/A

            \[\leadsto \color{blue}{\frac{y \cdot x}{\left(\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)\right) \cdot \left(y + x\right)}} \]
          6. lift-*.f64N/A

            \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)\right)} \cdot \left(y + x\right)} \]
          7. associate-*r*N/A

            \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
          8. lift-*.f64N/A

            \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
          9. lift-*.f64N/A

            \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
          10. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)} \cdot x} \]
          11. div-flipN/A

            \[\leadsto \color{blue}{\frac{1}{\frac{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}{y}}} \cdot x \]
          12. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{1 \cdot x}{\frac{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}{y}}} \]
          13. *-lft-identityN/A

            \[\leadsto \frac{\color{blue}{x}}{\frac{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}{y}} \]
          14. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{x}{\frac{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}{y}}} \]
        5. Applied rewrites84.7%

          \[\leadsto \color{blue}{\frac{x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \frac{\left(y + x\right) - -1}{y}}} \]
        6. Taylor expanded in x around 0

          \[\leadsto \frac{x}{\color{blue}{x \cdot \left(y + 2 \cdot \left(1 + y\right)\right) + y \cdot \left(1 + y\right)}} \]
        7. Step-by-step derivation
          1. lower-fma.f64N/A

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, \color{blue}{y + 2 \cdot \left(1 + y\right)}, y \cdot \left(1 + y\right)\right)} \]
          2. lower-+.f64N/A

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + \color{blue}{2 \cdot \left(1 + y\right)}, y \cdot \left(1 + y\right)\right)} \]
          3. lower-*.f64N/A

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + 2 \cdot \color{blue}{\left(1 + y\right)}, y \cdot \left(1 + y\right)\right)} \]
          4. lower-+.f64N/A

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + 2 \cdot \left(1 + \color{blue}{y}\right), y \cdot \left(1 + y\right)\right)} \]
          5. lower-*.f64N/A

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + 2 \cdot \left(1 + y\right), y \cdot \left(1 + y\right)\right)} \]
          6. lower-+.f6452.0

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + 2 \cdot \left(1 + y\right), y \cdot \left(1 + y\right)\right)} \]
        8. Applied rewrites52.0%

          \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(x, y + 2 \cdot \left(1 + y\right), y \cdot \left(1 + y\right)\right)}} \]
        9. Taylor expanded in y around 0

          \[\leadsto \frac{x}{\mathsf{fma}\left(x, 2 + \color{blue}{3 \cdot y}, y \cdot \left(1 + y\right)\right)} \]
        10. Step-by-step derivation
          1. lower-+.f64N/A

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, 2 + 3 \cdot \color{blue}{y}, y \cdot \left(1 + y\right)\right)} \]
          2. lower-*.f6452.0

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, 2 + 3 \cdot y, y \cdot \left(1 + y\right)\right)} \]
        11. Applied rewrites52.0%

          \[\leadsto \frac{x}{\mathsf{fma}\left(x, 2 + \color{blue}{3 \cdot y}, y \cdot \left(1 + y\right)\right)} \]

        if 3.20000000000000005e152 < y

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          3. lift-*.f64N/A

            \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          4. lift-*.f64N/A

            \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
          5. associate-*l*N/A

            \[\leadsto \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)}} \]
          6. times-fracN/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          7. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          8. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          9. lift-+.f64N/A

            \[\leadsto \frac{x}{\color{blue}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          10. +-commutativeN/A

            \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          11. lower-+.f64N/A

            \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          12. lower-/.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          13. *-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
          14. lower-*.f6493.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
          15. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right)} \cdot \left(x + y\right)} \]
          16. add-flipN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
          17. lower--.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
          18. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          19. +-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          20. lower-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          21. metadata-eval93.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - \color{blue}{-1}\right) \cdot \left(x + y\right)} \]
          22. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(x + y\right)}} \]
          23. +-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
          24. lower-+.f6493.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
        3. Applied rewrites93.4%

          \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
        4. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          2. lift-/.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          3. associate-*r/N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          4. lift-*.f64N/A

            \[\leadsto \frac{\frac{x}{y + x} \cdot y}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          5. times-fracN/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
          6. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
          7. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1}} \cdot \frac{y}{y + x} \]
          8. lower-/.f6499.8

            \[\leadsto \frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \color{blue}{\frac{y}{y + x}} \]
        5. Applied rewrites99.8%

          \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
        6. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
          2. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1}} \cdot \frac{y}{y + x} \]
          3. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot \frac{y}{y + x}}{\left(y + x\right) - -1}} \]
          4. lift-/.f64N/A

            \[\leadsto \frac{\color{blue}{\frac{x}{y + x}} \cdot \frac{y}{y + x}}{\left(y + x\right) - -1} \]
          5. lift-/.f64N/A

            \[\leadsto \frac{\frac{x}{y + x} \cdot \color{blue}{\frac{y}{y + x}}}{\left(y + x\right) - -1} \]
          6. frac-timesN/A

            \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{\left(y + x\right) \cdot \left(y + x\right)}}}{\left(y + x\right) - -1} \]
          7. lift-*.f64N/A

            \[\leadsto \frac{\frac{\color{blue}{x \cdot y}}{\left(y + x\right) \cdot \left(y + x\right)}}{\left(y + x\right) - -1} \]
          8. pow2N/A

            \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{{\left(y + x\right)}^{2}}}}{\left(y + x\right) - -1} \]
          9. lift-+.f64N/A

            \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(y + x\right)}}^{2}}}{\left(y + x\right) - -1} \]
          10. +-commutativeN/A

            \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(x + y\right)}}^{2}}}{\left(y + x\right) - -1} \]
          11. lift-+.f64N/A

            \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(x + y\right)}}^{2}}}{\left(y + x\right) - -1} \]
          12. pow2N/A

            \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right)}}}{\left(y + x\right) - -1} \]
          13. lift-*.f64N/A

            \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right)}}}{\left(y + x\right) - -1} \]
          14. associate-/l/N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(y + x\right) - -1\right)}} \]
          15. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(y + x\right) - -1\right)} \]
          16. frac-timesN/A

            \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(y + x\right) - -1}} \]
          17. div-flipN/A

            \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{1}{\frac{\left(y + x\right) - -1}{y}}} \]
          18. lift-/.f64N/A

            \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{1}{\color{blue}{\frac{\left(y + x\right) - -1}{y}}} \]
        7. Applied rewrites99.2%

          \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{\left(y + x\right) - -1}{y} \cdot \left(y + x\right)}} \]
        8. Taylor expanded in x around 0

          \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + y}} \]
        9. Step-by-step derivation
          1. lower-+.f6450.3

            \[\leadsto \frac{\frac{x}{y + x}}{1 + \color{blue}{y}} \]
        10. Applied rewrites50.3%

          \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + y}} \]
      3. Recombined 4 regimes into one program.
      4. Add Preprocessing

      Alternative 17: 83.4% accurate, 0.9× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 3.1 \cdot 10^{-50}:\\ \;\;\;\;\frac{\frac{y}{x}}{\left(y + x\right) - -1}\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{+152}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(x, 2 + 3 \cdot y, y \cdot \left(1 + y\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{1 + y}\\ \end{array} \end{array} \]
      NOTE: x and y should be sorted in increasing order before calling this function.
      (FPCore (x y)
       :precision binary64
       (if (<= y 3.1e-50)
         (/ (/ y x) (- (+ y x) -1.0))
         (if (<= y 3.2e+152)
           (/ x (fma x (+ 2.0 (* 3.0 y)) (* y (+ 1.0 y))))
           (/ (/ x (+ y x)) (+ 1.0 y)))))
      assert(x < y);
      double code(double x, double y) {
      	double tmp;
      	if (y <= 3.1e-50) {
      		tmp = (y / x) / ((y + x) - -1.0);
      	} else if (y <= 3.2e+152) {
      		tmp = x / fma(x, (2.0 + (3.0 * y)), (y * (1.0 + y)));
      	} else {
      		tmp = (x / (y + x)) / (1.0 + y);
      	}
      	return tmp;
      }
      
      x, y = sort([x, y])
      function code(x, y)
      	tmp = 0.0
      	if (y <= 3.1e-50)
      		tmp = Float64(Float64(y / x) / Float64(Float64(y + x) - -1.0));
      	elseif (y <= 3.2e+152)
      		tmp = Float64(x / fma(x, Float64(2.0 + Float64(3.0 * y)), Float64(y * Float64(1.0 + y))));
      	else
      		tmp = Float64(Float64(x / Float64(y + x)) / Float64(1.0 + y));
      	end
      	return tmp
      end
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      code[x_, y_] := If[LessEqual[y, 3.1e-50], N[(N[(y / x), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.2e+152], N[(x / N[(x * N[(2.0 + N[(3.0 * y), $MachinePrecision]), $MachinePrecision] + N[(y * N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]]]
      
      \begin{array}{l}
      [x, y] = \mathsf{sort}([x, y])\\
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq 3.1 \cdot 10^{-50}:\\
      \;\;\;\;\frac{\frac{y}{x}}{\left(y + x\right) - -1}\\
      
      \mathbf{elif}\;y \leq 3.2 \cdot 10^{+152}:\\
      \;\;\;\;\frac{x}{\mathsf{fma}\left(x, 2 + 3 \cdot y, y \cdot \left(1 + y\right)\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\frac{x}{y + x}}{1 + y}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if y < 3.1000000000000002e-50

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          3. 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. associate-*r/N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1}} \]
          6. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1}} \]
          7. lower-*.f64N/A

            \[\leadsto \frac{\color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}}{\left(x + y\right) + 1} \]
          8. lower-/.f6487.6

            \[\leadsto \frac{\color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \cdot y}{\left(x + y\right) + 1} \]
          9. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\color{blue}{\left(x + y\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
          10. +-commutativeN/A

            \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
          11. lower-+.f6487.6

            \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
          12. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + y\right)}} \cdot y}{\left(x + y\right) + 1} \]
          13. +-commutativeN/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot y}{\left(x + y\right) + 1} \]
          14. lower-+.f6487.6

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot y}{\left(x + y\right) + 1} \]
          15. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) + 1}} \]
          16. add-flipN/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
          17. lower--.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
          18. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
          19. +-commutativeN/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
          20. lower-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
          21. metadata-eval87.6

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\left(y + x\right) - \color{blue}{-1}} \]
        3. Applied rewrites87.6%

          \[\leadsto \color{blue}{\frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\left(y + x\right) - -1}} \]
        4. Taylor expanded in x around inf

          \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{\left(y + x\right) - -1} \]
        5. Step-by-step derivation
          1. lower-/.f6451.2

            \[\leadsto \frac{\frac{y}{\color{blue}{x}}}{\left(y + x\right) - -1} \]
        6. Applied rewrites51.2%

          \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{\left(y + x\right) - -1} \]

        if 3.1000000000000002e-50 < y < 3.20000000000000005e152

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          3. lift-*.f64N/A

            \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          4. lift-*.f64N/A

            \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
          5. associate-*l*N/A

            \[\leadsto \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)}} \]
          6. times-fracN/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          7. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          8. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          9. lift-+.f64N/A

            \[\leadsto \frac{x}{\color{blue}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          10. +-commutativeN/A

            \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          11. lower-+.f64N/A

            \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          12. lower-/.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          13. *-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
          14. lower-*.f6493.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
          15. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right)} \cdot \left(x + y\right)} \]
          16. add-flipN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
          17. lower--.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
          18. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          19. +-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          20. lower-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          21. metadata-eval93.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - \color{blue}{-1}\right) \cdot \left(x + y\right)} \]
          22. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(x + y\right)}} \]
          23. +-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
          24. lower-+.f6493.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
        3. Applied rewrites93.4%

          \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
        4. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          2. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)} \cdot \frac{x}{y + x}} \]
          3. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \cdot \frac{x}{y + x} \]
          4. lift-/.f64N/A

            \[\leadsto \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)} \cdot \color{blue}{\frac{x}{y + x}} \]
          5. frac-timesN/A

            \[\leadsto \color{blue}{\frac{y \cdot x}{\left(\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)\right) \cdot \left(y + x\right)}} \]
          6. lift-*.f64N/A

            \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)\right)} \cdot \left(y + x\right)} \]
          7. associate-*r*N/A

            \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
          8. lift-*.f64N/A

            \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
          9. lift-*.f64N/A

            \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
          10. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)} \cdot x} \]
          11. div-flipN/A

            \[\leadsto \color{blue}{\frac{1}{\frac{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}{y}}} \cdot x \]
          12. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{1 \cdot x}{\frac{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}{y}}} \]
          13. *-lft-identityN/A

            \[\leadsto \frac{\color{blue}{x}}{\frac{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}{y}} \]
          14. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{x}{\frac{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}{y}}} \]
        5. Applied rewrites84.7%

          \[\leadsto \color{blue}{\frac{x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \frac{\left(y + x\right) - -1}{y}}} \]
        6. Taylor expanded in x around 0

          \[\leadsto \frac{x}{\color{blue}{x \cdot \left(y + 2 \cdot \left(1 + y\right)\right) + y \cdot \left(1 + y\right)}} \]
        7. Step-by-step derivation
          1. lower-fma.f64N/A

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, \color{blue}{y + 2 \cdot \left(1 + y\right)}, y \cdot \left(1 + y\right)\right)} \]
          2. lower-+.f64N/A

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + \color{blue}{2 \cdot \left(1 + y\right)}, y \cdot \left(1 + y\right)\right)} \]
          3. lower-*.f64N/A

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + 2 \cdot \color{blue}{\left(1 + y\right)}, y \cdot \left(1 + y\right)\right)} \]
          4. lower-+.f64N/A

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + 2 \cdot \left(1 + \color{blue}{y}\right), y \cdot \left(1 + y\right)\right)} \]
          5. lower-*.f64N/A

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + 2 \cdot \left(1 + y\right), y \cdot \left(1 + y\right)\right)} \]
          6. lower-+.f6452.0

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + 2 \cdot \left(1 + y\right), y \cdot \left(1 + y\right)\right)} \]
        8. Applied rewrites52.0%

          \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(x, y + 2 \cdot \left(1 + y\right), y \cdot \left(1 + y\right)\right)}} \]
        9. Taylor expanded in y around 0

          \[\leadsto \frac{x}{\mathsf{fma}\left(x, 2 + \color{blue}{3 \cdot y}, y \cdot \left(1 + y\right)\right)} \]
        10. Step-by-step derivation
          1. lower-+.f64N/A

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, 2 + 3 \cdot \color{blue}{y}, y \cdot \left(1 + y\right)\right)} \]
          2. lower-*.f6452.0

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, 2 + 3 \cdot y, y \cdot \left(1 + y\right)\right)} \]
        11. Applied rewrites52.0%

          \[\leadsto \frac{x}{\mathsf{fma}\left(x, 2 + \color{blue}{3 \cdot y}, y \cdot \left(1 + y\right)\right)} \]

        if 3.20000000000000005e152 < y

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          3. lift-*.f64N/A

            \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          4. lift-*.f64N/A

            \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
          5. associate-*l*N/A

            \[\leadsto \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)}} \]
          6. times-fracN/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          7. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          8. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          9. lift-+.f64N/A

            \[\leadsto \frac{x}{\color{blue}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          10. +-commutativeN/A

            \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          11. lower-+.f64N/A

            \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          12. lower-/.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          13. *-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
          14. lower-*.f6493.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
          15. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right)} \cdot \left(x + y\right)} \]
          16. add-flipN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
          17. lower--.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
          18. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          19. +-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          20. lower-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          21. metadata-eval93.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - \color{blue}{-1}\right) \cdot \left(x + y\right)} \]
          22. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(x + y\right)}} \]
          23. +-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
          24. lower-+.f6493.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
        3. Applied rewrites93.4%

          \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
        4. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          2. lift-/.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          3. associate-*r/N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          4. lift-*.f64N/A

            \[\leadsto \frac{\frac{x}{y + x} \cdot y}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          5. times-fracN/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
          6. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
          7. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1}} \cdot \frac{y}{y + x} \]
          8. lower-/.f6499.8

            \[\leadsto \frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \color{blue}{\frac{y}{y + x}} \]
        5. Applied rewrites99.8%

          \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
        6. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
          2. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1}} \cdot \frac{y}{y + x} \]
          3. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot \frac{y}{y + x}}{\left(y + x\right) - -1}} \]
          4. lift-/.f64N/A

            \[\leadsto \frac{\color{blue}{\frac{x}{y + x}} \cdot \frac{y}{y + x}}{\left(y + x\right) - -1} \]
          5. lift-/.f64N/A

            \[\leadsto \frac{\frac{x}{y + x} \cdot \color{blue}{\frac{y}{y + x}}}{\left(y + x\right) - -1} \]
          6. frac-timesN/A

            \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{\left(y + x\right) \cdot \left(y + x\right)}}}{\left(y + x\right) - -1} \]
          7. lift-*.f64N/A

            \[\leadsto \frac{\frac{\color{blue}{x \cdot y}}{\left(y + x\right) \cdot \left(y + x\right)}}{\left(y + x\right) - -1} \]
          8. pow2N/A

            \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{{\left(y + x\right)}^{2}}}}{\left(y + x\right) - -1} \]
          9. lift-+.f64N/A

            \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(y + x\right)}}^{2}}}{\left(y + x\right) - -1} \]
          10. +-commutativeN/A

            \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(x + y\right)}}^{2}}}{\left(y + x\right) - -1} \]
          11. lift-+.f64N/A

            \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(x + y\right)}}^{2}}}{\left(y + x\right) - -1} \]
          12. pow2N/A

            \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right)}}}{\left(y + x\right) - -1} \]
          13. lift-*.f64N/A

            \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right)}}}{\left(y + x\right) - -1} \]
          14. associate-/l/N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(y + x\right) - -1\right)}} \]
          15. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(y + x\right) - -1\right)} \]
          16. frac-timesN/A

            \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(y + x\right) - -1}} \]
          17. div-flipN/A

            \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{1}{\frac{\left(y + x\right) - -1}{y}}} \]
          18. lift-/.f64N/A

            \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{1}{\color{blue}{\frac{\left(y + x\right) - -1}{y}}} \]
        7. Applied rewrites99.2%

          \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{\left(y + x\right) - -1}{y} \cdot \left(y + x\right)}} \]
        8. Taylor expanded in x around 0

          \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + y}} \]
        9. Step-by-step derivation
          1. lower-+.f6450.3

            \[\leadsto \frac{\frac{x}{y + x}}{1 + \color{blue}{y}} \]
        10. Applied rewrites50.3%

          \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + y}} \]
      3. Recombined 3 regimes into one program.
      4. Add Preprocessing

      Alternative 18: 83.3% accurate, 0.9× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 3.1 \cdot 10^{-50}:\\ \;\;\;\;\frac{\frac{y}{x}}{\left(y + x\right) - -1}\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{+152}:\\ \;\;\;\;\frac{x}{\mathsf{fma}\left(x, 3 \cdot y, y \cdot \left(1 + y\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{1 + y}\\ \end{array} \end{array} \]
      NOTE: x and y should be sorted in increasing order before calling this function.
      (FPCore (x y)
       :precision binary64
       (if (<= y 3.1e-50)
         (/ (/ y x) (- (+ y x) -1.0))
         (if (<= y 3.2e+152)
           (/ x (fma x (* 3.0 y) (* y (+ 1.0 y))))
           (/ (/ x (+ y x)) (+ 1.0 y)))))
      assert(x < y);
      double code(double x, double y) {
      	double tmp;
      	if (y <= 3.1e-50) {
      		tmp = (y / x) / ((y + x) - -1.0);
      	} else if (y <= 3.2e+152) {
      		tmp = x / fma(x, (3.0 * y), (y * (1.0 + y)));
      	} else {
      		tmp = (x / (y + x)) / (1.0 + y);
      	}
      	return tmp;
      }
      
      x, y = sort([x, y])
      function code(x, y)
      	tmp = 0.0
      	if (y <= 3.1e-50)
      		tmp = Float64(Float64(y / x) / Float64(Float64(y + x) - -1.0));
      	elseif (y <= 3.2e+152)
      		tmp = Float64(x / fma(x, Float64(3.0 * y), Float64(y * Float64(1.0 + y))));
      	else
      		tmp = Float64(Float64(x / Float64(y + x)) / Float64(1.0 + y));
      	end
      	return tmp
      end
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      code[x_, y_] := If[LessEqual[y, 3.1e-50], N[(N[(y / x), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.2e+152], N[(x / N[(x * N[(3.0 * y), $MachinePrecision] + N[(y * N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]]]
      
      \begin{array}{l}
      [x, y] = \mathsf{sort}([x, y])\\
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq 3.1 \cdot 10^{-50}:\\
      \;\;\;\;\frac{\frac{y}{x}}{\left(y + x\right) - -1}\\
      
      \mathbf{elif}\;y \leq 3.2 \cdot 10^{+152}:\\
      \;\;\;\;\frac{x}{\mathsf{fma}\left(x, 3 \cdot y, y \cdot \left(1 + y\right)\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\frac{x}{y + x}}{1 + y}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if y < 3.1000000000000002e-50

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          3. 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. associate-*r/N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1}} \]
          6. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1}} \]
          7. lower-*.f64N/A

            \[\leadsto \frac{\color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}}{\left(x + y\right) + 1} \]
          8. lower-/.f6487.6

            \[\leadsto \frac{\color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \cdot y}{\left(x + y\right) + 1} \]
          9. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\color{blue}{\left(x + y\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
          10. +-commutativeN/A

            \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
          11. lower-+.f6487.6

            \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
          12. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + y\right)}} \cdot y}{\left(x + y\right) + 1} \]
          13. +-commutativeN/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot y}{\left(x + y\right) + 1} \]
          14. lower-+.f6487.6

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot y}{\left(x + y\right) + 1} \]
          15. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) + 1}} \]
          16. add-flipN/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
          17. lower--.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
          18. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
          19. +-commutativeN/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
          20. lower-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
          21. metadata-eval87.6

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\left(y + x\right) - \color{blue}{-1}} \]
        3. Applied rewrites87.6%

          \[\leadsto \color{blue}{\frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\left(y + x\right) - -1}} \]
        4. Taylor expanded in x around inf

          \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{\left(y + x\right) - -1} \]
        5. Step-by-step derivation
          1. lower-/.f6451.2

            \[\leadsto \frac{\frac{y}{\color{blue}{x}}}{\left(y + x\right) - -1} \]
        6. Applied rewrites51.2%

          \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{\left(y + x\right) - -1} \]

        if 3.1000000000000002e-50 < y < 3.20000000000000005e152

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          3. lift-*.f64N/A

            \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          4. lift-*.f64N/A

            \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
          5. associate-*l*N/A

            \[\leadsto \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)}} \]
          6. times-fracN/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          7. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          8. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          9. lift-+.f64N/A

            \[\leadsto \frac{x}{\color{blue}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          10. +-commutativeN/A

            \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          11. lower-+.f64N/A

            \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          12. lower-/.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          13. *-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
          14. lower-*.f6493.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
          15. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right)} \cdot \left(x + y\right)} \]
          16. add-flipN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
          17. lower--.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
          18. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          19. +-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          20. lower-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          21. metadata-eval93.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - \color{blue}{-1}\right) \cdot \left(x + y\right)} \]
          22. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(x + y\right)}} \]
          23. +-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
          24. lower-+.f6493.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
        3. Applied rewrites93.4%

          \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
        4. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          2. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)} \cdot \frac{x}{y + x}} \]
          3. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \cdot \frac{x}{y + x} \]
          4. lift-/.f64N/A

            \[\leadsto \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)} \cdot \color{blue}{\frac{x}{y + x}} \]
          5. frac-timesN/A

            \[\leadsto \color{blue}{\frac{y \cdot x}{\left(\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)\right) \cdot \left(y + x\right)}} \]
          6. lift-*.f64N/A

            \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)\right)} \cdot \left(y + x\right)} \]
          7. associate-*r*N/A

            \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
          8. lift-*.f64N/A

            \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
          9. lift-*.f64N/A

            \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
          10. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)} \cdot x} \]
          11. div-flipN/A

            \[\leadsto \color{blue}{\frac{1}{\frac{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}{y}}} \cdot x \]
          12. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{1 \cdot x}{\frac{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}{y}}} \]
          13. *-lft-identityN/A

            \[\leadsto \frac{\color{blue}{x}}{\frac{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}{y}} \]
          14. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{x}{\frac{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}{y}}} \]
        5. Applied rewrites84.7%

          \[\leadsto \color{blue}{\frac{x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \frac{\left(y + x\right) - -1}{y}}} \]
        6. Taylor expanded in x around 0

          \[\leadsto \frac{x}{\color{blue}{x \cdot \left(y + 2 \cdot \left(1 + y\right)\right) + y \cdot \left(1 + y\right)}} \]
        7. Step-by-step derivation
          1. lower-fma.f64N/A

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, \color{blue}{y + 2 \cdot \left(1 + y\right)}, y \cdot \left(1 + y\right)\right)} \]
          2. lower-+.f64N/A

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + \color{blue}{2 \cdot \left(1 + y\right)}, y \cdot \left(1 + y\right)\right)} \]
          3. lower-*.f64N/A

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + 2 \cdot \color{blue}{\left(1 + y\right)}, y \cdot \left(1 + y\right)\right)} \]
          4. lower-+.f64N/A

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + 2 \cdot \left(1 + \color{blue}{y}\right), y \cdot \left(1 + y\right)\right)} \]
          5. lower-*.f64N/A

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + 2 \cdot \left(1 + y\right), y \cdot \left(1 + y\right)\right)} \]
          6. lower-+.f6452.0

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + 2 \cdot \left(1 + y\right), y \cdot \left(1 + y\right)\right)} \]
        8. Applied rewrites52.0%

          \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(x, y + 2 \cdot \left(1 + y\right), y \cdot \left(1 + y\right)\right)}} \]
        9. Taylor expanded in y around inf

          \[\leadsto \frac{x}{\mathsf{fma}\left(x, 3 \cdot \color{blue}{y}, y \cdot \left(1 + y\right)\right)} \]
        10. Step-by-step derivation
          1. lower-*.f6451.6

            \[\leadsto \frac{x}{\mathsf{fma}\left(x, 3 \cdot y, y \cdot \left(1 + y\right)\right)} \]
        11. Applied rewrites51.6%

          \[\leadsto \frac{x}{\mathsf{fma}\left(x, 3 \cdot \color{blue}{y}, y \cdot \left(1 + y\right)\right)} \]

        if 3.20000000000000005e152 < y

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          3. lift-*.f64N/A

            \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          4. lift-*.f64N/A

            \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
          5. associate-*l*N/A

            \[\leadsto \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)}} \]
          6. times-fracN/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          7. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          8. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          9. lift-+.f64N/A

            \[\leadsto \frac{x}{\color{blue}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          10. +-commutativeN/A

            \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          11. lower-+.f64N/A

            \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          12. lower-/.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          13. *-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
          14. lower-*.f6493.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
          15. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right)} \cdot \left(x + y\right)} \]
          16. add-flipN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
          17. lower--.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
          18. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          19. +-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          20. lower-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          21. metadata-eval93.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - \color{blue}{-1}\right) \cdot \left(x + y\right)} \]
          22. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(x + y\right)}} \]
          23. +-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
          24. lower-+.f6493.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
        3. Applied rewrites93.4%

          \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
        4. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          2. lift-/.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          3. associate-*r/N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          4. lift-*.f64N/A

            \[\leadsto \frac{\frac{x}{y + x} \cdot y}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          5. times-fracN/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
          6. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
          7. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1}} \cdot \frac{y}{y + x} \]
          8. lower-/.f6499.8

            \[\leadsto \frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \color{blue}{\frac{y}{y + x}} \]
        5. Applied rewrites99.8%

          \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
        6. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
          2. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1}} \cdot \frac{y}{y + x} \]
          3. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot \frac{y}{y + x}}{\left(y + x\right) - -1}} \]
          4. lift-/.f64N/A

            \[\leadsto \frac{\color{blue}{\frac{x}{y + x}} \cdot \frac{y}{y + x}}{\left(y + x\right) - -1} \]
          5. lift-/.f64N/A

            \[\leadsto \frac{\frac{x}{y + x} \cdot \color{blue}{\frac{y}{y + x}}}{\left(y + x\right) - -1} \]
          6. frac-timesN/A

            \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{\left(y + x\right) \cdot \left(y + x\right)}}}{\left(y + x\right) - -1} \]
          7. lift-*.f64N/A

            \[\leadsto \frac{\frac{\color{blue}{x \cdot y}}{\left(y + x\right) \cdot \left(y + x\right)}}{\left(y + x\right) - -1} \]
          8. pow2N/A

            \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{{\left(y + x\right)}^{2}}}}{\left(y + x\right) - -1} \]
          9. lift-+.f64N/A

            \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(y + x\right)}}^{2}}}{\left(y + x\right) - -1} \]
          10. +-commutativeN/A

            \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(x + y\right)}}^{2}}}{\left(y + x\right) - -1} \]
          11. lift-+.f64N/A

            \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(x + y\right)}}^{2}}}{\left(y + x\right) - -1} \]
          12. pow2N/A

            \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right)}}}{\left(y + x\right) - -1} \]
          13. lift-*.f64N/A

            \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right)}}}{\left(y + x\right) - -1} \]
          14. associate-/l/N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(y + x\right) - -1\right)}} \]
          15. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(y + x\right) - -1\right)} \]
          16. frac-timesN/A

            \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(y + x\right) - -1}} \]
          17. div-flipN/A

            \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{1}{\frac{\left(y + x\right) - -1}{y}}} \]
          18. lift-/.f64N/A

            \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{1}{\color{blue}{\frac{\left(y + x\right) - -1}{y}}} \]
        7. Applied rewrites99.2%

          \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{\left(y + x\right) - -1}{y} \cdot \left(y + x\right)}} \]
        8. Taylor expanded in x around 0

          \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + y}} \]
        9. Step-by-step derivation
          1. lower-+.f6450.3

            \[\leadsto \frac{\frac{x}{y + x}}{1 + \color{blue}{y}} \]
        10. Applied rewrites50.3%

          \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + y}} \]
      3. Recombined 3 regimes into one program.
      4. Add Preprocessing

      Alternative 19: 81.6% accurate, 1.4× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 3.1 \cdot 10^{-50}:\\ \;\;\;\;\frac{\frac{y}{x}}{\left(y + x\right) - -1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{1 + y}\\ \end{array} \end{array} \]
      NOTE: x and y should be sorted in increasing order before calling this function.
      (FPCore (x y)
       :precision binary64
       (if (<= y 3.1e-50) (/ (/ y x) (- (+ y x) -1.0)) (/ (/ x (+ y x)) (+ 1.0 y))))
      assert(x < y);
      double code(double x, double y) {
      	double tmp;
      	if (y <= 3.1e-50) {
      		tmp = (y / x) / ((y + x) - -1.0);
      	} else {
      		tmp = (x / (y + x)) / (1.0 + y);
      	}
      	return tmp;
      }
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(x, y)
      use fmin_fmax_functions
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8) :: tmp
          if (y <= 3.1d-50) then
              tmp = (y / x) / ((y + x) - (-1.0d0))
          else
              tmp = (x / (y + x)) / (1.0d0 + y)
          end if
          code = tmp
      end function
      
      assert x < y;
      public static double code(double x, double y) {
      	double tmp;
      	if (y <= 3.1e-50) {
      		tmp = (y / x) / ((y + x) - -1.0);
      	} else {
      		tmp = (x / (y + x)) / (1.0 + y);
      	}
      	return tmp;
      }
      
      [x, y] = sort([x, y])
      def code(x, y):
      	tmp = 0
      	if y <= 3.1e-50:
      		tmp = (y / x) / ((y + x) - -1.0)
      	else:
      		tmp = (x / (y + x)) / (1.0 + y)
      	return tmp
      
      x, y = sort([x, y])
      function code(x, y)
      	tmp = 0.0
      	if (y <= 3.1e-50)
      		tmp = Float64(Float64(y / x) / Float64(Float64(y + x) - -1.0));
      	else
      		tmp = Float64(Float64(x / Float64(y + x)) / Float64(1.0 + y));
      	end
      	return tmp
      end
      
      x, y = num2cell(sort([x, y])){:}
      function tmp_2 = code(x, y)
      	tmp = 0.0;
      	if (y <= 3.1e-50)
      		tmp = (y / x) / ((y + x) - -1.0);
      	else
      		tmp = (x / (y + x)) / (1.0 + y);
      	end
      	tmp_2 = tmp;
      end
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      code[x_, y_] := If[LessEqual[y, 3.1e-50], N[(N[(y / x), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      [x, y] = \mathsf{sort}([x, y])\\
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq 3.1 \cdot 10^{-50}:\\
      \;\;\;\;\frac{\frac{y}{x}}{\left(y + x\right) - -1}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\frac{x}{y + x}}{1 + y}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < 3.1000000000000002e-50

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          3. 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. associate-*r/N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1}} \]
          6. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1}} \]
          7. lower-*.f64N/A

            \[\leadsto \frac{\color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}}{\left(x + y\right) + 1} \]
          8. lower-/.f6487.6

            \[\leadsto \frac{\color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \cdot y}{\left(x + y\right) + 1} \]
          9. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\color{blue}{\left(x + y\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
          10. +-commutativeN/A

            \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
          11. lower-+.f6487.6

            \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
          12. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + y\right)}} \cdot y}{\left(x + y\right) + 1} \]
          13. +-commutativeN/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot y}{\left(x + y\right) + 1} \]
          14. lower-+.f6487.6

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot y}{\left(x + y\right) + 1} \]
          15. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) + 1}} \]
          16. add-flipN/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
          17. lower--.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
          18. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
          19. +-commutativeN/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
          20. lower-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
          21. metadata-eval87.6

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\left(y + x\right) - \color{blue}{-1}} \]
        3. Applied rewrites87.6%

          \[\leadsto \color{blue}{\frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\left(y + x\right) - -1}} \]
        4. Taylor expanded in x around inf

          \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{\left(y + x\right) - -1} \]
        5. Step-by-step derivation
          1. lower-/.f6451.2

            \[\leadsto \frac{\frac{y}{\color{blue}{x}}}{\left(y + x\right) - -1} \]
        6. Applied rewrites51.2%

          \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{\left(y + x\right) - -1} \]

        if 3.1000000000000002e-50 < y

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          3. lift-*.f64N/A

            \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          4. lift-*.f64N/A

            \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
          5. associate-*l*N/A

            \[\leadsto \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)}} \]
          6. times-fracN/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          7. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          8. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          9. lift-+.f64N/A

            \[\leadsto \frac{x}{\color{blue}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          10. +-commutativeN/A

            \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          11. lower-+.f64N/A

            \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          12. lower-/.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          13. *-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
          14. lower-*.f6493.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
          15. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right)} \cdot \left(x + y\right)} \]
          16. add-flipN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
          17. lower--.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
          18. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          19. +-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          20. lower-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
          21. metadata-eval93.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - \color{blue}{-1}\right) \cdot \left(x + y\right)} \]
          22. lift-+.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(x + y\right)}} \]
          23. +-commutativeN/A

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
          24. lower-+.f6493.4

            \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
        3. Applied rewrites93.4%

          \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
        4. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          2. lift-/.f64N/A

            \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          3. associate-*r/N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          4. lift-*.f64N/A

            \[\leadsto \frac{\frac{x}{y + x} \cdot y}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
          5. times-fracN/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
          6. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
          7. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1}} \cdot \frac{y}{y + x} \]
          8. lower-/.f6499.8

            \[\leadsto \frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \color{blue}{\frac{y}{y + x}} \]
        5. Applied rewrites99.8%

          \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
        6. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1} \cdot \frac{y}{y + x}} \]
          2. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\left(y + x\right) - -1}} \cdot \frac{y}{y + x} \]
          3. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{y + x} \cdot \frac{y}{y + x}}{\left(y + x\right) - -1}} \]
          4. lift-/.f64N/A

            \[\leadsto \frac{\color{blue}{\frac{x}{y + x}} \cdot \frac{y}{y + x}}{\left(y + x\right) - -1} \]
          5. lift-/.f64N/A

            \[\leadsto \frac{\frac{x}{y + x} \cdot \color{blue}{\frac{y}{y + x}}}{\left(y + x\right) - -1} \]
          6. frac-timesN/A

            \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{\left(y + x\right) \cdot \left(y + x\right)}}}{\left(y + x\right) - -1} \]
          7. lift-*.f64N/A

            \[\leadsto \frac{\frac{\color{blue}{x \cdot y}}{\left(y + x\right) \cdot \left(y + x\right)}}{\left(y + x\right) - -1} \]
          8. pow2N/A

            \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{{\left(y + x\right)}^{2}}}}{\left(y + x\right) - -1} \]
          9. lift-+.f64N/A

            \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(y + x\right)}}^{2}}}{\left(y + x\right) - -1} \]
          10. +-commutativeN/A

            \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(x + y\right)}}^{2}}}{\left(y + x\right) - -1} \]
          11. lift-+.f64N/A

            \[\leadsto \frac{\frac{x \cdot y}{{\color{blue}{\left(x + y\right)}}^{2}}}{\left(y + x\right) - -1} \]
          12. pow2N/A

            \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right)}}}{\left(y + x\right) - -1} \]
          13. lift-*.f64N/A

            \[\leadsto \frac{\frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right)}}}{\left(y + x\right) - -1} \]
          14. associate-/l/N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(y + x\right) - -1\right)}} \]
          15. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(y + x\right) - -1\right)} \]
          16. frac-timesN/A

            \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(y + x\right) - -1}} \]
          17. div-flipN/A

            \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{1}{\frac{\left(y + x\right) - -1}{y}}} \]
          18. lift-/.f64N/A

            \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{1}{\color{blue}{\frac{\left(y + x\right) - -1}{y}}} \]
        7. Applied rewrites99.2%

          \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{\left(y + x\right) - -1}{y} \cdot \left(y + x\right)}} \]
        8. Taylor expanded in x around 0

          \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + y}} \]
        9. Step-by-step derivation
          1. lower-+.f6450.3

            \[\leadsto \frac{\frac{x}{y + x}}{1 + \color{blue}{y}} \]
        10. Applied rewrites50.3%

          \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + y}} \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 20: 81.4% accurate, 1.4× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 3.2 \cdot 10^{-50}:\\ \;\;\;\;\frac{\frac{y}{x}}{\left(y + x\right) - -1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - -1}}{y}\\ \end{array} \end{array} \]
      NOTE: x and y should be sorted in increasing order before calling this function.
      (FPCore (x y)
       :precision binary64
       (if (<= y 3.2e-50) (/ (/ y x) (- (+ y x) -1.0)) (/ (/ x (- y -1.0)) y)))
      assert(x < y);
      double code(double x, double y) {
      	double tmp;
      	if (y <= 3.2e-50) {
      		tmp = (y / x) / ((y + x) - -1.0);
      	} else {
      		tmp = (x / (y - -1.0)) / y;
      	}
      	return tmp;
      }
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(x, y)
      use fmin_fmax_functions
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8) :: tmp
          if (y <= 3.2d-50) then
              tmp = (y / x) / ((y + x) - (-1.0d0))
          else
              tmp = (x / (y - (-1.0d0))) / y
          end if
          code = tmp
      end function
      
      assert x < y;
      public static double code(double x, double y) {
      	double tmp;
      	if (y <= 3.2e-50) {
      		tmp = (y / x) / ((y + x) - -1.0);
      	} else {
      		tmp = (x / (y - -1.0)) / y;
      	}
      	return tmp;
      }
      
      [x, y] = sort([x, y])
      def code(x, y):
      	tmp = 0
      	if y <= 3.2e-50:
      		tmp = (y / x) / ((y + x) - -1.0)
      	else:
      		tmp = (x / (y - -1.0)) / y
      	return tmp
      
      x, y = sort([x, y])
      function code(x, y)
      	tmp = 0.0
      	if (y <= 3.2e-50)
      		tmp = Float64(Float64(y / x) / Float64(Float64(y + x) - -1.0));
      	else
      		tmp = Float64(Float64(x / Float64(y - -1.0)) / y);
      	end
      	return tmp
      end
      
      x, y = num2cell(sort([x, y])){:}
      function tmp_2 = code(x, y)
      	tmp = 0.0;
      	if (y <= 3.2e-50)
      		tmp = (y / x) / ((y + x) - -1.0);
      	else
      		tmp = (x / (y - -1.0)) / y;
      	end
      	tmp_2 = tmp;
      end
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      code[x_, y_] := If[LessEqual[y, 3.2e-50], N[(N[(y / x), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y - -1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
      
      \begin{array}{l}
      [x, y] = \mathsf{sort}([x, y])\\
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq 3.2 \cdot 10^{-50}:\\
      \;\;\;\;\frac{\frac{y}{x}}{\left(y + x\right) - -1}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\frac{x}{y - -1}}{y}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < 3.2e-50

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          3. 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. associate-*r/N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1}} \]
          6. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1}} \]
          7. lower-*.f64N/A

            \[\leadsto \frac{\color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}}{\left(x + y\right) + 1} \]
          8. lower-/.f6487.6

            \[\leadsto \frac{\color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \cdot y}{\left(x + y\right) + 1} \]
          9. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\color{blue}{\left(x + y\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
          10. +-commutativeN/A

            \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
          11. lower-+.f6487.6

            \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1} \]
          12. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + y\right)}} \cdot y}{\left(x + y\right) + 1} \]
          13. +-commutativeN/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot y}{\left(x + y\right) + 1} \]
          14. lower-+.f6487.6

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot y}{\left(x + y\right) + 1} \]
          15. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) + 1}} \]
          16. add-flipN/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
          17. lower--.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)}} \]
          18. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
          19. +-commutativeN/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
          20. lower-+.f64N/A

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)} \]
          21. metadata-eval87.6

            \[\leadsto \frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\left(y + x\right) - \color{blue}{-1}} \]
        3. Applied rewrites87.6%

          \[\leadsto \color{blue}{\frac{\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot y}{\left(y + x\right) - -1}} \]
        4. Taylor expanded in x around inf

          \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{\left(y + x\right) - -1} \]
        5. Step-by-step derivation
          1. lower-/.f6451.2

            \[\leadsto \frac{\frac{y}{\color{blue}{x}}}{\left(y + x\right) - -1} \]
        6. Applied rewrites51.2%

          \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{\left(y + x\right) - -1} \]

        if 3.2e-50 < y

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Taylor expanded in x around 0

          \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
        3. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{x}{\color{blue}{y \cdot \left(1 + y\right)}} \]
          2. lower-*.f64N/A

            \[\leadsto \frac{x}{y \cdot \color{blue}{\left(1 + y\right)}} \]
          3. lower-+.f6448.4

            \[\leadsto \frac{x}{y \cdot \left(1 + \color{blue}{y}\right)} \]
        4. Applied rewrites48.4%

          \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
        5. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \frac{x}{\color{blue}{y \cdot \left(1 + y\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{x}{y \cdot \color{blue}{\left(1 + y\right)}} \]
          3. *-commutativeN/A

            \[\leadsto \frac{x}{\left(1 + y\right) \cdot \color{blue}{y}} \]
          4. associate-/r*N/A

            \[\leadsto \frac{\frac{x}{1 + y}}{\color{blue}{y}} \]
          5. lower-/.f64N/A

            \[\leadsto \frac{\frac{x}{1 + y}}{\color{blue}{y}} \]
          6. lower-/.f6449.8

            \[\leadsto \frac{\frac{x}{1 + y}}{y} \]
          7. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{1 + y}}{y} \]
          8. +-commutativeN/A

            \[\leadsto \frac{\frac{x}{y + 1}}{y} \]
          9. add-flipN/A

            \[\leadsto \frac{\frac{x}{y - \left(\mathsf{neg}\left(1\right)\right)}}{y} \]
          10. metadata-evalN/A

            \[\leadsto \frac{\frac{x}{y - -1}}{y} \]
          11. lower--.f6449.8

            \[\leadsto \frac{\frac{x}{y - -1}}{y} \]
        6. Applied rewrites49.8%

          \[\leadsto \frac{\frac{x}{y - -1}}{\color{blue}{y}} \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 21: 79.8% accurate, 1.7× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 3.2 \cdot 10^{-50}:\\ \;\;\;\;\frac{y}{x \cdot \left(1 + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - -1}}{y}\\ \end{array} \end{array} \]
      NOTE: x and y should be sorted in increasing order before calling this function.
      (FPCore (x y)
       :precision binary64
       (if (<= y 3.2e-50) (/ y (* x (+ 1.0 x))) (/ (/ x (- y -1.0)) y)))
      assert(x < y);
      double code(double x, double y) {
      	double tmp;
      	if (y <= 3.2e-50) {
      		tmp = y / (x * (1.0 + x));
      	} else {
      		tmp = (x / (y - -1.0)) / y;
      	}
      	return tmp;
      }
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(x, y)
      use fmin_fmax_functions
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8) :: tmp
          if (y <= 3.2d-50) then
              tmp = y / (x * (1.0d0 + x))
          else
              tmp = (x / (y - (-1.0d0))) / y
          end if
          code = tmp
      end function
      
      assert x < y;
      public static double code(double x, double y) {
      	double tmp;
      	if (y <= 3.2e-50) {
      		tmp = y / (x * (1.0 + x));
      	} else {
      		tmp = (x / (y - -1.0)) / y;
      	}
      	return tmp;
      }
      
      [x, y] = sort([x, y])
      def code(x, y):
      	tmp = 0
      	if y <= 3.2e-50:
      		tmp = y / (x * (1.0 + x))
      	else:
      		tmp = (x / (y - -1.0)) / y
      	return tmp
      
      x, y = sort([x, y])
      function code(x, y)
      	tmp = 0.0
      	if (y <= 3.2e-50)
      		tmp = Float64(y / Float64(x * Float64(1.0 + x)));
      	else
      		tmp = Float64(Float64(x / Float64(y - -1.0)) / y);
      	end
      	return tmp
      end
      
      x, y = num2cell(sort([x, y])){:}
      function tmp_2 = code(x, y)
      	tmp = 0.0;
      	if (y <= 3.2e-50)
      		tmp = y / (x * (1.0 + x));
      	else
      		tmp = (x / (y - -1.0)) / y;
      	end
      	tmp_2 = tmp;
      end
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      code[x_, y_] := If[LessEqual[y, 3.2e-50], N[(y / N[(x * N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y - -1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
      
      \begin{array}{l}
      [x, y] = \mathsf{sort}([x, y])\\
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq 3.2 \cdot 10^{-50}:\\
      \;\;\;\;\frac{y}{x \cdot \left(1 + x\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\frac{x}{y - -1}}{y}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < 3.2e-50

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Taylor expanded in y around 0

          \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
        3. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{y}{\color{blue}{x \cdot \left(1 + x\right)}} \]
          2. lower-*.f64N/A

            \[\leadsto \frac{y}{x \cdot \color{blue}{\left(1 + x\right)}} \]
          3. lower-+.f6449.4

            \[\leadsto \frac{y}{x \cdot \left(1 + \color{blue}{x}\right)} \]
        4. Applied rewrites49.4%

          \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]

        if 3.2e-50 < y

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Taylor expanded in x around 0

          \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
        3. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{x}{\color{blue}{y \cdot \left(1 + y\right)}} \]
          2. lower-*.f64N/A

            \[\leadsto \frac{x}{y \cdot \color{blue}{\left(1 + y\right)}} \]
          3. lower-+.f6448.4

            \[\leadsto \frac{x}{y \cdot \left(1 + \color{blue}{y}\right)} \]
        4. Applied rewrites48.4%

          \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
        5. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \frac{x}{\color{blue}{y \cdot \left(1 + y\right)}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{x}{y \cdot \color{blue}{\left(1 + y\right)}} \]
          3. *-commutativeN/A

            \[\leadsto \frac{x}{\left(1 + y\right) \cdot \color{blue}{y}} \]
          4. associate-/r*N/A

            \[\leadsto \frac{\frac{x}{1 + y}}{\color{blue}{y}} \]
          5. lower-/.f64N/A

            \[\leadsto \frac{\frac{x}{1 + y}}{\color{blue}{y}} \]
          6. lower-/.f6449.8

            \[\leadsto \frac{\frac{x}{1 + y}}{y} \]
          7. lift-+.f64N/A

            \[\leadsto \frac{\frac{x}{1 + y}}{y} \]
          8. +-commutativeN/A

            \[\leadsto \frac{\frac{x}{y + 1}}{y} \]
          9. add-flipN/A

            \[\leadsto \frac{\frac{x}{y - \left(\mathsf{neg}\left(1\right)\right)}}{y} \]
          10. metadata-evalN/A

            \[\leadsto \frac{\frac{x}{y - -1}}{y} \]
          11. lower--.f6449.8

            \[\leadsto \frac{\frac{x}{y - -1}}{y} \]
        6. Applied rewrites49.8%

          \[\leadsto \frac{\frac{x}{y - -1}}{\color{blue}{y}} \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 22: 78.5% accurate, 1.7× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{-149}:\\ \;\;\;\;\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-149) (/ 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-149) {
      		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-149)
      		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-149], 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^{-149}:\\
      \;\;\;\;\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.8000000000000001e-149

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Taylor expanded in y around 0

          \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
        3. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{y}{\color{blue}{x \cdot \left(1 + x\right)}} \]
          2. lower-*.f64N/A

            \[\leadsto \frac{y}{x \cdot \color{blue}{\left(1 + x\right)}} \]
          3. lower-+.f6449.4

            \[\leadsto \frac{y}{x \cdot \left(1 + \color{blue}{x}\right)} \]
        4. Applied rewrites49.4%

          \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]

        if -1.8000000000000001e-149 < x

        1. Initial program 68.5%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Taylor expanded in x around 0

          \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
        3. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \frac{x}{\color{blue}{y \cdot \left(1 + y\right)}} \]
          2. lower-*.f64N/A

            \[\leadsto \frac{x}{y \cdot \color{blue}{\left(1 + y\right)}} \]
          3. lower-+.f6448.4

            \[\leadsto \frac{x}{y \cdot \left(1 + \color{blue}{y}\right)} \]
        4. Applied rewrites48.4%

          \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
        5. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \frac{x}{y \cdot \color{blue}{\left(1 + y\right)}} \]
          2. lift-+.f64N/A

            \[\leadsto \frac{x}{y \cdot \left(1 + \color{blue}{y}\right)} \]
          3. +-commutativeN/A

            \[\leadsto \frac{x}{y \cdot \left(y + \color{blue}{1}\right)} \]
          4. distribute-rgt-inN/A

            \[\leadsto \frac{x}{y \cdot y + \color{blue}{1 \cdot y}} \]
          5. *-lft-identityN/A

            \[\leadsto \frac{x}{y \cdot y + y} \]
          6. lower-fma.f6448.4

            \[\leadsto \frac{x}{\mathsf{fma}\left(y, \color{blue}{y}, y\right)} \]
        6. Applied rewrites48.4%

          \[\leadsto \color{blue}{\frac{x}{\mathsf{fma}\left(y, y, y\right)}} \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 23: 48.4% accurate, 2.6× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{x}{\mathsf{fma}\left(y, y, y\right)} \end{array} \]
      NOTE: x and y should be sorted in increasing order before calling this function.
      (FPCore (x y) :precision binary64 (/ x (fma y y y)))
      assert(x < y);
      double code(double x, double y) {
      	return x / fma(y, y, y);
      }
      
      x, y = sort([x, y])
      function code(x, y)
      	return Float64(x / fma(y, y, y))
      end
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      code[x_, y_] := N[(x / N[(y * y + y), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      [x, y] = \mathsf{sort}([x, y])\\
      \\
      \frac{x}{\mathsf{fma}\left(y, y, y\right)}
      \end{array}
      
      Derivation
      1. Initial program 68.5%

        \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. Taylor expanded in x around 0

        \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
      3. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \frac{x}{\color{blue}{y \cdot \left(1 + y\right)}} \]
        2. lower-*.f64N/A

          \[\leadsto \frac{x}{y \cdot \color{blue}{\left(1 + y\right)}} \]
        3. lower-+.f6448.4

          \[\leadsto \frac{x}{y \cdot \left(1 + \color{blue}{y}\right)} \]
      4. Applied rewrites48.4%

        \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
      5. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \frac{x}{y \cdot \color{blue}{\left(1 + y\right)}} \]
        2. lift-+.f64N/A

          \[\leadsto \frac{x}{y \cdot \left(1 + \color{blue}{y}\right)} \]
        3. +-commutativeN/A

          \[\leadsto \frac{x}{y \cdot \left(y + \color{blue}{1}\right)} \]
        4. distribute-rgt-inN/A

          \[\leadsto \frac{x}{y \cdot y + \color{blue}{1 \cdot y}} \]
        5. *-lft-identityN/A

          \[\leadsto \frac{x}{y \cdot y + y} \]
        6. lower-fma.f6448.4

          \[\leadsto \frac{x}{\mathsf{fma}\left(y, \color{blue}{y}, y\right)} \]
      6. Applied rewrites48.4%

        \[\leadsto \color{blue}{\frac{x}{\mathsf{fma}\left(y, y, y\right)}} \]
      7. Add Preprocessing

      Alternative 24: 3.5% accurate, 3.3× speedup?

      \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{x}{2 \cdot x} \end{array} \]
      NOTE: x and y should be sorted in increasing order before calling this function.
      (FPCore (x y) :precision binary64 (/ x (* 2.0 x)))
      assert(x < y);
      double code(double x, double y) {
      	return x / (2.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 / (2.0d0 * x)
      end function
      
      assert x < y;
      public static double code(double x, double y) {
      	return x / (2.0 * x);
      }
      
      [x, y] = sort([x, y])
      def code(x, y):
      	return x / (2.0 * x)
      
      x, y = sort([x, y])
      function code(x, y)
      	return Float64(x / Float64(2.0 * x))
      end
      
      x, y = num2cell(sort([x, y])){:}
      function tmp = code(x, y)
      	tmp = x / (2.0 * x);
      end
      
      NOTE: x and y should be sorted in increasing order before calling this function.
      code[x_, y_] := N[(x / N[(2.0 * x), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      [x, y] = \mathsf{sort}([x, y])\\
      \\
      \frac{x}{2 \cdot x}
      \end{array}
      
      Derivation
      1. Initial program 68.5%

        \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
        2. lift-*.f64N/A

          \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        3. lift-*.f64N/A

          \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
        4. lift-*.f64N/A

          \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
        5. associate-*l*N/A

          \[\leadsto \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)}} \]
        6. times-fracN/A

          \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
        7. lower-*.f64N/A

          \[\leadsto \color{blue}{\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
        8. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        9. lift-+.f64N/A

          \[\leadsto \frac{x}{\color{blue}{x + y}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        10. +-commutativeN/A

          \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        11. lower-+.f64N/A

          \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        12. lower-/.f64N/A

          \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
        13. *-commutativeN/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
        14. lower-*.f6493.4

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
        15. lift-+.f64N/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right)} \cdot \left(x + y\right)} \]
        16. add-flipN/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
        17. lower--.f64N/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) - \left(\mathsf{neg}\left(1\right)\right)\right)} \cdot \left(x + y\right)} \]
        18. lift-+.f64N/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(x + y\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
        19. +-commutativeN/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
        20. lower-+.f64N/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\color{blue}{\left(y + x\right)} - \left(\mathsf{neg}\left(1\right)\right)\right) \cdot \left(x + y\right)} \]
        21. metadata-eval93.4

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - \color{blue}{-1}\right) \cdot \left(x + y\right)} \]
        22. lift-+.f64N/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(x + y\right)}} \]
        23. +-commutativeN/A

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
        24. lower-+.f6493.4

          \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(y + x\right)}} \]
      3. Applied rewrites93.4%

        \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
      4. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
        2. *-commutativeN/A

          \[\leadsto \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)} \cdot \frac{x}{y + x}} \]
        3. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \cdot \frac{x}{y + x} \]
        4. lift-/.f64N/A

          \[\leadsto \frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)} \cdot \color{blue}{\frac{x}{y + x}} \]
        5. frac-timesN/A

          \[\leadsto \color{blue}{\frac{y \cdot x}{\left(\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)\right) \cdot \left(y + x\right)}} \]
        6. lift-*.f64N/A

          \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)\right)} \cdot \left(y + x\right)} \]
        7. associate-*r*N/A

          \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
        8. lift-*.f64N/A

          \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) - -1\right) \cdot \color{blue}{\left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
        9. lift-*.f64N/A

          \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
        10. associate-*l/N/A

          \[\leadsto \color{blue}{\frac{y}{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)} \cdot x} \]
        11. div-flipN/A

          \[\leadsto \color{blue}{\frac{1}{\frac{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}{y}}} \cdot x \]
        12. associate-*l/N/A

          \[\leadsto \color{blue}{\frac{1 \cdot x}{\frac{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}{y}}} \]
        13. *-lft-identityN/A

          \[\leadsto \frac{\color{blue}{x}}{\frac{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}{y}} \]
        14. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{x}{\frac{\left(\left(y + x\right) - -1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}{y}}} \]
      5. Applied rewrites84.7%

        \[\leadsto \color{blue}{\frac{x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \frac{\left(y + x\right) - -1}{y}}} \]
      6. Taylor expanded in x around 0

        \[\leadsto \frac{x}{\color{blue}{x \cdot \left(y + 2 \cdot \left(1 + y\right)\right) + y \cdot \left(1 + y\right)}} \]
      7. Step-by-step derivation
        1. lower-fma.f64N/A

          \[\leadsto \frac{x}{\mathsf{fma}\left(x, \color{blue}{y + 2 \cdot \left(1 + y\right)}, y \cdot \left(1 + y\right)\right)} \]
        2. lower-+.f64N/A

          \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + \color{blue}{2 \cdot \left(1 + y\right)}, y \cdot \left(1 + y\right)\right)} \]
        3. lower-*.f64N/A

          \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + 2 \cdot \color{blue}{\left(1 + y\right)}, y \cdot \left(1 + y\right)\right)} \]
        4. lower-+.f64N/A

          \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + 2 \cdot \left(1 + \color{blue}{y}\right), y \cdot \left(1 + y\right)\right)} \]
        5. lower-*.f64N/A

          \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + 2 \cdot \left(1 + y\right), y \cdot \left(1 + y\right)\right)} \]
        6. lower-+.f6452.0

          \[\leadsto \frac{x}{\mathsf{fma}\left(x, y + 2 \cdot \left(1 + y\right), y \cdot \left(1 + y\right)\right)} \]
      8. Applied rewrites52.0%

        \[\leadsto \frac{x}{\color{blue}{\mathsf{fma}\left(x, y + 2 \cdot \left(1 + y\right), y \cdot \left(1 + y\right)\right)}} \]
      9. Taylor expanded in y around 0

        \[\leadsto \frac{x}{2 \cdot \color{blue}{x}} \]
      10. Step-by-step derivation
        1. lower-*.f643.5

          \[\leadsto \frac{x}{2 \cdot x} \]
      11. Applied rewrites3.5%

        \[\leadsto \frac{x}{2 \cdot \color{blue}{x}} \]
      12. Add Preprocessing

      Reproduce

      ?
      herbie shell --seed 2025148 
      (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))))