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

Percentage Accurate: 65.2% → 99.9%
Time: 9.5s
Alternatives: 16
Speedup: 2.1×

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 16 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: 65.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.9% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -550000 \lor \neg \left(y \leq 430000\right):\\
\;\;\;\;x + \left(\frac{x + -1}{y \cdot y} - \frac{x + -1}{y}\right)\\

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


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

    1. Initial program 30.2%

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

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

        \[\leadsto \color{blue}{x + \left(\left(-1 \cdot \frac{x - 1}{y} + \frac{x}{{y}^{2}}\right) - \frac{1}{{y}^{2}}\right)} \]
      2. associate--l+100.0%

        \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{x - 1}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right)} \]
      3. mul-1-neg100.0%

        \[\leadsto x + \left(\color{blue}{\left(-\frac{x - 1}{y}\right)} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      4. sub-neg100.0%

        \[\leadsto x + \left(\left(-\frac{\color{blue}{x + \left(-1\right)}}{y}\right) + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      5. metadata-eval100.0%

        \[\leadsto x + \left(\left(-\frac{x + \color{blue}{-1}}{y}\right) + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      6. distribute-neg-frac100.0%

        \[\leadsto x + \left(\color{blue}{\frac{-\left(x + -1\right)}{y}} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      7. +-commutative100.0%

        \[\leadsto x + \left(\frac{-\color{blue}{\left(-1 + x\right)}}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      8. distribute-neg-in100.0%

        \[\leadsto x + \left(\frac{\color{blue}{\left(--1\right) + \left(-x\right)}}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      9. metadata-eval100.0%

        \[\leadsto x + \left(\frac{\color{blue}{1} + \left(-x\right)}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      10. sub-neg100.0%

        \[\leadsto x + \left(\frac{\color{blue}{1 - x}}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      11. div-sub100.0%

        \[\leadsto x + \left(\frac{1 - x}{y} + \color{blue}{\frac{x - 1}{{y}^{2}}}\right) \]
      12. sub-neg100.0%

        \[\leadsto x + \left(\frac{1 - x}{y} + \frac{\color{blue}{x + \left(-1\right)}}{{y}^{2}}\right) \]
      13. metadata-eval100.0%

        \[\leadsto x + \left(\frac{1 - x}{y} + \frac{x + \color{blue}{-1}}{{y}^{2}}\right) \]
      14. +-commutative100.0%

        \[\leadsto x + \left(\frac{1 - x}{y} + \frac{\color{blue}{-1 + x}}{{y}^{2}}\right) \]
      15. unpow2100.0%

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

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

    if -5.5e5 < y < 4.3e5

    1. Initial program 99.9%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg99.9%

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

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

        \[\leadsto \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) + 1 \]
      4. distribute-lft-neg-in99.9%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(-\frac{1 - x}{y + 1}, y, 1\right)} \]
      6. *-rgt-identity99.9%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot 1}, y, 1\right) \]
      7. *-rgt-identity99.9%

        \[\leadsto \mathsf{fma}\left(\color{blue}{-\frac{1 - x}{y + 1}}, y, 1\right) \]
      8. distribute-frac-neg99.9%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{-\left(1 - x\right)}{y + 1}}, y, 1\right) \]
      9. neg-sub099.9%

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1}, y, 1\right) \]
      10. associate--r-99.9%

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

        \[\leadsto \mathsf{fma}\left(\frac{\color{blue}{-1} + x}{y + 1}, y, 1\right) \]
      12. +-commutative99.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -550000 \lor \neg \left(y \leq 430000\right):\\ \;\;\;\;x + \left(\frac{x + -1}{y \cdot y} - \frac{x + -1}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x + -1}{y + 1}, y, 1\right)\\ \end{array} \]

Alternative 2: 99.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y \cdot \left(1 - x\right)}{y + 1}\\ \mathbf{if}\;t_0 \leq 0.1 \lor \neg \left(t_0 \leq 1.001\right):\\ \;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{1}{y} + \frac{-1}{y \cdot y}\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (* y (- 1.0 x)) (+ y 1.0))))
   (if (or (<= t_0 0.1) (not (<= t_0 1.001)))
     (+ 1.0 (* y (/ (+ x -1.0) (+ y 1.0))))
     (+ x (+ (/ 1.0 y) (/ -1.0 (* y y)))))))
double code(double x, double y) {
	double t_0 = (y * (1.0 - x)) / (y + 1.0);
	double tmp;
	if ((t_0 <= 0.1) || !(t_0 <= 1.001)) {
		tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)));
	} else {
		tmp = x + ((1.0 / y) + (-1.0 / (y * y)));
	}
	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 = (y * (1.0d0 - x)) / (y + 1.0d0)
    if ((t_0 <= 0.1d0) .or. (.not. (t_0 <= 1.001d0))) then
        tmp = 1.0d0 + (y * ((x + (-1.0d0)) / (y + 1.0d0)))
    else
        tmp = x + ((1.0d0 / y) + ((-1.0d0) / (y * y)))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (y * (1.0 - x)) / (y + 1.0);
	double tmp;
	if ((t_0 <= 0.1) || !(t_0 <= 1.001)) {
		tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)));
	} else {
		tmp = x + ((1.0 / y) + (-1.0 / (y * y)));
	}
	return tmp;
}
def code(x, y):
	t_0 = (y * (1.0 - x)) / (y + 1.0)
	tmp = 0
	if (t_0 <= 0.1) or not (t_0 <= 1.001):
		tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)))
	else:
		tmp = x + ((1.0 / y) + (-1.0 / (y * y)))
	return tmp
