Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1

Percentage Accurate: 88.5% → 99.8%
Time: 2.6s
Alternatives: 13
Speedup: 0.8×

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 13 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: 88.5% 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.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 -\infty:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+263}:\\ \;\;\;\;\frac{\frac{x}{y} \cdot x + 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 (- INFINITY))
     (/ x y)
     (if (<= t_0 5e+263) (/ (+ (* (/ x y) x) 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 <= 5e+263) {
		tmp = (((x / y) * x) + x) / (x + 1.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 <= 5e+263) {
		tmp = (((x / y) * x) + 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 <= -math.inf:
		tmp = x / y
	elif t_0 <= 5e+263:
		tmp = (((x / y) * x) + 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 <= 5e+263)
		tmp = Float64(Float64(Float64(Float64(x / y) * x) + 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 <= -Inf)
		tmp = x / y;
	elseif (t_0 <= 5e+263)
		tmp = (((x / y) * x) + 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, (-Infinity)], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 5e+263], N[(N[(N[(N[(x / y), $MachinePrecision] * x), $MachinePrecision] + x), $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 5 \cdot 10^{+263}:\\
\;\;\;\;\frac{\frac{x}{y} \cdot x + 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))) < -inf.0 or 5.00000000000000022e263 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 53.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-/.f6499.4

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

      \[\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))) < 5.00000000000000022e263

    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. *-lft-identityN/A

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y} \cdot x} + x}{x + 1} \]
      8. lift-/.f6499.9

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

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

