Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A

Percentage Accurate: 69.3% → 99.8%
Time: 18.1s
Alternatives: 17
Speedup: 1.0×

Specification

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

\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\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 17 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: 69.3% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

\\
\frac{x \cdot \frac{\frac{y}{x + y}}{y + \left(x + 1\right)}}{x + y}
\end{array}
Derivation
  1. Initial program 71.0%

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-commutative71.0%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\left(x \cdot \frac{1}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\right)} \]
  7. Step-by-step derivation
    1. associate-*r/94.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{x \cdot \frac{\frac{y}{y + x}}{y + \left(x + 1\right)}}{y + x}} \]
  11. Final simplification99.9%

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

Alternative 2: 69.8% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.8 \cdot 10^{-164}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x + y}\\

\mathbf{elif}\;y \leq 10^{+92}:\\
\;\;\;\;x \cdot \frac{y}{\left(x + \left(y + 1\right)\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}\\

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


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

    1. Initial program 71.8%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative71.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\left(x \cdot \frac{1}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\right)} \]
    7. Step-by-step derivation
      1. associate-*r/94.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{y}{\color{blue}{x + 1}}}{y + x} \]
    13. Simplified51.5%

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

    if 2.8000000000000001e-164 < y < 1e92

    1. Initial program 84.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*87.6%

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing

    if 1e92 < y

    1. Initial program 55.9%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative55.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{x}{x + y} \cdot 1}{\color{blue}{1 + \left(y + 2 \cdot x\right)}} \]
    8. Step-by-step derivation
      1. associate-+r+78.3%

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

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

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

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

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

Alternative 3: 95.1% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.22e162

    1. Initial program 60.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\left(x \cdot \frac{1}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\right)} \]
    7. Step-by-step derivation
      1. associate-*r/85.1%

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

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

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

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

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

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

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

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

    if -1.22e162 < x

    1. Initial program 72.8%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative72.8%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 65.6% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.12 \cdot 10^{-142}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x + y}\\

\mathbf{elif}\;y \leq 6.8 \cdot 10^{+165}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\\

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


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

    1. Initial program 72.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\left(x \cdot \frac{1}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\right)} \]
    7. Step-by-step derivation
      1. associate-*r/94.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{y}{1 + x}}}{y + x} \]
    12. Step-by-step derivation
      1. +-commutative52.1%

        \[\leadsto \frac{\frac{y}{\color{blue}{x + 1}}}{y + x} \]
    13. Simplified52.1%

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

    if 1.1199999999999999e-142 < y < 6.80000000000000022e165

    1. Initial program 65.7%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative65.7%

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

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

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

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

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

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

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

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

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

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

    if 6.80000000000000022e165 < y

    1. Initial program 76.9%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative76.9%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\left(x \cdot \frac{1}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\right)} \]
    7. Step-by-step derivation
      1. associate-*r/90.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 65.8% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.9999999999999997e-148

    1. Initial program 67.8%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative67.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\left(x \cdot \frac{1}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\right)} \]
    7. Step-by-step derivation
      1. associate-*r/92.4%

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

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

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

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

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

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

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

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

    if -9.9999999999999997e-148 < x

    1. Initial program 73.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*81.9%

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. associate-/r*63.8%

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

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

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

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

Alternative 6: 66.5% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.2e-148

    1. Initial program 67.8%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative67.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\left(x \cdot \frac{1}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\right)} \]
    7. Step-by-step derivation
      1. associate-*r/92.4%

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

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

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

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

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

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

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

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

    if -4.2e-148 < x

    1. Initial program 73.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative73.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{x}{x + y} \cdot 1}{\color{blue}{1 + \left(y + 2 \cdot x\right)}} \]
    8. Step-by-step derivation
      1. associate-+r+65.1%

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

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

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

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

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

Alternative 7: 47.5% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 61.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative61.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x}} \]
    6. Step-by-step derivation
      1. un-div-inv74.4%

        \[\leadsto \color{blue}{\frac{\frac{y}{y + x}}{x}} \]
    7. Applied egg-rr74.4%

      \[\leadsto \color{blue}{\frac{\frac{y}{y + x}}{x}} \]
    8. Taylor expanded in y around 0 73.9%

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

    if -550 < x < -3.39999999999999999e-150

    1. Initial program 83.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity83.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.39999999999999999e-150 < x

    1. Initial program 73.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*81.9%

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

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

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

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

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

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

Alternative 8: 60.6% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 61.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative61.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x}} \]
    6. Step-by-step derivation
      1. un-div-inv74.4%

        \[\leadsto \color{blue}{\frac{\frac{y}{y + x}}{x}} \]
    7. Applied egg-rr74.4%

      \[\leadsto \color{blue}{\frac{\frac{y}{y + x}}{x}} \]
    8. Taylor expanded in y around 0 73.9%

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

    if -550 < x < -2.1e-125

    1. Initial program 84.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity84.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.1e-125 < x

    1. Initial program 73.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*82.4%

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

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

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

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

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

Alternative 9: 61.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{+162}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\

\mathbf{elif}\;x \leq -2.1 \cdot 10^{-125}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\

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


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

    1. Initial program 60.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{y + x}}{x}} \]
    7. Applied egg-rr92.5%

      \[\leadsto \color{blue}{\frac{\frac{y}{y + x}}{x}} \]
    8. Taylor expanded in y around 0 92.4%

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

    if -2.4999999999999998e162 < x < -2.1e-125

    1. Initial program 71.7%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*79.2%

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

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

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

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

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

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

    if -2.1e-125 < x

    1. Initial program 73.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*82.4%

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

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

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

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

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

Alternative 10: 61.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.7 \cdot 10^{+163}:\\
\;\;\;\;\frac{\frac{y}{x}}{x}\\

