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

Percentage Accurate: 68.3% → 99.8%
Time: 16.2s
Alternatives: 15
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 15 alternatives:

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

Initial Program: 68.3% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

      \[\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. times-frac92.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 69.9% accurate, 0.6× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{x}{y}\\


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

    1. Initial program 66.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.80000000000000018e-199 < y < 4.60000000000000026e98

    1. Initial program 88.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. associate-/l*93.0%

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

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

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

    if 4.60000000000000026e98 < y

    1. Initial program 47.3%

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

        \[\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. times-frac83.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 82.8% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;y \leq 1.4 \cdot 10^{+124}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot t\_0}\\

\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{x}{y}\\


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

    1. Initial program 53.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.99999999999999984e88 < y < 1.4e124

    1. Initial program 77.0%

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

        \[\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. times-frac98.1%

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

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

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

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

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

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

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

    if 1.4e124 < y

    1. Initial program 48.9%

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

        \[\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. times-frac83.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 91.7% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 46.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*46.2%

        \[\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. times-frac75.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.49999999999999996e86 < x

    1. Initial program 71.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. associate-/l*82.5%

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-un-lft-identity82.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 91.7% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 46.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*46.2%

        \[\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. times-frac75.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.7000000000000001e87 < x

    1. Initial program 71.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. associate-/l*82.5%

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-un-lft-identity82.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 65.2% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 69.2%

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

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

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

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

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

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

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

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

    if 3.10000000000000007e-110 < y

    1. Initial program 65.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 64.5% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 69.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*81.1%

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

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

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

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

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

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

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

    if 3.30000000000000004e-107 < y

    1. Initial program 64.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. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*64.6%

        \[\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. times-frac89.2%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 45.3% accurate, 1.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3 \cdot 10^{-108}:\\
\;\;\;\;\frac{y}{x}\\

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


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

    1. Initial program 69.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*81.1%

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

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

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

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

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

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

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

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

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

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

    if 2.99999999999999993e-108 < y

    1. Initial program 64.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. associate-/l*79.2%

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

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

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

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

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

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

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

Alternative 9: 59.5% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 8 \cdot 10^{-107}:\\ \;\;\;\;\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 8e-107) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
double code(double x, double y) {
	double tmp;
	if (y <= 8e-107) {
		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 <= 8d-107) 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 <= 8e-107) {
		tmp = y / (x * (x + 1.0));
	} else {
		tmp = x / (y * (y + 1.0));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 8e-107:
		tmp = y / (x * (x + 1.0))
	else:
		tmp = x / (y * (y + 1.0))
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 8e-107)
		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 <= 8e-107)
		tmp = y / (x * (x + 1.0));
	else
		tmp = x / (y * (y + 1.0));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 8e-107], 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 8 \cdot 10^{-107}:\\
\;\;\;\;\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 2 regimes
  2. if y < 8e-107

    1. Initial program 69.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*81.1%

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

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

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

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

    if 8e-107 < y

    1. Initial program 64.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. associate-/l*79.2%

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

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

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

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

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

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

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

Alternative 10: 60.1% accurate, 1.4× speedup?

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

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

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


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

    1. Initial program 69.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*81.1%

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

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

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

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

    if 1.9e-106 < y

    1. Initial program 64.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. associate-/l*79.2%

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

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

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

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

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

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

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

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

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

Alternative 11: 60.8% accurate, 1.4× speedup?

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

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

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


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

    1. Initial program 69.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*81.1%

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

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

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

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

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

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

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

    if 1.9e-106 < y

    1. Initial program 64.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. associate-/l*79.2%

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

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

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

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

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

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

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

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

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

Alternative 12: 33.7% accurate, 2.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.8 \cdot 10^{-107}:\\
\;\;\;\;\frac{y}{x}\\

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


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

    1. Initial program 69.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*81.1%

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

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

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

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

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

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

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

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

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

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

    if 9.79999999999999959e-107 < y

    1. Initial program 64.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. associate-/l*79.2%

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

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

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

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

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

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

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

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

Alternative 13: 26.8% 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 67.8%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{x}{y}} \]
  9. Final simplification25.0%

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

Alternative 14: 3.6% accurate, 8.5× speedup?

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

\\
-x
\end{array}
Derivation
  1. Initial program 67.8%

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{-1 \cdot x} \]
  10. Step-by-step derivation
    1. neg-mul-13.7%

      \[\leadsto \color{blue}{-x} \]
  11. Simplified3.7%

    \[\leadsto \color{blue}{-x} \]
  12. Final simplification3.7%

    \[\leadsto -x \]
  13. Add Preprocessing

Alternative 15: 3.5% accurate, 17.0× speedup?

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

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

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

      \[\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. times-frac92.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto 1 \]
  10. Add Preprocessing

Developer target: 99.8% accurate, 0.9× speedup?

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

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

Reproduce

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

  :alt
  (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))

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