function code(x, y)
	t_0 = Float64(Float64(y * Float64(1.0 - x)) / Float64(y + 1.0))
	tmp = 0.0
	if ((t_0 <= 0.1) || !(t_0 <= 1.001))
		tmp = Float64(1.0 + Float64(y * Float64(Float64(x + -1.0) / Float64(y + 1.0))));
	else
		tmp = Float64(x + Float64(Float64(1.0 / y) + Float64(-1.0 / Float64(y * y))));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (y * (1.0 - x)) / (y + 1.0);
	tmp = 0.0;
	if ((t_0 <= 0.1) || ~((t_0 <= 1.001)))
		tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)));
	else
		tmp = x + ((1.0 / y) + (-1.0 / (y * y)));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * N[(1.0 - x), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, 0.1], N[Not[LessEqual[t$95$0, 1.001]], $MachinePrecision]], N[(1.0 + N[(y * N[(N[(x + -1.0), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(1.0 / y), $MachinePrecision] + N[(-1.0 / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{y \cdot \left(1 - x\right)}{y + 1}\\
\mathbf{if}\;t_0 \leq 0.1 \lor \neg \left(t_0 \leq 1.001\right):\\
\;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)) < 0.10000000000000001 or 1.0009999999999999 < (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1))

    1. Initial program 84.4%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg84.4%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in99.8%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg99.8%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-99.8%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval99.8%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative99.8%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative99.8%

        \[\leadsto 1 + \frac{x + -1}{\color{blue}{1 + y}} \cdot y \]
    3. Simplified99.8%

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

    if 0.10000000000000001 < (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)) < 1.0009999999999999

    1. Initial program 7.8%

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

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

        \[\leadsto \color{blue}{x + \left(\left(-1 \cdot \frac{x - 1}{y} + \frac{x}{{y}^{2}}\right) - \frac{1}{{y}^{2}}\right)} \]
      2. associate--l+100.0%

        \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{x - 1}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right)} \]
      3. mul-1-neg100.0%

        \[\leadsto x + \left(\color{blue}{\left(-\frac{x - 1}{y}\right)} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      4. sub-neg100.0%

        \[\leadsto x + \left(\left(-\frac{\color{blue}{x + \left(-1\right)}}{y}\right) + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      5. metadata-eval100.0%

        \[\leadsto x + \left(\left(-\frac{x + \color{blue}{-1}}{y}\right) + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      6. distribute-neg-frac100.0%

        \[\leadsto x + \left(\color{blue}{\frac{-\left(x + -1\right)}{y}} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      7. +-commutative100.0%

        \[\leadsto x + \left(\frac{-\color{blue}{\left(-1 + x\right)}}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      8. distribute-neg-in100.0%

        \[\leadsto x + \left(\frac{\color{blue}{\left(--1\right) + \left(-x\right)}}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      9. metadata-eval100.0%

        \[\leadsto x + \left(\frac{\color{blue}{1} + \left(-x\right)}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      10. sub-neg100.0%

        \[\leadsto x + \left(\frac{\color{blue}{1 - x}}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      11. div-sub100.0%

        \[\leadsto x + \left(\frac{1 - x}{y} + \color{blue}{\frac{x - 1}{{y}^{2}}}\right) \]
      12. sub-neg100.0%

        \[\leadsto x + \left(\frac{1 - x}{y} + \frac{\color{blue}{x + \left(-1\right)}}{{y}^{2}}\right) \]
      13. metadata-eval100.0%

        \[\leadsto x + \left(\frac{1 - x}{y} + \frac{x + \color{blue}{-1}}{{y}^{2}}\right) \]
      14. +-commutative100.0%

        \[\leadsto x + \left(\frac{1 - x}{y} + \frac{\color{blue}{-1 + x}}{{y}^{2}}\right) \]
      15. unpow2100.0%

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

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

      \[\leadsto x + \color{blue}{\left(\frac{1}{y} - \frac{1}{{y}^{2}}\right)} \]
    6. Step-by-step derivation
      1. unpow2100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y \cdot \left(1 - x\right)}{y + 1} \leq 0.1 \lor \neg \left(\frac{y \cdot \left(1 - x\right)}{y + 1} \leq 1.001\right):\\ \;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{1}{y} + \frac{-1}{y \cdot y}\right)\\ \end{array} \]

Alternative 3: 99.6% accurate, 0.4× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\


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

    1. Initial program 86.5%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg86.5%

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

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

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

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

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

        \[\leadsto 1 - \color{blue}{\frac{1 - x}{\frac{y + 1}{y}}} \]
      7. +-commutative100.0%

        \[\leadsto 1 - \frac{1 - x}{\frac{\color{blue}{1 + y}}{y}} \]
    3. Simplified100.0%

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

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

    if 0.10000000000000001 < (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1)) < 1.0009999999999999

    1. Initial program 7.8%

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

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

        \[\leadsto \color{blue}{x + \left(\left(-1 \cdot \frac{x - 1}{y} + \frac{x}{{y}^{2}}\right) - \frac{1}{{y}^{2}}\right)} \]
      2. associate--l+100.0%

        \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{x - 1}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right)} \]
      3. mul-1-neg100.0%

        \[\leadsto x + \left(\color{blue}{\left(-\frac{x - 1}{y}\right)} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      4. sub-neg100.0%

        \[\leadsto x + \left(\left(-\frac{\color{blue}{x + \left(-1\right)}}{y}\right) + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      5. metadata-eval100.0%

        \[\leadsto x + \left(\left(-\frac{x + \color{blue}{-1}}{y}\right) + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      6. distribute-neg-frac100.0%

        \[\leadsto x + \left(\color{blue}{\frac{-\left(x + -1\right)}{y}} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      7. +-commutative100.0%

        \[\leadsto x + \left(\frac{-\color{blue}{\left(-1 + x\right)}}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      8. distribute-neg-in100.0%

        \[\leadsto x + \left(\frac{\color{blue}{\left(--1\right) + \left(-x\right)}}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      9. metadata-eval100.0%

        \[\leadsto x + \left(\frac{\color{blue}{1} + \left(-x\right)}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      10. sub-neg100.0%

        \[\leadsto x + \left(\frac{\color{blue}{1 - x}}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      11. div-sub100.0%

        \[\leadsto x + \left(\frac{1 - x}{y} + \color{blue}{\frac{x - 1}{{y}^{2}}}\right) \]
      12. sub-neg100.0%

        \[\leadsto x + \left(\frac{1 - x}{y} + \frac{\color{blue}{x + \left(-1\right)}}{{y}^{2}}\right) \]
      13. metadata-eval100.0%

        \[\leadsto x + \left(\frac{1 - x}{y} + \frac{x + \color{blue}{-1}}{{y}^{2}}\right) \]
      14. +-commutative100.0%

        \[\leadsto x + \left(\frac{1 - x}{y} + \frac{\color{blue}{-1 + x}}{{y}^{2}}\right) \]
      15. unpow2100.0%

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

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

      \[\leadsto x + \color{blue}{\left(\frac{1}{y} - \frac{1}{{y}^{2}}\right)} \]
    6. Step-by-step derivation
      1. unpow2100.0%

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

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

    if 1.0009999999999999 < (/.f64 (*.f64 (-.f64 1 x) y) (+.f64 y 1))

    1. Initial program 77.8%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg77.8%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in99.5%

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

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-99.5%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval99.5%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative99.5%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative99.5%

        \[\leadsto 1 + \frac{x + -1}{\color{blue}{1 + y}} \cdot y \]
    3. Simplified99.5%

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

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

Alternative 4: 99.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -370000 \lor \neg \left(y \leq 510000\right):\\ \;\;\;\;x + \left(\frac{x + -1}{y \cdot y} - \frac{x + -1}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -370000.0) (not (<= y 510000.0)))
   (+ x (- (/ (+ x -1.0) (* y y)) (/ (+ x -1.0) y)))
   (+ 1.0 (* y (/ (+ x -1.0) (+ y 1.0))))))
double code(double x, double y) {
	double tmp;
	if ((y <= -370000.0) || !(y <= 510000.0)) {
		tmp = x + (((x + -1.0) / (y * y)) - ((x + -1.0) / y));
	} else {
		tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= (-370000.0d0)) .or. (.not. (y <= 510000.0d0))) then
        tmp = x + (((x + (-1.0d0)) / (y * y)) - ((x + (-1.0d0)) / y))
    else
        tmp = 1.0d0 + (y * ((x + (-1.0d0)) / (y + 1.0d0)))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= -370000.0) || !(y <= 510000.0)) {
		tmp = x + (((x + -1.0) / (y * y)) - ((x + -1.0) / y));
	} else {
		tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -370000.0) or not (y <= 510000.0):
		tmp = x + (((x + -1.0) / (y * y)) - ((x + -1.0) / y))
	else:
		tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)))
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -370000.0) || !(y <= 510000.0))
		tmp = Float64(x + Float64(Float64(Float64(x + -1.0) / Float64(y * y)) - Float64(Float64(x + -1.0) / y)));
	else
		tmp = Float64(1.0 + Float64(y * Float64(Float64(x + -1.0) / Float64(y + 1.0))));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -370000.0) || ~((y <= 510000.0)))
		tmp = x + (((x + -1.0) / (y * y)) - ((x + -1.0) / y));
	else
		tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -370000.0], N[Not[LessEqual[y, 510000.0]], $MachinePrecision]], N[(x + N[(N[(N[(x + -1.0), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(N[(x + -1.0), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -370000 \lor \neg \left(y \leq 510000\right):\\
\;\;\;\;x + \left(\frac{x + -1}{y \cdot y} - \frac{x + -1}{y}\right)\\

\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\


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

    1. Initial program 30.2%

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

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

        \[\leadsto \color{blue}{x + \left(\left(-1 \cdot \frac{x - 1}{y} + \frac{x}{{y}^{2}}\right) - \frac{1}{{y}^{2}}\right)} \]
      2. associate--l+100.0%

        \[\leadsto x + \color{blue}{\left(-1 \cdot \frac{x - 1}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right)} \]
      3. mul-1-neg100.0%

        \[\leadsto x + \left(\color{blue}{\left(-\frac{x - 1}{y}\right)} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      4. sub-neg100.0%

        \[\leadsto x + \left(\left(-\frac{\color{blue}{x + \left(-1\right)}}{y}\right) + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      5. metadata-eval100.0%

        \[\leadsto x + \left(\left(-\frac{x + \color{blue}{-1}}{y}\right) + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      6. distribute-neg-frac100.0%

        \[\leadsto x + \left(\color{blue}{\frac{-\left(x + -1\right)}{y}} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      7. +-commutative100.0%

        \[\leadsto x + \left(\frac{-\color{blue}{\left(-1 + x\right)}}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      8. distribute-neg-in100.0%

        \[\leadsto x + \left(\frac{\color{blue}{\left(--1\right) + \left(-x\right)}}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      9. metadata-eval100.0%

        \[\leadsto x + \left(\frac{\color{blue}{1} + \left(-x\right)}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      10. sub-neg100.0%

        \[\leadsto x + \left(\frac{\color{blue}{1 - x}}{y} + \left(\frac{x}{{y}^{2}} - \frac{1}{{y}^{2}}\right)\right) \]
      11. div-sub100.0%

        \[\leadsto x + \left(\frac{1 - x}{y} + \color{blue}{\frac{x - 1}{{y}^{2}}}\right) \]
      12. sub-neg100.0%

        \[\leadsto x + \left(\frac{1 - x}{y} + \frac{\color{blue}{x + \left(-1\right)}}{{y}^{2}}\right) \]
      13. metadata-eval100.0%

        \[\leadsto x + \left(\frac{1 - x}{y} + \frac{x + \color{blue}{-1}}{{y}^{2}}\right) \]
      14. +-commutative100.0%

        \[\leadsto x + \left(\frac{1 - x}{y} + \frac{\color{blue}{-1 + x}}{{y}^{2}}\right) \]
      15. unpow2100.0%

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

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

    if -3.7e5 < y < 5.1e5

    1. Initial program 99.9%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg99.9%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in99.9%

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

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-99.9%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval99.9%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative99.9%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -370000 \lor \neg \left(y \leq 510000\right):\\ \;\;\;\;x + \left(\frac{x + -1}{y \cdot y} - \frac{x + -1}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\ \end{array} \]

Alternative 5: 99.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -94000000 \lor \neg \left(y \leq 240000000\right):\\ \;\;\;\;x + \frac{1 - x}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -94000000.0) (not (<= y 240000000.0)))
   (+ x (/ (- 1.0 x) y))
   (+ 1.0 (* y (/ (+ x -1.0) (+ y 1.0))))))
double code(double x, double y) {
	double tmp;
	if ((y <= -94000000.0) || !(y <= 240000000.0)) {
		tmp = x + ((1.0 - x) / y);
	} else {
		tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= (-94000000.0d0)) .or. (.not. (y <= 240000000.0d0))) then
        tmp = x + ((1.0d0 - x) / y)
    else
        tmp = 1.0d0 + (y * ((x + (-1.0d0)) / (y + 1.0d0)))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= -94000000.0) || !(y <= 240000000.0)) {
		tmp = x + ((1.0 - x) / y);
	} else {
		tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -94000000.0) or not (y <= 240000000.0):
		tmp = x + ((1.0 - x) / y)
	else:
		tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)))
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -94000000.0) || !(y <= 240000000.0))
		tmp = Float64(x + Float64(Float64(1.0 - x) / y));
	else
		tmp = Float64(1.0 + Float64(y * Float64(Float64(x + -1.0) / Float64(y + 1.0))));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -94000000.0) || ~((y <= 240000000.0)))
		tmp = x + ((1.0 - x) / y);
	else
		tmp = 1.0 + (y * ((x + -1.0) / (y + 1.0)));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -94000000.0], N[Not[LessEqual[y, 240000000.0]], $MachinePrecision]], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(N[(x + -1.0), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -94000000 \lor \neg \left(y \leq 240000000\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\

\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\


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

    1. Initial program 29.4%

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

      \[\leadsto \color{blue}{x + -1 \cdot \frac{x - 1}{y}} \]
    3. Step-by-step derivation
      1. mul-1-neg99.8%

        \[\leadsto x + \color{blue}{\left(-\frac{x - 1}{y}\right)} \]
      2. sub-neg99.8%

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

        \[\leadsto x + \left(-\frac{x + \color{blue}{-1}}{y}\right) \]
      4. distribute-neg-frac99.8%

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

        \[\leadsto x + \frac{-\color{blue}{\left(-1 + x\right)}}{y} \]
      6. distribute-neg-in99.8%

        \[\leadsto x + \frac{\color{blue}{\left(--1\right) + \left(-x\right)}}{y} \]
      7. metadata-eval99.8%

        \[\leadsto x + \frac{\color{blue}{1} + \left(-x\right)}{y} \]
      8. sub-neg99.8%

        \[\leadsto x + \frac{\color{blue}{1 - x}}{y} \]
    4. Simplified99.8%

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

    if -9.4e7 < y < 2.4e8

    1. Initial program 99.6%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg99.6%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in99.6%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg99.6%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-99.6%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval99.6%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative99.6%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative99.6%

        \[\leadsto 1 + \frac{x + -1}{\color{blue}{1 + y}} \cdot y \]
    3. Simplified99.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -94000000 \lor \neg \left(y \leq 240000000\right):\\ \;\;\;\;x + \frac{1 - x}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\ \end{array} \]

Alternative 6: 85.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.06 \cdot 10^{+99}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.08 \cdot 10^{+46}:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{elif}\;y \leq -1 \lor \neg \left(y \leq 1.62\right):\\ \;\;\;\;x - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + y \cdot x\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -1.06e+99)
   x
   (if (<= y -1.08e+46)
     (/ 1.0 y)
     (if (or (<= y -1.0) (not (<= y 1.62))) (- x (/ x y)) (+ 1.0 (* y x))))))
double code(double x, double y) {
	double tmp;
	if (y <= -1.06e+99) {
		tmp = x;
	} else if (y <= -1.08e+46) {
		tmp = 1.0 / y;
	} else if ((y <= -1.0) || !(y <= 1.62)) {
		tmp = x - (x / y);
	} else {
		tmp = 1.0 + (y * 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.06d+99)) then
        tmp = x
    else if (y <= (-1.08d+46)) then
        tmp = 1.0d0 / y
    else if ((y <= (-1.0d0)) .or. (.not. (y <= 1.62d0))) then
        tmp = x - (x / y)
    else
        tmp = 1.0d0 + (y * x)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -1.06e+99) {
		tmp = x;
	} else if (y <= -1.08e+46) {
		tmp = 1.0 / y;
	} else if ((y <= -1.0) || !(y <= 1.62)) {
		tmp = x - (x / y);
	} else {
		tmp = 1.0 + (y * x);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -1.06e+99:
		tmp = x
	elif y <= -1.08e+46:
		tmp = 1.0 / y
	elif (y <= -1.0) or not (y <= 1.62):
		tmp = x - (x / y)
	else:
		tmp = 1.0 + (y * x)
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -1.06e+99)
		tmp = x;
	elseif (y <= -1.08e+46)
		tmp = Float64(1.0 / y);
	elseif ((y <= -1.0) || !(y <= 1.62))
		tmp = Float64(x - Float64(x / y));
	else
		tmp = Float64(1.0 + Float64(y * x));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -1.06e+99)
		tmp = x;
	elseif (y <= -1.08e+46)
		tmp = 1.0 / y;
	elseif ((y <= -1.0) || ~((y <= 1.62)))
		tmp = x - (x / y);
	else
		tmp = 1.0 + (y * x);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -1.06e+99], x, If[LessEqual[y, -1.08e+46], N[(1.0 / y), $MachinePrecision], If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.62]], $MachinePrecision]], N[(x - N[(x / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.06 \cdot 10^{+99}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq -1.08 \cdot 10^{+46}:\\
\;\;\;\;\frac{1}{y}\\

\mathbf{elif}\;y \leq -1 \lor \neg \left(y \leq 1.62\right):\\
\;\;\;\;x - \frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;1 + y \cdot x\\


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

    1. Initial program 24.0%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg24.0%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in53.5%

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

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-53.5%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval53.5%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative53.5%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative53.5%

        \[\leadsto 1 + \frac{x + -1}{\color{blue}{1 + y}} \cdot y \]
    3. Simplified53.5%

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

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

    if -1.05999999999999999e99 < y < -1.07999999999999994e46

    1. Initial program 33.7%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg33.7%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in33.3%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg33.3%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-33.3%

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

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative33.3%

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

        \[\leadsto 1 + \frac{x + -1}{\color{blue}{1 + y}} \cdot y \]
    3. Simplified33.3%

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

      \[\leadsto \color{blue}{1 + -1 \cdot \frac{y}{1 + y}} \]
    5. Step-by-step derivation
      1. neg-mul-13.4%

        \[\leadsto 1 + \color{blue}{\left(-\frac{y}{1 + y}\right)} \]
      2. sub-neg3.4%

        \[\leadsto \color{blue}{1 - \frac{y}{1 + y}} \]
    6. Simplified3.4%

      \[\leadsto \color{blue}{1 - \frac{y}{1 + y}} \]
    7. Taylor expanded in y around inf 70.1%

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

    if -1.07999999999999994e46 < y < -1 or 1.6200000000000001 < y

    1. Initial program 35.6%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg35.6%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in60.7%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg60.7%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-60.7%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval60.7%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative60.7%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative60.7%

        \[\leadsto 1 + \frac{x + -1}{\color{blue}{1 + y}} \cdot y \]
    3. Simplified60.7%

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

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

      \[\leadsto \color{blue}{x + -1 \cdot \frac{x}{y}} \]
    6. Step-by-step derivation
      1. neg-mul-175.3%

        \[\leadsto x + \color{blue}{\left(-\frac{x}{y}\right)} \]
      2. unsub-neg75.3%

        \[\leadsto \color{blue}{x - \frac{x}{y}} \]
    7. Simplified75.3%

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

    if -1 < y < 1.6200000000000001

    1. Initial program 100.0%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in100.0%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg100.0%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-100.0%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval100.0%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative100.0%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.06 \cdot 10^{+99}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.08 \cdot 10^{+46}:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{elif}\;y \leq -1 \lor \neg \left(y \leq 1.62\right):\\ \;\;\;\;x - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + y \cdot x\\ \end{array} \]

Alternative 7: 84.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.06 \cdot 10^{+99}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -5.5 \cdot 10^{+45}:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{elif}\;y \leq -1:\\ \;\;\;\;y \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq 1.9:\\ \;\;\;\;1 + y \cdot x\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -1.06e+99)
   x
   (if (<= y -5.5e+45)
     (/ 1.0 y)
     (if (<= y -1.0) (* y (/ x y)) (if (<= y 1.9) (+ 1.0 (* y x)) x)))))
double code(double x, double y) {
	double tmp;
	if (y <= -1.06e+99) {
		tmp = x;
	} else if (y <= -5.5e+45) {
		tmp = 1.0 / y;
	} else if (y <= -1.0) {
		tmp = y * (x / y);
	} else if (y <= 1.9) {
		tmp = 1.0 + (y * x);
	} 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.06d+99)) then
        tmp = x
    else if (y <= (-5.5d+45)) then
        tmp = 1.0d0 / y
    else if (y <= (-1.0d0)) then
        tmp = y * (x / y)
    else if (y <= 1.9d0) then
        tmp = 1.0d0 + (y * x)
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -1.06e+99) {
		tmp = x;
	} else if (y <= -5.5e+45) {
		tmp = 1.0 / y;
	} else if (y <= -1.0) {
		tmp = y * (x / y);
	} else if (y <= 1.9) {
		tmp = 1.0 + (y * x);
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -1.06e+99:
		tmp = x
	elif y <= -5.5e+45:
		tmp = 1.0 / y
	elif y <= -1.0:
		tmp = y * (x / y)
	elif y <= 1.9:
		tmp = 1.0 + (y * x)
	else:
		tmp = x
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -1.06e+99)
		tmp = x;
	elseif (y <= -5.5e+45)
		tmp = Float64(1.0 / y);
	elseif (y <= -1.0)
		tmp = Float64(y * Float64(x / y));
	elseif (y <= 1.9)
		tmp = Float64(1.0 + Float64(y * x));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -1.06e+99)
		tmp = x;
	elseif (y <= -5.5e+45)
		tmp = 1.0 / y;
	elseif (y <= -1.0)
		tmp = y * (x / y);
	elseif (y <= 1.9)
		tmp = 1.0 + (y * x);
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -1.06e+99], x, If[LessEqual[y, -5.5e+45], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, -1.0], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9], N[(1.0 + N[(y * x), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.06 \cdot 10^{+99}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq -5.5 \cdot 10^{+45}:\\
\;\;\;\;\frac{1}{y}\\

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

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

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


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

    1. Initial program 27.5%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg27.5%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in55.3%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg55.3%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-55.3%

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

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative55.3%

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

        \[\leadsto 1 + \frac{x + -1}{\color{blue}{1 + y}} \cdot y \]
    3. Simplified55.3%

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

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

    if -1.05999999999999999e99 < y < -5.5000000000000001e45

    1. Initial program 33.7%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg33.7%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in33.3%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg33.3%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-33.3%

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

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative33.3%

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

        \[\leadsto 1 + \frac{x + -1}{\color{blue}{1 + y}} \cdot y \]
    3. Simplified33.3%

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

      \[\leadsto \color{blue}{1 + -1 \cdot \frac{y}{1 + y}} \]
    5. Step-by-step derivation
      1. neg-mul-13.4%

        \[\leadsto 1 + \color{blue}{\left(-\frac{y}{1 + y}\right)} \]
      2. sub-neg3.4%

        \[\leadsto \color{blue}{1 - \frac{y}{1 + y}} \]
    6. Simplified3.4%

      \[\leadsto \color{blue}{1 - \frac{y}{1 + y}} \]
    7. Taylor expanded in y around inf 70.1%

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

    if -5.5000000000000001e45 < y < -1

    1. Initial program 70.1%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg70.1%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in84.9%

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

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-84.9%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval84.9%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative84.9%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative84.9%

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{1 + y}} \]
    5. Step-by-step derivation
      1. associate-/l*76.0%

        \[\leadsto \color{blue}{\frac{x}{\frac{1 + y}{y}}} \]
      2. associate-/r/75.9%

        \[\leadsto \color{blue}{\frac{x}{1 + y} \cdot y} \]
    6. Applied egg-rr75.9%

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

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

    if -1 < y < 1.8999999999999999

    1. Initial program 100.0%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in100.0%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg100.0%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-100.0%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval100.0%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative100.0%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.06 \cdot 10^{+99}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -5.5 \cdot 10^{+45}:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{elif}\;y \leq -1:\\ \;\;\;\;y \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq 1.9:\\ \;\;\;\;1 + y \cdot x\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 8: 85.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.06 \cdot 10^{+99}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{+46}:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{elif}\;y \leq -5 \cdot 10^{-8}:\\ \;\;\;\;y \cdot \frac{x}{y + 1}\\ \mathbf{elif}\;y \leq 1.9:\\ \;\;\;\;1 + y \cdot x\\ \mathbf{else}:\\ \;\;\;\;x - \frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -1.06e+99)
   x
   (if (<= y -1.1e+46)
     (/ 1.0 y)
     (if (<= y -5e-8)
       (* y (/ x (+ y 1.0)))
       (if (<= y 1.9) (+ 1.0 (* y x)) (- x (/ x y)))))))
double code(double x, double y) {
	double tmp;
	if (y <= -1.06e+99) {
		tmp = x;
	} else if (y <= -1.1e+46) {
		tmp = 1.0 / y;
	} else if (y <= -5e-8) {
		tmp = y * (x / (y + 1.0));
	} else if (y <= 1.9) {
		tmp = 1.0 + (y * x);
	} else {
		tmp = x - (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 <= (-1.06d+99)) then
        tmp = x
    else if (y <= (-1.1d+46)) then
        tmp = 1.0d0 / y
    else if (y <= (-5d-8)) then
        tmp = y * (x / (y + 1.0d0))
    else if (y <= 1.9d0) then
        tmp = 1.0d0 + (y * x)
    else
        tmp = x - (x / y)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -1.06e+99) {
		tmp = x;
	} else if (y <= -1.1e+46) {
		tmp = 1.0 / y;
	} else if (y <= -5e-8) {
		tmp = y * (x / (y + 1.0));
	} else if (y <= 1.9) {
		tmp = 1.0 + (y * x);
	} else {
		tmp = x - (x / y);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -1.06e+99:
		tmp = x
	elif y <= -1.1e+46:
		tmp = 1.0 / y
	elif y <= -5e-8:
		tmp = y * (x / (y + 1.0))
	elif y <= 1.9:
		tmp = 1.0 + (y * x)
	else:
		tmp = x - (x / y)
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -1.06e+99)
		tmp = x;
	elseif (y <= -1.1e+46)
		tmp = Float64(1.0 / y);
	elseif (y <= -5e-8)
		tmp = Float64(y * Float64(x / Float64(y + 1.0)));
	elseif (y <= 1.9)
		tmp = Float64(1.0 + Float64(y * x));
	else
		tmp = Float64(x - Float64(x / y));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -1.06e+99)
		tmp = x;
	elseif (y <= -1.1e+46)
		tmp = 1.0 / y;
	elseif (y <= -5e-8)
		tmp = y * (x / (y + 1.0));
	elseif (y <= 1.9)
		tmp = 1.0 + (y * x);
	else
		tmp = x - (x / y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -1.06e+99], x, If[LessEqual[y, -1.1e+46], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, -5e-8], N[(y * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9], N[(1.0 + N[(y * x), $MachinePrecision]), $MachinePrecision], N[(x - N[(x / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.06 \cdot 10^{+99}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq -1.1 \cdot 10^{+46}:\\
\;\;\;\;\frac{1}{y}\\

\mathbf{elif}\;y \leq -5 \cdot 10^{-8}:\\
\;\;\;\;y \cdot \frac{x}{y + 1}\\

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

\mathbf{else}:\\
\;\;\;\;x - \frac{x}{y}\\


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

    1. Initial program 24.0%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg24.0%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in53.5%

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

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-53.5%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval53.5%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative53.5%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative53.5%

        \[\leadsto 1 + \frac{x + -1}{\color{blue}{1 + y}} \cdot y \]
    3. Simplified53.5%

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

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

    if -1.05999999999999999e99 < y < -1.1e46

    1. Initial program 33.7%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg33.7%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in33.3%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg33.3%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-33.3%

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

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative33.3%

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

        \[\leadsto 1 + \frac{x + -1}{\color{blue}{1 + y}} \cdot y \]
    3. Simplified33.3%

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

      \[\leadsto \color{blue}{1 + -1 \cdot \frac{y}{1 + y}} \]
    5. Step-by-step derivation
      1. neg-mul-13.4%

        \[\leadsto 1 + \color{blue}{\left(-\frac{y}{1 + y}\right)} \]
      2. sub-neg3.4%

        \[\leadsto \color{blue}{1 - \frac{y}{1 + y}} \]
    6. Simplified3.4%

      \[\leadsto \color{blue}{1 - \frac{y}{1 + y}} \]
    7. Taylor expanded in y around inf 70.1%

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

    if -1.1e46 < y < -4.9999999999999998e-8

    1. Initial program 74.3%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg74.3%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in86.9%

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

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-86.9%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval86.9%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative86.9%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative86.9%

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{1 + y}} \]
    5. Step-by-step derivation
      1. associate-/l*79.1%

        \[\leadsto \color{blue}{\frac{x}{\frac{1 + y}{y}}} \]
      2. associate-/r/78.9%

        \[\leadsto \color{blue}{\frac{x}{1 + y} \cdot y} \]
    6. Applied egg-rr78.9%

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

    if -4.9999999999999998e-8 < y < 1.8999999999999999

    1. Initial program 100.0%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in100.0%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg100.0%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-100.0%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval100.0%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative100.0%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative100.0%

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

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

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

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

    if 1.8999999999999999 < y

    1. Initial program 29.4%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg29.4%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in56.3%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg56.3%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-56.3%

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

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative56.3%

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

        \[\leadsto 1 + \frac{x + -1}{\color{blue}{1 + y}} \cdot y \]
    3. Simplified56.3%

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

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

      \[\leadsto \color{blue}{x + -1 \cdot \frac{x}{y}} \]
    6. Step-by-step derivation
      1. neg-mul-175.5%

        \[\leadsto x + \color{blue}{\left(-\frac{x}{y}\right)} \]
      2. unsub-neg75.5%

        \[\leadsto \color{blue}{x - \frac{x}{y}} \]
    7. Simplified75.5%

      \[\leadsto \color{blue}{x - \frac{x}{y}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification89.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.06 \cdot 10^{+99}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{+46}:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{elif}\;y \leq -5 \cdot 10^{-8}:\\ \;\;\;\;y \cdot \frac{x}{y + 1}\\ \mathbf{elif}\;y \leq 1.9:\\ \;\;\;\;1 + y \cdot x\\ \mathbf{else}:\\ \;\;\;\;x - \frac{x}{y}\\ \end{array} \]

Alternative 9: 98.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -420 \lor \neg \left(y \leq 150000\right):\\ \;\;\;\;x + \frac{1 - x}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + y \cdot \frac{x}{y + 1}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -420.0) (not (<= y 150000.0)))
   (+ x (/ (- 1.0 x) y))
   (+ 1.0 (* y (/ x (+ y 1.0))))))
double code(double x, double y) {
	double tmp;
	if ((y <= -420.0) || !(y <= 150000.0)) {
		tmp = x + ((1.0 - x) / y);
	} else {
		tmp = 1.0 + (y * (x / (y + 1.0)));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= (-420.0d0)) .or. (.not. (y <= 150000.0d0))) then
        tmp = x + ((1.0d0 - x) / y)
    else
        tmp = 1.0d0 + (y * (x / (y + 1.0d0)))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= -420.0) || !(y <= 150000.0)) {
		tmp = x + ((1.0 - x) / y);
	} else {
		tmp = 1.0 + (y * (x / (y + 1.0)));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -420.0) or not (y <= 150000.0):
		tmp = x + ((1.0 - x) / y)
	else:
		tmp = 1.0 + (y * (x / (y + 1.0)))
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -420.0) || !(y <= 150000.0))
		tmp = Float64(x + Float64(Float64(1.0 - x) / y));
	else
		tmp = Float64(1.0 + Float64(y * Float64(x / Float64(y + 1.0))));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -420.0) || ~((y <= 150000.0)))
		tmp = x + ((1.0 - x) / y);
	else
		tmp = 1.0 + (y * (x / (y + 1.0)));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -420.0], N[Not[LessEqual[y, 150000.0]], $MachinePrecision]], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -420 \lor \neg \left(y \leq 150000\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\

\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{x}{y + 1}\\


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

    1. Initial program 30.6%

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

      \[\leadsto \color{blue}{x + -1 \cdot \frac{x - 1}{y}} \]
    3. Step-by-step derivation
      1. mul-1-neg98.8%

        \[\leadsto x + \color{blue}{\left(-\frac{x - 1}{y}\right)} \]
      2. sub-neg98.8%

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

        \[\leadsto x + \left(-\frac{x + \color{blue}{-1}}{y}\right) \]
      4. distribute-neg-frac98.8%

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

        \[\leadsto x + \frac{-\color{blue}{\left(-1 + x\right)}}{y} \]
      6. distribute-neg-in98.8%

        \[\leadsto x + \frac{\color{blue}{\left(--1\right) + \left(-x\right)}}{y} \]
      7. metadata-eval98.8%

        \[\leadsto x + \frac{\color{blue}{1} + \left(-x\right)}{y} \]
      8. sub-neg98.8%

        \[\leadsto x + \frac{\color{blue}{1 - x}}{y} \]
    4. Simplified98.8%

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

    if -420 < y < 1.5e5

    1. Initial program 100.0%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in100.0%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg100.0%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-100.0%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval100.0%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative100.0%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -420 \lor \neg \left(y \leq 150000\right):\\ \;\;\;\;x + \frac{1 - x}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + y \cdot \frac{x}{y + 1}\\ \end{array} \]

