Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, D

Percentage Accurate: 66.2% → 99.8%
Time: 16.4s
Alternatives: 15
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 66.2% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y}{1 + y}\\ t_1 := \frac{1 + y}{y}\\ t_2 := 1 + t\_0\\ t_3 := \frac{x}{t\_1}\\ t_4 := \frac{\left(1 - x\right) \cdot y}{1 + y}\\ t_5 := \frac{y}{t\_1}\\ \mathbf{if}\;t\_4 \leq 0.998:\\ \;\;\;\;\left(\frac{1}{t\_2 \cdot \left(1 + \frac{t\_5}{1 + y}\right)} + \frac{\frac{y}{\frac{t\_1}{t\_0} \cdot \left(\left(1 + y\right) \cdot t\_1\right)}}{t\_2 \cdot \left(-1 + \frac{t\_5}{-1 - y}\right)}\right) + t\_3\\ \mathbf{elif}\;t\_4 \leq 10000:\\ \;\;\;\;t\_3 + \frac{1 + \frac{-1 - \frac{-1 + \frac{1}{y}}{y}}{y}}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{1}{x} + \frac{\left(1 - x\right) \cdot \frac{y}{-1 - y}}{x}\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ y (+ 1.0 y)))
        (t_1 (/ (+ 1.0 y) y))
        (t_2 (+ 1.0 t_0))
        (t_3 (/ x t_1))
        (t_4 (/ (* (- 1.0 x) y) (+ 1.0 y)))
        (t_5 (/ y t_1)))
   (if (<= t_4 0.998)
     (+
      (+
       (/ 1.0 (* t_2 (+ 1.0 (/ t_5 (+ 1.0 y)))))
       (/
        (/ y (* (/ t_1 t_0) (* (+ 1.0 y) t_1)))
        (* t_2 (+ -1.0 (/ t_5 (- -1.0 y))))))
      t_3)
     (if (<= t_4 10000.0)
       (+ t_3 (/ (+ 1.0 (/ (- -1.0 (/ (+ -1.0 (/ 1.0 y)) y)) y)) y))
       (* x (+ (/ 1.0 x) (/ (* (- 1.0 x) (/ y (- -1.0 y))) x)))))))
double code(double x, double y) {
	double t_0 = y / (1.0 + y);
	double t_1 = (1.0 + y) / y;
	double t_2 = 1.0 + t_0;
	double t_3 = x / t_1;
	double t_4 = ((1.0 - x) * y) / (1.0 + y);
	double t_5 = y / t_1;
	double tmp;
	if (t_4 <= 0.998) {
		tmp = ((1.0 / (t_2 * (1.0 + (t_5 / (1.0 + y))))) + ((y / ((t_1 / t_0) * ((1.0 + y) * t_1))) / (t_2 * (-1.0 + (t_5 / (-1.0 - y)))))) + t_3;
	} else if (t_4 <= 10000.0) {
		tmp = t_3 + ((1.0 + ((-1.0 - ((-1.0 + (1.0 / y)) / y)) / y)) / y);
	} else {
		tmp = x * ((1.0 / x) + (((1.0 - x) * (y / (-1.0 - y))) / x));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_0 = y / (1.0d0 + y)
    t_1 = (1.0d0 + y) / y
    t_2 = 1.0d0 + t_0
    t_3 = x / t_1
    t_4 = ((1.0d0 - x) * y) / (1.0d0 + y)
    t_5 = y / t_1
    if (t_4 <= 0.998d0) then
        tmp = ((1.0d0 / (t_2 * (1.0d0 + (t_5 / (1.0d0 + y))))) + ((y / ((t_1 / t_0) * ((1.0d0 + y) * t_1))) / (t_2 * ((-1.0d0) + (t_5 / ((-1.0d0) - y)))))) + t_3
    else if (t_4 <= 10000.0d0) then
        tmp = t_3 + ((1.0d0 + (((-1.0d0) - (((-1.0d0) + (1.0d0 / y)) / y)) / y)) / y)
    else
        tmp = x * ((1.0d0 / x) + (((1.0d0 - x) * (y / ((-1.0d0) - y))) / x))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = y / (1.0 + y);
	double t_1 = (1.0 + y) / y;
	double t_2 = 1.0 + t_0;
	double t_3 = x / t_1;
	double t_4 = ((1.0 - x) * y) / (1.0 + y);
	double t_5 = y / t_1;
	double tmp;
	if (t_4 <= 0.998) {
		tmp = ((1.0 / (t_2 * (1.0 + (t_5 / (1.0 + y))))) + ((y / ((t_1 / t_0) * ((1.0 + y) * t_1))) / (t_2 * (-1.0 + (t_5 / (-1.0 - y)))))) + t_3;
	} else if (t_4 <= 10000.0) {
		tmp = t_3 + ((1.0 + ((-1.0 - ((-1.0 + (1.0 / y)) / y)) / y)) / y);
	} else {
		tmp = x * ((1.0 / x) + (((1.0 - x) * (y / (-1.0 - y))) / x));
	}
	return tmp;
}
def code(x, y):
	t_0 = y / (1.0 + y)
	t_1 = (1.0 + y) / y
	t_2 = 1.0 + t_0
	t_3 = x / t_1
	t_4 = ((1.0 - x) * y) / (1.0 + y)
	t_5 = y / t_1
	tmp = 0
	if t_4 <= 0.998:
		tmp = ((1.0 / (t_2 * (1.0 + (t_5 / (1.0 + y))))) + ((y / ((t_1 / t_0) * ((1.0 + y) * t_1))) / (t_2 * (-1.0 + (t_5 / (-1.0 - y)))))) + t_3
	elif t_4 <= 10000.0:
		tmp = t_3 + ((1.0 + ((-1.0 - ((-1.0 + (1.0 / y)) / y)) / y)) / y)
	else:
		tmp = x * ((1.0 / x) + (((1.0 - x) * (y / (-1.0 - y))) / x))
	return tmp
function code(x, y)
	t_0 = Float64(y / Float64(1.0 + y))
	t_1 = Float64(Float64(1.0 + y) / y)
	t_2 = Float64(1.0 + t_0)
	t_3 = Float64(x / t_1)
	t_4 = Float64(Float64(Float64(1.0 - x) * y) / Float64(1.0 + y))
	t_5 = Float64(y / t_1)
	tmp = 0.0
	if (t_4 <= 0.998)
		tmp = Float64(Float64(Float64(1.0 / Float64(t_2 * Float64(1.0 + Float64(t_5 / Float64(1.0 + y))))) + Float64(Float64(y / Float64(Float64(t_1 / t_0) * Float64(Float64(1.0 + y) * t_1))) / Float64(t_2 * Float64(-1.0 + Float64(t_5 / Float64(-1.0 - y)))))) + t_3);
	elseif (t_4 <= 10000.0)
		tmp = Float64(t_3 + Float64(Float64(1.0 + Float64(Float64(-1.0 - Float64(Float64(-1.0 + Float64(1.0 / y)) / y)) / y)) / y));
	else
		tmp = Float64(x * Float64(Float64(1.0 / x) + Float64(Float64(Float64(1.0 - x) * Float64(y / Float64(-1.0 - y))) / x)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = y / (1.0 + y);
	t_1 = (1.0 + y) / y;
	t_2 = 1.0 + t_0;
	t_3 = x / t_1;
	t_4 = ((1.0 - x) * y) / (1.0 + y);
	t_5 = y / t_1;
	tmp = 0.0;
	if (t_4 <= 0.998)
		tmp = ((1.0 / (t_2 * (1.0 + (t_5 / (1.0 + y))))) + ((y / ((t_1 / t_0) * ((1.0 + y) * t_1))) / (t_2 * (-1.0 + (t_5 / (-1.0 - y)))))) + t_3;
	elseif (t_4 <= 10000.0)
		tmp = t_3 + ((1.0 + ((-1.0 - ((-1.0 + (1.0 / y)) / y)) / y)) / y);
	else
		tmp = x * ((1.0 / x) + (((1.0 - x) * (y / (-1.0 - y))) / x));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 + y), $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(x / t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(y / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$4, 0.998], N[(N[(N[(1.0 / N[(t$95$2 * N[(1.0 + N[(t$95$5 / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(y / N[(N[(t$95$1 / t$95$0), $MachinePrecision] * N[(N[(1.0 + y), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$2 * N[(-1.0 + N[(t$95$5 / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision], If[LessEqual[t$95$4, 10000.0], N[(t$95$3 + N[(N[(1.0 + N[(N[(-1.0 - N[(N[(-1.0 + N[(1.0 / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(1.0 / x), $MachinePrecision] + N[(N[(N[(1.0 - x), $MachinePrecision] * N[(y / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{y}{1 + y}\\
t_1 := \frac{1 + y}{y}\\
t_2 := 1 + t\_0\\
t_3 := \frac{x}{t\_1}\\
t_4 := \frac{\left(1 - x\right) \cdot y}{1 + y}\\
t_5 := \frac{y}{t\_1}\\
\mathbf{if}\;t\_4 \leq 0.998:\\
\;\;\;\;\left(\frac{1}{t\_2 \cdot \left(1 + \frac{t\_5}{1 + y}\right)} + \frac{\frac{y}{\frac{t\_1}{t\_0} \cdot \left(\left(1 + y\right) \cdot t\_1\right)}}{t\_2 \cdot \left(-1 + \frac{t\_5}{-1 - y}\right)}\right) + t\_3\\

\mathbf{elif}\;t\_4 \leq 10000:\\
\;\;\;\;t\_3 + \frac{1 + \frac{-1 - \frac{-1 + \frac{1}{y}}{y}}{y}}{y}\\

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


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

    1. Initial program 95.1%

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

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

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

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

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

        \[\leadsto y \cdot \frac{1 - x}{\mathsf{neg}\left(\left(y + 1\right)\right)} + 1 \]
      6. accelerator-lowering-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\mathsf{neg}\left(\color{blue}{\left(y + 1\right)}\right)\right)\right), 1\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\mathsf{neg}\left(\left(1 + y\right)\right)\right)\right), 1\right) \]
      10. distribute-neg-inN/A

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

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(-1 + \left(\mathsf{neg}\left(\color{blue}{y}\right)\right)\right)\right), 1\right) \]
      12. unsub-negN/A

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(-1 - \color{blue}{y}\right)\right), 1\right) \]
      13. --lowering--.f6499.9%

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(-1, \color{blue}{y}\right)\right), 1\right) \]
    4. Applied egg-rr99.9%

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

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

        \[\leadsto 1 + \frac{1 - x}{-1 - y} \cdot \color{blue}{y} \]
      3. frac-2negN/A

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

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

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

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

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

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

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

        \[\leadsto 1 - \frac{1 - x}{\color{blue}{\frac{1 + y}{y}}} \]
      11. div-subN/A

        \[\leadsto 1 - \left(\frac{1}{\frac{1 + y}{y}} - \color{blue}{\frac{x}{\frac{1 + y}{y}}}\right) \]
      12. associate--r-N/A

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

        \[\leadsto \mathsf{+.f64}\left(\left(1 - \frac{1}{\frac{1 + y}{y}}\right), \color{blue}{\left(\frac{x}{\frac{1 + y}{y}}\right)}\right) \]
    6. Applied egg-rr99.9%

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - \frac{y}{y + 1} \cdot \frac{y}{y + 1}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      3. pow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - {\left(\frac{y}{y + 1}\right)}^{2}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - {\left(\frac{y}{1 + y}\right)}^{2}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      5. pow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - \frac{y}{1 + y} \cdot \frac{y}{1 + y}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      6. div-invN/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(1 - \frac{y}{1 + y} \cdot \frac{y}{1 + y}\right), \left(\frac{1}{1 + \frac{y}{y + 1}}\right)\right), \mathsf{/.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
    8. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\left(1 - \frac{\frac{y}{1 + y}}{\frac{1 + y}{y}}\right) \cdot \frac{1}{1 + \frac{y}{1 + y}}} + \frac{x}{\frac{y + 1}{y}} \]
    9. Step-by-step derivation
      1. un-div-invN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - \frac{\frac{y}{1 + y}}{\frac{1 + y}{y}}}{1 + \frac{y}{1 + y}}\right), \mathsf{/.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      2. flip--N/A

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - \frac{\frac{y}{1 + y}}{\frac{1 + y}{y}} \cdot \frac{\frac{y}{1 + y}}{\frac{1 + y}{y}}}{\left(1 + \frac{y}{1 + y}\right) \cdot \left(1 + \frac{\frac{y}{1 + y}}{\frac{1 + y}{y}}\right)}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      5. div-subN/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{\left(1 + \frac{y}{1 + y}\right) \cdot \left(1 + \frac{\frac{y}{1 + y}}{\frac{1 + y}{y}}\right)}\right), \left(\frac{\frac{\frac{y}{1 + y}}{\frac{1 + y}{y}} \cdot \frac{\frac{y}{1 + y}}{\frac{1 + y}{y}}}{\left(1 + \frac{y}{1 + y}\right) \cdot \left(1 + \frac{\frac{y}{1 + y}}{\frac{1 + y}{y}}\right)}\right)\right), \mathsf{/.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
    10. Applied egg-rr99.9%

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

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

    1. Initial program 13.4%

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

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

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

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

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

        \[\leadsto y \cdot \frac{1 - x}{\mathsf{neg}\left(\left(y + 1\right)\right)} + 1 \]
      6. accelerator-lowering-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\mathsf{neg}\left(\color{blue}{\left(y + 1\right)}\right)\right)\right), 1\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\mathsf{neg}\left(\left(1 + y\right)\right)\right)\right), 1\right) \]
      10. distribute-neg-inN/A

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

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(-1 + \left(\mathsf{neg}\left(\color{blue}{y}\right)\right)\right)\right), 1\right) \]
      12. unsub-negN/A

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(-1 - \color{blue}{y}\right)\right), 1\right) \]
      13. --lowering--.f6413.5%

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(-1, \color{blue}{y}\right)\right), 1\right) \]
    4. Applied egg-rr13.5%

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

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

        \[\leadsto 1 + \frac{1 - x}{-1 - y} \cdot \color{blue}{y} \]
      3. frac-2negN/A

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

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

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

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

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

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

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

        \[\leadsto 1 - \frac{1 - x}{\color{blue}{\frac{1 + y}{y}}} \]
      11. div-subN/A

        \[\leadsto 1 - \left(\frac{1}{\frac{1 + y}{y}} - \color{blue}{\frac{x}{\frac{1 + y}{y}}}\right) \]
      12. associate--r-N/A

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

        \[\leadsto \mathsf{+.f64}\left(\left(1 - \frac{1}{\frac{1 + y}{y}}\right), \color{blue}{\left(\frac{x}{\frac{1 + y}{y}}\right)}\right) \]
    6. Applied egg-rr49.0%

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - \frac{y}{y + 1} \cdot \frac{y}{y + 1}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      3. pow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - {\left(\frac{y}{y + 1}\right)}^{2}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - {\left(\frac{y}{1 + y}\right)}^{2}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      5. pow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - \frac{y}{1 + y} \cdot \frac{y}{1 + y}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      6. div-invN/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(1 - \frac{y}{1 + y} \cdot \frac{y}{1 + y}\right), \left(\frac{1}{1 + \frac{y}{y + 1}}\right)\right), \mathsf{/.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
    8. Applied egg-rr49.3%

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

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(\frac{\left(1 + \frac{1}{{y}^{2}}\right) - \left(\frac{1}{y} + \frac{1}{{y}^{3}}\right)}{y}\right)}, \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
    10. Simplified99.8%

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

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

    1. Initial program 63.8%

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

        \[\leadsto \mathsf{\_.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{y + 1}{\left(1 - x\right) \cdot y}}}\right)\right) \]
      2. div-invN/A

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

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{1}{y + 1}\right), \color{blue}{\left(\frac{1}{\left(1 - x\right) \cdot y}\right)}\right)\right) \]
      5. /-lowering-/.f64N/A

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

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \left(\frac{1}{\left(1 - x\right) \cdot y}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \color{blue}{\left(\left(1 - x\right) \cdot y\right)}\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\left(1 - x\right), \color{blue}{y}\right)\right)\right)\right) \]
      10. --lowering--.f6463.7%

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), y\right)\right)\right)\right) \]
    4. Applied egg-rr63.7%

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \left(\frac{y}{x \cdot \left(1 + y\right)} + \left(\mathsf{neg}\left(\frac{y}{1 + y}\right)\right)\right)\right)\right) \]
      6. unsub-negN/A

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

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{\_.f64}\left(\left(\frac{y}{x \cdot \left(1 + y\right)}\right), \color{blue}{\left(\frac{y}{1 + y}\right)}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(y, \mathsf{*.f64}\left(x, \left(1 + y\right)\right)\right), \left(\frac{y}{1 + y}\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(y, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, y\right)\right)\right), \left(\frac{y}{1 + y}\right)\right)\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(y, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, y\right)\right)\right), \mathsf{/.f64}\left(y, \color{blue}{\left(1 + y\right)}\right)\right)\right)\right) \]
      12. +-lowering-+.f6499.9%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(y, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, y\right)\right)\right), \mathsf{/.f64}\left(y, \mathsf{+.f64}\left(1, \color{blue}{y}\right)\right)\right)\right)\right) \]
    7. Simplified99.9%

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

      \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \color{blue}{\left(\frac{-1 \cdot \frac{x \cdot y}{1 + y} + \frac{y}{1 + y}}{x}\right)}\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{/.f64}\left(\left(-1 \cdot \frac{x \cdot y}{1 + y} + \frac{y}{1 + y}\right), \color{blue}{x}\right)\right)\right) \]
    10. Simplified99.9%

      \[\leadsto x \cdot \left(\frac{1}{x} - \color{blue}{\frac{\left(1 - x\right) \cdot \frac{y}{1 + y}}{x}}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.9%

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

Alternative 2: 99.8% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y}{1 + y}\\ t_1 := \frac{\left(1 - x\right) \cdot y}{1 + y}\\ t_2 := \frac{x}{\frac{1 + y}{y}}\\ \mathbf{if}\;t\_1 \leq 0.998:\\ \;\;\;\;t\_2 + \left(1 + \frac{t\_0}{\frac{-1 - y}{y}}\right) \cdot \frac{1}{1 + t\_0}\\ \mathbf{elif}\;t\_1 \leq 10000:\\ \;\;\;\;t\_2 + \frac{1 + \frac{-1 - \frac{-1 + \frac{1}{y}}{y}}{y}}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{1}{x} + \frac{\left(1 - x\right) \cdot \frac{y}{-1 - y}}{x}\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ y (+ 1.0 y)))
        (t_1 (/ (* (- 1.0 x) y) (+ 1.0 y)))
        (t_2 (/ x (/ (+ 1.0 y) y))))
   (if (<= t_1 0.998)
     (+ t_2 (* (+ 1.0 (/ t_0 (/ (- -1.0 y) y))) (/ 1.0 (+ 1.0 t_0))))
     (if (<= t_1 10000.0)
       (+ t_2 (/ (+ 1.0 (/ (- -1.0 (/ (+ -1.0 (/ 1.0 y)) y)) y)) y))
       (* x (+ (/ 1.0 x) (/ (* (- 1.0 x) (/ y (- -1.0 y))) x)))))))
