?

Average Error: 31.07% → 0.22%
Time: 41.4s
Precision: binary64

?

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

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


\end{array}

Error?

Target

Original31.07%
Target0.22%
Herbie0.22%
\[\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}} \]

Derivation?

  1. Initial program 31.07

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Applied egg-rr0.16

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

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

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;y \ne 0:\\ \;\;\;\;\frac{\frac{\frac{x}{x + y}}{y + \left(x + 1\right)}}{\frac{x + y}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x}{x + y} \cdot y}{y + \left(x + 1\right)}}{x + y}\\ } \end{array}} \]
  7. Simplified0.22

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;y \ne 0:\\ \;\;\;\;\frac{\frac{\frac{x}{x + y}}{\left(y + x\right) + 1}}{\frac{x + y}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{x \cdot y}{x + y}}{\left(y + x\right) + 1}}{x + y}\\ } \end{array}} \]
    Proof

Reproduce?

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

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

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