Average Error: 19.2 → 0.1
Time: 11.7s
Precision: binary64
Cost: 1088
\[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
\[\frac{x \cdot \frac{\frac{y}{x + y}}{y + \left(x + 1\right)}}{x + y} \]
(FPCore (x y)
 :precision binary64
 (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))
(FPCore (x y)
 :precision binary64
 (/ (* x (/ (/ y (+ x y)) (+ y (+ x 1.0)))) (+ x y)))
double code(double x, double y) {
	return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
double code(double x, double y) {
	return (x * ((y / (x + y)) / (y + (x + 1.0)))) / (x + y);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0d0))
end function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x * ((y / (x + y)) / (y + (x + 1.0d0)))) / (x + y)
end function
public static double code(double x, double y) {
	return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
}
public static double code(double x, double y) {
	return (x * ((y / (x + y)) / (y + (x + 1.0)))) / (x + y);
}
def code(x, y):
	return (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0))
def code(x, y):
	return (x * ((y / (x + y)) / (y + (x + 1.0)))) / (x + y)
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)
	return Float64(Float64(x * Float64(Float64(y / Float64(x + y)) / Float64(y + Float64(x + 1.0)))) / Float64(x + y))
end
function tmp = code(x, y)
	tmp = (x * y) / (((x + y) * (x + y)) * ((x + y) + 1.0));
end
function tmp = code(x, y)
	tmp = (x * ((y / (x + y)) / (y + (x + 1.0)))) / (x + y);
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_] := N[(N[(x * N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\frac{x \cdot \frac{\frac{y}{x + y}}{y + \left(x + 1\right)}}{x + y}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original19.2
Target0.1
Herbie0.1
\[\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}} \]

Derivation

  1. Initial program 19.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. Applied egg-rr4.0

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

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

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

Alternatives

Alternative 1
Error5.3
Cost1220
\[\begin{array}{l} t_0 := \frac{y}{x + y}\\ \mathbf{if}\;x \leq -3.953410181335054 \cdot 10^{+68}:\\ \;\;\;\;\frac{t_0}{1 + \left(x + y \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{t_0}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}\\ \end{array} \]
Alternative 2
Error21.7
Cost1096
\[\begin{array}{l} \mathbf{if}\;x \leq -8.937224149169489 \cdot 10^{+157}:\\ \;\;\;\;\frac{\frac{y}{x + y}}{1 + \left(x + y \cdot 2\right)}\\ \mathbf{elif}\;x \leq -7.897542295876651 \cdot 10^{-121}:\\ \;\;\;\;\frac{y}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{1}{y + \left(x + 1\right)}}{x + y}\\ \end{array} \]
Alternative 3
Error0.1
Cost1088
\[\frac{y}{x + y} \cdot \frac{\frac{x}{x + y}}{\left(x + y\right) + 1} \]
Alternative 4
Error24.7
Cost964
\[\begin{array}{l} \mathbf{if}\;x \leq -7.897542295876651 \cdot 10^{-121}:\\ \;\;\;\;\frac{\frac{y}{x + y}}{1 + \left(x + y \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{1}{y + 1}\\ \end{array} \]
Alternative 5
Error24.5
Cost964
\[\begin{array}{l} \mathbf{if}\;x \leq -7.897542295876651 \cdot 10^{-121}:\\ \;\;\;\;\frac{\frac{y}{x + y}}{1 + \left(x + y \cdot 2\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{1}{y + \left(x + 1\right)}}{x + y}\\ \end{array} \]
Alternative 6
Error23.9
Cost844
\[\begin{array}{l} t_0 := \frac{\frac{y}{x}}{x + 1}\\ \mathbf{if}\;y \leq 4.3999721589381234 \cdot 10^{-74}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 7.775629882489578 \cdot 10^{-5}:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{elif}\;y \leq 3.230507962694233 \cdot 10^{+31}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]
Alternative 7
Error23.9
Cost844
\[\begin{array}{l} t_0 := \frac{\frac{y}{x}}{x + 1}\\ \mathbf{if}\;y \leq 4.3999721589381234 \cdot 10^{-74}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 7.775629882489578 \cdot 10^{-5}:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{elif}\;y \leq 1.8617215179976599 \cdot 10^{+24}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{x + y}\\ \end{array} \]
Alternative 8
Error23.9
Cost844
\[\begin{array}{l} \mathbf{if}\;y \leq 4.3999721589381234 \cdot 10^{-74}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{elif}\;y \leq 7.775629882489578 \cdot 10^{-5}:\\ \;\;\;\;\frac{x}{y} - x\\ \mathbf{elif}\;y \leq 7.339461142889711 \cdot 10^{+28}:\\ \;\;\;\;\frac{\frac{y}{x + y}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{x + y}\\ \end{array} \]
Alternative 9
Error25.0
Cost836
\[\begin{array}{l} \mathbf{if}\;x \leq -7.897542295876651 \cdot 10^{-121}:\\ \;\;\;\;\frac{\frac{y}{x + y}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{1}{y + 1}\\ \end{array} \]
Alternative 10
Error29.7
Cost716
\[\begin{array}{l} \mathbf{if}\;x \leq -145.98319200575563:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq -7.897542295876651 \cdot 10^{-121}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{elif}\;x \leq 1.228859111833597 \cdot 10^{-221}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]
Alternative 11
Error25.5
Cost708
\[\begin{array}{l} \mathbf{if}\;x \leq -7.897542295876651 \cdot 10^{-121}:\\ \;\;\;\;\frac{\frac{y}{x + y}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]
Alternative 12
Error25.0
Cost708
\[\begin{array}{l} \mathbf{if}\;x \leq -7.897542295876651 \cdot 10^{-121}:\\ \;\;\;\;\frac{\frac{y}{x + y}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{x + y}\\ \end{array} \]
Alternative 13
Error34.8
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -145.98319200575563:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq -7.897542295876651 \cdot 10^{-121}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 14
Error25.6
Cost580
\[\begin{array}{l} \mathbf{if}\;x \leq -7.897542295876651 \cdot 10^{-121}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]
Alternative 15
Error34.8
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -145.98319200575563:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq -7.897542295876651 \cdot 10^{-121}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 16
Error41.9
Cost324
\[\begin{array}{l} \mathbf{if}\;x \leq -7.897542295876651 \cdot 10^{-121}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 17
Error47.1
Cost192
\[\frac{x}{y} \]
Alternative 18
Error61.8
Cost64
\[1 \]

Error

Reproduce

herbie shell --seed 2022317 
(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))))