double code(double x, double y) {
	double t_0 = y / (1.0 + y);
	double t_1 = ((1.0 - x) * y) / (1.0 + y);
	double t_2 = x / ((1.0 + y) / y);
	double tmp;
	if (t_1 <= 0.998) {
		tmp = t_2 + ((1.0 + (t_0 / ((-1.0 - y) / y))) * (1.0 / (1.0 + t_0)));
	} else if (t_1 <= 10000.0) {
		tmp = t_2 + ((1.0 + ((-1.0 - ((-1.0 + (1.0 / y)) / y)) / y)) / y);
	} else {
		tmp = x * ((1.0 / x) + (((1.0 - x) * (y / (-1.0 - y))) / x));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = y / (1.0d0 + y)
    t_1 = ((1.0d0 - x) * y) / (1.0d0 + y)
    t_2 = x / ((1.0d0 + y) / y)
    if (t_1 <= 0.998d0) then
        tmp = t_2 + ((1.0d0 + (t_0 / (((-1.0d0) - y) / y))) * (1.0d0 / (1.0d0 + t_0)))
    else if (t_1 <= 10000.0d0) then
        tmp = t_2 + ((1.0d0 + (((-1.0d0) - (((-1.0d0) + (1.0d0 / y)) / y)) / y)) / y)
    else
        tmp = x * ((1.0d0 / x) + (((1.0d0 - x) * (y / ((-1.0d0) - y))) / x))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = y / (1.0 + y);
	double t_1 = ((1.0 - x) * y) / (1.0 + y);
	double t_2 = x / ((1.0 + y) / y);
	double tmp;
	if (t_1 <= 0.998) {
		tmp = t_2 + ((1.0 + (t_0 / ((-1.0 - y) / y))) * (1.0 / (1.0 + t_0)));
	} else if (t_1 <= 10000.0) {
		tmp = t_2 + ((1.0 + ((-1.0 - ((-1.0 + (1.0 / y)) / y)) / y)) / y);
	} else {
		tmp = x * ((1.0 / x) + (((1.0 - x) * (y / (-1.0 - y))) / x));
	}
	return tmp;
}
def code(x, y):
	t_0 = y / (1.0 + y)
	t_1 = ((1.0 - x) * y) / (1.0 + y)
	t_2 = x / ((1.0 + y) / y)
	tmp = 0
	if t_1 <= 0.998:
		tmp = t_2 + ((1.0 + (t_0 / ((-1.0 - y) / y))) * (1.0 / (1.0 + t_0)))
	elif t_1 <= 10000.0:
		tmp = t_2 + ((1.0 + ((-1.0 - ((-1.0 + (1.0 / y)) / y)) / y)) / y)
	else:
		tmp = x * ((1.0 / x) + (((1.0 - x) * (y / (-1.0 - y))) / x))
	return tmp
function code(x, y)
	t_0 = Float64(y / Float64(1.0 + y))
	t_1 = Float64(Float64(Float64(1.0 - x) * y) / Float64(1.0 + y))
	t_2 = Float64(x / Float64(Float64(1.0 + y) / y))
	tmp = 0.0
	if (t_1 <= 0.998)
		tmp = Float64(t_2 + Float64(Float64(1.0 + Float64(t_0 / Float64(Float64(-1.0 - y) / y))) * Float64(1.0 / Float64(1.0 + t_0))));
	elseif (t_1 <= 10000.0)
		tmp = Float64(t_2 + Float64(Float64(1.0 + Float64(Float64(-1.0 - Float64(Float64(-1.0 + Float64(1.0 / y)) / y)) / y)) / y));
	else
		tmp = Float64(x * Float64(Float64(1.0 / x) + Float64(Float64(Float64(1.0 - x) * Float64(y / Float64(-1.0 - y))) / x)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = y / (1.0 + y);
	t_1 = ((1.0 - x) * y) / (1.0 + y);
	t_2 = x / ((1.0 + y) / y);
	tmp = 0.0;
	if (t_1 <= 0.998)
		tmp = t_2 + ((1.0 + (t_0 / ((-1.0 - y) / y))) * (1.0 / (1.0 + t_0)));
	elseif (t_1 <= 10000.0)
		tmp = t_2 + ((1.0 + ((-1.0 - ((-1.0 + (1.0 / y)) / y)) / y)) / y);
	else
		tmp = x * ((1.0 / x) + (((1.0 - x) * (y / (-1.0 - y))) / x));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[(N[(1.0 + y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.998], N[(t$95$2 + N[(N[(1.0 + N[(t$95$0 / N[(N[(-1.0 - y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 10000.0], N[(t$95$2 + N[(N[(1.0 + N[(N[(-1.0 - N[(N[(-1.0 + N[(1.0 / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(1.0 / x), $MachinePrecision] + N[(N[(N[(1.0 - x), $MachinePrecision] * N[(y / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_1 \leq 10000:\\
\;\;\;\;t\_2 + \frac{1 + \frac{-1 - \frac{-1 + \frac{1}{y}}{y}}{y}}{y}\\

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


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

    1. Initial program 95.1%

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

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

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

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

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

        \[\leadsto y \cdot \frac{1 - x}{\mathsf{neg}\left(\left(y + 1\right)\right)} + 1 \]
      6. accelerator-lowering-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\mathsf{neg}\left(\color{blue}{\left(y + 1\right)}\right)\right)\right), 1\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\mathsf{neg}\left(\left(1 + y\right)\right)\right)\right), 1\right) \]
      10. distribute-neg-inN/A

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

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(-1 + \left(\mathsf{neg}\left(\color{blue}{y}\right)\right)\right)\right), 1\right) \]
      12. unsub-negN/A

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(-1 - \color{blue}{y}\right)\right), 1\right) \]
      13. --lowering--.f6499.9%

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(-1, \color{blue}{y}\right)\right), 1\right) \]
    4. Applied egg-rr99.9%

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

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

        \[\leadsto 1 + \frac{1 - x}{-1 - y} \cdot \color{blue}{y} \]
      3. frac-2negN/A

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

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

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

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

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

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

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

        \[\leadsto 1 - \frac{1 - x}{\color{blue}{\frac{1 + y}{y}}} \]
      11. div-subN/A

        \[\leadsto 1 - \left(\frac{1}{\frac{1 + y}{y}} - \color{blue}{\frac{x}{\frac{1 + y}{y}}}\right) \]
      12. associate--r-N/A

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

        \[\leadsto \mathsf{+.f64}\left(\left(1 - \frac{1}{\frac{1 + y}{y}}\right), \color{blue}{\left(\frac{x}{\frac{1 + y}{y}}\right)}\right) \]
    6. Applied egg-rr99.9%

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - \frac{y}{y + 1} \cdot \frac{y}{y + 1}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      3. pow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - {\left(\frac{y}{y + 1}\right)}^{2}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - {\left(\frac{y}{1 + y}\right)}^{2}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      5. pow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - \frac{y}{1 + y} \cdot \frac{y}{1 + y}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      6. div-invN/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(1 - \frac{y}{1 + y} \cdot \frac{y}{1 + y}\right), \left(\frac{1}{1 + \frac{y}{y + 1}}\right)\right), \mathsf{/.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
    8. Applied egg-rr99.9%

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

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

    1. Initial program 13.4%

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

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

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

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

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

        \[\leadsto y \cdot \frac{1 - x}{\mathsf{neg}\left(\left(y + 1\right)\right)} + 1 \]
      6. accelerator-lowering-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\mathsf{neg}\left(\color{blue}{\left(y + 1\right)}\right)\right)\right), 1\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\mathsf{neg}\left(\left(1 + y\right)\right)\right)\right), 1\right) \]
      10. distribute-neg-inN/A

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

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(-1 + \left(\mathsf{neg}\left(\color{blue}{y}\right)\right)\right)\right), 1\right) \]
      12. unsub-negN/A

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(-1 - \color{blue}{y}\right)\right), 1\right) \]
      13. --lowering--.f6413.5%

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(-1, \color{blue}{y}\right)\right), 1\right) \]
    4. Applied egg-rr13.5%

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

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

        \[\leadsto 1 + \frac{1 - x}{-1 - y} \cdot \color{blue}{y} \]
      3. frac-2negN/A

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

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

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

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

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

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

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

        \[\leadsto 1 - \frac{1 - x}{\color{blue}{\frac{1 + y}{y}}} \]
      11. div-subN/A

        \[\leadsto 1 - \left(\frac{1}{\frac{1 + y}{y}} - \color{blue}{\frac{x}{\frac{1 + y}{y}}}\right) \]
      12. associate--r-N/A

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

        \[\leadsto \mathsf{+.f64}\left(\left(1 - \frac{1}{\frac{1 + y}{y}}\right), \color{blue}{\left(\frac{x}{\frac{1 + y}{y}}\right)}\right) \]
    6. Applied egg-rr49.0%

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - \frac{y}{y + 1} \cdot \frac{y}{y + 1}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      3. pow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - {\left(\frac{y}{y + 1}\right)}^{2}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - {\left(\frac{y}{1 + y}\right)}^{2}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      5. pow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - \frac{y}{1 + y} \cdot \frac{y}{1 + y}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      6. div-invN/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(1 - \frac{y}{1 + y} \cdot \frac{y}{1 + y}\right), \left(\frac{1}{1 + \frac{y}{y + 1}}\right)\right), \mathsf{/.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
    8. Applied egg-rr49.3%

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

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(\frac{\left(1 + \frac{1}{{y}^{2}}\right) - \left(\frac{1}{y} + \frac{1}{{y}^{3}}\right)}{y}\right)}, \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
    10. Simplified99.8%

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

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

    1. Initial program 63.8%

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

        \[\leadsto \mathsf{\_.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{y + 1}{\left(1 - x\right) \cdot y}}}\right)\right) \]
      2. div-invN/A

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

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{1}{y + 1}\right), \color{blue}{\left(\frac{1}{\left(1 - x\right) \cdot y}\right)}\right)\right) \]
      5. /-lowering-/.f64N/A

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

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \left(\frac{1}{\left(1 - x\right) \cdot y}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \color{blue}{\left(\left(1 - x\right) \cdot y\right)}\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\left(1 - x\right), \color{blue}{y}\right)\right)\right)\right) \]
      10. --lowering--.f6463.7%

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), y\right)\right)\right)\right) \]
    4. Applied egg-rr63.7%

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \left(\frac{y}{x \cdot \left(1 + y\right)} + \left(\mathsf{neg}\left(\frac{y}{1 + y}\right)\right)\right)\right)\right) \]
      6. unsub-negN/A

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

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{\_.f64}\left(\left(\frac{y}{x \cdot \left(1 + y\right)}\right), \color{blue}{\left(\frac{y}{1 + y}\right)}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(y, \mathsf{*.f64}\left(x, \left(1 + y\right)\right)\right), \left(\frac{y}{1 + y}\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(y, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, y\right)\right)\right), \left(\frac{y}{1 + y}\right)\right)\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(y, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, y\right)\right)\right), \mathsf{/.f64}\left(y, \color{blue}{\left(1 + y\right)}\right)\right)\right)\right) \]
      12. +-lowering-+.f6499.9%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(y, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, y\right)\right)\right), \mathsf{/.f64}\left(y, \mathsf{+.f64}\left(1, \color{blue}{y}\right)\right)\right)\right)\right) \]
    7. Simplified99.9%

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

      \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \color{blue}{\left(\frac{-1 \cdot \frac{x \cdot y}{1 + y} + \frac{y}{1 + y}}{x}\right)}\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{/.f64}\left(\left(-1 \cdot \frac{x \cdot y}{1 + y} + \frac{y}{1 + y}\right), \color{blue}{x}\right)\right)\right) \]
    10. Simplified99.9%

      \[\leadsto x \cdot \left(\frac{1}{x} - \color{blue}{\frac{\left(1 - x\right) \cdot \frac{y}{1 + y}}{x}}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.9%

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

Alternative 3: 99.8% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y}{1 + y}\\ t_1 := \frac{\left(1 - x\right) \cdot y}{1 + y}\\ t_2 := \frac{x}{\frac{1 + y}{y}}\\ \mathbf{if}\;t\_1 \leq 0.998:\\ \;\;\;\;t\_2 + \frac{1 + \frac{t\_0}{\frac{-1 - y}{y}}}{1 + t\_0}\\ \mathbf{elif}\;t\_1 \leq 10000:\\ \;\;\;\;t\_2 + \frac{1 + \frac{-1 - \frac{-1 + \frac{1}{y}}{y}}{y}}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{1}{x} + \frac{\left(1 - x\right) \cdot \frac{y}{-1 - y}}{x}\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ y (+ 1.0 y)))
        (t_1 (/ (* (- 1.0 x) y) (+ 1.0 y)))
        (t_2 (/ x (/ (+ 1.0 y) y))))
   (if (<= t_1 0.998)
     (+ t_2 (/ (+ 1.0 (/ t_0 (/ (- -1.0 y) y))) (+ 1.0 t_0)))
     (if (<= t_1 10000.0)
       (+ t_2 (/ (+ 1.0 (/ (- -1.0 (/ (+ -1.0 (/ 1.0 y)) y)) y)) y))
       (* x (+ (/ 1.0 x) (/ (* (- 1.0 x) (/ y (- -1.0 y))) x)))))))
