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

Percentage Accurate: 65.5% → 99.9%
Time: 8.7s
Alternatives: 14
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 14 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.5% 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 -190000 \lor \neg \left(y \leq 14000\right):\\ \;\;\;\;\left(x + \left(\frac{1 - x}{{y}^{3}} - \frac{x + -1}{y}\right)\right) + \frac{x + -1}{y \cdot y}\\ \mathbf{else}:\\ \;\;\;\;1 + \frac{y \cdot \left(x + -1\right)}{y + 1}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -190000.0) (not (<= y 14000.0)))
   (+
    (+ x (- (/ (- 1.0 x) (pow y 3.0)) (/ (+ x -1.0) y)))
    (/ (+ x -1.0) (* y y)))
   (+ 1.0 (/ (* y (+ x -1.0)) (+ y 1.0)))))
double code(double x, double y) {
	double tmp;
	if ((y <= -190000.0) || !(y <= 14000.0)) {
		tmp = (x + (((1.0 - x) / pow(y, 3.0)) - ((x + -1.0) / y))) + ((x + -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) :: tmp
    if ((y <= (-190000.0d0)) .or. (.not. (y <= 14000.0d0))) then
        tmp = (x + (((1.0d0 - x) / (y ** 3.0d0)) - ((x + (-1.0d0)) / y))) + ((x + (-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 tmp;
	if ((y <= -190000.0) || !(y <= 14000.0)) {
		tmp = (x + (((1.0 - x) / Math.pow(y, 3.0)) - ((x + -1.0) / y))) + ((x + -1.0) / (y * y));
	} else {
		tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -190000.0) or not (y <= 14000.0):
		tmp = (x + (((1.0 - x) / math.pow(y, 3.0)) - ((x + -1.0) / y))) + ((x + -1.0) / (y * y))
	else:
		tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0))
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -190000.0) || !(y <= 14000.0))
		tmp = Float64(Float64(x + Float64(Float64(Float64(1.0 - x) / (y ^ 3.0)) - Float64(Float64(x + -1.0) / y))) + Float64(Float64(x + -1.0) / Float64(y * y)));
	else
		tmp = Float64(1.0 + Float64(Float64(y * Float64(x + -1.0)) / Float64(y + 1.0)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -190000.0) || ~((y <= 14000.0)))
		tmp = (x + (((1.0 - x) / (y ^ 3.0)) - ((x + -1.0) / y))) + ((x + -1.0) / (y * y));
	else
		tmp = 1.0 + ((y * (x + -1.0)) / (y + 1.0));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -190000.0], N[Not[LessEqual[y, 14000.0]], $MachinePrecision]], N[(N[(x + N[(N[(N[(1.0 - x), $MachinePrecision] / N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision] - N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 29.7%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-\left(1 - x\right)}{\frac{y + 1}{y}}} + 1 \]
      5. *-lft-identity57.2%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*57.2%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y}{1 + y}, \color{blue}{-1} + x, 1\right) \]
      14. +-commutative57.2%

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

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

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

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

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

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

    if -1.9e5 < y < 14000

    1. Initial program 100.0%

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

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

Alternative 2: 99.9% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 29.1%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*56.8%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\frac{x}{{y}^{2}} + \left(-1 \cdot \frac{x - 1}{y} + x\right)\right) - \frac{1}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. +-commutative99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.1e5 < y < 3e5

    1. Initial program 100.0%

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

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

Alternative 3: 73.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_0 := x - \frac{x}{y}\\
\mathbf{if}\;y \leq -8.5 \cdot 10^{+119}:\\
\;\;\;\;x\\

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

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

