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

Percentage Accurate: 69.2% → 99.8%
Time: 12.5s
Alternatives: 24
Speedup: 1.6×

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 24 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.2% 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, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{\frac{\frac{y}{\left(y + x\right) + 1}}{y + x} \cdot x}{y + x} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (/ (* (/ (/ y (+ (+ y x) 1.0)) (+ y x)) x) (+ y x)))
assert(x < y);
double code(double x, double y) {
	return (((y / ((y + x) + 1.0)) / (y + x)) * x) / (y + x);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (((y / ((y + x) + 1.0d0)) / (y + x)) * x) / (y + x)
end function
assert x < y;
public static double code(double x, double y) {
	return (((y / ((y + x) + 1.0)) / (y + x)) * x) / (y + x);
}
[x, y] = sort([x, y])
def code(x, y):
	return (((y / ((y + x) + 1.0)) / (y + x)) * x) / (y + x)
x, y = sort([x, y])
function code(x, y)
	return Float64(Float64(Float64(Float64(y / Float64(Float64(y + x) + 1.0)) / Float64(y + x)) * x) / Float64(y + x))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = (((y / ((y + x) + 1.0)) / (y + x)) * x) / (y + x);
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(N[(N[(N[(y / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{\frac{y}{\left(y + x\right) + 1}}{y + x} \cdot x}{y + x}
\end{array}
Derivation
  1. Initial program 67.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. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    3. lift-*.f64N/A

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
    4. times-fracN/A

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
    5. *-commutativeN/A

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) + 1} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
    6. lift-*.f64N/A

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

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

      \[\leadsto \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1} \cdot \frac{x}{x + y}}{x + y}} \]
    9. lower-/.f64N/A

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(1 + x\right) + y}}}{y + x} \]
    3. lift-/.f64N/A

      \[\leadsto \frac{\color{blue}{\frac{x}{y + x}} \cdot \frac{y}{\left(1 + x\right) + y}}{y + x} \]
    4. lift-/.f64N/A

      \[\leadsto \frac{\frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(1 + x\right) + y}}}{y + x} \]
    5. clear-numN/A

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

      \[\leadsto \frac{\color{blue}{\frac{x \cdot 1}{\left(y + x\right) \cdot \frac{\left(1 + x\right) + y}{y}}}}{y + x} \]
    7. *-commutativeN/A

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot x}}{\left(y + x\right) \cdot \frac{\left(1 + x\right) + y}{y}}}{y + x} \]
    8. *-lft-identityN/A

      \[\leadsto \frac{\frac{\color{blue}{x}}{\left(y + x\right) \cdot \frac{\left(1 + x\right) + y}{y}}}{y + x} \]
    9. div-invN/A

      \[\leadsto \frac{\color{blue}{x \cdot \frac{1}{\left(y + x\right) \cdot \frac{\left(1 + x\right) + y}{y}}}}{y + x} \]
    10. clear-numN/A

      \[\leadsto \frac{x \cdot \frac{1}{\left(y + x\right) \cdot \color{blue}{\frac{1}{\frac{y}{\left(1 + x\right) + y}}}}}{y + x} \]
    11. lift-/.f64N/A

      \[\leadsto \frac{x \cdot \frac{1}{\left(y + x\right) \cdot \frac{1}{\color{blue}{\frac{y}{\left(1 + x\right) + y}}}}}{y + x} \]
    12. div-invN/A

      \[\leadsto \frac{x \cdot \frac{1}{\color{blue}{\frac{y + x}{\frac{y}{\left(1 + x\right) + y}}}}}{y + x} \]
    13. clear-numN/A

      \[\leadsto \frac{x \cdot \color{blue}{\frac{\frac{y}{\left(1 + x\right) + y}}{y + x}}}{y + x} \]
    14. lower-*.f64N/A

      \[\leadsto \frac{\color{blue}{x \cdot \frac{\frac{y}{\left(1 + x\right) + y}}{y + x}}}{y + x} \]
    15. lower-/.f6499.8

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

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

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

