Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1

Percentage Accurate: 87.3% → 99.6%
Time: 2.7s
Alternatives: 12
Speedup: 0.3×

Specification

?
\[\begin{array}{l} \\ \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1} \end{array} \]
(FPCore (x y) :precision binary64 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
double code(double x, double y) {
	return (x * ((x / y) + 1.0)) / (x + 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 * ((x / y) + 1.0d0)) / (x + 1.0d0)
end function
public static double code(double x, double y) {
	return (x * ((x / y) + 1.0)) / (x + 1.0);
}
def code(x, y):
	return (x * ((x / y) + 1.0)) / (x + 1.0)
function code(x, y)
	return Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
end
function tmp = code(x, y)
	tmp = (x * ((x / y) + 1.0)) / (x + 1.0);
end
code[x_, y_] := N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\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 12 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: 87.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1} \end{array} \]
(FPCore (x y) :precision binary64 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
double code(double x, double y) {
	return (x * ((x / y) + 1.0)) / (x + 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 * ((x / y) + 1.0d0)) / (x + 1.0d0)
end function
public static double code(double x, double y) {
	return (x * ((x / y) + 1.0)) / (x + 1.0);
}
def code(x, y):
	return (x * ((x / y) + 1.0)) / (x + 1.0)
function code(x, y)
	return Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
end
function tmp = code(x, y)
	tmp = (x * ((x / y) + 1.0)) / (x + 1.0);
end
code[x_, y_] := N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 99.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+225}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, 1 \cdot x\right)}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
   (if (<= t_0 (- INFINITY))
     (/ x y)
     (if (<= t_0 4e+225) (/ (fma (/ x y) x (* 1.0 x)) (+ x 1.0)) (/ x y)))))
double code(double x, double y) {
	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = x / y;
	} else if (t_0 <= 4e+225) {
		tmp = fma((x / y), x, (1.0 * x)) / (x + 1.0);
	} else {
		tmp = x / y;
	}
	return tmp;
}
function code(x, y)
	t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(x / y);
	elseif (t_0 <= 4e+225)
		tmp = Float64(fma(Float64(x / y), x, Float64(1.0 * x)) / Float64(x + 1.0));
	else
		tmp = Float64(x / y);
	end
	return tmp
end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 4e+225], N[(N[(N[(x / y), $MachinePrecision] * x + N[(1.0 * x), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+225}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, 1 \cdot x\right)}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -inf.0 or 3.99999999999999971e225 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 52.8%

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

      \[\leadsto \color{blue}{\frac{x}{y}} \]
    3. Step-by-step derivation
      1. lift-/.f6499.0

        \[\leadsto \frac{x}{\color{blue}{y}} \]
    4. Applied rewrites99.0%

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

    if -inf.0 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 3.99999999999999971e225

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

Alternative 2: 99.6% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+225}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
   (if (<= t_0 (- INFINITY)) (/ x y) (if (<= t_0 4e+225) t_0 (/ x y)))))
double code(double x, double y) {
	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = x / y;
	} else if (t_0 <= 4e+225) {
		tmp = t_0;
	} else {
		tmp = x / y;
	}
	return tmp;
}
public static double code(double x, double y) {
	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
	double tmp;
	if (t_0 <= -Double.POSITIVE_INFINITY) {
		tmp = x / y;
	} else if (t_0 <= 4e+225) {
		tmp = t_0;
	} else {
		tmp = x / y;
	}
	return tmp;
}
def code(x, y):
	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0)
	tmp = 0
	if t_0 <= -math.inf:
		tmp = x / y
	elif t_0 <= 4e+225:
		tmp = t_0
	else:
		tmp = x / y
	return tmp
function code(x, y)
	t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(x / y);
	elseif (t_0 <= 4e+225)
		tmp = t_0;
	else
		tmp = Float64(x / y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
	tmp = 0.0;
	if (t_0 <= -Inf)
		tmp = x / y;
	elseif (t_0 <= 4e+225)
		tmp = t_0;
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 4e+225], t$95$0, N[(x / y), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+225}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -inf.0 or 3.99999999999999971e225 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 52.8%

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

      \[\leadsto \color{blue}{\frac{x}{y}} \]
    3. Step-by-step derivation
      1. lift-/.f6499.0

        \[\leadsto \frac{x}{\color{blue}{y}} \]
    4. Applied rewrites99.0%

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

    if -inf.0 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 3.99999999999999971e225

    1. Initial program 99.9%

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

Alternative 3: 95.7% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\frac{x \cdot x}{x - -1}}{y}\\ t_1 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_1 \leq -20:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 10^{-12}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{1}\\ \mathbf{elif}\;t\_1 \leq 2:\\ \;\;\;\;\frac{x}{x - -1}\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+225}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (/ (* x x) (- x -1.0)) y))
        (t_1 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
   (if (<= t_1 (- INFINITY))
     (/ x y)
     (if (<= t_1 -20.0)
       t_0
       (if (<= t_1 1e-12)
         (/ (fma (/ x y) x x) 1.0)
         (if (<= t_1 2.0)
           (/ x (- x -1.0))
           (if (<= t_1 4e+225) t_0 (/ x y))))))))