\mathbf{elif}\;y \leq -2.6 \cdot 10^{-55}:\\
\;\;\;\;y \cdot x\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


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

    1. Initial program 18.1%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-\left(1 - x\right)}{\frac{y + 1}{y}}} + 1 \]
      5. *-lft-identity57.3%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*57.3%

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

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

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

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

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

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

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

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

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

    if -8.49999999999999997e119 < y < -4.5e88

    1. Initial program 23.2%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-\left(1 - x\right)}{\frac{y + 1}{y}}} + 1 \]
      5. *-lft-identity23.2%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*23.2%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y}{1 + y}, \color{blue}{-1} + x, 1\right) \]
      14. +-commutative23.2%

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

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

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

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

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

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

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

    if -4.5e88 < y < -1 or 1 < y

    1. Initial program 38.5%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*62.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{1 + y}{x}}} \]
    6. Simplified67.7%

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

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

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

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

        \[\leadsto \color{blue}{x + \frac{-x}{y}} \]
      4. distribute-frac-neg75.3%

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

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

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

    if -1 < y < -2.5999999999999999e-55

    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. +-commutative100.0%

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

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

        \[\leadsto \color{blue}{\frac{-\left(1 - x\right)}{\frac{y + 1}{y}}} + 1 \]
      5. *-lft-identity99.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{1 + y}{x}}} \]
    6. Simplified73.0%

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

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

    if -2.5999999999999999e-55 < y < 1

    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. +-commutative100.0%

        \[\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}{\frac{y + 1}{y}}}\right) + 1 \]
      4. distribute-neg-frac99.9%

        \[\leadsto \color{blue}{\frac{-\left(1 - x\right)}{\frac{y + 1}{y}}} + 1 \]
      5. *-lft-identity99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.5 \cdot 10^{+119}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -4.5 \cdot 10^{+88}:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{elif}\;y \leq -1:\\ \;\;\;\;x - \frac{x}{y}\\ \mathbf{elif}\;y \leq -2.6 \cdot 10^{-55}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;x - \frac{x}{y}\\ \end{array} \]

Alternative 4: 85.7% accurate, 0.7× speedup?

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

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

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

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

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


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

    1. Initial program 18.1%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-\left(1 - x\right)}{\frac{y + 1}{y}}} + 1 \]
      5. *-lft-identity57.3%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*57.3%

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

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

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

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

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

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

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

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

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

    if -8.49999999999999997e119 < y < -4.5e88

    1. Initial program 23.2%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-\left(1 - x\right)}{\frac{y + 1}{y}}} + 1 \]
      5. *-lft-identity23.2%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*23.2%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y}{1 + y}, \color{blue}{-1} + x, 1\right) \]
      14. +-commutative23.2%

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

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

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

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

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

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

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

    if -4.5e88 < y < -1 or 1.1000000000000001 < y

    1. Initial program 38.5%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*62.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{1 + y}{x}}} \]
    6. Simplified67.7%

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

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

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

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

        \[\leadsto \color{blue}{x + \frac{-x}{y}} \]
      4. distribute-frac-neg75.3%

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

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

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

    if -1 < y < 1.1000000000000001

    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. distribute-neg-frac100.0%

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

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

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

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

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

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

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

        \[\leadsto 1 + \color{blue}{\left(-\frac{-1}{\frac{y + 1}{-1}}\right)} \cdot \left(\left(1 - x\right) \cdot y\right) \]
      10. cancel-sign-sub-inv100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 - \color{blue}{\left(y \cdot 1 + y \cdot \left(-x\right)\right)} \]
      3. *-rgt-identity97.9%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.5 \cdot 10^{+119}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -4.5 \cdot 10^{+88}:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{elif}\;y \leq -1 \lor \neg \left(y \leq 1.1\right):\\ \;\;\;\;x - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + \left(y \cdot x - y\right)\\ \end{array} \]

Alternative 5: 99.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -180000000 \lor \neg \left(y \leq 170000000\right):\\ \;\;\;\;x - \frac{x + -1}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + y \cdot \frac{x + -1}{y + 1}\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -180000000.0) (not (<= y 170000000.0)))
   (- x (/ (+ x -1.0) y))
   (+ 1.0 (* y (/ (+ x -1.0) (+ y 1.0))))))
