Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1

Percentage Accurate: 88.7% → 99.9%
Time: 3.3s
Alternatives: 11
Speedup: 0.8×

Specification

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

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

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

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

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 11 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.7% 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.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+17} \lor \neg \left(x \leq 1.8 \cdot 10^{+15}\right):\\ \;\;\;\;1 - \frac{-x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y} \cdot x, x - -1, \left(x - -1\right) \cdot x\right)}{\left(x - -1\right) \cdot \left(x - -1\right)}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= x -1e+17) (not (<= x 1.8e+15)))
   (- 1.0 (/ (- x) y))
   (/
    (fma (* (/ x y) x) (- x -1.0) (* (- x -1.0) x))
    (* (- x -1.0) (- x -1.0)))))
double code(double x, double y) {
	double tmp;
	if ((x <= -1e+17) || !(x <= 1.8e+15)) {
		tmp = 1.0 - (-x / y);
	} else {
		tmp = fma(((x / y) * x), (x - -1.0), ((x - -1.0) * x)) / ((x - -1.0) * (x - -1.0));
	}
	return tmp;
}
function code(x, y)
	tmp = 0.0
	if ((x <= -1e+17) || !(x <= 1.8e+15))
		tmp = Float64(1.0 - Float64(Float64(-x) / y));
	else
		tmp = Float64(fma(Float64(Float64(x / y) * x), Float64(x - -1.0), Float64(Float64(x - -1.0) * x)) / Float64(Float64(x - -1.0) * Float64(x - -1.0)));
	end
	return tmp