\mathbf{elif}\;x \leq -1.6 \cdot 10^{-125}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\

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


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

    1. Initial program 61.9%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative61.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x}} \]
    6. Step-by-step derivation
      1. un-div-inv94.9%

        \[\leadsto \color{blue}{\frac{\frac{y}{y + x}}{x}} \]
    7. Applied egg-rr94.9%

      \[\leadsto \color{blue}{\frac{\frac{y}{y + x}}{x}} \]
    8. Taylor expanded in y around 0 94.8%

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

    if -4.70000000000000019e163 < x < -1.5999999999999999e-125

    1. Initial program 70.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*79.5%

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

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

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

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

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

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

    if -1.5999999999999999e-125 < x

    1. Initial program 73.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*82.4%

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. associate-/r*64.3%

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

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

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

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

Alternative 11: 99.8% accurate, 1.0× speedup?

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

\\
\frac{y}{x + y} \cdot \frac{\frac{x}{x + y}}{x + \left(y + 1\right)}
\end{array}
Derivation
  1. Initial program 71.0%

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-commutative71.0%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\left(x \cdot \frac{1}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\right)} \]
  7. Step-by-step derivation
    1. associate-*r/94.4%

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

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

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

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

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

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

    \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + \left(y + 1\right)}} \]
  9. Final simplification99.8%

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

Alternative 12: 61.9% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-125}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{x + y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.00000000000000002e-125

    1. Initial program 67.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\left(x \cdot \frac{1}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\right)} \]
    7. Step-by-step derivation
      1. associate-*r/92.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{y}{1 + x}}}{y + x} \]
    12. Step-by-step derivation
      1. +-commutative65.8%

        \[\leadsto \frac{\frac{y}{\color{blue}{x + 1}}}{y + x} \]
    13. Simplified65.8%

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

    if -2.00000000000000002e-125 < x

    1. Initial program 73.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*82.4%

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. associate-/r*64.3%

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

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

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

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

Alternative 13: 61.7% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-125}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.1e-125

    1. Initial program 67.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\left(x \cdot \frac{1}{\left(x + y\right) \cdot \left(y + \left(x + 1\right)\right)}\right)} \]
    7. Step-by-step derivation
      1. associate-*r/92.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    13. Simplified65.3%

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

    if -2.1e-125 < x

    1. Initial program 73.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*82.4%

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. associate-/r*64.3%

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

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

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

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

Alternative 14: 45.6% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -550:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
(FPCore (x y) :precision binary64 (if (<= x -550.0) (/ (/ y x) x) (/ x y)))
double code(double x, double y) {
	double tmp;
	if (x <= -550.0) {
		tmp = (y / x) / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-550.0d0)) then
        tmp = (y / x) / x
    else
        tmp = x / y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -550.0) {
		tmp = (y / x) / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -550.0:
		tmp = (y / x) / x
	else:
		tmp = x / y
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -550.0)
		tmp = Float64(Float64(y / x) / x);
	else
		tmp = Float64(x / y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -550.0)
		tmp = (y / x) / x;
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -550.0], N[(N[(y / x), $MachinePrecision] / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 61.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative61.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x}} \]
    6. Step-by-step derivation
      1. un-div-inv74.4%

        \[\leadsto \color{blue}{\frac{\frac{y}{y + x}}{x}} \]
    7. Applied egg-rr74.4%

      \[\leadsto \color{blue}{\frac{\frac{y}{y + x}}{x}} \]
    8. Taylor expanded in y around 0 73.9%

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

    if -550 < x

    1. Initial program 74.7%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*83.7%

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

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

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

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

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

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

Alternative 15: 27.7% accurate, 2.1× speedup?

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

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

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


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

    1. Initial program 61.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative61.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x}} \]
    6. Step-by-step derivation
      1. un-div-inv74.4%

        \[\leadsto \color{blue}{\frac{\frac{y}{y + x}}{x}} \]
    7. Applied egg-rr74.4%

      \[\leadsto \color{blue}{\frac{\frac{y}{y + x}}{x}} \]
    8. Taylor expanded in y around inf 5.8%

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

    if -780 < x

    1. Initial program 74.7%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*83.7%

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

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

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

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

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

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

Alternative 16: 4.2% accurate, 5.7× speedup?

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

\\
\frac{1}{x}
\end{array}
Derivation
  1. Initial program 71.0%

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-commutative71.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x}} \]
  6. Step-by-step derivation
    1. un-div-inv38.2%

      \[\leadsto \color{blue}{\frac{\frac{y}{y + x}}{x}} \]
  7. Applied egg-rr38.2%

    \[\leadsto \color{blue}{\frac{\frac{y}{y + x}}{x}} \]
  8. Taylor expanded in y around inf 4.3%

    \[\leadsto \color{blue}{\frac{1}{x}} \]
  9. Final simplification4.3%

    \[\leadsto \frac{1}{x} \]
  10. Add Preprocessing

Alternative 17: 3.5% accurate, 17.0× speedup?

\[\begin{array}{l} \\ 1 \end{array} \]
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
	return 1.0;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0
end function
public static double code(double x, double y) {
	return 1.0;
}
def code(x, y):
	return 1.0
function code(x, y)
	return 1.0
end
function tmp = code(x, y)
	tmp = 1.0;
end
code[x_, y_] := 1.0
\begin{array}{l}

\\
1
\end{array}
Derivation
  1. Initial program 71.0%

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-un-lft-identity71.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{1} \]
  9. Final simplification3.6%

    \[\leadsto 1 \]
  10. Add Preprocessing

Developer target: 99.8% accurate, 0.9× speedup?

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

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

Reproduce

?
herbie shell --seed 2024044 
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))

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