double code(double x, double y) {
	double t_0 = y / (1.0 + y);
	double t_1 = ((1.0 - x) * y) / (1.0 + y);
	double t_2 = x / ((1.0 + y) / y);
	double tmp;
	if (t_1 <= 0.998) {
		tmp = t_2 + ((1.0 + (t_0 / ((-1.0 - y) / y))) / (1.0 + t_0));
	} else if (t_1 <= 10000.0) {
		tmp = t_2 + ((1.0 + ((-1.0 - ((-1.0 + (1.0 / y)) / y)) / y)) / y);
	} else {
		tmp = x * ((1.0 / x) + (((1.0 - x) * (y / (-1.0 - y))) / x));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = y / (1.0d0 + y)
    t_1 = ((1.0d0 - x) * y) / (1.0d0 + y)
    t_2 = x / ((1.0d0 + y) / y)
    if (t_1 <= 0.998d0) then
        tmp = t_2 + ((1.0d0 + (t_0 / (((-1.0d0) - y) / y))) / (1.0d0 + t_0))
    else if (t_1 <= 10000.0d0) then
        tmp = t_2 + ((1.0d0 + (((-1.0d0) - (((-1.0d0) + (1.0d0 / y)) / y)) / y)) / y)
    else
        tmp = x * ((1.0d0 / x) + (((1.0d0 - x) * (y / ((-1.0d0) - y))) / x))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = y / (1.0 + y);
	double t_1 = ((1.0 - x) * y) / (1.0 + y);
	double t_2 = x / ((1.0 + y) / y);
	double tmp;
	if (t_1 <= 0.998) {
		tmp = t_2 + ((1.0 + (t_0 / ((-1.0 - y) / y))) / (1.0 + t_0));
	} else if (t_1 <= 10000.0) {
		tmp = t_2 + ((1.0 + ((-1.0 - ((-1.0 + (1.0 / y)) / y)) / y)) / y);
	} else {
		tmp = x * ((1.0 / x) + (((1.0 - x) * (y / (-1.0 - y))) / x));
	}
	return tmp;
}
def code(x, y):
	t_0 = y / (1.0 + y)
	t_1 = ((1.0 - x) * y) / (1.0 + y)
	t_2 = x / ((1.0 + y) / y)
	tmp = 0
	if t_1 <= 0.998:
		tmp = t_2 + ((1.0 + (t_0 / ((-1.0 - y) / y))) / (1.0 + t_0))
	elif t_1 <= 10000.0:
		tmp = t_2 + ((1.0 + ((-1.0 - ((-1.0 + (1.0 / y)) / y)) / y)) / y)
	else:
		tmp = x * ((1.0 / x) + (((1.0 - x) * (y / (-1.0 - y))) / x))
	return tmp
function code(x, y)
	t_0 = Float64(y / Float64(1.0 + y))
	t_1 = Float64(Float64(Float64(1.0 - x) * y) / Float64(1.0 + y))
	t_2 = Float64(x / Float64(Float64(1.0 + y) / y))
	tmp = 0.0
	if (t_1 <= 0.998)
		tmp = Float64(t_2 + Float64(Float64(1.0 + Float64(t_0 / Float64(Float64(-1.0 - y) / y))) / Float64(1.0 + t_0)));
	elseif (t_1 <= 10000.0)
		tmp = Float64(t_2 + Float64(Float64(1.0 + Float64(Float64(-1.0 - Float64(Float64(-1.0 + Float64(1.0 / y)) / y)) / y)) / y));
	else
		tmp = Float64(x * Float64(Float64(1.0 / x) + Float64(Float64(Float64(1.0 - x) * Float64(y / Float64(-1.0 - y))) / x)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = y / (1.0 + y);
	t_1 = ((1.0 - x) * y) / (1.0 + y);
	t_2 = x / ((1.0 + y) / y);
	tmp = 0.0;
	if (t_1 <= 0.998)
		tmp = t_2 + ((1.0 + (t_0 / ((-1.0 - y) / y))) / (1.0 + t_0));
	elseif (t_1 <= 10000.0)
		tmp = t_2 + ((1.0 + ((-1.0 - ((-1.0 + (1.0 / y)) / y)) / y)) / y);
	else
		tmp = x * ((1.0 / x) + (((1.0 - x) * (y / (-1.0 - y))) / x));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x / N[(N[(1.0 + y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.998], N[(t$95$2 + N[(N[(1.0 + N[(t$95$0 / N[(N[(-1.0 - y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 10000.0], N[(t$95$2 + N[(N[(1.0 + N[(N[(-1.0 - N[(N[(-1.0 + N[(1.0 / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(1.0 / x), $MachinePrecision] + N[(N[(N[(1.0 - x), $MachinePrecision] * N[(y / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_1 \leq 10000:\\
\;\;\;\;t\_2 + \frac{1 + \frac{-1 - \frac{-1 + \frac{1}{y}}{y}}{y}}{y}\\

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


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

    1. Initial program 95.1%

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

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

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

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

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

        \[\leadsto y \cdot \frac{1 - x}{\mathsf{neg}\left(\left(y + 1\right)\right)} + 1 \]
      6. accelerator-lowering-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\mathsf{neg}\left(\color{blue}{\left(y + 1\right)}\right)\right)\right), 1\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\mathsf{neg}\left(\left(1 + y\right)\right)\right)\right), 1\right) \]
      10. distribute-neg-inN/A

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

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(-1 + \left(\mathsf{neg}\left(\color{blue}{y}\right)\right)\right)\right), 1\right) \]
      12. unsub-negN/A

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(-1 - \color{blue}{y}\right)\right), 1\right) \]
      13. --lowering--.f6499.9%

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(-1, \color{blue}{y}\right)\right), 1\right) \]
    4. Applied egg-rr99.9%

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

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

        \[\leadsto 1 + \frac{1 - x}{-1 - y} \cdot \color{blue}{y} \]
      3. frac-2negN/A

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

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

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

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

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

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

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

        \[\leadsto 1 - \frac{1 - x}{\color{blue}{\frac{1 + y}{y}}} \]
      11. div-subN/A

        \[\leadsto 1 - \left(\frac{1}{\frac{1 + y}{y}} - \color{blue}{\frac{x}{\frac{1 + y}{y}}}\right) \]
      12. associate--r-N/A

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

        \[\leadsto \mathsf{+.f64}\left(\left(1 - \frac{1}{\frac{1 + y}{y}}\right), \color{blue}{\left(\frac{x}{\frac{1 + y}{y}}\right)}\right) \]
    6. Applied egg-rr99.9%

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

        \[\leadsto \mathsf{+.f64}\left(\left(1 + \left(\mathsf{neg}\left(\frac{y}{y + 1}\right)\right)\right), \mathsf{/.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      2. flip-+N/A

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

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - \left(\mathsf{neg}\left(\frac{y}{y + 1}\right)\right) \cdot \left(\mathsf{neg}\left(\frac{y}{y + 1}\right)\right)}{1 - \left(\mathsf{neg}\left(\frac{y}{y + 1}\right)\right)}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      4. sqr-negN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - \frac{y}{y + 1} \cdot \frac{y}{y + 1}}{1 - \left(\mathsf{neg}\left(\frac{y}{y + 1}\right)\right)}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      5. pow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - {\left(\frac{y}{y + 1}\right)}^{2}}{1 - \left(\mathsf{neg}\left(\frac{y}{y + 1}\right)\right)}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - {\left(\frac{y}{1 + y}\right)}^{2}}{1 - \left(\mathsf{neg}\left(\frac{y}{y + 1}\right)\right)}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      7. pow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - \frac{y}{1 + y} \cdot \frac{y}{1 + y}}{1 - \left(\mathsf{neg}\left(\frac{y}{y + 1}\right)\right)}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(1 - \frac{y}{1 + y} \cdot \frac{y}{1 + y}\right), \left(1 - \left(\mathsf{neg}\left(\frac{y}{y + 1}\right)\right)\right)\right), \mathsf{/.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
    8. Applied egg-rr99.9%

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

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

    1. Initial program 13.4%

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

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

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

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

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

        \[\leadsto y \cdot \frac{1 - x}{\mathsf{neg}\left(\left(y + 1\right)\right)} + 1 \]
      6. accelerator-lowering-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\mathsf{neg}\left(\color{blue}{\left(y + 1\right)}\right)\right)\right), 1\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\mathsf{neg}\left(\left(1 + y\right)\right)\right)\right), 1\right) \]
      10. distribute-neg-inN/A

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

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(-1 + \left(\mathsf{neg}\left(\color{blue}{y}\right)\right)\right)\right), 1\right) \]
      12. unsub-negN/A

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(-1 - \color{blue}{y}\right)\right), 1\right) \]
      13. --lowering--.f6413.5%

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(-1, \color{blue}{y}\right)\right), 1\right) \]
    4. Applied egg-rr13.5%

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

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

        \[\leadsto 1 + \frac{1 - x}{-1 - y} \cdot \color{blue}{y} \]
      3. frac-2negN/A

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

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

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

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

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

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

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

        \[\leadsto 1 - \frac{1 - x}{\color{blue}{\frac{1 + y}{y}}} \]
      11. div-subN/A

        \[\leadsto 1 - \left(\frac{1}{\frac{1 + y}{y}} - \color{blue}{\frac{x}{\frac{1 + y}{y}}}\right) \]
      12. associate--r-N/A

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

        \[\leadsto \mathsf{+.f64}\left(\left(1 - \frac{1}{\frac{1 + y}{y}}\right), \color{blue}{\left(\frac{x}{\frac{1 + y}{y}}\right)}\right) \]
    6. Applied egg-rr49.0%

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - \frac{y}{y + 1} \cdot \frac{y}{y + 1}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      3. pow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - {\left(\frac{y}{y + 1}\right)}^{2}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - {\left(\frac{y}{1 + y}\right)}^{2}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      5. pow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - \frac{y}{1 + y} \cdot \frac{y}{1 + y}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      6. div-invN/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(1 - \frac{y}{1 + y} \cdot \frac{y}{1 + y}\right), \left(\frac{1}{1 + \frac{y}{y + 1}}\right)\right), \mathsf{/.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
    8. Applied egg-rr49.3%

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

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(\frac{\left(1 + \frac{1}{{y}^{2}}\right) - \left(\frac{1}{y} + \frac{1}{{y}^{3}}\right)}{y}\right)}, \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
    10. Simplified99.8%

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

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

    1. Initial program 63.8%

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

        \[\leadsto \mathsf{\_.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{y + 1}{\left(1 - x\right) \cdot y}}}\right)\right) \]
      2. div-invN/A

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

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{1}{y + 1}\right), \color{blue}{\left(\frac{1}{\left(1 - x\right) \cdot y}\right)}\right)\right) \]
      5. /-lowering-/.f64N/A

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

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \left(\frac{1}{\left(1 - x\right) \cdot y}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \color{blue}{\left(\left(1 - x\right) \cdot y\right)}\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\left(1 - x\right), \color{blue}{y}\right)\right)\right)\right) \]
      10. --lowering--.f6463.7%

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), y\right)\right)\right)\right) \]
    4. Applied egg-rr63.7%

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \left(\frac{y}{x \cdot \left(1 + y\right)} + \left(\mathsf{neg}\left(\frac{y}{1 + y}\right)\right)\right)\right)\right) \]
      6. unsub-negN/A

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

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{\_.f64}\left(\left(\frac{y}{x \cdot \left(1 + y\right)}\right), \color{blue}{\left(\frac{y}{1 + y}\right)}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(y, \mathsf{*.f64}\left(x, \left(1 + y\right)\right)\right), \left(\frac{y}{1 + y}\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(y, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, y\right)\right)\right), \left(\frac{y}{1 + y}\right)\right)\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(y, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, y\right)\right)\right), \mathsf{/.f64}\left(y, \color{blue}{\left(1 + y\right)}\right)\right)\right)\right) \]
      12. +-lowering-+.f6499.9%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(y, \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(1, y\right)\right)\right), \mathsf{/.f64}\left(y, \mathsf{+.f64}\left(1, \color{blue}{y}\right)\right)\right)\right)\right) \]
    7. Simplified99.9%

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

      \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \color{blue}{\left(\frac{-1 \cdot \frac{x \cdot y}{1 + y} + \frac{y}{1 + y}}{x}\right)}\right)\right) \]
    9. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, x\right), \mathsf{/.f64}\left(\left(-1 \cdot \frac{x \cdot y}{1 + y} + \frac{y}{1 + y}\right), \color{blue}{x}\right)\right)\right) \]
    10. Simplified99.9%

      \[\leadsto x \cdot \left(\frac{1}{x} - \color{blue}{\frac{\left(1 - x\right) \cdot \frac{y}{1 + y}}{x}}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.9%

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

Alternative 4: 99.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1700:\\ \;\;\;\;\frac{x}{\frac{1 + y}{y}} + \frac{1 + \frac{-1 - \frac{-1 + \frac{1}{y}}{y}}{y}}{y}\\ \mathbf{elif}\;y \leq 350000:\\ \;\;\;\;1 + \frac{\left(1 - x\right) \cdot y}{-1 - y}\\ \mathbf{else}:\\ \;\;\;\;x + \left(1 + \frac{-1}{y}\right) \cdot \frac{1 - x}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -1700.0)
   (+
    (/ x (/ (+ 1.0 y) y))
    (/ (+ 1.0 (/ (- -1.0 (/ (+ -1.0 (/ 1.0 y)) y)) y)) y))
   (if (<= y 350000.0)
     (+ 1.0 (/ (* (- 1.0 x) y) (- -1.0 y)))
     (+ x (* (+ 1.0 (/ -1.0 y)) (/ (- 1.0 x) y))))))
