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

Percentage Accurate: 68.7% → 89.2%
Time: 3.6s
Alternatives: 15
Speedup: 1.7×

Specification

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

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

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

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

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 15 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.7% 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: 89.2% accurate, 0.7× speedup?

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

\mathbf{elif}\;y \leq 1.5 \cdot 10^{+97}:\\
\;\;\;\;x \cdot \frac{y}{\left(\left(y + x\right) + 1\right) \cdot \mathsf{fma}\left(y, y - -2 \cdot x, x \cdot x\right)}\\

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


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

    1. Initial program 64.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \frac{\mathsf{fma}\left(x \cdot x - y \cdot y, 2, \left(x - y\right) \cdot 2\right)}{\color{blue}{\left(x - y\right)} \cdot 2}} \]
    3. Applied rewrites64.2%

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

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

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

        \[\leadsto 2 \cdot \frac{y}{\color{blue}{2 \cdot x + 2 \cdot {x}^{2}}} \]
      3. lower-fma.f64N/A

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

        \[\leadsto 2 \cdot \frac{y}{\mathsf{fma}\left(2, x, 2 \cdot {x}^{2}\right)} \]
      5. pow2N/A

        \[\leadsto 2 \cdot \frac{y}{\mathsf{fma}\left(2, x, 2 \cdot \left(x \cdot x\right)\right)} \]
      6. lift-*.f6485.8

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

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

    if 2.95000000000000007e-136 < y < 1.4999999999999999e97

    1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{y}{\left(\left(y + x\right) + 1\right) \cdot \mathsf{fma}\left(y, \color{blue}{y + 2 \cdot x}, {x}^{2}\right)} \]
      2. fp-cancel-sign-sub-invN/A

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

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

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

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

        \[\leadsto x \cdot \frac{y}{\left(\left(y + x\right) + 1\right) \cdot \mathsf{fma}\left(y, y - -2 \cdot x, x \cdot x\right)} \]
      7. lift-*.f6493.2

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

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

    if 1.4999999999999999e97 < y

    1. Initial program 60.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-\frac{\left(\left(x + 2 \cdot x\right) + 1\right) \cdot x}{y}\right) + x}{{y}^{2}} \]
      10. distribute-rgt1-inN/A

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

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

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

        \[\leadsto \frac{\left(-\frac{\mathsf{fma}\left(3, x, 1\right) \cdot x}{y}\right) + x}{y \cdot \color{blue}{y}} \]
      14. lower-*.f6476.2

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

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

      \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
      3. pow2N/A

        \[\leadsto \frac{-3 \cdot \frac{x \cdot x}{y} + x}{y \cdot y} \]
      4. lift-*.f6476.2

        \[\leadsto \frac{-3 \cdot \frac{x \cdot x}{y} + x}{y \cdot y} \]
    7. Applied rewrites76.2%

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

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

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

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

        \[\leadsto \frac{\frac{-3 \cdot \frac{x \cdot x}{y} + x}{y}}{\color{blue}{y}} \]
    9. Applied rewrites90.2%

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

Alternative 2: 89.2% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 64.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \frac{\mathsf{fma}\left(x \cdot x - y \cdot y, 2, \left(x - y\right) \cdot 2\right)}{\color{blue}{\left(x - y\right)} \cdot 2}} \]
    3. Applied rewrites64.2%

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

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

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

        \[\leadsto 2 \cdot \frac{y}{\color{blue}{2 \cdot x + 2 \cdot {x}^{2}}} \]
      3. lower-fma.f64N/A

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

        \[\leadsto 2 \cdot \frac{y}{\mathsf{fma}\left(2, x, 2 \cdot {x}^{2}\right)} \]
      5. pow2N/A

        \[\leadsto 2 \cdot \frac{y}{\mathsf{fma}\left(2, x, 2 \cdot \left(x \cdot x\right)\right)} \]
      6. lift-*.f6485.8

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

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

    if 2.95000000000000007e-136 < y < 1.4999999999999999e97

    1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4999999999999999e97 < y

    1. Initial program 60.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-\frac{\left(\left(x + 2 \cdot x\right) + 1\right) \cdot x}{y}\right) + x}{{y}^{2}} \]
      10. distribute-rgt1-inN/A

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

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

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

        \[\leadsto \frac{\left(-\frac{\mathsf{fma}\left(3, x, 1\right) \cdot x}{y}\right) + x}{y \cdot \color{blue}{y}} \]
      14. lower-*.f6476.2

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

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

      \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
      3. pow2N/A

        \[\leadsto \frac{-3 \cdot \frac{x \cdot x}{y} + x}{y \cdot y} \]
      4. lift-*.f6476.2

        \[\leadsto \frac{-3 \cdot \frac{x \cdot x}{y} + x}{y \cdot y} \]
    7. Applied rewrites76.2%

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

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

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

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

        \[\leadsto \frac{\frac{-3 \cdot \frac{x \cdot x}{y} + x}{y}}{\color{blue}{y}} \]
    9. Applied rewrites90.2%

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

