Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1

Percentage Accurate: 88.0% → 99.9%
Time: 2.7s
Alternatives: 12
Speedup: 0.3×

Specification

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

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

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

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

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 88.0% 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.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ t_1 := \frac{x}{\frac{y}{x} + y}\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{+147}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 200000000000:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))) (t_1 (/ x (+ (/ y x) y))))
   (if (<= t_0 -1e+147) t_1 (if (<= t_0 200000000000.0) t_0 t_1))))
double code(double x, double y) {
	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
	double t_1 = x / ((y / x) + y);
	double tmp;
	if (t_0 <= -1e+147) {
		tmp = t_1;
	} else if (t_0 <= 200000000000.0) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
    t_1 = x / ((y / x) + y)
    if (t_0 <= (-1d+147)) then
        tmp = t_1
    else if (t_0 <= 200000000000.0d0) then
        tmp = t_0
    else
        tmp = t_1
    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 t_1 = x / ((y / x) + y);
	double tmp;
	if (t_0 <= -1e+147) {
		tmp = t_1;
	} else if (t_0 <= 200000000000.0) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y):
	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0)
	t_1 = x / ((y / x) + y)
	tmp = 0
	if t_0 <= -1e+147:
		tmp = t_1
	elif t_0 <= 200000000000.0:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y)
	t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
	t_1 = Float64(x / Float64(Float64(y / x) + y))
	tmp = 0.0
	if (t_0 <= -1e+147)
		tmp = t_1;
	elseif (t_0 <= 200000000000.0)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
	t_1 = x / ((y / x) + y);
	tmp = 0.0;
	if (t_0 <= -1e+147)
		tmp = t_1;
	elseif (t_0 <= 200000000000.0)
		tmp = t_0;
	else
		tmp = t_1;
	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]}, Block[{t$95$1 = N[(x / N[(N[(y / x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+147], t$95$1, If[LessEqual[t$95$0, 200000000000.0], t$95$0, t$95$1]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_0 \leq 200000000000:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


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

    1. Initial program 67.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{\frac{y}{x} + y} \]
      3. lower-/.f6499.8

        \[\leadsto \frac{x}{\frac{y}{x} + y} \]
    9. Applied rewrites99.8%

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

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

    1. Initial program 99.9%

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

Alternative 2: 99.9% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_0 \leq 200000000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{x - -1}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


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

    1. Initial program 67.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{\frac{y}{x} + y} \]
      3. lower-/.f6499.8

        \[\leadsto \frac{x}{\frac{y}{x} + y} \]
    9. Applied rewrites99.8%

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

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

    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 3: 98.6% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(\frac{x}{y} + 1\right)\\ t_1 := \frac{t\_0}{x + 1}\\ t_2 := \frac{x}{\frac{y}{x} + y}\\ \mathbf{if}\;t\_1 \leq -2000000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 0.05:\\ \;\;\;\;\mathsf{fma}\left(\frac{1}{y} - 1, x, 1\right) \cdot x\\ \mathbf{elif}\;t\_1 \leq 2000:\\ \;\;\;\;\frac{t\_0}{x}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* x (+ (/ x y) 1.0)))
        (t_1 (/ t_0 (+ x 1.0)))
        (t_2 (/ x (+ (/ y x) y))))
   (if (<= t_1 -2000000.0)
     t_2
     (if (<= t_1 0.05)
       (* (fma (- (/ 1.0 y) 1.0) x 1.0) x)
       (if (<= t_1 2000.0) (/ t_0 x) t_2)))))
double code(double x, double y) {
	double t_0 = x * ((x / y) + 1.0);
	double t_1 = t_0 / (x + 1.0);
	double t_2 = x / ((y / x) + y);
	double tmp;
	if (t_1 <= -2000000.0) {
		tmp = t_2;
	} else if (t_1 <= 0.05) {
		tmp = fma(((1.0 / y) - 1.0), x, 1.0) * x;
	} else if (t_1 <= 2000.0) {
		tmp = t_0 / x;
	} else {
		tmp = t_2;
	}
	return tmp;
}
function code(x, y)
	t_0 = Float64(x * Float64(Float64(x / y) + 1.0))
	t_1 = Float64(t_0 / Float64(x + 1.0))
	t_2 = Float64(x / Float64(Float64(y / x) + y))
	tmp = 0.0
	if (t_1 <= -2000000.0)
		tmp = t_2;
	elseif (t_1 <= 0.05)
		tmp = Float64(fma(Float64(Float64(1.0 / y) - 1.0), x, 1.0) * x);
	elseif (t_1 <= 2000.0)
		tmp = Float64(t_0 / x);
	else
		tmp = t_2;
	end
	return tmp