double code(double x, double y) {
	double tmp;
	if (y <= -1700.0) {
		tmp = (x / ((1.0 + y) / y)) + ((1.0 + ((-1.0 - ((-1.0 + (1.0 / y)) / y)) / y)) / y);
	} else if (y <= 350000.0) {
		tmp = 1.0 + (((1.0 - x) * y) / (-1.0 - y));
	} else {
		tmp = x + ((1.0 + (-1.0 / y)) * ((1.0 - x) / y));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-1700.0d0)) then
        tmp = (x / ((1.0d0 + y) / y)) + ((1.0d0 + (((-1.0d0) - (((-1.0d0) + (1.0d0 / y)) / y)) / y)) / y)
    else if (y <= 350000.0d0) then
        tmp = 1.0d0 + (((1.0d0 - x) * y) / ((-1.0d0) - y))
    else
        tmp = x + ((1.0d0 + ((-1.0d0) / y)) * ((1.0d0 - x) / y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -1700.0) {
		tmp = (x / ((1.0 + y) / y)) + ((1.0 + ((-1.0 - ((-1.0 + (1.0 / y)) / y)) / y)) / y);
	} else if (y <= 350000.0) {
		tmp = 1.0 + (((1.0 - x) * y) / (-1.0 - y));
	} else {
		tmp = x + ((1.0 + (-1.0 / y)) * ((1.0 - x) / y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -1700.0:
		tmp = (x / ((1.0 + y) / y)) + ((1.0 + ((-1.0 - ((-1.0 + (1.0 / y)) / y)) / y)) / y)
	elif y <= 350000.0:
		tmp = 1.0 + (((1.0 - x) * y) / (-1.0 - y))
	else:
		tmp = x + ((1.0 + (-1.0 / y)) * ((1.0 - x) / y))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -1700.0)
		tmp = Float64(Float64(x / Float64(Float64(1.0 + y) / y)) + Float64(Float64(1.0 + Float64(Float64(-1.0 - Float64(Float64(-1.0 + Float64(1.0 / y)) / y)) / y)) / y));
	elseif (y <= 350000.0)
		tmp = Float64(1.0 + Float64(Float64(Float64(1.0 - x) * y) / Float64(-1.0 - y)));
	else
		tmp = Float64(x + Float64(Float64(1.0 + Float64(-1.0 / y)) * Float64(Float64(1.0 - x) / y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -1700.0)
		tmp = (x / ((1.0 + y) / y)) + ((1.0 + ((-1.0 - ((-1.0 + (1.0 / y)) / y)) / y)) / y);
	elseif (y <= 350000.0)
		tmp = 1.0 + (((1.0 - x) * y) / (-1.0 - y));
	else
		tmp = x + ((1.0 + (-1.0 / y)) * ((1.0 - x) / y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -1700.0], N[(N[(x / N[(N[(1.0 + y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 + N[(N[(-1.0 - N[(N[(-1.0 + N[(1.0 / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 350000.0], N[(1.0 + N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(1.0 + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1700:\\
\;\;\;\;\frac{x}{\frac{1 + y}{y}} + \frac{1 + \frac{-1 - \frac{-1 + \frac{1}{y}}{y}}{y}}{y}\\

\mathbf{elif}\;y \leq 350000:\\
\;\;\;\;1 + \frac{\left(1 - x\right) \cdot y}{-1 - y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1700

    1. Initial program 38.2%

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

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

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

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

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

        \[\leadsto y \cdot \frac{1 - x}{\mathsf{neg}\left(\left(y + 1\right)\right)} + 1 \]
      6. accelerator-lowering-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\mathsf{neg}\left(\color{blue}{\left(y + 1\right)}\right)\right)\right), 1\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\mathsf{neg}\left(\left(1 + y\right)\right)\right)\right), 1\right) \]
      10. distribute-neg-inN/A

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

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(-1 + \left(\mathsf{neg}\left(\color{blue}{y}\right)\right)\right)\right), 1\right) \]
      12. unsub-negN/A

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(-1 - \color{blue}{y}\right)\right), 1\right) \]
      13. --lowering--.f6461.1%

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(-1, \color{blue}{y}\right)\right), 1\right) \]
    4. Applied egg-rr61.1%

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

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

        \[\leadsto 1 + \frac{1 - x}{-1 - y} \cdot \color{blue}{y} \]
      3. frac-2negN/A

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

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

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

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

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

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

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

        \[\leadsto 1 - \frac{1 - x}{\color{blue}{\frac{1 + y}{y}}} \]
      11. div-subN/A

        \[\leadsto 1 - \left(\frac{1}{\frac{1 + y}{y}} - \color{blue}{\frac{x}{\frac{1 + y}{y}}}\right) \]
      12. associate--r-N/A

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

        \[\leadsto \mathsf{+.f64}\left(\left(1 - \frac{1}{\frac{1 + y}{y}}\right), \color{blue}{\left(\frac{x}{\frac{1 + y}{y}}\right)}\right) \]
    6. Applied egg-rr75.8%

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

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

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - \frac{y}{y + 1} \cdot \frac{y}{y + 1}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      3. pow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - {\left(\frac{y}{y + 1}\right)}^{2}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - {\left(\frac{y}{1 + y}\right)}^{2}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      5. pow2N/A

        \[\leadsto \mathsf{+.f64}\left(\left(\frac{1 - \frac{y}{1 + y} \cdot \frac{y}{1 + y}}{1 + \frac{y}{y + 1}}\right), \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
      6. div-invN/A

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

        \[\leadsto \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(1 - \frac{y}{1 + y} \cdot \frac{y}{1 + y}\right), \left(\frac{1}{1 + \frac{y}{y + 1}}\right)\right), \mathsf{/.f64}\left(\color{blue}{x}, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
    8. Applied egg-rr76.1%

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

      \[\leadsto \mathsf{+.f64}\left(\color{blue}{\left(\frac{\left(1 + \frac{1}{{y}^{2}}\right) - \left(\frac{1}{y} + \frac{1}{{y}^{3}}\right)}{y}\right)}, \mathsf{/.f64}\left(x, \mathsf{/.f64}\left(\mathsf{+.f64}\left(y, 1\right), y\right)\right)\right) \]
    10. Simplified99.9%

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

    if -1700 < y < 3.5e5

    1. Initial program 99.8%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Add Preprocessing

    if 3.5e5 < y

    1. Initial program 35.0%

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

      \[\leadsto \color{blue}{\left(x + \left(-1 \cdot \frac{1 + -1 \cdot x}{{y}^{2}} + \frac{1}{y}\right)\right) - \frac{x}{y}} \]
    4. Simplified99.9%

      \[\leadsto \color{blue}{x + \frac{x + -1}{y} \cdot \left(\frac{1}{y} + -1\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.9%

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

Alternative 5: 99.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1 - x}{y}\\ \mathbf{if}\;y \leq -14500000000:\\ \;\;\;\;x + \left(\frac{x + -1}{y \cdot y} + t\_0\right)\\ \mathbf{elif}\;y \leq 350000:\\ \;\;\;\;1 + \frac{\left(1 - x\right) \cdot y}{-1 - y}\\ \mathbf{else}:\\ \;\;\;\;x + \left(1 + \frac{-1}{y}\right) \cdot t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (- 1.0 x) y)))
   (if (<= y -14500000000.0)
     (+ x (+ (/ (+ x -1.0) (* y y)) t_0))
     (if (<= y 350000.0)
       (+ 1.0 (/ (* (- 1.0 x) y) (- -1.0 y)))
       (+ x (* (+ 1.0 (/ -1.0 y)) t_0))))))
double code(double x, double y) {
	double t_0 = (1.0 - x) / y;
	double tmp;
	if (y <= -14500000000.0) {
		tmp = x + (((x + -1.0) / (y * y)) + t_0);
	} else if (y <= 350000.0) {
		tmp = 1.0 + (((1.0 - x) * y) / (-1.0 - y));
	} else {
		tmp = x + ((1.0 + (-1.0 / y)) * t_0);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (1.0d0 - x) / y
    if (y <= (-14500000000.0d0)) then
        tmp = x + (((x + (-1.0d0)) / (y * y)) + t_0)
    else if (y <= 350000.0d0) then
        tmp = 1.0d0 + (((1.0d0 - x) * y) / ((-1.0d0) - y))
    else
        tmp = x + ((1.0d0 + ((-1.0d0) / y)) * t_0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (1.0 - x) / y;
	double tmp;
	if (y <= -14500000000.0) {
		tmp = x + (((x + -1.0) / (y * y)) + t_0);
	} else if (y <= 350000.0) {
		tmp = 1.0 + (((1.0 - x) * y) / (-1.0 - y));
	} else {
		tmp = x + ((1.0 + (-1.0 / y)) * t_0);
	}
	return tmp;
}
def code(x, y):
	t_0 = (1.0 - x) / y
	tmp = 0
	if y <= -14500000000.0:
		tmp = x + (((x + -1.0) / (y * y)) + t_0)
	elif y <= 350000.0:
		tmp = 1.0 + (((1.0 - x) * y) / (-1.0 - y))
	else:
		tmp = x + ((1.0 + (-1.0 / y)) * t_0)
	return tmp
function code(x, y)
	t_0 = Float64(Float64(1.0 - x) / y)
	tmp = 0.0
	if (y <= -14500000000.0)
		tmp = Float64(x + Float64(Float64(Float64(x + -1.0) / Float64(y * y)) + t_0));
	elseif (y <= 350000.0)
		tmp = Float64(1.0 + Float64(Float64(Float64(1.0 - x) * y) / Float64(-1.0 - y)));
	else
		tmp = Float64(x + Float64(Float64(1.0 + Float64(-1.0 / y)) * t_0));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (1.0 - x) / y;
	tmp = 0.0;
	if (y <= -14500000000.0)
		tmp = x + (((x + -1.0) / (y * y)) + t_0);
	elseif (y <= 350000.0)
		tmp = 1.0 + (((1.0 - x) * y) / (-1.0 - y));
	else
		tmp = x + ((1.0 + (-1.0 / y)) * t_0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -14500000000.0], N[(x + N[(N[(N[(x + -1.0), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 350000.0], N[(1.0 + N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(1.0 + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 350000:\\
\;\;\;\;1 + \frac{\left(1 - x\right) \cdot y}{-1 - y}\\

\mathbf{else}:\\
\;\;\;\;x + \left(1 + \frac{-1}{y}\right) \cdot t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.45e10

    1. Initial program 36.1%

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

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

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

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

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

        \[\leadsto y \cdot \frac{1 - x}{\mathsf{neg}\left(\left(y + 1\right)\right)} + 1 \]
      6. accelerator-lowering-fma.f64N/A

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

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

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\mathsf{neg}\left(\color{blue}{\left(y + 1\right)}\right)\right)\right), 1\right) \]
      9. +-commutativeN/A

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\mathsf{neg}\left(\left(1 + y\right)\right)\right)\right), 1\right) \]
      10. distribute-neg-inN/A

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

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(-1 + \left(\mathsf{neg}\left(\color{blue}{y}\right)\right)\right)\right), 1\right) \]
      12. unsub-negN/A

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(-1 - \color{blue}{y}\right)\right), 1\right) \]
      13. --lowering--.f6459.8%

        \[\leadsto \mathsf{fma.f64}\left(y, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(-1, \color{blue}{y}\right)\right), 1\right) \]
    4. Applied egg-rr59.8%

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

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

        \[\leadsto 1 + \frac{1 - x}{-1 - y} \cdot \color{blue}{y} \]
      3. frac-2negN/A

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

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

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

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

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

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

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

        \[\leadsto 1 - \frac{1 - x}{\color{blue}{\frac{1 + y}{y}}} \]
      11. div-subN/A

        \[\leadsto 1 - \left(\frac{1}{\frac{1 + y}{y}} - \color{blue}{\frac{x}{\frac{1 + y}{y}}}\right) \]
      12. associate--r-N/A

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

        \[\leadsto \mathsf{+.f64}\left(\left(1 - \frac{1}{\frac{1 + y}{y}}\right), \color{blue}{\left(\frac{x}{\frac{1 + y}{y}}\right)}\right) \]
    6. Applied egg-rr75.3%

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

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

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \left(-1 \cdot \frac{1 + -1 \cdot x}{{y}^{2}} + \color{blue}{\left(\frac{1}{y} - \frac{x}{y}\right)}\right)\right) \]
      4. div-subN/A

        \[\leadsto \mathsf{+.f64}\left(x, \left(-1 \cdot \frac{1 + -1 \cdot x}{{y}^{2}} + \frac{1 - x}{\color{blue}{y}}\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{+.f64}\left(\left(-1 \cdot \frac{1 + -1 \cdot x}{{y}^{2}}\right), \color{blue}{\left(\frac{1 - x}{y}\right)}\right)\right) \]
      6. associate-*r/N/A

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{-1 \cdot \left(-1 \cdot x\right) + -1 \cdot 1}{{y}^{2}}\right), \left(\frac{\color{blue}{1} - x}{y}\right)\right)\right) \]
      9. neg-mul-1N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{\left(\mathsf{neg}\left(-1 \cdot x\right)\right) + -1 \cdot 1}{{y}^{2}}\right), \left(\frac{1 - x}{y}\right)\right)\right) \]
      10. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) + -1 \cdot 1}{{y}^{2}}\right), \left(\frac{1 - x}{y}\right)\right)\right) \]
      11. remove-double-negN/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{x + -1}{{y}^{2}}\right), \left(\frac{1 - x}{y}\right)\right)\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{x + \left(\mathsf{neg}\left(1\right)\right)}{{y}^{2}}\right), \left(\frac{1 - x}{y}\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{+.f64}\left(\left(\frac{x - 1}{{y}^{2}}\right), \left(\frac{\color{blue}{1} - x}{y}\right)\right)\right) \]
      15. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(x - 1\right), \left({y}^{2}\right)\right), \left(\frac{\color{blue}{1 - x}}{y}\right)\right)\right) \]
      16. sub-negN/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(x + -1\right), \left({y}^{2}\right)\right), \left(\frac{1 - x}{y}\right)\right)\right) \]
      18. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \left({y}^{2}\right)\right), \left(\frac{\color{blue}{1} - x}{y}\right)\right)\right) \]
      19. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \left(y \cdot y\right)\right), \left(\frac{1 - \color{blue}{x}}{y}\right)\right)\right) \]
      20. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{1 - \color{blue}{x}}{y}\right)\right)\right) \]
      21. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\left(1 - x\right), \color{blue}{y}\right)\right)\right) \]
      22. --lowering--.f64100.0%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), y\right)\right)\right) \]
    9. Simplified100.0%

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

    if -1.45e10 < y < 3.5e5

    1. Initial program 99.7%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Add Preprocessing

    if 3.5e5 < y

    1. Initial program 35.0%

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

      \[\leadsto \color{blue}{\left(x + \left(-1 \cdot \frac{1 + -1 \cdot x}{{y}^{2}} + \frac{1}{y}\right)\right) - \frac{x}{y}} \]
    4. Simplified99.9%

      \[\leadsto \color{blue}{x + \frac{x + -1}{y} \cdot \left(\frac{1}{y} + -1\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.8%

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

Alternative 6: 99.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \left(1 + \frac{-1}{y}\right) \cdot \frac{1 - x}{y}\\ \mathbf{if}\;y \leq -14500000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 350000:\\ \;\;\;\;1 + \frac{\left(1 - x\right) \cdot y}{-1 - y}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ x (* (+ 1.0 (/ -1.0 y)) (/ (- 1.0 x) y)))))
   (if (<= y -14500000000.0)
     t_0
     (if (<= y 350000.0) (+ 1.0 (/ (* (- 1.0 x) y) (- -1.0 y))) t_0))))