Alternative 10: 72.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{+99}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{+46}:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{elif}\;y \leq -1:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-12}:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -1.4e+99)
   x
   (if (<= y -1.1e+46)
     (/ 1.0 y)
     (if (<= y -1.0) x (if (<= y 9.5e-12) (- 1.0 y) x)))))
double code(double x, double y) {
	double tmp;
	if (y <= -1.4e+99) {
		tmp = x;
	} else if (y <= -1.1e+46) {
		tmp = 1.0 / y;
	} else if (y <= -1.0) {
		tmp = x;
	} else if (y <= 9.5e-12) {
		tmp = 1.0 - 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.4d+99)) then
        tmp = x
    else if (y <= (-1.1d+46)) then
        tmp = 1.0d0 / y
    else if (y <= (-1.0d0)) then
        tmp = x
    else if (y <= 9.5d-12) then
        tmp = 1.0d0 - y
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -1.4e+99) {
		tmp = x;
	} else if (y <= -1.1e+46) {
		tmp = 1.0 / y;
	} else if (y <= -1.0) {
		tmp = x;
	} else if (y <= 9.5e-12) {
		tmp = 1.0 - y;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -1.4e+99:
		tmp = x
	elif y <= -1.1e+46:
		tmp = 1.0 / y
	elif y <= -1.0:
		tmp = x
	elif y <= 9.5e-12:
		tmp = 1.0 - y
	else:
		tmp = x
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -1.4e+99)
		tmp = x;
	elseif (y <= -1.1e+46)
		tmp = Float64(1.0 / y);
	elseif (y <= -1.0)
		tmp = x;
	elseif (y <= 9.5e-12)
		tmp = Float64(1.0 - y);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -1.4e+99)
		tmp = x;
	elseif (y <= -1.1e+46)
		tmp = 1.0 / y;
	elseif (y <= -1.0)
		tmp = x;
	elseif (y <= 9.5e-12)
		tmp = 1.0 - y;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -1.4e+99], x, If[LessEqual[y, -1.1e+46], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, -1.0], x, If[LessEqual[y, 9.5e-12], N[(1.0 - y), $MachinePrecision], x]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{+99}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq -1.1 \cdot 10^{+46}:\\