double code(double x, double y) {
	double tmp;
	if ((y <= -180000000.0) || !(y <= 170000000.0)) {
		tmp = x - ((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 <= (-180000000.0d0)) .or. (.not. (y <= 170000000.0d0))) then
        tmp = x - ((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 <= -180000000.0) || !(y <= 170000000.0)) {
		tmp = x - ((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 <= -180000000.0) or not (y <= 170000000.0):
		tmp = x - ((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 <= -180000000.0) || !(y <= 170000000.0))
		tmp = Float64(x - 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 <= -180000000.0) || ~((y <= 170000000.0)))
		tmp = x - ((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, -180000000.0], N[Not[LessEqual[y, 170000000.0]], $MachinePrecision]], N[(x - N[(N[(x + -1.0), $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 -180000000 \lor \neg \left(y \leq 170000000\right):\\
\;\;\;\;x - \frac{x + -1}{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 < -1.8e8 or 1.7e8 < y

    1. Initial program 28.4%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*56.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x + -1 \cdot \frac{x - 1}{y}} \]
      2. mul-1-neg99.4%

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

        \[\leadsto \color{blue}{x - \frac{x - 1}{y}} \]
      4. sub-neg99.4%

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

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

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

    if -1.8e8 < y < 1.7e8

    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. distribute-neg-frac99.6%

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

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

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

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

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

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

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

        \[\leadsto 1 + \color{blue}{\left(-\frac{-1}{\frac{y + 1}{-1}}\right)} \cdot \left(\left(1 - x\right) \cdot y\right) \]
      10. cancel-sign-sub-inv99.5%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 99.8% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 27.3%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*55.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x + -1 \cdot \frac{x - 1}{y}} \]
      2. mul-1-neg99.4%

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

        \[\leadsto \color{blue}{x - \frac{x - 1}{y}} \]
      4. sub-neg99.4%

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

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

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

    if -1.8e10 < y < 1.6e8

    1. Initial program 99.6%

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

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

Alternative 7: 85.4% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;y \leq -1 \lor \neg \left(y \leq 3\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 < -8.49999999999999997e119

    1. Initial program 18.1%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-\left(1 - x\right)}{\frac{y + 1}{y}}} + 1 \]
      5. *-lft-identity57.3%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*57.3%

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

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

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

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

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

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

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

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

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

    if -8.49999999999999997e119 < y < -4.29999999999999974e88

    1. Initial program 23.2%

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

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

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

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

        \[\leadsto \color{blue}{\frac{-\left(1 - x\right)}{\frac{y + 1}{y}}} + 1 \]
      5. *-lft-identity23.2%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*23.2%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y}{1 + y}, \color{blue}{-1} + x, 1\right) \]
      14. +-commutative23.2%

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

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

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

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

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

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

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

    if -4.29999999999999974e88 < y < -1 or 3 < y

    1. Initial program 38.5%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*62.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{1 + y}{x}}} \]
    6. Simplified67.7%

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

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

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

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

        \[\leadsto \color{blue}{x + \frac{-x}{y}} \]
      4. distribute-frac-neg75.3%

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

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

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

    if -1 < y < 3

    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. distribute-neg-frac100.0%

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

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

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

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

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

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

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

        \[\leadsto 1 + \color{blue}{\left(-\frac{-1}{\frac{y + 1}{-1}}\right)} \cdot \left(\left(1 - x\right) \cdot y\right) \]
      10. cancel-sign-sub-inv100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 - \color{blue}{\left(y \cdot 1 + y \cdot \left(-x\right)\right)} \]
      3. *-rgt-identity97.9%

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

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

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

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

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

        \[\leadsto 1 - \color{blue}{\left(-y \cdot x\right)} \]
      2. distribute-rgt-neg-in97.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.5 \cdot 10^{+119}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -4.3 \cdot 10^{+88}:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{elif}\;y \leq -1 \lor \neg \left(y \leq 3\right):\\ \;\;\;\;x - \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;1 + y \cdot x\\ \end{array} \]