double code(double x, double y) {
	double t_0 = x + ((1.0 + (-1.0 / y)) * ((1.0 - x) / y));
	double tmp;
	if (y <= -14500000000.0) {
		tmp = t_0;
	} else if (y <= 350000.0) {
		tmp = 1.0 + (((1.0 - x) * y) / (-1.0 - y));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x + ((1.0d0 + ((-1.0d0) / y)) * ((1.0d0 - x) / y))
    if (y <= (-14500000000.0d0)) then
        tmp = t_0
    else if (y <= 350000.0d0) then
        tmp = 1.0d0 + (((1.0d0 - x) * y) / ((-1.0d0) - y))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = x + ((1.0 + (-1.0 / y)) * ((1.0 - x) / y));
	double tmp;
	if (y <= -14500000000.0) {
		tmp = t_0;
	} else if (y <= 350000.0) {
		tmp = 1.0 + (((1.0 - x) * y) / (-1.0 - y));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = x + ((1.0 + (-1.0 / y)) * ((1.0 - x) / y))
	tmp = 0
	if y <= -14500000000.0:
		tmp = t_0
	elif y <= 350000.0:
		tmp = 1.0 + (((1.0 - x) * y) / (-1.0 - y))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(x + Float64(Float64(1.0 + Float64(-1.0 / y)) * Float64(Float64(1.0 - x) / y)))
	tmp = 0.0
	if (y <= -14500000000.0)
		tmp = t_0;
	elseif (y <= 350000.0)
		tmp = Float64(1.0 + Float64(Float64(Float64(1.0 - x) * y) / Float64(-1.0 - y)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = x + ((1.0 + (-1.0 / y)) * ((1.0 - x) / y));
	tmp = 0.0;
	if (y <= -14500000000.0)
		tmp = t_0;
	elseif (y <= 350000.0)
		tmp = 1.0 + (((1.0 - x) * y) / (-1.0 - y));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(x + N[(N[(1.0 + N[(-1.0 / y), $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -14500000000.0], t$95$0, If[LessEqual[y, 350000.0], N[(1.0 + N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 350000:\\
\;\;\;\;1 + \frac{\left(1 - x\right) \cdot y}{-1 - y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.45e10 or 3.5e5 < y

    1. Initial program 35.5%

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

      \[\leadsto \color{blue}{\left(x + \left(-1 \cdot \frac{1 + -1 \cdot x}{{y}^{2}} + \frac{1}{y}\right)\right) - \frac{x}{y}} \]
    4. Simplified99.9%

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

    if -1.45e10 < y < 3.5e5

    1. Initial program 99.7%

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

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

Alternative 7: 99.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{y} + \left(x - \frac{x}{y}\right)\\ \mathbf{if}\;y \leq -14500000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 165000000:\\ \;\;\;\;1 + \frac{\left(1 - x\right) \cdot y}{-1 - y}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ (/ 1.0 y) (- x (/ x y)))))
   (if (<= y -14500000000.0)
     t_0
     (if (<= y 165000000.0) (+ 1.0 (/ (* (- 1.0 x) y) (- -1.0 y))) t_0))))
double code(double x, double y) {
	double t_0 = (1.0 / y) + (x - (x / y));
	double tmp;
	if (y <= -14500000000.0) {
		tmp = t_0;
	} else if (y <= 165000000.0) {
		tmp = 1.0 + (((1.0 - x) * y) / (-1.0 - y));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (1.0d0 / y) + (x - (x / y))
    if (y <= (-14500000000.0d0)) then
        tmp = t_0
    else if (y <= 165000000.0d0) then
        tmp = 1.0d0 + (((1.0d0 - x) * y) / ((-1.0d0) - y))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (1.0 / y) + (x - (x / y));
	double tmp;
	if (y <= -14500000000.0) {
		tmp = t_0;
	} else if (y <= 165000000.0) {
		tmp = 1.0 + (((1.0 - x) * y) / (-1.0 - y));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = (1.0 / y) + (x - (x / y))
	tmp = 0
	if y <= -14500000000.0:
		tmp = t_0
	elif y <= 165000000.0:
		tmp = 1.0 + (((1.0 - x) * y) / (-1.0 - y))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(Float64(1.0 / y) + Float64(x - Float64(x / y)))
	tmp = 0.0
	if (y <= -14500000000.0)
		tmp = t_0;
	elseif (y <= 165000000.0)
		tmp = Float64(1.0 + Float64(Float64(Float64(1.0 - x) * y) / Float64(-1.0 - y)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (1.0 / y) + (x - (x / y));
	tmp = 0.0;
	if (y <= -14500000000.0)
		tmp = t_0;
	elseif (y <= 165000000.0)
		tmp = 1.0 + (((1.0 - x) * y) / (-1.0 - y));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 / y), $MachinePrecision] + N[(x - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -14500000000.0], t$95$0, If[LessEqual[y, 165000000.0], N[(1.0 + N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 165000000:\\
\;\;\;\;1 + \frac{\left(1 - x\right) \cdot y}{-1 - y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.45e10 or 1.65e8 < y

    1. Initial program 35.5%

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

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

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

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

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

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

        \[\leadsto x - \frac{x - 1}{\color{blue}{y}} \]
      6. unsub-negN/A

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \color{blue}{\left(-1 \cdot \frac{x - 1}{y}\right)}\right) \]
      9. associate-*r/N/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(-1 \cdot \left(x - 1\right)\right), \color{blue}{y}\right)\right) \]
      11. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\left(x - 1\right)\right)\right), y\right)\right) \]
      12. neg-sub0N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(0 - \left(x - 1\right)\right), y\right)\right) \]
      13. associate-+l-N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\left(0 - x\right) + 1\right), y\right)\right) \]
      14. neg-sub0N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\left(\mathsf{neg}\left(x\right)\right) + 1\right), y\right)\right) \]
      15. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(1 + \left(\mathsf{neg}\left(x\right)\right)\right), y\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(1 - x\right), y\right)\right) \]
      17. --lowering--.f6499.2%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), y\right)\right) \]
    5. Simplified99.2%

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

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

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

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

        \[\leadsto \mathsf{\_.f64}\left(\left(\frac{1}{y}\right), \color{blue}{\left(\frac{x}{y} - x\right)}\right) \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, y\right), \mathsf{\_.f64}\left(\left(\frac{x}{y}\right), \color{blue}{x}\right)\right) \]
      7. /-lowering-/.f6499.2%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, y\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x, y\right), x\right)\right) \]
    7. Applied egg-rr99.2%

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

    if -1.45e10 < y < 1.65e8

    1. Initial program 99.7%

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

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