\;\;\;\;\frac{1}{y}\\

\mathbf{elif}\;y \leq -1:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 9.5 \cdot 10^{-12}:\\
\;\;\;\;1 - y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.4e99 or -1.1e46 < y < -1 or 9.4999999999999995e-12 < y

    1. Initial program 33.2%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg33.2%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in59.2%

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

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-59.2%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval59.2%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative59.2%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative59.2%

        \[\leadsto 1 + \frac{x + -1}{\color{blue}{1 + y}} \cdot y \]
    3. Simplified59.2%

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

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

    if -1.4e99 < y < -1.1e46

    1. Initial program 33.7%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg33.7%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in33.3%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg33.3%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-33.3%

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

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative33.3%

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

        \[\leadsto 1 + \frac{x + -1}{\color{blue}{1 + y}} \cdot y \]
    3. Simplified33.3%

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

      \[\leadsto \color{blue}{1 + -1 \cdot \frac{y}{1 + y}} \]
    5. Step-by-step derivation
      1. neg-mul-13.4%

        \[\leadsto 1 + \color{blue}{\left(-\frac{y}{1 + y}\right)} \]
      2. sub-neg3.4%

        \[\leadsto \color{blue}{1 - \frac{y}{1 + y}} \]
    6. Simplified3.4%

      \[\leadsto \color{blue}{1 - \frac{y}{1 + y}} \]
    7. Taylor expanded in y around inf 70.1%

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

    if -1 < y < 9.4999999999999995e-12

    1. Initial program 100.0%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in100.0%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg100.0%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-100.0%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval100.0%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative100.0%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative100.0%

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

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

      \[\leadsto \color{blue}{1 + -1 \cdot \frac{y}{1 + y}} \]
    5. Step-by-step derivation
      1. neg-mul-174.1%

        \[\leadsto 1 + \color{blue}{\left(-\frac{y}{1 + y}\right)} \]
      2. sub-neg74.1%

        \[\leadsto \color{blue}{1 - \frac{y}{1 + y}} \]
    6. Simplified74.1%

      \[\leadsto \color{blue}{1 - \frac{y}{1 + y}} \]
    7. Taylor expanded in y around 0 74.1%

      \[\leadsto \color{blue}{1 + -1 \cdot y} \]
    8. Step-by-step derivation
      1. neg-mul-174.1%

        \[\leadsto 1 + \color{blue}{\left(-y\right)} \]
      2. sub-neg74.1%

        \[\leadsto \color{blue}{1 - y} \]
    9. Simplified74.1%

      \[\leadsto \color{blue}{1 - y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification75.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{+99}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{+46}:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{elif}\;y \leq -1:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-12}:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 11: 72.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.75 \cdot 10^{+99}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.08 \cdot 10^{+46}:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{elif}\;y \leq -1:\\ \;\;\;\;y \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-12}:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -1.75e+99)
   x
   (if (<= y -1.08e+46)
     (/ 1.0 y)
     (if (<= y -1.0) (* y (/ x y)) (if (<= y 9.5e-12) (- 1.0 y) x)))))
