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

Percentage Accurate: 68.4% → 99.8%
Time: 5.9s
Alternatives: 19
Speedup: 1.6×

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}

Sampling outcomes in binary64 precision:

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 19 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.4% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 99.8% accurate, 0.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 97.3% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.75 \cdot 10^{+154}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(y, \frac{\mathsf{fma}\left(-2, y, -1\right)}{x}, y\right)}{x}}{x + y}\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{+45}:\\ \;\;\;\;\frac{y}{y + x} \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x}{y}}{y + x} \cdot y}{x + y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.75e+154)
   (/ (/ (fma y (/ (fma -2.0 y -1.0) x) y) x) (+ x y))
   (if (<= x 5.2e+45)
     (* (/ y (+ y x)) (/ x (* (- (+ y x) -1.0) (+ y x))))
     (/ (* (/ (/ x y) (+ y x)) y) (+ x y)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.75e+154) {
		tmp = (fma(y, (fma(-2.0, y, -1.0) / x), y) / x) / (x + y);
	} else if (x <= 5.2e+45) {
		tmp = (y / (y + x)) * (x / (((y + x) - -1.0) * (y + x)));
	} else {
		tmp = (((x / y) / (y + x)) * y) / (x + y);
	}
	return tmp;
}
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.75e+154)
		tmp = Float64(Float64(fma(y, Float64(fma(-2.0, y, -1.0) / x), y) / x) / Float64(x + y));
	elseif (x <= 5.2e+45)
		tmp = Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(Float64(Float64(y + x) - -1.0) * Float64(y + x))));
	else
		tmp = Float64(Float64(Float64(Float64(x / y) / Float64(y + x)) * y) / Float64(x + 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.75e+154], N[(N[(N[(y * N[(N[(-2.0 * y + -1.0), $MachinePrecision] / x), $MachinePrecision] + y), $MachinePrecision] / x), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.2e+45], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x / y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+154}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(y, \frac{\mathsf{fma}\left(-2, y, -1\right)}{x}, y\right)}{x}}{x + y}\\

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

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


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

    1. Initial program 61.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.7500000000000001e154 < x < 5.20000000000000014e45

    1. Initial program 68.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.20000000000000014e45 < x

    1. Initial program 38.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{\frac{x}{y}}}{y + x} \cdot y}{x + y} \]
    10. Step-by-step derivation
      1. lower-/.f6432.6

        \[\leadsto \frac{\frac{\frac{x}{\color{blue}{y}}}{y + x} \cdot y}{x + y} \]
    11. Applied rewrites32.6%

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

Alternative 3: 97.3% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.75 \cdot 10^{+154}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(\frac{y}{x} \cdot 3, -y, y\right)}{x}}{x}\\ \mathbf{elif}\;x \leq 5.2 \cdot 10^{+45}:\\ \;\;\;\;\frac{y}{y + x} \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x}{y}}{y + x} \cdot y}{x + y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.75e+154)
   (/ (/ (fma (* (/ y x) 3.0) (- y) y) x) x)
   (if (<= x 5.2e+45)
     (* (/ y (+ y x)) (/ x (* (- (+ y x) -1.0) (+ y x))))
     (/ (* (/ (/ x y) (+ y x)) y) (+ x y)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.75e+154) {
		tmp = (fma(((y / x) * 3.0), -y, y) / x) / x;
	} else if (x <= 5.2e+45) {
		tmp = (y / (y + x)) * (x / (((y + x) - -1.0) * (y + x)));
	} else {
		tmp = (((x / y) / (y + x)) * y) / (x + y);
	}
	return tmp;
}
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.75e+154)
		tmp = Float64(Float64(fma(Float64(Float64(y / x) * 3.0), Float64(-y), y) / x) / x);
	elseif (x <= 5.2e+45)
		tmp = Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(Float64(Float64(y + x) - -1.0) * Float64(y + x))));
	else
		tmp = Float64(Float64(Float64(Float64(x / y) / Float64(y + x)) * y) / Float64(x + 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.75e+154], N[(N[(N[(N[(N[(y / x), $MachinePrecision] * 3.0), $MachinePrecision] * (-y) + y), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 5.2e+45], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(N[(N[(y + x), $MachinePrecision] - -1.0), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x / y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+154}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\frac{y}{x} \cdot 3, -y, y\right)}{x}}{x}\\

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

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


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

    1. Initial program 61.1%

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

      \[\leadsto \color{blue}{\frac{y + -1 \cdot \frac{y \cdot \left(1 + \left(y + 2 \cdot y\right)\right)}{x}}{{x}^{2}}} \]
    4. Step-by-step derivation
      1. fp-cancel-sign-sub-invN/A

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

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

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(-y, 3 \cdot \frac{y}{x}, y\right)}{x \cdot x} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(-y, \frac{y}{x} \cdot 3, y\right)}{x \cdot x} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-y, \frac{y}{x} \cdot 3, y\right)}{x \cdot x} \]
      3. lower-/.f6474.8

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

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{fma}\left(-y, \frac{y}{x} \cdot 3, y\right)}{x}}{\color{blue}{x}} \]
      5. lower-/.f6491.5

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

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

        \[\leadsto \frac{\frac{\left(\frac{y}{x} \cdot 3\right) \cdot \left(-y\right) + y}{x}}{x} \]
      8. lower-fma.f6491.5

        \[\leadsto \frac{\frac{\mathsf{fma}\left(\frac{y}{x} \cdot 3, -y, y\right)}{x}}{x} \]
    10. Applied rewrites91.5%

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

    if -1.7500000000000001e154 < x < 5.20000000000000014e45

    1. Initial program 68.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.20000000000000014e45 < x

    1. Initial program 38.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{\color{blue}{\frac{x}{y}}}{y + x} \cdot y}{x + y} \]
    10. Step-by-step derivation
      1. lower-/.f6432.6

        \[\leadsto \frac{\frac{\frac{x}{\color{blue}{y}}}{y + x} \cdot y}{x + y} \]
    11. Applied rewrites32.6%

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