Alternative 8: 72.4% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;y \leq -3.05 \cdot 10^{-56}:\\
\;\;\;\;y \cdot x\\

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

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


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

    1. Initial program 28.5%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*60.6%

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

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

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

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

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

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

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

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

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

    if -8.49999999999999997e119 < y < -1

    1. Initial program 45.7%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*49.5%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y}{1 + y}, \color{blue}{-1} + x, 1\right) \]
      14. +-commutative49.5%

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

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

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

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

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

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

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

    if -1 < y < -3.0499999999999999e-56

    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. +-commutative100.0%

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

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

        \[\leadsto \color{blue}{\frac{-\left(1 - x\right)}{\frac{y + 1}{y}}} + 1 \]
      5. *-lft-identity99.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{1 + y}{x}}} \]
    6. Simplified73.0%

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

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

    if -3.0499999999999999e-56 < y < 0.044999999999999998

    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. +-commutative100.0%

        \[\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}{\frac{y + 1}{y}}}\right) + 1 \]
      4. distribute-neg-frac99.9%

        \[\leadsto \color{blue}{\frac{-\left(1 - x\right)}{\frac{y + 1}{y}}} + 1 \]
      5. *-lft-identity99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.5 \cdot 10^{+119}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1:\\ \;\;\;\;\frac{1}{y}\\ \mathbf{elif}\;y \leq -3.05 \cdot 10^{-56}:\\ \;\;\;\;y \cdot x\\ \mathbf{elif}\;y \leq 0.045:\\ \;\;\;\;1 - y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 9: 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{x + -1}{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 (/ (+ x -1.0) y))
   (+ 1.0 (- (* y x) y))))
double code(double x, double y) {
	double tmp;
	if ((y <= -1.0) || !(y <= 1.0)) {
		tmp = x - ((x + -1.0) / 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 - ((x + (-1.0d0)) / 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 - ((x + -1.0) / 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 - ((x + -1.0) / 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(x + -1.0) / 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 - ((x + -1.0) / 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[(x + -1.0), $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{x + -1}{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 30.8%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*57.9%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x - 1}{y} + x} \]
    5. Step-by-step derivation
      1. +-commutative97.7%

        \[\leadsto \color{blue}{x + -1 \cdot \frac{x - 1}{y}} \]
      2. mul-1-neg97.7%

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

        \[\leadsto \color{blue}{x - \frac{x - 1}{y}} \]
      4. sub-neg97.7%

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

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

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

    if -1 < y < 1

    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. distribute-neg-frac100.0%

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

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

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

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

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

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

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

        \[\leadsto 1 + \color{blue}{\left(-\frac{-1}{\frac{y + 1}{-1}}\right)} \cdot \left(\left(1 - x\right) \cdot y\right) \]
      10. cancel-sign-sub-inv100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 - \color{blue}{\left(y \cdot 1 + y \cdot \left(-x\right)\right)} \]
      3. *-rgt-identity97.9%

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

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

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

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

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

Alternative 10: 98.5% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 28.6%

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

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

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

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

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

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

        \[\leadsto 1 + \color{blue}{\left(\frac{1}{y + 1} \cdot -1\right)} \cdot \left(\left(1 - x\right) \cdot y\right) \]
      7. associate-/r/28.0%

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

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

        \[\leadsto 1 + \color{blue}{\left(-\frac{-1}{\frac{y + 1}{-1}}\right)} \cdot \left(\left(1 - x\right) \cdot y\right) \]
      10. cancel-sign-sub-inv28.0%

        \[\leadsto \color{blue}{1 - \frac{-1}{\frac{y + 1}{-1}} \cdot \left(\left(1 - x\right) \cdot y\right)} \]
      11. associate-/r/28.5%

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

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

        \[\leadsto 1 - \frac{-1}{\frac{y + 1}{\color{blue}{-\left(1 - x\right) \cdot y}}} \]
      14. associate-/r/28.0%

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

        \[\leadsto 1 - \color{blue}{\left(-\frac{-1}{y + 1} \cdot \left(\left(1 - x\right) \cdot y\right)\right)} \]
      16. associate-/r/28.5%

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

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

        \[\leadsto 1 - \frac{\color{blue}{1}}{\frac{y + 1}{\left(1 - x\right) \cdot y}} \]
      19. associate-/r/28.0%

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

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

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

    if -1 < y < 1

    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. distribute-neg-frac100.0%

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

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

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

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

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

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

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

        \[\leadsto 1 + \color{blue}{\left(-\frac{-1}{\frac{y + 1}{-1}}\right)} \cdot \left(\left(1 - x\right) \cdot y\right) \]
      10. cancel-sign-sub-inv100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 - \color{blue}{\left(y \cdot 1 + y \cdot \left(-x\right)\right)} \]
      3. *-rgt-identity97.9%

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

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

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

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

    if 1 < 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. +-commutative33.2%

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*61.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x + -1 \cdot \frac{x - 1}{y}} \]
      2. mul-1-neg97.6%

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

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

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

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

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

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

Alternative 11: 74.6% accurate, 1.2× speedup?

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

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

\mathbf{elif}\;y \leq -1.22 \cdot 10^{-52}:\\
\;\;\;\;y \cdot x\\

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

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


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

    1. Initial program 31.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*58.5%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y}{1 + y}, \color{blue}{-1} + x, 1\right) \]
      14. +-commutative58.5%

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

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

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

    if -1 < y < -1.22e-52

    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. +-commutative100.0%

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

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

        \[\leadsto \color{blue}{\frac{-\left(1 - x\right)}{\frac{y + 1}{y}}} + 1 \]
      5. *-lft-identity99.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{1 + y}{x}}} \]
    6. Simplified73.0%

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

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

    if -1.22e-52 < y < 0.0389999999999999999

    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. +-commutative100.0%

        \[\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}{\frac{y + 1}{y}}}\right) + 1 \]
      4. distribute-neg-frac99.9%

        \[\leadsto \color{blue}{\frac{-\left(1 - x\right)}{\frac{y + 1}{y}}} + 1 \]
      5. *-lft-identity99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 74.3% accurate, 1.5× speedup?

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

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