double code(double x, double y) {
	double t_0 = ((x * x) / (x - -1.0)) / y;
	double t_1 = (x * ((x / y) + 1.0)) / (x + 1.0);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = x / y;
	} else if (t_1 <= -20.0) {
		tmp = t_0;
	} else if (t_1 <= 1e-12) {
		tmp = fma((x / y), x, x) / 1.0;
	} else if (t_1 <= 2.0) {
		tmp = x / (x - -1.0);
	} else if (t_1 <= 4e+225) {
		tmp = t_0;
	} else {
		tmp = x / y;
	}
	return tmp;
}
function code(x, y)
	t_0 = Float64(Float64(Float64(x * x) / Float64(x - -1.0)) / y)
	t_1 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(x / y);
	elseif (t_1 <= -20.0)
		tmp = t_0;
	elseif (t_1 <= 1e-12)
		tmp = Float64(fma(Float64(x / y), x, x) / 1.0);
	elseif (t_1 <= 2.0)
		tmp = Float64(x / Float64(x - -1.0));
	elseif (t_1 <= 4e+225)
		tmp = t_0;
	else
		tmp = Float64(x / y);
	end
	return tmp
end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(x * x), $MachinePrecision] / N[(x - -1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x / y), $MachinePrecision], If[LessEqual[t$95$1, -20.0], t$95$0, If[LessEqual[t$95$1, 1e-12], N[(N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision] / 1.0), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+225], t$95$0, N[(x / y), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\frac{x \cdot x}{x - -1}}{y}\\
t_1 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{elif}\;t\_1 \leq -20:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_1 \leq 10^{-12}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{1}\\

\mathbf{elif}\;t\_1 \leq 2:\\
\;\;\;\;\frac{x}{x - -1}\\

\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+225}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -inf.0 or 3.99999999999999971e225 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 52.8%

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

      \[\leadsto \color{blue}{\frac{x}{y}} \]
    3. Step-by-step derivation
      1. lift-/.f6499.0

        \[\leadsto \frac{x}{\color{blue}{y}} \]
    4. Applied rewrites99.0%

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

    if -inf.0 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -20 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 3.99999999999999971e225

    1. Initial program 99.7%

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

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

        \[\leadsto \frac{\frac{x \cdot y}{1 + x} + \frac{{x}^{2}}{1 + x}}{\color{blue}{y}} \]
      2. div-add-revN/A

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

        \[\leadsto \frac{\frac{x \cdot y + {x}^{2}}{1 + x}}{y} \]
      4. *-commutativeN/A

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

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

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

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

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

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

        \[\leadsto \frac{\frac{\mathsf{fma}\left(y, x, x \cdot x\right)}{x - -1}}{y} \]
      11. lower--.f6484.3

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

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

      \[\leadsto \frac{\frac{{x}^{2}}{x - -1}}{y} \]
    6. Step-by-step derivation
      1. pow2N/A

        \[\leadsto \frac{\frac{x \cdot x}{x - -1}}{y} \]
      2. lift-*.f6482.1

        \[\leadsto \frac{\frac{x \cdot x}{x - -1}}{y} \]
    7. Applied rewrites82.1%

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

    if -20 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 9.9999999999999998e-13

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

      if 9.9999999999999998e-13 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2

      1. Initial program 99.9%

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

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

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

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

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

          \[\leadsto \frac{x}{x - \color{blue}{-1}} \]
        5. lower--.f6493.3

          \[\leadsto \frac{x}{x - \color{blue}{-1}} \]
      4. Applied rewrites93.3%

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

    Alternative 4: 95.5% accurate, 0.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{+236}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq -20:\\ \;\;\;\;\frac{x \cdot x}{\left(x - -1\right) \cdot y}\\ \mathbf{elif}\;t\_0 \leq 10^{-12}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{1}\\ \mathbf{elif}\;t\_0 \leq 2:\\ \;\;\;\;\frac{x}{x - -1}\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+225}:\\ \;\;\;\;x \cdot \frac{x}{\mathsf{fma}\left(y, x, y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
    (FPCore (x y)
     :precision binary64
     (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
       (if (<= t_0 -4e+236)
         (/ x y)
         (if (<= t_0 -20.0)
           (/ (* x x) (* (- x -1.0) y))
           (if (<= t_0 1e-12)
             (/ (fma (/ x y) x x) 1.0)
             (if (<= t_0 2.0)
               (/ x (- x -1.0))
               (if (<= t_0 4e+225) (* x (/ x (fma y x y))) (/ x y))))))))
    double code(double x, double y) {
    	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
    	double tmp;
    	if (t_0 <= -4e+236) {
    		tmp = x / y;
    	} else if (t_0 <= -20.0) {
    		tmp = (x * x) / ((x - -1.0) * y);
    	} else if (t_0 <= 1e-12) {
    		tmp = fma((x / y), x, x) / 1.0;
    	} else if (t_0 <= 2.0) {
    		tmp = x / (x - -1.0);
    	} else if (t_0 <= 4e+225) {
    		tmp = x * (x / fma(y, x, y));
    	} else {
    		tmp = x / y;
    	}
    	return tmp;
    }
    
    function code(x, y)
    	t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
    	tmp = 0.0
    	if (t_0 <= -4e+236)
    		tmp = Float64(x / y);
    	elseif (t_0 <= -20.0)
    		tmp = Float64(Float64(x * x) / Float64(Float64(x - -1.0) * y));
    	elseif (t_0 <= 1e-12)
    		tmp = Float64(fma(Float64(x / y), x, x) / 1.0);
    	elseif (t_0 <= 2.0)
    		tmp = Float64(x / Float64(x - -1.0));
    	elseif (t_0 <= 4e+225)
    		tmp = Float64(x * Float64(x / fma(y, x, y)));
    	else
    		tmp = Float64(x / y);
    	end
    	return tmp
    end
    
    code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e+236], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, -20.0], N[(N[(x * x), $MachinePrecision] / N[(N[(x - -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e-12], N[(N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision] / 1.0), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+225], N[(x * N[(x / N[(y * x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
    \mathbf{if}\;t\_0 \leq -4 \cdot 10^{+236}:\\
    \;\;\;\;\frac{x}{y}\\
    
    \mathbf{elif}\;t\_0 \leq -20:\\
    \;\;\;\;\frac{x \cdot x}{\left(x - -1\right) \cdot y}\\
    
    \mathbf{elif}\;t\_0 \leq 10^{-12}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{1}\\
    
    \mathbf{elif}\;t\_0 \leq 2:\\
    \;\;\;\;\frac{x}{x - -1}\\
    
    \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+225}:\\
    \;\;\;\;x \cdot \frac{x}{\mathsf{fma}\left(y, x, y\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{x}{y}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 5 regimes
    2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -4.00000000000000021e236 or 3.99999999999999971e225 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

      1. Initial program 53.8%

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

        \[\leadsto \color{blue}{\frac{x}{y}} \]
      3. Step-by-step derivation
        1. lift-/.f6498.3

          \[\leadsto \frac{x}{\color{blue}{y}} \]
      4. Applied rewrites98.3%

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

      if -4.00000000000000021e236 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -20

      1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{x \cdot x}{\left(x - -1\right) \cdot y} \]
        9. lower--.f6481.0

          \[\leadsto \frac{x \cdot x}{\left(x - -1\right) \cdot y} \]
      4. Applied rewrites81.0%

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

      if -20 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 9.9999999999999998e-13

      1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

        if 9.9999999999999998e-13 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2

        1. Initial program 99.9%

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

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

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

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

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

            \[\leadsto \frac{x}{x - \color{blue}{-1}} \]
          5. lower--.f6493.3

            \[\leadsto \frac{x}{x - \color{blue}{-1}} \]
        4. Applied rewrites93.3%

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

        if 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 3.99999999999999971e225

        1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{x \cdot x}{y \cdot \left(x + \left(\mathsf{neg}\left(-1\right)\right)\right)} \]
          6. negate-subN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto x \cdot \frac{x}{y \cdot x + y} \]
          13. lower-fma.f6486.2

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

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

      Alternative 5: 95.3% accurate, 0.2× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \frac{x}{\mathsf{fma}\left(y, x, y\right)}\\ t_1 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ \mathbf{if}\;t\_1 \leq -1 \cdot 10^{+199}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_1 \leq -20:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 10^{-12}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{1}\\ \mathbf{elif}\;t\_1 \leq 2:\\ \;\;\;\;\frac{x}{x - -1}\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+225}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
      (FPCore (x y)
       :precision binary64
       (let* ((t_0 (* x (/ x (fma y x y))))
              (t_1 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
         (if (<= t_1 -1e+199)
           (/ x y)
           (if (<= t_1 -20.0)
             t_0
             (if (<= t_1 1e-12)
               (/ (fma (/ x y) x x) 1.0)
               (if (<= t_1 2.0)
                 (/ x (- x -1.0))
                 (if (<= t_1 4e+225) t_0 (/ x y))))))))
      double code(double x, double y) {
      	double t_0 = x * (x / fma(y, x, y));
      	double t_1 = (x * ((x / y) + 1.0)) / (x + 1.0);
      	double tmp;
      	if (t_1 <= -1e+199) {
      		tmp = x / y;
      	} else if (t_1 <= -20.0) {
      		tmp = t_0;
      	} else if (t_1 <= 1e-12) {
      		tmp = fma((x / y), x, x) / 1.0;
      	} else if (t_1 <= 2.0) {
      		tmp = x / (x - -1.0);
      	} else if (t_1 <= 4e+225) {
      		tmp = t_0;
      	} else {
      		tmp = x / y;
      	}
      	return tmp;
      }
      
      function code(x, y)
      	t_0 = Float64(x * Float64(x / fma(y, x, y)))
      	t_1 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
      	tmp = 0.0
      	if (t_1 <= -1e+199)
      		tmp = Float64(x / y);
      	elseif (t_1 <= -20.0)
      		tmp = t_0;
      	elseif (t_1 <= 1e-12)
      		tmp = Float64(fma(Float64(x / y), x, x) / 1.0);
      	elseif (t_1 <= 2.0)
      		tmp = Float64(x / Float64(x - -1.0));
      	elseif (t_1 <= 4e+225)
      		tmp = t_0;
      	else
      		tmp = Float64(x / y);
      	end
      	return tmp
      end
      
      code[x_, y_] := Block[{t$95$0 = N[(x * N[(x / N[(y * x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+199], N[(x / y), $MachinePrecision], If[LessEqual[t$95$1, -20.0], t$95$0, If[LessEqual[t$95$1, 1e-12], N[(N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision] / 1.0), $MachinePrecision], If[LessEqual[t$95$1, 2.0], N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+225], t$95$0, N[(x / y), $MachinePrecision]]]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := x \cdot \frac{x}{\mathsf{fma}\left(y, x, y\right)}\\
      t_1 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
      \mathbf{if}\;t\_1 \leq -1 \cdot 10^{+199}:\\
      \;\;\;\;\frac{x}{y}\\
      
      \mathbf{elif}\;t\_1 \leq -20:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;t\_1 \leq 10^{-12}:\\
      \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{1}\\
      
      \mathbf{elif}\;t\_1 \leq 2:\\
      \;\;\;\;\frac{x}{x - -1}\\
      
      \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+225}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{x}{y}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -1.0000000000000001e199 or 3.99999999999999971e225 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

        1. Initial program 55.0%

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

          \[\leadsto \color{blue}{\frac{x}{y}} \]
        3. Step-by-step derivation
          1. lift-/.f6497.4

            \[\leadsto \frac{x}{\color{blue}{y}} \]
        4. Applied rewrites97.4%

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

        if -1.0000000000000001e199 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -20 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 3.99999999999999971e225

        1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{x \cdot x}{y \cdot \left(x + \left(\mathsf{neg}\left(-1\right)\right)\right)} \]
          6. negate-subN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto x \cdot \frac{x}{y \cdot x + y} \]
          13. lower-fma.f6485.8

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

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

        if -20 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 9.9999999999999998e-13

        1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

          if 9.9999999999999998e-13 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2

          1. Initial program 99.9%

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

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

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

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

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

              \[\leadsto \frac{x}{x - \color{blue}{-1}} \]
            5. lower--.f6493.3

              \[\leadsto \frac{x}{x - \color{blue}{-1}} \]
          4. Applied rewrites93.3%

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

        Alternative 6: 90.0% accurate, 0.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \frac{x}{\mathsf{fma}\left(y, x, y\right)}\\ t_1 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ \mathbf{if}\;t\_1 \leq -1 \cdot 10^{+199}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_1 \leq -20:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 2:\\ \;\;\;\;\frac{x}{x - -1}\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+225}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
        (FPCore (x y)
         :precision binary64
         (let* ((t_0 (* x (/ x (fma y x y))))
                (t_1 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
           (if (<= t_1 -1e+199)
             (/ x y)
             (if (<= t_1 -20.0)
               t_0
               (if (<= t_1 2.0) (/ x (- x -1.0)) (if (<= t_1 4e+225) t_0 (/ x y)))))))
        double code(double x, double y) {
        	double t_0 = x * (x / fma(y, x, y));
        	double t_1 = (x * ((x / y) + 1.0)) / (x + 1.0);
        	double tmp;
        	if (t_1 <= -1e+199) {
        		tmp = x / y;
        	} else if (t_1 <= -20.0) {
        		tmp = t_0;
        	} else if (t_1 <= 2.0) {
        		tmp = x / (x - -1.0);
        	} else if (t_1 <= 4e+225) {
        		tmp = t_0;
        	} else {
        		tmp = x / y;
        	}
        	return tmp;
        }
        
        function code(x, y)
        	t_0 = Float64(x * Float64(x / fma(y, x, y)))
        	t_1 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
        	tmp = 0.0
        	if (t_1 <= -1e+199)
        		tmp = Float64(x / y);
        	elseif (t_1 <= -20.0)
        		tmp = t_0;
        	elseif (t_1 <= 2.0)
        		tmp = Float64(x / Float64(x - -1.0));
        	elseif (t_1 <= 4e+225)
        		tmp = t_0;
        	else
        		tmp = Float64(x / y);
        	end
        	return tmp
        end
        
        code[x_, y_] := Block[{t$95$0 = N[(x * N[(x / N[(y * x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+199], N[(x / y), $MachinePrecision], If[LessEqual[t$95$1, -20.0], t$95$0, If[LessEqual[t$95$1, 2.0], N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+225], t$95$0, N[(x / y), $MachinePrecision]]]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := x \cdot \frac{x}{\mathsf{fma}\left(y, x, y\right)}\\
        t_1 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
        \mathbf{if}\;t\_1 \leq -1 \cdot 10^{+199}:\\
        \;\;\;\;\frac{x}{y}\\
        
        \mathbf{elif}\;t\_1 \leq -20:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;t\_1 \leq 2:\\
        \;\;\;\;\frac{x}{x - -1}\\
        
        \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+225}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{x}{y}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -1.0000000000000001e199 or 3.99999999999999971e225 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

          1. Initial program 55.0%

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

            \[\leadsto \color{blue}{\frac{x}{y}} \]
          3. Step-by-step derivation
            1. lift-/.f6497.4

              \[\leadsto \frac{x}{\color{blue}{y}} \]
          4. Applied rewrites97.4%

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

          if -1.0000000000000001e199 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -20 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 3.99999999999999971e225

          1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{x \cdot x}{y \cdot \left(x + \left(\mathsf{neg}\left(-1\right)\right)\right)} \]
            6. negate-subN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto x \cdot \frac{x}{y \cdot x + y} \]
            13. lower-fma.f6485.8

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

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

          if -20 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2

          1. Initial program 99.9%

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

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

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

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

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

              \[\leadsto \frac{x}{x - \color{blue}{-1}} \]
            5. lower--.f6487.4

              \[\leadsto \frac{x}{x - \color{blue}{-1}} \]
          4. Applied rewrites87.4%

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

        Alternative 7: 86.4% accurate, 0.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ \mathbf{if}\;t\_0 \leq -20:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq 2:\\ \;\;\;\;\frac{x}{x - -1}\\ \mathbf{elif}\;t\_0 \leq 10^{+85}:\\ \;\;\;\;\frac{x}{y} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
        (FPCore (x y)
         :precision binary64
         (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
           (if (<= t_0 -20.0)
             (/ x y)
             (if (<= t_0 2.0)
               (/ x (- x -1.0))
               (if (<= t_0 1e+85) (* (/ x y) x) (/ x y))))))
        double code(double x, double y) {
        	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
        	double tmp;
        	if (t_0 <= -20.0) {
        		tmp = x / y;
        	} else if (t_0 <= 2.0) {
        		tmp = x / (x - -1.0);
        	} else if (t_0 <= 1e+85) {
        		tmp = (x / y) * x;
        	} else {
        		tmp = x / y;
        	}
        	return tmp;
        }
        
        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 * ((x / y) + 1.0d0)) / (x + 1.0d0)
            if (t_0 <= (-20.0d0)) then
                tmp = x / y
            else if (t_0 <= 2.0d0) then
                tmp = x / (x - (-1.0d0))
            else if (t_0 <= 1d+85) then
                tmp = (x / y) * x
            else
                tmp = x / y
            end if
            code = tmp
        end function
        
        public static double code(double x, double y) {
        	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
        	double tmp;
        	if (t_0 <= -20.0) {
        		tmp = x / y;
        	} else if (t_0 <= 2.0) {
        		tmp = x / (x - -1.0);
        	} else if (t_0 <= 1e+85) {
        		tmp = (x / y) * x;
        	} else {
        		tmp = x / y;
        	}
        	return tmp;
        }
        
        def code(x, y):
        	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0)
        	tmp = 0
        	if t_0 <= -20.0:
        		tmp = x / y
        	elif t_0 <= 2.0:
        		tmp = x / (x - -1.0)
        	elif t_0 <= 1e+85:
        		tmp = (x / y) * x
        	else:
        		tmp = x / y
        	return tmp
        
        function code(x, y)
        	t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
        	tmp = 0.0
        	if (t_0 <= -20.0)
        		tmp = Float64(x / y);
        	elseif (t_0 <= 2.0)
        		tmp = Float64(x / Float64(x - -1.0));
        	elseif (t_0 <= 1e+85)
        		tmp = Float64(Float64(x / y) * x);
        	else
        		tmp = Float64(x / y);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y)
        	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
        	tmp = 0.0;
        	if (t_0 <= -20.0)
        		tmp = x / y;
        	elseif (t_0 <= 2.0)
        		tmp = x / (x - -1.0);
        	elseif (t_0 <= 1e+85)
        		tmp = (x / y) * x;
        	else
        		tmp = x / y;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -20.0], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+85], N[(N[(x / y), $MachinePrecision] * x), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
        \mathbf{if}\;t\_0 \leq -20:\\
        \;\;\;\;\frac{x}{y}\\
        
        \mathbf{elif}\;t\_0 \leq 2:\\
        \;\;\;\;\frac{x}{x - -1}\\
        
        \mathbf{elif}\;t\_0 \leq 10^{+85}:\\
        \;\;\;\;\frac{x}{y} \cdot x\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{x}{y}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -20 or 1e85 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

          1. Initial program 68.2%

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

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

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

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

          if -20 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2

          1. Initial program 99.9%

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

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

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

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

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

              \[\leadsto \frac{x}{x - \color{blue}{-1}} \]
            5. lower--.f6487.4

              \[\leadsto \frac{x}{x - \color{blue}{-1}} \]
          4. Applied rewrites87.4%

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

          if 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 1e85

          1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{x \cdot x}{y \cdot \left(x + \left(\mathsf{neg}\left(-1\right)\right)\right)} \]
            6. negate-subN/A

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

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

              \[\leadsto \frac{x \cdot x}{\left(x - -1\right) \cdot \color{blue}{y}} \]
            9. lift--.f6470.4

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

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

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

              \[\leadsto \frac{x \cdot x}{y} \]
            2. associate-*l/N/A

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

              \[\leadsto \frac{x}{y} \cdot x \]
            4. lift-/.f6430.7

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

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

        Alternative 8: 85.1% accurate, 0.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ \mathbf{if}\;t\_0 \leq -20:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq 2:\\ \;\;\;\;\frac{x}{x - -1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
        (FPCore (x y)
         :precision binary64
         (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
           (if (<= t_0 -20.0) (/ x y) (if (<= t_0 2.0) (/ x (- x -1.0)) (/ x y)))))
        double code(double x, double y) {
        	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
        	double tmp;
        	if (t_0 <= -20.0) {
        		tmp = x / y;
        	} else if (t_0 <= 2.0) {
        		tmp = x / (x - -1.0);
        	} else {
        		tmp = x / y;
        	}
        	return tmp;
        }
        
        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 * ((x / y) + 1.0d0)) / (x + 1.0d0)
            if (t_0 <= (-20.0d0)) then
                tmp = x / y
            else if (t_0 <= 2.0d0) then
                tmp = x / (x - (-1.0d0))
            else
                tmp = x / y
            end if
            code = tmp
        end function
        
        public static double code(double x, double y) {
        	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
        	double tmp;
        	if (t_0 <= -20.0) {
        		tmp = x / y;
        	} else if (t_0 <= 2.0) {
        		tmp = x / (x - -1.0);
        	} else {
        		tmp = x / y;
        	}
        	return tmp;
        }
        
        def code(x, y):
        	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0)
        	tmp = 0
        	if t_0 <= -20.0:
        		tmp = x / y
        	elif t_0 <= 2.0:
        		tmp = x / (x - -1.0)
        	else:
        		tmp = x / y
        	return tmp
        
        function code(x, y)
        	t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
        	tmp = 0.0
        	if (t_0 <= -20.0)
        		tmp = Float64(x / y);
        	elseif (t_0 <= 2.0)
        		tmp = Float64(x / Float64(x - -1.0));
        	else
        		tmp = Float64(x / y);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y)
        	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
        	tmp = 0.0;
        	if (t_0 <= -20.0)
        		tmp = x / y;
        	elseif (t_0 <= 2.0)
        		tmp = x / (x - -1.0);
        	else
        		tmp = x / y;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -20.0], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
        \mathbf{if}\;t\_0 \leq -20:\\
        \;\;\;\;\frac{x}{y}\\
        
        \mathbf{elif}\;t\_0 \leq 2:\\
        \;\;\;\;\frac{x}{x - -1}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{x}{y}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -20 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

          1. Initial program 71.4%

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

            \[\leadsto \color{blue}{\frac{x}{y}} \]
          3. Step-by-step derivation
            1. lift-/.f6485.0

              \[\leadsto \frac{x}{\color{blue}{y}} \]
          4. Applied rewrites85.0%

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

          if -20 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2

          1. Initial program 99.9%

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

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

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

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

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

              \[\leadsto \frac{x}{x - \color{blue}{-1}} \]
            5. lower--.f6487.4

              \[\leadsto \frac{x}{x - \color{blue}{-1}} \]
          4. Applied rewrites87.4%

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

        Alternative 9: 84.9% accurate, 0.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ \mathbf{if}\;t\_0 \leq -20:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-22}:\\ \;\;\;\;x\\ \mathbf{elif}\;t\_0 \leq 2:\\ \;\;\;\;1 - \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
        (FPCore (x y)
         :precision binary64
         (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
           (if (<= t_0 -20.0)
             (/ x y)
             (if (<= t_0 2e-22) x (if (<= t_0 2.0) (- 1.0 (/ 1.0 x)) (/ x y))))))
        double code(double x, double y) {
        	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
        	double tmp;
        	if (t_0 <= -20.0) {
        		tmp = x / y;
        	} else if (t_0 <= 2e-22) {
        		tmp = x;
        	} else if (t_0 <= 2.0) {
        		tmp = 1.0 - (1.0 / x);
        	} else {
        		tmp = x / y;
        	}
        	return tmp;
        }
        
        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 * ((x / y) + 1.0d0)) / (x + 1.0d0)
            if (t_0 <= (-20.0d0)) then
                tmp = x / y
            else if (t_0 <= 2d-22) then
                tmp = x
            else if (t_0 <= 2.0d0) then
                tmp = 1.0d0 - (1.0d0 / x)
            else
                tmp = x / y
            end if
            code = tmp
        end function
        
        public static double code(double x, double y) {
        	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
        	double tmp;
        	if (t_0 <= -20.0) {
        		tmp = x / y;
        	} else if (t_0 <= 2e-22) {
        		tmp = x;
        	} else if (t_0 <= 2.0) {
        		tmp = 1.0 - (1.0 / x);
        	} else {
        		tmp = x / y;
        	}
        	return tmp;
        }
        
        def code(x, y):
        	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0)
        	tmp = 0
        	if t_0 <= -20.0:
        		tmp = x / y
        	elif t_0 <= 2e-22:
        		tmp = x
        	elif t_0 <= 2.0:
        		tmp = 1.0 - (1.0 / x)
        	else:
        		tmp = x / y
        	return tmp
        
        function code(x, y)
        	t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
        	tmp = 0.0
        	if (t_0 <= -20.0)
        		tmp = Float64(x / y);
        	elseif (t_0 <= 2e-22)
        		tmp = x;
        	elseif (t_0 <= 2.0)
        		tmp = Float64(1.0 - Float64(1.0 / x));
        	else
        		tmp = Float64(x / y);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y)
        	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
        	tmp = 0.0;
        	if (t_0 <= -20.0)
        		tmp = x / y;
        	elseif (t_0 <= 2e-22)
        		tmp = x;
        	elseif (t_0 <= 2.0)
        		tmp = 1.0 - (1.0 / x);
        	else
        		tmp = x / y;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -20.0], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 2e-22], x, If[LessEqual[t$95$0, 2.0], N[(1.0 - N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
        \mathbf{if}\;t\_0 \leq -20:\\
        \;\;\;\;\frac{x}{y}\\
        
        \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-22}:\\
        \;\;\;\;x\\
        
        \mathbf{elif}\;t\_0 \leq 2:\\
        \;\;\;\;1 - \frac{1}{x}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{x}{y}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -20 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

          1. Initial program 71.4%

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

            \[\leadsto \color{blue}{\frac{x}{y}} \]
          3. Step-by-step derivation
            1. lift-/.f6485.0

              \[\leadsto \frac{x}{\color{blue}{y}} \]
          4. Applied rewrites85.0%

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

          if -20 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2.0000000000000001e-22

          1. Initial program 99.9%

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

            \[\leadsto \color{blue}{x} \]
          3. Step-by-step derivation
            1. Applied rewrites85.4%

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

            if 2.0000000000000001e-22 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2

            1. Initial program 99.9%

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

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

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

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

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

                \[\leadsto \frac{x}{x - \color{blue}{-1}} \]
              5. lower--.f6491.8

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

              \[\leadsto \color{blue}{\frac{x}{x - -1}} \]
            5. Taylor expanded in x around inf

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

                \[\leadsto 1 - \frac{1}{\color{blue}{x}} \]
              2. lower-/.f6484.3

                \[\leadsto 1 - \frac{1}{x} \]
            7. Applied rewrites84.3%

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

          Alternative 10: 83.8% accurate, 0.3× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ \mathbf{if}\;t\_0 \leq -20:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-22}:\\ \;\;\;\;x\\ \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+42}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
          (FPCore (x y)
           :precision binary64
           (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
             (if (<= t_0 -20.0)
               (/ x y)
               (if (<= t_0 2e-22) x (if (<= t_0 4e+42) 1.0 (/ x y))))))
          double code(double x, double y) {
          	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
          	double tmp;
          	if (t_0 <= -20.0) {
          		tmp = x / y;
          	} else if (t_0 <= 2e-22) {
          		tmp = x;
          	} else if (t_0 <= 4e+42) {
          		tmp = 1.0;
          	} else {
          		tmp = x / y;
          	}
          	return tmp;
          }
          
          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 * ((x / y) + 1.0d0)) / (x + 1.0d0)
              if (t_0 <= (-20.0d0)) then
                  tmp = x / y
              else if (t_0 <= 2d-22) then
                  tmp = x
              else if (t_0 <= 4d+42) then
                  tmp = 1.0d0
              else
                  tmp = x / y
              end if
              code = tmp
          end function
          
          public static double code(double x, double y) {
          	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
          	double tmp;
          	if (t_0 <= -20.0) {
          		tmp = x / y;
          	} else if (t_0 <= 2e-22) {
          		tmp = x;
          	} else if (t_0 <= 4e+42) {
          		tmp = 1.0;
          	} else {
          		tmp = x / y;
          	}
          	return tmp;
          }
          
          def code(x, y):
          	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0)
          	tmp = 0
          	if t_0 <= -20.0:
          		tmp = x / y
          	elif t_0 <= 2e-22:
          		tmp = x
          	elif t_0 <= 4e+42:
          		tmp = 1.0
          	else:
          		tmp = x / y
          	return tmp
          
          function code(x, y)
          	t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
          	tmp = 0.0
          	if (t_0 <= -20.0)
          		tmp = Float64(x / y);
          	elseif (t_0 <= 2e-22)
          		tmp = x;
          	elseif (t_0 <= 4e+42)
          		tmp = 1.0;
          	else
          		tmp = Float64(x / y);
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y)
          	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
          	tmp = 0.0;
          	if (t_0 <= -20.0)
          		tmp = x / y;
          	elseif (t_0 <= 2e-22)
          		tmp = x;
          	elseif (t_0 <= 4e+42)
          		tmp = 1.0;
          	else
          		tmp = x / y;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -20.0], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 2e-22], x, If[LessEqual[t$95$0, 4e+42], 1.0, N[(x / y), $MachinePrecision]]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
          \mathbf{if}\;t\_0 \leq -20:\\
          \;\;\;\;\frac{x}{y}\\
          
          \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-22}:\\
          \;\;\;\;x\\
          
          \mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+42}:\\
          \;\;\;\;1\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{x}{y}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -20 or 4.00000000000000018e42 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

            1. Initial program 69.8%

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

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

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

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

            if -20 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2.0000000000000001e-22

            1. Initial program 99.9%

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

              \[\leadsto \color{blue}{x} \]
            3. Step-by-step derivation
              1. Applied rewrites85.4%

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

              if 2.0000000000000001e-22 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 4.00000000000000018e42

              1. Initial program 99.9%

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

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

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

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

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

                  \[\leadsto \frac{x}{x - \color{blue}{-1}} \]
                5. lower--.f6479.1

                  \[\leadsto \frac{x}{x - \color{blue}{-1}} \]
              4. Applied rewrites79.1%

                \[\leadsto \color{blue}{\frac{x}{x - -1}} \]
              5. Taylor expanded in x around inf

                \[\leadsto 1 \]
              6. Step-by-step derivation
                1. Applied rewrites72.2%

                  \[\leadsto 1 \]
              7. Recombined 3 regimes into one program.
              8. Add Preprocessing

              Alternative 11: 49.2% accurate, 0.8× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1} \leq 2 \cdot 10^{-22}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
              (FPCore (x y)
               :precision binary64
               (if (<= (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)) 2e-22) x 1.0))
              double code(double x, double y) {
              	double tmp;
              	if (((x * ((x / y) + 1.0)) / (x + 1.0)) <= 2e-22) {
              		tmp = x;
              	} else {
              		tmp = 1.0;
              	}
              	return tmp;
              }
              
              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 * ((x / y) + 1.0d0)) / (x + 1.0d0)) <= 2d-22) then
                      tmp = x
                  else
                      tmp = 1.0d0
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y) {
              	double tmp;
              	if (((x * ((x / y) + 1.0)) / (x + 1.0)) <= 2e-22) {
              		tmp = x;
              	} else {
              		tmp = 1.0;
              	}
              	return tmp;
              }
              
              def code(x, y):
              	tmp = 0
              	if ((x * ((x / y) + 1.0)) / (x + 1.0)) <= 2e-22:
              		tmp = x
              	else:
              		tmp = 1.0
              	return tmp
              
              function code(x, y)
              	tmp = 0.0
              	if (Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) <= 2e-22)
              		tmp = x;
              	else
              		tmp = 1.0;
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y)
              	tmp = 0.0;
              	if (((x * ((x / y) + 1.0)) / (x + 1.0)) <= 2e-22)
              		tmp = x;
              	else
              		tmp = 1.0;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_] := If[LessEqual[N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 2e-22], x, 1.0]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1} \leq 2 \cdot 10^{-22}:\\
              \;\;\;\;x\\
              
              \mathbf{else}:\\
              \;\;\;\;1\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2.0000000000000001e-22

                1. Initial program 90.6%

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

                  \[\leadsto \color{blue}{x} \]
                3. Step-by-step derivation
                  1. Applied rewrites57.5%

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

                  if 2.0000000000000001e-22 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

                  1. Initial program 81.5%

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

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

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

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

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

                      \[\leadsto \frac{x}{x - \color{blue}{-1}} \]
                    5. lower--.f6437.2

                      \[\leadsto \frac{x}{x - \color{blue}{-1}} \]
                  4. Applied rewrites37.2%

                    \[\leadsto \color{blue}{\frac{x}{x - -1}} \]
                  5. Taylor expanded in x around inf

                    \[\leadsto 1 \]
                  6. Step-by-step derivation
                    1. Applied rewrites34.3%

                      \[\leadsto 1 \]
                  7. Recombined 2 regimes into one program.
                  8. Add Preprocessing

                  Alternative 12: 38.7% accurate, 16.1× speedup?

                  \[\begin{array}{l} \\ x \end{array} \]
                  (FPCore (x y) :precision binary64 x)
                  double code(double x, double y) {
                  	return x;
                  }
                  
                  module fmin_fmax_functions
                      implicit none
                      private
                      public fmax
                      public fmin
                  
                      interface fmax
                          module procedure fmax88
                          module procedure fmax44
                          module procedure fmax84
                          module procedure fmax48
                      end interface
                      interface fmin
                          module procedure fmin88
                          module procedure fmin44
                          module procedure fmin84
                          module procedure fmin48
                      end interface
                  contains
                      real(8) function fmax88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmax44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmax84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmax48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                      end function
                      real(8) function fmin88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmin44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmin84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmin48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                      end function
                  end module
                  
                  real(8) function code(x, y)
                  use fmin_fmax_functions
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      code = x
                  end function
                  
                  public static double code(double x, double y) {
                  	return x;
                  }
                  
                  def code(x, y):
                  	return x
                  
                  function code(x, y)
                  	return x
                  end
                  
                  function tmp = code(x, y)
                  	tmp = x;
                  end
                  
                  code[x_, y_] := x
                  
                  \begin{array}{l}
                  
                  \\
                  x
                  \end{array}
                  
                  Derivation
                  1. Initial program 87.3%

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

                    \[\leadsto \color{blue}{x} \]
                  3. Step-by-step derivation
                    1. Applied rewrites38.7%

                      \[\leadsto \color{blue}{x} \]
                    2. Add Preprocessing

                    Reproduce

                    ?
                    herbie shell --seed 2025110 
                    (FPCore (x y)
                      :name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"
                      :precision binary64
                      (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))