Alternative 8: 98.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{y} + \left(x - \frac{x}{y}\right)\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 + y \cdot \left(x - x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ (/ 1.0 y) (- x (/ x y)))))
   (if (<= y -1.0) t_0 (if (<= y 1.0) (+ 1.0 (* y (- x (* x y)))) t_0))))
double code(double x, double y) {
	double t_0 = (1.0 / y) + (x - (x / y));
	double tmp;
	if (y <= -1.0) {
		tmp = t_0;
	} else if (y <= 1.0) {
		tmp = 1.0 + (y * (x - (x * y)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (1.0d0 / y) + (x - (x / y))
    if (y <= (-1.0d0)) then
        tmp = t_0
    else if (y <= 1.0d0) then
        tmp = 1.0d0 + (y * (x - (x * y)))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (1.0 / y) + (x - (x / y));
	double tmp;
	if (y <= -1.0) {
		tmp = t_0;
	} else if (y <= 1.0) {
		tmp = 1.0 + (y * (x - (x * y)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = (1.0 / y) + (x - (x / y))
	tmp = 0
	if y <= -1.0:
		tmp = t_0
	elif y <= 1.0:
		tmp = 1.0 + (y * (x - (x * y)))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(Float64(1.0 / y) + Float64(x - Float64(x / y)))
	tmp = 0.0
	if (y <= -1.0)
		tmp = t_0;
	elseif (y <= 1.0)
		tmp = Float64(1.0 + Float64(y * Float64(x - Float64(x * y))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (1.0 / y) + (x - (x / y));
	tmp = 0.0;
	if (y <= -1.0)
		tmp = t_0;
	elseif (y <= 1.0)
		tmp = 1.0 + (y * (x - (x * y)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 / y), $MachinePrecision] + N[(x - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.0], t$95$0, If[LessEqual[y, 1.0], N[(1.0 + N[(y * N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 + y \cdot \left(x - x \cdot y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1 or 1 < y

    1. Initial program 37.4%

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

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

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

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

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

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

        \[\leadsto x - \frac{x - 1}{\color{blue}{y}} \]
      6. unsub-negN/A

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \color{blue}{\left(-1 \cdot \frac{x - 1}{y}\right)}\right) \]
      9. associate-*r/N/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(-1 \cdot \left(x - 1\right)\right), \color{blue}{y}\right)\right) \]
      11. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\left(x - 1\right)\right)\right), y\right)\right) \]
      12. neg-sub0N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(0 - \left(x - 1\right)\right), y\right)\right) \]
      13. associate-+l-N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\left(0 - x\right) + 1\right), y\right)\right) \]
      14. neg-sub0N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\left(\mathsf{neg}\left(x\right)\right) + 1\right), y\right)\right) \]
      15. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(1 + \left(\mathsf{neg}\left(x\right)\right)\right), y\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(1 - x\right), y\right)\right) \]
      17. --lowering--.f6497.4%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), y\right)\right) \]
    5. Simplified97.4%

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

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

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

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

        \[\leadsto \mathsf{\_.f64}\left(\left(\frac{1}{y}\right), \color{blue}{\left(\frac{x}{y} - x\right)}\right) \]
      5. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, y\right), \mathsf{\_.f64}\left(\left(\frac{x}{y}\right), \color{blue}{x}\right)\right) \]
      7. /-lowering-/.f6497.5%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, y\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(x, y\right), x\right)\right) \]
    7. Applied egg-rr97.5%

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

    if -1 < y < 1

    1. Initial program 100.0%

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

        \[\leadsto \mathsf{\_.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{y + 1}{\left(1 - x\right) \cdot y}}}\right)\right) \]
      2. div-invN/A

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

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{1}{y + 1}\right), \color{blue}{\left(\frac{1}{\left(1 - x\right) \cdot y}\right)}\right)\right) \]
      5. /-lowering-/.f64N/A

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

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \left(\frac{1}{\left(1 - x\right) \cdot y}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \color{blue}{\left(\left(1 - x\right) \cdot y\right)}\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\left(1 - x\right), \color{blue}{y}\right)\right)\right)\right) \]
      10. --lowering--.f6499.9%

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), y\right)\right)\right)\right) \]
    4. Applied egg-rr99.9%

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

      \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \color{blue}{\left(\frac{-1}{x \cdot y}\right)}\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(-1, \left(y \cdot \color{blue}{x}\right)\right)\right)\right) \]
      3. *-lowering-*.f6499.4%

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(-1, \mathsf{*.f64}\left(y, \color{blue}{x}\right)\right)\right)\right) \]
    7. Simplified99.4%

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(y \cdot \left(-1 \cdot \left(x \cdot y\right) - -1 \cdot x\right)\right)}\right) \]
      2. distribute-lft-out--N/A

        \[\leadsto \mathsf{+.f64}\left(1, \left(y \cdot \left(-1 \cdot \color{blue}{\left(x \cdot y - x\right)}\right)\right)\right) \]
      3. distribute-lft-out--N/A

        \[\leadsto \mathsf{+.f64}\left(1, \left(y \cdot \left(-1 \cdot \left(x \cdot y\right) - \color{blue}{-1 \cdot x}\right)\right)\right) \]
      4. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(1, \left(y \cdot \left(-1 \cdot \left(x \cdot y\right) + \color{blue}{\left(\mathsf{neg}\left(-1 \cdot x\right)\right)}\right)\right)\right) \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(1, \left(y \cdot \left(-1 \cdot \left(x \cdot y\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)\right)\right) \]
      6. remove-double-negN/A

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

        \[\leadsto \mathsf{+.f64}\left(1, \left(y \cdot \left(x + \color{blue}{-1 \cdot \left(x \cdot y\right)}\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \color{blue}{\left(x + -1 \cdot \left(x \cdot y\right)\right)}\right)\right) \]
      9. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \left(x + \left(\mathsf{neg}\left(x \cdot y\right)\right)\right)\right)\right) \]
      10. unsub-negN/A

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

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(x, \color{blue}{\left(x \cdot y\right)}\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(x, \left(y \cdot \color{blue}{x}\right)\right)\right)\right) \]
      13. *-lowering-*.f6499.5%

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(x, \mathsf{*.f64}\left(y, \color{blue}{x}\right)\right)\right)\right) \]
    10. Simplified99.5%

      \[\leadsto \color{blue}{1 + y \cdot \left(x - y \cdot x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.6%

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

Alternative 9: 98.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \frac{1 - x}{y}\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 + y \cdot \left(x - x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ x (/ (- 1.0 x) y))))
   (if (<= y -1.0) t_0 (if (<= y 1.0) (+ 1.0 (* y (- x (* x y)))) t_0))))
