Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1

Percentage Accurate: 88.0% → 99.9%
Time: 5.5s
Alternatives: 15
Speedup: 1.0×

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}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 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}\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{+179} \lor \neg \left(t\_0 \leq 10^{+15}\right):\\ \;\;\;\;\frac{\frac{x}{y}}{x - -1} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{x - -1}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
   (if (or (<= t_0 -4e+179) (not (<= t_0 1e+15)))
     (* (/ (/ x y) (- x -1.0)) x)
     (/ (fma (/ x y) x x) (- x -1.0)))))
double code(double x, double y) {
	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
	double tmp;
	if ((t_0 <= -4e+179) || !(t_0 <= 1e+15)) {
		tmp = ((x / y) / (x - -1.0)) * x;
	} else {
		tmp = fma((x / y), x, x) / (x - -1.0);
	}
	return tmp;
}
function code(x, y)
	t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
	tmp = 0.0
	if ((t_0 <= -4e+179) || !(t_0 <= 1e+15))
		tmp = Float64(Float64(Float64(x / y) / Float64(x - -1.0)) * x);
	else
		tmp = Float64(fma(Float64(x / y), x, x) / Float64(x - -1.0));
	end
	return tmp
end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -4e+179], N[Not[LessEqual[t$95$0, 1e+15]], $MachinePrecision]], N[(N[(N[(x / y), $MachinePrecision] / N[(x - -1.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision] / N[(x - -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{+179} \lor \neg \left(t\_0 \leq 10^{+15}\right):\\
\;\;\;\;\frac{\frac{x}{y}}{x - -1} \cdot x\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{x - -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))) < -3.99999999999999992e179 or 1e15 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

    1. Initial program 63.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y} - \left(\mathsf{neg}\left(1\right)\right)}}{x + 1} \cdot x \]
      14. metadata-eval99.9

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{x}{y} - -1}{\color{blue}{x - \left(\mathsf{neg}\left(1\right)\right)}} \cdot x \]
      22. metadata-eval99.9

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

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

      \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{x - -1} \cdot x \]
    6. Step-by-step derivation
      1. Applied rewrites99.9%

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

      if -3.99999999999999992e179 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 1e15

      1. Initial program 99.9%

        \[\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1} \]
      2. Add Preprocessing
      3. 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. distribute-rgt-inN/A

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

          \[\leadsto \frac{\frac{x}{y} \cdot x + \color{blue}{x}}{x + 1} \]
        5. lower-fma.f6499.9

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

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

          \[\leadsto \frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{x + \color{blue}{1 \cdot 1}} \]
        8. 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}} \]
        9. metadata-evalN/A

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{x - -1}} \]
    7. Recombined 2 regimes into one program.
    8. Final simplification99.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1} \leq -4 \cdot 10^{+179} \lor \neg \left(\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1} \leq 10^{+15}\right):\\ \;\;\;\;\frac{\frac{x}{y}}{x - -1} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{x - -1}\\ \end{array} \]
    9. Add Preprocessing

    Alternative 2: 92.8% accurate, 0.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ t_1 := \mathsf{fma}\left(\frac{x}{y}, x, x\right)\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq -2 \cdot 10^{+15}:\\ \;\;\;\;\frac{\left(y + x\right) \cdot x}{\mathsf{fma}\left(y, x, y\right)}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-19}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+22}:\\ \;\;\;\;\frac{t\_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))) (t_1 (fma (/ x y) x x)))
       (if (<= t_0 (- INFINITY))
         (/ x y)
         (if (<= t_0 -2e+15)
           (/ (* (+ y x) x) (fma y x y))
           (if (<= t_0 2e-19) t_1 (if (<= t_0 2e+22) (/ t_1 x) (/ x y)))))))
    double code(double x, double y) {
    	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
    	double t_1 = fma((x / y), x, x);
    	double tmp;
    	if (t_0 <= -((double) INFINITY)) {
    		tmp = x / y;
    	} else if (t_0 <= -2e+15) {
    		tmp = ((y + x) * x) / fma(y, x, y);
    	} else if (t_0 <= 2e-19) {
    		tmp = t_1;
    	} else if (t_0 <= 2e+22) {
    		tmp = t_1 / 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))
    	t_1 = fma(Float64(x / y), x, x)
    	tmp = 0.0
    	if (t_0 <= Float64(-Inf))
    		tmp = Float64(x / y);
    	elseif (t_0 <= -2e+15)
    		tmp = Float64(Float64(Float64(y + x) * x) / fma(y, x, y));
    	elseif (t_0 <= 2e-19)
    		tmp = t_1;
    	elseif (t_0 <= 2e+22)
    		tmp = Float64(t_1 / x);
    	else
    		tmp = Float64(x / y);
    	end
    	return tmp
    end
    
    code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, -2e+15], N[(N[(N[(y + x), $MachinePrecision] * x), $MachinePrecision] / N[(y * x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-19], t$95$1, If[LessEqual[t$95$0, 2e+22], N[(t$95$1 / x), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
    t_1 := \mathsf{fma}\left(\frac{x}{y}, x, x\right)\\
    \mathbf{if}\;t\_0 \leq -\infty:\\
    \;\;\;\;\frac{x}{y}\\
    
    \mathbf{elif}\;t\_0 \leq -2 \cdot 10^{+15}:\\
    \;\;\;\;\frac{\left(y + x\right) \cdot x}{\mathsf{fma}\left(y, x, y\right)}\\
    
    \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-19}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+22}:\\
    \;\;\;\;\frac{t\_1}{x}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{x}{y}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -inf.0 or 2e22 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

      1. Initial program 61.1%

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

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

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

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

        1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\color{blue}{\frac{x}{y} - \left(\mathsf{neg}\left(1\right)\right)}}{x + 1} \cdot x \]
          14. metadata-eval99.8

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

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

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

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

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

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

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

            \[\leadsto \frac{\frac{x}{y} - -1}{\color{blue}{x - \left(\mathsf{neg}\left(1\right)\right)}} \cdot x \]
          22. metadata-eval99.8

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

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

          \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{1 + x} + \frac{{x}^{2}}{1 + x}}{y}} \]
        6. Step-by-step derivation
          1. Applied rewrites99.6%

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

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

          1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\color{blue}{\frac{x}{y} - \left(\mathsf{neg}\left(1\right)\right)}}{x + 1} \cdot x \]
            14. metadata-eval99.9

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

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

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

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

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

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

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

              \[\leadsto \frac{\frac{x}{y} - -1}{\color{blue}{x - \left(\mathsf{neg}\left(1\right)\right)}} \cdot x \]
            22. metadata-eval99.9

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

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

            \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{1 + x} + \frac{{x}^{2}}{1 + x}}{y}} \]
          6. Step-by-step derivation
            1. Applied rewrites71.3%

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

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

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

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

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

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

              1. Initial program 100.0%

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

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

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

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

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

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

                    \[\leadsto \frac{\frac{x}{y} \cdot x + \color{blue}{x}}{x} \]
                  5. lower-fma.f6491.4

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

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

              Alternative 3: 93.3% accurate, 0.2× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq -2 \cdot 10^{+15}:\\ \;\;\;\;\frac{\left(y + x\right) \cdot x}{\mathsf{fma}\left(y, x, y\right)}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-19}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{y}, x, x\right)\\ \mathbf{elif}\;t\_0 \leq 2:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
              (FPCore (x y)
               :precision binary64
               (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
                 (if (<= t_0 (- INFINITY))
                   (/ x y)
                   (if (<= t_0 -2e+15)
                     (/ (* (+ y x) x) (fma y x y))
                     (if (<= t_0 2e-19)
                       (fma (/ x y) x x)
                       (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 <= -((double) INFINITY)) {
              		tmp = x / y;
              	} else if (t_0 <= -2e+15) {
              		tmp = ((y + x) * x) / fma(y, x, y);
              	} else if (t_0 <= 2e-19) {
              		tmp = fma((x / y), x, x);
              	} else if (t_0 <= 2.0) {
              		tmp = x / (x + 1.0);
              	} else {
              		tmp = x / y;
              	}
              	return tmp;
              }
              
              function code(x, y)
              	t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
              	tmp = 0.0
              	if (t_0 <= Float64(-Inf))
              		tmp = Float64(x / y);
              	elseif (t_0 <= -2e+15)
              		tmp = Float64(Float64(Float64(y + x) * x) / fma(y, x, y));
              	elseif (t_0 <= 2e-19)
              		tmp = fma(Float64(x / y), x, x);
              	elseif (t_0 <= 2.0)
              		tmp = Float64(x / Float64(x + 1.0));
              	else
              		tmp = Float64(x / y);
              	end
              	return tmp
              end
              
              code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, -2e+15], N[(N[(N[(y + x), $MachinePrecision] * x), $MachinePrecision] / N[(y * x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-19], N[(N[(x / y), $MachinePrecision] * x + x), $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 -\infty:\\
              \;\;\;\;\frac{x}{y}\\
              
              \mathbf{elif}\;t\_0 \leq -2 \cdot 10^{+15}:\\
              \;\;\;\;\frac{\left(y + x\right) \cdot x}{\mathsf{fma}\left(y, x, y\right)}\\
              
              \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-19}:\\
              \;\;\;\;\mathsf{fma}\left(\frac{x}{y}, x, x\right)\\
              
              \mathbf{elif}\;t\_0 \leq 2:\\
              \;\;\;\;\frac{x}{x + 1}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{x}{y}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 4 regimes
              2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -inf.0 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

                1. Initial program 63.9%

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

                  \[\leadsto \color{blue}{\frac{x}{y}} \]
                4. Step-by-step derivation
                  1. Applied rewrites91.8%

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

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

                  1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \frac{\color{blue}{\frac{x}{y} - \left(\mathsf{neg}\left(1\right)\right)}}{x + 1} \cdot x \]
                    14. metadata-eval99.8

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

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

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

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

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

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

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

                      \[\leadsto \frac{\frac{x}{y} - -1}{\color{blue}{x - \left(\mathsf{neg}\left(1\right)\right)}} \cdot x \]
                    22. metadata-eval99.8

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

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

                    \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{1 + x} + \frac{{x}^{2}}{1 + x}}{y}} \]
                  6. Step-by-step derivation
                    1. Applied rewrites99.6%

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

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

                    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \frac{\color{blue}{\frac{x}{y} - \left(\mathsf{neg}\left(1\right)\right)}}{x + 1} \cdot x \]
                      14. metadata-eval99.9

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

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

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

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

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

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

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

                        \[\leadsto \frac{\frac{x}{y} - -1}{\color{blue}{x - \left(\mathsf{neg}\left(1\right)\right)}} \cdot x \]
                      22. metadata-eval99.9

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

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

                      \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{1 + x} + \frac{{x}^{2}}{1 + x}}{y}} \]
                    6. Step-by-step derivation
                      1. Applied rewrites71.3%

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

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

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

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

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

                        if 2e-19 < (/.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. Add Preprocessing
                        3. Taylor expanded in x around 0

                          \[\leadsto \frac{\color{blue}{x}}{x + 1} \]
                        4. Step-by-step derivation
                          1. Applied rewrites97.2%

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

                        Alternative 4: 93.3% accurate, 0.2× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq -2 \cdot 10^{+15}:\\ \;\;\;\;\frac{x \cdot x}{\mathsf{fma}\left(y, x, y\right)}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-19}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{y}, x, x\right)\\ \mathbf{elif}\;t\_0 \leq 2:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
                        (FPCore (x y)
                         :precision binary64
                         (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
                           (if (<= t_0 (- INFINITY))
                             (/ x y)
                             (if (<= t_0 -2e+15)
                               (/ (* x x) (fma y x y))
                               (if (<= t_0 2e-19)
                                 (fma (/ x y) x x)
                                 (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 <= -((double) INFINITY)) {
                        		tmp = x / y;
                        	} else if (t_0 <= -2e+15) {
                        		tmp = (x * x) / fma(y, x, y);
                        	} else if (t_0 <= 2e-19) {
                        		tmp = fma((x / y), x, x);
                        	} else if (t_0 <= 2.0) {
                        		tmp = x / (x + 1.0);
                        	} else {
                        		tmp = x / y;
                        	}
                        	return tmp;
                        }
                        
                        function code(x, y)
                        	t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
                        	tmp = 0.0
                        	if (t_0 <= Float64(-Inf))
                        		tmp = Float64(x / y);
                        	elseif (t_0 <= -2e+15)
                        		tmp = Float64(Float64(x * x) / fma(y, x, y));
                        	elseif (t_0 <= 2e-19)
                        		tmp = fma(Float64(x / y), x, x);
                        	elseif (t_0 <= 2.0)
                        		tmp = Float64(x / Float64(x + 1.0));
                        	else
                        		tmp = Float64(x / y);
                        	end
                        	return tmp
                        end
                        
                        code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, -2e+15], N[(N[(x * x), $MachinePrecision] / N[(y * x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-19], N[(N[(x / y), $MachinePrecision] * x + x), $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 -\infty:\\
                        \;\;\;\;\frac{x}{y}\\
                        
                        \mathbf{elif}\;t\_0 \leq -2 \cdot 10^{+15}:\\
                        \;\;\;\;\frac{x \cdot x}{\mathsf{fma}\left(y, x, y\right)}\\
                        
                        \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-19}:\\
                        \;\;\;\;\mathsf{fma}\left(\frac{x}{y}, x, x\right)\\
                        
                        \mathbf{elif}\;t\_0 \leq 2:\\
                        \;\;\;\;\frac{x}{x + 1}\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;\frac{x}{y}\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 4 regimes
                        2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -inf.0 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

                          1. Initial program 63.9%

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

                            \[\leadsto \color{blue}{\frac{x}{y}} \]
                          4. Step-by-step derivation
                            1. Applied rewrites91.8%

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

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

                            1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \frac{\color{blue}{\frac{x}{y} - \left(\mathsf{neg}\left(1\right)\right)}}{x + 1} \cdot x \]
                              14. metadata-eval99.8

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

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

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

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

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

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

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

                                \[\leadsto \frac{\frac{x}{y} - -1}{\color{blue}{x - \left(\mathsf{neg}\left(1\right)\right)}} \cdot x \]
                              22. metadata-eval99.8

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

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

                              \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{1 + x} + \frac{{x}^{2}}{1 + x}}{y}} \]
                            6. Step-by-step derivation
                              1. Applied rewrites99.6%

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

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

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

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

                                1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \frac{\color{blue}{\frac{x}{y} - \left(\mathsf{neg}\left(1\right)\right)}}{x + 1} \cdot x \]
                                  14. metadata-eval99.9

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

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

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

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

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

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

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

                                    \[\leadsto \frac{\frac{x}{y} - -1}{\color{blue}{x - \left(\mathsf{neg}\left(1\right)\right)}} \cdot x \]
                                  22. metadata-eval99.9

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

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

                                  \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{1 + x} + \frac{{x}^{2}}{1 + x}}{y}} \]
                                6. Step-by-step derivation
                                  1. Applied rewrites71.3%

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

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

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

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

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

                                    if 2e-19 < (/.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. Add Preprocessing
                                    3. Taylor expanded in x around 0

                                      \[\leadsto \frac{\color{blue}{x}}{x + 1} \]
                                    4. Step-by-step derivation
                                      1. Applied rewrites97.2%

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

                                    Alternative 5: 96.9% accurate, 0.2× speedup?

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

                                      1. Initial program 70.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          \[\leadsto \frac{\color{blue}{\frac{x}{y} - \left(\mathsf{neg}\left(1\right)\right)}}{x + 1} \cdot x \]
                                        14. metadata-eval99.9

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

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

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

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

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

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

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

                                          \[\leadsto \frac{\frac{x}{y} - -1}{\color{blue}{x - \left(\mathsf{neg}\left(1\right)\right)}} \cdot x \]
                                        22. metadata-eval99.9

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

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

                                        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{x - -1} \cdot x \]
                                      6. Step-by-step derivation
                                        1. Applied rewrites99.9%

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

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

                                        1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                            \[\leadsto \frac{\color{blue}{\frac{x}{y} - \left(\mathsf{neg}\left(1\right)\right)}}{x + 1} \cdot x \]
                                          14. metadata-eval99.9

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

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

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

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

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

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

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

                                            \[\leadsto \frac{\frac{x}{y} - -1}{\color{blue}{x - \left(\mathsf{neg}\left(1\right)\right)}} \cdot x \]
                                          22. metadata-eval99.9

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

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

                                          \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{1 + x} + \frac{{x}^{2}}{1 + x}}{y}} \]
                                        6. Step-by-step derivation
                                          1. Applied rewrites71.3%

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

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

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

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

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

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

                                            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

                                            Alternative 6: 90.8% accurate, 0.3× speedup?

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

                                              1. Initial program 68.4%

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

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

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

                                                if -4.00000000000000003e78 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2e-19

                                                1. Initial program 99.9%

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

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

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

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

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

                                                    if 2e-19 < (/.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. Add Preprocessing
                                                    3. Taylor expanded in x around 0

                                                      \[\leadsto \frac{\color{blue}{x}}{x + 1} \]
                                                    4. Step-by-step derivation
                                                      1. Applied rewrites97.2%

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

                                                    Alternative 7: 90.7% 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 -4 \cdot 10^{+78}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-19}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{y}, x, x\right)\\ \mathbf{elif}\;t\_0 \leq 2:\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
                                                    (FPCore (x y)
                                                     :precision binary64
                                                     (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
                                                       (if (<= t_0 -4e+78)
                                                         (/ x y)
                                                         (if (<= t_0 2e-19)
                                                           (fma (/ x y) x x)
                                                           (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 <= -4e+78) {
                                                    		tmp = x / y;
                                                    	} else if (t_0 <= 2e-19) {
                                                    		tmp = fma((x / y), x, x);
                                                    	} else if (t_0 <= 2.0) {
                                                    		tmp = x / (x + 1.0);
                                                    	} else {
                                                    		tmp = x / y;
                                                    	}
                                                    	return tmp;
                                                    }
                                                    
                                                    function code(x, y)
                                                    	t_0 = Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0))
                                                    	tmp = 0.0
                                                    	if (t_0 <= -4e+78)
                                                    		tmp = Float64(x / y);
                                                    	elseif (t_0 <= 2e-19)
                                                    		tmp = fma(Float64(x / y), x, x);
                                                    	elseif (t_0 <= 2.0)
                                                    		tmp = Float64(x / Float64(x + 1.0));
                                                    	else
                                                    		tmp = Float64(x / y);
                                                    	end
                                                    	return tmp
                                                    end
                                                    
                                                    code[x_, y_] := Block[{t$95$0 = N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e+78], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, 2e-19], N[(N[(x / y), $MachinePrecision] * x + x), $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 -4 \cdot 10^{+78}:\\
                                                    \;\;\;\;\frac{x}{y}\\
                                                    
                                                    \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-19}:\\
                                                    \;\;\;\;\mathsf{fma}\left(\frac{x}{y}, x, x\right)\\
                                                    
                                                    \mathbf{elif}\;t\_0 \leq 2:\\
                                                    \;\;\;\;\frac{x}{x + 1}\\
                                                    
                                                    \mathbf{else}:\\
                                                    \;\;\;\;\frac{x}{y}\\
                                                    
                                                    
                                                    \end{array}
                                                    \end{array}
                                                    
                                                    Derivation
                                                    1. Split input into 3 regimes
                                                    2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -4.00000000000000003e78 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

                                                      1. Initial program 68.4%

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

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

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

                                                        if -4.00000000000000003e78 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 2e-19

                                                        1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                            \[\leadsto \frac{\color{blue}{\frac{x}{y} - \left(\mathsf{neg}\left(1\right)\right)}}{x + 1} \cdot x \]
                                                          14. metadata-eval99.9

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

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

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

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

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

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

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

                                                            \[\leadsto \frac{\frac{x}{y} - -1}{\color{blue}{x - \left(\mathsf{neg}\left(1\right)\right)}} \cdot x \]
                                                          22. metadata-eval99.9

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

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

                                                          \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{1 + x} + \frac{{x}^{2}}{1 + x}}{y}} \]
                                                        6. Step-by-step derivation
                                                          1. Applied rewrites73.1%

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

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

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

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

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

                                                            if 2e-19 < (/.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. Add Preprocessing
                                                            3. Taylor expanded in x around 0

                                                              \[\leadsto \frac{\color{blue}{x}}{x + 1} \]
                                                            4. Step-by-step derivation
                                                              1. Applied rewrites97.2%

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

                                                            Alternative 8: 84.4% accurate, 0.3× speedup?

                                                            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{+78}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;t\_0 \leq -5 \cdot 10^{-33}:\\ \;\;\;\;\frac{x}{y} \cdot x\\ \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 -4e+78)
                                                                 (/ x y)
                                                                 (if (<= t_0 -5e-33)
                                                                   (* (/ x y) x)
                                                                   (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 <= -4e+78) {
                                                            		tmp = x / y;
                                                            	} else if (t_0 <= -5e-33) {
                                                            		tmp = (x / y) * x;
                                                            	} 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 <= (-4d+78)) then
                                                                    tmp = x / y
                                                                else if (t_0 <= (-5d-33)) then
                                                                    tmp = (x / y) * x
                                                                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 <= -4e+78) {
                                                            		tmp = x / y;
                                                            	} else if (t_0 <= -5e-33) {
                                                            		tmp = (x / y) * x;
                                                            	} 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 <= -4e+78:
                                                            		tmp = x / y
                                                            	elif t_0 <= -5e-33:
                                                            		tmp = (x / y) * x
                                                            	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 <= -4e+78)
                                                            		tmp = Float64(x / y);
                                                            	elseif (t_0 <= -5e-33)
                                                            		tmp = Float64(Float64(x / y) * x);
                                                            	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 <= -4e+78)
                                                            		tmp = x / y;
                                                            	elseif (t_0 <= -5e-33)
                                                            		tmp = (x / y) * x;
                                                            	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, -4e+78], N[(x / y), $MachinePrecision], If[LessEqual[t$95$0, -5e-33], N[(N[(x / y), $MachinePrecision] * x), $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 -4 \cdot 10^{+78}:\\
                                                            \;\;\;\;\frac{x}{y}\\
                                                            
                                                            \mathbf{elif}\;t\_0 \leq -5 \cdot 10^{-33}:\\
                                                            \;\;\;\;\frac{x}{y} \cdot x\\
                                                            
                                                            \mathbf{elif}\;t\_0 \leq 2:\\
                                                            \;\;\;\;\frac{x}{x + 1}\\
                                                            
                                                            \mathbf{else}:\\
                                                            \;\;\;\;\frac{x}{y}\\
                                                            
                                                            
                                                            \end{array}
                                                            \end{array}
                                                            
                                                            Derivation
                                                            1. Split input into 3 regimes
                                                            2. if (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -4.00000000000000003e78 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

                                                              1. Initial program 68.4%

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

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

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

                                                                if -4.00000000000000003e78 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -5.00000000000000028e-33

                                                                1. Initial program 99.9%

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

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

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

                                                                    \[\leadsto \frac{x}{y} \cdot x \]
                                                                  3. Step-by-step derivation
                                                                    1. Applied rewrites76.0%

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

                                                                    if -5.00000000000000028e-33 < (/.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. Add Preprocessing
                                                                    3. Taylor expanded in x around 0

                                                                      \[\leadsto \frac{\color{blue}{x}}{x + 1} \]
                                                                    4. Step-by-step derivation
                                                                      1. Applied rewrites89.2%

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

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

                                                                      1. Initial program 71.7%

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

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

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

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

                                                                        1. Initial program 99.9%

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

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

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

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

                                                                          1. Initial program 99.9%

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

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

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

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

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

                                                                            Alternative 10: 86.1% accurate, 0.4× speedup?

                                                                            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-6} \lor \neg \left(t\_0 \leq 2\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + 1}\\ \end{array} \end{array} \]
                                                                            (FPCore (x y)
                                                                             :precision binary64
                                                                             (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
                                                                               (if (or (<= t_0 -2e-6) (not (<= t_0 2.0))) (/ x y) (/ x (+ x 1.0)))))
                                                                            double code(double x, double y) {
                                                                            	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
                                                                            	double tmp;
                                                                            	if ((t_0 <= -2e-6) || !(t_0 <= 2.0)) {
                                                                            		tmp = x / y;
                                                                            	} else {
                                                                            		tmp = x / (x + 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) :: t_0
                                                                                real(8) :: tmp
                                                                                t_0 = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
                                                                                if ((t_0 <= (-2d-6)) .or. (.not. (t_0 <= 2.0d0))) then
                                                                                    tmp = x / y
                                                                                else
                                                                                    tmp = x / (x + 1.0d0)
                                                                                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 <= -2e-6) || !(t_0 <= 2.0)) {
                                                                            		tmp = x / y;
                                                                            	} else {
                                                                            		tmp = x / (x + 1.0);
                                                                            	}
                                                                            	return tmp;
                                                                            }
                                                                            
                                                                            def code(x, y):
                                                                            	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0)
                                                                            	tmp = 0
                                                                            	if (t_0 <= -2e-6) or not (t_0 <= 2.0):
                                                                            		tmp = x / y
                                                                            	else:
                                                                            		tmp = x / (x + 1.0)
                                                                            	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 <= -2e-6) || !(t_0 <= 2.0))
                                                                            		tmp = Float64(x / y);
                                                                            	else
                                                                            		tmp = Float64(x / Float64(x + 1.0));
                                                                            	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 <= -2e-6) || ~((t_0 <= 2.0)))
                                                                            		tmp = x / y;
                                                                            	else
                                                                            		tmp = x / (x + 1.0);
                                                                            	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[Or[LessEqual[t$95$0, -2e-6], N[Not[LessEqual[t$95$0, 2.0]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
                                                                            
                                                                            \begin{array}{l}
                                                                            
                                                                            \\
                                                                            \begin{array}{l}
                                                                            t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
                                                                            \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-6} \lor \neg \left(t\_0 \leq 2\right):\\
                                                                            \;\;\;\;\frac{x}{y}\\
                                                                            
                                                                            \mathbf{else}:\\
                                                                            \;\;\;\;\frac{x}{x + 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.99999999999999991e-6 or 2 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

                                                                              1. Initial program 71.7%

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

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

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

                                                                                if -1.99999999999999991e-6 < (/.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. Add Preprocessing
                                                                                3. Taylor expanded in x around 0

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

                                                                                    \[\leadsto \frac{\color{blue}{x}}{x + 1} \]
                                                                                5. Recombined 2 regimes into one program.
                                                                                6. Final simplification85.5%

                                                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1} \leq -2 \cdot 10^{-6} \lor \neg \left(\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1} \leq 2\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + 1}\\ \end{array} \]
                                                                                7. Add Preprocessing

                                                                                Alternative 11: 74.6% accurate, 0.4× speedup?

                                                                                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-6} \lor \neg \left(t\_0 \leq 1\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
                                                                                (FPCore (x y)
                                                                                 :precision binary64
                                                                                 (let* ((t_0 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0))))
                                                                                   (if (or (<= t_0 -2e-6) (not (<= t_0 1.0))) (/ x y) x)))
                                                                                double code(double x, double y) {
                                                                                	double t_0 = (x * ((x / y) + 1.0)) / (x + 1.0);
                                                                                	double tmp;
                                                                                	if ((t_0 <= -2e-6) || !(t_0 <= 1.0)) {
                                                                                		tmp = x / y;
                                                                                	} else {
                                                                                		tmp = x;
                                                                                	}
                                                                                	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 <= (-2d-6)) .or. (.not. (t_0 <= 1.0d0))) then
                                                                                        tmp = x / y
                                                                                    else
                                                                                        tmp = x
                                                                                    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 <= -2e-6) || !(t_0 <= 1.0)) {
                                                                                		tmp = x / y;
                                                                                	} else {
                                                                                		tmp = x;
                                                                                	}
                                                                                	return tmp;
                                                                                }
                                                                                
                                                                                def code(x, y):
                                                                                	t_0 = (x * ((x / y) + 1.0)) / (x + 1.0)
                                                                                	tmp = 0
                                                                                	if (t_0 <= -2e-6) or not (t_0 <= 1.0):
                                                                                		tmp = x / y
                                                                                	else:
                                                                                		tmp = x
                                                                                	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 <= -2e-6) || !(t_0 <= 1.0))
                                                                                		tmp = Float64(x / y);
                                                                                	else
                                                                                		tmp = x;
                                                                                	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 <= -2e-6) || ~((t_0 <= 1.0)))
                                                                                		tmp = x / y;
                                                                                	else
                                                                                		tmp = x;
                                                                                	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[Or[LessEqual[t$95$0, -2e-6], N[Not[LessEqual[t$95$0, 1.0]], $MachinePrecision]], N[(x / y), $MachinePrecision], x]]
                                                                                
                                                                                \begin{array}{l}
                                                                                
                                                                                \\
                                                                                \begin{array}{l}
                                                                                t_0 := \frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}\\
                                                                                \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-6} \lor \neg \left(t\_0 \leq 1\right):\\
                                                                                \;\;\;\;\frac{x}{y}\\
                                                                                
                                                                                \mathbf{else}:\\
                                                                                \;\;\;\;x\\
                                                                                
                                                                                
                                                                                \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.99999999999999991e-6 or 1 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64)))

                                                                                  1. Initial program 72.2%

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

                                                                                    \[\leadsto \color{blue}{\frac{x}{y}} \]
                                                                                  4. Step-by-step derivation
                                                                                    1. Applied rewrites79.7%

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

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

                                                                                    1. Initial program 99.9%

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

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

                                                                                        \[\leadsto \color{blue}{x} \]
                                                                                    5. Recombined 2 regimes into one program.
                                                                                    6. Final simplification76.8%

                                                                                      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1} \leq -2 \cdot 10^{-6} \lor \neg \left(\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1} \leq 1\right):\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
                                                                                    7. Add Preprocessing

                                                                                    Alternative 12: 44.3% accurate, 0.7× speedup?

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

                                                                                      1. Initial program 71.8%

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

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

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

                                                                                          \[\leadsto \left(1 + -1 \cdot x\right) \cdot x \]
                                                                                        3. Step-by-step derivation
                                                                                          1. Applied rewrites23.1%

                                                                                            \[\leadsto \left(1 - x\right) \cdot x \]
                                                                                          2. Taylor expanded in x around inf

                                                                                            \[\leadsto \left(-1 \cdot x\right) \cdot x \]
                                                                                          3. Step-by-step derivation
                                                                                            1. Applied rewrites23.5%

                                                                                              \[\leadsto \left(-x\right) \cdot x \]

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

                                                                                            1. Initial program 92.9%

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

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

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

                                                                                            Alternative 13: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                                \[\leadsto \frac{\color{blue}{\frac{x}{y} - \left(\mathsf{neg}\left(1\right)\right)}}{x + 1} \cdot x \]
                                                                                              14. metadata-eval99.9

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

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

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

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

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

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

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

                                                                                                \[\leadsto \frac{\frac{x}{y} - -1}{\color{blue}{x - \left(\mathsf{neg}\left(1\right)\right)}} \cdot x \]
                                                                                              22. metadata-eval99.9

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

                                                                                              \[\leadsto \color{blue}{\frac{\frac{x}{y} - -1}{x - -1} \cdot x} \]
                                                                                            5. Add Preprocessing

                                                                                            Alternative 14: 43.6% accurate, 3.8× speedup?

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

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

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

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

                                                                                                \[\leadsto \left(1 + -1 \cdot x\right) \cdot x \]
                                                                                              3. Step-by-step derivation
                                                                                                1. Applied rewrites48.2%

                                                                                                  \[\leadsto \left(1 - x\right) \cdot x \]
                                                                                                2. Add Preprocessing

                                                                                                Alternative 15: 39.3% accurate, 34.0× speedup?

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

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

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

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

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

                                                                                                  \[\begin{array}{l} \\ \frac{x}{1} \cdot \frac{\frac{x}{y} + 1}{x + 1} \end{array} \]
                                                                                                  (FPCore (x y) :precision binary64 (* (/ x 1.0) (/ (+ (/ x y) 1.0) (+ x 1.0))))
                                                                                                  double code(double x, double y) {
                                                                                                  	return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0));
                                                                                                  }
                                                                                                  
                                                                                                  module fmin_fmax_functions
                                                                                                      implicit none
                                                                                                      private
                                                                                                      public fmax
                                                                                                      public fmin
                                                                                                  
                                                                                                      interface fmax
                                                                                                          module procedure fmax88
                                                                                                          module procedure fmax44
                                                                                                          module procedure fmax84
                                                                                                          module procedure fmax48
                                                                                                      end interface
                                                                                                      interface fmin
                                                                                                          module procedure fmin88
                                                                                                          module procedure fmin44
                                                                                                          module procedure fmin84
                                                                                                          module procedure fmin48
                                                                                                      end interface
                                                                                                  contains
                                                                                                      real(8) function fmax88(x, y) result (res)
                                                                                                          real(8), intent (in) :: x
                                                                                                          real(8), intent (in) :: y
                                                                                                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                                                      end function
                                                                                                      real(4) function fmax44(x, y) result (res)
                                                                                                          real(4), intent (in) :: x
                                                                                                          real(4), intent (in) :: y
                                                                                                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                                                      end function
                                                                                                      real(8) function fmax84(x, y) result(res)
                                                                                                          real(8), intent (in) :: x
                                                                                                          real(4), intent (in) :: y
                                                                                                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                                                      end function
                                                                                                      real(8) function fmax48(x, y) result(res)
                                                                                                          real(4), intent (in) :: x
                                                                                                          real(8), intent (in) :: y
                                                                                                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                                                      end function
                                                                                                      real(8) function fmin88(x, y) result (res)
                                                                                                          real(8), intent (in) :: x
                                                                                                          real(8), intent (in) :: y
                                                                                                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                                                      end function
                                                                                                      real(4) function fmin44(x, y) result (res)
                                                                                                          real(4), intent (in) :: x
                                                                                                          real(4), intent (in) :: y
                                                                                                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                                                      end function
                                                                                                      real(8) function fmin84(x, y) result(res)
                                                                                                          real(8), intent (in) :: x
                                                                                                          real(4), intent (in) :: y
                                                                                                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                                                      end function
                                                                                                      real(8) function fmin48(x, y) result(res)
                                                                                                          real(4), intent (in) :: x
                                                                                                          real(8), intent (in) :: y
                                                                                                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                                                      end function
                                                                                                  end module
                                                                                                  
                                                                                                  real(8) function code(x, y)
                                                                                                  use fmin_fmax_functions
                                                                                                      real(8), intent (in) :: x
                                                                                                      real(8), intent (in) :: y
                                                                                                      code = (x / 1.0d0) * (((x / y) + 1.0d0) / (x + 1.0d0))
                                                                                                  end function
                                                                                                  
                                                                                                  public static double code(double x, double y) {
                                                                                                  	return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0));
                                                                                                  }
                                                                                                  
                                                                                                  def code(x, y):
                                                                                                  	return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0))
                                                                                                  
                                                                                                  function code(x, y)
                                                                                                  	return Float64(Float64(x / 1.0) * Float64(Float64(Float64(x / y) + 1.0) / Float64(x + 1.0)))
                                                                                                  end
                                                                                                  
                                                                                                  function tmp = code(x, y)
                                                                                                  	tmp = (x / 1.0) * (((x / y) + 1.0) / (x + 1.0));
                                                                                                  end
                                                                                                  
                                                                                                  code[x_, y_] := N[(N[(x / 1.0), $MachinePrecision] * N[(N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                                                                                                  
                                                                                                  \begin{array}{l}
                                                                                                  
                                                                                                  \\
                                                                                                  \frac{x}{1} \cdot \frac{\frac{x}{y} + 1}{x + 1}
                                                                                                  \end{array}
                                                                                                  

                                                                                                  Reproduce

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