double code(double x, double y) {
	double tmp;
	if (y <= -1.75e+99) {
		tmp = x;
	} else if (y <= -1.08e+46) {
		tmp = 1.0 / y;
	} else if (y <= -1.0) {
		tmp = y * (x / y);
	} else if (y <= 9.5e-12) {
		tmp = 1.0 - 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.75d+99)) then
        tmp = x
    else if (y <= (-1.08d+46)) then
        tmp = 1.0d0 / y
    else if (y <= (-1.0d0)) then
        tmp = y * (x / y)
    else if (y <= 9.5d-12) then
        tmp = 1.0d0 - y
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -1.75e+99) {
		tmp = x;
	} else if (y <= -1.08e+46) {
		tmp = 1.0 / y;
	} else if (y <= -1.0) {
		tmp = y * (x / y);
	} else if (y <= 9.5e-12) {
		tmp = 1.0 - y;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -1.75e+99:
		tmp = x
	elif y <= -1.08e+46:
		tmp = 1.0 / y
	elif y <= -1.0:
		tmp = y * (x / y)
	elif y <= 9.5e-12:
		tmp = 1.0 - y
	else:
		tmp = x
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -1.75e+99)
		tmp = x;
	elseif (y <= -1.08e+46)
		tmp = Float64(1.0 / y);
	elseif (y <= -1.0)
		tmp = Float64(y * Float64(x / y));
	elseif (y <= 9.5e-12)
		tmp = Float64(1.0 - y);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -1.75e+99)
		tmp = x;
	elseif (y <= -1.08e+46)
		tmp = 1.0 / y;
	elseif (y <= -1.0)
		tmp = y * (x / y);
	elseif (y <= 9.5e-12)
		tmp = 1.0 - y;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -1.75e+99], x, If[LessEqual[y, -1.08e+46], N[(1.0 / y), $MachinePrecision], If[LessEqual[y, -1.0], N[(y * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.5e-12], N[(1.0 - y), $MachinePrecision], x]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.75 \cdot 10^{+99}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq -1.08 \cdot 10^{+46}:\\
\;\;\;\;\frac{1}{y}\\

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

\mathbf{elif}\;y \leq 9.5 \cdot 10^{-12}:\\
\;\;\;\;1 - y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.7499999999999999e99 or 9.4999999999999995e-12 < y

    1. Initial program 28.9%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg28.9%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in56.2%

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

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-56.2%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval56.2%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative56.2%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative56.2%

        \[\leadsto 1 + \frac{x + -1}{\color{blue}{1 + y}} \cdot y \]
    3. Simplified56.2%

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

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

    if -1.7499999999999999e99 < y < -1.07999999999999994e46

    1. Initial program 33.7%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg33.7%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in33.3%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg33.3%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-33.3%

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

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative33.3%

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

        \[\leadsto 1 + \frac{x + -1}{\color{blue}{1 + y}} \cdot y \]
    3. Simplified33.3%

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

      \[\leadsto \color{blue}{1 + -1 \cdot \frac{y}{1 + y}} \]
    5. Step-by-step derivation
      1. neg-mul-13.4%

        \[\leadsto 1 + \color{blue}{\left(-\frac{y}{1 + y}\right)} \]
      2. sub-neg3.4%

        \[\leadsto \color{blue}{1 - \frac{y}{1 + y}} \]
    6. Simplified3.4%

      \[\leadsto \color{blue}{1 - \frac{y}{1 + y}} \]
    7. Taylor expanded in y around inf 70.1%

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

    if -1.07999999999999994e46 < y < -1

    1. Initial program 70.1%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg70.1%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in84.9%

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

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-84.9%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval84.9%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative84.9%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative84.9%

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{1 + y}} \]
    5. Step-by-step derivation
      1. associate-/l*76.0%

        \[\leadsto \color{blue}{\frac{x}{\frac{1 + y}{y}}} \]
      2. associate-/r/75.9%

        \[\leadsto \color{blue}{\frac{x}{1 + y} \cdot y} \]
    6. Applied egg-rr75.9%

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

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

    if -1 < y < 9.4999999999999995e-12

    1. Initial program 100.0%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in100.0%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg100.0%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-100.0%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval100.0%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative100.0%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative100.0%

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

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

      \[\leadsto \color{blue}{1 + -1 \cdot \frac{y}{1 + y}} \]
    5. Step-by-step derivation
      1. neg-mul-174.1%

        \[\leadsto 1 + \color{blue}{\left(-\frac{y}{1 + y}\right)} \]
      2. sub-neg74.1%

        \[\leadsto \color{blue}{1 - \frac{y}{1 + y}} \]
    6. Simplified74.1%

      \[\leadsto \color{blue}{1 - \frac{y}{1 + y}} \]
    7. Taylor expanded in y around 0 74.1%

      \[\leadsto \color{blue}{1 + -1 \cdot y} \]
    8. Step-by-step derivation
      1. neg-mul-174.1%

        \[\leadsto 1 + \color{blue}{\left(-y\right)} \]
      2. sub-neg74.1%

        \[\leadsto \color{blue}{1 - y} \]
    9. Simplified74.1%

      \[\leadsto \color{blue}{1 - y} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification75.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.75 \cdot 10^{+99}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.08 \cdot 10^{+46}:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{elif}\;y \leq -1:\\ \;\;\;\;y \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-12}:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 12: 98.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1.22\right):\\ \;\;\;\;x + \frac{1 - x}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + y \cdot x\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -1.0) (not (<= y 1.22))) (+ x (/ (- 1.0 x) y)) (+ 1.0 (* y x))))