Alternative 3: 87.3% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 64.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \frac{\mathsf{fma}\left(x \cdot x - y \cdot y, 2, \left(x - y\right) \cdot 2\right)}{\color{blue}{\left(x - y\right)} \cdot 2}} \]
    3. Applied rewrites64.2%

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

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

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

        \[\leadsto 2 \cdot \frac{y}{\color{blue}{2 \cdot x + 2 \cdot {x}^{2}}} \]
      3. lower-fma.f64N/A

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

        \[\leadsto 2 \cdot \frac{y}{\mathsf{fma}\left(2, x, 2 \cdot {x}^{2}\right)} \]
      5. pow2N/A

        \[\leadsto 2 \cdot \frac{y}{\mathsf{fma}\left(2, x, 2 \cdot \left(x \cdot x\right)\right)} \]
      6. lift-*.f6485.8

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

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

    if 2.9999999999999998e-136 < y < 1.15e139

    1. Initial program 79.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.15e139 < y

    1. Initial program 61.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-\frac{\left(\left(x + 2 \cdot x\right) + 1\right) \cdot x}{y}\right) + x}{{y}^{2}} \]
      10. distribute-rgt1-inN/A

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

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

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

        \[\leadsto \frac{\left(-\frac{\mathsf{fma}\left(3, x, 1\right) \cdot x}{y}\right) + x}{y \cdot \color{blue}{y}} \]
      14. lower-*.f6474.5

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

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

      \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
      3. pow2N/A

        \[\leadsto \frac{-3 \cdot \frac{x \cdot x}{y} + x}{y \cdot y} \]
      4. lift-*.f6474.5

        \[\leadsto \frac{-3 \cdot \frac{x \cdot x}{y} + x}{y \cdot y} \]
    7. Applied rewrites74.5%

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

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

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

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

        \[\leadsto \frac{\frac{-3 \cdot \frac{x \cdot x}{y} + x}{y}}{\color{blue}{y}} \]
    9. Applied rewrites91.7%

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

Alternative 4: 86.8% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 64.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \frac{\mathsf{fma}\left(x \cdot x - y \cdot y, 2, \left(x - y\right) \cdot 2\right)}{\color{blue}{\left(x - y\right)} \cdot 2}} \]
    3. Applied rewrites64.2%

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

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

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

        \[\leadsto 2 \cdot \frac{y}{\color{blue}{2 \cdot x + 2 \cdot {x}^{2}}} \]
      3. lower-fma.f64N/A

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

        \[\leadsto 2 \cdot \frac{y}{\mathsf{fma}\left(2, x, 2 \cdot {x}^{2}\right)} \]
      5. pow2N/A

        \[\leadsto 2 \cdot \frac{y}{\mathsf{fma}\left(2, x, 2 \cdot \left(x \cdot x\right)\right)} \]
      6. lift-*.f6485.8

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

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

    if 2.9999999999999998e-136 < y < 1.4999999999999999e97

    1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4999999999999999e97 < y

    1. Initial program 60.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\left(-\frac{\left(\left(x + 2 \cdot x\right) + 1\right) \cdot x}{y}\right) + x}{{y}^{2}} \]
      10. distribute-rgt1-inN/A

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

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

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

        \[\leadsto \frac{\left(-\frac{\mathsf{fma}\left(3, x, 1\right) \cdot x}{y}\right) + x}{y \cdot \color{blue}{y}} \]
      14. lower-*.f6476.2

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

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

      \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
    6. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
      2. lower-/.f64N/A

        \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
      3. pow2N/A

        \[\leadsto \frac{-3 \cdot \frac{x \cdot x}{y} + x}{y \cdot y} \]
      4. lift-*.f6476.2

        \[\leadsto \frac{-3 \cdot \frac{x \cdot x}{y} + x}{y \cdot y} \]
    7. Applied rewrites76.2%

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

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

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

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

        \[\leadsto \frac{\frac{-3 \cdot \frac{x \cdot x}{y} + x}{y}}{\color{blue}{y}} \]
    9. Applied rewrites90.2%

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