Alternative 2: 95.3% 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 -\infty:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq -10000:\\ \;\;\;\;\frac{x \cdot \frac{x}{y}}{x + 1}\\ \mathbf{elif}\;t\_0 \leq 0.2:\\ \;\;\;\;\frac{\frac{x}{y} \cdot x + x}{1}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+48}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{x}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{x}{\mathsf{fma}\left(y, x, y\right)}\\ \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 -10000.0)
       (/ (* x (/ x y)) (+ x 1.0))
       (if (<= t_0 0.2)
         (/ (+ (* (/ x y) x) x) 1.0)
         (if (<= t_0 2e+48)
           (/ (fma (/ x y) x x) x)
           (* x (/ x (fma 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 <= -((double) INFINITY)) {
		tmp = x / y;
	} else if (t_0 <= -10000.0) {
		tmp = (x * (x / y)) / (x + 1.0);
	} else if (t_0 <= 0.2) {
		tmp = (((x / y) * x) + x) / 1.0;
	} else if (t_0 <= 2e+48) {
		tmp = fma((x / y), x, x) / x;
	} else {
		tmp = x * (x / fma(y, 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 <= -10000.0)
		tmp = Float64(Float64(x * Float64(x / y)) / Float64(x + 1.0));
	elseif (t_0 <= 0.2)
		tmp = Float64(Float64(Float64(Float64(x / y) * x) + x) / 1.0);
	elseif (t_0 <= 2e+48)
		tmp = Float64(fma(Float64(x / y), x, x) / x);
	else
		tmp = Float64(x * Float64(x / fma(y, 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, -10000.0], N[(N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.2], N[(N[(N[(N[(x / y), $MachinePrecision] * x), $MachinePrecision] + x), $MachinePrecision] / 1.0), $MachinePrecision], If[LessEqual[t$95$0, 2e+48], N[(N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision] / x), $MachinePrecision], N[(x * N[(x / N[(y * x + y), $MachinePrecision]), $MachinePrecision]), $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 -10000:\\
\;\;\;\;\frac{x \cdot \frac{x}{y}}{x + 1}\\

\mathbf{elif}\;t\_0 \leq 0.2:\\
\;\;\;\;\frac{\frac{x}{y} \cdot x + x}{1}\\

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

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{x}{\mathsf{fma}\left(y, x, y\right)}\\


\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))) < -inf.0

    1. Initial program 51.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-/.f6499.9

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

      \[\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))) < -1e4

    1. Initial program 99.8%

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

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

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

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

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

    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 rewrites98.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{\color{blue}{\frac{x}{y} \cdot x} + x}{1} \]
        9. lift-/.f6498.5

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

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

      if 0.20000000000000001 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2.00000000000000009e48

      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. *-lft-identityN/A

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

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

          \[\leadsto \frac{\color{blue}{\frac{x}{y} \cdot x} + x}{x + 1} \]
        8. lift-/.f6499.9

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

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

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

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

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

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

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

            \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}}{x} \]
          5. lift-/.f6490.4

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

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

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

        1. Initial program 70.5%

          \[\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}{y \cdot \left(x + \color{blue}{1}\right)} \]
          5. distribute-lft-inN/A

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

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

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

          \[\leadsto \color{blue}{\frac{x \cdot x}{\mathsf{fma}\left(y, x, y\right)}} \]
        5. Step-by-step derivation
          1. *-commutative72.7

            \[\leadsto \frac{\color{blue}{x} \cdot x}{\mathsf{fma}\left(y, x, y\right)} \]
          2. distribute-lft1-in72.7

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

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

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

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

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

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

            \[\leadsto x \cdot \frac{x}{\color{blue}{y \cdot x + y}} \]
          9. lift-fma.f6487.1

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

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

      Alternative 3: 95.3% accurate, 0.2× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ t_1 := \mathsf{fma}\left(\frac{x}{y}, x, x\right)\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq -10000:\\ \;\;\;\;\frac{x \cdot \frac{x}{y}}{x + 1}\\ \mathbf{elif}\;t\_0 \leq 0.2:\\ \;\;\;\;\frac{t\_1}{1}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+48}:\\ \;\;\;\;\frac{t\_1}{x}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{x}{\mathsf{fma}\left(y, x, y\right)}\\ \end{array} \end{array} \]
      (FPCore (x y)
       :precision binary64
       (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))) (t_1 (fma (/ x y) x x)))
         (if (<= t_0 (- INFINITY))
           (/ x y)
           (if (<= t_0 -10000.0)
             (/ (* x (/ x y)) (+ x 1.0))
             (if (<= t_0 0.2)
               (/ t_1 1.0)
               (if (<= t_0 2e+48) (/ t_1 x) (* x (/ x (fma y x y)))))))))
      double code(double x, double y) {
      	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
      	double t_1 = fma((x / y), x, x);
      	double tmp;
      	if (t_0 <= -((double) INFINITY)) {
      		tmp = x / y;
      	} else if (t_0 <= -10000.0) {
      		tmp = (x * (x / y)) / (x + 1.0);
      	} else if (t_0 <= 0.2) {
      		tmp = t_1 / 1.0;
      	} else if (t_0 <= 2e+48) {
      		tmp = t_1 / x;
      	} else {
      		tmp = x * (x / fma(y, x, y));
      	}
      	return tmp;
      }
      
      function code(x, y)
      	t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
      	t_1 = fma(Float64(x / y), x, x)
      	tmp = 0.0
      	if (t_0 <= Float64(-Inf))
      		tmp = Float64(x / y);
      	elseif (t_0 <= -10000.0)
      		tmp = Float64(Float64(x * Float64(x / y)) / Float64(x + 1.0));
      	elseif (t_0 <= 0.2)
      		tmp = Float64(t_1 / 1.0);
      	elseif (t_0 <= 2e+48)
      		tmp = Float64(t_1 / x);
      	else
      		tmp = Float64(x * Float64(x / fma(y, 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]}, Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, -10000.0], N[(N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.2], N[(t$95$1 / 1.0), $MachinePrecision], If[LessEqual[t$95$0, 2e+48], N[(t$95$1 / x), $MachinePrecision], N[(x * N[(x / N[(y * x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
      t_1 := \mathsf{fma}\left(\frac{x}{y}, x, x\right)\\
      \mathbf{if}\;t\_0 \leq -\infty:\\
      \;\;\;\;\frac{x}{y}\\
      
      \mathbf{elif}\;t\_0 \leq -10000:\\
      \;\;\;\;\frac{x \cdot \frac{x}{y}}{x + 1}\\
      
      \mathbf{elif}\;t\_0 \leq 0.2:\\
      \;\;\;\;\frac{t\_1}{1}\\
      
      \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+48}:\\
      \;\;\;\;\frac{t\_1}{x}\\
      
      \mathbf{else}:\\
      \;\;\;\;x \cdot \frac{x}{\mathsf{fma}\left(y, x, y\right)}\\
      
      
      \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))) < -inf.0

        1. Initial program 51.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-/.f6499.9

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

          \[\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))) < -1e4

        1. Initial program 99.8%

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

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

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

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

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

        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 rewrites98.5%

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

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

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

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

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

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

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

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

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

          if 0.20000000000000001 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2.00000000000000009e48

          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. *-lft-identityN/A

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

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

              \[\leadsto \frac{\color{blue}{\frac{x}{y} \cdot x} + x}{x + 1} \]
            8. lift-/.f6499.9

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

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

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

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

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

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

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

                \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}}{x} \]
              5. lift-/.f6490.4

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

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

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

            1. Initial program 70.5%

              \[\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}{y \cdot \left(x + \color{blue}{1}\right)} \]
              5. distribute-lft-inN/A

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

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

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

              \[\leadsto \color{blue}{\frac{x \cdot x}{\mathsf{fma}\left(y, x, y\right)}} \]
            5. Step-by-step derivation
              1. *-commutative72.7

                \[\leadsto \frac{\color{blue}{x} \cdot x}{\mathsf{fma}\left(y, x, y\right)} \]
              2. distribute-lft1-in72.7

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

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

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

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

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

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

                \[\leadsto x \cdot \frac{x}{\color{blue}{y \cdot x + y}} \]
              9. lift-fma.f6487.1

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

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

          Alternative 4: 94.2% accurate, 0.2× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ t_1 := \mathsf{fma}\left(\frac{x}{y}, x, x\right)\\ \mathbf{if}\;t\_0 \leq -5 \cdot 10^{+201}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-6}:\\ \;\;\;\;\left(y + x\right) \cdot \frac{x}{\left(x - -1\right) \cdot y}\\ \mathbf{elif}\;t\_0 \leq 0.2:\\ \;\;\;\;\frac{t\_1}{1}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+48}:\\ \;\;\;\;\frac{t\_1}{x}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{x}{\mathsf{fma}\left(y, x, y\right)}\\ \end{array} \end{array} \]
          (FPCore (x y)
           :precision binary64
           (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))) (t_1 (fma (/ x y) x x)))
             (if (<= t_0 -5e+201)
               (/ x y)
               (if (<= t_0 -1e-6)
                 (* (+ y x) (/ x (* (- x -1.0) y)))
                 (if (<= t_0 0.2)
                   (/ t_1 1.0)
                   (if (<= t_0 2e+48) (/ t_1 x) (* x (/ x (fma y x y)))))))))
          double code(double x, double y) {
          	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
          	double t_1 = fma((x / y), x, x);
          	double tmp;
          	if (t_0 <= -5e+201) {
          		tmp = x / y;
          	} else if (t_0 <= -1e-6) {
          		tmp = (y + x) * (x / ((x - -1.0) * y));
          	} else if (t_0 <= 0.2) {
          		tmp = t_1 / 1.0;
          	} else if (t_0 <= 2e+48) {
          		tmp = t_1 / x;
          	} else {
          		tmp = x * (x / fma(y, x, y));
          	}
          	return tmp;
          }
          
          function code(x, y)
          	t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
          	t_1 = fma(Float64(x / y), x, x)
          	tmp = 0.0
          	if (t_0 <= -5e+201)
          		tmp = Float64(x / y);
          	elseif (t_0 <= -1e-6)
          		tmp = Float64(Float64(y + x) * Float64(x / Float64(Float64(x - -1.0) * y)));
          	elseif (t_0 <= 0.2)
          		tmp = Float64(t_1 / 1.0);
          	elseif (t_0 <= 2e+48)
          		tmp = Float64(t_1 / x);
          	else
          		tmp = Float64(x * Float64(x / fma(y, 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]}, Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+201], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, -1e-6], N[(N[(y + x), $MachinePrecision] * N[(x / N[(N[(x - -1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.2], N[(t$95$1 / 1.0), $MachinePrecision], If[LessEqual[t$95$0, 2e+48], N[(t$95$1 / x), $MachinePrecision], N[(x * N[(x / N[(y * x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
          t_1 := \mathsf{fma}\left(\frac{x}{y}, x, x\right)\\
          \mathbf{if}\;t\_0 \leq -5 \cdot 10^{+201}:\\
          \;\;\;\;\frac{x}{y}\\
          
          \mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-6}:\\
          \;\;\;\;\left(y + x\right) \cdot \frac{x}{\left(x - -1\right) \cdot y}\\
          
          \mathbf{elif}\;t\_0 \leq 0.2:\\
          \;\;\;\;\frac{t\_1}{1}\\
          
          \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+48}:\\
          \;\;\;\;\frac{t\_1}{x}\\
          
          \mathbf{else}:\\
          \;\;\;\;x \cdot \frac{x}{\mathsf{fma}\left(y, x, y\right)}\\
          
          
          \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.9999999999999995e201

            1. Initial program 55.7%

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

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

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

            if -4.9999999999999995e201 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -9.99999999999999955e-7

            1. Initial program 99.8%

              \[\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}} \]
            4. Applied rewrites80.3%

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

                \[\leadsto \frac{\frac{\color{blue}{x \cdot \left(y + x\right)}}{x - -1}}{y} \]
              2. distribute-lft1-in80.3

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if -9.99999999999999955e-7 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 0.20000000000000001

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

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

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

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

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

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

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

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

              if 0.20000000000000001 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2.00000000000000009e48

              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. *-lft-identityN/A

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

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

                  \[\leadsto \frac{\color{blue}{\frac{x}{y} \cdot x} + x}{x + 1} \]
                8. lift-/.f6499.9

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

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

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

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

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

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

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

                    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}}{x} \]
                  5. lift-/.f6490.4

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

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

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

                1. Initial program 70.5%

                  \[\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}{y \cdot \left(x + \color{blue}{1}\right)} \]
                  5. distribute-lft-inN/A

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

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

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

                  \[\leadsto \color{blue}{\frac{x \cdot x}{\mathsf{fma}\left(y, x, y\right)}} \]
                5. Step-by-step derivation
                  1. *-commutative72.7

                    \[\leadsto \frac{\color{blue}{x} \cdot x}{\mathsf{fma}\left(y, x, y\right)} \]
                  2. distribute-lft1-in72.7

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

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

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

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

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

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

                    \[\leadsto x \cdot \frac{x}{\color{blue}{y \cdot x + y}} \]
                  9. lift-fma.f6487.1

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

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

              Alternative 5: 94.2% accurate, 0.2× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(y + x\right) \cdot \frac{x}{\left(x - -1\right) \cdot y}\\ t_1 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+201}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-6}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 0.2:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{1}\\ \mathbf{elif}\;t\_1 \leq 1.1:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
              (FPCore (x y)
               :precision binary64
               (let* ((t_0 (* (+ y x) (/ x (* (- x -1.0) y))))
                      (t_1 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
                 (if (<= t_1 -5e+201)
                   (/ x y)
                   (if (<= t_1 -1e-6)
                     t_0
                     (if (<= t_1 0.2)
                       (/ (fma (/ x y) x x) 1.0)
                       (if (<= t_1 1.1) (/ x (+ x 1.0)) t_0))))))
              double code(double x, double y) {
              	double t_0 = (y + x) * (x / ((x - -1.0) * y));
              	double t_1 = (x * ((x / y) + 1.0)) / (x + 1.0);
              	double tmp;
              	if (t_1 <= -5e+201) {
              		tmp = x / y;
              	} else if (t_1 <= -1e-6) {
              		tmp = t_0;
              	} else if (t_1 <= 0.2) {
              		tmp = fma((x / y), x, x) / 1.0;
              	} else if (t_1 <= 1.1) {
              		tmp = x / (x + 1.0);
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              function code(x, y)
              	t_0 = Float64(Float64(y + x) * Float64(x / Float64(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 <= -5e+201)
              		tmp = Float64(x / y);
              	elseif (t_1 <= -1e-6)
              		tmp = t_0;
              	elseif (t_1 <= 0.2)
              		tmp = Float64(fma(Float64(x / y), x, x) / 1.0);
              	elseif (t_1 <= 1.1)
              		tmp = Float64(x / Float64(x + 1.0));
              	else
              		tmp = t_0;
              	end
              	return tmp
              end
              
              code[x_, y_] := Block[{t$95$0 = N[(N[(y + x), $MachinePrecision] * N[(x / N[(N[(x - -1.0), $MachinePrecision] * 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, -5e+201], N[(x / y), $MachinePrecision], If[LessEqual[t$95$1, -1e-6], t$95$0, If[LessEqual[t$95$1, 0.2], N[(N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision] / 1.0), $MachinePrecision], If[LessEqual[t$95$1, 1.1], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \left(y + x\right) \cdot \frac{x}{\left(x - -1\right) \cdot y}\\
              t_1 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
              \mathbf{if}\;t\_1 \leq -5 \cdot 10^{+201}:\\
              \;\;\;\;\frac{x}{y}\\
              
              \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-6}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;t\_1 \leq 0.2:\\
              \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{1}\\
              
              \mathbf{elif}\;t\_1 \leq 1.1:\\
              \;\;\;\;\frac{x}{x + 1}\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_0\\
              
              
              \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))) < -4.9999999999999995e201

                1. Initial program 55.7%

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

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

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

                if -4.9999999999999995e201 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -9.99999999999999955e-7 or 1.1000000000000001 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

                1. Initial program 81.6%

                  \[\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}} \]
                4. Applied rewrites74.8%

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

                    \[\leadsto \frac{\frac{\color{blue}{x \cdot \left(y + x\right)}}{x - -1}}{y} \]
                  2. distribute-lft1-in74.8

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if -9.99999999999999955e-7 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 0.20000000000000001

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

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

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

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

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

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

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

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

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

                  1. Initial program 100.0%

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

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

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

                  Alternative 6: 86.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 -5 \cdot 10^{+201}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq -3 \cdot 10^{+80}:\\ \;\;\;\;\frac{x \cdot x}{\mathsf{fma}\left(y, x, y\right)}\\ \mathbf{elif}\;t\_0 \leq -1000:\\ \;\;\;\;\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 -5e+201)
                       (/ x y)
                       (if (<= t_0 -3e+80)
                         (/ (* x x) (fma y x y))
                         (if (<= t_0 -1000.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 <= -5e+201) {
                  		tmp = x / y;
                  	} else if (t_0 <= -3e+80) {
                  		tmp = (x * x) / fma(y, x, y);
                  	} else if (t_0 <= -1000.0) {
                  		tmp = x / y;
                  	} else if (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 <= -5e+201)
                  		tmp = Float64(x / y);
                  	elseif (t_0 <= -3e+80)
                  		tmp = Float64(Float64(x * x) / fma(y, x, y));
                  	elseif (t_0 <= -1000.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
                  
                  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, -5e+201], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, -3e+80], N[(N[(x * x), $MachinePrecision] / N[(y * x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -1000.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 -5 \cdot 10^{+201}:\\
                  \;\;\;\;\frac{x}{y}\\
                  
                  \mathbf{elif}\;t\_0 \leq -3 \cdot 10^{+80}:\\
                  \;\;\;\;\frac{x \cdot x}{\mathsf{fma}\left(y, x, y\right)}\\
                  
                  \mathbf{elif}\;t\_0 \leq -1000:\\
                  \;\;\;\;\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 3 regimes
                  2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -4.9999999999999995e201 or -2.99999999999999987e80 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -1e3 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

                    1. Initial program 70.6%

                      \[\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.9

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

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

                    if -4.9999999999999995e201 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -2.99999999999999987e80

                    1. Initial program 99.8%

                      \[\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}{y \cdot \left(x + \color{blue}{1}\right)} \]
                      5. distribute-lft-inN/A

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

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

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

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

                    if -1e3 < (/.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 x around 0

                      \[\leadsto \frac{\color{blue}{x}}{x + 1} \]
                    3. Step-by-step derivation
                      1. Applied rewrites86.9%

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

                    Alternative 7: 87.3% 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 -5 \cdot 10^{+201}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq -1000:\\ \;\;\;\;x \cdot \frac{x}{\mathsf{fma}\left(y, x, y\right)}\\ \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 -5e+201)
                         (/ x y)
                         (if (<= t_0 -1000.0)
                           (* x (/ x (fma y 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 <= -5e+201) {
                    		tmp = x / y;
                    	} else if (t_0 <= -1000.0) {
                    		tmp = x * (x / fma(y, x, y));
                    	} else if (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 <= -5e+201)
                    		tmp = Float64(x / y);
                    	elseif (t_0 <= -1000.0)
                    		tmp = Float64(x * Float64(x / fma(y, x, y)));
                    	elseif (t_0 <= 2.0)
                    		tmp = Float64(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, -5e+201], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, -1000.0], N[(x * N[(x / N[(y * x + y), $MachinePrecision]), $MachinePrecision]), $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 -5 \cdot 10^{+201}:\\
                    \;\;\;\;\frac{x}{y}\\
                    
                    \mathbf{elif}\;t\_0 \leq -1000:\\
                    \;\;\;\;x \cdot \frac{x}{\mathsf{fma}\left(y, x, y\right)}\\
                    
                    \mathbf{elif}\;t\_0 \leq 2:\\
                    \;\;\;\;\frac{x}{x + 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))) < -4.9999999999999995e201 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

                      1. Initial program 67.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-/.f6488.2

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

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

                      if -4.9999999999999995e201 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -1e3

                      1. Initial program 99.8%

                        \[\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}{y \cdot \left(x + \color{blue}{1}\right)} \]
                        5. distribute-lft-inN/A

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

                          \[\leadsto \frac{x \cdot x}{y \cdot x + y} \]
                        7. lower-fma.f6478.1

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

                        \[\leadsto \color{blue}{\frac{x \cdot x}{\mathsf{fma}\left(y, x, y\right)}} \]
                      5. Step-by-step derivation
                        1. *-commutative78.1

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

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

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

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

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

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

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

                          \[\leadsto x \cdot \frac{x}{\color{blue}{y \cdot x + y}} \]
                        9. lift-fma.f6485.7

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

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

                      if -1e3 < (/.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 x around 0

                        \[\leadsto \frac{\color{blue}{x}}{x + 1} \]
                      3. Step-by-step derivation
                        1. Applied rewrites86.9%

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

                      Alternative 8: 84.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 -1000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-5}:\\ \;\;\;\;x\\ \mathbf{elif}\;t\_0 \leq 2:\\ \;\;\;\;\frac{x}{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 -1000.0)
                           (/ x y)
                           (if (<= t_0 5e-5) x (if (<= t_0 2.0) (/ x 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 <= -1000.0) {
                      		tmp = x / y;
                      	} else if (t_0 <= 5e-5) {
                      		tmp = x;
                      	} else if (t_0 <= 2.0) {
                      		tmp = x / 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 <= (-1000.0d0)) then
                              tmp = x / y
                          else if (t_0 <= 5d-5) then
                              tmp = x
                          else if (t_0 <= 2.0d0) then
                              tmp = x / 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 <= -1000.0) {
                      		tmp = x / y;
                      	} else if (t_0 <= 5e-5) {
                      		tmp = x;
                      	} else if (t_0 <= 2.0) {
                      		tmp = x / 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 <= -1000.0:
                      		tmp = x / y
                      	elif t_0 <= 5e-5:
                      		tmp = x
                      	elif t_0 <= 2.0:
                      		tmp = x / 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 <= -1000.0)
                      		tmp = Float64(x / y);
                      	elseif (t_0 <= 5e-5)
                      		tmp = x;
                      	elseif (t_0 <= 2.0)
                      		tmp = Float64(x / 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 <= -1000.0)
                      		tmp = x / y;
                      	elseif (t_0 <= 5e-5)
                      		tmp = x;
                      	elseif (t_0 <= 2.0)
                      		tmp = x / 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, -1000.0], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 5e-5], x, If[LessEqual[t$95$0, 2.0], N[(x / 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 -1000:\\
                      \;\;\;\;\frac{x}{y}\\
                      
                      \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-5}:\\
                      \;\;\;\;x\\
                      
                      \mathbf{elif}\;t\_0 \leq 2:\\
                      \;\;\;\;\frac{x}{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))) < -1e3 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

                        1. Initial program 73.3%

                          \[\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-/.f6483.9

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

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

                        if -1e3 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 5.00000000000000024e-5

                        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 rewrites84.0%

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

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

                          1. Initial program 100.0%

                            \[\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. *-lft-identityN/A

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

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

                              \[\leadsto \frac{\color{blue}{\frac{x}{y} \cdot x} + x}{x + 1} \]
                            8. lift-/.f64100.0

                              \[\leadsto \frac{\color{blue}{\frac{x}{y}} \cdot x + x}{x + 1} \]
                          3. Applied rewrites100.0%

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

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

                              \[\leadsto \frac{\frac{x}{y} \cdot x + x}{\color{blue}{x}} \]
                            2. Taylor expanded in x around 0

                              \[\leadsto \frac{\color{blue}{x}}{x} \]
                            3. Step-by-step derivation
                              1. Applied rewrites90.0%

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

                            Alternative 9: 99.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 -\infty:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+263}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, 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 5e+263) (/ (fma (/ x y) x 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 <= 5e+263) {
                            		tmp = fma((x / y), x, 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 <= 5e+263)
                            		tmp = Float64(fma(Float64(x / y), x, 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, 5e+263], N[(N[(N[(x / y), $MachinePrecision] * x + x), $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 5 \cdot 10^{+263}:\\
                            \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, 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 5.00000000000000022e263 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

                              1. Initial program 53.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-/.f6499.4

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

                                \[\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))) < 5.00000000000000022e263

                              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. *-lft-identityN/A

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

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

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

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

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

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

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

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

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

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

                            Alternative 10: 85.6% 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 -1000:\\ \;\;\;\;\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 -1000.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 <= -1000.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 <= (-1000.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 <= -1000.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 <= -1000.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 <= -1000.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 <= -1000.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, -1000.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 -1000:\\
                            \;\;\;\;\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))) < -1e3 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

                              1. Initial program 73.3%

                                \[\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-/.f6483.9

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

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

                              if -1e3 < (/.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 x around 0

                                \[\leadsto \frac{\color{blue}{x}}{x + 1} \]
                              3. Step-by-step derivation
                                1. Applied rewrites86.9%

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

                              Alternative 11: 74.3% 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 -1000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq 0.9999999999994632:\\ \;\;\;\;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 -1000.0) (/ x y) (if (<= t_0 0.9999999999994632) 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 <= -1000.0) {
                              		tmp = x / y;
                              	} else if (t_0 <= 0.9999999999994632) {
                              		tmp = 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 <= (-1000.0d0)) then
                                      tmp = x / y
                                  else if (t_0 <= 0.9999999999994632d0) then
                                      tmp = 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 <= -1000.0) {
                              		tmp = x / y;
                              	} else if (t_0 <= 0.9999999999994632) {
                              		tmp = 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 <= -1000.0:
                              		tmp = x / y
                              	elif t_0 <= 0.9999999999994632:
                              		tmp = 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 <= -1000.0)
                              		tmp = Float64(x / y);
                              	elseif (t_0 <= 0.9999999999994632)
                              		tmp = 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 <= -1000.0)
                              		tmp = x / y;
                              	elseif (t_0 <= 0.9999999999994632)
                              		tmp = 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, -1000.0], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 0.9999999999994632], x, 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 -1000:\\
                              \;\;\;\;\frac{x}{y}\\
                              
                              \mathbf{elif}\;t\_0 \leq 0.9999999999994632:\\
                              \;\;\;\;x\\
                              
                              \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))) < -1e3 or 0.999999999999463207 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

                                1. Initial program 78.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-/.f6467.7

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

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

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

                                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 rewrites82.1%

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

                                Alternative 12: 91.1% accurate, 0.8× speedup?

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

                                  1. Initial program 92.3%

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

                                    \[\leadsto \frac{\color{blue}{x}}{x + 1} \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites82.0%

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

                                    if -3.80000000000000006e72 < y < 1.59999999999999987e135

                                    1. Initial program 86.6%

                                      \[\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}} \]
                                    4. Applied rewrites77.6%

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

                                        \[\leadsto \frac{\frac{\color{blue}{x \cdot \left(y + x\right)}}{x - -1}}{y} \]
                                      2. distribute-lft1-in77.6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  Alternative 13: 39.8% accurate, 34.0× 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 88.5%

                                    \[\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 rewrites39.8%

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

                                    Developer Target 1: 99.8% accurate, 0.8× speedup?

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

                                    Reproduce

                                    ?
                                    herbie shell --seed 2025105 
                                    (FPCore (x y)
                                      :name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"
                                      :precision binary64
                                    
                                      :alt
                                      (! :herbie-platform default (* (/ x 1) (/ (+ (/ x y) 1) (+ x 1))))
                                    
                                      (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))