double code(double x, double y) {
	double tmp;
	if ((y <= -1.0) || !(y <= 1.22)) {
		tmp = x + ((1.0 - x) / y);
	} else {
		tmp = 1.0 + (y * 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)) .or. (.not. (y <= 1.22d0))) then
        tmp = x + ((1.0d0 - x) / y)
    else
        tmp = 1.0d0 + (y * x)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= -1.0) || !(y <= 1.22)) {
		tmp = x + ((1.0 - x) / y);
	} else {
		tmp = 1.0 + (y * x);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -1.0) or not (y <= 1.22):
		tmp = x + ((1.0 - x) / y)
	else:
		tmp = 1.0 + (y * x)
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -1.0) || !(y <= 1.22))
		tmp = Float64(x + Float64(Float64(1.0 - x) / y));
	else
		tmp = Float64(1.0 + Float64(y * x));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -1.0) || ~((y <= 1.22)))
		tmp = x + ((1.0 - x) / y);
	else
		tmp = 1.0 + (y * x);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.22]], $MachinePrecision]], N[(x + N[(N[(1.0 - x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1.22\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\

\mathbf{else}:\\
\;\;\;\;1 + y \cdot x\\


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

    1. Initial program 32.3%

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

      \[\leadsto \color{blue}{x + -1 \cdot \frac{x - 1}{y}} \]
    3. Step-by-step derivation
      1. mul-1-neg97.6%

        \[\leadsto x + \color{blue}{\left(-\frac{x - 1}{y}\right)} \]
      2. sub-neg97.6%

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

        \[\leadsto x + \left(-\frac{x + \color{blue}{-1}}{y}\right) \]
      4. distribute-neg-frac97.6%

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

        \[\leadsto x + \frac{-\color{blue}{\left(-1 + x\right)}}{y} \]
      6. distribute-neg-in97.6%

        \[\leadsto x + \frac{\color{blue}{\left(--1\right) + \left(-x\right)}}{y} \]
      7. metadata-eval97.6%

        \[\leadsto x + \frac{\color{blue}{1} + \left(-x\right)}{y} \]
      8. sub-neg97.6%

        \[\leadsto x + \frac{\color{blue}{1 - x}}{y} \]
    4. Simplified97.6%

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

    if -1 < y < 1.21999999999999997

    1. Initial program 100.0%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in100.0%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg100.0%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-100.0%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval100.0%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative100.0%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1.22\right):\\ \;\;\;\;x + \frac{1 - x}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + y \cdot x\\ \end{array} \]

Alternative 13: 98.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;x + \frac{1 - x}{y}\\

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


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

    1. Initial program 32.3%

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

      \[\leadsto \color{blue}{x + -1 \cdot \frac{x - 1}{y}} \]
    3. Step-by-step derivation
      1. mul-1-neg97.6%

        \[\leadsto x + \color{blue}{\left(-\frac{x - 1}{y}\right)} \]
      2. sub-neg97.6%

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

        \[\leadsto x + \left(-\frac{x + \color{blue}{-1}}{y}\right) \]
      4. distribute-neg-frac97.6%

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

        \[\leadsto x + \frac{-\color{blue}{\left(-1 + x\right)}}{y} \]
      6. distribute-neg-in97.6%

        \[\leadsto x + \frac{\color{blue}{\left(--1\right) + \left(-x\right)}}{y} \]
      7. metadata-eval97.6%

        \[\leadsto x + \frac{\color{blue}{1} + \left(-x\right)}{y} \]
      8. sub-neg97.6%

        \[\leadsto x + \frac{\color{blue}{1 - x}}{y} \]
    4. Simplified97.6%

      \[\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. Taylor expanded in y around 0 98.9%

      \[\leadsto 1 - \color{blue}{y \cdot \left(1 - x\right)} \]
    3. Step-by-step derivation
      1. *-commutative98.9%

        \[\leadsto 1 - \color{blue}{\left(1 - x\right) \cdot y} \]
      2. /-rgt-identity98.9%

        \[\leadsto 1 - \color{blue}{\frac{1 - x}{1}} \cdot y \]
      3. associate-/r/98.8%

        \[\leadsto 1 - \color{blue}{\frac{1 - x}{\frac{1}{y}}} \]
      4. div-sub98.8%

        \[\leadsto 1 - \color{blue}{\left(\frac{1}{\frac{1}{y}} - \frac{x}{\frac{1}{y}}\right)} \]
      5. remove-double-div98.8%

        \[\leadsto 1 - \left(\color{blue}{y} - \frac{x}{\frac{1}{y}}\right) \]
      6. associate-/r/98.9%

        \[\leadsto 1 - \left(y - \color{blue}{\frac{x}{1} \cdot y}\right) \]
      7. /-rgt-identity98.9%

        \[\leadsto 1 - \left(y - \color{blue}{x} \cdot y\right) \]
      8. *-commutative98.9%

        \[\leadsto 1 - \left(y - \color{blue}{y \cdot x}\right) \]
    4. Simplified98.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\ \;\;\;\;x + \frac{1 - x}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + \left(y \cdot x - y\right)\\ \end{array} \]

Alternative 14: 74.0% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-12}:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -1.0) x (if (<= y 9.5e-12) (- 1.0 y) x)))
double code(double x, double y) {
	double tmp;
	if (y <= -1.0) {
		tmp = x;
	} else if (y <= 9.5e-12) {
		tmp = 1.0 - 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 <= 9.5d-12) then
        tmp = 1.0d0 - 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 <= 9.5e-12) {
		tmp = 1.0 - y;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -1.0:
		tmp = x
	elif y <= 9.5e-12:
		tmp = 1.0 - y
	else:
		tmp = x
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -1.0)
		tmp = x;
	elseif (y <= 9.5e-12)
		tmp = Float64(1.0 - 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 <= 9.5e-12)
		tmp = 1.0 - y;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 9.5e-12], N[(1.0 - y), $MachinePrecision], x]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 9.5 \cdot 10^{-12}:\\