end
code[x_, y_] := If[Or[LessEqual[x, -1e+17], N[Not[LessEqual[x, 1.8e+15]], $MachinePrecision]], N[(1.0 - N[((-x) / y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x / y), $MachinePrecision] * x), $MachinePrecision] * N[(x - -1.0), $MachinePrecision] + N[(N[(x - -1.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / N[(N[(x - -1.0), $MachinePrecision] * N[(x - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{+17} \lor \neg \left(x \leq 1.8 \cdot 10^{+15}\right):\\
\;\;\;\;1 - \frac{-x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1e17 or 1.8e15 < x

    1. Initial program 76.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}{-1 \cdot \left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right) \]
      2. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto 1 + \color{blue}{-1 \cdot \frac{1 - x}{y}} \]
    7. Step-by-step derivation
      1. fp-cancel-sign-sub-invN/A

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

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

        \[\leadsto 1 - \frac{-1}{-1} \cdot \frac{1 - x}{y} \]
      4. times-fracN/A

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

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

        \[\leadsto 1 - \frac{\mathsf{neg}\left(\left(1 - x\right)\right)}{\mathsf{neg}\left(y\right)} \]
      7. frac-2negN/A

        \[\leadsto 1 - \frac{1 - x}{y} \]
      8. lower--.f64N/A

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

        \[\leadsto 1 - \frac{1 - x}{y} \]
      10. lower--.f64100.0

        \[\leadsto 1 - \frac{1 - x}{y} \]
    8. Applied rewrites100.0%

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

      \[\leadsto 1 - \frac{-1 \cdot x}{y} \]
    10. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto 1 - \frac{\mathsf{neg}\left(x\right)}{y} \]
      2. lower-neg.f64100.0

        \[\leadsto 1 - \frac{-x}{y} \]
    11. Applied rewrites100.0%

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

    if -1e17 < x < 1.8e15

    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. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y} \cdot x + x}}{x - -1} \]
      5. div-addN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 88.0% accurate, 0.3× speedup?

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

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

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

\mathbf{elif}\;t\_0 \leq 0.01:\\
\;\;\;\;\frac{x}{x - -1}\\

\mathbf{else}:\\
\;\;\;\;1 - \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

    1. Initial program 56.0%

      \[\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. lift-/.f64100.0

        \[\leadsto \frac{x}{\color{blue}{y}} \]
    5. Applied rewrites100.0%

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

    if -inf.0 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < -3.99999999999999976e-11

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

    if -3.99999999999999976e-11 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 0.0100000000000000002

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

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

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

      1. Initial program 85.5%

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

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

          \[\leadsto \mathsf{neg}\left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right) \]
        2. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 + \color{blue}{-1 \cdot \frac{1 - x}{y}} \]
      7. Step-by-step derivation
        1. fp-cancel-sign-sub-invN/A

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

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

          \[\leadsto 1 - \frac{-1}{-1} \cdot \frac{1 - x}{y} \]
        4. times-fracN/A

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

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

          \[\leadsto 1 - \frac{\mathsf{neg}\left(\left(1 - x\right)\right)}{\mathsf{neg}\left(y\right)} \]
        7. frac-2negN/A

          \[\leadsto 1 - \frac{1 - x}{y} \]
        8. lower--.f64N/A

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

          \[\leadsto 1 - \frac{1 - x}{y} \]
        10. lower--.f6490.3

          \[\leadsto 1 - \frac{1 - x}{y} \]
      8. Applied rewrites90.3%

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

        \[\leadsto 1 - \frac{-1 \cdot x}{y} \]
      10. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto 1 - \frac{\mathsf{neg}\left(x\right)}{y} \]
        2. lower-neg.f6490.6

          \[\leadsto 1 - \frac{-x}{y} \]
      11. Applied rewrites90.6%

        \[\leadsto 1 - \frac{-x}{y} \]
    5. Recombined 4 regimes into one program.
    6. Final simplification91.5%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(\frac{x}{y} - -1\right)}{x - -1} \leq -\infty:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x \cdot \left(\frac{x}{y} - -1\right)}{x - -1} \leq -4 \cdot 10^{-11}:\\ \;\;\;\;\frac{x \cdot x}{\mathsf{fma}\left(y, x, y\right)}\\ \mathbf{elif}\;\frac{x \cdot \left(\frac{x}{y} - -1\right)}{x - -1} \leq 0.01:\\ \;\;\;\;\frac{x}{x - -1}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{-x}{y}\\ \end{array} \]
    7. Add Preprocessing

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

      1. Initial program 73.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}{-1 \cdot \left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right)} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \mathsf{neg}\left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right) \]
        2. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\frac{1 - x}{y}} \]
      7. Step-by-step derivation
        1. mul-1-negN/A

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

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

          \[\leadsto -\frac{1 - x}{y} \]
        4. lower--.f6484.4

          \[\leadsto -\frac{1 - x}{y} \]
      8. Applied rewrites84.4%

        \[\leadsto -\frac{1 - x}{y} \]
      9. Taylor expanded in x around 0

        \[\leadsto \frac{x}{y} - \frac{1}{\color{blue}{y}} \]
      10. Step-by-step derivation
        1. sub-divN/A

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

          \[\leadsto \frac{x - 1}{y} \]
        3. lower--.f6484.4

          \[\leadsto \frac{x - 1}{y} \]
      11. Applied rewrites84.4%

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

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

      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 \color{blue}{x} \]
      4. Step-by-step derivation
        1. Applied rewrites87.9%

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

        if 0.0100000000000000002 < (/.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 -inf

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

            \[\leadsto \mathsf{neg}\left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right) \]
          2. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto 1 \]
        7. Step-by-step derivation
          1. Applied rewrites88.4%

            \[\leadsto 1 \]

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

          1. Initial program 76.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. lift-/.f6484.9

              \[\leadsto \frac{x}{\color{blue}{y}} \]
          5. Applied rewrites84.9%

            \[\leadsto \color{blue}{\frac{x}{y}} \]
        8. Recombined 4 regimes into one program.
        9. Final simplification86.7%

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

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

          1. Initial program 75.3%

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

              \[\leadsto \frac{x}{\color{blue}{y}} \]
          5. Applied rewrites83.0%

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

          if -3.99999999999999976e-11 < (/.f64 (*.f64 x (+.f64 (/.f64 x y) #s(literal 1 binary64))) (+.f64 x #s(literal 1 binary64))) < 0.0100000000000000002

          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 \color{blue}{x} \]
          4. Step-by-step derivation
            1. Applied rewrites89.3%

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

            if 0.0100000000000000002 < (/.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 -inf

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

                \[\leadsto \mathsf{neg}\left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right) \]
              2. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto 1 \]
            7. Step-by-step derivation
              1. Applied rewrites88.4%

                \[\leadsto 1 \]
            8. Recombined 3 regimes into one program.
            9. Final simplification86.6%

              \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(\frac{x}{y} - -1\right)}{x - -1} \leq -4 \cdot 10^{-11}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;\frac{x \cdot \left(\frac{x}{y} - -1\right)}{x - -1} \leq 0.01:\\ \;\;\;\;x\\ \mathbf{elif}\;\frac{x \cdot \left(\frac{x}{y} - -1\right)}{x - -1} \leq 2:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
            10. Add Preprocessing

            Alternative 5: 85.6% accurate, 0.4× speedup?

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

              1. Initial program 73.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}{-1 \cdot \left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right)} \]
              4. Step-by-step derivation
                1. mul-1-negN/A

                  \[\leadsto \mathsf{neg}\left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right) \]
                2. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto -1 \cdot \color{blue}{\frac{1 - x}{y}} \]
              7. Step-by-step derivation
                1. mul-1-negN/A

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

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

                  \[\leadsto -\frac{1 - x}{y} \]
                4. lower--.f6484.4

                  \[\leadsto -\frac{1 - x}{y} \]
              8. Applied rewrites84.4%

                \[\leadsto -\frac{1 - x}{y} \]
              9. Taylor expanded in x around 0

                \[\leadsto \frac{x}{y} - \frac{1}{\color{blue}{y}} \]
              10. Step-by-step derivation
                1. sub-divN/A

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

                  \[\leadsto \frac{x - 1}{y} \]
                3. lower--.f6484.4

                  \[\leadsto \frac{x - 1}{y} \]
              11. Applied rewrites84.4%

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

              if -2e22 < (/.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 rewrites89.0%

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

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

                1. Initial program 76.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. lift-/.f6484.9

                    \[\leadsto \frac{x}{\color{blue}{y}} \]
                5. Applied rewrites84.9%

                  \[\leadsto \color{blue}{\frac{x}{y}} \]
              5. Recombined 3 regimes into one program.
              6. Final simplification87.3%

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

              Alternative 6: 99.7% accurate, 0.8× speedup?

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

                1. Initial program 75.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}{-1 \cdot \left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right)} \]
                4. Step-by-step derivation
                  1. mul-1-negN/A

                    \[\leadsto \mathsf{neg}\left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right) \]
                  2. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto 1 + \color{blue}{-1 \cdot \frac{1 - x}{y}} \]
                7. Step-by-step derivation
                  1. fp-cancel-sign-sub-invN/A

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

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

                    \[\leadsto 1 - \frac{-1}{-1} \cdot \frac{1 - x}{y} \]
                  4. times-fracN/A

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

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

                    \[\leadsto 1 - \frac{\mathsf{neg}\left(\left(1 - x\right)\right)}{\mathsf{neg}\left(y\right)} \]
                  7. frac-2negN/A

                    \[\leadsto 1 - \frac{1 - x}{y} \]
                  8. lower--.f64N/A

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

                    \[\leadsto 1 - \frac{1 - x}{y} \]
                  10. lower--.f64100.0

                    \[\leadsto 1 - \frac{1 - x}{y} \]
                8. Applied rewrites100.0%

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

                  \[\leadsto 1 - \frac{-1 \cdot x}{y} \]
                10. Step-by-step derivation
                  1. mul-1-negN/A

                    \[\leadsto 1 - \frac{\mathsf{neg}\left(x\right)}{y} \]
                  2. lower-neg.f64100.0

                    \[\leadsto 1 - \frac{-x}{y} \]
                11. Applied rewrites100.0%

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

                if -7.2000000000000003e54 < x < 3.8e15

                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. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 7: 98.0% accurate, 0.8× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;1 - \frac{-x}{y}\\ \mathbf{elif}\;x \leq 1.22:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{1}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{1 - x}{y}\\ \end{array} \end{array} \]
              (FPCore (x y)
               :precision binary64
               (if (<= x -1.0)
                 (- 1.0 (/ (- x) y))
                 (if (<= x 1.22) (/ (fma (/ x y) x x) 1.0) (- 1.0 (/ (- 1.0 x) y)))))
              double code(double x, double y) {
              	double tmp;
              	if (x <= -1.0) {
              		tmp = 1.0 - (-x / y);
              	} else if (x <= 1.22) {
              		tmp = fma((x / y), x, x) / 1.0;
              	} else {
              		tmp = 1.0 - ((1.0 - x) / y);
              	}
              	return tmp;
              }
              
              function code(x, y)
              	tmp = 0.0
              	if (x <= -1.0)
              		tmp = Float64(1.0 - Float64(Float64(-x) / y));
              	elseif (x <= 1.22)
              		tmp = Float64(fma(Float64(x / y), x, x) / 1.0);
              	else
              		tmp = Float64(1.0 - Float64(Float64(1.0 - x) / y));
              	end
              	return tmp
              end
              
              code[x_, y_] := If[LessEqual[x, -1.0], N[(1.0 - N[((-x) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.22], N[(N[(N[(x / y), $MachinePrecision] * x + x), $MachinePrecision] / 1.0), $MachinePrecision], N[(1.0 - N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;x \leq -1:\\
              \;\;\;\;1 - \frac{-x}{y}\\
              
              \mathbf{elif}\;x \leq 1.22:\\
              \;\;\;\;\frac{\mathsf{fma}\left(\frac{x}{y}, x, x\right)}{1}\\
              
              \mathbf{else}:\\
              \;\;\;\;1 - \frac{1 - x}{y}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if x < -1

                1. Initial program 78.6%

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

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

                    \[\leadsto \mathsf{neg}\left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right) \]
                  2. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto 1 + \color{blue}{-1 \cdot \frac{1 - x}{y}} \]
                7. Step-by-step derivation
                  1. fp-cancel-sign-sub-invN/A

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

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

                    \[\leadsto 1 - \frac{-1}{-1} \cdot \frac{1 - x}{y} \]
                  4. times-fracN/A

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

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

                    \[\leadsto 1 - \frac{\mathsf{neg}\left(\left(1 - x\right)\right)}{\mathsf{neg}\left(y\right)} \]
                  7. frac-2negN/A

                    \[\leadsto 1 - \frac{1 - x}{y} \]
                  8. lower--.f64N/A

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

                    \[\leadsto 1 - \frac{1 - x}{y} \]
                  10. lower--.f6499.0

                    \[\leadsto 1 - \frac{1 - x}{y} \]
                8. Applied rewrites99.0%

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

                  \[\leadsto 1 - \frac{-1 \cdot x}{y} \]
                10. Step-by-step derivation
                  1. mul-1-negN/A

                    \[\leadsto 1 - \frac{\mathsf{neg}\left(x\right)}{y} \]
                  2. lower-neg.f6499.0

                    \[\leadsto 1 - \frac{-x}{y} \]
                11. Applied rewrites99.0%

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

                if -1 < x < 1.21999999999999997

                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. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  if 1.21999999999999997 < x

                  1. Initial program 77.6%

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

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

                      \[\leadsto \mathsf{neg}\left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right) \]
                    2. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto 1 + \color{blue}{-1 \cdot \frac{1 - x}{y}} \]
                  7. Step-by-step derivation
                    1. fp-cancel-sign-sub-invN/A

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

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

                      \[\leadsto 1 - \frac{-1}{-1} \cdot \frac{1 - x}{y} \]
                    4. times-fracN/A

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

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

                      \[\leadsto 1 - \frac{\mathsf{neg}\left(\left(1 - x\right)\right)}{\mathsf{neg}\left(y\right)} \]
                    7. frac-2negN/A

                      \[\leadsto 1 - \frac{1 - x}{y} \]
                    8. lower--.f64N/A

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

                      \[\leadsto 1 - \frac{1 - x}{y} \]
                    10. lower--.f6499.5

                      \[\leadsto 1 - \frac{1 - x}{y} \]
                  8. Applied rewrites99.5%

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

                Alternative 8: 50.6% accurate, 0.8× speedup?

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

                  1. Initial program 92.0%

                    \[\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 rewrites62.6%

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

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

                    1. Initial program 85.5%

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

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

                        \[\leadsto \mathsf{neg}\left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right) \]
                      2. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto 1 \]
                    7. Step-by-step derivation
                      1. Applied rewrites37.2%

                        \[\leadsto 1 \]
                    8. Recombined 2 regimes into one program.
                    9. Final simplification54.9%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(\frac{x}{y} - -1\right)}{x - -1} \leq 0.01:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
                    10. Add Preprocessing

                    Alternative 9: 86.9% accurate, 1.1× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -175000000:\\ \;\;\;\;1 - \frac{-x}{y}\\ \mathbf{elif}\;x \leq 24000:\\ \;\;\;\;\frac{x}{x - -1}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{1 - x}{y}\\ \end{array} \end{array} \]
                    (FPCore (x y)
                     :precision binary64
                     (if (<= x -175000000.0)
                       (- 1.0 (/ (- x) y))
                       (if (<= x 24000.0) (/ x (- x -1.0)) (- 1.0 (/ (- 1.0 x) y)))))
                    double code(double x, double y) {
                    	double tmp;
                    	if (x <= -175000000.0) {
                    		tmp = 1.0 - (-x / y);
                    	} else if (x <= 24000.0) {
                    		tmp = x / (x - -1.0);
                    	} else {
                    		tmp = 1.0 - ((1.0 - 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) :: tmp
                        if (x <= (-175000000.0d0)) then
                            tmp = 1.0d0 - (-x / y)
                        else if (x <= 24000.0d0) then
                            tmp = x / (x - (-1.0d0))
                        else
                            tmp = 1.0d0 - ((1.0d0 - x) / y)
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double x, double y) {
                    	double tmp;
                    	if (x <= -175000000.0) {
                    		tmp = 1.0 - (-x / y);
                    	} else if (x <= 24000.0) {
                    		tmp = x / (x - -1.0);
                    	} else {
                    		tmp = 1.0 - ((1.0 - x) / y);
                    	}
                    	return tmp;
                    }
                    
                    def code(x, y):
                    	tmp = 0
                    	if x <= -175000000.0:
                    		tmp = 1.0 - (-x / y)
                    	elif x <= 24000.0:
                    		tmp = x / (x - -1.0)
                    	else:
                    		tmp = 1.0 - ((1.0 - x) / y)
                    	return tmp
                    
                    function code(x, y)
                    	tmp = 0.0
                    	if (x <= -175000000.0)
                    		tmp = Float64(1.0 - Float64(Float64(-x) / y));
                    	elseif (x <= 24000.0)
                    		tmp = Float64(x / Float64(x - -1.0));
                    	else
                    		tmp = Float64(1.0 - Float64(Float64(1.0 - x) / y));
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(x, y)
                    	tmp = 0.0;
                    	if (x <= -175000000.0)
                    		tmp = 1.0 - (-x / y);
                    	elseif (x <= 24000.0)
                    		tmp = x / (x - -1.0);
                    	else
                    		tmp = 1.0 - ((1.0 - x) / y);
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[x_, y_] := If[LessEqual[x, -175000000.0], N[(1.0 - N[((-x) / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 24000.0], N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;x \leq -175000000:\\
                    \;\;\;\;1 - \frac{-x}{y}\\
                    
                    \mathbf{elif}\;x \leq 24000:\\
                    \;\;\;\;\frac{x}{x - -1}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;1 - \frac{1 - x}{y}\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 3 regimes
                    2. if x < -1.75e8

                      1. Initial program 78.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}{-1 \cdot \left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right)} \]
                      4. Step-by-step derivation
                        1. mul-1-negN/A

                          \[\leadsto \mathsf{neg}\left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right) \]
                        2. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto 1 + \color{blue}{-1 \cdot \frac{1 - x}{y}} \]
                      7. Step-by-step derivation
                        1. fp-cancel-sign-sub-invN/A

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

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

                          \[\leadsto 1 - \frac{-1}{-1} \cdot \frac{1 - x}{y} \]
                        4. times-fracN/A

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

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

                          \[\leadsto 1 - \frac{\mathsf{neg}\left(\left(1 - x\right)\right)}{\mathsf{neg}\left(y\right)} \]
                        7. frac-2negN/A

                          \[\leadsto 1 - \frac{1 - x}{y} \]
                        8. lower--.f64N/A

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

                          \[\leadsto 1 - \frac{1 - x}{y} \]
                        10. lower--.f64100.0

                          \[\leadsto 1 - \frac{1 - x}{y} \]
                      8. Applied rewrites100.0%

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

                        \[\leadsto 1 - \frac{-1 \cdot x}{y} \]
                      10. Step-by-step derivation
                        1. mul-1-negN/A

                          \[\leadsto 1 - \frac{\mathsf{neg}\left(x\right)}{y} \]
                        2. lower-neg.f64100.0

                          \[\leadsto 1 - \frac{-x}{y} \]
                      11. Applied rewrites100.0%

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

                      if -1.75e8 < x < 24000

                      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 rewrites79.8%

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

                        if 24000 < x

                        1. Initial program 77.6%

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

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

                            \[\leadsto \mathsf{neg}\left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right) \]
                          2. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto 1 + \color{blue}{-1 \cdot \frac{1 - x}{y}} \]
                        7. Step-by-step derivation
                          1. fp-cancel-sign-sub-invN/A

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

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

                            \[\leadsto 1 - \frac{-1}{-1} \cdot \frac{1 - x}{y} \]
                          4. times-fracN/A

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

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

                            \[\leadsto 1 - \frac{\mathsf{neg}\left(\left(1 - x\right)\right)}{\mathsf{neg}\left(y\right)} \]
                          7. frac-2negN/A

                            \[\leadsto 1 - \frac{1 - x}{y} \]
                          8. lower--.f64N/A

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

                            \[\leadsto 1 - \frac{1 - x}{y} \]
                          10. lower--.f6499.5

                            \[\leadsto 1 - \frac{1 - x}{y} \]
                        8. Applied rewrites99.5%

                          \[\leadsto 1 - \color{blue}{\frac{1 - x}{y}} \]
                      5. Recombined 3 regimes into one program.
                      6. Final simplification88.8%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -175000000:\\ \;\;\;\;1 - \frac{-x}{y}\\ \mathbf{elif}\;x \leq 24000:\\ \;\;\;\;\frac{x}{x - -1}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{1 - x}{y}\\ \end{array} \]
                      7. Add Preprocessing

                      Alternative 10: 86.8% accurate, 1.2× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -175000000 \lor \neg \left(x \leq 90000\right):\\ \;\;\;\;1 - \frac{-x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - -1}\\ \end{array} \end{array} \]
                      (FPCore (x y)
                       :precision binary64
                       (if (or (<= x -175000000.0) (not (<= x 90000.0)))
                         (- 1.0 (/ (- x) y))
                         (/ x (- x -1.0))))
                      double code(double x, double y) {
                      	double tmp;
                      	if ((x <= -175000000.0) || !(x <= 90000.0)) {
                      		tmp = 1.0 - (-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) :: tmp
                          if ((x <= (-175000000.0d0)) .or. (.not. (x <= 90000.0d0))) then
                              tmp = 1.0d0 - (-x / y)
                          else
                              tmp = x / (x - (-1.0d0))
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double x, double y) {
                      	double tmp;
                      	if ((x <= -175000000.0) || !(x <= 90000.0)) {
                      		tmp = 1.0 - (-x / y);
                      	} else {
                      		tmp = x / (x - -1.0);
                      	}
                      	return tmp;
                      }
                      
                      def code(x, y):
                      	tmp = 0
                      	if (x <= -175000000.0) or not (x <= 90000.0):
                      		tmp = 1.0 - (-x / y)
                      	else:
                      		tmp = x / (x - -1.0)
                      	return tmp
                      
                      function code(x, y)
                      	tmp = 0.0
                      	if ((x <= -175000000.0) || !(x <= 90000.0))
                      		tmp = Float64(1.0 - Float64(Float64(-x) / y));
                      	else
                      		tmp = Float64(x / Float64(x - -1.0));
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(x, y)
                      	tmp = 0.0;
                      	if ((x <= -175000000.0) || ~((x <= 90000.0)))
                      		tmp = 1.0 - (-x / y);
                      	else
                      		tmp = x / (x - -1.0);
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[x_, y_] := If[Or[LessEqual[x, -175000000.0], N[Not[LessEqual[x, 90000.0]], $MachinePrecision]], N[(1.0 - N[((-x) / y), $MachinePrecision]), $MachinePrecision], N[(x / N[(x - -1.0), $MachinePrecision]), $MachinePrecision]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;x \leq -175000000 \lor \neg \left(x \leq 90000\right):\\
                      \;\;\;\;1 - \frac{-x}{y}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\frac{x}{x - -1}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if x < -1.75e8 or 9e4 < x

                        1. Initial program 77.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}{-1 \cdot \left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right)} \]
                        4. Step-by-step derivation
                          1. mul-1-negN/A

                            \[\leadsto \mathsf{neg}\left(x \cdot \left(\frac{1}{x \cdot y} - \left(\frac{1}{x} + \frac{1}{y}\right)\right)\right) \]
                          2. distribute-lft-neg-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto 1 + \color{blue}{-1 \cdot \frac{1 - x}{y}} \]
                        7. Step-by-step derivation
                          1. fp-cancel-sign-sub-invN/A

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

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

                            \[\leadsto 1 - \frac{-1}{-1} \cdot \frac{1 - x}{y} \]
                          4. times-fracN/A

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

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

                            \[\leadsto 1 - \frac{\mathsf{neg}\left(\left(1 - x\right)\right)}{\mathsf{neg}\left(y\right)} \]
                          7. frac-2negN/A

                            \[\leadsto 1 - \frac{1 - x}{y} \]
                          8. lower--.f64N/A

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

                            \[\leadsto 1 - \frac{1 - x}{y} \]
                          10. lower--.f6499.7

                            \[\leadsto 1 - \frac{1 - x}{y} \]
                        8. Applied rewrites99.7%

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

                          \[\leadsto 1 - \frac{-1 \cdot x}{y} \]
                        10. Step-by-step derivation
                          1. mul-1-negN/A

                            \[\leadsto 1 - \frac{\mathsf{neg}\left(x\right)}{y} \]
                          2. lower-neg.f6499.4

                            \[\leadsto 1 - \frac{-x}{y} \]
                        11. Applied rewrites99.4%

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

                        if -1.75e8 < x < 9e4

                        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 rewrites79.8%

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

                          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -175000000 \lor \neg \left(x \leq 90000\right):\\ \;\;\;\;1 - \frac{-x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - -1}\\ \end{array} \]
                        7. Add Preprocessing

                        Alternative 11: 39.4% 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 90.0%

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

                            \[\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 2025037 
                          (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)))