Alternative 4: 97.3% accurate, 0.7× speedup?

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

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

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

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

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


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

    1. Initial program 61.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -1.7500000000000001e154 < x < 5.20000000000000014e45

      1. Initial program 68.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 5.20000000000000014e45 < x

      1. Initial program 38.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\color{blue}{\frac{x}{y}}}{y + x} \cdot y}{x + y} \]
      10. Step-by-step derivation
        1. lower-/.f6432.6

          \[\leadsto \frac{\frac{\frac{x}{\color{blue}{y}}}{y + x} \cdot y}{x + y} \]
      11. Applied rewrites32.6%

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

    Alternative 5: 97.3% accurate, 0.7× speedup?

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

      1. Initial program 61.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -1.7500000000000001e154 < x < 5.20000000000000014e45

        1. Initial program 68.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 5.20000000000000014e45 < x

        1. Initial program 38.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 6: 92.2% accurate, 0.7× speedup?

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

        1. Initial program 64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\frac{y}{x + \left(\mathsf{neg}\left(1\right)\right) \cdot -1}}{x + y} \]
          5. fp-cancel-sub-sign-invN/A

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

            \[\leadsto \frac{\frac{y}{x - -1}}{x + y} \]
          7. lower--.f6480.7

            \[\leadsto \frac{\frac{y}{x - \color{blue}{-1}}}{x + y} \]
        9. Applied rewrites80.7%

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

        if -3.1e12 < x < 5.0999999999999997e45

        1. Initial program 68.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 5.0999999999999997e45 < x

          1. Initial program 38.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 7: 87.3% accurate, 0.8× speedup?

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

          1. Initial program 64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if -1.6e18 < x < -3.80000000000000005e-149

          1. Initial program 83.6%

            \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
          2. Add Preprocessing

          if -3.80000000000000005e-149 < x

          1. Initial program 57.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\frac{x}{y + \left(\mathsf{neg}\left(1\right)\right) \cdot -1}}{x + y} \]
            5. fp-cancel-sub-sign-invN/A

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

              \[\leadsto \frac{\frac{x}{y - -1}}{x + y} \]
            7. lower--.f6460.2

              \[\leadsto \frac{\frac{x}{y - \color{blue}{-1}}}{x + y} \]
          9. Applied rewrites60.2%

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

        Alternative 8: 99.8% accurate, 0.8× speedup?

        \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{\frac{x}{x + y}}{\left(x + y\right) - -1} \cdot \frac{y}{x + y} \end{array} \]
        NOTE: x and y should be sorted in increasing order before calling this function.
        (FPCore (x y)
         :precision binary64
         (* (/ (/ x (+ x y)) (- (+ x y) -1.0)) (/ y (+ x y))))
        assert(x < y);
        double code(double x, double y) {
        	return ((x / (x + y)) / ((x + y) - -1.0)) * (y / (x + y));
        }
        
        NOTE: x and y should be sorted in increasing order before calling this function.
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(x, y)
        use fmin_fmax_functions
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            code = ((x / (x + y)) / ((x + y) - (-1.0d0))) * (y / (x + y))
        end function
        
        assert x < y;
        public static double code(double x, double y) {
        	return ((x / (x + y)) / ((x + y) - -1.0)) * (y / (x + y));
        }
        
        [x, y] = sort([x, y])
        def code(x, y):
        	return ((x / (x + y)) / ((x + y) - -1.0)) * (y / (x + y))
        
        x, y = sort([x, y])
        function code(x, y)
        	return Float64(Float64(Float64(x / Float64(x + y)) / Float64(Float64(x + y) - -1.0)) * Float64(y / Float64(x + y)))
        end
        
        x, y = num2cell(sort([x, y])){:}
        function tmp = code(x, y)
        	tmp = ((x / (x + y)) / ((x + y) - -1.0)) * (y / (x + y));
        end
        
        NOTE: x and y should be sorted in increasing order before calling this function.
        code[x_, y_] := N[(N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
        
        \begin{array}{l}
        [x, y] = \mathsf{sort}([x, y])\\
        \\
        \frac{\frac{x}{x + y}}{\left(x + y\right) - -1} \cdot \frac{y}{x + y}
        \end{array}
        
        Derivation
        1. Initial program 62.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 9: 80.5% accurate, 1.0× speedup?

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

          1. Initial program 64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if -2.7e14 < x < 3.8000000000000003e32

          1. Initial program 67.8%

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

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

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

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

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

              \[\leadsto \frac{x}{y \cdot y + y} \]
            5. lower-fma.f6472.0

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

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

          if 3.8000000000000003e32 < x

          1. Initial program 41.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 10: 80.3% accurate, 1.0× speedup?

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

          1. Initial program 64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\frac{y}{x}}{x} \]
            5. lower-/.f6480.3

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

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

          if -2.7e14 < x < 3.8000000000000003e32

          1. Initial program 67.8%

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

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

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

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

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

              \[\leadsto \frac{x}{y \cdot y + y} \]
            5. lower-fma.f6472.0

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

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

          if 3.8000000000000003e32 < x

          1. Initial program 41.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 11: 69.9% accurate, 1.1× speedup?

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

          1. Initial program 64.9%

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

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

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

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

              \[\leadsto \frac{y}{x \cdot \color{blue}{x}} \]
          5. Applied rewrites73.6%

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

          if -2.7e14 < x < -3.7000000000000002e-193 or 4.00000000000000033e-217 < x

          1. Initial program 66.8%

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

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

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

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

              \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
          5. Applied rewrites43.7%

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

          if -3.7000000000000002e-193 < x < 4.00000000000000033e-217

          1. Initial program 43.0%

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

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

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

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

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

              \[\leadsto \frac{x}{y \cdot y + y} \]
            5. lower-fma.f6493.0

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

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

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

              \[\leadsto \frac{x}{y} \]
          8. Recombined 3 regimes into one program.
          9. Final simplification58.6%

            \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.7 \cdot 10^{+14}:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;x \leq -3.7 \cdot 10^{-193} \lor \neg \left(x \leq 4 \cdot 10^{-217}\right):\\ \;\;\;\;\frac{x}{y \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
          10. Add Preprocessing

          Alternative 12: 80.3% accurate, 1.1× speedup?

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

            1. Initial program 64.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\frac{y}{x}}{x} \]
              5. lower-/.f6480.3

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

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

            if -2.7e14 < x < 1.95e43

            1. Initial program 68.0%

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

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

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

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

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

                \[\leadsto \frac{x}{y \cdot y + y} \]
              5. lower-fma.f6471.5

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

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

            if 1.95e43 < x

            1. Initial program 39.7%

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

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

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

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

                \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
            5. Applied rewrites27.7%

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

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

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

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

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

                \[\leadsto \frac{\frac{x}{y}}{y} \]
            7. Applied rewrites30.7%

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

          Alternative 13: 78.6% accurate, 1.1× speedup?

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

            1. Initial program 70.1%

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

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

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

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

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

                \[\leadsto \frac{y}{x \cdot x + x} \]
              5. lower-fma.f6458.9

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

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

            if -8.99999999999999986e-188 < x < 1.95e43

            1. Initial program 64.2%

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

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

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

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

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

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

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

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

            if 1.95e43 < x

            1. Initial program 39.7%

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

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

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

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

                \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
            5. Applied rewrites27.7%

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

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

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

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

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

                \[\leadsto \frac{\frac{x}{y}}{y} \]
            7. Applied rewrites30.7%

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

          Alternative 14: 80.8% accurate, 1.1× speedup?

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

            1. Initial program 70.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(\left(x + y\right) - -1\right)}}{x + y}} \]
            7. Taylor expanded in y around 0

              \[\leadsto \frac{\color{blue}{\frac{y}{1 + x}}}{x + y} \]
            8. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{\frac{y}{\color{blue}{1 + x}}}{x + y} \]
              2. +-commutativeN/A

                \[\leadsto \frac{\frac{y}{x + \color{blue}{1}}}{x + y} \]
              3. metadata-evalN/A

                \[\leadsto \frac{\frac{y}{x + -1 \cdot \color{blue}{-1}}}{x + y} \]
              4. metadata-evalN/A

                \[\leadsto \frac{\frac{y}{x + \left(\mathsf{neg}\left(1\right)\right) \cdot -1}}{x + y} \]
              5. fp-cancel-sub-sign-invN/A

                \[\leadsto \frac{\frac{y}{x - \color{blue}{1 \cdot -1}}}{x + y} \]
              6. metadata-evalN/A

                \[\leadsto \frac{\frac{y}{x - -1}}{x + y} \]
              7. lower--.f6463.5

                \[\leadsto \frac{\frac{y}{x - \color{blue}{-1}}}{x + y} \]
            9. Applied rewrites63.5%

              \[\leadsto \frac{\color{blue}{\frac{y}{x - -1}}}{x + y} \]

            if -8.99999999999999986e-188 < x

            1. Initial program 56.8%

              \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-/.f64N/A

                \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
              2. lift-*.f64N/A

                \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              3. *-commutativeN/A

                \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              4. lift-*.f64N/A

                \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
              5. lift-*.f64N/A

                \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
              6. associate-*l*N/A

                \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
              7. times-fracN/A

                \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
              8. lower-*.f64N/A

                \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
              9. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{y}{x + y}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              10. lift-+.f64N/A

                \[\leadsto \frac{y}{\color{blue}{x + y}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              11. +-commutativeN/A

                \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              12. lower-+.f64N/A

                \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              13. lower-/.f64N/A

                \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
              14. *-commutativeN/A

                \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
              15. lower-*.f6492.1

                \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
            4. Applied rewrites92.1%

              \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
            5. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
              2. lift-/.f64N/A

                \[\leadsto \color{blue}{\frac{y}{y + x}} \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)} \]
              3. associate-*l/N/A

                \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}}{y + x}} \]
              4. lift-+.f64N/A

                \[\leadsto \frac{y \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}}{\color{blue}{y + x}} \]
              5. +-commutativeN/A

                \[\leadsto \frac{y \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}}{\color{blue}{x + y}} \]
              6. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}}{x + y}} \]
            6. Applied rewrites63.3%

              \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(\left(x + y\right) - -1\right)}}{x + y}} \]
            7. Taylor expanded in x around 0

              \[\leadsto \frac{\color{blue}{\frac{x}{1 + y}}}{x + y} \]
            8. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{\frac{x}{\color{blue}{1 + y}}}{x + y} \]
              2. +-commutativeN/A

                \[\leadsto \frac{\frac{x}{y + \color{blue}{1}}}{x + y} \]
              3. metadata-evalN/A

                \[\leadsto \frac{\frac{x}{y + -1 \cdot \color{blue}{-1}}}{x + y} \]
              4. metadata-evalN/A

                \[\leadsto \frac{\frac{x}{y + \left(\mathsf{neg}\left(1\right)\right) \cdot -1}}{x + y} \]
              5. fp-cancel-sub-sign-invN/A

                \[\leadsto \frac{\frac{x}{y - \color{blue}{1 \cdot -1}}}{x + y} \]
              6. metadata-evalN/A

                \[\leadsto \frac{\frac{x}{y - -1}}{x + y} \]
              7. lower--.f6460.0

                \[\leadsto \frac{\frac{x}{y - \color{blue}{-1}}}{x + y} \]
            9. Applied rewrites60.0%

              \[\leadsto \frac{\color{blue}{\frac{x}{y - -1}}}{x + y} \]
          3. Recombined 2 regimes into one program.
          4. Add Preprocessing

          Alternative 15: 80.5% accurate, 1.1× speedup?

          \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.75 \cdot 10^{+14}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - -1}}{x + y}\\ \end{array} \end{array} \]
          NOTE: x and y should be sorted in increasing order before calling this function.
          (FPCore (x y)
           :precision binary64
           (if (<= x -2.75e+14) (/ (/ y x) (+ x y)) (/ (/ x (- y -1.0)) (+ x y))))
          assert(x < y);
          double code(double x, double y) {
          	double tmp;
          	if (x <= -2.75e+14) {
          		tmp = (y / x) / (x + y);
          	} else {
          		tmp = (x / (y - -1.0)) / (x + y);
          	}
          	return tmp;
          }
          
          NOTE: x and y should be sorted in increasing order before calling this function.
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(x, y)
          use fmin_fmax_functions
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8) :: tmp
              if (x <= (-2.75d+14)) then
                  tmp = (y / x) / (x + y)
              else
                  tmp = (x / (y - (-1.0d0))) / (x + y)
              end if
              code = tmp
          end function
          
          assert x < y;
          public static double code(double x, double y) {
          	double tmp;
          	if (x <= -2.75e+14) {
          		tmp = (y / x) / (x + y);
          	} else {
          		tmp = (x / (y - -1.0)) / (x + y);
          	}
          	return tmp;
          }
          
          [x, y] = sort([x, y])
          def code(x, y):
          	tmp = 0
          	if x <= -2.75e+14:
          		tmp = (y / x) / (x + y)
          	else:
          		tmp = (x / (y - -1.0)) / (x + y)
          	return tmp
          
          x, y = sort([x, y])
          function code(x, y)
          	tmp = 0.0
          	if (x <= -2.75e+14)
          		tmp = Float64(Float64(y / x) / Float64(x + y));
          	else
          		tmp = Float64(Float64(x / Float64(y - -1.0)) / Float64(x + y));
          	end
          	return tmp
          end
          
          x, y = num2cell(sort([x, y])){:}
          function tmp_2 = code(x, y)
          	tmp = 0.0;
          	if (x <= -2.75e+14)
          		tmp = (y / x) / (x + y);
          	else
          		tmp = (x / (y - -1.0)) / (x + y);
          	end
          	tmp_2 = tmp;
          end
          
          NOTE: x and y should be sorted in increasing order before calling this function.
          code[x_, y_] := If[LessEqual[x, -2.75e+14], N[(N[(y / x), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y - -1.0), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          [x, y] = \mathsf{sort}([x, y])\\
          \\
          \begin{array}{l}
          \mathbf{if}\;x \leq -2.75 \cdot 10^{+14}:\\
          \;\;\;\;\frac{\frac{y}{x}}{x + y}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\frac{x}{y - -1}}{x + y}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if x < -2.75e14

            1. Initial program 64.9%

              \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-/.f64N/A

                \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
              2. lift-*.f64N/A

                \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              3. *-commutativeN/A

                \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              4. lift-*.f64N/A

                \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
              5. lift-*.f64N/A

                \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
              6. associate-*l*N/A

                \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
              7. times-fracN/A

                \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
              8. lower-*.f64N/A

                \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
              9. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{y}{x + y}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              10. lift-+.f64N/A

                \[\leadsto \frac{y}{\color{blue}{x + y}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              11. +-commutativeN/A

                \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              12. lower-+.f64N/A

                \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              13. lower-/.f64N/A

                \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
              14. *-commutativeN/A

                \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
              15. lower-*.f6486.4

                \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
            4. Applied rewrites86.4%

              \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
            5. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
              2. lift-/.f64N/A

                \[\leadsto \color{blue}{\frac{y}{y + x}} \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)} \]
              3. associate-*l/N/A

                \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}}{y + x}} \]
              4. lift-+.f64N/A

                \[\leadsto \frac{y \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}}{\color{blue}{y + x}} \]
              5. +-commutativeN/A

                \[\leadsto \frac{y \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}}{\color{blue}{x + y}} \]
              6. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}}{x + y}} \]
            6. Applied rewrites70.8%

              \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(\left(x + y\right) - -1\right)}}{x + y}} \]
            7. Taylor expanded in x around inf

              \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{x + y} \]
            8. Step-by-step derivation
              1. lower-/.f6480.7

                \[\leadsto \frac{\frac{y}{\color{blue}{x}}}{x + y} \]
            9. Applied rewrites80.7%

              \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{x + y} \]

            if -2.75e14 < x

            1. Initial program 61.1%

              \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
            2. Add Preprocessing
            3. Step-by-step derivation
              1. lift-/.f64N/A

                \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
              2. lift-*.f64N/A

                \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              3. *-commutativeN/A

                \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              4. lift-*.f64N/A

                \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
              5. lift-*.f64N/A

                \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
              6. associate-*l*N/A

                \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
              7. times-fracN/A

                \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
              8. lower-*.f64N/A

                \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
              9. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{y}{x + y}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              10. lift-+.f64N/A

                \[\leadsto \frac{y}{\color{blue}{x + y}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              11. +-commutativeN/A

                \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              12. lower-+.f64N/A

                \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              13. lower-/.f64N/A

                \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
              14. *-commutativeN/A

                \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
              15. lower-*.f6493.6

                \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
            4. Applied rewrites93.6%

              \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
            5. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}} \]
              2. lift-/.f64N/A

                \[\leadsto \color{blue}{\frac{y}{y + x}} \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)} \]
              3. associate-*l/N/A

                \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}}{y + x}} \]
              4. lift-+.f64N/A

                \[\leadsto \frac{y \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}}{\color{blue}{y + x}} \]
              5. +-commutativeN/A

                \[\leadsto \frac{y \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}}{\color{blue}{x + y}} \]
              6. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\left(\left(y + x\right) - -1\right) \cdot \left(y + x\right)}}{x + y}} \]
            6. Applied rewrites66.8%

              \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(\left(x + y\right) - -1\right)}}{x + y}} \]
            7. Taylor expanded in x around 0

              \[\leadsto \frac{\color{blue}{\frac{x}{1 + y}}}{x + y} \]
            8. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{\frac{x}{\color{blue}{1 + y}}}{x + y} \]
              2. +-commutativeN/A

                \[\leadsto \frac{\frac{x}{y + \color{blue}{1}}}{x + y} \]
              3. metadata-evalN/A

                \[\leadsto \frac{\frac{x}{y + -1 \cdot \color{blue}{-1}}}{x + y} \]
              4. metadata-evalN/A

                \[\leadsto \frac{\frac{x}{y + \left(\mathsf{neg}\left(1\right)\right) \cdot -1}}{x + y} \]
              5. fp-cancel-sub-sign-invN/A

                \[\leadsto \frac{\frac{x}{y - \color{blue}{1 \cdot -1}}}{x + y} \]
              6. metadata-evalN/A

                \[\leadsto \frac{\frac{x}{y - -1}}{x + y} \]
              7. lower--.f6461.7

                \[\leadsto \frac{\frac{x}{y - \color{blue}{-1}}}{x + y} \]
            9. Applied rewrites61.7%

              \[\leadsto \frac{\color{blue}{\frac{x}{y - -1}}}{x + y} \]
          3. Recombined 2 regimes into one program.
          4. Add Preprocessing

          Alternative 16: 77.2% accurate, 1.6× speedup?

          \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -9 \cdot 10^{-188}:\\ \;\;\;\;\frac{y}{\mathsf{fma}\left(x, x, 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 -9e-188) (/ y (fma x x x)) (/ x (fma y y y))))
          assert(x < y);
          double code(double x, double y) {
          	double tmp;
          	if (x <= -9e-188) {
          		tmp = y / fma(x, x, x);
          	} else {
          		tmp = x / fma(y, y, y);
          	}
          	return tmp;
          }
          
          x, y = sort([x, y])
          function code(x, y)
          	tmp = 0.0
          	if (x <= -9e-188)
          		tmp = Float64(y / fma(x, x, 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, -9e-188], N[(y / N[(x * x + x), $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 -9 \cdot 10^{-188}:\\
          \;\;\;\;\frac{y}{\mathsf{fma}\left(x, x, 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 < -8.99999999999999986e-188

            1. Initial program 70.1%

              \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
            2. Add Preprocessing
            3. Taylor expanded in y around 0

              \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
            4. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{y}{\color{blue}{x \cdot \left(1 + x\right)}} \]
              2. +-commutativeN/A

                \[\leadsto \frac{y}{x \cdot \left(x + \color{blue}{1}\right)} \]
              3. distribute-lft-inN/A

                \[\leadsto \frac{y}{x \cdot x + \color{blue}{x \cdot 1}} \]
              4. *-rgt-identityN/A

                \[\leadsto \frac{y}{x \cdot x + x} \]
              5. lower-fma.f6458.9

                \[\leadsto \frac{y}{\mathsf{fma}\left(x, \color{blue}{x}, x\right)} \]
            5. Applied rewrites58.9%

              \[\leadsto \color{blue}{\frac{y}{\mathsf{fma}\left(x, x, x\right)}} \]

            if -8.99999999999999986e-188 < x

            1. Initial program 56.8%

              \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
            2. Add Preprocessing
            3. Taylor expanded in x around 0

              \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
            4. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{x}{\color{blue}{y \cdot \left(1 + y\right)}} \]
              2. +-commutativeN/A

                \[\leadsto \frac{x}{y \cdot \left(y + \color{blue}{1}\right)} \]
              3. distribute-lft-inN/A

                \[\leadsto \frac{x}{y \cdot y + \color{blue}{y \cdot 1}} \]
              4. *-rgt-identityN/A

                \[\leadsto \frac{x}{y \cdot y + y} \]
              5. lower-fma.f6458.9

                \[\leadsto \frac{x}{\mathsf{fma}\left(y, \color{blue}{y}, y\right)} \]
            5. Applied rewrites58.9%

              \[\leadsto \color{blue}{\frac{x}{\mathsf{fma}\left(y, y, y\right)}} \]
          3. Recombined 2 regimes into one program.
          4. Add Preprocessing

          Alternative 17: 76.9% accurate, 1.6× speedup?

          \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.7 \cdot 10^{+14}:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \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 -2.7e+14) (/ y (* x x)) (/ x (fma y y y))))
          assert(x < y);
          double code(double x, double y) {
          	double tmp;
          	if (x <= -2.7e+14) {
          		tmp = y / (x * x);
          	} else {
          		tmp = x / fma(y, y, y);
          	}
          	return tmp;
          }
          
          x, y = sort([x, y])
          function code(x, y)
          	tmp = 0.0
          	if (x <= -2.7e+14)
          		tmp = Float64(y / Float64(x * 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, -2.7e+14], N[(y / N[(x * x), $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 -2.7 \cdot 10^{+14}:\\
          \;\;\;\;\frac{y}{x \cdot x}\\
          
          \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 < -2.7e14

            1. Initial program 64.9%

              \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
            2. Add Preprocessing
            3. Taylor expanded in x around inf

              \[\leadsto \color{blue}{\frac{y}{{x}^{2}}} \]
            4. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{y}{\color{blue}{{x}^{2}}} \]
              2. unpow2N/A

                \[\leadsto \frac{y}{x \cdot \color{blue}{x}} \]
              3. lower-*.f6473.6

                \[\leadsto \frac{y}{x \cdot \color{blue}{x}} \]
            5. Applied rewrites73.6%

              \[\leadsto \color{blue}{\frac{y}{x \cdot x}} \]

            if -2.7e14 < x

            1. Initial program 61.1%

              \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
            2. Add Preprocessing
            3. Taylor expanded in x around 0

              \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
            4. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{x}{\color{blue}{y \cdot \left(1 + y\right)}} \]
              2. +-commutativeN/A

                \[\leadsto \frac{x}{y \cdot \left(y + \color{blue}{1}\right)} \]
              3. distribute-lft-inN/A

                \[\leadsto \frac{x}{y \cdot y + \color{blue}{y \cdot 1}} \]
              4. *-rgt-identityN/A

                \[\leadsto \frac{x}{y \cdot y + y} \]
              5. lower-fma.f6460.8

                \[\leadsto \frac{x}{\mathsf{fma}\left(y, \color{blue}{y}, y\right)} \]
            5. Applied rewrites60.8%

              \[\leadsto \color{blue}{\frac{x}{\mathsf{fma}\left(y, y, y\right)}} \]
          3. Recombined 2 regimes into one program.
          4. Add Preprocessing

          Alternative 18: 47.5% accurate, 1.7× speedup?

          \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \end{array} \]
          NOTE: x and y should be sorted in increasing order before calling this function.
          (FPCore (x y) :precision binary64 (if (<= y 1.0) (/ x y) (/ x (* y y))))
          assert(x < y);
          double code(double x, double y) {
          	double tmp;
          	if (y <= 1.0) {
          		tmp = x / y;
          	} else {
          		tmp = x / (y * y);
          	}
          	return tmp;
          }
          
          NOTE: x and y should be sorted in increasing order before calling this function.
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(x, y)
          use fmin_fmax_functions
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8) :: tmp
              if (y <= 1.0d0) then
                  tmp = x / y
              else
                  tmp = x / (y * y)
              end if
              code = tmp
          end function
          
          assert x < y;
          public static double code(double x, double y) {
          	double tmp;
          	if (y <= 1.0) {
          		tmp = x / y;
          	} else {
          		tmp = x / (y * y);
          	}
          	return tmp;
          }
          
          [x, y] = sort([x, y])
          def code(x, y):
          	tmp = 0
          	if y <= 1.0:
          		tmp = x / y
          	else:
          		tmp = x / (y * y)
          	return tmp
          
          x, y = sort([x, y])
          function code(x, y)
          	tmp = 0.0
          	if (y <= 1.0)
          		tmp = Float64(x / y);
          	else
          		tmp = Float64(x / Float64(y * y));
          	end
          	return tmp
          end
          
          x, y = num2cell(sort([x, y])){:}
          function tmp_2 = code(x, y)
          	tmp = 0.0;
          	if (y <= 1.0)
          		tmp = x / y;
          	else
          		tmp = x / (y * y);
          	end
          	tmp_2 = tmp;
          end
          
          NOTE: x and y should be sorted in increasing order before calling this function.
          code[x_, y_] := If[LessEqual[y, 1.0], N[(x / y), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          [x, y] = \mathsf{sort}([x, y])\\
          \\
          \begin{array}{l}
          \mathbf{if}\;y \leq 1:\\
          \;\;\;\;\frac{x}{y}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{x}{y \cdot y}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y < 1

            1. Initial program 63.4%

              \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
            2. Add Preprocessing
            3. Taylor expanded in x around 0

              \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
            4. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{x}{\color{blue}{y \cdot \left(1 + y\right)}} \]
              2. +-commutativeN/A

                \[\leadsto \frac{x}{y \cdot \left(y + \color{blue}{1}\right)} \]
              3. distribute-lft-inN/A

                \[\leadsto \frac{x}{y \cdot y + \color{blue}{y \cdot 1}} \]
              4. *-rgt-identityN/A

                \[\leadsto \frac{x}{y \cdot y + y} \]
              5. lower-fma.f6444.1

                \[\leadsto \frac{x}{\mathsf{fma}\left(y, \color{blue}{y}, y\right)} \]
            5. Applied rewrites44.1%

              \[\leadsto \color{blue}{\frac{x}{\mathsf{fma}\left(y, y, y\right)}} \]
            6. Taylor expanded in y around 0

              \[\leadsto \frac{x}{y} \]
            7. Step-by-step derivation
              1. Applied rewrites26.6%

                \[\leadsto \frac{x}{y} \]

              if 1 < y

              1. Initial program 58.1%

                \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
              2. Add Preprocessing
              3. Taylor expanded in y around inf

                \[\leadsto \color{blue}{\frac{x}{{y}^{2}}} \]
              4. Step-by-step derivation
                1. lower-/.f64N/A

                  \[\leadsto \frac{x}{\color{blue}{{y}^{2}}} \]
                2. unpow2N/A

                  \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
                3. lower-*.f6467.9

                  \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
              5. Applied rewrites67.9%

                \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
            8. Recombined 2 regimes into one program.
            9. Add Preprocessing

            Alternative 19: 26.3% accurate, 3.3× speedup?

            \[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{x}{y} \end{array} \]
            NOTE: x and y should be sorted in increasing order before calling this function.
            (FPCore (x y) :precision binary64 (/ x y))
            assert(x < y);
            double code(double x, double y) {
            	return x / y;
            }
            
            NOTE: x and y should be sorted in increasing order before calling this function.
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(x, y)
            use fmin_fmax_functions
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                code = x / y
            end function
            
            assert x < y;
            public static double code(double x, double y) {
            	return x / y;
            }
            
            [x, y] = sort([x, y])
            def code(x, y):
            	return x / y
            
            x, y = sort([x, y])
            function code(x, y)
            	return Float64(x / y)
            end
            
            x, y = num2cell(sort([x, y])){:}
            function tmp = code(x, y)
            	tmp = x / y;
            end
            
            NOTE: x and y should be sorted in increasing order before calling this function.
            code[x_, y_] := N[(x / y), $MachinePrecision]
            
            \begin{array}{l}
            [x, y] = \mathsf{sort}([x, y])\\
            \\
            \frac{x}{y}
            \end{array}
            
            Derivation
            1. Initial program 62.0%

              \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
            2. Add Preprocessing
            3. Taylor expanded in x around 0

              \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
            4. Step-by-step derivation
              1. lower-/.f64N/A

                \[\leadsto \frac{x}{\color{blue}{y \cdot \left(1 + y\right)}} \]
              2. +-commutativeN/A

                \[\leadsto \frac{x}{y \cdot \left(y + \color{blue}{1}\right)} \]
              3. distribute-lft-inN/A

                \[\leadsto \frac{x}{y \cdot y + \color{blue}{y \cdot 1}} \]
              4. *-rgt-identityN/A

                \[\leadsto \frac{x}{y \cdot y + y} \]
              5. lower-fma.f6450.3

                \[\leadsto \frac{x}{\mathsf{fma}\left(y, \color{blue}{y}, y\right)} \]
            5. Applied rewrites50.3%

              \[\leadsto \color{blue}{\frac{x}{\mathsf{fma}\left(y, y, y\right)}} \]
            6. Taylor expanded in y around 0

              \[\leadsto \frac{x}{y} \]
            7. Step-by-step derivation
              1. Applied rewrites25.3%

                \[\leadsto \frac{x}{y} \]
              2. Add Preprocessing

              Developer Target 1: 99.8% accurate, 0.6× speedup?

              \[\begin{array}{l} \\ \frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}} \end{array} \]
              (FPCore (x y)
               :precision binary64
               (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x)))))
              double code(double x, double y) {
              	return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
              }
              
              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 + 1.0d0) + x)) / (y + x)) / (1.0d0 / (y / (y + x)))
              end function
              
              public static double code(double x, double y) {
              	return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
              }
              
              def code(x, y):
              	return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)))
              
              function code(x, y)
              	return Float64(Float64(Float64(x / Float64(Float64(y + 1.0) + x)) / Float64(y + x)) / Float64(1.0 / Float64(y / Float64(y + x))))
              end
              
              function tmp = code(x, y)
              	tmp = ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
              end
              
              code[x_, y_] := N[(N[(N[(x / N[(N[(y + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              \frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}}
              \end{array}
              

              Reproduce

              ?
              herbie shell --seed 2025026 
              (FPCore (x y)
                :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
                :precision binary64
              
                :alt
                (! :herbie-platform default (/ (/ (/ x (+ (+ y 1) x)) (+ y x)) (/ 1 (/ y (+ y x)))))
              
                (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))