\mathbf{elif}\;y \leq -8.5 \cdot 10^{-58}:\\
\;\;\;\;y \cdot x\\

\mathbf{elif}\;y \leq 0.0145:\\
\;\;\;\;1\\

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


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

    1. Initial program 31.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*58.5%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y}{1 + y}, \color{blue}{-1} + x, 1\right) \]
      14. +-commutative58.5%

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

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

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

    if -1 < y < -8.5000000000000004e-58

    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. +-commutative100.0%

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

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

        \[\leadsto \color{blue}{\frac{-\left(1 - x\right)}{\frac{y + 1}{y}}} + 1 \]
      5. *-lft-identity99.3%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{1 + y}{x}}} \]
    6. Simplified73.0%

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

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

    if -8.5000000000000004e-58 < y < 0.0145000000000000007

    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. +-commutative100.0%

        \[\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}{\frac{y + 1}{y}}}\right) + 1 \]
      4. distribute-neg-frac99.9%

        \[\leadsto \color{blue}{\frac{-\left(1 - x\right)}{\frac{y + 1}{y}}} + 1 \]
      5. *-lft-identity99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 74.7% accurate, 2.1× speedup?

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

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

\mathbf{elif}\;y \leq 0.026:\\
\;\;\;\;1\\

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


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

    1. Initial program 31.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
      8. associate-/l*58.5%

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y}{1 + y}, \color{blue}{-1} + x, 1\right) \]
      14. +-commutative58.5%

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

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

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

    if -1 < y < 0.0259999999999999988

    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. +-commutative100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 0.026:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 14: 38.9% 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.4%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{\frac{y + 1}{y}}, -\left(1 - x\right), 1\right)} \]
    8. associate-/l*78.9%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{1} \]
  5. Final simplification35.3%

    \[\leadsto 1 \]

Developer target: 99.7% 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 2023221 
(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))))