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

Percentage Accurate: 69.6% → 99.8%
Time: 13.5s
Alternatives: 18
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 18 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.6% 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{\frac{y}{y + x} \cdot \frac{x}{x + \left(y + 1\right)}}{y + x} \end{array} \]
(FPCore (x y)
 :precision binary64
 (/ (* (/ y (+ y x)) (/ x (+ x (+ y 1.0)))) (+ y x)))
double code(double x, double y) {
	return ((y / (y + x)) * (x / (x + (y + 1.0)))) / (y + x);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = ((y / (y + x)) * (x / (x + (y + 1.0d0)))) / (y + x)
end function
public static double code(double x, double y) {
	return ((y / (y + x)) * (x / (x + (y + 1.0)))) / (y + x);
}
def code(x, y):
	return ((y / (y + x)) * (x / (x + (y + 1.0)))) / (y + x)
function code(x, y)
	return Float64(Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(x + Float64(y + 1.0)))) / Float64(y + x))
end
function tmp = code(x, y)
	tmp = ((y / (y + x)) * (x / (x + (y + 1.0)))) / (y + x);
end
code[x_, y_] := N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{y}{y + x} \cdot \frac{x}{x + \left(y + 1\right)}}{y + x}
\end{array}
Derivation
  1. Initial program 66.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. Step-by-step derivation
    1. times-frac85.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 84.8% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 67.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. Step-by-step derivation
      1. times-frac83.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4e-14 < y < 1.25000000000000001e154

    1. Initial program 63.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. times-frac95.8%

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

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

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

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

    if 1.25000000000000001e154 < y

    1. Initial program 64.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. times-frac88.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 69.4% accurate, 0.9× speedup?

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

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

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

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

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


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

    1. Initial program 64.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. times-frac82.1%

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

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

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

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

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

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

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

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

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

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

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

    if -340 < x < -6.5000000000000002e-178

    1. Initial program 85.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*85.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.5000000000000002e-178 < x < -2.79999999999999991e-205

    1. Initial program 50.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. times-frac51.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.79999999999999991e-205 < x

    1. Initial program 64.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. Step-by-step derivation
      1. times-frac84.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 83.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\frac{x}{y + x}}{y + x}\\
\mathbf{if}\;x \leq -1500000:\\
\;\;\;\;t_0 \cdot \frac{y}{x}\\

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


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

    1. Initial program 64.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. times-frac82.1%

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

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

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

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

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

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

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

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

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

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

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

    if -1.5e6 < x

    1. Initial program 67.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. times-frac86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1500000:\\ \;\;\;\;\frac{\frac{x}{y + x}}{y + x} \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{y + x} \cdot \frac{y}{y + 1}\\ \end{array} \]

Alternative 5: 80.6% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 67.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. Step-by-step derivation
      1. times-frac83.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.5e-12 < y

    1. Initial program 63.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. Step-by-step derivation
      1. times-frac91.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 99.8% accurate, 1.0× speedup?

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

\\
\frac{\frac{x}{y + x}}{y + x} \cdot \frac{y}{y + \left(x + 1\right)}
\end{array}
Derivation
  1. Initial program 66.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. Step-by-step derivation
    1. times-frac85.4%

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 61.3% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 65.6%

      \[\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. times-frac81.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.4e-116 < y

    1. Initial program 69.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. Step-by-step derivation
      1. times-frac92.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 60.5% accurate, 1.3× speedup?

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

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

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

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

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


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

    1. Initial program 57.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. times-frac80.7%

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

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

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

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

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

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

    if -1.7500000000000001e43 < y < 2.7999999999999999e-116

    1. Initial program 69.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. Step-by-step derivation
      1. times-frac82.4%

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

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

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

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

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

    if 2.7999999999999999e-116 < y < 4.6e42

    1. Initial program 96.6%

      \[\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. times-frac99.4%

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

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

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

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

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

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

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

    if 4.6e42 < y

    1. Initial program 59.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. Step-by-step derivation
      1. times-frac90.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.75 \cdot 10^{+43}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{-116}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{+42}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + x}\\ \end{array} \]

Alternative 9: 59.5% accurate, 1.5× speedup?

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

\mathbf{elif}\;y \leq 5.9 \cdot 10^{-119}:\\
\;\;\;\;\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 y < -1.21999999999999988e49

    1. Initial program 57.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. times-frac80.7%

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

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

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

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

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

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

    if -1.21999999999999988e49 < y < 5.9000000000000002e-119

    1. Initial program 69.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. Step-by-step derivation
      1. times-frac82.4%

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

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

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

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

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

    if 5.9000000000000002e-119 < y

    1. Initial program 69.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. Step-by-step derivation
      1. times-frac92.7%

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

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

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

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

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

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

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

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

Alternative 10: 60.6% accurate, 1.5× speedup?

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

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

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

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


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

    1. Initial program 65.6%

      \[\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. times-frac81.8%

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

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

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

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

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

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

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

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

    if 6.99999999999999968e-116 < y < 4.6e42

    1. Initial program 96.6%

      \[\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. times-frac99.4%

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

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

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

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

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

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

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

    if 4.6e42 < y

    1. Initial program 59.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. Step-by-step derivation
      1. times-frac90.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 60.7% accurate, 1.5× speedup?

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

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

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


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

    1. Initial program 65.6%

      \[\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. times-frac81.8%

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

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

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

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

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

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

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

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

    if 6.5000000000000001e-116 < y

    1. Initial program 69.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. Step-by-step derivation
      1. times-frac92.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 6.5 \cdot 10^{-116}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\ \end{array} \]

Alternative 12: 61.0% accurate, 1.5× speedup?

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

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

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


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

    1. Initial program 65.6%

      \[\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. times-frac81.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.99999999999999968e-116 < y

    1. Initial program 69.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. Step-by-step derivation
      1. times-frac92.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 7 \cdot 10^{-116}:\\ \;\;\;\;\frac{\frac{y}{x + 1}}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\ \end{array} \]

Alternative 13: 44.0% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{-33}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\

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


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

    1. Initial program 65.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. Step-by-step derivation
      1. times-frac84.0%

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

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

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

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

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

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

    if -1.2e-33 < x

    1. Initial program 67.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. times-frac85.8%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.2 \cdot 10^{-33}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 14: 62.2% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 64.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. times-frac82.1%

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

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

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

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

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

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

    if -8.8e8 < x

    1. Initial program 67.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. times-frac86.3%

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

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

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

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

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

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

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

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

Alternative 15: 27.0% accurate, 3.4× speedup?

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

\\
\frac{x}{y + x}
\end{array}
Derivation
  1. Initial program 66.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. Step-by-step derivation
    1. times-frac85.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{x}}{x + y} \]
  10. Final simplification29.4%

    \[\leadsto \frac{x}{y + x} \]

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 66.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. Step-by-step derivation
    1. times-frac85.4%

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{x}} \]
  6. Final simplification4.0%

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

Alternative 17: 4.3% accurate, 5.7× speedup?

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

\\
\frac{1}{y}
\end{array}
Derivation
  1. Initial program 66.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. Step-by-step derivation
    1. times-frac85.4%

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{y}} \]
  6. Final simplification4.3%

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

Alternative 18: 26.6% accurate, 5.7× speedup?

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

\\
\frac{x}{y}
\end{array}
Derivation
  1. Initial program 66.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. Step-by-step derivation
    1. times-frac85.4%

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

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

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

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

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

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

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

    \[\leadsto \frac{x}{\color{blue}{y}} \]
  8. Final simplification29.0%

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

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 2023310 
(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))))