\;\;\;\;1 - y\\

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


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

    1. Initial program 33.3%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg33.3%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in56.0%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg56.0%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-56.0%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval56.0%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative56.0%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative56.0%

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

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

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

    if -1 < y < 9.4999999999999995e-12

    1. Initial program 100.0%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in100.0%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg100.0%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-100.0%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval100.0%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative100.0%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative100.0%

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

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

      \[\leadsto \color{blue}{1 + -1 \cdot \frac{y}{1 + y}} \]
    5. Step-by-step derivation
      1. neg-mul-174.1%

        \[\leadsto 1 + \color{blue}{\left(-\frac{y}{1 + y}\right)} \]
      2. sub-neg74.1%

        \[\leadsto \color{blue}{1 - \frac{y}{1 + y}} \]
    6. Simplified74.1%

      \[\leadsto \color{blue}{1 - \frac{y}{1 + y}} \]
    7. Taylor expanded in y around 0 74.1%

      \[\leadsto \color{blue}{1 + -1 \cdot y} \]
    8. Step-by-step derivation
      1. neg-mul-174.1%

        \[\leadsto 1 + \color{blue}{\left(-y\right)} \]
      2. sub-neg74.1%

        \[\leadsto \color{blue}{1 - y} \]
    9. Simplified74.1%

      \[\leadsto \color{blue}{1 - y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification73.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-12}:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 15: 73.8% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-12}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y) :precision binary64 (if (<= y -1.0) x (if (<= y 9.5e-12) 1.0 x)))