Alternative 5: 85.0% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 2.9999999999999998e-136

    1. Initial program 64.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \frac{\mathsf{fma}\left(x \cdot x - y \cdot y, 2, \left(x - y\right) \cdot 2\right)}{\color{blue}{\left(x - y\right)} \cdot 2}} \]
    3. Applied rewrites64.2%

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

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

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

        \[\leadsto 2 \cdot \frac{y}{\color{blue}{2 \cdot x + 2 \cdot {x}^{2}}} \]
      3. lower-fma.f64N/A

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

        \[\leadsto 2 \cdot \frac{y}{\mathsf{fma}\left(2, x, 2 \cdot {x}^{2}\right)} \]
      5. pow2N/A

        \[\leadsto 2 \cdot \frac{y}{\mathsf{fma}\left(2, x, 2 \cdot \left(x \cdot x\right)\right)} \]
      6. lift-*.f6485.8

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

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

    if 2.9999999999999998e-136 < y < 2.89999999999999992e-112

    1. Initial program 70.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if 2.89999999999999992e-112 < y < 2.1e7

      1. Initial program 86.3%

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

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

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

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

      if 2.1e7 < y

      1. Initial program 67.1%

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\left(-\frac{\left(\left(x + 2 \cdot x\right) + 1\right) \cdot x}{y}\right) + x}{{y}^{2}} \]
        10. distribute-rgt1-inN/A

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

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

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

          \[\leadsto \frac{\left(-\frac{\mathsf{fma}\left(3, x, 1\right) \cdot x}{y}\right) + x}{y \cdot \color{blue}{y}} \]
        14. lower-*.f6475.1

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

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

        \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
      6. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
        2. lower-/.f64N/A

          \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
        3. pow2N/A

          \[\leadsto \frac{-3 \cdot \frac{x \cdot x}{y} + x}{y \cdot y} \]
        4. lift-*.f6474.8

          \[\leadsto \frac{-3 \cdot \frac{x \cdot x}{y} + x}{y \cdot y} \]
      7. Applied rewrites74.8%

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

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

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

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

          \[\leadsto \frac{\frac{-3 \cdot \frac{x \cdot x}{y} + x}{y}}{\color{blue}{y}} \]
      9. Applied rewrites85.2%

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

    Alternative 6: 84.7% accurate, 0.9× speedup?

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

      1. Initial program 64.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \frac{\mathsf{fma}\left(x \cdot x - y \cdot y, 2, \left(x - y\right) \cdot 2\right)}{\color{blue}{\left(x - y\right)} \cdot 2}} \]
      3. Applied rewrites64.2%

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

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

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

          \[\leadsto 2 \cdot \frac{y}{\color{blue}{2 \cdot x + 2 \cdot {x}^{2}}} \]
        3. lower-fma.f64N/A

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

          \[\leadsto 2 \cdot \frac{y}{\mathsf{fma}\left(2, x, 2 \cdot {x}^{2}\right)} \]
        5. pow2N/A

          \[\leadsto 2 \cdot \frac{y}{\mathsf{fma}\left(2, x, 2 \cdot \left(x \cdot x\right)\right)} \]
        6. lift-*.f6485.8

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

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

      if 2.9999999999999998e-136 < y < 1.05e7

      1. Initial program 84.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 1.05e7 < y

        1. Initial program 67.1%

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\left(-\frac{\left(\left(x + 2 \cdot x\right) + 1\right) \cdot x}{y}\right) + x}{{y}^{2}} \]
          10. distribute-rgt1-inN/A

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

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

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

            \[\leadsto \frac{\left(-\frac{\mathsf{fma}\left(3, x, 1\right) \cdot x}{y}\right) + x}{y \cdot \color{blue}{y}} \]
          14. lower-*.f6475.1

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

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

          \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
        6. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
          2. lower-/.f64N/A

            \[\leadsto \frac{-3 \cdot \frac{{x}^{2}}{y} + x}{y \cdot y} \]
          3. pow2N/A

            \[\leadsto \frac{-3 \cdot \frac{x \cdot x}{y} + x}{y \cdot y} \]
          4. lift-*.f6474.8

            \[\leadsto \frac{-3 \cdot \frac{x \cdot x}{y} + x}{y \cdot y} \]
        7. Applied rewrites74.8%

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

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

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

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

            \[\leadsto \frac{\frac{-3 \cdot \frac{x \cdot x}{y} + x}{y}}{\color{blue}{y}} \]
        9. Applied rewrites85.1%

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

      Alternative 7: 84.2% accurate, 0.8× speedup?

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

        1. Initial program 58.7%

          \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
        2. Taylor expanded in 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}}} \]
        3. Step-by-step derivation
          1. lower-/.f64N/A

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\left(-\frac{\left(\left(y + 2 \cdot y\right) + 1\right) \cdot y}{x}\right) + y}{{x}^{2}} \]
          10. distribute-rgt1-inN/A

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

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

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

            \[\leadsto \frac{\left(-\frac{\mathsf{fma}\left(3, y, 1\right) \cdot y}{x}\right) + y}{x \cdot \color{blue}{x}} \]
          14. lower-*.f6475.2

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\frac{\left(\mathsf{neg}\left(\frac{y}{x}\right)\right) + y}{x}}{x} \]
            7. lift-/.f64N/A

              \[\leadsto \frac{\frac{\left(\mathsf{neg}\left(\frac{y}{x}\right)\right) + y}{x}}{x} \]
            8. distribute-neg-frac2N/A

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

              \[\leadsto \frac{\frac{\frac{y}{\mathsf{neg}\left(x\right)} + y}{x}}{x} \]
            10. lower-neg.f6490.5

              \[\leadsto \frac{\frac{\frac{y}{-x} + y}{x}}{x} \]
          3. Applied rewrites90.5%

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

          if -5.49999999999999981e102 < x < -75

          1. Initial program 86.2%

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

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

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

            if -75 < x < -1.9999999999999999e-129

            1. Initial program 83.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. Step-by-step derivation
              1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              if -1.9999999999999999e-129 < x

              1. Initial program 65.3%

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

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

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

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

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

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

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

            Alternative 8: 84.2% accurate, 0.9× speedup?

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

              1. Initial program 66.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. Step-by-step derivation
                1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \frac{\mathsf{fma}\left(x \cdot x - y \cdot y, 2, \left(x - y\right) \cdot 2\right)}{\color{blue}{\left(x - y\right) \cdot 2}}} \]
                18. lower--.f6466.6

                  \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \frac{\mathsf{fma}\left(x \cdot x - y \cdot y, 2, \left(x - y\right) \cdot 2\right)}{\color{blue}{\left(x - y\right)} \cdot 2}} \]
              3. Applied rewrites66.6%

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

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

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

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

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

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

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

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

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

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

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

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

                if -75 < x < -1.9999999999999999e-129

                1. Initial program 83.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. Step-by-step derivation
                  1. lift-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  if -1.9999999999999999e-129 < x

                  1. Initial program 65.3%

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

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

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

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

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

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

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

                Alternative 9: 84.2% accurate, 0.9× speedup?

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

                  1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{\left(-\frac{\left(\left(y + 2 \cdot y\right) + 1\right) \cdot y}{x}\right) + y}{{x}^{2}} \]
                    10. distribute-rgt1-inN/A

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

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

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

                      \[\leadsto \frac{\left(-\frac{\mathsf{fma}\left(3, y, 1\right) \cdot y}{x}\right) + y}{x \cdot \color{blue}{x}} \]
                    14. lower-*.f6474.9

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

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

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

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

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

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

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

                        \[\leadsto \frac{\frac{\left(-\frac{y}{x}\right) + y}{x}}{\color{blue}{x}} \]
                      5. lower-/.f6485.7

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

                        \[\leadsto \frac{\frac{\left(\mathsf{neg}\left(\frac{y}{x}\right)\right) + y}{x}}{x} \]
                      7. lift-/.f64N/A

                        \[\leadsto \frac{\frac{\left(\mathsf{neg}\left(\frac{y}{x}\right)\right) + y}{x}}{x} \]
                      8. distribute-neg-frac2N/A

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

                        \[\leadsto \frac{\frac{\frac{y}{\mathsf{neg}\left(x\right)} + y}{x}}{x} \]
                      10. lower-neg.f6485.7

                        \[\leadsto \frac{\frac{\frac{y}{-x} + y}{x}}{x} \]
                    3. Applied rewrites85.7%

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

                    if -1.06e7 < x < -1.9999999999999999e-129

                    1. Initial program 84.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      if -1.9999999999999999e-129 < x

                      1. Initial program 65.3%

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

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

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

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

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

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

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

                    Alternative 10: 78.6% accurate, 1.1× speedup?

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

                      1. Initial program 66.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto 2 \cdot \frac{y}{\color{blue}{2 \cdot x + 2 \cdot {x}^{2}}} \]
                        3. lower-fma.f64N/A

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

                          \[\leadsto 2 \cdot \frac{y}{\mathsf{fma}\left(2, x, 2 \cdot {x}^{2}\right)} \]
                        5. pow2N/A

                          \[\leadsto 2 \cdot \frac{y}{\mathsf{fma}\left(2, x, 2 \cdot \left(x \cdot x\right)\right)} \]
                        6. lift-*.f6480.5

                          \[\leadsto 2 \cdot \frac{y}{\mathsf{fma}\left(2, x, 2 \cdot \left(x \cdot x\right)\right)} \]
                      6. Applied rewrites80.5%

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

                      if 3.6e-72 < y

                      1. Initial program 71.0%

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

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

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

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

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

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

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

                    Alternative 11: 78.6% accurate, 1.7× speedup?

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

                      1. Initial program 66.2%

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

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

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

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

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

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

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

                      if 3.6e-72 < y

                      1. Initial program 71.0%

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

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

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

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

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

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

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

                    Alternative 12: 77.1% accurate, 1.7× speedup?

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

                      1. Initial program 66.3%

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

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

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

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

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

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

                      if -5.1e9 < x

                      1. Initial program 70.5%

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

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

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

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

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

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

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

                    Alternative 13: 70.6% accurate, 1.3× speedup?

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

                      1. Initial program 66.3%

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

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

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

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

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

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

                      if -5.1e9 < x < -3.70000000000000016e-180 or 1.75000000000000014e-163 < x

                      1. Initial program 74.3%

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

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

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

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

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

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

                      if -3.70000000000000016e-180 < x < 1.75000000000000014e-163

                      1. Initial program 64.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto x \cdot \frac{1}{y} \]
                      9. Recombined 3 regimes into one program.
                      10. Add Preprocessing

                      Alternative 14: 65.2% accurate, 2.2× speedup?

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

                        1. Initial program 66.3%

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

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

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

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

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

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

                        if -5.1e9 < x

                        1. Initial program 70.5%

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

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

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

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

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

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

                      Alternative 15: 37.3% accurate, 3.3× speedup?

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

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

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

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

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

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

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

                      Reproduce

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