Alternative 2: 95.5% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 9.5 \cdot 10^{+159}:\\ \;\;\;\;\frac{\frac{y}{y + x} \cdot x}{\left(\left(1 + x\right) + y\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{\mathsf{fma}\left(2 + \frac{1}{y}, x, 1 + y\right)}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y 9.5e+159)
   (/ (* (/ y (+ y x)) x) (* (+ (+ 1.0 x) y) (+ y x)))
   (/ (/ x (+ y x)) (fma (+ 2.0 (/ 1.0 y)) x (+ 1.0 y)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 9.5e+159) {
		tmp = ((y / (y + x)) * x) / (((1.0 + x) + y) * (y + x));
	} else {
		tmp = (x / (y + x)) / fma((2.0 + (1.0 / y)), x, (1.0 + y));
	}
	return tmp;
}
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 9.5e+159)
		tmp = Float64(Float64(Float64(y / Float64(y + x)) * x) / Float64(Float64(Float64(1.0 + x) + y) * Float64(y + x)));
	else
		tmp = Float64(Float64(x / Float64(y + x)) / fma(Float64(2.0 + Float64(1.0 / y)), x, Float64(1.0 + y)));
	end
	return tmp
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 9.5e+159], N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / N[(N[(N[(1.0 + x), $MachinePrecision] + y), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(2.0 + N[(1.0 / y), $MachinePrecision]), $MachinePrecision] * x + N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.5 \cdot 10^{+159}:\\
\;\;\;\;\frac{\frac{y}{y + x} \cdot x}{\left(\left(1 + x\right) + y\right) \cdot \left(y + x\right)}\\

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


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

    1. Initial program 70.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. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      5. lift-*.f64N/A

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

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      7. times-fracN/A

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

        \[\leadsto \color{blue}{\frac{\frac{y}{x + y} \cdot x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      9. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{y}{x + y} \cdot x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      10. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{y}{x + y} \cdot x}}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      11. lower-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{y}{x + y}} \cdot x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      12. lift-+.f64N/A

        \[\leadsto \frac{\frac{y}{\color{blue}{x + y}} \cdot x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      13. +-commutativeN/A

        \[\leadsto \frac{\frac{y}{\color{blue}{y + x}} \cdot x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      14. lower-+.f64N/A

        \[\leadsto \frac{\frac{y}{\color{blue}{y + x}} \cdot x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      15. *-commutativeN/A

        \[\leadsto \frac{\frac{y}{y + x} \cdot x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
      16. lower-*.f6496.1

        \[\leadsto \frac{\frac{y}{y + x} \cdot x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(x + y\right)}} \]
      17. lift-+.f64N/A

        \[\leadsto \frac{\frac{y}{y + x} \cdot x}{\color{blue}{\left(\left(x + y\right) + 1\right)} \cdot \left(x + y\right)} \]
      18. +-commutativeN/A

        \[\leadsto \frac{\frac{y}{y + x} \cdot x}{\color{blue}{\left(1 + \left(x + y\right)\right)} \cdot \left(x + y\right)} \]
      19. lift-+.f64N/A

        \[\leadsto \frac{\frac{y}{y + x} \cdot x}{\left(1 + \color{blue}{\left(x + y\right)}\right) \cdot \left(x + y\right)} \]
      20. associate-+r+N/A

        \[\leadsto \frac{\frac{y}{y + x} \cdot x}{\color{blue}{\left(\left(1 + x\right) + y\right)} \cdot \left(x + y\right)} \]
      21. lower-+.f64N/A

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

        \[\leadsto \frac{\frac{y}{y + x} \cdot x}{\left(\color{blue}{\left(1 + x\right)} + y\right) \cdot \left(x + y\right)} \]
      23. lift-+.f64N/A

        \[\leadsto \frac{\frac{y}{y + x} \cdot x}{\left(\left(1 + x\right) + y\right) \cdot \color{blue}{\left(x + y\right)}} \]
      24. +-commutativeN/A

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

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

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

    if 9.5000000000000003e159 < 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. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. times-fracN/A

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      5. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) + 1} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      6. lift-*.f64N/A

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

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

        \[\leadsto \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1} \cdot \frac{x}{x + y}}{x + y}} \]
      9. lower-/.f64N/A

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(1 + x\right) + y}}}{y + x} \]
      3. lift-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{x}{y + x}} \cdot \frac{y}{\left(1 + x\right) + y}}{y + x} \]
      4. lift-/.f64N/A

        \[\leadsto \frac{\frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(1 + x\right) + y}}}{y + x} \]
      5. clear-numN/A

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

        \[\leadsto \frac{\color{blue}{\frac{x \cdot 1}{\left(y + x\right) \cdot \frac{\left(1 + x\right) + y}{y}}}}{y + x} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\frac{\color{blue}{1 \cdot x}}{\left(y + x\right) \cdot \frac{\left(1 + x\right) + y}{y}}}{y + x} \]
      8. *-lft-identityN/A

        \[\leadsto \frac{\frac{\color{blue}{x}}{\left(y + x\right) \cdot \frac{\left(1 + x\right) + y}{y}}}{y + x} \]
      9. div-invN/A

        \[\leadsto \frac{\color{blue}{x \cdot \frac{1}{\left(y + x\right) \cdot \frac{\left(1 + x\right) + y}{y}}}}{y + x} \]
      10. clear-numN/A

        \[\leadsto \frac{x \cdot \frac{1}{\left(y + x\right) \cdot \color{blue}{\frac{1}{\frac{y}{\left(1 + x\right) + y}}}}}{y + x} \]
      11. lift-/.f64N/A

        \[\leadsto \frac{x \cdot \frac{1}{\left(y + x\right) \cdot \frac{1}{\color{blue}{\frac{y}{\left(1 + x\right) + y}}}}}{y + x} \]
      12. div-invN/A

        \[\leadsto \frac{x \cdot \frac{1}{\color{blue}{\frac{y + x}{\frac{y}{\left(1 + x\right) + y}}}}}{y + x} \]
      13. clear-numN/A

        \[\leadsto \frac{x \cdot \color{blue}{\frac{\frac{y}{\left(1 + x\right) + y}}{y + x}}}{y + x} \]
      14. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{x \cdot \frac{\frac{y}{\left(1 + x\right) + y}}{y + x}}}{y + x} \]
      15. lower-/.f6499.9

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

      \[\leadsto \frac{\color{blue}{x \cdot \frac{\frac{y}{\left(x + y\right) + 1}}{x + y}}}{y + x} \]
    7. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot \frac{\frac{y}{\left(x + y\right) + 1}}{x + y}}{y + x}} \]
      2. lift-*.f64N/A

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

        \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{\frac{y}{\left(x + y\right) + 1}}{x + y}} \]
      4. lift-+.f64N/A

        \[\leadsto \frac{x}{\color{blue}{y + x}} \cdot \frac{\frac{y}{\left(x + y\right) + 1}}{x + y} \]
      5. lift-/.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{x + y}} \]
      6. lift-/.f64N/A

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

        \[\leadsto \frac{x}{y + x} \cdot \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      9. +-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      10. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      11. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(\left(x + y\right) + 1\right)}} \]
      12. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \left(\color{blue}{\left(x + y\right)} + 1\right)} \]
      13. associate-+l+N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      14. +-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \left(x + \color{blue}{\left(1 + y\right)}\right)} \]
      15. associate-+l+N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(\left(x + 1\right) + y\right)}} \]
      16. +-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \left(\color{blue}{\left(1 + x\right)} + y\right)} \]
      17. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \left(\color{blue}{\left(1 + x\right)} + y\right)} \]
      18. lift-+.f64N/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(\left(1 + x\right) + y\right)}} \]
      19. *-commutativeN/A

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(\left(1 + x\right) + y\right) \cdot \left(y + x\right)}} \]
      20. lift-*.f64N/A

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

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

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + \left(y + x \cdot \left(2 + \frac{1}{y}\right)\right)}} \]
    10. Step-by-step derivation
      1. +-commutativeN/A

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

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

        \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{x \cdot \left(2 + \frac{1}{y}\right) + \left(y + 1\right)}} \]
      4. *-commutativeN/A

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

        \[\leadsto \frac{\frac{x}{y + x}}{\left(2 + \frac{1}{y}\right) \cdot x + \color{blue}{\left(1 + y\right)}} \]
      6. lower-fma.f64N/A

        \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{\mathsf{fma}\left(2 + \frac{1}{y}, x, 1 + y\right)}} \]
      7. +-commutativeN/A

        \[\leadsto \frac{\frac{x}{y + x}}{\mathsf{fma}\left(\color{blue}{\frac{1}{y} + 2}, x, 1 + y\right)} \]
      8. lower-+.f64N/A

        \[\leadsto \frac{\frac{x}{y + x}}{\mathsf{fma}\left(\color{blue}{\frac{1}{y} + 2}, x, 1 + y\right)} \]
      9. lower-/.f64N/A

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

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

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

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

Developer Target 1: 99.8% accurate, 0.6× 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 2024230 
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
  :precision binary64

  :alt
  (! :herbie-platform default (/ (/ (/ x (+ (+ y 1) x)) (+ y x)) (/ 1 (/ y (+ y x)))))

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