double code(double x, double y) {
	double tmp;
	if (y <= -1.0) {
		tmp = x;
	} else if (y <= 9.5e-12) {
		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 <= 9.5d-12) 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 <= 9.5e-12) {
		tmp = 1.0;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -1.0:
		tmp = x
	elif y <= 9.5e-12:
		tmp = 1.0
	else:
		tmp = x
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -1.0)
		tmp = x;
	elseif (y <= 9.5e-12)
		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 <= 9.5e-12)
		tmp = 1.0;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -1.0], x, If[LessEqual[y, 9.5e-12], 1.0, x]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 9.5 \cdot 10^{-12}:\\
\;\;\;\;1\\

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


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

    1. Initial program 33.3%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg33.3%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in56.0%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg56.0%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-56.0%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval56.0%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative56.0%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative56.0%

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

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

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

    if -1 < y < 9.4999999999999995e-12

    1. Initial program 100.0%

      \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
    2. Step-by-step derivation
      1. sub-neg100.0%

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

        \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
      3. distribute-lft-neg-in100.0%

        \[\leadsto 1 + \color{blue}{\left(-\frac{1 - x}{y + 1}\right) \cdot y} \]
      4. distribute-frac-neg100.0%

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

        \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
      6. associate--r-100.0%

        \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
      7. metadata-eval100.0%

        \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
      8. +-commutative100.0%

        \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
      9. +-commutative100.0%

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

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

      \[\leadsto \color{blue}{1} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification73.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{-12}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 16: 38.0% 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 65.8%

    \[1 - \frac{\left(1 - x\right) \cdot y}{y + 1} \]
  2. Step-by-step derivation
    1. sub-neg65.8%

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

      \[\leadsto 1 + \left(-\color{blue}{\frac{1 - x}{y + 1} \cdot y}\right) \]
    3. distribute-lft-neg-in77.5%

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

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

      \[\leadsto 1 + \frac{\color{blue}{0 - \left(1 - x\right)}}{y + 1} \cdot y \]
    6. associate--r-77.5%

      \[\leadsto 1 + \frac{\color{blue}{\left(0 - 1\right) + x}}{y + 1} \cdot y \]
    7. metadata-eval77.5%

      \[\leadsto 1 + \frac{\color{blue}{-1} + x}{y + 1} \cdot y \]
    8. +-commutative77.5%

      \[\leadsto 1 + \frac{\color{blue}{x + -1}}{y + 1} \cdot y \]
    9. +-commutative77.5%

      \[\leadsto 1 + \frac{x + -1}{\color{blue}{1 + y}} \cdot y \]
  3. Simplified77.5%

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

    \[\leadsto \color{blue}{1} \]
  5. Final simplification37.9%

    \[\leadsto 1 \]

Developer target: 99.6% accurate, 0.7× 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 2023290 
(FPCore (x y)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, D"
  :precision binary64

  :herbie-target
  (if (< y -3693.8482788297247) (- (/ 1.0 y) (- (/ x y) x)) (if (< y 6799310503.41891) (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))) (- (/ 1.0 y) (- (/ x y) x))))

  (- 1.0 (/ (* (- 1.0 x) y) (+ y 1.0))))