end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[(N[(y / x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2000000.0], t$95$2, If[LessEqual[t$95$1, 0.05], N[(N[(N[(N[(1.0 / y), $MachinePrecision] - 1.0), $MachinePrecision] * x + 1.0), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$1, 2000.0], N[(t$95$0 / x), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;t\_1 \leq 2000:\\
\;\;\;\;\frac{t\_0}{x}\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\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))) < -2e6 or 2e3 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 72.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{\frac{y}{x} + y} \]
      3. lower-/.f6499.2

        \[\leadsto \frac{x}{\frac{y}{x} + y} \]
    9. Applied rewrites99.2%

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

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

    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 \cdot \left(1 + x \cdot \left(\frac{1}{y} - 1\right)\right)} \]
    3. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{1}{y} - 1, x, 1\right) \cdot x \]
      7. lower-/.f6498.9

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

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

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

    1. Initial program 100.0%

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

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

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

    Alternative 4: 98.4% accurate, 0.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \left(\frac{x}{y} + 1\right)\\ t_1 := \frac{t\_0}{x + 1}\\ t_2 := \frac{x}{\frac{y}{x} + y}\\ \mathbf{if}\;t\_1 \leq -2000000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t\_1 \leq 0.05:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{1}\\ \mathbf{elif}\;t\_1 \leq 2000:\\ \;\;\;\;\frac{t\_0}{x}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
    (FPCore (x y)
     :precision binary64
     (let* ((t_0 (* x (+ (/ x y) 1.0)))
            (t_1 (/ t_0 (+ x 1.0)))
            (t_2 (/ x (+ (/ y x) y))))
       (if (<= t_1 -2000000.0)
         t_2
         (if (<= t_1 0.05)
           (/ (fma (/ x y) x x) 1.0)
           (if (<= t_1 2000.0) (/ t_0 x) t_2)))))
    double code(double x, double y) {
    	double t_0 = x * ((x / y) + 1.0);
    	double t_1 = t_0 / (x + 1.0);
    	double t_2 = x / ((y / x) + y);
    	double tmp;
    	if (t_1 <= -2000000.0) {
    		tmp = t_2;
    	} else if (t_1 <= 0.05) {
    		tmp = fma((x / y), x, x) / 1.0;
    	} else if (t_1 <= 2000.0) {
    		tmp = t_0 / x;
    	} else {
    		tmp = t_2;
    	}
    	return tmp;
    }
    
    function code(x, y)
    	t_0 = Float64(x * Float64(Float64(x / y) + 1.0))
    	t_1 = Float64(t_0 / Float64(x + 1.0))
    	t_2 = Float64(x / Float64(Float64(y / x) + y))
    	tmp = 0.0
    	if (t_1 <= -2000000.0)
    		tmp = t_2;
    	elseif (t_1 <= 0.05)
    		tmp = Float64(fma(Float64(x / y), x, x) / 1.0);
    	elseif (t_1 <= 2000.0)
    		tmp = Float64(t_0 / x);
    	else
    		tmp = t_2;
    	end
    	return tmp
    end
    
    code[x_, y_] := Block[{t$95$0 = N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[(N[(y / x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2000000.0], t$95$2, If[LessEqual[t$95$1, 0.05], N[(N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision] / 1.0), $MachinePrecision], If[LessEqual[t$95$1, 2000.0], N[(t$95$0 / x), $MachinePrecision], t$95$2]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := x \cdot \left(\frac{x}{y} + 1\right)\\
    t_1 := \frac{t\_0}{x + 1}\\
    t_2 := \frac{x}{\frac{y}{x} + y}\\
    \mathbf{if}\;t\_1 \leq -2000000:\\
    \;\;\;\;t\_2\\
    
    \mathbf{elif}\;t\_1 \leq 0.05:\\
    \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{1}\\
    
    \mathbf{elif}\;t\_1 \leq 2000:\\
    \;\;\;\;\frac{t\_0}{x}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_2\\
    
    
    \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))) < -2e6 or 2e3 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

      1. Initial program 72.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \frac{x}{\frac{y}{x} + y} \]
        3. lower-/.f6499.2

          \[\leadsto \frac{x}{\frac{y}{x} + y} \]
      9. Applied rewrites99.2%

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

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

      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}} \]
      4. Taylor expanded in x around 0

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{\color{blue}{1}} \]
      5. Step-by-step derivation
        1. Applied rewrites98.4%

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

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

        1. Initial program 100.0%

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

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

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

        Alternative 5: 98.4% accurate, 0.2× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x}{\frac{y}{x} + y}\\ t_1 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ t_2 := \mathsf{fma}\left(\frac{x}{y}, x, x\right)\\ \mathbf{if}\;t\_1 \leq -2000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq 0.05:\\ \;\;\;\;\frac{t\_2}{1}\\ \mathbf{elif}\;t\_1 \leq 2000:\\ \;\;\;\;\frac{t\_2}{x}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (x y)
         :precision binary64
         (let* ((t_0 (/ x (+ (/ y x) y)))
                (t_1 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
                (t_2 (fma (/ x y) x x)))
           (if (<= t_1 -2000000.0)
             t_0
             (if (<= t_1 0.05) (/ t_2 1.0) (if (<= t_1 2000.0) (/ t_2 x) t_0)))))
        double code(double x, double y) {
        	double t_0 = x / ((y / x) + y);
        	double t_1 = (x * ((x / y) + 1.0)) / (x + 1.0);
        	double t_2 = fma((x / y), x, x);
        	double tmp;
        	if (t_1 <= -2000000.0) {
        		tmp = t_0;
        	} else if (t_1 <= 0.05) {
        		tmp = t_2 / 1.0;
        	} else if (t_1 <= 2000.0) {
        		tmp = t_2 / x;
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        function code(x, y)
        	t_0 = Float64(x / Float64(Float64(y / x) + y))
        	t_1 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
        	t_2 = fma(Float64(x / y), x, x)
        	tmp = 0.0
        	if (t_1 <= -2000000.0)
        		tmp = t_0;
        	elseif (t_1 <= 0.05)
        		tmp = Float64(t_2 / 1.0);
        	elseif (t_1 <= 2000.0)
        		tmp = Float64(t_2 / x);
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        code[x_, y_] := Block[{t$95$0 = N[(x / N[(N[(y / x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision]}, If[LessEqual[t$95$1, -2000000.0], t$95$0, If[LessEqual[t$95$1, 0.05], N[(t$95$2 / 1.0), $MachinePrecision], If[LessEqual[t$95$1, 2000.0], N[(t$95$2 / x), $MachinePrecision], t$95$0]]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \frac{x}{\frac{y}{x} + y}\\
        t_1 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
        t_2 := \mathsf{fma}\left(\frac{x}{y}, x, x\right)\\
        \mathbf{if}\;t\_1 \leq -2000000:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;t\_1 \leq 0.05:\\
        \;\;\;\;\frac{t\_2}{1}\\
        
        \mathbf{elif}\;t\_1 \leq 2000:\\
        \;\;\;\;\frac{t\_2}{x}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \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))) < -2e6 or 2e3 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

          1. Initial program 72.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{x}{\frac{y}{x} + y} \]
            3. lower-/.f6499.2

              \[\leadsto \frac{x}{\frac{y}{x} + y} \]
          9. Applied rewrites99.2%

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

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

          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}} \]
          4. Taylor expanded in x around 0

            \[\leadsto \frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{\color{blue}{1}} \]
          5. Step-by-step derivation
            1. Applied rewrites98.4%

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

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

            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-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}} \]
            4. Taylor expanded in x around inf

              \[\leadsto \frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{\color{blue}{x}} \]
            5. Step-by-step derivation
              1. Applied rewrites95.6%

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

            Alternative 6: 98.1% 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 := \frac{x}{\frac{y}{x} + y}\\ \mathbf{if}\;t\_0 \leq -2000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-28}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{1}\\ \mathbf{elif}\;t\_0 \leq 2:\\ \;\;\;\;\frac{x}{x - -1}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
            (FPCore (x y)
             :precision binary64
             (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))) (t_1 (/ x (+ (/ y x) y))))
               (if (<= t_0 -2000000.0)
                 t_1
                 (if (<= t_0 5e-28)
                   (/ (fma (/ x y) x x) 1.0)
                   (if (<= t_0 2.0) (/ x (- x -1.0)) t_1)))))
            double code(double x, double y) {
            	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
            	double t_1 = x / ((y / x) + y);
            	double tmp;
            	if (t_0 <= -2000000.0) {
            		tmp = t_1;
            	} else if (t_0 <= 5e-28) {
            		tmp = fma((x / y), x, x) / 1.0;
            	} else if (t_0 <= 2.0) {
            		tmp = x / (x - -1.0);
            	} else {
            		tmp = t_1;
            	}
            	return tmp;
            }
            
            function code(x, y)
            	t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
            	t_1 = Float64(x / Float64(Float64(y / x) + y))
            	tmp = 0.0
            	if (t_0 <= -2000000.0)
            		tmp = t_1;
            	elseif (t_0 <= 5e-28)
            		tmp = Float64(fma(Float64(x / y), x, x) / 1.0);
            	elseif (t_0 <= 2.0)
            		tmp = Float64(x / Float64(x - -1.0));
            	else
            		tmp = t_1;
            	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[(x / N[(N[(y / x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2000000.0], t$95$1, If[LessEqual[t$95$0, 5e-28], N[(N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision] / 1.0), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
            t_1 := \frac{x}{\frac{y}{x} + y}\\
            \mathbf{if}\;t\_0 \leq -2000000:\\
            \;\;\;\;t\_1\\
            
            \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-28}:\\
            \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{1}\\
            
            \mathbf{elif}\;t\_0 \leq 2:\\
            \;\;\;\;\frac{x}{x - -1}\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_1\\
            
            
            \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))) < -2e6 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

              1. Initial program 72.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{x}{\frac{y}{x} + y} \]
                3. lower-/.f6499.0

                  \[\leadsto \frac{x}{\frac{y}{x} + y} \]
              9. Applied rewrites99.0%

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

              if -2e6 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 5.0000000000000002e-28

              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}} \]
              4. Taylor expanded in x around 0

                \[\leadsto \frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{\color{blue}{1}} \]
              5. Step-by-step derivation
                1. Applied rewrites98.8%

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

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

                1. Initial program 99.9%

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

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

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

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

                    \[\leadsto \frac{x}{x + 1 \cdot \color{blue}{1}} \]
                  4. fp-cancel-sign-sub-invN/A

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

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

                    \[\leadsto \frac{x}{x - -1} \]
                  7. lower--.f6492.7

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

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

              Alternative 7: 92.3% accurate, 0.3× speedup?

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

                1. Initial program 72.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \frac{x}{\frac{y}{x} + y} \]
                  3. lower-/.f6499.0

                    \[\leadsto \frac{x}{\frac{y}{x} + y} \]
                9. Applied rewrites99.0%

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

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

                1. Initial program 99.9%

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

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

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

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

                    \[\leadsto \frac{x}{x + 1 \cdot \color{blue}{1}} \]
                  4. fp-cancel-sign-sub-invN/A

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

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

                    \[\leadsto \frac{x}{x - -1} \]
                  7. lower--.f6487.1

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

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

              Alternative 8: 85.5% 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 -2000000:\\ \;\;\;\;\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 -2000000.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 <= -2000000.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 <= (-2000000.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 <= -2000000.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 <= -2000000.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 <= -2000000.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 <= -2000000.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, -2000000.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 -2000000:\\
              \;\;\;\;\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))) < -2e6 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

                1. Initial program 72.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-/.f6483.3

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

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

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

                1. Initial program 99.9%

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

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

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

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

                    \[\leadsto \frac{x}{x + 1 \cdot \color{blue}{1}} \]
                  4. fp-cancel-sign-sub-invN/A

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

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

                    \[\leadsto \frac{x}{x - -1} \]
                  7. lower--.f6487.1

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

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

              Alternative 9: 84.9% accurate, 0.3× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ \mathbf{if}\;t\_0 \leq -2000000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq 0.05:\\ \;\;\;\;x\\ \mathbf{elif}\;t\_0 \leq 2:\\ \;\;\;\;1 - \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
              (FPCore (x y)
               :precision binary64
               (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
                 (if (<= t_0 -2000000.0)
                   (/ x y)
                   (if (<= t_0 0.05) x (if (<= t_0 2.0) (- 1.0 (/ 1.0 x)) (/ x y))))))
              double code(double x, double y) {
              	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
              	double tmp;
              	if (t_0 <= -2000000.0) {
              		tmp = x / y;
              	} else if (t_0 <= 0.05) {
              		tmp = x;
              	} else if (t_0 <= 2.0) {
              		tmp = 1.0 - (1.0 / x);
              	} else {
              		tmp = x / y;
              	}
              	return tmp;
              }
              
              module fmin_fmax_functions
                  implicit none
                  private
                  public fmax
                  public fmin
              
                  interface fmax
                      module procedure fmax88
                      module procedure fmax44
                      module procedure fmax84
                      module procedure fmax48
                  end interface
                  interface fmin
                      module procedure fmin88
                      module procedure fmin44
                      module procedure fmin84
                      module procedure fmin48
                  end interface
              contains
                  real(8) function fmax88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmax44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmax84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmax48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                  end function
                  real(8) function fmin88(x, y) result (res)
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(4) function fmin44(x, y) result (res)
                      real(4), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                  end function
                  real(8) function fmin84(x, y) result(res)
                      real(8), intent (in) :: x
                      real(4), intent (in) :: y
                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                  end function
                  real(8) function fmin48(x, y) result(res)
                      real(4), intent (in) :: x
                      real(8), intent (in) :: y
                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                  end function
              end module
              
              real(8) function code(x, y)
              use fmin_fmax_functions
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  real(8) :: t_0
                  real(8) :: tmp
                  t_0 = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
                  if (t_0 <= (-2000000.0d0)) then
                      tmp = x / y
                  else if (t_0 <= 0.05d0) then
                      tmp = x
                  else if (t_0 <= 2.0d0) then
                      tmp = 1.0d0 - (1.0d0 / x)
                  else
                      tmp = x / y
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y) {
              	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
              	double tmp;
              	if (t_0 <= -2000000.0) {
              		tmp = x / y;
              	} else if (t_0 <= 0.05) {
              		tmp = x;
              	} else if (t_0 <= 2.0) {
              		tmp = 1.0 - (1.0 / x);
              	} else {
              		tmp = x / y;
              	}
              	return tmp;
              }
              
              def code(x, y):
              	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0)
              	tmp = 0
              	if t_0 <= -2000000.0:
              		tmp = x / y
              	elif t_0 <= 0.05:
              		tmp = x
              	elif t_0 <= 2.0:
              		tmp = 1.0 - (1.0 / x)
              	else:
              		tmp = x / y
              	return tmp
              
              function code(x, y)
              	t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
              	tmp = 0.0
              	if (t_0 <= -2000000.0)
              		tmp = Float64(x / y);
              	elseif (t_0 <= 0.05)
              		tmp = x;
              	elseif (t_0 <= 2.0)
              		tmp = Float64(1.0 - Float64(1.0 / x));
              	else
              		tmp = Float64(x / y);
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y)
              	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
              	tmp = 0.0;
              	if (t_0 <= -2000000.0)
              		tmp = x / y;
              	elseif (t_0 <= 0.05)
              		tmp = x;
              	elseif (t_0 <= 2.0)
              		tmp = 1.0 - (1.0 / x);
              	else
              		tmp = x / y;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2000000.0], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 0.05], x, If[LessEqual[t$95$0, 2.0], N[(1.0 - N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
              \mathbf{if}\;t\_0 \leq -2000000:\\
              \;\;\;\;\frac{x}{y}\\
              
              \mathbf{elif}\;t\_0 \leq 0.05:\\
              \;\;\;\;x\\
              
              \mathbf{elif}\;t\_0 \leq 2:\\
              \;\;\;\;1 - \frac{1}{x}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{x}{y}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -2e6 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

                1. Initial program 72.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-/.f6483.3

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{1}{\frac{1}{x} + \color{blue}{1}} \]
                    4. lift-/.f6495.4

                      \[\leadsto \frac{1}{\frac{1}{x} + 1} \]
                  6. Applied rewrites95.4%

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

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

                      \[\leadsto 1 - \frac{1}{\color{blue}{x}} \]
                    2. lift-/.f6493.6

                      \[\leadsto 1 - \frac{1}{x} \]
                  9. Applied rewrites93.6%

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

                Alternative 10: 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 -2000000:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq 0.0001:\\ \;\;\;\;x\\ \mathbf{elif}\;t\_0 \leq 2:\\ \;\;\;\;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 -2000000.0)
                     (/ x y)
                     (if (<= t_0 0.0001) x (if (<= t_0 2.0) 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 <= -2000000.0) {
                		tmp = x / y;
                	} else if (t_0 <= 0.0001) {
                		tmp = x;
                	} else if (t_0 <= 2.0) {
                		tmp = 1.0;
                	} else {
                		tmp = x / y;
                	}
                	return tmp;
                }
                
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(x, y)
                use fmin_fmax_functions
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    real(8) :: t_0
                    real(8) :: tmp
                    t_0 = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
                    if (t_0 <= (-2000000.0d0)) then
                        tmp = x / y
                    else if (t_0 <= 0.0001d0) then
                        tmp = x
                    else if (t_0 <= 2.0d0) then
                        tmp = 1.0d0
                    else
                        tmp = x / y
                    end if
                    code = tmp
                end function
                
                public static double code(double x, double y) {
                	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
                	double tmp;
                	if (t_0 <= -2000000.0) {
                		tmp = x / y;
                	} else if (t_0 <= 0.0001) {
                		tmp = x;
                	} else if (t_0 <= 2.0) {
                		tmp = 1.0;
                	} else {
                		tmp = x / y;
                	}
                	return tmp;
                }
                
                def code(x, y):
                	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0)
                	tmp = 0
                	if t_0 <= -2000000.0:
                		tmp = x / y
                	elif t_0 <= 0.0001:
                		tmp = x
                	elif t_0 <= 2.0:
                		tmp = 1.0
                	else:
                		tmp = x / y
                	return tmp
                
                function code(x, y)
                	t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
                	tmp = 0.0
                	if (t_0 <= -2000000.0)
                		tmp = Float64(x / y);
                	elseif (t_0 <= 0.0001)
                		tmp = x;
                	elseif (t_0 <= 2.0)
                		tmp = 1.0;
                	else
                		tmp = Float64(x / y);
                	end
                	return tmp
                end
                
                function tmp_2 = code(x, y)
                	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
                	tmp = 0.0;
                	if (t_0 <= -2000000.0)
                		tmp = x / y;
                	elseif (t_0 <= 0.0001)
                		tmp = x;
                	elseif (t_0 <= 2.0)
                		tmp = 1.0;
                	else
                		tmp = x / y;
                	end
                	tmp_2 = tmp;
                end
                
                code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2000000.0], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 0.0001], x, If[LessEqual[t$95$0, 2.0], 1.0, N[(x / y), $MachinePrecision]]]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
                \mathbf{if}\;t\_0 \leq -2000000:\\
                \;\;\;\;\frac{x}{y}\\
                
                \mathbf{elif}\;t\_0 \leq 0.0001:\\
                \;\;\;\;x\\
                
                \mathbf{elif}\;t\_0 \leq 2:\\
                \;\;\;\;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))) < -2e6 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

                  1. Initial program 72.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-/.f6483.3

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

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

                  if -2e6 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 1.00000000000000005e-4

                  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.2%

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

                    if 1.00000000000000005e-4 < (/.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{x \cdot \left(\frac{x}{y} + 1\right)}{\color{blue}{x + 1}} \]
                      2. *-rgt-identityN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \frac{1}{\frac{1}{x} + \color{blue}{1}} \]
                      4. lift-/.f6495.0

                        \[\leadsto \frac{1}{\frac{1}{x} + 1} \]
                    6. Applied rewrites95.0%

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

                      \[\leadsto 1 \]
                    8. Step-by-step derivation
                      1. Applied rewrites90.8%

                        \[\leadsto 1 \]
                    9. Recombined 3 regimes into one program.
                    10. Add Preprocessing

                    Alternative 11: 50.1% accurate, 0.8× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1} \leq 0.0001:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
                    (FPCore (x y)
                     :precision binary64
                     (if (<= (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)) 0.0001) x 1.0))
                    double code(double x, double y) {
                    	double tmp;
                    	if (((x * ((x / y) + 1.0)) / (x + 1.0)) <= 0.0001) {
                    		tmp = x;
                    	} else {
                    		tmp = 1.0;
                    	}
                    	return tmp;
                    }
                    
                    module fmin_fmax_functions
                        implicit none
                        private
                        public fmax
                        public fmin
                    
                        interface fmax
                            module procedure fmax88
                            module procedure fmax44
                            module procedure fmax84
                            module procedure fmax48
                        end interface
                        interface fmin
                            module procedure fmin88
                            module procedure fmin44
                            module procedure fmin84
                            module procedure fmin48
                        end interface
                    contains
                        real(8) function fmax88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmax44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmax84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmax48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                        end function
                        real(8) function fmin88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmin44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmin84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmin48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                        end function
                    end module
                    
                    real(8) function code(x, y)
                    use fmin_fmax_functions
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        real(8) :: tmp
                        if (((x * ((x / y) + 1.0d0)) / (x + 1.0d0)) <= 0.0001d0) then
                            tmp = x
                        else
                            tmp = 1.0d0
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double x, double y) {
                    	double tmp;
                    	if (((x * ((x / y) + 1.0)) / (x + 1.0)) <= 0.0001) {
                    		tmp = x;
                    	} else {
                    		tmp = 1.0;
                    	}
                    	return tmp;
                    }
                    
                    def code(x, y):
                    	tmp = 0
                    	if ((x * ((x / y) + 1.0)) / (x + 1.0)) <= 0.0001:
                    		tmp = x
                    	else:
                    		tmp = 1.0
                    	return tmp
                    
                    function code(x, y)
                    	tmp = 0.0
                    	if (Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) <= 0.0001)
                    		tmp = x;
                    	else
                    		tmp = 1.0;
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(x, y)
                    	tmp = 0.0;
                    	if (((x * ((x / y) + 1.0)) / (x + 1.0)) <= 0.0001)
                    		tmp = x;
                    	else
                    		tmp = 1.0;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[x_, y_] := If[LessEqual[N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 0.0001], x, 1.0]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1} \leq 0.0001:\\
                    \;\;\;\;x\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;1\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 1.00000000000000005e-4

                      1. Initial program 91.7%

                        \[\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 rewrites58.0%

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

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

                        1. Initial program 81.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \frac{1}{\frac{1}{x} + \color{blue}{1}} \]
                          4. lift-/.f6436.1

                            \[\leadsto \frac{1}{\frac{1}{x} + 1} \]
                        6. Applied rewrites36.1%

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

                          \[\leadsto 1 \]
                        8. Step-by-step derivation
                          1. Applied rewrites34.9%

                            \[\leadsto 1 \]
                        9. Recombined 2 regimes into one program.
                        10. Add Preprocessing

                        Alternative 12: 13.8% accurate, 16.1× speedup?

                        \[\begin{array}{l} \\ 1 \end{array} \]
                        (FPCore (x y) :precision binary64 1.0)
                        double code(double x, double y) {
                        	return 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 = 1.0d0
                        end function
                        
                        public static double code(double x, double y) {
                        	return 1.0;
                        }
                        
                        def code(x, y):
                        	return 1.0
                        
                        function code(x, y)
                        	return 1.0
                        end
                        
                        function tmp = code(x, y)
                        	tmp = 1.0;
                        end
                        
                        code[x_, y_] := 1.0
                        
                        \begin{array}{l}
                        
                        \\
                        1
                        \end{array}
                        
                        Derivation
                        1. Initial program 88.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \frac{1}{\frac{1}{x} + \color{blue}{1}} \]
                          4. lift-/.f6450.2

                            \[\leadsto \frac{1}{\frac{1}{x} + 1} \]
                        6. Applied rewrites50.2%

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

                          \[\leadsto 1 \]
                        8. Step-by-step derivation
                          1. Applied rewrites13.8%

                            \[\leadsto 1 \]
                          2. Add Preprocessing

                          Reproduce

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