double code(double x, double y) {
	double t_0 = x + ((1.0 - x) / y);
	double tmp;
	if (y <= -1.0) {
		tmp = t_0;
	} else if (y <= 1.0) {
		tmp = 1.0 + (y * (x - (x * y)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x + ((1.0d0 - x) / y)
    if (y <= (-1.0d0)) then
        tmp = t_0
    else if (y <= 1.0d0) then
        tmp = 1.0d0 + (y * (x - (x * y)))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = x + ((1.0 - x) / y);
	double tmp;
	if (y <= -1.0) {
		tmp = t_0;
	} else if (y <= 1.0) {
		tmp = 1.0 + (y * (x - (x * y)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = x + ((1.0 - x) / y)
	tmp = 0
	if y <= -1.0:
		tmp = t_0
	elif y <= 1.0:
		tmp = 1.0 + (y * (x - (x * y)))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(x + Float64(Float64(1.0 - x) / y))
	tmp = 0.0
	if (y <= -1.0)
		tmp = t_0;
	elseif (y <= 1.0)
		tmp = Float64(1.0 + Float64(y * Float64(x - Float64(x * y))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = x + ((1.0 - x) / y);
	tmp = 0.0;
	if (y <= -1.0)
		tmp = t_0;
	elseif (y <= 1.0)
		tmp = 1.0 + (y * (x - (x * y)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.0], t$95$0, If[LessEqual[y, 1.0], N[(1.0 + N[(y * N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x + \frac{1 - x}{y}\\
\mathbf{if}\;y \leq -1:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 + y \cdot \left(x - x \cdot y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1 or 1 < y

    1. Initial program 37.4%

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

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

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

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

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

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

        \[\leadsto x - \frac{x - 1}{\color{blue}{y}} \]
      6. unsub-negN/A

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \color{blue}{\left(-1 \cdot \frac{x - 1}{y}\right)}\right) \]
      9. associate-*r/N/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(-1 \cdot \left(x - 1\right)\right), \color{blue}{y}\right)\right) \]
      11. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\left(x - 1\right)\right)\right), y\right)\right) \]
      12. neg-sub0N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(0 - \left(x - 1\right)\right), y\right)\right) \]
      13. associate-+l-N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\left(0 - x\right) + 1\right), y\right)\right) \]
      14. neg-sub0N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\left(\mathsf{neg}\left(x\right)\right) + 1\right), y\right)\right) \]
      15. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(1 + \left(\mathsf{neg}\left(x\right)\right)\right), y\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(1 - x\right), y\right)\right) \]
      17. --lowering--.f6497.4%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), y\right)\right) \]
    5. Simplified97.4%

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

    if -1 < y < 1

    1. Initial program 100.0%

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

        \[\leadsto \mathsf{\_.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{y + 1}{\left(1 - x\right) \cdot y}}}\right)\right) \]
      2. div-invN/A

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

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{1}{y + 1}\right), \color{blue}{\left(\frac{1}{\left(1 - x\right) \cdot y}\right)}\right)\right) \]
      5. /-lowering-/.f64N/A

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

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \left(\frac{1}{\left(1 - x\right) \cdot y}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \color{blue}{\left(\left(1 - x\right) \cdot y\right)}\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\left(1 - x\right), \color{blue}{y}\right)\right)\right)\right) \]
      10. --lowering--.f6499.9%

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), y\right)\right)\right)\right) \]
    4. Applied egg-rr99.9%

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

      \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \color{blue}{\left(\frac{-1}{x \cdot y}\right)}\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(-1, \left(y \cdot \color{blue}{x}\right)\right)\right)\right) \]
      3. *-lowering-*.f6499.4%

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(-1, \mathsf{*.f64}\left(y, \color{blue}{x}\right)\right)\right)\right) \]
    7. Simplified99.4%

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(y \cdot \left(-1 \cdot \left(x \cdot y\right) - -1 \cdot x\right)\right)}\right) \]
      2. distribute-lft-out--N/A

        \[\leadsto \mathsf{+.f64}\left(1, \left(y \cdot \left(-1 \cdot \color{blue}{\left(x \cdot y - x\right)}\right)\right)\right) \]
      3. distribute-lft-out--N/A

        \[\leadsto \mathsf{+.f64}\left(1, \left(y \cdot \left(-1 \cdot \left(x \cdot y\right) - \color{blue}{-1 \cdot x}\right)\right)\right) \]
      4. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(1, \left(y \cdot \left(-1 \cdot \left(x \cdot y\right) + \color{blue}{\left(\mathsf{neg}\left(-1 \cdot x\right)\right)}\right)\right)\right) \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(1, \left(y \cdot \left(-1 \cdot \left(x \cdot y\right) + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)\right)\right)\right) \]
      6. remove-double-negN/A

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

        \[\leadsto \mathsf{+.f64}\left(1, \left(y \cdot \left(x + \color{blue}{-1 \cdot \left(x \cdot y\right)}\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \color{blue}{\left(x + -1 \cdot \left(x \cdot y\right)\right)}\right)\right) \]
      9. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \left(x + \left(\mathsf{neg}\left(x \cdot y\right)\right)\right)\right)\right) \]
      10. unsub-negN/A

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

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(x, \color{blue}{\left(x \cdot y\right)}\right)\right)\right) \]
      12. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(x, \left(y \cdot \color{blue}{x}\right)\right)\right)\right) \]
      13. *-lowering-*.f6499.5%

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(x, \mathsf{*.f64}\left(y, \color{blue}{x}\right)\right)\right)\right) \]
    10. Simplified99.5%

      \[\leadsto \color{blue}{1 + y \cdot \left(x - y \cdot x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.6%

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

Alternative 10: 98.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \frac{1 - x}{y}\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 + y \cdot \left(x + -1\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ x (/ (- 1.0 x) y))))
   (if (<= y -1.0) t_0 (if (<= y 1.0) (+ 1.0 (* y (+ x -1.0))) t_0))))
double code(double x, double y) {
	double t_0 = x + ((1.0 - x) / y);
	double tmp;
	if (y <= -1.0) {
		tmp = t_0;
	} else if (y <= 1.0) {
		tmp = 1.0 + (y * (x + -1.0));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x + ((1.0d0 - x) / y)
    if (y <= (-1.0d0)) then
        tmp = t_0
    else if (y <= 1.0d0) then
        tmp = 1.0d0 + (y * (x + (-1.0d0)))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = x + ((1.0 - x) / y);
	double tmp;
	if (y <= -1.0) {
		tmp = t_0;
	} else if (y <= 1.0) {
		tmp = 1.0 + (y * (x + -1.0));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = x + ((1.0 - x) / y)
	tmp = 0
	if y <= -1.0:
		tmp = t_0
	elif y <= 1.0:
		tmp = 1.0 + (y * (x + -1.0))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(x + Float64(Float64(1.0 - x) / y))
	tmp = 0.0
	if (y <= -1.0)
		tmp = t_0;
	elseif (y <= 1.0)
		tmp = Float64(1.0 + Float64(y * Float64(x + -1.0)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = x + ((1.0 - x) / y);
	tmp = 0.0;
	if (y <= -1.0)
		tmp = t_0;
	elseif (y <= 1.0)
		tmp = 1.0 + (y * (x + -1.0));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.0], t$95$0, If[LessEqual[y, 1.0], N[(1.0 + N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x + \frac{1 - x}{y}\\
\mathbf{if}\;y \leq -1:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 + y \cdot \left(x + -1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1 or 1 < y

    1. Initial program 37.4%

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

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

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

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

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

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

        \[\leadsto x - \frac{x - 1}{\color{blue}{y}} \]
      6. unsub-negN/A

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \color{blue}{\left(-1 \cdot \frac{x - 1}{y}\right)}\right) \]
      9. associate-*r/N/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(-1 \cdot \left(x - 1\right)\right), \color{blue}{y}\right)\right) \]
      11. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\left(x - 1\right)\right)\right), y\right)\right) \]
      12. neg-sub0N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(0 - \left(x - 1\right)\right), y\right)\right) \]
      13. associate-+l-N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\left(0 - x\right) + 1\right), y\right)\right) \]
      14. neg-sub0N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\left(\mathsf{neg}\left(x\right)\right) + 1\right), y\right)\right) \]
      15. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(1 + \left(\mathsf{neg}\left(x\right)\right)\right), y\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(1 - x\right), y\right)\right) \]
      17. --lowering--.f6497.4%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), y\right)\right) \]
    5. Simplified97.4%

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

    if -1 < y < 1

    1. Initial program 100.0%

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

      \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{\left(y \cdot \left(1 - x\right)\right)}\right) \]
    4. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{\_.f64}\left(1, \left(y \cdot \left(1 + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(1, \left(y \cdot \left(\left(\mathsf{neg}\left(x\right)\right) + \color{blue}{1}\right)\right)\right) \]
      3. neg-sub0N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \left(y \cdot \left(\left(0 - x\right) + 1\right)\right)\right) \]
      4. associate-+l-N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \left(y \cdot \left(0 - \color{blue}{\left(x - 1\right)}\right)\right)\right) \]
      5. neg-sub0N/A

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

        \[\leadsto \mathsf{\_.f64}\left(1, \left(y \cdot \left(-1 \cdot \color{blue}{\left(x - 1\right)}\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(y, \color{blue}{\left(-1 \cdot \left(x - 1\right)\right)}\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(y, \left(\mathsf{neg}\left(\left(x - 1\right)\right)\right)\right)\right) \]
      9. neg-sub0N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(y, \left(0 - \color{blue}{\left(x - 1\right)}\right)\right)\right) \]
      10. associate-+l-N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(y, \left(\left(0 - x\right) + \color{blue}{1}\right)\right)\right) \]
      11. neg-sub0N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(y, \left(\left(\mathsf{neg}\left(x\right)\right) + 1\right)\right)\right) \]
      12. +-commutativeN/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(y, \left(1 + \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(y, \left(1 - \color{blue}{x}\right)\right)\right) \]
      14. --lowering--.f6499.4%

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{*.f64}\left(y, \mathsf{\_.f64}\left(1, \color{blue}{x}\right)\right)\right) \]
    5. Simplified99.4%

      \[\leadsto 1 - \color{blue}{y \cdot \left(1 - x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.5%

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

Alternative 11: 98.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \frac{1 - x}{y}\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 1.2:\\ \;\;\;\;1 + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ x (/ (- 1.0 x) y))))
   (if (<= y -1.0) t_0 (if (<= y 1.2) (+ 1.0 (* x y)) t_0))))
double code(double x, double y) {
	double t_0 = x + ((1.0 - x) / y);
	double tmp;
	if (y <= -1.0) {
		tmp = t_0;
	} else if (y <= 1.2) {
		tmp = 1.0 + (x * y);
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x + ((1.0d0 - x) / y)
    if (y <= (-1.0d0)) then
        tmp = t_0
    else if (y <= 1.2d0) then
        tmp = 1.0d0 + (x * y)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = x + ((1.0 - x) / y);
	double tmp;
	if (y <= -1.0) {
		tmp = t_0;
	} else if (y <= 1.2) {
		tmp = 1.0 + (x * y);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = x + ((1.0 - x) / y)
	tmp = 0
	if y <= -1.0:
		tmp = t_0
	elif y <= 1.2:
		tmp = 1.0 + (x * y)
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(x + Float64(Float64(1.0 - x) / y))
	tmp = 0.0
	if (y <= -1.0)
		tmp = t_0;
	elseif (y <= 1.2)
		tmp = Float64(1.0 + Float64(x * y));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = x + ((1.0 - x) / y);
	tmp = 0.0;
	if (y <= -1.0)
		tmp = t_0;
	elseif (y <= 1.2)
		tmp = 1.0 + (x * y);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.0], t$95$0, If[LessEqual[y, 1.2], N[(1.0 + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x + \frac{1 - x}{y}\\
\mathbf{if}\;y \leq -1:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 1.2:\\
\;\;\;\;1 + x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1 or 1.19999999999999996 < y

    1. Initial program 37.4%

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

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

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

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

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

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

        \[\leadsto x - \frac{x - 1}{\color{blue}{y}} \]
      6. unsub-negN/A

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \color{blue}{\left(-1 \cdot \frac{x - 1}{y}\right)}\right) \]
      9. associate-*r/N/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(-1 \cdot \left(x - 1\right)\right), \color{blue}{y}\right)\right) \]
      11. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\left(x - 1\right)\right)\right), y\right)\right) \]
      12. neg-sub0N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(0 - \left(x - 1\right)\right), y\right)\right) \]
      13. associate-+l-N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\left(0 - x\right) + 1\right), y\right)\right) \]
      14. neg-sub0N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\left(\mathsf{neg}\left(x\right)\right) + 1\right), y\right)\right) \]
      15. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(1 + \left(\mathsf{neg}\left(x\right)\right)\right), y\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(1 - x\right), y\right)\right) \]
      17. --lowering--.f6497.4%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), y\right)\right) \]
    5. Simplified97.4%

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

    if -1 < y < 1.19999999999999996

    1. Initial program 100.0%

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

        \[\leadsto \mathsf{\_.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{y + 1}{\left(1 - x\right) \cdot y}}}\right)\right) \]
      2. div-invN/A

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

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{1}{y + 1}\right), \color{blue}{\left(\frac{1}{\left(1 - x\right) \cdot y}\right)}\right)\right) \]
      5. /-lowering-/.f64N/A

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

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \left(\frac{1}{\left(1 - x\right) \cdot y}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \color{blue}{\left(\left(1 - x\right) \cdot y\right)}\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\left(1 - x\right), \color{blue}{y}\right)\right)\right)\right) \]
      10. --lowering--.f6499.9%

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), y\right)\right)\right)\right) \]
    4. Applied egg-rr99.9%

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

      \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \color{blue}{\left(\frac{-1}{x \cdot y}\right)}\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(-1, \left(y \cdot \color{blue}{x}\right)\right)\right)\right) \]
      3. *-lowering-*.f6499.4%

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(-1, \mathsf{*.f64}\left(y, \color{blue}{x}\right)\right)\right)\right) \]
    7. Simplified99.4%

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

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \left(y \cdot \color{blue}{x}\right)\right) \]
      3. *-lowering-*.f6499.4%

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \color{blue}{x}\right)\right) \]
    10. Simplified99.4%

      \[\leadsto \color{blue}{1 + y \cdot x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x + \frac{1 - x}{y}\\ \mathbf{elif}\;y \leq 1.2:\\ \;\;\;\;1 + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1 - x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 97.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \frac{1}{y}\\ \mathbf{if}\;y \leq -1:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ x (/ 1.0 y))))
   (if (<= y -1.0) t_0 (if (<= y 1.0) (+ 1.0 (* x y)) t_0))))
double code(double x, double y) {
	double t_0 = x + (1.0 / y);
	double tmp;
	if (y <= -1.0) {
		tmp = t_0;
	} else if (y <= 1.0) {
		tmp = 1.0 + (x * y);
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x + (1.0d0 / y)
    if (y <= (-1.0d0)) then
        tmp = t_0
    else if (y <= 1.0d0) then
        tmp = 1.0d0 + (x * y)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = x + (1.0 / y);
	double tmp;
	if (y <= -1.0) {
		tmp = t_0;
	} else if (y <= 1.0) {
		tmp = 1.0 + (x * y);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = x + (1.0 / y)
	tmp = 0
	if y <= -1.0:
		tmp = t_0
	elif y <= 1.0:
		tmp = 1.0 + (x * y)
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(x + Float64(1.0 / y))
	tmp = 0.0
	if (y <= -1.0)
		tmp = t_0;
	elseif (y <= 1.0)
		tmp = Float64(1.0 + Float64(x * y));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = x + (1.0 / y);
	tmp = 0.0;
	if (y <= -1.0)
		tmp = t_0;
	elseif (y <= 1.0)
		tmp = 1.0 + (x * y);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(x + N[(1.0 / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.0], t$95$0, If[LessEqual[y, 1.0], N[(1.0 + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x + \frac{1}{y}\\
\mathbf{if}\;y \leq -1:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 1:\\
\;\;\;\;1 + x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1 or 1 < y

    1. Initial program 37.4%

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

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

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

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

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

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

        \[\leadsto x - \frac{x - 1}{\color{blue}{y}} \]
      6. unsub-negN/A

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

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

        \[\leadsto \mathsf{+.f64}\left(x, \color{blue}{\left(-1 \cdot \frac{x - 1}{y}\right)}\right) \]
      9. associate-*r/N/A

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

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(-1 \cdot \left(x - 1\right)\right), \color{blue}{y}\right)\right) \]
      11. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\mathsf{neg}\left(\left(x - 1\right)\right)\right), y\right)\right) \]
      12. neg-sub0N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(0 - \left(x - 1\right)\right), y\right)\right) \]
      13. associate-+l-N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\left(0 - x\right) + 1\right), y\right)\right) \]
      14. neg-sub0N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(\left(\mathsf{neg}\left(x\right)\right) + 1\right), y\right)\right) \]
      15. +-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(1 + \left(\mathsf{neg}\left(x\right)\right)\right), y\right)\right) \]
      16. sub-negN/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(1 - x\right), y\right)\right) \]
      17. --lowering--.f6497.4%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(1, x\right), y\right)\right) \]
    5. Simplified97.4%

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

      \[\leadsto \mathsf{+.f64}\left(x, \color{blue}{\left(\frac{1}{y}\right)}\right) \]
    7. Step-by-step derivation
      1. /-lowering-/.f6496.7%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(1, \color{blue}{y}\right)\right) \]
    8. Simplified96.7%

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

    if -1 < y < 1

    1. Initial program 100.0%

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

        \[\leadsto \mathsf{\_.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{y + 1}{\left(1 - x\right) \cdot y}}}\right)\right) \]
      2. div-invN/A

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

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{1}{y + 1}\right), \color{blue}{\left(\frac{1}{\left(1 - x\right) \cdot y}\right)}\right)\right) \]
      5. /-lowering-/.f64N/A

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

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \left(\frac{1}{\left(1 - x\right) \cdot y}\right)\right)\right) \]
      8. /-lowering-/.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \color{blue}{\left(\left(1 - x\right) \cdot y\right)}\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\left(1 - x\right), \color{blue}{y}\right)\right)\right)\right) \]
      10. --lowering--.f6499.9%

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), y\right)\right)\right)\right) \]
    4. Applied egg-rr99.9%

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

      \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \color{blue}{\left(\frac{-1}{x \cdot y}\right)}\right)\right) \]
    6. Step-by-step derivation
      1. /-lowering-/.f64N/A

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(-1, \left(y \cdot \color{blue}{x}\right)\right)\right)\right) \]
      3. *-lowering-*.f6499.4%

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(-1, \mathsf{*.f64}\left(y, \color{blue}{x}\right)\right)\right)\right) \]
    7. Simplified99.4%

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

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

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

        \[\leadsto \mathsf{+.f64}\left(1, \left(y \cdot \color{blue}{x}\right)\right) \]
      3. *-lowering-*.f6499.4%

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \color{blue}{x}\right)\right) \]
    10. Simplified99.4%

      \[\leadsto \color{blue}{1 + y \cdot x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.1%

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

Alternative 13: 86.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 340:\\ \;\;\;\;1 + x \cdot y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -1.0) x (if (<= y 340.0) (+ 1.0 (* x y)) x)))
double code(double x, double y) {
	double tmp;
	if (y <= -1.0) {
		tmp = x;
	} else if (y <= 340.0) {
		tmp = 1.0 + (x * y);
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-1.0d0)) then
        tmp = x
    else if (y <= 340.0d0) then
        tmp = 1.0d0 + (x * y)
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -1.0) {
		tmp = x;
	} else if (y <= 340.0) {
		tmp = 1.0 + (x * y);
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -1.0:
		tmp = x
	elif y <= 340.0:
		tmp = 1.0 + (x * y)
	else:
		tmp = x
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -1.0)
		tmp = x;
	elseif (y <= 340.0)
		tmp = Float64(1.0 + Float64(x * y));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -1.0)
		tmp = x;
	elseif (y <= 340.0)
		tmp = 1.0 + (x * y);
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 340.0], N[(1.0 + N[(x * y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 340:\\
\;\;\;\;1 + x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1 or 340 < y

    1. Initial program 36.4%

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

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

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

      if -1 < y < 340

      1. Initial program 99.8%

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

          \[\leadsto \mathsf{\_.f64}\left(1, \left(\frac{1}{\color{blue}{\frac{y + 1}{\left(1 - x\right) \cdot y}}}\right)\right) \]
        2. div-invN/A

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

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

          \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{1}{y + 1}\right), \color{blue}{\left(\frac{1}{\left(1 - x\right) \cdot y}\right)}\right)\right) \]
        5. /-lowering-/.f64N/A

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

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

          \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \left(\frac{1}{\left(1 - x\right) \cdot y}\right)\right)\right) \]
        8. /-lowering-/.f64N/A

          \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \color{blue}{\left(\left(1 - x\right) \cdot y\right)}\right)\right)\right) \]
        9. *-lowering-*.f64N/A

          \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\left(1 - x\right), \color{blue}{y}\right)\right)\right)\right) \]
        10. --lowering--.f6499.8%

          \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), y\right)\right)\right)\right) \]
      4. Applied egg-rr99.8%

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

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \color{blue}{\left(\frac{-1}{x \cdot y}\right)}\right)\right) \]
      6. Step-by-step derivation
        1. /-lowering-/.f64N/A

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

          \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(-1, \left(y \cdot \color{blue}{x}\right)\right)\right)\right) \]
        3. *-lowering-*.f6498.2%

          \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(1, y\right)\right), \mathsf{/.f64}\left(-1, \mathsf{*.f64}\left(y, \color{blue}{x}\right)\right)\right)\right) \]
      7. Simplified98.2%

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

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

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

          \[\leadsto \mathsf{+.f64}\left(1, \left(y \cdot \color{blue}{x}\right)\right) \]
        3. *-lowering-*.f6498.2%

          \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, \color{blue}{x}\right)\right) \]
      10. Simplified98.2%

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

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

    Alternative 14: 74.3% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 350:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
    (FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 350.0) 1.0 x)))
    double code(double x, double y) {
    	double tmp;
    	if (y <= -1.0) {
    		tmp = x;
    	} else if (y <= 350.0) {
    		tmp = 1.0;
    	} else {
    		tmp = x;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8) :: tmp
        if (y <= (-1.0d0)) then
            tmp = x
        else if (y <= 350.0d0) then
            tmp = 1.0d0
        else
            tmp = x
        end if
        code = tmp
    end function
    
    public static double code(double x, double y) {
    	double tmp;
    	if (y <= -1.0) {
    		tmp = x;
    	} else if (y <= 350.0) {
    		tmp = 1.0;
    	} else {
    		tmp = x;
    	}
    	return tmp;
    }
    
    def code(x, y):
    	tmp = 0
    	if y <= -1.0:
    		tmp = x
    	elif y <= 350.0:
    		tmp = 1.0
    	else:
    		tmp = x
    	return tmp
    
    function code(x, y)
    	tmp = 0.0
    	if (y <= -1.0)
    		tmp = x;
    	elseif (y <= 350.0)
    		tmp = 1.0;
    	else
    		tmp = x;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y)
    	tmp = 0.0;
    	if (y <= -1.0)
    		tmp = x;
    	elseif (y <= 350.0)
    		tmp = 1.0;
    	else
    		tmp = x;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 350.0], 1.0, x]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq -1:\\
    \;\;\;\;x\\
    
    \mathbf{elif}\;y \leq 350:\\
    \;\;\;\;1\\
    
    \mathbf{else}:\\
    \;\;\;\;x\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -1 or 350 < y

      1. Initial program 36.4%

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

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

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

        if -1 < y < 350

        1. Initial program 99.8%

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

          \[\leadsto \color{blue}{1} \]
        4. Step-by-step derivation
          1. Simplified76.0%

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

        Alternative 15: 38.7% accurate, 11.0× speedup?

        \[\begin{array}{l} \\ 1 \end{array} \]
        (FPCore (x y) :precision binary64 1.0)
        double code(double x, double y) {
        	return 1.0;
        }
        
        real(8) function code(x, y)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            code = 1.0d0
        end function
        
        public static double code(double x, double y) {
        	return 1.0;
        }
        
        def code(x, y):
        	return 1.0
        
        function code(x, y)
        	return 1.0
        end
        
        function tmp = code(x, y)
        	tmp = 1.0;
        end
        
        code[x_, y_] := 1.0
        
        \begin{array}{l}
        
        \\
        1
        \end{array}
        
        Derivation
        1. Initial program 71.8%

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

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

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

          Developer Target 1: 99.7% accurate, 0.5× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{1}{y} - \left(\frac{x}{y} - x\right)\\ \mathbf{if}\;y < -3693.8482788297247:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y < 6799310503.41891:\\ \;\;\;\;1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (x y)
           :precision binary64
           (let* ((t_0 (- (/ 1.0 y) (- (/ x y) x))))
             (if (< y -3693.8482788297247)
               t_0
               (if (< y 6799310503.41891) (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))) t_0))))
          double code(double x, double y) {
          	double t_0 = (1.0 / y) - ((x / y) - x);
          	double tmp;
          	if (y < -3693.8482788297247) {
          		tmp = t_0;
          	} else if (y < 6799310503.41891) {
          		tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0));
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          real(8) function code(x, y)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8) :: t_0
              real(8) :: tmp
              t_0 = (1.0d0 / y) - ((x / y) - x)
              if (y < (-3693.8482788297247d0)) then
                  tmp = t_0
              else if (y < 6799310503.41891d0) then
                  tmp = 1.0d0 - (((1.0d0 - x) * y) / (y + 1.0d0))
              else
                  tmp = t_0
              end if
              code = tmp
          end function
          
          public static double code(double x, double y) {
          	double t_0 = (1.0 / y) - ((x / y) - x);
          	double tmp;
          	if (y < -3693.8482788297247) {
          		tmp = t_0;
          	} else if (y < 6799310503.41891) {
          		tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0));
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          def code(x, y):
          	t_0 = (1.0 / y) - ((x / y) - x)
          	tmp = 0
          	if y < -3693.8482788297247:
          		tmp = t_0
          	elif y < 6799310503.41891:
          		tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0))
          	else:
          		tmp = t_0
          	return tmp
          
          function code(x, y)
          	t_0 = Float64(Float64(1.0 / y) - Float64(Float64(x / y) - x))
          	tmp = 0.0
          	if (y < -3693.8482788297247)
          		tmp = t_0;
          	elseif (y < 6799310503.41891)
          		tmp = Float64(1.0 - Float64(Float64(Float64(1.0 - x) * y) / Float64(y + 1.0)));
          	else
          		tmp = t_0;
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y)
          	t_0 = (1.0 / y) - ((x / y) - x);
          	tmp = 0.0;
          	if (y < -3693.8482788297247)
          		tmp = t_0;
          	elseif (y < 6799310503.41891)
          		tmp = 1.0 - (((1.0 - x) * y) / (y + 1.0));
          	else
          		tmp = t_0;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_] := Block[{t$95$0 = N[(N[(1.0 / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -3693.8482788297247], t$95$0, If[Less[y, 6799310503.41891], N[(1.0 - N[(N[(N[(1.0 - x), $MachinePrecision] * y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \frac{1}{y} - \left(\frac{x}{y} - x\right)\\
          \mathbf{if}\;y < -3693.8482788297247:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;y < 6799310503.41891:\\
          \;\;\;\;1 - \frac{\left(1 - x\right) \cdot y}{y + 1}\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          

          Reproduce

          ?
          herbie shell --seed 2024191 
          (FPCore (x y)
            :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, D"
            :precision binary64
          
            :alt
            (! :herbie-platform default (if (< y -36938482788297247/10000000000000) (- (/ 1 y) (- (/ x y) x)) (if (< y 679931050341891/100000) (- 1 (/ (* (- 1 x) y) (+ y 1))) (- (/ 1 y) (- (/ x y) x)))))
          
            (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))